refactor(Core/Object): adds consistency in the use of type object check (#19671)

This commit is contained in:
Grimdhex 2024-08-25 14:57:37 +02:00 committed by GitHub
parent 61f3a631c3
commit 643362d697
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
189 changed files with 783 additions and 775 deletions

View file

@ -1134,7 +1134,7 @@ public:
return true;
// check index
if (unit->GetTypeId() == TYPEID_PLAYER)
if (unit->IsPlayer())
{
if (index >= PLAYER_END)
return true;

View file

@ -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()))
{

View file

@ -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;
}

View file

@ -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;

View file

@ -673,7 +673,7 @@ struct boss_nefarian : public BossAI
{
for (auto& ref : me->GetThreatMgr().GetThreatList())
{
if (ref->getTarget() && ref->getTarget()->GetTypeId() == TYPEID_PLAYER)
if (ref->getTarget() && ref->getTarget()->IsPlayer())
{
classesPresent.insert(ref->getTarget()->getClass());
}

View file

@ -69,7 +69,7 @@ struct boss_curator : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
Talk(SAY_KILL);
}

View file

@ -72,7 +72,7 @@ struct boss_maiden_of_virtue : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
Talk(SAY_SLAY);
}

View file

@ -139,7 +139,7 @@ struct boss_attumen : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
Talk(SAY_KILL);
}

View file

@ -178,7 +178,7 @@ struct boss_moroes : public BossAI
void KilledUnit(Unit* victim) override
{
if (!_recentlySpoken && victim->GetTypeId() == TYPEID_PLAYER)
if (!_recentlySpoken && victim->IsPlayer())
{
Talk(SAY_KILL);
_recentlySpoken = true;

View file

@ -149,7 +149,7 @@ struct boss_netherspite : public BossAI
}
}
// buff the target
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
{
target->AddAura(PlayerBuff[j], target);
}
@ -177,7 +177,7 @@ struct boss_netherspite : public BossAI
}
}
// aggro target if Red Beam
if (j == RED_PORTAL && me->GetVictim() != target && target->GetTypeId() == TYPEID_PLAYER)
if (j == RED_PORTAL && me->GetVictim() != target && target->IsPlayer())
{
me->GetThreatMgr().AddThreat(target, 100000.0f + DoGetThreat(me->GetVictim()));
}

View file

@ -224,7 +224,7 @@ struct boss_terestian_illhoof : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
Talk(SAY_SLAY);
}

View file

@ -142,7 +142,7 @@ struct boss_felblood_kaelthas : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (!introSpeak && me->IsWithinDistInMap(who, 40.0f) && who->GetTypeId() == TYPEID_PLAYER)
if (!introSpeak && me->IsWithinDistInMap(who, 40.0f) && who->IsPlayer())
{
Talk(SAY_AGGRO);
introSpeak = true;

View file

@ -292,7 +292,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
for (ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr)
{
Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->GetThreatMgr().GetThreat(pUnit))
if (pUnit && pUnit->IsPlayer() && me->GetThreatMgr().GetThreat(pUnit))
{
float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit);
me->GetThreatMgr().ModifyThreatByPercent(pUnit, -100);

View file

@ -116,7 +116,7 @@ struct boss_selin_fireheart : public ScriptedAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_KILL);
}

View file

@ -82,7 +82,7 @@ struct boss_vexallus : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_KILL);
}

View file

@ -77,7 +77,7 @@ public:
void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->GetTypeId() == TYPEID_PLAYER && me->IsAlive() && !speechCounter)
if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->IsPlayer() && me->IsAlive() && !speechCounter)
{
if (Player* player = caster->ToPlayer())
{

View file

@ -104,7 +104,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50))
if (victim->IsPlayer() && roll_chance_i(50))
Talk(YELL_KILL);
}

View file

@ -143,7 +143,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && urand(0, 1))
if (victim->IsPlayer() && urand(0, 1))
Talk(YELL_SAC_KILL);
}
@ -291,7 +291,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && urand(0, 1))
if (victim->IsPlayer() && urand(0, 1))
Talk(YELL_SAC_KILL);
}

View file

@ -173,7 +173,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50))
if (victim->IsPlayer() && roll_chance_i(50))
Talk(YELL_KILL);
}

View file

@ -229,7 +229,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50))
if (victim->IsPlayer() && roll_chance_i(50))
Talk(SAY_EVIL_SLAY);
}
@ -539,7 +539,7 @@ public:
void KilledUnit(Unit* target) override
{
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
Talk(SAY_SATH_SLAY);
}

View file

@ -364,7 +364,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && events.GetNextEventTime(EVENT_NO_KILL_TALK) == 0)
if (victim->IsPlayer() && events.GetNextEventTime(EVENT_NO_KILL_TALK) == 0)
Talk(SAY_KJ_SLAY);
}

View file

@ -135,7 +135,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
Talk(SAY_KILL);
}

View file

