mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-16 08:46:09 +00:00
refactor(Core/Object): adds consistency in the use of type object check (#19671)
This commit is contained in:
@@ -1134,7 +1134,7 @@ public:
|
||||
return true;
|
||||
|
||||
// check index
|
||||
if (unit->GetTypeId() == TYPEID_PLAYER)
|
||||
if (unit->IsPlayer())
|
||||
{
|
||||
if (index >= PLAYER_END)
|
||||
return true;
|
||||
|
||||
@@ -1130,7 +1130,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
if (target->IsPlayer())
|
||||
{
|
||||
if (handler->HasLowerSecurity(target->ToPlayer()))
|
||||
{
|
||||
@@ -2659,7 +2659,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUID().ToString());
|
||||
handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->IsPlayer() ? "Player" : "Creature"), unit->GetGUID().ToString());
|
||||
|
||||
MotionMaster* motionMaster = unit->GetMotionMaster();
|
||||
float x, y, z;
|
||||
@@ -2694,7 +2694,7 @@ public:
|
||||
case CHASE_MOTION_TYPE:
|
||||
{
|
||||
Unit* target = nullptr;
|
||||
if (unit->GetTypeId() == TYPEID_PLAYER)
|
||||
if (unit->IsPlayer())
|
||||
{
|
||||
target = static_cast<ChaseMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
|
||||
}
|
||||
@@ -2707,7 +2707,7 @@ public:
|
||||
{
|
||||
handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL);
|
||||
}
|
||||
else if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
else if (target->IsPlayer())
|
||||
{
|
||||
handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUID().ToString());
|
||||
}
|
||||
@@ -2720,7 +2720,7 @@ public:
|
||||
case FOLLOW_MOTION_TYPE:
|
||||
{
|
||||
Unit* target = nullptr;
|
||||
if (unit->GetTypeId() == TYPEID_PLAYER)
|
||||
if (unit->IsPlayer())
|
||||
{
|
||||
target = static_cast<FollowMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
|
||||
}
|
||||
@@ -2733,7 +2733,7 @@ public:
|
||||
{
|
||||
handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL);
|
||||
}
|
||||
else if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
else if (target->IsPlayer())
|
||||
{
|
||||
handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUID().ToString());
|
||||
}
|
||||
@@ -2809,7 +2809,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
if (target->IsPlayer())
|
||||
{
|
||||
if (handler->HasLowerSecurity(target->ToPlayer()))
|
||||
{
|
||||
|
||||
@@ -355,7 +355,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
if (target->IsPlayer())
|
||||
{
|
||||
// check online security
|
||||
if (handler->HasLowerSecurity(target->ToPlayer()))
|
||||
@@ -370,7 +370,7 @@ public:
|
||||
else if (target->IsPet())
|
||||
{
|
||||
Unit* owner = target->GetOwner();
|
||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet*)target)->IsPermanentPetFor(owner->ToPlayer()))
|
||||
if (owner && owner->IsPlayer() && ((Pet*)target)->IsPermanentPetFor(owner->ToPlayer()))
|
||||
{
|
||||
// check online security
|
||||
if (handler->HasLowerSecurity(owner->ToPlayer()))
|
||||
@@ -666,7 +666,7 @@ public:
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer()))
|
||||
if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -843,7 +843,7 @@ public:
|
||||
{
|
||||
target = handler->GetSession()->GetPlayer();
|
||||
}
|
||||
else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer())) // check online security
|
||||
else if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer())) // check online security
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -860,7 +860,7 @@ public:
|
||||
{
|
||||
target = handler->GetSession()->GetPlayer();
|
||||
}
|
||||
else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer())) // check online security
|
||||
else if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer())) // check online security
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -873,7 +873,7 @@ public:
|
||||
{
|
||||
Player* target = handler->getSelectedPlayerOrSelf();
|
||||
|
||||
if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer())) // check online security
|
||||
if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer())) // check online security
|
||||
return false;
|
||||
|
||||
if (!target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).empty())
|
||||
@@ -892,7 +892,7 @@ public:
|
||||
{
|
||||
target = handler->GetSession()->GetPlayer();
|
||||
}
|
||||
else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer())) // check online security
|
||||
else if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer())) // check online security
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
Creature* creatureTarget = handler->getSelectedCreature();
|
||||
|
||||
if (!creatureTarget || creatureTarget->IsPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
|
||||
if (!creatureTarget || creatureTarget->IsPet() || creatureTarget->IsPlayer())
|
||||
{
|
||||
handler->SendErrorMessage(LANG_SELECT_CREATURE);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user