Core/AI: Cleaning up hungarian notation
This commit is contained in:
@@ -214,23 +214,23 @@ void SmartAI::EndPath(bool fail)
|
||||
{
|
||||
if (targets->size() == 1 && GetScript()->IsPlayer((*targets->begin())))
|
||||
{
|
||||
Player* plr = (*targets->begin())->ToPlayer();
|
||||
if (!fail && plr->IsAtGroupRewardDistance(me) && !plr->GetCorpse())
|
||||
plr->GroupEventHappens(mEscortQuestID, me);
|
||||
Player* player = (*targets->begin())->ToPlayer();
|
||||
if (!fail && player->IsAtGroupRewardDistance(me) && !player->GetCorpse())
|
||||
player->GroupEventHappens(mEscortQuestID, me);
|
||||
|
||||
if (fail && plr->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
|
||||
plr->FailQuest(mEscortQuestID);
|
||||
if (fail && player->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
|
||||
player->FailQuest(mEscortQuestID);
|
||||
|
||||
if (Group* pGroup = plr->GetGroup())
|
||||
if (Group* group = player->GetGroup())
|
||||
{
|
||||
for (GroupReference* gr = pGroup->GetFirstMember(); gr != NULL; gr = gr->next())
|
||||
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
|
||||
{
|
||||
Player* pGroupGuy = gr->getSource();
|
||||
Player* groupGuy = groupRef->getSource();
|
||||
|
||||
if (!fail && pGroupGuy->IsAtGroupRewardDistance(me) && !pGroupGuy->GetCorpse())
|
||||
pGroupGuy->AreaExploredOrEventHappens(mEscortQuestID);
|
||||
if (fail && pGroupGuy->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
|
||||
pGroupGuy->FailQuest(mEscortQuestID);
|
||||
if (!fail && groupGuy->IsAtGroupRewardDistance(me) && !groupGuy->GetCorpse())
|
||||
groupGuy->AreaExploredOrEventHappens(mEscortQuestID);
|
||||
if (fail && groupGuy->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
|
||||
groupGuy->FailQuest(mEscortQuestID);
|
||||
}
|
||||
}
|
||||
}else
|
||||
@@ -239,11 +239,11 @@ void SmartAI::EndPath(bool fail)
|
||||
{
|
||||
if (GetScript()->IsPlayer((*iter)))
|
||||
{
|
||||
Player* plr = (*iter)->ToPlayer();
|
||||
if (!fail && plr->IsAtGroupRewardDistance(me) && !plr->GetCorpse())
|
||||
plr->AreaExploredOrEventHappens(mEscortQuestID);
|
||||
if (fail && plr->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
|
||||
plr->FailQuest(mEscortQuestID);
|
||||
Player* player = (*iter)->ToPlayer();
|
||||
if (!fail && player->IsAtGroupRewardDistance(me) && !player->GetCorpse())
|
||||
player->AreaExploredOrEventHappens(mEscortQuestID);
|
||||
if (fail && player->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
|
||||
player->FailQuest(mEscortQuestID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -346,12 +346,12 @@ void SmartAI::UpdateAI(const uint32 diff)
|
||||
{
|
||||
if (me->FindNearestCreature(mFollowArrivedEntry, INTERACTION_DISTANCE, true))
|
||||
{
|
||||
if (Player* plr = me->GetPlayer(*me, mFollowGuid))
|
||||
if (Player* player = me->GetPlayer(*me, mFollowGuid))
|
||||
{
|
||||
if (!mFollowCreditType)
|
||||
plr->RewardPlayerAndGroupAtEvent(mFollowCredit, me);
|
||||
player->RewardPlayerAndGroupAtEvent(mFollowCredit, me);
|
||||
else
|
||||
plr->GroupEventHappens(mFollowCredit, me);
|
||||
player->GroupEventHappens(mFollowCredit, me);
|
||||
}
|
||||
mFollowGuid = 0;
|
||||
mFollowDist = 0;
|
||||
@@ -385,17 +385,17 @@ bool SmartAI::IsEscortInvokerInRange()
|
||||
{
|
||||
if (targets->size() == 1 && GetScript()->IsPlayer((*targets->begin())))
|
||||
{
|
||||
Player* plr = (*targets->begin())->ToPlayer();
|
||||
if (me->GetDistance(plr) <= SMART_ESCORT_MAX_PLAYER_DIST)
|
||||
Player* player = (*targets->begin())->ToPlayer();
|
||||
if (me->GetDistance(player) <= SMART_ESCORT_MAX_PLAYER_DIST)
|
||||
return true;
|
||||
|
||||
if (Group* pGroup = plr->GetGroup())
|
||||
if (Group* group = player->GetGroup())
|
||||
{
|
||||
for (GroupReference* gr = pGroup->GetFirstMember(); gr != NULL; gr = gr->next())
|
||||
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
|
||||
{
|
||||
Player* pGroupGuy = gr->getSource();
|
||||
Player* groupGuy = groupRef->getSource();
|
||||
|
||||
if (me->GetDistance(pGroupGuy) <= SMART_ESCORT_MAX_PLAYER_DIST)
|
||||
if (me->GetDistance(groupGuy) <= SMART_ESCORT_MAX_PLAYER_DIST)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -499,9 +499,9 @@ bool SmartAI::CanAIAttack(const Unit* /*who*/) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SmartAI::AssistPlayerInCombat(Unit* pWho)
|
||||
bool SmartAI::AssistPlayerInCombat(Unit* who)
|
||||
{
|
||||
if (!pWho || !pWho->getVictim())
|
||||
if (!who || !who->getVictim())
|
||||
return false;
|
||||
|
||||
//experimental (unknown) flag not present
|
||||
@@ -509,26 +509,26 @@ bool SmartAI::AssistPlayerInCombat(Unit* pWho)
|
||||
return false;
|
||||
|
||||
//not a player
|
||||
if (!pWho->getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
if (!who->getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
return false;
|
||||
|
||||
//never attack friendly
|
||||
if (me->IsFriendlyTo(pWho))
|
||||
if (me->IsFriendlyTo(who))
|
||||
return false;
|
||||
|
||||
//too far away and no free sight?
|
||||
if (me->IsWithinDistInMap(pWho, SMART_MAX_AID_DIST) && me->IsWithinLOSInMap(pWho))
|
||||
if (me->IsWithinDistInMap(who, SMART_MAX_AID_DIST) && me->IsWithinLOSInMap(who))
|
||||
{
|
||||
//already fighting someone?
|
||||
if (!me->getVictim())
|
||||
{
|
||||
AttackStart(pWho);
|
||||
AttackStart(who);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
pWho->SetInCombatWith(me);
|
||||
me->AddThreat(pWho, 0.0f);
|
||||
who->SetInCombatWith(me);
|
||||
me->AddThreat(who, 0.0f);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -606,29 +606,29 @@ void SmartAI::AttackStart(Unit* who)
|
||||
}
|
||||
}
|
||||
|
||||
void SmartAI::SpellHit(Unit* pUnit, const SpellInfo* pSpell)
|
||||
void SmartAI::SpellHit(Unit* unit, const SpellInfo* spellInfo)
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT, pUnit, 0, 0, false, pSpell);
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT, unit, 0, 0, false, spellInfo);
|
||||
}
|
||||
|
||||
void SmartAI::SpellHitTarget(Unit* target, const SpellInfo* pSpell)
|
||||
void SmartAI::SpellHitTarget(Unit* target, const SpellInfo* spellInfo)
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT_TARGET, target, 0, 0, false, pSpell);
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT_TARGET, target, 0, 0, false, spellInfo);
|
||||
}
|
||||
|
||||
void SmartAI::DamageTaken(Unit* done_by, uint32& damage)
|
||||
void SmartAI::DamageTaken(Unit* doneBy, uint32& damage)
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED, done_by, damage);
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED, doneBy, damage);
|
||||
}
|
||||
|
||||
void SmartAI::HealReceived(Unit* done_by, uint32& addhealth)
|
||||
void SmartAI::HealReceived(Unit* doneBy, uint32& addhealth)
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RECEIVE_HEAL, done_by, addhealth);
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RECEIVE_HEAL, doneBy, addhealth);
|
||||
}
|
||||
|
||||
void SmartAI::ReceiveEmote(Player* pPlayer, uint32 text_emote)
|
||||
void SmartAI::ReceiveEmote(Player* player, uint32 textEmote)
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RECEIVE_EMOTE, pPlayer, text_emote);
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RECEIVE_EMOTE, player, textEmote);
|
||||
}
|
||||
|
||||
void SmartAI::IsSummonedBy(Unit* summoner)
|
||||
@@ -636,9 +636,9 @@ void SmartAI::IsSummonedBy(Unit* summoner)
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_JUST_SUMMONED, summoner);
|
||||
}
|
||||
|
||||
void SmartAI::DamageDealt(Unit* done_to, uint32& damage, DamageEffectType /*damagetype*/)
|
||||
void SmartAI::DamageDealt(Unit* doneTo, uint32& damage, DamageEffectType /*damagetype*/)
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED_TARGET, done_to, damage);
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED_TARGET, doneTo, damage);
|
||||
}
|
||||
|
||||
void SmartAI::SummonedCreatureDespawn(Creature* unit)
|
||||
@@ -705,14 +705,14 @@ void SmartAI::SetRun(bool run)
|
||||
mRun = run;
|
||||
}
|
||||
|
||||
void SmartAI::SetFly(bool bFly)
|
||||
void SmartAI::SetFly(bool fly)
|
||||
{
|
||||
me->SetFlying(bFly);
|
||||
me->SetFlying(fly);
|
||||
}
|
||||
|
||||
void SmartAI::SetSwimm(bool bSwimm)
|
||||
void SmartAI::SetSwimm(bool swimm)
|
||||
{
|
||||
if (bSwimm)
|
||||
if (swimm)
|
||||
me->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
|
||||
else
|
||||
me->RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
|
||||
|
||||
@@ -100,22 +100,22 @@ class SmartAI : public CreatureAI
|
||||
void MoveInLineOfSight(Unit* who);
|
||||
|
||||
// Called when hit by a spell
|
||||
void SpellHit(Unit* pUnit, const SpellInfo* pSpell);
|
||||
void SpellHit(Unit* unit, const SpellInfo* spellInfo);
|
||||
|
||||
// Called when spell hits a target
|
||||
void SpellHitTarget(Unit* target, const SpellInfo* pSpell);
|
||||
void SpellHitTarget(Unit* target, const SpellInfo* spellInfo);
|
||||
|
||||
// Called at any Damage from any attacker (before damage apply)
|
||||
void DamageTaken(Unit* done_by, uint32& damage);
|
||||
void DamageTaken(Unit* doneBy, uint32& damage);
|
||||
|
||||
// Called when the creature receives heal
|
||||
void HealReceived(Unit* done_by, uint32& addhealth);
|
||||
void HealReceived(Unit* doneBy, uint32& addhealth);
|
||||
|
||||
// Called at World update tick
|
||||
void UpdateAI(const uint32 diff);
|
||||
|
||||
// Called at text emote receive from player
|
||||
void ReceiveEmote(Player* pPlayer, uint32 text_emote);
|
||||
void ReceiveEmote(Player* player, uint32 textEmote);
|
||||
|
||||
// Called at waypoint reached or point movement finished
|
||||
void MovementInform(uint32 MovementType, uint32 Data);
|
||||
@@ -124,7 +124,7 @@ class SmartAI : public CreatureAI
|
||||
void IsSummonedBy(Unit* summoner);
|
||||
|
||||
// Called at any Damage to any victim (before damage apply)
|
||||
void DamageDealt(Unit* done_to, uint32& damage, DamageEffectType /*damagetype*/);
|
||||
void DamageDealt(Unit* doneTo, uint32& damage, DamageEffectType /*damagetype*/);
|
||||
|
||||
// Called when a summoned creature dissapears (UnSommoned)
|
||||
void SummonedCreatureDespawn(Creature* unit);
|
||||
@@ -169,11 +169,11 @@ class SmartAI : public CreatureAI
|
||||
void MovepointReached(uint32 id);
|
||||
|
||||
// Makes the creature run/walk
|
||||
void SetRun(bool bRun = true);
|
||||
void SetRun(bool run = true);
|
||||
|
||||
void SetFly(bool bFly = true);
|
||||
void SetFly(bool fly = true);
|
||||
|
||||
void SetSwimm(bool bSwimm = true);
|
||||
void SetSwimm(bool swimm = true);
|
||||
|
||||
void sGossipHello(Player* player);
|
||||
void sGossipSelect(Player* player, uint32 sender, uint32 action);
|
||||
@@ -220,7 +220,7 @@ class SmartAI : public CreatureAI
|
||||
bool mCanCombatMove;
|
||||
bool mForcedPaused;
|
||||
|
||||
bool AssistPlayerInCombat(Unit* pWho);
|
||||
bool AssistPlayerInCombat(Unit* who);
|
||||
|
||||
uint32 mDespawnTime;
|
||||
uint32 mDespawnState;
|
||||
|
||||
@@ -1946,9 +1946,9 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
|
||||
if (trigger)
|
||||
{
|
||||
l->push_back(trigger);
|
||||
if (Player* plr = trigger->ToPlayer())
|
||||
if (Group* pGroup = plr->GetGroup())
|
||||
for (GroupReference* groupRef = pGroup->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
|
||||
if (Player* player = trigger->ToPlayer())
|
||||
if (Group* group = player->GetGroup())
|
||||
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
|
||||
if (Player* member = groupRef->getSource())
|
||||
l->push_back(member);
|
||||
}
|
||||
@@ -2263,10 +2263,10 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
|
||||
if (!me || !me->isInCombat())
|
||||
return;
|
||||
|
||||
Unit* pUnit = DoSelectLowestHpFriendly((float)e.event.friendlyHealt.radius, e.event.friendlyHealt.hpDeficit);
|
||||
if (!pUnit)
|
||||
Unit* unit = DoSelectLowestHpFriendly((float)e.event.friendlyHealt.radius, e.event.friendlyHealt.hpDeficit);
|
||||
if (!unit)
|
||||
return;
|
||||
ProcessAction(e, pUnit);
|
||||
ProcessAction(e, unit);
|
||||
RecalcTimer(e, e.event.friendlyHealt.repeatMin, e.event.friendlyHealt.repeatMax);
|
||||
break;
|
||||
}
|
||||
@@ -2881,15 +2881,15 @@ Unit* SmartScript::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff)
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
Unit* pUnit = NULL;
|
||||
Unit* unit = NULL;
|
||||
|
||||
Trinity::MostHPMissingInRange u_check(me, range, MinHPDiff);
|
||||
Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange> searcher(me, pUnit, u_check);
|
||||
Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange> searcher(me, unit, u_check);
|
||||
|
||||
TypeContainerVisitor<Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange>, GridTypeMapContainer > grid_unit_searcher(searcher);
|
||||
|
||||
cell.Visit(p, grid_unit_searcher, *me->GetMap(), *me, range);
|
||||
return pUnit;
|
||||
return unit;
|
||||
}
|
||||
|
||||
void SmartScript::DoFindFriendlyCC(std::list<Creature*>& _list, float range)
|
||||
|
||||
@@ -151,35 +151,35 @@ class SmartScript
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GameObject* FindGameObjectNear(WorldObject* pSearchObject, uint32 guid) const
|
||||
GameObject* FindGameObjectNear(WorldObject* searchObject, uint32 guid) const
|
||||
{
|
||||
GameObject* pGameObject = NULL;
|
||||
GameObject* gameObject = NULL;
|
||||
|
||||
CellPair p(Trinity::ComputeCellPair(pSearchObject->GetPositionX(), pSearchObject->GetPositionY()));
|
||||
CellPair p(Trinity::ComputeCellPair(searchObject->GetPositionX(), searchObject->GetPositionY()));
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
|
||||
Trinity::GameObjectWithDbGUIDCheck goCheck(*pSearchObject, guid);
|
||||
Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck> checker(pSearchObject, pGameObject, goCheck);
|
||||
Trinity::GameObjectWithDbGUIDCheck goCheck(*searchObject, guid);
|
||||
Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck> checker(searchObject, gameObject, goCheck);
|
||||
|
||||
TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > objectChecker(checker);
|
||||
cell.Visit(p, objectChecker, *pSearchObject->GetMap());
|
||||
cell.Visit(p, objectChecker, *searchObject->GetMap());
|
||||
|
||||
return pGameObject;
|
||||
return gameObject;
|
||||
}
|
||||
|
||||
Creature* FindCreatureNear(WorldObject* pSearchObject, uint32 guid) const
|
||||
Creature* FindCreatureNear(WorldObject* searchObject, uint32 guid) const
|
||||
{
|
||||
Creature* crea = NULL;
|
||||
CellPair p(Trinity::ComputeCellPair(pSearchObject->GetPositionX(), pSearchObject->GetPositionY()));
|
||||
CellPair p(Trinity::ComputeCellPair(searchObject->GetPositionX(), searchObject->GetPositionY()));
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
|
||||
Trinity::CreatureWithDbGUIDCheck target_check(pSearchObject, guid);
|
||||
Trinity::CreatureSearcher<Trinity::CreatureWithDbGUIDCheck> checker(pSearchObject, crea, target_check);
|
||||
Trinity::CreatureWithDbGUIDCheck target_check(searchObject, guid);
|
||||
Trinity::CreatureSearcher<Trinity::CreatureWithDbGUIDCheck> checker(searchObject, crea, target_check);
|
||||
|
||||
TypeContainerVisitor<Trinity::CreatureSearcher <Trinity::CreatureWithDbGUIDCheck>, GridTypeMapContainer > unit_checker(checker);
|
||||
cell.Visit(p, unit_checker, *pSearchObject->GetMap());
|
||||
cell.Visit(p, unit_checker, *searchObject->GetMap());
|
||||
|
||||
return crea;
|
||||
}
|
||||
|
||||
@@ -334,13 +334,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
case SMART_EVENT_SPELLHIT_TARGET:
|
||||
if (e.event.spellHit.spell)
|
||||
{
|
||||
SpellInfo const* pSpell = sSpellMgr->GetSpellInfo(e.event.spellHit.spell);
|
||||
if (!pSpell)
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(e.event.spellHit.spell);
|
||||
if (!spellInfo)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
|
||||
return false;
|
||||
}
|
||||
if (e.event.spellHit.school && (e.event.spellHit.school & pSpell->SchoolMask) != pSpell->SchoolMask)
|
||||
if (e.event.spellHit.school && (e.event.spellHit.school & spellInfo->SchoolMask) != spellInfo->SchoolMask)
|
||||
{
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses Spell entry %u with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user