@ -420,7 +420,7 @@ public:
void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_REMOVE_AMANI_CURSE && caster->GetTypeId() == TYPEID_PLAYER && me->GetEntry() == NPC_FOREST_FROG)
if (spell->Id == SPELL_REMOVE_AMANI_CURSE && caster->IsPlayer() && me->GetEntry() == NPC_FOREST_FROG)
{
me->GetMotionMaster()->MoveIdle();
me->SetFacingToObject(caster);

View file

@ -299,7 +299,7 @@ class spell_enveloping_webs : public SpellScript
{
Unit* caster = GetCaster();
Unit* hitUnit = GetHitUnit();
if (caster && hitUnit && hitUnit->GetTypeId() == TYPEID_PLAYER)
if (caster && hitUnit && hitUnit->IsPlayer())
{
caster->GetThreatMgr().ModifyThreatByPercent(hitUnit, -100);
}

View file

@ -75,7 +75,7 @@ struct boss_twilight_corrupter : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (!_introSpoken && who->GetTypeId() == TYPEID_PLAYER)
if (!_introSpoken && who->IsPlayer())
{
_introSpoken = true;
Talk(SAY_RESPAWN, who);
@ -102,7 +102,7 @@ struct boss_twilight_corrupter : public ScriptedAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
Talk(SAY_KILL, victim);
DoCastSelf(SPELL_SWELL_OF_SOULS);

View file

@ -499,7 +499,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (!announced && who->GetTypeId() == TYPEID_PLAYER && who->GetPositionZ() < 30.0f)
if (!announced && who->IsPlayer() && who->GetPositionZ() < 30.0f)
{
announced = true;
playerGUID = who->GetGUID();

View file

@ -109,7 +109,7 @@ public:
m_uiPhase = 1;
if (pDoneBy->GetTypeId() == TYPEID_PLAYER)
if (pDoneBy->IsPlayer())
{
m_uiPlayerGUID = pDoneBy->GetGUID();
}
@ -118,7 +118,7 @@ public:
if (Unit* owner = pDoneBy->GetOwner())
{
// not sure if this is needed.
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
{
m_uiPlayerGUID = owner->GetGUID();
}

View file

@ -68,7 +68,7 @@ struct npc_brewfest_keg_thrower : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->GetMountID() == RAM_DISPLAY_ID)
if (me->GetDistance(who) < 10.0f && who->IsPlayer() && who->GetMountID() == RAM_DISPLAY_ID)
{
if (!who->ToPlayer()->HasItemCount(ITEM_PORTABLE_BREWFEST_KEG)) // portable brewfest keg
me->CastSpell(who, SPELL_THROW_KEG, true); // throw keg
@ -90,7 +90,7 @@ struct npc_brewfest_keg_reciver : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->GetMountID() == RAM_DISPLAY_ID)
if (me->GetDistance(who) < 10.0f && who->IsPlayer() && who->GetMountID() == RAM_DISPLAY_ID)
{
Player* player = who->ToPlayer();
if (player->HasItemCount(ITEM_PORTABLE_BREWFEST_KEG)) // portable brewfest keg
@ -149,7 +149,7 @@ struct npc_brewfest_bark_trigger : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->GetMountID() == RAM_DISPLAY_ID)
if (me->GetDistance(who) < 10.0f && who->IsPlayer() && who->GetMountID() == RAM_DISPLAY_ID)
{
bool allow = false;
uint32 quest = 0;

View file

@ -62,7 +62,7 @@ struct npc_love_in_air_supply_sentry : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
if (lock > 1000 && me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->HasAura(SPELL_GOBLIN_DISGUISE) && !who->HasAura(SPELL_GOBLIN_CARRY_CRATE))
if (lock > 1000 && me->GetDistance(who) < 10.0f && who->IsPlayer() && who->HasAura(SPELL_GOBLIN_DISGUISE) && !who->HasAura(SPELL_GOBLIN_CARRY_CRATE))
{
lock = 0;
if (urand(0, 1))
@ -135,7 +135,7 @@ struct npc_love_in_air_snivel : public NullCreatureAI
void MoveInLineOfSight(Unit* who) override
{
if (delay == 0 && me->GetDistance(who) < 7.0f && who->GetTypeId() == TYPEID_PLAYER)
if (delay == 0 && me->GetDistance(who) < 7.0f && who->IsPlayer())
{
Player* plr = who->ToPlayer();
if (AllowAction(plr))
@ -454,7 +454,7 @@ class spell_gen_aura_service_uniform : public AuraScript
{
// Apply model goblin
Unit* target = GetTarget();
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
{
if (target->getGender() == GENDER_MALE)
{
@ -472,7 +472,7 @@ class spell_gen_aura_service_uniform : public AuraScript
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
target->RestoreDisplayId();
}

View file

@ -437,7 +437,7 @@ struct npc_midsummer_torch_target : public ScriptedAI
if (posVec.empty())
return;
// Triggered spell from torch
if (spellInfo->Id == SPELL_TORCH_TOSS_LAND && caster->GetTypeId() == TYPEID_PLAYER)
if (spellInfo->Id == SPELL_TORCH_TOSS_LAND && caster->IsPlayer())
{
me->CastSpell(me, SPELL_BRAZIERS_HIT_VISUAL, true); // hit visual anim
if (++counter >= maxCount)
@ -906,12 +906,12 @@ class spell_midsummer_ribbon_pole : public AuraScript
target->CastSpell(target, SPELL_RIBBON_POLE_XP, true);
// Achievement
if ((GameTime::GetGameTime().count() - GetApplyTime()) > 60 && target->GetTypeId() == TYPEID_PLAYER)
if ((GameTime::GetGameTime().count() - GetApplyTime()) > 60 && target->IsPlayer())
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58934, 0, target);
}
// Achievement
if ((time(nullptr) - GetApplyTime()) > 60 && target->GetTypeId() == TYPEID_PLAYER)
if ((time(nullptr) - GetApplyTime()) > 60 && target->IsPlayer())
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58934, 0, target);
}
}

View file

@ -118,7 +118,7 @@ struct npc_pilgrims_bounty_chair : public VehicleAI
void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply) override
{
if (apply && who->GetTypeId() == TYPEID_PLAYER)
if (apply && who->IsPlayer())
who->ToPlayer()->SetClientControl(me, 0, true);
}

View file

@ -1550,7 +1550,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (!allowTimer && !locked && (who->GetTypeId() == TYPEID_PLAYER || who->IsPet()) && me->GetDistance(who) < 15.0f)
if (!allowTimer && !locked && (who->IsPlayer() || who->IsPet()) && me->GetDistance(who) < 15.0f)
InfectMe(2000);
ScriptedAI::MoveInLineOfSight(who);

View file

@ -68,7 +68,7 @@ struct boss_epoch_hunter : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_SLAY);
}

View file

@ -91,7 +91,7 @@ struct boss_lieutenant_drake : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
Talk(SAY_SLAY);
}

View file

@ -130,7 +130,7 @@ struct npc_medivh_bm : public ScriptedAI
return;
}
if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 20.0f))
if (who->IsPlayer() && me->IsWithinDistInMap(who, 20.0f))
{
Talk(SAY_MEDIVH_ENTER);
_instance->SetData(DATA_MEDIVH, 1);

View file

@ -106,7 +106,7 @@ struct boss_buru : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
ChaseNewVictim();
}

