mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 00:53:46 +00:00
refactor(Core): Make more use of helpers. (#19835)
* Init. * Reword. * Update codestyle script. Co-Authored-By: Kitzunu <24550914+Kitzunu@users.noreply.github.com> * Add gameobject type ID check, reorder checks. * Add helper/codestyle check for unit type. * `IsUnit()` -> `IsCreature()` * Add `IsUnit()` method. * Use type mask. https: //github.com/TrinityCore/TrinityCore/commit/cc71da35b5dc74abf71f8691161525a23d870bb5 Co-Authored-By: Giacomo Pozzoni <giacomopoz@gmail.com> Co-Authored-By: Ovahlord <18347559+Ovahlord@users.noreply.github.com> * Replace instances of `isType` with `IsUnit`. --------- Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Co-authored-by: Giacomo Pozzoni <giacomopoz@gmail.com> Co-authored-by: Ovahlord <18347559+Ovahlord@users.noreply.github.com>
This commit is contained in:
@@ -91,7 +91,7 @@ namespace Acore
|
||||
{
|
||||
Unit& i_unit;
|
||||
bool isCreature;
|
||||
explicit AIRelocationNotifier(Unit& unit) : i_unit(unit), isCreature(unit.GetTypeId() == TYPEID_UNIT) {}
|
||||
explicit AIRelocationNotifier(Unit& unit) : i_unit(unit), isCreature(unit.IsCreature()) {}
|
||||
template<class T> void Visit(GridRefMgr<T>&) {}
|
||||
void Visit(CreatureMapType&);
|
||||
};
|
||||
@@ -864,7 +864,7 @@ namespace Acore
|
||||
bool operator()(Unit* u)
|
||||
{
|
||||
if (u->IsAlive() && !u->IsCritter() && i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u) &&
|
||||
(i_funit->GetTypeId() != TYPEID_UNIT || !i_funit->ToCreature()->IsAvoidingAOE())) // pussywizard
|
||||
(!i_funit->IsCreature() || !i_funit->ToCreature()->IsAvoidingAOE())) // pussywizard
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
@@ -887,7 +887,7 @@ namespace Acore
|
||||
if (u->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET)
|
||||
return false;
|
||||
|
||||
if (u->GetTypeId() == TYPEID_UNIT && (u->ToCreature()->IsTotem() || u->ToCreature()->IsTrigger() || u->ToCreature()->IsAvoidingAOE())) // pussywizard: added IsAvoidingAOE()
|
||||
if (u->IsCreature() && (u->ToCreature()->IsTotem() || u->ToCreature()->IsTrigger() || u->ToCreature()->IsAvoidingAOE())) // pussywizard: added IsAvoidingAOE()
|
||||
return false;
|
||||
|
||||
if (!u->isTargetableForAttack(false, i_funit))
|
||||
@@ -918,7 +918,7 @@ namespace Acore
|
||||
return false;
|
||||
}
|
||||
|
||||
if (u->GetTypeId() == TYPEID_UNIT && u->ToCreature()->IsTotem())
|
||||
if (u->IsCreature() && u->ToCreature()->IsTotem())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -930,7 +930,7 @@ namespace Acore
|
||||
|
||||
uint32 losChecks = LINEOFSIGHT_ALL_CHECKS;
|
||||
Optional<float> collisionHeight = { };
|
||||
if (i_obj->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
if (i_obj->IsGameObject())
|
||||
{
|
||||
losChecks &= ~LINEOFSIGHT_CHECK_GOBJECT_M2;
|
||||
collisionHeight = i_owner->GetCollisionHeight();
|
||||
@@ -1203,7 +1203,7 @@ namespace Acore
|
||||
if (!me->IsValidAttackTarget(u))
|
||||
return false;
|
||||
|
||||
if (i_playerOnly && u->GetTypeId() != TYPEID_PLAYER)
|
||||
if (i_playerOnly && !u->IsPlayer())
|
||||
return false;
|
||||
|
||||
m_range = me->GetDistance(u); // use found unit range as new range limit for next check
|
||||
|
||||
Reference in New Issue
Block a user