mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-26 15:16:24 +00:00
refactor(Core/Object): adds consistency in the use of type object check (#19671)
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ public:
|
||||
|
||||
void KilledUnit(Unit* victim) override
|
||||
{
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
||||
if (victim->IsPlayer())
|
||||
Talk(SAY_SLAY);
|
||||
}
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)))
|
||||
|
||||
@@ -225,7 +225,7 @@ public:
|
||||
|
||||
void KilledUnit(Unit* victim) override
|
||||
{
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER && !urand(0, 2))
|
||||
if (victim->IsPlayer() && !urand(0, 2))
|
||||
{
|
||||
Talk(SAY_SLAY);
|
||||
}
|
||||
|
||||
@@ -1097,7 +1097,7 @@ public:
|
||||
void OnUnitDeath(Unit* unit) override
|
||||
{
|
||||
// Feeds on Tears achievement
|
||||
if (unit->GetTypeId() == TYPEID_PLAYER)
|
||||
if (unit->IsPlayer())
|
||||
{
|
||||
if (GetData(TYPE_ALGALON) == IN_PROGRESS)
|
||||
if (Creature* algalon = instance->GetCreature(m_uiAlgalonGUID))
|
||||
@@ -1114,7 +1114,7 @@ public:
|
||||
}
|
||||
|
||||
// achievement Champion/Conqueror of Ulduar
|
||||
if (unit->GetTypeId() == TYPEID_PLAYER)
|
||||
if (unit->IsPlayer())
|
||||
for (uint8 i = 0; i <= 12; ++i)
|
||||
{
|
||||
bool go = false;
|
||||
|
||||
@@ -239,7 +239,7 @@ struct npc_ulduar_snow_mound : public ScriptedAI
|
||||
|
||||
void MoveInLineOfSight(Unit* who) override
|
||||
{
|
||||
if (!_activated && who->GetTypeId() == TYPEID_PLAYER)
|
||||
if (!_activated && who->IsPlayer())
|
||||
{
|
||||
if (me->GetExactDist2d(who) <= 10.0f && me->GetMap()->isInLineOfSight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 5.0f,
|
||||
who->GetPositionX(), who->GetPositionY(), who->GetPositionZ() + 5.0f, 2, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::Nothing))
|
||||
|
||||
Reference in New Issue
Block a user