View file

@ -189,7 +189,7 @@ struct boss_eye_of_cthun : public BossAI
void MoveInLineOfSight(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER && !me->IsInCombat())
if (who->IsPlayer() && !me->IsInCombat())
{
// Z checks are necessary here because AQ maps do funky stuff.
if (me->IsWithinLOSInMap(who) && me->IsWithinDist2d(who, 90.0f) && who->GetPositionZ() > 100.0f)

View file

@ -75,7 +75,7 @@ struct npc_ouro_spawner : public ScriptedAI
void MoveInLineOfSight(Unit* who) override
{
// Spawn Ouro on LoS check
if (!hasSummoned && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 40.0f) && !who->ToPlayer()->IsGameMaster())
if (!hasSummoned && who->IsPlayer() && me->IsWithinDistInMap(who, 40.0f) && !who->ToPlayer()->IsGameMaster())
{
if (InstanceScript* instance = me->GetInstanceScript())
{

View file

@ -117,7 +117,7 @@ struct boss_twinemperorsAI : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim && victim->GetTypeId() == TYPEID_PLAYER)
if (victim && victim->IsPlayer())
Talk(SAY_KILL);
}

View file

@ -77,7 +77,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim && victim->GetTypeId() == TYPEID_PLAYER)
if (victim && victim->IsPlayer())
{
Talk(SAY_KILL);
victim->CastSpell(victim, SPELL_MARK_OF_FROST, true);

View file

@ -339,7 +339,7 @@ public:
if (!who)
return;
if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 5))
if (who->IsPlayer() && me->IsWithinDistInMap(who, 5))
{
DoCast(who, SPELL_DEPTH_CHARGE_TRAP);
WeMustDie = true;

View file

@ -94,7 +94,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (CanSayHelp && who->GetTypeId() == TYPEID_PLAYER && me->IsFriendlyTo(who) && me->IsWithinDistInMap(who, 25.0f))
if (CanSayHelp && who->IsPlayer() && me->IsFriendlyTo(who) && me->IsWithinDistInMap(who, 25.0f))
{
//Random switch between 4 texts
Talk(SAY_HELP, who);

View file

@ -70,7 +70,7 @@ public:
{
if (Unit* owner = killer->GetOwner())
{
if (owner->GetTypeId() == TYPEID_PLAYER)
if (owner->IsPlayer())
{
owner->ToPlayer()->KilledMonsterCredit(NPC_EXPEDITION_RESEARCHER);
}

View file

@ -99,7 +99,7 @@ class spell_energize_aoe : public SpellScript
{
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
{
if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE)
if ((*itr)->IsPlayer() && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE)
++itr;
else
targets.erase(itr++);

View file

@ -91,7 +91,7 @@ public:
{
if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
{
if (player->GetTypeId() == TYPEID_PLAYER && player->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE)
if (player->IsPlayer() && player->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE)
player->FailQuest(QUEST_SHATTERED_SALUTE);
}
Reset();

View file

@ -121,7 +121,7 @@ public:
{
if (SendItemTimer <= diff)
{
if (me->GetVictim()->GetTypeId() == TYPEID_PLAYER)
if (me->GetVictim()->IsPlayer())
SendItem(me->GetVictim());
SendItemTimer = 5000;
}

View file

@ -95,7 +95,7 @@ class boss_anub_arak : public CreatureScript
void MoveInLineOfSight(Unit* who) override
{
if (!intro && who->GetTypeId() == TYPEID_PLAYER)
if (!intro && who->IsPlayer())
{
intro = true;
Talk(SAY_INTRO);

View file

@ -146,7 +146,7 @@ struct boss_elder_nadox : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
Talk(SAY_SLAY);
}

View file

@ -151,7 +151,7 @@ struct boss_volazj : public BossAI
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
{
switch (urand(0, 2))
{

View file

@ -420,7 +420,7 @@ struct boss_taldaram : public BossAI
if (reference)
{
Unit const* pTarget = ObjectAccessor::GetUnit(*me, reference->getUnitGuid());
if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->IsAlive())
if (pTarget && pTarget->IsPlayer() && pTarget->IsAlive())
{
++count;
}

View file

@ -389,7 +389,7 @@ public:
void KilledUnit(Unit* pVictim) override
{
if (!urand(0, 2) && pVictim->GetTypeId() == TYPEID_PLAYER)
if (!urand(0, 2) && pVictim->IsPlayer())
{
Talk(SAY_SARTHARION_SLAY);
}

View file

@ -308,7 +308,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && events.GetNextEventTime(EVENT_KILL_TALK) == 0)
if (victim->IsPlayer() && events.GetNextEventTime(EVENT_KILL_TALK) == 0)
{
Talk(SAY_KILL);
events.ScheduleEvent(EVENT_KILL_TALK, 6s);
@ -475,7 +475,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && _events.GetNextEventTime(EVENT_KILL_TALK) == 0)
if (victim->IsPlayer() && _events.GetNextEventTime(EVENT_KILL_TALK) == 0)
{
Talk(SAY_KILL);
_events.ScheduleEvent(EVENT_KILL_TALK, 6s);

View file

@ -116,7 +116,7 @@ public:
void KilledUnit(Unit* who) override
{
if( who->GetTypeId() == TYPEID_PLAYER )
if( who->IsPlayer() )
{
Talk(SAY_EADRIC_KILL_PLAYER);
}
@ -243,7 +243,7 @@ public:
void KilledUnit(Unit* who) override
{
if( who->GetTypeId() == TYPEID_PLAYER )
if( who->IsPlayer() )
{
Talk(SAY_PALETRESS_KILL_PLAYER);
}

View file

@ -305,7 +305,7 @@ public:
void KilledUnit(Unit* victim) override
{
if( victim->GetTypeId() == TYPEID_PLAYER )
if( victim->IsPlayer() )
{
Talk(SAY_BK_KILL_PLAYER);
}
@ -434,7 +434,7 @@ public:
}
break;
case SPELL_EXPLODE_H:
if (target && target->GetTypeId() == TYPEID_PLAYER)
if (target && target->IsPlayer())
if (pInstance)
pInstance->SetData(DATA_ACHIEV_IVE_HAD_WORSE, 0);
break;

View file

@ -385,7 +385,7 @@ public:
void KilledUnit(Unit* who) override
{
if( who->GetTypeId() == TYPEID_PLAYER )
if( who->IsPlayer() )
Talk(SAY_KILL_PLAYER);
}

View file

@ -107,7 +107,7 @@ struct boss_faction_championsAI : public ScriptedAI
for( ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr )
{
Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if( pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->GetThreatMgr().GetThreat(pUnit) )
if( pUnit && pUnit->IsPlayer() && me->GetThreatMgr().GetThreat(pUnit) )
{
float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit);
me->GetThreatMgr().ModifyThreatByPercent(pUnit, -100);

View file

@ -161,12 +161,12 @@ public:
case 0:
break;
case EVENT_SPELL_SNOBOLLED:
if( t->GetTypeId() == TYPEID_PLAYER )
if( t->IsPlayer() )
me->CastSpell((Unit*)nullptr, SPELL_SNOBOLLED, true);
break;
case EVENT_SPELL_BATTER:
if( t->GetTypeId() == TYPEID_PLAYER )
if( t->IsPlayer() )
me->CastSpell(t, SPELL_BATTER);
events.Repeat(6s, 8s);
break;
@ -198,7 +198,7 @@ public:
}
break;
case EVENT_SPELL_HEAD_CRACK:
if( t->GetTypeId() == TYPEID_PLAYER )
if( t->IsPlayer() )
me->CastSpell(t, SPELL_HEAD_CRACK);
events.Repeat(30s, 35s);
break;

View file

@ -499,7 +499,7 @@ struct boss_twin_valkyrAI : public ScriptedAI
void KilledUnit(Unit* who) override
{
if( who->GetTypeId() == TYPEID_PLAYER )
if( who->IsPlayer() )
{
Talk(SAY_KILL_PLAYER);
if( Creature* twin = GetSister() )

View file

@ -155,7 +155,7 @@ public:
void OnUnitDeath(Unit* u) override
{
if (bNooneDied && u->GetTypeId() == TYPEID_PLAYER)
if (bNooneDied && u->IsPlayer())
{
bNooneDied = false;
SaveToDB();

View file

@ -86,7 +86,7 @@ public:
me->setActive(true);
instance->SetBossState(DATA_TROLLGORE, IN_PROGRESS);
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
{
Talk(SAY_AGGRO);
me->SetInCombatWithZone();

View file

@ -190,7 +190,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
Talk(SAY_SLAY);
}

View file

@ -161,7 +161,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
Talk(SAY_SLAY);
}

View file

@ -154,7 +154,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
Talk(SAY_SLAY);
}

View file

@ -280,7 +280,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
Talk(SAY_SLAY);
}

View file

@ -115,7 +115,7 @@ public:
{
if (!target || !spell)
return;
if (spell->Id == SPELL_PURSUIT && target->GetTypeId() == TYPEID_PLAYER)
if (spell->Id == SPELL_PURSUIT && target->IsPlayer())
{
Talk(EMOTE_ICK_CHASE, target);
AttackStart(target);
@ -262,7 +262,7 @@ public:
if (me->GetReactState() == REACT_PASSIVE)
me->SetReactState(REACT_AGGRESSIVE);
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
if (Creature* k = GetKrick())
k->AI()->Talk(SAY_SLAY);
}

View file

@ -209,7 +209,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
Talk(SAY_SLAY);
}

View file

@ -881,7 +881,7 @@ public:
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
{
if (target && spell && target->GetTypeId() == TYPEID_PLAYER && spell->Id == 70827 && pInstance)
if (target && spell && target->IsPlayer() && spell->Id == 70827 && pInstance)
pInstance->SetData(DATA_ACHIEV_DONT_LOOK_UP, 0);
}
@ -1185,7 +1185,7 @@ public:
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
{
if ((spell->Id == SPELL_TELEPORT_JAINA || spell->Id == SPELL_TELEPORT_SYLVANAS) && target && target->GetTypeId() == TYPEID_PLAYER)
if ((spell->Id == SPELL_TELEPORT_JAINA || spell->Id == SPELL_TELEPORT_SYLVANAS) && target && target->IsPlayer())
{
float angle = rand_norm() * 2 * M_PI;
float dist = urand(1, 4);

View file

@ -358,7 +358,7 @@ public:
{
if (me->ToTempSummon())
{
if (who->GetTypeId() == TYPEID_PLAYER || who->GetOwnerGUID().IsPlayer())
if (who->IsPlayer() || who->GetOwnerGUID().IsPlayer())
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
summoner->GetAI()->DoAction(ACTION_INFORM);
return;

View file

@ -352,7 +352,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_KELESETH_KILL);
}
@ -622,7 +622,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_TALDARAM_KILL);
}
@ -916,7 +916,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_VALANAR_KILL);
}
@ -1451,7 +1451,7 @@ class spell_blood_council_shadow_prison_aura : public AuraScript
void HandleDummyTick(AuraEffect const* aurEff)
{
if (GetTarget()->GetTypeId() == TYPEID_PLAYER && GetTarget()->isMoving())
if (GetTarget()->IsPlayer() && GetTarget()->isMoving())
{
GetTarget()->CastSpell(GetTarget(), SPELL_SHADOW_PRISON_DAMAGE, true, nullptr, aurEff);
}

View file

@ -268,7 +268,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_KILL);
}

View file

@ -341,7 +341,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_KILL);
}

View file

@ -162,7 +162,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_KILL);
}

View file

@ -2018,7 +2018,7 @@ class spell_igb_rocket_pack_useable_aura : public AuraScript
bool CheckAreaTarget(Unit* target)
{
return target->GetTypeId() == TYPEID_PLAYER && GetOwner()->GetInstanceScript()->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != DONE;
return target->IsPlayer() && GetOwner()->GetInstanceScript()->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != DONE;
}
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@ -2571,7 +2571,7 @@ class spell_igb_on_gunship_deck_aura : public AuraScript
bool CheckAreaTarget(Unit* unit)
{
return unit->GetTypeId() == TYPEID_PLAYER;
return unit->IsPlayer();
}
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)

View file

@ -544,7 +544,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_KILL);
}

View file

@ -285,13 +285,13 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_KILL);
}
void MoveInLineOfSight(Unit* who) override
{
if (!_introDone && me->IsAlive() && who->GetTypeId() == TYPEID_PLAYER && me->GetExactDist2dSq(who) <= 10000.0f) // 100*100, moveinlineofsight limited to 60yd anyway
if (!_introDone && me->IsAlive() && who->IsPlayer() && me->GetExactDist2dSq(who) <= 10000.0f) // 100*100, moveinlineofsight limited to 60yd anyway
{
Talk(SAY_ENTER_ZONE);
_introDone = true;

View file

@ -333,7 +333,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_KILL);
}

View file

@ -216,7 +216,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_KILL);
}

View file

@ -361,7 +361,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_KILL);
}
@ -488,7 +488,7 @@ public:
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
{
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
if (uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(70127, me))
if (spellId == spell->Id)
if (Aura const* mysticBuffet = target->GetAura(spell->Id))
@ -805,7 +805,7 @@ class spell_sindragosa_s_fury : public SpellScript
{
PreventHitDefaultEffect(effIndex);
if (!GetHitUnit()->IsAlive() || (GetHitUnit()->GetTypeId() == TYPEID_PLAYER && GetHitUnit()->ToPlayer()->IsGameMaster()) || !_targetCount)
if (!GetHitUnit()->IsAlive() || (GetHitUnit()->IsPlayer() && GetHitUnit()->ToPlayer()->IsGameMaster()) || !_targetCount)
return;
float resistance = float(GetHitUnit()->GetResistance(SpellSchoolMask(GetSpellInfo()->SchoolMask)));

View file

@ -725,7 +725,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER && !me->IsInEvadeMode() && _phase != PHASE_OUTRO && _lastTalkTimeKill + 5 < GameTime::GetGameTime().count())
if (victim->IsPlayer() && !me->IsInEvadeMode() && _phase != PHASE_OUTRO && _lastTalkTimeKill + 5 < GameTime::GetGameTime().count())
{
_lastTalkTimeKill = GameTime::GetGameTime().count();
Talk(SAY_LK_KILL);
@ -2229,7 +2229,7 @@ public:
me->CastSpell(me, SPELL_RAGING_SPIRIT_VISUAL, true);
if (TempSummon* summon = me->ToTempSummon())
if (Unit* summoner = summon->GetSummonerUnit())
if (summoner->GetTypeId() == TYPEID_PLAYER && summoner->IsAlive() && !summoner->ToPlayer()->IsBeingTeleported() && summoner->FindMap() == me->GetMap())
if (summoner->IsPlayer() && summoner->IsAlive() && !summoner->ToPlayer()->IsBeingTeleported() && summoner->FindMap() == me->GetMap())
{
valid = true;
summoner->CastSpell(me, SPELL_RAGING_SPIRIT_VISUAL_CLONE, true);
@ -2290,7 +2290,7 @@ public:
bool valid = false;
if (TempSummon* summon = me->ToTempSummon())
if (Unit* summoner = summon->GetSummonerUnit())
if (summoner->GetTypeId() == TYPEID_PLAYER && summoner->IsAlive() && !summoner->ToPlayer()->IsBeingTeleported() && summoner->FindMap() == me->GetMap())
if (summoner->IsPlayer() && summoner->IsAlive() && !summoner->ToPlayer()->IsBeingTeleported() && summoner->FindMap() == me->GetMap())
{
valid = true;
AttackStart(summoner);
@ -2957,8 +2957,8 @@ public:
{
if (Unit* summoner = summ->GetSummonerUnit())
{
bool buff = _instance->GetBossState(DATA_THE_LICH_KING) == IN_PROGRESS && summoner->GetTypeId() == TYPEID_PLAYER && (!summoner->IsAlive() || summoner->ToPlayer()->IsBeingTeleported() || summoner->FindMap() != me->GetMap());
if (summoner->GetTypeId() == TYPEID_PLAYER && !summoner->ToPlayer()->IsBeingTeleported() && summoner->FindMap() == me->GetMap())
bool buff = _instance->GetBossState(DATA_THE_LICH_KING) == IN_PROGRESS && summoner->IsPlayer() && (!summoner->IsAlive() || summoner->ToPlayer()->IsBeingTeleported() || summoner->FindMap() != me->GetMap());
if (summoner->IsPlayer() && !summoner->ToPlayer()->IsBeingTeleported() && summoner->FindMap() == me->GetMap())
{
if (buff)
summoner->CastSpell((Unit*)nullptr, SPELL_HARVESTED_SOUL_LK_BUFF, true, nullptr, nullptr, _instance->GetGuidData(DATA_THE_LICH_KING));
@ -2994,7 +2994,7 @@ public:
if (TempSummon* summ = me->ToTempSummon())
if (Unit* summoner = summ->GetSummonerUnit())
{
if (summoner->IsAlive() && summoner->GetTypeId() == TYPEID_PLAYER)
if (summoner->IsAlive() && summoner->IsPlayer())
{
summoner->CastSpell((Unit*)nullptr, SPELL_HARVEST_SOUL_VISUAL, true);
summoner->ExitVehicle(summoner);
@ -3487,7 +3487,7 @@ public:
bool CanAIAttack(Unit const* target) const override
{
return me->GetReactState() == REACT_AGGRESSIVE && target->GetTypeId() == TYPEID_PLAYER && target->GetExactDistSq(495.708f, -2523.76f, 1049.95f) < 40.0f * 40.0f;
return me->GetReactState() == REACT_AGGRESSIVE && target->IsPlayer() && target->GetExactDistSq(495.708f, -2523.76f, 1049.95f) < 40.0f * 40.0f;
}
};

View file

@ -551,7 +551,7 @@ public:
void AttackStart(Unit* target) override
{
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
BossAI::AttackStart(target);
}
@ -564,7 +564,7 @@ public:
bool CanAIAttack(Unit const* target) const override
{
return target->GetTypeId() == TYPEID_PLAYER;
return target->IsPlayer();
}
void JustReachedHome() override
@ -599,7 +599,7 @@ public:
if (!threatList.empty())
for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
if (Unit* target = (*itr)->getTarget())
if (target->IsAlive() && target->GetTypeId() == TYPEID_PLAYER && me->GetExactDist(target) < 200.0f && !target->IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_ALL))
if (target->IsAlive() && target->IsPlayer() && me->GetExactDist(target) < 200.0f && !target->IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_ALL))
return;
EnterEvadeMode();
}

View file

@ -1211,7 +1211,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_CAPTAIN_KILL);
}
@ -1237,7 +1237,7 @@ public:
bool CanAIAttack(Unit const* target) const override
{
// do not see targets inside Frostwing Halls when we are not there
return (me->GetPositionY() > 2660.0f) == (target->GetPositionY() > 2660.0f) && (target->GetTypeId() == TYPEID_PLAYER || target->IsInCombat());
return (me->GetPositionY() > 2660.0f) == (target->GetPositionY() > 2660.0f) && (target->IsPlayer() || target->IsInCombat());
}
void EnterEvadeMode(EvadeReason why) override
@ -2713,7 +2713,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (me->IsAlive() && !me->IsInCombat() && who->GetTypeId() == TYPEID_PLAYER && who->GetExactDist2d(me) < 35.0f)
if (me->IsAlive() && !me->IsInCombat() && who->IsPlayer() && who->GetExactDist2d(me) < 35.0f)
AttackStart(who);
}
@ -3085,7 +3085,7 @@ public:
ScriptedAI::MoveInLineOfSight(who);
else
{
if (!me->IsInCombat() && who->GetTypeId() == TYPEID_PLAYER && me->GetExactDist2dSq(who) < 25.0f * 25.0f && me->CanSeeOrDetect(who) && me->IsValidAttackTarget(who))
if (!me->IsInCombat() && who->IsPlayer() && me->GetExactDist2dSq(who) < 25.0f * 25.0f && me->CanSeeOrDetect(who) && me->IsValidAttackTarget(who))
AttackStart(who);
}
}
@ -3230,7 +3230,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (!_didWebBeam && who->GetTypeId() == TYPEID_PLAYER && me->GetExactDist2d(who) < 70.0f)
if (!_didWebBeam && who->IsPlayer() && me->GetExactDist2d(who) < 70.0f)
{
_didWebBeam = true;
float nx = me->GetPositionX();

View file

@ -184,7 +184,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (!sayGreet && who->GetTypeId() == TYPEID_PLAYER)
if (!sayGreet && who->IsPlayer())
{
Talk(SAY_GREET);
sayGreet = true;

View file

@ -133,7 +133,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (!sayGreet && who->GetTypeId() == TYPEID_PLAYER)
if (!sayGreet && who->IsPlayer())
{
Talk(SAY_GREET);
sayGreet = true;

View file

@ -141,7 +141,7 @@ public:
{
me->ModifyHealth(int32(me->GetMaxHealth() * 0.05f));
}
if (who->GetTypeId() == TYPEID_PLAYER && pInstance)
if (who->IsPlayer() && pInstance)
{
pInstance->SetData(DATA_IMMORTAL_FAIL, 0);
}

View file

@ -597,7 +597,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER && me->GetInstanceScript())
if (who->IsPlayer() && me->GetInstanceScript())
{
me->GetInstanceScript()->SetData(DATA_IMMORTAL_FAIL, 0);
}

View file

@ -110,7 +110,7 @@ public:
void SpellHitTarget(Unit* target, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == RAID_MODE(SPELL_SLIME_SPRAY_10, SPELL_SLIME_SPRAY_25) && target->GetTypeId() == TYPEID_PLAYER)
if (spellInfo->Id == RAID_MODE(SPELL_SLIME_SPRAY_10, SPELL_SLIME_SPRAY_25) && target->IsPlayer())
{
me->SummonCreature(NPC_FALLOUT_SLIME, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
}
@ -138,7 +138,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER && pInstance)
if (who->IsPlayer() && pInstance)
{
pInstance->SetData(DATA_IMMORTAL_FAIL, 0);
}
@ -217,7 +217,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER && me->GetInstanceScript())
if (who->IsPlayer() && me->GetInstanceScript())
{
me->GetInstanceScript()->SetData(DATA_IMMORTAL_FAIL, 0);
}

View file

@ -293,7 +293,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (!me->IsInCombat() && who->GetTypeId() == TYPEID_PLAYER && who->IsAlive() && me->GetDistance(who) <= 50.0f)
if (!me->IsInCombat() && who->IsPlayer() && who->IsAlive() && me->GetDistance(who) <= 50.0f)
AttackStart(who);
}
@ -442,7 +442,7 @@ public:
ThreatContainer::StorageType const& threatList = me->GetThreatMgr().GetThreatList();
for (auto itr : threatList)
{
if (itr->getTarget()->GetTypeId() == TYPEID_PLAYER
if (itr->getTarget()->IsPlayer()
&& itr->getTarget()->getPowerType() == POWER_MANA
&& itr->getTarget()->GetPower(POWER_MANA))
{
@ -618,7 +618,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER && me->GetInstanceScript())
if (who->IsPlayer() && me->GetInstanceScript())
{
me->GetInstanceScript()->SetData(DATA_IMMORTAL_FAIL, 0);
}

View file

@ -103,7 +103,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER && pInstance)
if (who->IsPlayer() && pInstance)
{
pInstance->SetData(DATA_IMMORTAL_FAIL, 0);
}

View file

@ -174,7 +174,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER && pInstance)
if (who->IsPlayer() && pInstance)
{
pInstance->SetData(DATA_IMMORTAL_FAIL, 0);
}

View file

@ -213,7 +213,7 @@ public:
{
Talk(SAY_SLAY);
}
if (who->GetTypeId() == TYPEID_PLAYER && pInstance)
if (who->IsPlayer() && pInstance)
{
pInstance->SetData(DATA_IMMORTAL_FAIL, 0);
}
@ -360,7 +360,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER && me->GetInstanceScript())
if (who->IsPlayer() && me->GetInstanceScript())
{
me->GetInstanceScript()->SetData(DATA_IMMORTAL_FAIL, 0);
}

View file

@ -221,7 +221,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER && pInstance)
if (who->IsPlayer() && pInstance)
{
pInstance->SetData(DATA_IMMORTAL_FAIL, 0);
}
@ -325,7 +325,7 @@ public:
auto i = me->GetThreatMgr().GetThreatList().begin();
for (; i != me->GetThreatMgr().GetThreatList().end(); ++i)
{
if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER)
if ((*i)->getTarget()->IsPlayer())
{
bool inList = false;
if (!blockList.empty())

View file

@ -894,7 +894,7 @@ public:
void PassengerBoarded(Unit* pass, int8 /*seat*/, bool apply) override
{
if (pass && !apply && pass->GetTypeId() == TYPEID_PLAYER)
if (pass && !apply && pass->IsPlayer())
{
Player* plr = pass->ToPlayer();
float speed = plr->GetDistance(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()) / (1.0f * 0.001f);
@ -1258,7 +1258,7 @@ public:
return;
if (apply)
{
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
{
who->ApplySpellImmune(0, IMMUNITY_ID, SPELL_ARCANE_OVERLOAD_DMG, true);
who->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SURGE_OF_POWER_DMG, true);
@ -1286,7 +1286,7 @@ public:
me->SetCanFly(false);
me->GetMotionMaster()->MoveLand(0, me->GetPositionX(), me->GetPositionY(), 267.24f, 10.0f);
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
{
who->ApplySpellImmune(0, IMMUNITY_ID, SPELL_ARCANE_OVERLOAD_DMG, false);
who->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SURGE_OF_POWER_DMG, false);
@ -1456,7 +1456,7 @@ public:
me->SetDisableGravity(false);
me->SendMovementFlagUpdate();
}
else if (pass && pass->GetTypeId() == TYPEID_PLAYER && me->IsAlive())
else if (pass && pass->IsPlayer() && me->IsAlive())
{
me->SetDisplayId(11686); // prevents nasty falling animation at despawn
me->DespawnOrUnsummon(1);

View file

@ -475,7 +475,7 @@ public:
{
if (_attackGUID)
ScriptedAI::MoveInLineOfSight(who);
else if (_isActive && who->GetTypeId() == TYPEID_PLAYER)
else if (_isActive && who->IsPlayer())
{
if ((who->GetPositionX() < me->GetPositionX() || who->GetPositionY() < -220.0f) && me->GetDistance2d(who) < 40)
{

View file

@ -657,7 +657,7 @@ void boss_flame_leviathan::boss_flame_leviathanAI::KilledUnit(Unit* who)
if (who == me->GetVictim())
events.RescheduleEvent(EVENT_PURSUE, 0ms);
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
Talk(FLAME_LEVIATHAN_SAY_SLAY);
}

View file

@ -203,7 +203,7 @@ public:
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
{
if (target && spell && target->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_VEZAX_SHADOW_CRASH_DMG)
if (target && spell && target->IsPlayer() && spell->Id == SPELL_VEZAX_SHADOW_CRASH_DMG)
bAchievShadowdodger = false;
}
@ -367,7 +367,7 @@ public:
void KilledUnit(Unit* who) override
{
if( who->GetTypeId() == TYPEID_PLAYER )
if( who->IsPlayer() )
Talk(SAY_SLAY);
}

View file

@ -560,7 +560,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
Talk(TEXT_SLAY);
}
@ -576,7 +576,7 @@ public:
bool CanAIAttack(Unit const* t) const override
{
if (t->GetTypeId() == TYPEID_PLAYER)
if (t->IsPlayer())
return !t->HasAura(SPELL_FLASH_FREEZE_TRAPPED_PLAYER);
else if (t->GetTypeId() == TYPEID_UNIT)
return !t->HasAura(SPELL_FLASH_FREEZE_TRAPPED_NPC);
@ -702,9 +702,9 @@ public:
{
if (Unit* s = me->ToTempSummon()->GetSummonerUnit())
{
if ((s->GetTypeId() == TYPEID_PLAYER && !s->HasAura(SPELL_FLASH_FREEZE_TRAPPED_PLAYER)) || (s->GetTypeId() == TYPEID_UNIT && !s->HasAura(SPELL_FLASH_FREEZE_TRAPPED_NPC)))
if ((s->IsPlayer() && !s->HasAura(SPELL_FLASH_FREEZE_TRAPPED_PLAYER)) || (s->GetTypeId() == TYPEID_UNIT && !s->HasAura(SPELL_FLASH_FREEZE_TRAPPED_NPC)))
me->DespawnOrUnsummon(2000);
else if (s->GetTypeId() == TYPEID_PLAYER)
else if (s->IsPlayer())
if (InstanceScript* instanceScript = me->GetInstanceScript())
if (instanceScript->GetData(TYPE_HODIR) == NOT_STARTED)
{
@ -1211,7 +1211,7 @@ class spell_hodir_biting_cold_main_aura : public AuraScript
{
if ((aurEff->GetTickNumber() % 4) == 0)
if (Unit* target = GetTarget())
if (target->GetTypeId() == TYPEID_PLAYER
if (target->IsPlayer()
&& !target->isMoving()
&& !target->HasAura(SPELL_BITING_COLD_PLAYER_AURA)
&& !target->HasAura(SPELL_MAGE_TOASTY_FIRE_AURA))
@ -1357,7 +1357,7 @@ class spell_hodir_flash_freeze_aura : public AuraScript
if (!target || !caster || caster->GetTypeId() != TYPEID_UNIT)
return;
if (Aura* aur = target->GetAura(target->GetTypeId() == TYPEID_PLAYER ? SPELL_FLASH_FREEZE_TRAPPED_PLAYER : SPELL_FLASH_FREEZE_TRAPPED_NPC))
if (Aura* aur = target->GetAura(target->IsPlayer() ? SPELL_FLASH_FREEZE_TRAPPED_PLAYER : SPELL_FLASH_FREEZE_TRAPPED_NPC))
{
if (Unit* caster2 = aur->GetCaster())
{
@ -1369,7 +1369,7 @@ class spell_hodir_flash_freeze_aura : public AuraScript
target->CastSpell(target, SPELL_FLASH_FREEZE_INSTAKILL, true);
return;
}
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
{
caster->ToCreature()->AI()->SetData(1, 1);
if( Creature* c = target->SummonCreature(NPC_FLASH_FREEZE_PLR, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 5 * 60 * 1000) )
@ -1409,7 +1409,7 @@ class spell_hodir_storm_power_aura : public AuraScript
void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* target = GetTarget())
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, GetId(), 0, GetCaster());
}
@ -1449,7 +1449,7 @@ class spell_hodir_toasty_fire_aura : public AuraScript
void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* target = GetTarget())
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, SPELL_MAGE_TOASTY_FIRE_AURA, 0, GetCaster());
}
@ -1466,7 +1466,7 @@ class spell_hodir_starlight_aura : public AuraScript
void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* target = GetTarget())
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, SPELL_DRUID_STARLIGHT_AREA_AURA, 0, GetCaster());
}

View file

@ -290,7 +290,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_SLAY);
}

View file

@ -174,7 +174,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER && me->GetExactDist2d(who) < 45.0f && me->getStandState() == UNIT_STAND_STATE_SUBMERGED)
if (who->IsPlayer() && me->GetExactDist2d(who) < 45.0f && me->getStandState() == UNIT_STAND_STATE_SUBMERGED)
{
me->SetStandState(UNIT_STAND_STATE_STAND);
if (Unit* arm = ObjectAccessor::GetCreature(*me, _left))

View file

@ -1186,7 +1186,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
if (Creature* c = GetMimiron())
{
if (Phase == 1)
@ -1522,7 +1522,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
if (Creature* c = GetMimiron())
{
if (Phase == 2)
@ -1827,7 +1827,7 @@ public:
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
if (who->IsPlayer())
if (Creature* c = GetMimiron())
{
if (Phase == 3)
@ -1909,7 +1909,7 @@ public:
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
{
if (target && spell && target->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_MINE_EXPLOSION)
if (target && spell && target->IsPlayer() && spell->Id == SPELL_MINE_EXPLOSION)
if (InstanceScript* pInstance = me->GetInstanceScript())
if (Creature* c = GetMimiron())
c->AI()->SetData(0, 11);
@ -2450,7 +2450,7 @@ public:
{
if (target->GetEntry() == NPC_ASSAULT_BOT)
me->CastSpell(me, 65040, true); // achievement Not-So-Friendly Fire
else if (target->GetTypeId() == TYPEID_PLAYER)
else if (target->IsPlayer())
if (InstanceScript* pInstance = me->GetInstanceScript())
if (Creature* c = GetMimiron())
c->AI()->SetData(0, 13);

View file

@ -510,7 +510,7 @@ public:
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
if (victim->IsPlayer())
Talk(SAY_SLAY);
}
@ -528,7 +528,7 @@ public:
void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) override
{
if (who && _isHitAllowed && who->GetPositionZ() > 430 && who->GetTypeId() == TYPEID_PLAYER)
if (who && _isHitAllowed && who->GetPositionZ() > 430 && who->IsPlayer())
{
_isHitAllowed = false;
DisableThorim(false);
@ -640,7 +640,7 @@ public:
void SpellHitTarget(Unit* target, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_LIGHTNING_CHARGE_DAMAGE && target->GetTypeId() == TYPEID_PLAYER)
if (spellInfo->Id == SPELL_LIGHTNING_CHARGE_DAMAGE && target->IsPlayer())
_hitByLightning = true;
}
@ -1111,7 +1111,7 @@ public:
void DamageTaken(Unit* who, uint32&, DamageEffectType, SpellSchoolMask) override
{
if (!_playerAttack && who && (who->GetTypeId() == TYPEID_PLAYER || who->GetOwnerGUID().IsPlayer()))
if (!_playerAttack && who && (who->IsPlayer() || who->GetOwnerGUID().IsPlayer()))
{
if (me->GetInstanceScript())
if (Creature* thorim = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetGuidData(TYPE_THORIM)))

Some files were not shown because too many files have changed in this diff Show more