From 643362d69702cbd353ac7933f714e1671f8b07e1 Mon Sep 17 00:00:00 2001 From: Grimdhex <176165533+Grimdhex@users.noreply.github.com> Date: Sun, 25 Aug 2024 14:57:37 +0200 Subject: [PATCH] refactor(Core/Object): adds consistency in the use of type object check (#19671) --- src/server/game/AI/CoreAI/PetAI.cpp | 10 +- src/server/game/AI/CoreAI/TotemAI.cpp | 2 +- src/server/game/AI/CoreAI/UnitAI.cpp | 4 +- .../game/AI/ScriptedAI/ScriptedCreature.cpp | 2 +- src/server/game/AI/SmartScripts/SmartAI.cpp | 2 +- .../game/AI/SmartScripts/SmartScript.cpp | 4 +- .../game/Battlefield/Zones/BattlefieldWG.cpp | 6 +- src/server/game/Combat/ThreatMgr.cpp | 4 +- src/server/game/Conditions/DisableMgr.cpp | 2 +- .../game/Entities/Creature/Creature.cpp | 4 +- .../Entities/Creature/TemporarySummon.cpp | 10 +- .../game/Entities/GameObject/GameObject.cpp | 6 +- src/server/game/Entities/Object/Object.cpp | 32 +- src/server/game/Entities/Object/Object.h | 29 +- src/server/game/Entities/Pet/Pet.cpp | 14 +- .../game/Entities/Player/KillRewarder.cpp | 6 +- src/server/game/Entities/Player/Player.cpp | 10 +- .../game/Entities/Player/PlayerQuest.cpp | 2 +- .../game/Entities/Player/PlayerUpdates.cpp | 2 +- src/server/game/Entities/Totem/Totem.cpp | 2 +- .../game/Entities/Transport/Transport.cpp | 4 +- src/server/game/Entities/Unit/CharmInfo.cpp | 2 +- src/server/game/Entities/Unit/Unit.cpp | 326 +++++++++--------- src/server/game/Entities/Vehicle/Vehicle.cpp | 20 +- src/server/game/Globals/ObjectAccessor.cpp | 2 +- .../game/Grids/Notifiers/GridNotifiers.cpp | 2 +- .../game/Grids/Notifiers/GridNotifiers.h | 15 +- src/server/game/Handlers/PetHandler.cpp | 12 +- src/server/game/Handlers/QuestHandler.cpp | 6 +- src/server/game/Handlers/SpellHandler.cpp | 6 +- src/server/game/Maps/Map.cpp | 2 +- src/server/game/Movement/MotionMaster.cpp | 46 +-- .../TargetedMovementGenerator.cpp | 6 +- src/server/game/Scripting/MapScripts.cpp | 4 +- .../game/Spells/Auras/SpellAuraEffects.cpp | 102 +++--- src/server/game/Spells/Auras/SpellAuras.cpp | 14 +- src/server/game/Spells/Spell.cpp | 134 +++---- src/server/game/Spells/SpellEffects.cpp | 62 ++-- src/server/game/Spells/SpellInfo.cpp | 8 +- src/server/scripts/Commands/cs_debug.cpp | 2 +- src/server/scripts/Commands/cs_misc.cpp | 14 +- src/server/scripts/Commands/cs_modify.cpp | 14 +- src/server/scripts/Commands/cs_pet.cpp | 2 +- .../BlackwingLair/boss_nefarian.cpp | 2 +- .../EasternKingdoms/Karazhan/boss_curator.cpp | 2 +- .../Karazhan/boss_maiden_of_virtue.cpp | 2 +- .../Karazhan/boss_midnight.cpp | 2 +- .../EasternKingdoms/Karazhan/boss_moroes.cpp | 2 +- .../Karazhan/boss_netherspite.cpp | 4 +- .../Karazhan/boss_terestian_illhoof.cpp | 2 +- .../boss_felblood_kaelthas.cpp | 2 +- .../boss_priestess_delrissa.cpp | 2 +- .../MagistersTerrace/boss_selin_fireheart.cpp | 2 +- .../MagistersTerrace/boss_vexallus.cpp | 2 +- .../ScarletEnclave/chapter2.cpp | 2 +- .../SunwellPlateau/boss_brutallus.cpp | 2 +- .../SunwellPlateau/boss_eredar_twins.cpp | 4 +- .../SunwellPlateau/boss_felmyst.cpp | 2 +- .../SunwellPlateau/boss_kalecgos.cpp | 4 +- .../SunwellPlateau/boss_kiljaeden.cpp | 2 +- .../EasternKingdoms/ZulAman/boss_akilzon.cpp | 2 +- .../EasternKingdoms/ZulAman/zulaman.cpp | 2 +- .../EasternKingdoms/ZulGurub/boss_marli.cpp | 2 +- .../scripts/EasternKingdoms/zone_duskwood.cpp | 4 +- .../zone_isle_of_queldanas.cpp | 2 +- .../EasternKingdoms/zone_tirisfal_glades.cpp | 4 +- src/server/scripts/Events/brewfest.cpp | 6 +- src/server/scripts/Events/love_in_air.cpp | 8 +- src/server/scripts/Events/midsummer.cpp | 6 +- src/server/scripts/Events/pilgrims_bounty.cpp | 2 +- .../culling_of_stratholme.cpp | 2 +- .../boss_epoch_hunter.cpp | 2 +- .../boss_lieutenant_drake.cpp | 2 +- .../TheBlackMorass/the_black_morass.cpp | 2 +- .../Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp | 2 +- .../Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp | 2 +- .../Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp | 2 +- .../TempleOfAhnQiraj/boss_twinemperors.cpp | 2 +- src/server/scripts/Kalimdor/boss_azuregos.cpp | 2 +- src/server/scripts/Kalimdor/zone_azshara.cpp | 2 +- .../scripts/Kalimdor/zone_azuremyst_isle.cpp | 2 +- .../scripts/Kalimdor/zone_bloodmyst_isle.cpp | 2 +- .../Kalimdor/zone_dustwallow_marsh.cpp | 2 +- .../scripts/Kalimdor/zone_orgrimmar.cpp | 2 +- src/server/scripts/Kalimdor/zone_tanaris.cpp | 2 +- .../AzjolNerub/AzjolNerub/boss_anubarak.cpp | 2 +- .../AzjolNerub/ahnkahet/boss_elder_nadox.cpp | 2 +- .../ahnkahet/boss_herald_volazj.cpp | 2 +- .../ahnkahet/boss_prince_taldaram.cpp | 2 +- .../ObsidianSanctum/boss_sartharion.cpp | 2 +- .../RubySanctum/boss_halion.cpp | 4 +- .../boss_argent_challenge.cpp | 4 +- .../TrialOfTheChampion/boss_black_knight.cpp | 4 +- .../boss_anubarak_trial.cpp | 2 +- .../boss_faction_champions.cpp | 2 +- .../boss_northrend_beasts.cpp | 6 +- .../TrialOfTheCrusader/boss_twin_valkyr.cpp | 2 +- .../instance_trial_of_the_crusader.cpp | 2 +- .../DraktharonKeep/boss_trollgore.cpp | 2 +- .../ForgeOfSouls/boss_bronjahm.cpp | 2 +- .../HallsOfReflection/boss_falric.cpp | 2 +- .../HallsOfReflection/boss_marwyn.cpp | 2 +- .../PitOfSaron/boss_forgemaster_garfrost.cpp | 2 +- .../PitOfSaron/boss_krickandick.cpp | 4 +- .../PitOfSaron/boss_scourgelord_tyrannus.cpp | 2 +- .../FrozenHalls/PitOfSaron/pit_of_saron.cpp | 4 +- .../Gundrak/boss_drakkari_colossus.cpp | 2 +- .../boss_blood_prince_council.cpp | 8 +- .../boss_blood_queen_lana_thel.cpp | 2 +- .../boss_deathbringer_saurfang.cpp | 2 +- .../IcecrownCitadel/boss_festergut.cpp | 2 +- .../boss_icecrown_gunship_battle.cpp | 4 +- .../boss_lady_deathwhisper.cpp | 2 +- .../IcecrownCitadel/boss_lord_marrowgar.cpp | 4 +- .../boss_professor_putricide.cpp | 2 +- .../IcecrownCitadel/boss_rotface.cpp | 2 +- .../IcecrownCitadel/boss_sindragosa.cpp | 6 +- .../IcecrownCitadel/boss_the_lich_king.cpp | 14 +- .../boss_valithria_dreamwalker.cpp | 6 +- .../IcecrownCitadel/icecrown_citadel.cpp | 10 +- .../Northrend/Naxxramas/boss_anubrekhan.cpp | 2 +- .../Northrend/Naxxramas/boss_faerlina.cpp | 2 +- .../Northrend/Naxxramas/boss_gluth.cpp | 2 +- .../Northrend/Naxxramas/boss_gothik.cpp | 2 +- .../Northrend/Naxxramas/boss_grobbulus.cpp | 6 +- .../Northrend/Naxxramas/boss_kelthuzad.cpp | 6 +- .../Northrend/Naxxramas/boss_loatheb.cpp | 2 +- .../Northrend/Naxxramas/boss_maexxna.cpp | 2 +- .../Northrend/Naxxramas/boss_razuvious.cpp | 4 +- .../Northrend/Naxxramas/boss_sapphiron.cpp | 4 +- .../Nexus/EyeOfEternity/boss_malygos.cpp | 8 +- .../Ulduar/HallsOfLightning/boss_volkhan.cpp | 2 +- .../Ulduar/Ulduar/boss_flame_leviathan.cpp | 2 +- .../Ulduar/Ulduar/boss_general_vezax.cpp | 4 +- .../Northrend/Ulduar/Ulduar/boss_hodir.cpp | 20 +- .../Northrend/Ulduar/Ulduar/boss_ignis.cpp | 2 +- .../Northrend/Ulduar/Ulduar/boss_kologarn.cpp | 2 +- .../Northrend/Ulduar/Ulduar/boss_mimiron.cpp | 10 +- .../Northrend/Ulduar/Ulduar/boss_thorim.cpp | 8 +- .../Northrend/Ulduar/Ulduar/boss_xt002.cpp | 2 +- .../Ulduar/Ulduar/instance_ulduar.cpp | 4 +- .../Northrend/Ulduar/Ulduar/ulduar.cpp | 2 +- .../UtgardePinnacle/boss_svala.cpp | 2 +- .../scripts/Northrend/isle_of_conquest.cpp | 2 +- .../scripts/Northrend/zone_borean_tundra.cpp | 4 +- .../scripts/Northrend/zone_dragonblight.cpp | 4 +- .../scripts/Northrend/zone_grizzly_hills.cpp | 4 +- .../scripts/Northrend/zone_howling_fjord.cpp | 2 +- .../scripts/Northrend/zone_sholazar_basin.cpp | 4 +- .../scripts/Northrend/zone_storm_peaks.cpp | 10 +- src/server/scripts/Northrend/zone_zuldrak.cpp | 2 +- .../scripts/OutdoorPvP/OutdoorPvPNA.cpp | 2 +- .../AuchenaiCrypts/boss_exarch_maladaar.cpp | 2 +- .../ManaTombs/boss_nexusprince_shaffar.cpp | 4 +- .../Auchindoun/ManaTombs/boss_pandemonius.cpp | 2 +- .../SethekkHalls/boss_darkweaver_syth.cpp | 2 +- .../boss_grandmaster_vorpil.cpp | 2 +- .../BlackTemple/boss_warlord_najentus.cpp | 2 +- .../SerpentShrine/boss_lady_vashj.cpp | 2 +- .../SteamVault/boss_warlord_kalithresh.cpp | 2 +- .../BloodFurnace/boss_the_maker.cpp | 2 +- .../boss_watchkeeper_gargolmar.cpp | 2 +- .../ShatteredHalls/boss_warbringer_omrogg.cpp | 2 +- .../boss_warchief_kargath_bladefist.cpp | 2 +- .../TempestKeep/Eye/boss_astromancer.cpp | 2 +- .../Outland/TempestKeep/Eye/boss_kaelthas.cpp | 6 +- .../scripts/Outland/boss_doomlord_kazzak.cpp | 2 +- .../scripts/Outland/boss_doomwalker.cpp | 2 +- .../Outland/zone_blades_edge_mountains.cpp | 4 +- .../Outland/zone_hellfire_peninsula.cpp | 2 +- .../Outland/zone_shadowmoon_valley.cpp | 6 +- src/server/scripts/Pet/pet_dk.cpp | 2 +- src/server/scripts/Pet/pet_generic.cpp | 2 +- src/server/scripts/Pet/pet_mage.cpp | 2 +- src/server/scripts/Spells/spell_dk.cpp | 14 +- src/server/scripts/Spells/spell_druid.cpp | 10 +- src/server/scripts/Spells/spell_generic.cpp | 28 +- src/server/scripts/Spells/spell_hunter.cpp | 10 +- src/server/scripts/Spells/spell_item.cpp | 38 +- src/server/scripts/Spells/spell_mage.cpp | 4 +- src/server/scripts/Spells/spell_paladin.cpp | 6 +- src/server/scripts/Spells/spell_priest.cpp | 6 +- src/server/scripts/Spells/spell_quest.cpp | 20 +- src/server/scripts/Spells/spell_rogue.cpp | 10 +- src/server/scripts/Spells/spell_shaman.cpp | 8 +- src/server/scripts/Spells/spell_warlock.cpp | 14 +- .../scripts/World/boss_emerald_dragons.cpp | 6 +- src/server/scripts/World/guards.cpp | 4 +- .../scripts/World/npc_stave_of_ancients.cpp | 2 +- 189 files changed, 783 insertions(+), 775 deletions(-) diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 96a340f9c..6d1892b0f 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -33,7 +33,7 @@ int32 PetAI::Permissible(Creature const* creature) { if (creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)) { - if (reinterpret_cast(creature)->GetOwner()->GetTypeId() == TYPEID_PLAYER) + if (reinterpret_cast(creature)->GetOwner()->IsPlayer()) return PERMIT_BASE_PROACTIVE; return PERMIT_BASE_REACTIVE; } @@ -210,7 +210,7 @@ void PetAI::UpdateAI(uint32 diff) // Autocast (casted only in combat or persistent spells in any state) if (!me->HasUnitState(UNIT_STATE_CASTING)) { - if (owner && owner->GetTypeId() == TYPEID_PLAYER && me->GetCharmInfo()->GetForcedSpell() && me->GetCharmInfo()->GetForcedTarget()) + if (owner && owner->IsPlayer() && me->GetCharmInfo()->GetForcedSpell() && me->GetCharmInfo()->GetForcedTarget()) { owner->ToPlayer()->GetSession()->HandlePetActionHelper(me, me->GetGUID(), std::abs(me->GetCharmInfo()->GetForcedSpell()), ACT_ENABLED, me->GetCharmInfo()->GetForcedTarget()); @@ -332,10 +332,10 @@ void PetAI::UpdateAI(uint32 diff) if (!me->HasInArc(M_PI, target)) { me->SetInFront(target); - if (target && target->GetTypeId() == TYPEID_PLAYER) + if (target && target->IsPlayer()) me->SendUpdateToPlayer(target->ToPlayer()); - if (owner && owner->GetTypeId() == TYPEID_PLAYER) + if (owner && owner->IsPlayer()) me->SendUpdateToPlayer(owner->ToPlayer()); } @@ -359,7 +359,7 @@ void PetAI::UpdateAllies() if (!owner) return; - else if (owner->GetTypeId() == TYPEID_PLAYER) + else if (owner->IsPlayer()) group = owner->ToPlayer()->GetGroup(); //only pet and owner/not in group->ok diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp index 03b105a76..c49ce38ad 100644 --- a/src/server/game/AI/CoreAI/TotemAI.cpp +++ b/src/server/game/AI/CoreAI/TotemAI.cpp @@ -129,7 +129,7 @@ void TotemAI::UpdateAI(uint32 /*diff*/) void TotemAI::AttackStart(Unit* /*victim*/) { // Sentry totem sends ping on attack - if (me->GetEntry() == SENTRY_TOTEM_ENTRY && me->GetOwner()->GetTypeId() == TYPEID_PLAYER) + if (me->GetEntry() == SENTRY_TOTEM_ENTRY && me->GetOwner()->IsPlayer()) { WorldPacket data(MSG_MINIMAP_PING, (8 + 4 + 4)); data << me->GetGUID(); diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp index fc2508ae0..9f08ceb37 100644 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -140,7 +140,7 @@ SpellCastResult UnitAI::DoAddAuraToAllHostilePlayers(uint32 spellid) { if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) { - if (unit->GetTypeId() == TYPEID_PLAYER) + if (unit->IsPlayer()) { me->AddAura(spellid, unit); return SPELL_CAST_OK; @@ -163,7 +163,7 @@ SpellCastResult UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered { if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) { - if (unit->GetTypeId() == TYPEID_PLAYER) + if (unit->IsPlayer()) return me->CastSpell(unit, spellid, triggered); } else diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index cab036c52..39eeed124 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -668,7 +668,7 @@ void BossAI::TeleportCheaters() ThreatContainer::StorageType threatList = me->GetThreatMgr().GetThreatList(); for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) if (Unit* target = (*itr)->getTarget()) - if (target->GetTypeId() == TYPEID_PLAYER && !IsInBoundary(target)) + if (target->IsPlayer() && !IsInBoundary(target)) target->NearTeleportTo(x, y, z, 0); } diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index b38464bc0..aa64e7c0a 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -202,7 +202,7 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* invoker) mCanRepeatPath = repeat; SetRun(run); - if (invoker && invoker->GetTypeId() == TYPEID_PLAYER) + if (invoker && invoker->IsPlayer()) { mEscortNPCFlags = me->GetNpcFlags(); me->ReplaceAllNpcFlags(UNIT_NPC_FLAG_NONE); diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index c680cc4cc..e44c03d47 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -5220,12 +5220,12 @@ WorldObject* SmartScript::GetLastInvoker(WorldObject* invoker) const bool SmartScript::IsUnit(WorldObject* obj) { - return obj && (obj->GetTypeId() == TYPEID_UNIT || obj->GetTypeId() == TYPEID_PLAYER); + return obj && (obj->GetTypeId() == TYPEID_UNIT || obj->IsPlayer()); } bool SmartScript::IsPlayer(WorldObject* obj) { - return obj && obj->GetTypeId() == TYPEID_PLAYER; + return obj && obj->IsPlayer(); } bool SmartScript::IsCreature(WorldObject* obj) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index ce81b448b..7052f3275 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -720,9 +720,9 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) TeamId killerTeam = killer->GetTeamId(); // xinef: tower cannons also grant rank - if (victim->GetTypeId() == TYPEID_PLAYER || IsKeepNpc(victim->GetEntry()) || victim->GetEntry() == NPC_WINTERGRASP_TOWER_CANNON) + if (victim->IsPlayer() || IsKeepNpc(victim->GetEntry()) || victim->GetEntry() == NPC_WINTERGRASP_TOWER_CANNON) { - if (victim->GetTypeId() == TYPEID_PLAYER && victim->HasAura(SPELL_LIEUTENANT)) + if (victim->IsPlayer() && victim->HasAura(SPELL_LIEUTENANT)) { // Quest - Wintergrasp - PvP Kill - Horde/Alliance for (auto& playerGuid : m_PlayersInWar[killerTeam]) @@ -749,7 +749,7 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) } // Xinef: Allow to Skin non-released corpse - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) { victim->SetUnitFlag(UNIT_FLAG_SKINNABLE); } diff --git a/src/server/game/Combat/ThreatMgr.cpp b/src/server/game/Combat/ThreatMgr.cpp index 21b3741d8..92ca0c049 100644 --- a/src/server/game/Combat/ThreatMgr.cpp +++ b/src/server/game/Combat/ThreatMgr.cpp @@ -66,7 +66,7 @@ bool ThreatCalcHelper::isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellIn return false; // not to GM - if (hatedUnit->GetTypeId() == TYPEID_PLAYER && hatedUnit->ToPlayer()->IsGameMaster()) + if (hatedUnit->IsPlayer() && hatedUnit->ToPlayer()->IsGameMaster()) return false; // not to dead and not for dead @@ -498,7 +498,7 @@ void ThreatMgr::_addThreat(Unit* victim, float threat) HostileReference* hostileRef = new HostileReference(victim, this, 0); iThreatContainer.addReference(hostileRef); hostileRef->AddThreat(threat); // now we add the real threat - if (victim->GetTypeId() == TYPEID_PLAYER && victim->ToPlayer()->IsGameMaster()) + if (victim->IsPlayer() && victim->ToPlayer()->IsGameMaster()) hostileRef->setOnlineOfflineState(false); // GM is always offline } } diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index b26272e32..5385612ff 100644 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.cpp @@ -325,7 +325,7 @@ namespace DisableMgr uint8 spellFlags = itr->second.flags; if (unit) { - if ((spellFlags & SPELL_DISABLE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) || + if ((spellFlags & SPELL_DISABLE_PLAYER && unit->IsPlayer()) || (unit->GetTypeId() == TYPEID_UNIT && ((unit->IsPet() && spellFlags & SPELL_DISABLE_PET) || spellFlags & SPELL_DISABLE_CREATURE))) { if (spellFlags & SPELL_DISABLE_MAP) diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 1c84cb317..6cb389301 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1905,13 +1905,13 @@ bool Creature::CanStartAttack(Unit const* who) const // This set of checks is should be done only for creatures if ((IsImmuneToNPC() && who->GetTypeId() != TYPEID_PLAYER) || // flag is valid only for non player characters - (IsImmuneToPC() && who->GetTypeId() == TYPEID_PLAYER)) // immune to PC and target is a player, return false + (IsImmuneToPC() && who->IsPlayer())) // immune to PC and target is a player, return false { return false; } if (Unit* owner = who->GetOwner()) - if (owner->GetTypeId() == TYPEID_PLAYER && IsImmuneToPC()) // immune to PC and target has player owner + if (owner->IsPlayer() && IsImmuneToPC()) // immune to PC and target has player owner return false; // Do not attack non-combat pets diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index 673eedc92..b080b772e 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -218,11 +218,11 @@ void TempSummon::InitStats(uint32 duration) { SetFaction(owner->GetFaction()); SetLevel(owner->GetLevel()); - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) m_ControlledByPlayer = true; } - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) m_CreatedByPlayer = true; } @@ -397,7 +397,7 @@ void Minion::setDeathState(DeathState s, bool despawn) Creature::setDeathState(s, despawn); if (s == DeathState::JustDied && IsGuardianPet()) if (Unit* owner = GetOwner()) - if (owner->GetTypeId() == TYPEID_PLAYER && owner->GetMinionGUID() == GetGUID()) + if (owner->IsPlayer() && owner->GetMinionGUID() == GetGUID()) for (Unit::ControlSet::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr) if ((*itr)->IsAlive() && (*itr)->GetEntry() == GetEntry()) { @@ -434,7 +434,7 @@ void Guardian::InitStats(uint32 duration) { InitStatsForLevel(m_owner->GetLevel()); - if (m_owner->GetTypeId() == TYPEID_PLAYER && HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)) + if (m_owner->IsPlayer() && HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)) m_charmInfo->InitCharmCreateSpells(); } @@ -447,7 +447,7 @@ void Guardian::InitSummon() if (Unit* m_owner = GetOwner()) { - if (m_owner->GetTypeId() == TYPEID_PLAYER && m_owner->GetMinionGUID() == GetGUID() && !m_owner->GetCharmGUID()) + if (m_owner->IsPlayer() && m_owner->GetMinionGUID() == GetGUID() && !m_owner->GetCharmGUID()) { m_owner->ToPlayer()->CharmSpellInitialize(); } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 7008ce476..3259ec0e1 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -510,7 +510,7 @@ void GameObject::Update(uint32 diff) { // splash bobber (bobber ready now) Unit* caster = GetOwner(); - if (caster && caster->GetTypeId() == TYPEID_PLAYER) + if (caster && caster->IsPlayer()) { SetGoState(GO_STATE_ACTIVE); ReplaceAllGameObjectFlags(GO_FLAG_NODESPAWN); @@ -634,7 +634,7 @@ void GameObject::Update(uint32 diff) case GAMEOBJECT_TYPE_FISHINGNODE: // can't fish now { Unit* caster = GetOwner(); - if (caster && caster->GetTypeId() == TYPEID_PLAYER) + if (caster && caster->IsPlayer()) { caster->ToPlayer()->RemoveGameObject(this, false); @@ -1635,7 +1635,7 @@ void GameObject::Use(Unit* user) if (HasGameObjectFlag(GO_FLAG_IN_USE)) return; - if (user->GetTypeId() == TYPEID_PLAYER) + if (user->IsPlayer()) { Player* player = user->ToPlayer(); diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index e6b60ffca..d494cd8da 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -90,7 +90,7 @@ WorldObject::~WorldObject() // this may happen because there are many !create/delete if (IsWorldObject() && m_currMap) { - if (GetTypeId() == TYPEID_CORPSE) + if (IsCorpse()) { LOG_FATAL("entities.object", "Object::~Object Corpse {}, type={} deleted but still in map!!", GetGUID().ToString(), ((Corpse*)this)->GetType()); ABORT(); @@ -403,7 +403,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const *data << object->GetOrientation(); - if (GetTypeId() == TYPEID_CORPSE) + if (IsCorpse()) *data << float(object->GetOrientation()); else *data << float(0); @@ -1087,7 +1087,7 @@ void WorldObject::setActive(bool on) if (m_isActive == on) return; - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) return; m_isActive = on; @@ -1103,7 +1103,7 @@ void WorldObject::setActive(bool on) { if (GetTypeId() == TYPEID_UNIT) map->AddToActive(this->ToCreature()); - else if (GetTypeId() == TYPEID_DYNAMICOBJECT) + else if (IsDynamicObject()) map->AddToActive((DynamicObject*)this); else if (GetTypeId() == TYPEID_GAMEOBJECT) map->AddToActive((GameObject*)this); @@ -1112,7 +1112,7 @@ void WorldObject::setActive(bool on) { if (GetTypeId() == TYPEID_UNIT) map->RemoveFromActive(this->ToCreature()); - else if (GetTypeId() == TYPEID_DYNAMICOBJECT) + else if (IsDynamicObject()) map->RemoveFromActive((DynamicObject*)this); else if (GetTypeId() == TYPEID_GAMEOBJECT) map->RemoveFromActive((GameObject*)this); @@ -1122,7 +1122,7 @@ void WorldObject::setActive(bool on) void WorldObject::SetVisibilityDistanceOverride(VisibilityDistanceType type) { ASSERT(type < VisibilityDistanceType::Max); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { return; } @@ -1329,7 +1329,7 @@ bool WorldObject::IsWithinLOS(float ox, float oy, float oz, VMAP::ModelIgnoreFla { oz += GetCollisionHeight(); float x, y, z; - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { GetPosition(x, y, z); z += GetCollisionHeight(); @@ -1350,7 +1350,7 @@ bool WorldObject::IsWithinLOSInMap(WorldObject const* obj, VMAP::ModelIgnoreFlag return false; float ox, oy, oz; - if (obj->GetTypeId() == TYPEID_PLAYER) + if (obj->IsPlayer()) { obj->GetPosition(ox, oy, oz); oz += obj->GetCollisionHeight(); @@ -1359,7 +1359,7 @@ bool WorldObject::IsWithinLOSInMap(WorldObject const* obj, VMAP::ModelIgnoreFlag obj->GetHitSpherePointFor({ GetPositionX(), GetPositionY(), GetPositionZ() + (collisionHeight ? *collisionHeight : GetCollisionHeight()) }, ox, oy, oz); float x, y, z; - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { GetPosition(x, y, z); z += GetCollisionHeight(); @@ -1634,7 +1634,7 @@ float WorldObject::GetGridActivationRange() const { return ToCreature()->m_SightDistance; } - else if (((GetTypeId() == TYPEID_GAMEOBJECT && ToGameObject()->IsTransport()) || GetTypeId() == TYPEID_DYNAMICOBJECT) && isActiveObject()) + else if (((GetTypeId() == TYPEID_GAMEOBJECT && ToGameObject()->IsTransport()) || IsDynamicObject()) && isActiveObject()) { return GetMap()->GetVisibilityRange(); } @@ -1762,7 +1762,7 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo } // pussywizard: arena spectator - if (obj->GetTypeId() == TYPEID_PLAYER) + if (obj->IsPlayer()) if (((Player const*)obj)->IsSpectator() && ((Player const*)obj)->FindMap()->IsBattleArena()) return false; @@ -1858,7 +1858,7 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo return false; // pussywizard: arena spectator - if (this->GetTypeId() == TYPEID_PLAYER) + if (this->IsPlayer()) if (((Player const*)this)->IsSpectator() && ((Player const*)this)->FindMap()->IsBattleArena() && (obj->m_invisibility.GetFlags() || obj->m_stealth.GetFlags())) return false; @@ -2035,7 +2035,7 @@ bool WorldObject::CanDetectStealthOf(WorldObject const* obj, bool checkAlert) co Unit const* unit = ToUnit(); // If this unit is an NPC then player detect range doesn't apply - if (unit && unit->GetTypeId() == TYPEID_PLAYER && visibilityRange > MAX_PLAYER_STEALTH_DETECT_RANGE) + if (unit && unit->IsPlayer() && visibilityRange > MAX_PLAYER_STEALTH_DETECT_RANGE) visibilityRange = MAX_PLAYER_STEALTH_DETECT_RANGE; if (checkAlert) @@ -2058,7 +2058,7 @@ void WorldObject::SendPlayMusic(uint32 Music, bool OnlySelf) { WorldPacket data(SMSG_PLAY_MUSIC, 4); data << Music; - if (OnlySelf && GetTypeId() == TYPEID_PLAYER) + if (OnlySelf && IsPlayer()) this->ToPlayer()->GetSession()->SendPacket(&data); else SendMessageToSet(&data, true); // ToSelf ignored in this case @@ -2389,7 +2389,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float if (respawnTime) go->SetSpellId(1); - if (GetTypeId() == TYPEID_PLAYER || (GetTypeId() == TYPEID_UNIT && summonType == GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)) //not sure how to handle this + if (IsPlayer() || (GetTypeId() == TYPEID_UNIT && summonType == GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)) //not sure how to handle this ToUnit()->AddGameObject(go); else go->SetSpawnedByDefault(false); @@ -2406,7 +2406,7 @@ Creature* WorldObject::SummonTrigger(float x, float y, float z, float ang, uint3 return nullptr; //summon->SetName(GetName()); - if (setLevel && (GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT)) + if (setLevel && (IsPlayer() || GetTypeId() == TYPEID_UNIT)) { summon->SetFaction(((Unit*)this)->GetFaction()); summon->SetLevel(((Unit*)this)->GetLevel()); diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 3147c41ab..6b439663c 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -195,21 +195,28 @@ public: void ForceValuesUpdateAtIndex(uint32); [[nodiscard]] inline bool IsPlayer() const { return GetTypeId() == TYPEID_PLAYER; } - Player* ToPlayer() { if (GetTypeId() == TYPEID_PLAYER) return reinterpret_cast(this); else return nullptr; } - [[nodiscard]] Player const* ToPlayer() const { if (GetTypeId() == TYPEID_PLAYER) return (Player const*)((Player*)this); else return nullptr; } + Player* ToPlayer() { if (IsPlayer()) return reinterpret_cast(this); else return nullptr; } + [[nodiscard]] Player const* ToPlayer() const { if (IsPlayer()) return reinterpret_cast(this); else return nullptr; } + Creature* ToCreature() { if (GetTypeId() == TYPEID_UNIT) return reinterpret_cast(this); else return nullptr; } - [[nodiscard]] Creature const* ToCreature() const { if (GetTypeId() == TYPEID_UNIT) return (Creature const*)((Creature*)this); else return nullptr; } + [[nodiscard]] Creature const* ToCreature() const { if (GetTypeId() == TYPEID_UNIT) return reinterpret_cast(this); else return nullptr; } - Unit* ToUnit() { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return reinterpret_cast(this); else return nullptr; } - [[nodiscard]] Unit const* ToUnit() const { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return (Unit const*)((Unit*)this); else return nullptr; } - GameObject* ToGameObject() { if (GetTypeId() == TYPEID_GAMEOBJECT) return reinterpret_cast(this); else return nullptr; } - [[nodiscard]] GameObject const* ToGameObject() const { if (GetTypeId() == TYPEID_GAMEOBJECT) return (GameObject const*)((GameObject*)this); else return nullptr; } + Unit* ToUnit() { if (GetTypeId() == TYPEID_UNIT || IsPlayer()) return reinterpret_cast(this); else return nullptr; } + [[nodiscard]] Unit const* ToUnit() const { if (GetTypeId() == TYPEID_UNIT || IsPlayer()) return reinterpret_cast(this); else return nullptr; } - Corpse* ToCorpse() { if (GetTypeId() == TYPEID_CORPSE) return reinterpret_cast(this); else return nullptr; } - [[nodiscard]] Corpse const* ToCorpse() const { if (GetTypeId() == TYPEID_CORPSE) return (const Corpse*)((Corpse*)this); else return nullptr; } + [[nodiscard]] inline bool IsGameObject() const { return GetTypeId() == TYPEID_GAMEOBJECT; } + GameObject* ToGameObject() { if (IsGameObject()) return reinterpret_cast(this); else return nullptr; } + [[nodiscard]] GameObject const* ToGameObject() const { if (IsGameObject()) return reinterpret_cast(this); else return nullptr; } - DynamicObject* ToDynObject() { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast(this); else return nullptr; } - [[nodiscard]] DynamicObject const* ToDynObject() const { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast(this); else return nullptr; } + [[nodiscard]] inline bool IsCorpse() const { return GetTypeId() == TYPEID_CORPSE; } + Corpse* ToCorpse() { if (IsCorpse()) return reinterpret_cast(this); else return nullptr; } + [[nodiscard]] Corpse const* ToCorpse() const { if (IsCorpse()) return reinterpret_cast(this); else return nullptr; } + + [[nodiscard]] inline bool IsDynamicObject() const { return GetTypeId() == TYPEID_DYNAMICOBJECT; } + DynamicObject* ToDynObject() { if (IsDynamicObject()) return reinterpret_cast(this); else return nullptr; } + [[nodiscard]] DynamicObject const* ToDynObject() const { if (IsDynamicObject()) return reinterpret_cast(this); else return nullptr; } + + [[nodiscard]] inline bool IsItem() const { return GetTypeId() == TYPEID_ITEM; } virtual std::string GetDebugInfo() const; diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 535a85186..f3228f3cd 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -52,7 +52,7 @@ Pet::Pet(Player* owner, PetType type) : Guardian(nullptr, owner ? owner->GetGUID m_tempspellIsPositive(false), m_tempspell(0) { - ASSERT(m_owner && m_owner->GetTypeId() == TYPEID_PLAYER); + ASSERT(m_owner && m_owner->IsPlayer()); m_unitTypeMask |= UNIT_MASK_PET; @@ -415,7 +415,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c map->AddToMap(ToCreature(), true); //set last used pet number (for use in BG's) - if (owner->GetTypeId() == TYPEID_PLAYER && isControlled() && !isTemporarySummoned() && (getPetType() == SUMMON_PET || getPetType() == HUNTER_PET)) + if (owner->IsPlayer() && isControlled() && !isTemporarySummoned() && (getPetType() == SUMMON_PET || getPetType() == HUNTER_PET)) owner->ToPlayer()->SetLastPetNumber(petInfo->PetNumber); owner->GetSession()->AddQueryHolderCallback(CharacterDatabase.DelayQueryHolder(std::make_shared(ownerid, petInfo->PetNumber))) @@ -1035,7 +1035,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) //Determine pet type PetType petType = MAX_PET_TYPE; - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) { sScriptMgr->OnBeforeGuardianInitStatsForLevel(owner->ToPlayer(), this, cinfo, petType); @@ -1132,8 +1132,8 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) // remove elite bonuses included in DB values CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(petlevel, cinfo->unit_class); // xinef: multiply base values by creature_template factors! - float factorHealth = owner->GetTypeId() == TYPEID_PLAYER ? std::min(1.0f, cinfo->ModHealth) : cinfo->ModHealth; - float factorMana = owner->GetTypeId() == TYPEID_PLAYER ? std::min(1.0f, cinfo->ModMana) : cinfo->ModMana; + float factorHealth = owner->IsPlayer() ? std::min(1.0f, cinfo->ModHealth) : cinfo->ModHealth; + float factorMana = owner->IsPlayer() ? std::min(1.0f, cinfo->ModMana) : cinfo->ModMana; if (sWorld->getBoolConfig(CONFIG_ALLOWS_RANK_MOD_FOR_PET_HEALTH)) { @@ -1430,7 +1430,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetFullHealth(); SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) sScriptMgr->OnAfterGuardianInitStatsForLevel(owner->ToPlayer(), this); return true; @@ -2025,7 +2025,7 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab) { // need update action bar for last removed rank if (Unit* owner = GetOwner()) - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) owner->ToPlayer()->PetSpellInitialize(); } } diff --git a/src/server/game/Entities/Player/KillRewarder.cpp b/src/server/game/Entities/Player/KillRewarder.cpp index 04ba9ca1d..680aaa43e 100644 --- a/src/server/game/Entities/Player/KillRewarder.cpp +++ b/src/server/game/Entities/Player/KillRewarder.cpp @@ -70,7 +70,7 @@ KillRewarder::KillRewarder(Player* killer, Unit* victim, bool isBattleGround) : _isFullXP(false), _maxLevel(0), _isBattleGround(isBattleGround), _isPvP(false) { // mark the credit as pvp if victim is player - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) _isPvP = true; // or if its owned by player and its not a vehicle else if (victim->GetCharmerOrOwnerGUID().IsPlayer()) @@ -201,7 +201,7 @@ void KillRewarder::_RewardPlayer(Player* player, bool isDungeon) // 4.1. Give honor (player must be alive and not on BG). _RewardHonor(player); // 4.1.1 Send player killcredit for quests with PlayerSlain - if (_victim->GetTypeId() == TYPEID_PLAYER) + if (_victim->IsPlayer()) player->KilledPlayerCredit(); } @@ -256,7 +256,7 @@ void KillRewarder::_RewardGroup() { _RewardPlayer(member, isDungeon); // Xinef: only count players - //if (_victim->GetTypeId() == TYPEID_PLAYER) + //if (_victim->IsPlayer()) // member->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, 1, 0, _victim); } } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 0bf34ab62..6a25a83c2 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -5904,7 +5904,7 @@ float Player::CalculateReputationGain(ReputationSource source, uint32 creatureOr // Calculates how many reputation points player gains in victim's enemy factions void Player::RewardReputation(Unit* victim) { - if (!victim || victim->GetTypeId() == TYPEID_PLAYER) + if (!victim || victim->IsPlayer()) return; if (victim->ToCreature()->IsReputationGainDisabled()) @@ -6036,7 +6036,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar return false; /* check if player has same IP - if (uVictim && uVictim->GetTypeId() == TYPEID_PLAYER) + if (uVictim && uVictim->IsPlayer()) { if (GetSession()->GetRemoteAddress() == uVictim->ToPlayer()->GetSession()->GetRemoteAddress()) return false; @@ -6063,7 +6063,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar victim_guid = uVictim->GetGUID(); - if (uVictim->GetTypeId() == TYPEID_PLAYER) + if (uVictim->IsPlayer()) { Player* victim = uVictim->ToPlayer(); @@ -6174,7 +6174,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT)) return true; - if (uVictim->GetTypeId() == TYPEID_PLAYER) + if (uVictim->IsPlayer()) { // Check if allowed to receive it in current map uint8 MapType = sWorld->getIntConfig(CONFIG_PVP_TOKEN_MAP_TYPE); @@ -9161,7 +9161,7 @@ Pet* Player::CreatePet(Creature* creatureTarget, uint32 spellID /*= 0*/) return nullptr; } - if (!creatureTarget || creatureTarget->IsPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER) + if (!creatureTarget || creatureTarget->IsPet() || creatureTarget->IsPlayer()) { return nullptr; } diff --git a/src/server/game/Entities/Player/PlayerQuest.cpp b/src/server/game/Entities/Player/PlayerQuest.cpp index e5626dc5e..44e46fc74 100644 --- a/src/server/game/Entities/Player/PlayerQuest.cpp +++ b/src/server/game/Entities/Player/PlayerQuest.cpp @@ -551,7 +551,7 @@ void Player::AddQuest(Quest const* quest, Object* questGiver) uint32 timeAllowed = quest->GetTimeAllowed(); // shared timed quest - if (questGiver && questGiver->GetTypeId() == TYPEID_PLAYER) + if (questGiver && questGiver->IsPlayer()) timeAllowed = questGiver->ToPlayer()->getQuestStatusMap()[quest_id].Timer / IN_MILLISECONDS; AddTimedQuest(quest_id); diff --git a/src/server/game/Entities/Player/PlayerUpdates.cpp b/src/server/game/Entities/Player/PlayerUpdates.cpp index 595a326ff..c97d6b2e9 100644 --- a/src/server/game/Entities/Player/PlayerUpdates.cpp +++ b/src/server/game/Entities/Player/PlayerUpdates.cpp @@ -1946,7 +1946,7 @@ void Player::UpdateCharmedAI() 1 << (CLASS_PRIEST - 1)); // Xinef: charmer type specific actions - if (charmer->GetTypeId() == TYPEID_PLAYER) + if (charmer->IsPlayer()) { bool follow = false; if (!target) diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp index 739ff3935..97cde0794 100644 --- a/src/server/game/Entities/Totem/Totem.cpp +++ b/src/server/game/Entities/Totem/Totem.cpp @@ -51,7 +51,7 @@ void Totem::InitStats(uint32 duration) if (Unit* owner = ObjectAccessor::GetUnit(*this, m_owner)) { uint32 slot = m_Properties->Slot; - if (owner->GetTypeId() == TYPEID_PLAYER && slot >= SUMMON_SLOT_TOTEM && slot < MAX_TOTEM_SLOT) + if (owner->IsPlayer() && slot >= SUMMON_SLOT_TOTEM && slot < MAX_TOTEM_SLOT) { WorldPackets::Totem::TotemCreated data; data.Totem = GetGUID(); diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 47203f94c..c76c79865 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -442,7 +442,7 @@ void MotionTransport::UnloadNonStaticPassengers() { for (PassengerSet::iterator itr = _passengers.begin(); itr != _passengers.end(); ) { - if ((*itr)->GetTypeId() == TYPEID_PLAYER) + if ((*itr)->IsPlayer()) { ++itr; continue; @@ -518,7 +518,7 @@ bool MotionTransport::TeleportTransport(uint32 newMapid, float x, float y, float // Teleport players, they need to know it for (PassengerSet::iterator itr = _passengers.begin(); itr != _passengers.end(); ++itr) { - if ((*itr)->GetTypeId() == TYPEID_PLAYER) + if ((*itr)->IsPlayer()) { float destX, destY, destZ, destO; (*itr)->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO); diff --git a/src/server/game/Entities/Unit/CharmInfo.cpp b/src/server/game/Entities/Unit/CharmInfo.cpp index 4e0664304..df36bb732 100644 --- a/src/server/game/Entities/Unit/CharmInfo.cpp +++ b/src/server/game/Entities/Unit/CharmInfo.cpp @@ -114,7 +114,7 @@ void CharmInfo::InitCharmCreateSpells() { InitPetActionBar(); - if (_unit->GetTypeId() == TYPEID_PLAYER) // charmed players don't have spells + if (_unit->IsPlayer()) // charmed players don't have spells return; for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 5fbd0a7d8..d6ae1cca7 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -424,7 +424,7 @@ void Unit::Update(uint32 p_time) SendThreatListUpdate(); // update combat timer only for players and pets (only pets with PetAI) - if (IsInCombat() && (GetTypeId() == TYPEID_PLAYER || ((IsPet() || HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)) && IsControlledByPlayer()))) + if (IsInCombat() && (IsPlayer() || ((IsPet() || HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)) && IsControlledByPlayer()))) { // Check UNIT_STATE_MELEE_ATTACKING or UNIT_STATE_CHASE (without UNIT_STATE_FOLLOW in this case) so pets can reach far away // targets without stopping half way there and running off. @@ -628,7 +628,7 @@ void Unit::UpdateSplinePosition() //if (HasUnitState(UNIT_STATE_CANNOT_TURN)) // loc.orientation = GetOrientation(); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) UpdatePosition(loc.x, loc.y, loc.z, loc.orientation); else ToCreature()->SetPosition(loc.x, loc.y, loc.z, loc.orientation); @@ -812,7 +812,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage // Hook for OnDamage Event sScriptMgr->OnDamage(attacker, victim, damage); - if (victim->GetTypeId() == TYPEID_PLAYER && attacker != victim) + if (victim->IsPlayer() && attacker != victim) { // Signal to pets that their owner was attacked Pet* pet = victim->ToPlayer()->GetPet(); @@ -822,7 +822,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage } //Dont deal damage to unit if .cheat god is enable. - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) { if (victim->ToPlayer()->GetCommandStatus(CHEAT_GOD)) { @@ -848,7 +848,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage // interrupt spells with SPELL_INTERRUPT_FLAG_ABORT_ON_DMG on absorbed damage (no dots) if (!damage && damagetype != DOT && cleanDamage && cleanDamage->absorbed_damage) { - if (victim != attacker && victim->GetTypeId() == TYPEID_PLAYER) + if (victim != attacker && victim->IsPlayer()) { if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL]) { @@ -902,7 +902,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage Unit::DealDamageMods(shareDamageTarget, shareDamage, &shareAbsorb); } - if (attacker && shareDamageTarget->GetTypeId() == TYPEID_PLAYER) + if (attacker && shareDamageTarget->IsPlayer()) { attacker->SendSpellNonMeleeDamageLog(shareDamageTarget, spell, shareDamage, damageSchoolMask, shareAbsorb, shareResist, damagetype == DIRECT_DAMAGE, 0, false, true); } @@ -958,7 +958,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage // duel ends when player has 1 or less hp bool duel_hasEnded = false; bool duel_wasMounted = false; - if (victim->GetTypeId() == TYPEID_PLAYER && victim->ToPlayer()->duel && damage >= (health - 1)) + if (victim->IsPlayer() && victim->ToPlayer()->duel && damage >= (health - 1)) { // xinef: situation not possible earlier, just return silently. if (!attacker) @@ -970,7 +970,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage duel_hasEnded = true; } - else if (victim->IsVehicle() && damage >= (health - 1) && victim->GetCharmer() && victim->GetCharmer()->GetTypeId() == TYPEID_PLAYER) + else if (victim->IsVehicle() && damage >= (health - 1) && victim->GetCharmer() && victim->GetCharmer()->IsPlayer()) { Player* victimRider = victim->GetCharmer()->ToPlayer(); @@ -1004,7 +1004,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage //killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT, damage); // pussywizard: optimization } - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) ;//victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED, damage); // pussywizard: optimization else if (!victim->IsControlledByPlayer() || victim->IsVehicle()) { @@ -1023,7 +1023,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage { LOG_DEBUG("entities.unit", "DealDamage: victim just died"); - //if (attacker && victim->GetTypeId() == TYPEID_PLAYER && victim != attacker) + //if (attacker && victim->IsPlayer() && victim != attacker) //victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health); // pussywizard: optimization Unit::Kill(attacker, victim, durabilityLoss, cleanDamage ? cleanDamage->attackType : BASE_ATTACK, spellProto, damageSpell); } @@ -1031,7 +1031,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage { LOG_DEBUG("entities.unit", "DealDamageAlive"); - //if (victim->GetTypeId() == TYPEID_PLAYER) + //if (victim->IsPlayer()) // victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, damage); // pussywizard: optimization victim->ModifyHealth(- (int32)damage); @@ -1072,7 +1072,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage victim->RewardRage(rageDamage, 0, false); } - if (attacker && attacker->GetTypeId() == TYPEID_PLAYER) + if (attacker && attacker->IsPlayer()) { // random durability for items (HIT DONE) if (roll_chance_f(sWorld->getRate(RATE_DURABILITY_LOSS_DAMAGE))) @@ -1084,7 +1084,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage if (damagetype != NODAMAGE && damage && (!spellProto || !(spellProto->HasAttribute(SPELL_ATTR3_TREAT_AS_PERIODIC) || spellProto->HasAttribute(SPELL_ATTR7_DONT_CAUSE_SPELL_PUSHBACK)))) { - if (victim != attacker && victim->GetTypeId() == TYPEID_PLAYER) // does not support creature push_back + if (victim != attacker && victim->IsPlayer()) // does not support creature push_back { if (damagetype != DOT && !(damageSpell && damageSpell->m_targets.HasDstChannel())) { @@ -1536,7 +1536,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, CalcDamageInfo* damageInfo, Weapon bool const addPctMods = (schoolMask & SPELL_SCHOOL_MASK_NORMAL); uint32 damage = 0; - uint8 itemDamagesMask = (GetTypeId() == TYPEID_PLAYER) ? (1 << i) : 0; + uint8 itemDamagesMask = (IsPlayer()) ? (1 << i) : 0; damage += CalculateDamage(damageInfo->attackType, false, addPctMods, itemDamagesMask); // Add melee damage bonus @@ -1877,7 +1877,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) // If this is a creature and it attacks from behind it has a probability to daze it's victim if ((damageInfo->damages[0].damage + damageInfo->damages[1].damage) && ((damageInfo->hitOutCome == MELEE_HIT_CRIT || damageInfo->hitOutCome == MELEE_HIT_CRUSHING || damageInfo->hitOutCome == MELEE_HIT_NORMAL || damageInfo->hitOutCome == MELEE_HIT_GLANCING) && GetTypeId() != TYPEID_PLAYER && !ToCreature()->IsControlledByPlayer() && !victim->HasInArc(M_PI, this) - && (victim->GetTypeId() == TYPEID_PLAYER || !victim->ToCreature()->isWorldBoss()) && !victim->IsVehicle())) + && (victim->IsPlayer() || !victim->ToCreature()->isWorldBoss()) && !victim->IsVehicle())) { // -probability is between 0% and 40% // 20% base chance @@ -1902,7 +1902,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) CastSpell(victim, 1604, true); } - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) ToPlayer()->CastItemCombatSpell(victim, damageInfo->attackType, damageInfo->procVictim, damageInfo->procEx); // Do effect if any damage done to target @@ -2021,7 +2021,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit const* attacker, Unit const* victim, co } // Apply Player CR_ARMOR_PENETRATION rating and buffs from stances\specializations etc. - if (attacker->GetTypeId() == TYPEID_PLAYER) + if (attacker->IsPlayer()) { float bonusPct = 0; AuraEffectList const& armorPenAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT); @@ -2545,7 +2545,7 @@ void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType /*= BASE_A return; // CombatStart puts the target into stand state, so we need to cache sit state here to know if we should crit later - const bool sittingVictim = victim->GetTypeId() == TYPEID_PLAYER && (victim->IsSitState() || victim->getStandState() == UNIT_STAND_STATE_SLEEP); + const bool sittingVictim = victim->IsPlayer() && (victim->IsSitState() || victim->getStandState() == UNIT_STAND_STATE_SLEEP); CombatStart(victim); RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MELEE_ATTACK); @@ -2611,7 +2611,7 @@ void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType /*= BASE_A Unit::ProcDamageAndSpell(damageInfo.attacker, damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, damageInfo.procEx, dmgInfo.GetDamage(), damageInfo.attackType, nullptr, nullptr, -1, nullptr, &dmgInfo); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) LOG_DEBUG("entities.unit", "AttackerStateUpdate: (Player) {} attacked {} for {} dmg, absorbed {}, blocked {}, resisted {}.", GetGUID().ToString(), victim->GetGUID().ToString(), dmgInfo.GetDamage(), dmgInfo.GetAbsorb(), dmgInfo.GetBlock(), dmgInfo.GetResist()); else @@ -2620,7 +2620,7 @@ void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType /*= BASE_A // Let the pet know we've started attacking someting. Handles melee attacks only // Spells such as auto-shot and others handled in WorldSession::HandleCastSpellOpcode - if (GetTypeId() == TYPEID_PLAYER && !m_Controlled.empty()) + if (IsPlayer() && !m_Controlled.empty()) for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr) if (Unit* pet = *itr) if (pet->IsAlive() && pet->GetTypeId() == TYPEID_UNIT) @@ -2800,15 +2800,15 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackTy // Dodge chance // only players can't dodge if attacker is behind - if (victim->GetTypeId() == TYPEID_PLAYER && !victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)) + if (victim->IsPlayer() && !victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)) { //LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind and victim was a player."); } // Xinef: do not allow to dodge with CREATURE_FLAG_EXTRA_NO_DODGE flag - else if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_DODGE)) + else if (victim->IsPlayer() || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_DODGE)) { // Reduce dodge chance by attacker expertise rating - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) dodge_chance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100); else dodge_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25; @@ -2842,12 +2842,12 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackTy else { // Reduce parry chance by attacker expertise rating - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) parry_chance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100); else parry_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25; - if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY)) + if (victim->IsPlayer() || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY)) { tmp = parry_chance; @@ -2864,7 +2864,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackTy } } - if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK)) + if (victim->IsPlayer() || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK)) { tmp = block_chance; @@ -2884,7 +2884,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackTy // Max 40% chance to score a glancing blow against mobs that are higher level (can do only players and pets and not with ranged weapon) if (attType != RANGED_ATTACK && - (GetTypeId() == TYPEID_PLAYER || IsPet()) && + (IsPlayer() || IsPet()) && victim->GetTypeId() != TYPEID_PLAYER && !victim->IsPet() && GetLevel() < victim->getLevelForTarget(this)) { @@ -3052,9 +3052,9 @@ void Unit::SendMeleeAttackStop(Unit* victim) LOG_DEBUG("entities.unit", "WORLD: Sent SMSG_ATTACKSTOP"); if (victim) - LOG_DEBUG("entities.unit", "{} {} stopped attacking {} {}", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUID().ToString(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUID().ToString()); + LOG_DEBUG("entities.unit", "{} {} stopped attacking {} {}", (IsPlayer() ? "Player" : "Creature"), GetGUID().ToString(), (victim->IsPlayer() ? "player" : "creature"), victim->GetGUID().ToString()); else - LOG_DEBUG("entities.unit", "{} {} stopped attacking", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUID().ToString()); + LOG_DEBUG("entities.unit", "{} {} stopped attacking", (IsPlayer() ? "Player" : "Creature"), GetGUID().ToString()); } bool Unit::isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttackType attackType) @@ -3180,7 +3180,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo if (!victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION) || spellInfo->HasAttribute(SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET)) { // Can`t dodge from behind in PvP (but its possible in PvE) - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) { canDodge = false; } @@ -3235,7 +3235,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo dodgeChance += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_COMBAT_RESULT_CHANCE, VICTIMSTATE_DODGE) * 100; dodgeChance = int32(float(dodgeChance) * GetTotalAuraMultiplier(SPELL_AURA_MOD_ENEMY_DODGE)); // Reduce dodge chance by attacker expertise rating - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) dodgeChance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100.0f); else dodgeChance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25; @@ -3254,7 +3254,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo // Roll parry int32 parryChance = int32(victim->GetUnitParryChance() * 100.0f) - skillDiff * 4; // Reduce parry chance by attacker expertise rating - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) parryChance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100.0f); else parryChance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25; @@ -3314,12 +3314,12 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo int32 MISS_CHANCE_MULTIPLIER; if (sWorld->getBoolConfig(CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS) && GetTypeId() != TYPEID_PLAYER) // keep it as it was originally (7 and 11) { - MISS_CHANCE_MULTIPLIER = victim->GetTypeId() == TYPEID_PLAYER ? 7 : 11; + MISS_CHANCE_MULTIPLIER = victim->IsPlayer() ? 7 : 11; } else { MISS_CHANCE_MULTIPLIER = sWorld->getRate( - victim->GetTypeId() == TYPEID_PLAYER + victim->IsPlayer() ? RATE_MISS_CHANCE_MULTIPLIER_TARGET_PLAYER : RATE_MISS_CHANCE_MULTIPLIER_TARGET_CREATURE); } @@ -3347,7 +3347,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo modHitChance -= victim->GetTotalAuraModifier(SPELL_AURA_MOD_AOE_AVOIDANCE); // Decrease hit chance from victim rating bonus - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) modHitChance -= int32(victim->ToPlayer()->GetRatingBonusValue(CR_HIT_TAKEN_SPELL)); } @@ -3584,10 +3584,10 @@ SpellMissInfo Unit::SpellHitResult(Unit* victim, Spell const* spell, bool CanRef uint32 Unit::GetDefenseSkillValue(Unit const* target) const { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { // in PvP use full skill instead current skill value - uint32 value = (target && target->GetTypeId() == TYPEID_PLAYER) + uint32 value = (target && target->IsPlayer()) ? ToPlayer()->GetMaxSkillValue(SKILL_DEFENSE) : ToPlayer()->GetSkillValue(SKILL_DEFENSE); value += uint32(ToPlayer()->GetRatingBonusValue(CR_DEFENSE_SKILL)); @@ -3599,7 +3599,7 @@ uint32 Unit::GetDefenseSkillValue(Unit const* target) const float Unit::GetUnitDodgeChance() const { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) return ToPlayer()->GetRealDodge(); //GetFloatValue(PLAYER_DODGE_PERCENTAGE); else { @@ -3689,7 +3689,7 @@ float Unit::GetUnitCriticalChance(WeaponAttackType attackType, Unit const* victi { float crit; - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { switch (attackType) { @@ -3875,7 +3875,7 @@ void Unit::_UpdateAutoRepeatSpell() static uint32 const HUNTER_AUTOSHOOT = 75; // Check "realtime" interrupts - if ((GetTypeId() == TYPEID_PLAYER && ToPlayer()->isMoving() && spellProto->Id != HUNTER_AUTOSHOOT) || IsNonMeleeSpellCast(false, false, true, spellProto->Id == HUNTER_AUTOSHOOT)) + if ((IsPlayer() && ToPlayer()->isMoving() && spellProto->Id != HUNTER_AUTOSHOOT) || IsNonMeleeSpellCast(false, false, true, spellProto->Id == HUNTER_AUTOSHOOT)) { // cancel wand shoot if (spellProto->Id != HUNTER_AUTOSHOOT) @@ -4032,7 +4032,7 @@ void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool wi // send autorepeat cancel message for autorepeat spells if (spellType == CURRENT_AUTOREPEAT_SPELL) - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) ToPlayer()->SendAutoRepeatCancel(this); if (spell->getState() != SPELL_STATE_FINISHED) @@ -6129,7 +6129,7 @@ void Unit::AddGameObject(GameObject* gameObj) m_gameObj.push_back(gameObj->GetGUID()); gameObj->SetOwnerGUID(GetGUID()); - if (GetTypeId() == TYPEID_PLAYER && gameObj->GetSpellId()) + if (IsPlayer() && gameObj->GetSpellId()) { SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(gameObj->GetSpellId()); // Need disable spell use for owner @@ -6160,7 +6160,7 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del) { RemoveAurasDueToSpell(spellid); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(spellid); // Need activate spell use for owner @@ -6230,7 +6230,7 @@ void Unit::SendSpellNonMeleeReflectLog(SpellNonMeleeDamage* log, Unit* attacker) //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop uint32 damage = log->damage; uint32 absorb = log->absorb; - if (log->target->GetTypeId() == TYPEID_PLAYER && log->target->ToPlayer()->GetCommandStatus(CHEAT_GOD)) + if (log->target->IsPlayer() && log->target->ToPlayer()->GetCommandStatus(CHEAT_GOD)) { absorb = damage; damage = 0; @@ -6258,7 +6258,7 @@ void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage* log) //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop uint32 damage = log->damage; uint32 absorb = log->absorb; - if (log->target->GetTypeId() == TYPEID_PLAYER && log->target->ToPlayer()->GetCommandStatus(CHEAT_GOD)) + if (log->target->IsPlayer() && log->target->ToPlayer()->GetCommandStatus(CHEAT_GOD)) { absorb = damage; damage = 0; @@ -6348,7 +6348,7 @@ void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo) //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop uint32 damage = pInfo->damage; uint32 absorb = pInfo->absorb; - if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetCommandStatus(CHEAT_GOD)) + if (IsPlayer() && ToPlayer()->GetCommandStatus(CHEAT_GOD)) { absorb = damage; damage = 0; @@ -6432,7 +6432,7 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo* damageInfo) //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop tmpDamage[i] = damageInfo->damages[i].damage; tmpAbsorb[i] = damageInfo->damages[i].absorb; - if (damageInfo->target->GetTypeId() == TYPEID_PLAYER && damageInfo->target->ToPlayer()->GetCommandStatus(CHEAT_GOD)) + if (damageInfo->target->IsPlayer() && damageInfo->target->ToPlayer()->GetCommandStatus(CHEAT_GOD)) { tmpAbsorb[i] = tmpDamage[i]; tmpDamage[i] = 0; @@ -6538,7 +6538,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere int32 triggerAmount = triggeredByAura->GetAmount(); Spell const* spellProc = eventInfo.GetProcSpell(); - Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER + Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && IsPlayer() ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : nullptr; uint32 triggered_spell_id = 0; @@ -7396,7 +7396,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere int32 basepoints1 = CalculatePct(GetMaxPower(Powers(POWER_MANA)), triggerAmount * 2); // Improved Leader of the Pack // Check cooldown of heal spell cooldown - if (GetTypeId() == TYPEID_PLAYER && !ToPlayer()->HasSpellCooldown(34299)) + if (IsPlayer() && !ToPlayer()->HasSpellCooldown(34299)) CastCustomSpell(this, 68285, &basepoints1, 0, 0, true, 0, triggeredByAura); break; } @@ -7490,7 +7490,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere } } // Eclipse - if (dummySpell->SpellIconID == 2856 && GetTypeId() == TYPEID_PLAYER) + if (dummySpell->SpellIconID == 2856 && IsPlayer()) { if (!procSpell || effIndex != 0) return false; @@ -8543,7 +8543,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere break; } // Sudden Doom - if (dummySpell->SpellIconID == 1939 && GetTypeId() == TYPEID_PLAYER) + if (dummySpell->SpellIconID == 1939 && IsPlayer()) { SpellChainNode const* chain = nullptr; // get highest rank of the Death Coil spell @@ -8884,7 +8884,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg if (triggeredByAura->GetAuraType() == SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE) basepoints0 = triggerAmount; - Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER + Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && IsPlayer() ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : nullptr; // Try handle unknown trigger spells @@ -9605,7 +9605,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg case 15250: // Rogue Setup { // applied only for main target - if (!victim || (GetTypeId() == TYPEID_PLAYER && victim != ToPlayer()->GetSelectedUnit())) + if (!victim || (IsPlayer() && victim != ToPlayer()->GetSelectedUnit())) return false; break; // continue normal case } @@ -9671,7 +9671,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg case 50227: { // Remove cooldown on Shield Slam - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) ToPlayer()->RemoveCategoryCooldown(1209); break; } @@ -9717,7 +9717,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg case 58628: { // remove cooldown of Death Grip - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) ToPlayer()->RemoveSpellCooldown(49576, true); return true; } @@ -9801,7 +9801,7 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit* victim, uint32 /*damage*/, Au if (!victim || !victim->IsAlive()) return false; - Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER + Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && IsPlayer() ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : nullptr; uint32 triggered_spell_id = 0; @@ -9916,7 +9916,7 @@ void Unit::setPowerType(Powers new_powertype) { SetByteValue(UNIT_FIELD_BYTES_0, 3, new_powertype); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { if (ToPlayer()->GetGroup()) ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POWER_TYPE); @@ -9926,7 +9926,7 @@ void Unit::setPowerType(Powers new_powertype) if (pet->isControlled()) { Unit* owner = GetOwner(); - if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup()) + if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup()) owner->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_POWER_TYPE); } } @@ -10087,7 +10087,7 @@ ReputationRank Unit::GetReactionTo(Unit const* target, bool checkOriginalFaction FactionTemplateEntry const* factionTemplateEntry = nullptr; if (checkOriginalFaction) { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(getRace())) { @@ -10219,7 +10219,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) return false; // player cannot attack in mount state - if (GetTypeId() == TYPEID_PLAYER && IsMounted()) + if (IsPlayer() && IsMounted()) return false; // creatures cannot attack while evading @@ -10239,7 +10239,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) // return false; // nobody can attack GM in GM-mode - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) { if (victim->ToPlayer()->IsGameMaster()) return false; @@ -10306,7 +10306,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) { // should not let player enter combat by right clicking target - doesn't helps SetInCombatWith(victim); - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) victim->SetInCombatWith(this); AddThreat(victim, 0.0f); @@ -10372,7 +10372,7 @@ void Unit::CombatStop(bool includingCast) AttackStop(); RemoveAllAttackers(); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel ClearInCombat(); @@ -10620,7 +10620,7 @@ void Unit::SetMinion(Minion* minion, bool apply) m_Controlled.insert(minion); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { minion->m_ControlledByPlayer = true; minion->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED); @@ -10671,7 +10671,7 @@ void Unit::SetMinion(Minion* minion, bool apply) if (minion->IsPetGhoul() || minion->GetEntry() == 24207 /*ENTRY_ARMY_OF_THE_DEAD*/) minion->setPowerType(POWER_ENERGY); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { // Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL)); @@ -10716,7 +10716,7 @@ void Unit::SetMinion(Minion* minion, bool apply) } } - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL)); // Remove infinity cooldown @@ -10755,7 +10755,7 @@ void Unit::SetMinion(Minion* minion, bool apply) if (AddGuidValue(UNIT_FIELD_SUMMON, (*itr)->GetGUID())) { // show another pet bar if there is no charm bar - if (GetTypeId() == TYPEID_PLAYER && !GetCharmGUID()) + if (IsPlayer() && !GetCharmGUID()) { if ((*itr)->IsPet()) ToPlayer()->PetSpellInitialize(); @@ -10799,7 +10799,7 @@ void Unit::SetCharm(Unit* charm, bool apply) { if (apply) { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { if (!AddGuidValue(UNIT_FIELD_CHARM, charm->GetGUID())) LOG_FATAL("entities.unit", "Player {} is trying to charm unit {}, but it already has a charmed unit {}", GetName(), charm->GetEntry(), GetCharmGUID().ToString()); @@ -10828,7 +10828,7 @@ void Unit::SetCharm(Unit* charm, bool apply) } else { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { if (!RemoveGuidValue(UNIT_FIELD_CHARM, charm->GetGUID())) LOG_FATAL("entities.unit", "Player {} is trying to uncharm unit {}, but it has another charmed unit {}", GetName(), charm->GetEntry(), GetCharmGUID().ToString()); @@ -10837,7 +10837,7 @@ void Unit::SetCharm(Unit* charm, bool apply) if (!charm->RemoveGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID())) LOG_FATAL("entities.unit", "Unit {} is being uncharmed, but it has another charmer {}", charm->GetEntry(), charm->GetCharmerGUID().ToString()); - if (charm->GetTypeId() == TYPEID_PLAYER) + if (charm->IsPlayer()) { charm->m_ControlledByPlayer = true; charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED); @@ -11008,7 +11008,7 @@ Unit* Unit::GetFirstControlled() const void Unit::RemoveAllControlled(bool onDeath /*= false*/) { // possessed pet and vehicle - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) ToPlayer()->StopCastingCharm(); while (!m_Controlled.empty()) @@ -11036,7 +11036,7 @@ void Unit::RemoveAllControlled(bool onDeath /*= false*/) Unit* Unit::GetNextRandomRaidMemberOrPet(float radius) { Player* player = nullptr; - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) player = ToPlayer(); // Should we enable this also for charmed units? else if (GetTypeId() == TYPEID_UNIT && IsPet()) @@ -11869,7 +11869,7 @@ int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) // 0 == any inventory type (not wand then) DoneAdvertisedBenefit += (*i)->GetAmount(); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { // Base value DoneAdvertisedBenefit += ToPlayer()->GetBaseSpellPowerBonus(); @@ -11935,7 +11935,7 @@ float Unit::SpellDoneCritChance(Unit const* /*victim*/, SpellInfo const* spellPr if (schoolMask & SPELL_SCHOOL_MASK_NORMAL) crit_chance = 0.0f; // For other schools - else if (GetTypeId() == TYPEID_PLAYER) + else if (IsPlayer()) crit_chance = GetFloatValue(static_cast(PLAYER_SPELL_CRIT_PERCENTAGE1) + GetFirstSchoolInMask(schoolMask)); else { @@ -11947,7 +11947,7 @@ float Unit::SpellDoneCritChance(Unit const* /*victim*/, SpellInfo const* spellPr case SPELL_DAMAGE_CLASS_MELEE: case SPELL_DAMAGE_CLASS_RANGED: { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { switch (attackType) { @@ -12145,7 +12145,7 @@ float Unit::SpellTakenCritChance(Unit const* caster, SpellInfo const* spellProto } // 100% critical chance against sitting target - if (GetTypeId() == TYPEID_PLAYER && (IsSitState() || getStandState() == UNIT_STAND_STATE_SLEEP)) + if (IsPlayer() && (IsSitState() || getStandState() == UNIT_STAND_STATE_SLEEP)) { return 100.0f; } @@ -12631,7 +12631,7 @@ int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) AdvertisedBenefit += (*i)->GetAmount(); // Healing bonus of spirit, intellect and strength - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { // Base value AdvertisedBenefit += ToPlayer()->GetBaseSpellPowerBonus(); @@ -13465,7 +13465,7 @@ void Unit::Dismount() SendMessageToSet(&data, true); // dismount as a vehicle - if (GetTypeId() == TYPEID_PLAYER && GetVehicleKit()) + if (IsPlayer() && GetVehicleKit()) { // Send other players that we are no longer a vehicle data.Initialize(SMSG_PLAYER_VEHICLE_DATA, 8 + 4); @@ -13514,7 +13514,7 @@ void Unit::SetInCombatWith(Unit* enemy, uint32 duration) } // check for duel - if (eOwner->GetTypeId() == TYPEID_PLAYER && eOwner->ToPlayer()->duel) + if (eOwner->IsPlayer() && eOwner->ToPlayer()->duel) { Unit const* myOwner = GetCharmerOrOwnerOrSelf(); if (((Player const*)eOwner)->duel->Opponent == myOwner) @@ -13609,7 +13609,7 @@ void Unit::CombatStart(Unit* victim, bool initialAggro) } Unit* who = victim->GetCharmerOrOwnerOrSelf(); - if (who->GetTypeId() == TYPEID_PLAYER) + if (who->IsPlayer()) SetContestedPvP(who->ToPlayer()); Player* player = GetCharmerOrOwnerPlayerOrPlayerItself(); @@ -13636,7 +13636,7 @@ void Unit::CombatStartOnCast(Unit* target, bool initialAggro, uint32 duration) } Unit* who = target->GetCharmerOrOwnerOrSelf(); - if (who->GetTypeId() == TYPEID_PLAYER) + if (who->IsPlayer()) SetContestedPvP(who->ToPlayer()); Player* player = GetCharmerOrOwnerPlayerOrPlayerItself(); @@ -13778,7 +13778,7 @@ bool Unit::isTargetableForAttack(bool checkFakeDeath, Unit const* byWho) const if (IsImmuneToPC() && byWho && byWho->GetCharmerOrOwnerPlayerOrPlayerItself()) return false; - if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->IsGameMaster()) + if (IsPlayer() && ToPlayer()->IsGameMaster()) return false; return !HasUnitState(UNIT_STATE_UNATTACKABLE) && (!checkFakeDeath || !HasUnitState(UNIT_STATE_DIED)); @@ -13800,7 +13800,7 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo // can't attack unattackable units or GMs if (target->HasUnitState(UNIT_STATE_UNATTACKABLE) - || (target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->IsGameMaster())) + || (target->IsPlayer() && target->ToPlayer()->IsGameMaster())) return false; // can't attack own vehicle or passenger @@ -13811,7 +13811,7 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo // can't attack invisible (ignore stealth for aoe spells) also if the area being looked at is from a spell use the dynamic object created instead of the casting unit. //Ignore stealth if target is player and unit in combat with same player - if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT)) && (obj ? !obj->CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()) : !CanSeeOrDetect(target, (bySpell && bySpell->IsAffectingArea()) || (target->GetTypeId() == TYPEID_PLAYER && target->HasStealthAura() && target->IsInCombat() && IsInCombatWith(target))))) + if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT)) && (obj ? !obj->CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()) : !CanSeeOrDetect(target, (bySpell && bySpell->IsAffectingArea()) || (target->IsPlayer() && target->HasStealthAura() && target->IsInCombat() && IsInCombatWith(target))))) return false; // can't attack dead @@ -13856,10 +13856,10 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo { Player* owner = GetAffectingPlayer(); Unit const* const thisUnit = owner ? owner : this; - if (!(target->GetTypeId() == TYPEID_PLAYER && thisUnit->GetTypeId() == TYPEID_PLAYER) && + if (!(target->IsPlayer() && thisUnit->IsPlayer()) && !(target->GetTypeId() == TYPEID_UNIT && thisUnit->GetTypeId() == TYPEID_UNIT)) { - Player const* player = target->GetTypeId() == TYPEID_PLAYER ? target->ToPlayer() : thisUnit->ToPlayer(); + Player const* player = target->IsPlayer() ? target->ToPlayer() : thisUnit->ToPlayer(); Unit const* creature = target->GetTypeId() == TYPEID_UNIT ? target : thisUnit; if (FactionTemplateEntry const* factionTemplate = creature->GetFactionTemplateEntry()) @@ -13923,7 +13923,7 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co // can't assist unattackable units or GMs if (target->HasUnitState(UNIT_STATE_UNATTACKABLE) - || (target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->IsGameMaster())) + || (target->IsPlayer() && target->ToPlayer()->IsGameMaster())) return false; // can't assist own vehicle or passenger @@ -14243,7 +14243,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) non_stack_bonus += GetMaxPositiveAuraModifier(SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK) / 100.0f; // Update speed for vehicle if available - if (GetTypeId() == TYPEID_PLAYER && GetVehicle()) + if (IsPlayer() && GetVehicle()) GetVehicleBase()->UpdateSpeed(MOVE_FLIGHT, true); break; } @@ -14396,7 +14396,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) } else { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { // register forced speed changes for WorldSession::HandleForceSpeedChangeAck // and do it only for real sent packets and use run for run/mounted as client expected @@ -14579,7 +14579,7 @@ void Unit::TauntApply(Unit* taunter) { ASSERT(GetTypeId() == TYPEID_UNIT); - if (!taunter || (taunter->GetTypeId() == TYPEID_PLAYER && taunter->ToPlayer()->IsGameMaster())) + if (!taunter || (taunter->IsPlayer() && taunter->ToPlayer()->IsGameMaster())) return; if (!CanHaveThreatList()) @@ -14609,7 +14609,7 @@ void Unit::TauntFadeOut(Unit* taunter) { ASSERT(GetTypeId() == TYPEID_UNIT); - if (!taunter || (taunter->GetTypeId() == TYPEID_PLAYER && taunter->ToPlayer()->IsGameMaster())) + if (!taunter || (taunter->IsPlayer() && taunter->ToPlayer()->IsGameMaster())) return; if (!CanHaveThreatList()) @@ -14974,9 +14974,9 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32& duration, Unit const* target = targetOwner ? targetOwner : this; Unit const* source = casterOwner ? casterOwner : caster; - if ((target->GetTypeId() == TYPEID_PLAYER + if ((target->IsPlayer() || target->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH) - && source->GetTypeId() == TYPEID_PLAYER) + && source->IsPlayer()) duration = limitduration; } @@ -15010,7 +15010,7 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32& duration, } // Some diminishings applies to mobs too (for example, Stun) else if ((GetDiminishingReturnsGroupType(group) == DRTYPE_PLAYER - && ((targetOwner ? (targetOwner->GetTypeId() == TYPEID_PLAYER) : (GetTypeId() == TYPEID_PLAYER)) + && ((targetOwner ? (targetOwner->IsPlayer()) : (IsPlayer())) || (GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH))) || GetDiminishingReturnsGroupType(group) == DRTYPE_ALL) { @@ -15095,7 +15095,7 @@ float Unit::GetSpellMinRangeForTarget(Unit const* target, SpellInfo const* spell uint32 Unit::GetCreatureType() const { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { ShapeshiftForm form = GetShapeshiftForm(); SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(form); @@ -15380,10 +15380,10 @@ void Unit::SetLevel(uint8 lvl, bool showLevelChange) _changesMask.UnsetBit(UNIT_FIELD_LEVEL); // group update - if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetGroup()) + if (IsPlayer() && ToPlayer()->GetGroup()) ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_LEVEL); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { sCharacterCache->UpdateCharacterLevel(GetGUID(), lvl); } @@ -15393,7 +15393,7 @@ void Unit::SetHealth(uint32 val) { if (getDeathState() == DeathState::JustDied) val = 0; - else if (GetTypeId() == TYPEID_PLAYER && getDeathState() == DeathState::Dead) + else if (IsPlayer() && getDeathState() == DeathState::Dead) val = 1; else { @@ -15413,7 +15413,7 @@ void Unit::SetHealth(uint32 val) } // group update - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { Player* player = ToPlayer(); if (player->NeedSendSpectatorData()) @@ -15448,7 +15448,7 @@ void Unit::SetMaxHealth(uint32 val) SetUInt32Value(UNIT_FIELD_MAXHEALTH, val); // group update - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { Player* player = ToPlayer(); if (player->NeedSendSpectatorData()) @@ -15506,11 +15506,11 @@ void Unit::SetPower(Powers power, uint32 val, bool withPowerUpdate /*= true*/, b data << GetPackGUID(); data << uint8(power); data << uint32(val); - SendMessageToSet(&data, GetTypeId() == TYPEID_PLAYER); + SendMessageToSet(&data, IsPlayer()); } // group update - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { Player* player = ToPlayer(); if (getPowerType() == power && player->NeedSendSpectatorData()) @@ -15528,7 +15528,7 @@ void Unit::SetPower(Powers power, uint32 val, bool withPowerUpdate /*= true*/, b if (pet->isControlled()) { Unit* owner = GetOwner(); - if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup()) + if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup()) { owner->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_CUR_POWER); } @@ -15548,7 +15548,7 @@ void Unit::SetMaxPower(Powers power, uint32 val) SetStatInt32Value(static_cast(UNIT_FIELD_MAXPOWER1) + power, val); // group update - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { Player* player = ToPlayer(); if (getPowerType() == power && player->NeedSendSpectatorData()) @@ -15562,7 +15562,7 @@ void Unit::SetMaxPower(Powers power, uint32 val) if (pet->isControlled()) { Unit* owner = GetOwner(); - if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup()) + if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup()) owner->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_MAX_POWER); } } @@ -15581,11 +15581,11 @@ uint32 Unit::GetCreatePowers(Powers power) const case POWER_RAGE: return 1000; case POWER_FOCUS: - return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 100); + return (IsPlayer() || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 100); case POWER_ENERGY: return 100; case POWER_HAPPINESS: - return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 1050000); + return (IsPlayer() || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 1050000); case POWER_RUNIC_POWER: return 1000; case POWER_RUNE: @@ -15698,7 +15698,7 @@ void Unit::CleanupsBeforeDelete(bool finalCleanup) void Unit::UpdateCharmAI() { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) return; if (i_disabledAI) // disabled AI must be primary AI @@ -15969,7 +15969,7 @@ uint32 createProcExtendMask(SpellNonMeleeDamage* damageInfo, SpellMissInfo missC void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const* procSpellInfo, uint32 damage, SpellInfo const* procAura, int8 procAuraEffectIndex, Spell const* procSpell, DamageInfo* damageInfo, HealInfo* healInfo, uint32 procPhase) { // Player is loaded now - do not allow passive spell casts to proc - if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetSession()->PlayerLoading()) + if (IsPlayer() && ToPlayer()->GetSession()->PlayerLoading()) return; // For melee/ranged based attack need update skills and set some Aura states if victim present if (procFlag & MELEE_BASED_TRIGGER_MASK && target && procPhase == PROC_SPELL_PHASE_HIT) @@ -16645,7 +16645,7 @@ void Unit::SetStandState(uint8 state) if (IsStandState()) RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_SEATED); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { WorldPacket data(SMSG_STANDSTATE_UPDATE, 1); data << (uint8)state; @@ -16670,7 +16670,7 @@ void Unit::RecalculateObjectScale() { int32 scaleAuras = GetTotalAuraModifier(SPELL_AURA_MOD_SCALE) + GetTotalAuraModifier(SPELL_AURA_MOD_SCALE_2); float scale = GetNativeObjectScale() + CalculatePct(1.0f, scaleAuras); - float scaleMin = GetTypeId() == TYPEID_PLAYER ? 0.1f : 0.01f; + float scaleMin = IsPlayer() ? 0.1f : 0.01f; SetObjectScale(std::max(scale, scaleMin)); } @@ -16848,7 +16848,7 @@ void Unit::ClearAllReactives() ModifyAuraState(AURA_STATE_DEFENSE, false); if (IsClass(CLASS_HUNTER, CLASS_CONTEXT_ABILITY_REACTIVE) && HasAuraState(AURA_STATE_HUNTER_PARRY)) ModifyAuraState(AURA_STATE_HUNTER_PARRY, false); - if (IsClass(CLASS_WARRIOR, CLASS_CONTEXT_ABILITY_REACTIVE) && GetTypeId() == TYPEID_PLAYER) + if (IsClass(CLASS_WARRIOR, CLASS_CONTEXT_ABILITY_REACTIVE) && IsPlayer()) ClearComboPoints(); } @@ -17099,7 +17099,7 @@ void Unit::UpdateAuraForGroup(uint8 slot) if (pet->isControlled()) { Unit* owner = GetOwner(); - if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup()) + if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup()) { owner->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_AURAS); pet->SetAuraUpdateMaskForRaid(slot); @@ -17307,7 +17307,7 @@ bool Unit::InitTamedPet(Pet* pet, uint8 level, uint32 spell_id) pet->SetFaction(GetFaction()); pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) pet->ReplaceAllUnitFlags(UNIT_FLAG_PLAYER_CONTROLLED); if (!pet->InitStatsForLevel(level)) @@ -17371,7 +17371,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, WeaponAttackTyp if (!sSpellMgr->IsSpellProcEventCanTriggeredBy(spellProto, spellProcEvent, EventProcFlag, eventInfo, active)) return false; // In most cases req get honor or XP from kill - if (EventProcFlag & PROC_FLAG_KILL && GetTypeId() == TYPEID_PLAYER) + if (EventProcFlag & PROC_FLAG_KILL && IsPlayer()) { bool allow = false; @@ -17391,7 +17391,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, WeaponAttackTyp return false; // Check if current equipment allows aura to proc - if (!isVictim && GetTypeId() == TYPEID_PLAYER && !spellProto->HasAttribute(SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT)) + if (!isVictim && IsPlayer() && !spellProto->HasAttribute(SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT)) { Player* player = ToPlayer(); if (spellProto->EquippedItemClass == ITEM_CLASS_WEAPON) @@ -17493,7 +17493,7 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura) std::list nearMembers; Player* player = nullptr; - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) player = ToPlayer(); else if (GetOwner()) player = GetOwner()->ToPlayer(); @@ -17741,7 +17741,7 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp // Spirit of Redemption // if talent known but not triggered (check priest class for speedup check) bool spiritOfRedemption = false; - if (victim->GetTypeId() == TYPEID_PLAYER && victim->IsClass(CLASS_PRIEST, CLASS_CONTEXT_ABILITY) && !victim->ToPlayer()->HasPlayerFlag(PLAYER_FLAGS_IS_OUT_OF_BOUNDS)) + if (victim->IsPlayer() && victim->IsClass(CLASS_PRIEST, CLASS_CONTEXT_ABILITY) && !victim->ToPlayer()->HasPlayerFlag(PLAYER_FLAGS_IS_OUT_OF_BOUNDS)) { if (AuraEffect* aurEff = victim->GetAuraEffectDummy(20711)) { @@ -17892,7 +17892,7 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp bf->HandleKill(player, victim); } - //if (victim->GetTypeId() == TYPEID_PLAYER) + //if (victim->IsPlayer()) // if (OutdoorPvP* pvp = victim->ToPlayer()->GetOutdoorPvP()) // pvp->HandlePlayerActivityChangedpVictim->ToPlayer(); @@ -17900,18 +17900,18 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp if (player) if (Battleground* bg = player->GetBattleground()) { - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) bg->HandleKillPlayer(victim->ToPlayer(), player); else bg->HandleKillUnit(victim->ToCreature(), player); } // achievement stuff - if (killer && victim->GetTypeId() == TYPEID_PLAYER) + if (killer && victim->IsPlayer()) { if (killer->GetTypeId() == TYPEID_UNIT) victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE, killer->GetEntry()); - else if (victim != killer && killer->GetTypeId() == TYPEID_PLAYER) + else if (victim != killer && killer->IsPlayer()) victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER, 1, killer->ToPlayer()->GetTeamId()); } @@ -17976,7 +17976,7 @@ void Unit::SetControlled(bool apply, UnitState state, Unit* source /*= nullptr*/ break; } - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { sScriptMgr->AnticheatSetRootACKUpd(ToPlayer()); } @@ -18069,7 +18069,7 @@ void Unit::SetStunned(bool apply) SetTarget(); SetUnitFlag(UNIT_FLAG_STUNNED); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { SetStandState(UNIT_STAND_STATE_STAND); } @@ -18210,7 +18210,7 @@ void Unit::SetFeared(bool apply, Unit* fearedBy /*= nullptr*/, bool isFear /*= f } // xinef: block / allow control to real mover (eg. charmer) - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { if (m_movedByPlayer) m_movedByPlayer->ToPlayer()->SetClientControl(this, !apply); // verified @@ -18242,7 +18242,7 @@ void Unit::SetConfused(bool apply) } // xinef: block / allow control to real mover (eg. charmer) - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { if (m_movedByPlayer) m_movedByPlayer->ToPlayer()->SetClientControl(this, !apply); // verified @@ -18262,13 +18262,13 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au } // dismount players when charmed - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) RemoveAurasByType(SPELL_AURA_MOUNTED); - if (charmer->GetTypeId() == TYPEID_PLAYER) + if (charmer->IsPlayer()) charmer->RemoveAurasByType(SPELL_AURA_MOUNTED); - ASSERT(type != CHARM_TYPE_POSSESS || charmer->GetTypeId() == TYPEID_PLAYER); + ASSERT(type != CHARM_TYPE_POSSESS || charmer->IsPlayer()); if (type == CHARM_TYPE_VEHICLE && !IsVehicle()) // pussywizard throw 1; ASSERT((type == CHARM_TYPE_VEHICLE) == IsVehicle()); @@ -18285,7 +18285,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au //if (HasUnitState(UNIT_STATE_UNATTACKABLE)) // return false; - if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetTransport()) + if (IsPlayer() && ToPlayer()->GetTransport()) { LOG_FATAL("entities.unit", "Unit::SetCharmedBy: Player on transport is trying to charm {} ({})", GetEntry(), GetGUID().ToString()); return false; @@ -18316,7 +18316,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au } // Charmed stop charming - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { ToPlayer()->StopCastingCharm(aurApp ? aurApp->GetBase() : nullptr); ToPlayer()->StopCastingBindSight(aurApp ? aurApp->GetBase() : nullptr); @@ -18349,7 +18349,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au GetMotionMaster()->MoveIdle(); StopMoving(); - if (charmer->GetTypeId() == TYPEID_PLAYER && charmer->IsClass(CLASS_WARLOCK, CLASS_CONTEXT_PET_CHARM) && ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_DEMON) + if (charmer->IsPlayer() && charmer->IsClass(CLASS_WARLOCK, CLASS_CONTEXT_PET_CHARM) && ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_DEMON) { // Disable CreatureAI/SmartAI and switch to CharmAI when charmed by warlock Creature* charmed = ToCreature(); @@ -18362,7 +18362,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au } // Xinef: If creature can fly, add normal player flying flag (fixes speed) - if (charmer->GetTypeId() == TYPEID_PLAYER && ToCreature()->CanFly()) + if (charmer->IsPlayer() && ToCreature()->CanFly()) AddUnitMovementFlag(MOVEMENTFLAG_FLYING); } else @@ -18441,13 +18441,13 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au break; } } - else if (GetTypeId() == TYPEID_PLAYER) + else if (IsPlayer()) RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT); if (Creature* creature = ToCreature()) creature->RefreshSwimmingFlag(); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) sScriptMgr->OnPlayerBeingCharmed(ToPlayer(), charmer, _oldFactionId, charmer->GetFaction()); return true; @@ -18510,7 +18510,7 @@ void Unit::RemoveCharmedBy(Unit* charmer) if (!charmer) return; - ASSERT(type != CHARM_TYPE_POSSESS || charmer->GetTypeId() == TYPEID_PLAYER); + ASSERT(type != CHARM_TYPE_POSSESS || charmer->IsPlayer()); ASSERT(type != CHARM_TYPE_VEHICLE || (GetTypeId() == TYPEID_UNIT && IsVehicle())); charmer->SetCharm(this, false); @@ -18592,13 +18592,13 @@ void Unit::RemoveCharmedBy(Unit* charmer) playerCharmer->SendRemoveControlBar(); // xinef: Always delete charm info (restores react state) - if (GetTypeId() == TYPEID_PLAYER || (GetTypeId() == TYPEID_UNIT && !ToCreature()->IsGuardian())) + if (IsPlayer() || (GetTypeId() == TYPEID_UNIT && !ToCreature()->IsGuardian())) DeleteCharmInfo(); } void Unit::RestoreFaction() { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) ToPlayer()->SetFactionForRace(getRace()); else { @@ -18685,14 +18685,14 @@ bool Unit::IsInPartyWith(Unit const* unit) const if (u1 == u2) return true; - if (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_PLAYER) + if (u1->IsPlayer() && u2->IsPlayer()) return u1->ToPlayer()->IsInSameGroupWith(u2->ToPlayer()); // Xinef: we assume that npcs with the same faction are in party else if (u1->GetTypeId() == TYPEID_UNIT && u2->GetTypeId() == TYPEID_UNIT && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer()) return u1->GetFaction() == u2->GetFaction(); // Xinef: creature type_flag should work for party check only if player group is not a raid - else if ((u2->GetTypeId() == TYPEID_PLAYER && u1->GetTypeId() == TYPEID_UNIT && (u1->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT) && u2->ToPlayer()->GetGroup() && !u2->ToPlayer()->GetGroup()->isRaidGroup()) || - (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_UNIT && (u2->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT) && u1->ToPlayer()->GetGroup() && !u1->ToPlayer()->GetGroup()->isRaidGroup())) + else if ((u2->IsPlayer() && u1->GetTypeId() == TYPEID_UNIT && (u1->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT) && u2->ToPlayer()->GetGroup() && !u2->ToPlayer()->GetGroup()->isRaidGroup()) || + (u1->IsPlayer() && u2->GetTypeId() == TYPEID_UNIT && (u2->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT) && u1->ToPlayer()->GetGroup() && !u1->ToPlayer()->GetGroup()->isRaidGroup())) return true; else return false; @@ -18708,13 +18708,13 @@ bool Unit::IsInRaidWith(Unit const* unit) const if (u1 == u2) return true; - if (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_PLAYER) + if (u1->IsPlayer() && u2->IsPlayer()) return u1->ToPlayer()->IsInSameRaidWith(u2->ToPlayer()); // Xinef: we assume that npcs with the same faction are in party else if (u1->GetTypeId() == TYPEID_UNIT && u2->GetTypeId() == TYPEID_UNIT && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer()) return u1->GetFaction() == u2->GetFaction(); - else if ((u2->GetTypeId() == TYPEID_PLAYER && u1->GetTypeId() == TYPEID_UNIT && u1->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT) || - (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_UNIT && u2->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT)) + else if ((u2->IsPlayer() && u1->GetTypeId() == TYPEID_UNIT && u1->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT) || + (u1->IsPlayer() && u2->GetTypeId() == TYPEID_UNIT && u2->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT)) return true; else return false; @@ -18724,7 +18724,7 @@ void Unit::GetPartyMembers(std::list& TagUnitMap) { Unit* owner = GetCharmerOrOwnerOrSelf(); Group* group = nullptr; - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) group = owner->ToPlayer()->GetGroup(); if (group) @@ -18835,12 +18835,12 @@ void Unit::ApplyResilience(Unit const* victim, float* crit, int32* damage, bool return; Unit const* target = nullptr; - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) target = victim; else if (victim->GetTypeId() == TYPEID_UNIT) { if (Unit* owner = victim->GetOwner()) - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) target = owner; } @@ -18909,7 +18909,7 @@ float Unit::MeleeSpellMissChance(Unit const* victim, WeaponAttackType attType, i // bonus from skills is 0.04% //miss_chance -= skillDiff * 0.04f; int32 diff = -skillDiff; - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) missChance += diff > 0 ? diff * 0.04f : diff * 0.02f; else missChance += diff > 10 ? 1 + (diff - 10) * 0.4f : diff * 0.1f; @@ -19114,7 +19114,7 @@ uint32 Unit::GetModelForForm(ShapeshiftForm form, uint32 spellId) const break; } - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { switch (form) { @@ -19478,7 +19478,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->second.spellId); // xinef: dont allow players to enter vehicles on arena - if (spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE) && caster->GetTypeId() == TYPEID_PLAYER && caster->FindMap() && caster->FindMap()->IsBattleArena()) + if (spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE) && caster->IsPlayer() && caster->FindMap() && caster->FindMap()->IsBattleArena()) continue; if (seatId > -1) @@ -19575,7 +19575,7 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a if (Player* player = ToPlayer()) { - if (vehicle->GetBase()->GetTypeId() == TYPEID_PLAYER && player->IsInCombat()) + if (vehicle->GetBase()->IsPlayer() && player->IsInCombat()) return; sScriptMgr->AnticheatSetUnderACKmount(player); @@ -19890,7 +19890,7 @@ void Unit::NearTeleportTo(Position& pos, bool casting /*= false*/, bool vehicleT void Unit::NearTeleportTo(float x, float y, float z, float orientation, bool casting /*= false*/, bool vehicleTeleport /*= false*/, bool withPet /*= false*/, bool removeTransport /*= false*/) { DisableSpline(); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) ToPlayer()->TeleportTo(GetMapId(), x, y, z, orientation, TELE_TO_NOT_LEAVE_COMBAT | (removeTransport ? 0 : TELE_TO_NOT_LEAVE_TRANSPORT) | TELE_TO_NOT_UNSUMMON_PET | (casting ? TELE_TO_SPELL : 0) | (vehicleTeleport ? TELE_TO_NOT_LEAVE_VEHICLE : 0) | (withPet ? TELE_TO_WITH_PET : 0)); else { @@ -19914,7 +19914,7 @@ void Unit::SendTeleportPacket(Position& pos) Position oldPos = { GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation() }; if (GetTypeId() == TYPEID_UNIT) Relocate(&pos); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { ToPlayer()->SetCanTeleport(true); } @@ -19923,7 +19923,7 @@ void Unit::SendTeleportPacket(Position& pos) BuildMovementPacket(&data2); if (GetTypeId() == TYPEID_UNIT) Relocate(&oldPos); - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) Relocate(&pos); SendMessageToSet(&data2, false); } @@ -19949,7 +19949,7 @@ bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool tel if (relocated) { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) GetMap()->PlayerRelocation(ToPlayer(), x, y, z, orientation); else GetMap()->CreatureRelocation(ToCreature(), x, y, z, orientation); @@ -19958,7 +19958,7 @@ bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool tel { UpdateOrientation(orientation); - if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetFarSightDistance()) + if (IsPlayer() && ToPlayer()->GetFarSightDistance()) UpdateObjectVisibility(false); } @@ -20081,7 +20081,7 @@ void Unit::StopAttackFaction(uint32 faction_id) InterruptNonMeleeSpells(false); // melee and ranged forced attack cancel - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) ToPlayer()->SendAttackSwingCancelAttack(); } } @@ -20113,7 +20113,7 @@ void Unit::StopAttackingInvalidTarget() if (!attacker->IsValidAttackTarget(this)) { attacker->AttackStop(); - if (attacker->GetTypeId() == TYPEID_PLAYER) + if (attacker->IsPlayer()) { attacker->ToPlayer()->SendAttackSwingCancelAttack(); } @@ -20835,7 +20835,7 @@ void Unit::PatchValuesUpdate(ByteBuffer& valuesUpdateBuf, BuildValuesCachePosPoi valuesUpdateBuf.put(posPointers.UnitFieldBytes2Pos, (m_uint32Values[UNIT_FIELD_BYTES_2] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8))); // this flag is at uint8 offset 1 !! }// pussywizard / Callmephil else if (target->IsSpectator() && target->FindMap() && target->FindMap()->IsBattleArena() && - (this->GetTypeId() == TYPEID_PLAYER || this->GetTypeId() == TYPEID_UNIT || this->GetTypeId() == TYPEID_DYNAMICOBJECT)) + (this->IsPlayer() || this->GetTypeId() == TYPEID_UNIT || this->IsDynamicObject())) { valuesUpdateBuf.put(posPointers.UnitFieldBytes2Pos, (m_uint32Values[UNIT_FIELD_BYTES_2] & 0xFFFFF2FF)); // clear UNIT_BYTE2_FLAG_PVP, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_BYTE2_FLAG_SANCTUARY } @@ -20853,7 +20853,7 @@ void Unit::PatchValuesUpdate(ByteBuffer& valuesUpdateBuf, BuildValuesCachePosPoi valuesUpdateBuf.put(posPointers.UnitFieldFactionTemplatePos, uint32(target->GetFaction())); }// pussywizard / Callmephil else if (target->IsSpectator() && target->FindMap() && target->FindMap()->IsBattleArena() && - (this->GetTypeId() == TYPEID_PLAYER || this->GetTypeId() == TYPEID_UNIT || this->GetTypeId() == TYPEID_DYNAMICOBJECT)) + (this->IsPlayer() || this->GetTypeId() == TYPEID_UNIT || this->IsDynamicObject())) { valuesUpdateBuf.put(posPointers.UnitFieldFactionTemplatePos, uint32(target->GetFaction())); } @@ -20885,7 +20885,7 @@ void Unit::BuildCooldownPacket(WorldPacket& data, uint8 flags, PacketCooldowns c uint8 Unit::getRace(bool original) const { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) { if (original) return m_realRace; @@ -20898,7 +20898,7 @@ uint8 Unit::getRace(bool original) const void Unit::setRace(uint8 race) { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) m_race = race; } @@ -20942,7 +20942,7 @@ bool Unit::IsInCombatWith(Unit const* who) const */ float Unit::GetCollisionWidth() const { - if (GetTypeId() == TYPEID_PLAYER) + if (IsPlayer()) return GetObjectSize(); float scaleMod = GetObjectScale(); // 99% sure about this diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 313427813..22952cd67 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -82,7 +82,7 @@ void Vehicle::Install() void Vehicle::InstallAllAccessories(bool evading) { - if (GetBase()->GetTypeId() == TYPEID_PLAYER || !evading) + if (GetBase()->IsPlayer() || !evading) RemoveAllPassengers(); // We might have aura's saved in the DB with now invalid casters - remove VehicleAccessoryList const* accessories = sObjectMgr->GetVehicleAccessoryList(this); @@ -116,7 +116,7 @@ void Vehicle::Uninstall() void Vehicle::Reset(bool evading /*= false*/) { LOG_DEBUG("vehicles", "Vehicle::Reset: {}", _me->GetGUID().ToString()); - if (_me->GetTypeId() == TYPEID_PLAYER) + if (_me->IsPlayer()) { if (_usableSeatNum) _me->SetNpcFlag(UNIT_NPC_FLAG_PLAYER_VEHICLE); @@ -357,7 +357,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) --_usableSeatNum; if (!_usableSeatNum) { - if (_me->GetTypeId() == TYPEID_PLAYER) + if (_me->IsPlayer()) _me->RemoveNpcFlag(UNIT_NPC_FLAG_PLAYER_VEHICLE); else _me->RemoveNpcFlag(UNIT_NPC_FLAG_SPELLCLICK); @@ -368,7 +368,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) return false; // Xinef: moved from unit.cpp, if aura passes seatId == -1 (choose automaticly) we wont get appropriate flags - if (unit->GetTypeId() == TYPEID_PLAYER && !(seat->second.SeatInfo->m_flagsB & VEHICLE_SEAT_FLAG_B_KEEP_PET)) + if (unit->IsPlayer() && !(seat->second.SeatInfo->m_flagsB & VEHICLE_SEAT_FLAG_B_KEEP_PET)) unit->ToPlayer()->UnsummonPetTemporaryIfAny(); if (seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE) @@ -383,7 +383,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) // xinef: removed seat->first == 0 check... if (_me->GetTypeId() == TYPEID_UNIT - && unit->GetTypeId() == TYPEID_PLAYER + && unit->IsPlayer() && seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL) { // Removed try catch + ABORT() here, and make it as simple condition check. @@ -460,7 +460,7 @@ void Vehicle::RemovePassenger(Unit* unit) unit->GetName(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUID().ToString(), (int32)seat->first); if (seat->second.SeatInfo->CanEnterOrExit() && ++_usableSeatNum) - _me->SetNpcFlag((_me->GetTypeId() == TYPEID_PLAYER ? UNIT_NPC_FLAG_PLAYER_VEHICLE : UNIT_NPC_FLAG_SPELLCLICK)); + _me->SetNpcFlag((_me->IsPlayer() ? UNIT_NPC_FLAG_PLAYER_VEHICLE : UNIT_NPC_FLAG_SPELLCLICK)); // Remove UNIT_FLAG_NOT_SELECTABLE if passenger did not have it before entering vehicle if (seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE && !seat->second.Passenger.IsUnselectable) @@ -468,7 +468,7 @@ void Vehicle::RemovePassenger(Unit* unit) seat->second.Passenger.Reset(); - if (_me->GetTypeId() == TYPEID_UNIT && unit->GetTypeId() == TYPEID_PLAYER && seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL) + if (_me->GetTypeId() == TYPEID_UNIT && unit->IsPlayer() && seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL) _me->RemoveCharmedBy(unit); if (_me->IsInWorld()) @@ -483,7 +483,7 @@ void Vehicle::RemovePassenger(Unit* unit) } // only for flyable vehicles - if (_me->IsFlying() && !_me->GetInstanceId() && unit->GetTypeId() == TYPEID_PLAYER && !(unit->ToPlayer()->GetDelayedOperations() & DELAYED_VEHICLE_TELEPORT) && _me->GetEntry() != 30275 /*NPC_WILD_WYRM*/) + if (_me->IsFlying() && !_me->GetInstanceId() && unit->IsPlayer() && !(unit->ToPlayer()->GetDelayedOperations() & DELAYED_VEHICLE_TELEPORT) && _me->GetEntry() != 30275 /*NPC_WILD_WYRM*/) _me->CastSpell(unit, VEHICLE_SPELL_PARACHUTE, true); if (_me->GetTypeId() == TYPEID_UNIT) @@ -533,7 +533,7 @@ bool Vehicle::IsVehicleInUse() for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr) if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger.Guid)) { - if (passenger->GetTypeId() == TYPEID_PLAYER) + if (passenger->IsPlayer()) return true; else if (passenger->GetTypeId() == TYPEID_UNIT && passenger->GetVehicleKit() && passenger->GetVehicleKit()->IsVehicleInUse()) return true; @@ -550,7 +550,7 @@ void Vehicle::TeleportVehicle(float x, float y, float z, float ang) for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr) if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger.Guid)) { - if (passenger->GetTypeId() == TYPEID_PLAYER) + if (passenger->IsPlayer()) { passenger->ToPlayer()->SetMover(passenger); passenger->NearTeleportTo(x, y, z, ang, false, true); diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp index c169769a8..19d8b6818 100644 --- a/src/server/game/Globals/ObjectAccessor.cpp +++ b/src/server/game/Globals/ObjectAccessor.cpp @@ -146,7 +146,7 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, ObjectGuid con switch (guid.GetHigh()) { case HighGuid::Item: - if (typemask & TYPEMASK_ITEM && p.GetTypeId() == TYPEID_PLAYER) + if (typemask & TYPEMASK_ITEM && p.IsPlayer()) return ((Player const&)p).GetItemByGuid(guid); break; case HighGuid::Player: diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp index 42661e934..bfbf028d7 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp +++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp @@ -159,7 +159,7 @@ inline void CreatureUnitRelocationWorker(Creature* c, Unit* u) { c->AI()->MoveInLineOfSight_Safe(u); } - else if (u->GetTypeId() == TYPEID_PLAYER && u->HasStealthAura() && c->IsAIEnabled && c->CanSeeOrDetect(u, false, true, true)) + else if (u->IsPlayer() && u->HasStealthAura() && c->IsAIEnabled && c->CanSeeOrDetect(u, false, true, true)) { c->AI()->TriggerAlert(u); } diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 9d6b36a0b..d3e1e89b2 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -107,7 +107,7 @@ namespace Acore bool required3dDist; MessageDistDeliverer(WorldObject const* src, WorldPacket const* msg, float dist, bool own_team_only = false, Player const* skipped = nullptr, bool req3dDist = false) : i_source(src), i_message(msg), i_phaseMask(src->GetPhaseMask()), i_distSq(dist * dist) - , teamId((own_team_only && src->GetTypeId() == TYPEID_PLAYER) ? src->ToPlayer()->GetTeamId() : TEAM_NEUTRAL) + , teamId((own_team_only && src->IsPlayer()) ? src->ToPlayer()->GetTeamId() : TEAM_NEUTRAL) , skipped_receiver(skipped), required3dDist(req3dDist) { } @@ -978,7 +978,7 @@ namespace Acore AnyFriendlyUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, bool playerOnly = false) : i_obj(obj), i_funit(funit), i_range(range), i_playerOnly(playerOnly) {} bool operator()(Unit* u) { - if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_funit->IsFriendlyTo(u) && (!i_playerOnly || u->GetTypeId() == TYPEID_PLAYER)) + if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_funit->IsFriendlyTo(u) && (!i_playerOnly || u->IsPlayer())) return true; else return false; @@ -996,7 +996,7 @@ namespace Acore AnyFriendlyNotSelfUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, bool playerOnly = false) : i_obj(obj), i_funit(funit), i_range(range), i_playerOnly(playerOnly) {} bool operator()(Unit* u) { - if (u != i_obj && u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_funit->IsFriendlyTo(u) && (!i_playerOnly || u->GetTypeId() == TYPEID_PLAYER)) + if (u != i_obj && u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_funit->IsFriendlyTo(u) && (!i_playerOnly || u->IsPlayer())) return true; else return false; @@ -1083,8 +1083,8 @@ namespace Acore Unit const* owner = i_funit->GetOwner(); if (owner) check = owner; - i_targetForPlayer = (check->GetTypeId() == TYPEID_PLAYER); - if (i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT) + i_targetForPlayer = (check->IsPlayer()); + if (i_obj->IsDynamicObject()) _spellInfo = sSpellMgr->GetSpellInfo(((DynamicObject*)i_obj)->GetSpellId()); } bool operator()(Unit* u) @@ -1104,7 +1104,8 @@ namespace Acore } - if (i_funit->_IsValidAttackTarget(u, _spellInfo, i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT ? i_obj : nullptr) && i_obj->IsWithinDistInMap(u, i_range,true,false)) + if (i_funit->_IsValidAttackTarget(u, _spellInfo, i_obj->IsDynamicObject() ? i_obj : nullptr) && i_obj->IsWithinDistInMap(u, i_range,true,false)) + return true; return false; @@ -1487,7 +1488,7 @@ namespace Acore } Player* player = nullptr; - if (u->GetTypeId() == TYPEID_PLAYER) + if (u->IsPlayer()) { player = u->ToPlayer(); } diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index c0f66a02b..8368c8723 100644 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -92,7 +92,7 @@ void WorldSession::HandlePetAction(WorldPacket& recvData) } // Xinef: allow to controll players - if (pet->GetTypeId() == TYPEID_PLAYER && flag != ACT_COMMAND && flag != ACT_REACTION) + if (pet->IsPlayer() && flag != ACT_COMMAND && flag != ACT_REACTION) return; // Do not follow itself vehicle @@ -387,17 +387,17 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe if (unit_target) { pet->SetInFront(unit_target); - if (unit_target->GetTypeId() == TYPEID_PLAYER) + if (unit_target->IsPlayer()) pet->SendUpdateToPlayer(unit_target->ToPlayer()); } else if (Unit* unit_target2 = spell->m_targets.GetUnitTarget()) { pet->SetInFront(unit_target2); - if (unit_target2->GetTypeId() == TYPEID_PLAYER) + if (unit_target2->IsPlayer()) pet->SendUpdateToPlayer(unit_target2->ToPlayer()); } if (Unit* powner = pet->GetCharmerOrOwner()) - if (powner->GetTypeId() == TYPEID_PLAYER) + if (powner->IsPlayer()) pet->SendUpdateToPlayer(powner->ToPlayer()); result = SPELL_CAST_OK; @@ -853,7 +853,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData) pet->SetName(name); Unit* owner = pet->GetOwner(); - if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup()) + if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup()) owner->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_NAME); pet->RemoveByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED); @@ -1065,7 +1065,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) if (!caster->GetCharmInfo() || !caster->GetCharmInfo()->GetForcedSpell()) spell->SendPetCastResult(result); - if (caster->GetTypeId() == TYPEID_PLAYER) + if (caster->IsPlayer()) { if (!caster->ToPlayer()->HasSpellCooldown(spellId)) GetPlayer()->SendClearCooldown(spellId, caster); diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 5d03deda1..120424711 100644 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -124,7 +124,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData) // no or incorrect quest giver if (!object || object == _player || (object->GetTypeId() != TYPEID_PLAYER && !object->hasQuest(questId)) || - (object->GetTypeId() == TYPEID_PLAYER && !object->ToPlayer()->CanShareQuest(questId))) + (object->IsPlayer() && !object->ToPlayer()->CanShareQuest(questId))) { _player->PlayerTalkClass->SendCloseGossip(); _player->SetDivider(); @@ -138,7 +138,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData) if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId)) { // pussywizard: exploit fix, can't share quests that give items to be sold - if (object->GetTypeId() == TYPEID_PLAYER) + if (object->IsPlayer()) if (uint32 itemId = quest->GetSrcItemId()) if (ItemTemplate const* srcItem = sObjectMgr->GetItemTemplate(itemId)) if (srcItem->SellPrice > 0) @@ -220,7 +220,7 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recvData) if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId)) { // not sure here what should happen to quests with QUEST_FLAGS_AUTOCOMPLETE - // if this breaks them, add && object->GetTypeId() == TYPEID_ITEM to this check + // if this breaks them, add && object->IsItem() to this check // item-started quests never have that flag if (!_player->CanTakeQuest(quest, true)) return; diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index b9745d3d7..e09e8033b 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -351,7 +351,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) // ignore for remote control state (for player case) Unit* mover = _player->m_mover; - if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER) + if (mover != _player && mover->IsPlayer()) { recvPacket.rfinish(); // prevent spam at ignore packet return; @@ -372,7 +372,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) HandleClientCastFlags(recvPacket, castFlags, targets); // not have spell in spellbook - if (mover->GetTypeId() == TYPEID_PLAYER) + if (mover->IsPlayer()) { // not have spell in spellbook or spell passive and not casted by client if( !(spellInfo->Targets & TARGET_FLAG_GAMEOBJECT_ITEM) && (!mover->ToPlayer()->HasActiveSpell(spellId) || spellInfo->IsPassive()) ) @@ -688,7 +688,7 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData) data << uint8(creator->getGender()); data << uint8(creator->getClass()); - if (creator->GetTypeId() == TYPEID_PLAYER) + if (creator->IsPlayer()) { Player* player = creator->ToPlayer(); data << uint8(player->GetByteValue(PLAYER_BYTES, 0)); // skin diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 4900bd377..f2d298624 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -70,7 +70,7 @@ Map::~Map() WorldObject* obj = *i_worldObjects.begin(); ASSERT(obj->IsWorldObject()); LOG_DEBUG("maps", "Map::~Map: WorldObject TypeId is not a corpse! ({})", static_cast(obj->GetTypeId())); - //ASSERT(obj->GetTypeId() == TYPEID_CORPSE); + //ASSERT(obj->IsCorpse()); obj->RemoveFromWorld(); obj->ResetMap(); } diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index d17cef553..8948c0d46 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -269,7 +269,7 @@ void MotionMaster::MoveTargetedHome(bool walk /*= false*/) Unit* target = _owner->ToCreature()->GetCharmerOrOwner(); if (target) { - LOG_DEBUG("movement.motionmaster", "Following {} ({})", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString()); + LOG_DEBUG("movement.motionmaster", "Following {} ({})", target->IsPlayer() ? "player" : "creature", target->GetGUID().ToString()); Mutate(new FollowMovementGenerator(target, PET_FOLLOW_DIST, _owner->GetFollowAngle(),true), MOTION_SLOT_ACTIVE); } } @@ -285,7 +285,7 @@ void MotionMaster::MoveConfused() if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) return; - if (_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->IsPlayer()) { LOG_DEBUG("movement.motionmaster", "Player ({}) move confused", _owner->GetGUID().ToString()); Mutate(new ConfusedMovementGenerator(), MOTION_SLOT_CONTROLLED); @@ -305,16 +305,16 @@ void MotionMaster::MoveChase(Unit* target, std::optional dist, std: return; //_owner->ClearUnitState(UNIT_STATE_FOLLOW); - if (_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->IsPlayer()) { LOG_DEBUG("movement.motionmaster", "Player ({}) chase to {} ({})", - _owner->GetGUID().ToString(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString()); + _owner->GetGUID().ToString(), target->IsPlayer() ? "player" : "creature", target->GetGUID().ToString()); Mutate(new ChaseMovementGenerator(target, dist, angle), MOTION_SLOT_ACTIVE); } else { LOG_DEBUG("movement.motionmaster", "Creature ({}) chase to {} ({})", - _owner->GetGUID().ToString(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString()); + _owner->GetGUID().ToString(), target->IsPlayer() ? "player" : "creature", target->GetGUID().ToString()); Mutate(new ChaseMovementGenerator(target, dist, angle), MOTION_SLOT_ACTIVE); } } @@ -401,16 +401,16 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo } //_owner->AddUnitState(UNIT_STATE_FOLLOW); - if (_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->IsPlayer()) { LOG_DEBUG("movement.motionmaster", "Player ({}) follow to {} ({})", - _owner->GetGUID().ToString(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString()); + _owner->GetGUID().ToString(), target->IsPlayer() ? "player" : "creature", target->GetGUID().ToString()); Mutate(new FollowMovementGenerator(target, dist, angle, inheritWalkState), slot); } else { LOG_DEBUG("movement.motionmaster", "Creature ({}) follow to {} ({})", - _owner->GetGUID().ToString(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString()); + _owner->GetGUID().ToString(), target->IsPlayer() ? "player" : "creature", target->GetGUID().ToString()); Mutate(new FollowMovementGenerator(target, dist, angle, inheritWalkState), slot); } } @@ -421,7 +421,7 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generate if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) return; - if (_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->IsPlayer()) { LOG_DEBUG("movement.motionmaster", "Player ({}) targeted point (Id: {} X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), id, x, y, z); Mutate(new PointMovementGenerator(id, x, y, z, 0.0f, orientation, nullptr, generatePath, forceDestination), slot); @@ -439,7 +439,7 @@ void MotionMaster::MoveSplinePath(Movement::PointsArray* path) if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) return; - if (_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->IsPlayer()) { Mutate(new EscortMovementGenerator(path), MOTION_SLOT_ACTIVE); } @@ -527,7 +527,7 @@ void MotionMaster::MoveTakeoff(uint32 id, float x, float y, float z, float speed void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ) { //this function may make players fall below map - if (_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->IsPlayer()) return; if (speedXY <= 0.1f) @@ -553,7 +553,7 @@ void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, floa void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ) { //this function may make players fall below map - if (_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->IsPlayer()) return; float x, y, z; @@ -603,7 +603,7 @@ void MotionMaster::MoveFall(uint32 id /*=0*/, bool addFlagForNPC) if (std::fabs(_owner->GetPositionZ() - tz) < 0.1f) return; - if (_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->IsPlayer()) { _owner->AddUnitMovementFlag(MOVEMENTFLAG_FALLING); _owner->m_movementInfo.SetFallTime(0); @@ -634,7 +634,7 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id, if (Impl[MOTION_SLOT_CONTROLLED] && Impl[MOTION_SLOT_CONTROLLED]->GetMovementGeneratorType() != DISTRACT_MOTION_TYPE) return; - if (_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->IsPlayer()) { LOG_DEBUG("movement.motionmaster", "Player ({}) charge point (X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), x, y, z); Mutate(new PointMovementGenerator(id, x, y, z, speed, orientation, path, generatePath, generatePath, targetGUID), MOTION_SLOT_CONTROLLED); @@ -665,7 +665,7 @@ void MotionMaster::MoveSeekAssistance(float x, float y, float z) if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) return; - if (_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->IsPlayer()) { LOG_ERROR("movement.motionmaster", "Player ({}) attempt to seek assistance", _owner->GetGUID().ToString()); } @@ -685,7 +685,7 @@ void MotionMaster::MoveSeekAssistanceDistract(uint32 time) if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) return; - if (_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->IsPlayer()) { LOG_ERROR("movement.motionmaster", "Player ({}) attempt to call distract after assistance", _owner->GetGUID().ToString()); } @@ -705,16 +705,16 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time) if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) return; - if (_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->IsPlayer()) { LOG_DEBUG("movement.motionmaster", "Player ({}) flee from {} ({})", - _owner->GetGUID().ToString(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetGUID().ToString()); + _owner->GetGUID().ToString(), enemy->IsPlayer() ? "player" : "creature", enemy->GetGUID().ToString()); Mutate(new FleeingMovementGenerator(enemy->GetGUID()), MOTION_SLOT_CONTROLLED); } else { LOG_DEBUG("movement.motionmaster", "Creature ({}) flee from {} ({}) {}", - _owner->GetGUID().ToString(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetGUID().ToString(), time ? " for a limited time" : ""); + _owner->GetGUID().ToString(), enemy->IsPlayer() ? "player" : "creature", enemy->GetGUID().ToString(), time ? " for a limited time" : ""); if (time) Mutate(new TimedFleeingMovementGenerator(enemy->GetGUID(), time), MOTION_SLOT_CONTROLLED); else @@ -724,7 +724,7 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time) void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode) { - if (_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->IsPlayer()) { if (path < sTaxiPathNodesByPath.size()) { @@ -754,7 +754,7 @@ void MotionMaster::MoveDistract(uint32 timer) if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE)) return; - /*if (_owner->GetTypeId() == TYPEID_PLAYER) + /*if (_owner->IsPlayer()) { LOG_DEBUG("movement.motionmaster", "Player ({}) distracted (timer: {})", _owner->GetGUID().ToString(), timer); } @@ -817,12 +817,12 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable) delete curr; }*/ - //_owner->GetTypeId() == TYPEID_PLAYER ? + //_owner->IsPlayer() ? //Mutate(new WaypointMovementGenerator(path_id, repeatable)): Mutate(new WaypointMovementGenerator(path_id, repeatable), MOTION_SLOT_IDLE); LOG_DEBUG("movement.motionmaster", "{} ({}) start moving over path(Id:{}, repeatable: {})", - _owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature", _owner->GetGUID().ToString(), path_id, repeatable ? "YES" : "NO"); + _owner->IsPlayer() ? "Player" : "Creature", _owner->GetGUID().ToString(), path_id, repeatable ? "YES" : "NO"); } void MotionMaster::MoveRotate(uint32 time, RotateDirection direction) diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index a2ef923f6..015f93650 100644 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp @@ -85,7 +85,7 @@ bool ChaseMovementGenerator::DoUpdate(T* owner, uint32 time_diff) bool forceDest = //(cOwner && (cOwner->isWorldBoss() || cOwner->IsDungeonBoss())) || // force for all bosses, even not in instances - (i_target->GetTypeId() == TYPEID_PLAYER && i_target->ToPlayer()->IsGameMaster()) || // for .npc follow + (i_target->IsPlayer() && i_target->ToPlayer()->IsGameMaster()) || // for .npc follow (owner->CanFly()) ; // closes "bool forceDest", that way it is more appropriate, so we can comment out crap whenever we need to @@ -452,11 +452,11 @@ bool FollowMovementGenerator::DoUpdate(T* owner, uint32 time_diff) bool forceDest = (followingMaster) || // allow pets following their master to cheat while generating paths - (i_target->GetTypeId() == TYPEID_PLAYER && i_target->ToPlayer()->IsGameMaster()) // for .npc follow + (i_target->IsPlayer() && i_target->ToPlayer()->IsGameMaster()) // for .npc follow ; // closes "bool forceDest", that way it is more appropriate, so we can comment out crap whenever we need to bool targetIsMoving = false; - if (PositionOkay(target, owner->IsGuardian() && target->GetTypeId() == TYPEID_PLAYER, targetIsMoving, time_diff)) + if (PositionOkay(target, owner->IsGuardian() && target->IsPlayer(), targetIsMoving, time_diff)) { if (owner->HasUnitState(UNIT_STATE_FOLLOW_MOVE) && owner->movespline->Finalized()) { diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index 2dfc18641..fe945d719 100644 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -40,7 +40,7 @@ void Map::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, O // prepare static data ObjectGuid sourceGUID = source ? source->GetGUID() : ObjectGuid::Empty; //some script commands doesn't have source ObjectGuid targetGUID = target ? target->GetGUID() : ObjectGuid::Empty; - ObjectGuid ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : ObjectGuid::Empty; + ObjectGuid ownerGUID = (source && source->IsItem()) ? ((Item*)source)->GetOwnerGUID() : ObjectGuid::Empty; ///- Schedule script execution for all scripts in the script map ScriptMap const* s2 = &(s->second); @@ -75,7 +75,7 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou // prepare static data ObjectGuid sourceGUID = source ? source->GetGUID() : ObjectGuid::Empty; ObjectGuid targetGUID = target ? target->GetGUID() : ObjectGuid::Empty; - ObjectGuid ownerGUID = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : ObjectGuid::Empty; + ObjectGuid ownerGUID = (source && source->IsItem()) ? ((Item*)source)->GetOwnerGUID() : ObjectGuid::Empty; ScriptAction sa; sa.sourceGUID = sourceGUID; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index ac239941e..92a3021a1 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1543,7 +1543,7 @@ void AuraEffect::HandleModInvisibilityDetect(AuraApplication const* aurApp, uint } // call functions which may have additional effects after chainging state of unit - target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer()); + target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer()); } void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -1557,7 +1557,7 @@ void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode if (apply) { // apply glow vision - if (target->GetTypeId() == TYPEID_PLAYER && (type == INVISIBILITY_GENERAL || type == INVISIBILITY_UNK10)) + if (target->IsPlayer() && (type == INVISIBILITY_GENERAL || type == INVISIBILITY_UNK10)) target->SetByteFlag(PLAYER_FIELD_BYTES2, PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION, PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); target->m_invisibility.AddFlag(type); @@ -1569,7 +1569,7 @@ void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode { // if not have different invisibility auras. // always remove glow vision - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->RemoveByteFlag(PLAYER_FIELD_BYTES2, 3, PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); target->m_invisibility.DelFlag(type); @@ -1592,7 +1592,7 @@ void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode // if not have invisibility auras of type INVISIBILITY_GENERAL // remove glow vision - if (target->GetTypeId() == TYPEID_PLAYER && !target->m_invisibility.HasFlag(INVISIBILITY_GENERAL) && !target->m_invisibility.HasFlag(INVISIBILITY_UNK10)) + if (target->IsPlayer() && !target->m_invisibility.HasFlag(INVISIBILITY_GENERAL) && !target->m_invisibility.HasFlag(INVISIBILITY_UNK10)) { target->RemoveByteFlag(PLAYER_FIELD_BYTES2, PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION, PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); } @@ -1609,7 +1609,7 @@ void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); } - target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true); + target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true); target->bRequestForcedVisibilityUpdate = false; } @@ -1635,7 +1635,7 @@ void AuraEffect::HandleModStealthDetect(AuraApplication const* aurApp, uint8 mod } // call functions which may have additional effects after chainging state of unit - target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer()); + target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer()); } void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -1652,7 +1652,7 @@ void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, boo target->m_stealth.AddValue(type, GetAmount()); target->SetStandFlags(UNIT_STAND_FLAGS_CREEP); - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->SetByteFlag(PLAYER_FIELD_BYTES2, 3, PLAYER_FIELD_BYTE2_STEALTH); // interrupt autoshot @@ -1671,7 +1671,7 @@ void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, boo target->m_stealth.DelFlag(type); target->RemoveStandFlags(UNIT_STAND_FLAGS_CREEP); - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->RemoveByteFlag(PLAYER_FIELD_BYTES2, 3, PLAYER_FIELD_BYTE2_STEALTH); } } @@ -1683,7 +1683,7 @@ void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, boo target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); } - target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true); + target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true); target->bRequestForcedVisibilityUpdate = false; } @@ -1701,7 +1701,7 @@ void AuraEffect::HandleModStealthLevel(AuraApplication const* aurApp, uint8 mode target->m_stealth.AddValue(type, -GetAmount()); // call functions which may have additional effects after chainging state of unit - target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer()); + target->UpdateObjectVisibility(target->IsPlayer() || target->GetOwnerGUID().IsPlayer()); } void AuraEffect::HandleDetectAmore(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -2065,7 +2065,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo Rage_val += aurEff->GetAmount() * 10; } // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch) - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) { // Stance mastery - trainer spell PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap(); @@ -2104,7 +2104,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo // add/remove the shapeshift aura's boosts HandleShapeshiftBoosts(target, apply); - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->ToPlayer()->InitDataForForm(); if (target->IsClass(CLASS_DRUID, CLASS_CONTEXT_ABILITY)) @@ -2142,7 +2142,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo if (apply && aurApp->GetRemoveMode()) return; - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) { SpellShapeshiftFormEntry const* shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form); // Learn spells for shapeshift form - no need to send action bars or add spells to spellbook @@ -2730,7 +2730,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, target->setTransForm(GetId()); // polymorph case - if ((mode & AURA_EFFECT_HANDLE_REAL) && target->GetTypeId() == TYPEID_PLAYER && target->IsPolymorphed()) + if ((mode & AURA_EFFECT_HANDLE_REAL) && target->IsPlayer() && target->IsPolymorphed()) { // for players, start regeneration after 1s (in polymorph fast regeneration case) // only if caster is Player (after patch 2.4.2) @@ -2991,7 +2991,7 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode, target->RemoveFlag(field, flag); // Handle damage modification, shapeshifted druids are not affected - if (target->GetTypeId() == TYPEID_PLAYER && (!target->IsInFeralForm() || target->GetShapeshiftForm() == FORM_GHOSTWOLF)) + if (target->IsPlayer() && (!target->IsInFeralForm() || target->GetShapeshiftForm() == FORM_GHOSTWOLF)) { if (Item* pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) { @@ -3087,7 +3087,7 @@ void AuraEffect::HandleAuraAllowOnlyAbility(AuraApplication const* aurApp, uint8 Unit* target = aurApp->GetTarget(); - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) { if (apply) target->ToPlayer()->SetPlayerFlag(PLAYER_ALLOW_ONLY_ABILITY); @@ -3174,7 +3174,7 @@ void AuraEffect::HandleAuraModStalked(AuraApplication const* aurApp, uint8 mode, } // call functions which may have additional effects after chainging state of unit - target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER); + target->UpdateObjectVisibility(target->IsPlayer()); } void AuraEffect::HandleAuraUntrackable(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -3366,7 +3366,7 @@ void AuraEffect::HandleAuraFeatherFall(AuraApplication const* aurApp, uint8 mode target->SetFeatherFall(apply); // start fall from current height - if (!apply && target->GetTypeId() == TYPEID_PLAYER) + if (!apply && target->IsPlayer()) target->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), target->GetPositionZ()); } @@ -3400,7 +3400,7 @@ void AuraEffect::HandleWaterBreathing(AuraApplication const* aurApp, uint8 mode, Unit* target = aurApp->GetTarget(); // update timers in client - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->ToPlayer()->UpdateMirrorTimers(); } @@ -3526,7 +3526,7 @@ void AuraEffect::HandlePreventFleeing(AuraApplication const* aurApp, uint8 mode, Unit* target = aurApp->GetTarget(); // Since patch 3.0.2 this mechanic no longer affects fear effects. It will ONLY prevent humanoids from fleeing due to low health. - if (target->GetTypeId() == TYPEID_PLAYER || !apply || target->HasAuraType(SPELL_AURA_MOD_FEAR)) + if (target->IsPlayer() || !apply || target->HasAuraType(SPELL_AURA_MOD_FEAR)) return; /// @todo: find a way to cancel fleeing for assistance. /// Currently this will only stop creatures fleeing due to low health that could not find nearby allies to flee towards. @@ -3733,7 +3733,7 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp, if (mode & AURA_EFFECT_HANDLE_REAL) { //Players on flying mounts must be immune to polymorph - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply); // Dragonmaw Illusion (overwrite mount model, mounted aura already applied) @@ -4327,7 +4327,7 @@ void AuraEffect::HandleAuraModResistanceExclusive(AuraApplication const* aurApp, { float value = float(GetAmount() - amount); target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, value, apply); - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->ApplyResistanceBuffModsMod(SpellSchools(x), aurApp->IsPositive(), value, apply); } } @@ -4346,7 +4346,7 @@ void AuraEffect::HandleAuraModResistance(AuraApplication const* aurApp, uint8 mo if (GetMiscValue() & int32(1 << x)) { target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(GetAmount()), apply); - if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet()) + if (target->IsPlayer() || target->IsPet()) target->ApplyResistanceBuffModsMod(SpellSchools(x), GetAmount() > 0, (float)GetAmount(), apply); } } @@ -4379,7 +4379,7 @@ void AuraEffect::HandleModResistancePercent(AuraApplication const* aurApp, uint8 if (GetMiscValue() & int32(1 << i)) { target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(GetAmount()), apply); - if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet()) + if (target->IsPlayer() || target->IsPet()) { target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, (float)GetAmount(), apply); target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, (float)GetAmount(), apply); @@ -4413,11 +4413,11 @@ void AuraEffect::HandleModTargetResistance(AuraApplication const* aurApp, uint8 // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage // show armor penetration - if (target->GetTypeId() == TYPEID_PLAYER && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)) + if (target->IsPlayer() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)) target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE, GetAmount(), apply); // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy - if (target->GetTypeId() == TYPEID_PLAYER && (GetMiscValue() & SPELL_SCHOOL_MASK_SPELL) == SPELL_SCHOOL_MASK_SPELL) + if (target->IsPlayer() && (GetMiscValue() & SPELL_SCHOOL_MASK_SPELL) == SPELL_SCHOOL_MASK_SPELL) target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE, GetAmount(), apply); } @@ -4445,7 +4445,7 @@ void AuraEffect::HandleAuraModStat(AuraApplication const* aurApp, uint8 mode, bo { //target->ApplyStatMod(Stats(i), m_amount, apply); target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(GetAmount()), apply); - if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet()) + if (target->IsPlayer() || target->IsPet()) target->ApplyStatBuffMod(Stats(i), (float)GetAmount(), apply); } } @@ -4575,12 +4575,12 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8 { if (i == STAT_STRENGTH || i == STAT_STAMINA) { - if (apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())) + if (apply && (target->IsPlayer() || target->IsPet())) target->ApplyStatPercentBuffMod(Stats(i), value, apply); target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, value, apply); - if (!apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())) + if (!apply && (target->IsPlayer() || target->IsPet())) target->ApplyStatPercentBuffMod(Stats(i), value, apply); } } @@ -4591,12 +4591,12 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8 { if (GetMiscValue() == i || GetMiscValue() == -1) { - if (apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())) + if (apply && (target->IsPlayer() || target->IsPet())) target->ApplyStatPercentBuffMod(Stats(i), value, apply); target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, value, apply); - if (!apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())) + if (!apply && (target->IsPlayer() || target->IsPet())) target->ApplyStatPercentBuffMod(Stats(i), value, apply); } } @@ -4892,7 +4892,7 @@ void AuraEffect::HandleModHitChance(AuraApplication const* aurApp, uint8 mode, b Unit* target = aurApp->GetTarget(); - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) { target->ToPlayer()->UpdateMeleeHitChances(); target->ToPlayer()->UpdateRangedHitChances(); @@ -4911,7 +4911,7 @@ void AuraEffect::HandleModSpellHitChance(AuraApplication const* aurApp, uint8 mo Unit* target = aurApp->GetTarget(); - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->ToPlayer()->UpdateSpellHitChances(); else target->m_modSpellHitChance += (apply) ? GetAmount() : (-GetAmount()); @@ -4924,7 +4924,7 @@ void AuraEffect::HandleModSpellCritChance(AuraApplication const* aurApp, uint8 m Unit* target = aurApp->GetTarget(); - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->ToPlayer()->UpdateAllSpellCritChances(); else target->m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount(); @@ -5152,7 +5152,7 @@ void AuraEffect::HandleAuraModRangedAttackPowerOfStatPercent(AuraApplication con Unit* target = aurApp->GetTarget(); // Recalculate bonus - if (target->GetTypeId() == TYPEID_PLAYER && !(target->getClassMask() & CLASSMASK_WAND_USERS)) + if (target->IsPlayer() && !(target->getClassMask() & CLASSMASK_WAND_USERS)) target->ToPlayer()->UpdateAttackPowerAndDamage(true); } @@ -5169,7 +5169,7 @@ void AuraEffect::HandleAuraModAttackPowerOfArmor(AuraApplication const* aurApp, Unit* target = aurApp->GetTarget(); // Recalculate bonus - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->ToPlayer()->UpdateAttackPowerAndDamage(false); } /********************************/ @@ -5183,7 +5183,7 @@ void AuraEffect::HandleModDamageDone(AuraApplication const* aurApp, uint8 mode, Unit* target = aurApp->GetTarget(); // apply item specific bonuses for already equipped weapon - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) { for (int i = 0; i < MAX_ATTACK; ++i) if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true)) @@ -5208,7 +5208,7 @@ void AuraEffect::HandleModDamageDone(AuraApplication const* aurApp, uint8 mode, target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(GetAmount()), apply); target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(GetAmount()), apply); - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) { if (GetAmount() > 0) target->ApplyModInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, GetAmount(), apply); @@ -5237,7 +5237,7 @@ void AuraEffect::HandleModDamageDone(AuraApplication const* aurApp, uint8 mode, // Magic damage modifiers implemented in Unit::SpellDamageBonus // This information for client side use only - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) { if (GetAmount() > 0) { @@ -5272,7 +5272,7 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8 if (!sScriptMgr->CanModAuraEffectModDamagePercentDone(this, target, aurApp, mode, apply)) return; - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) { for (int i = 0; i < MAX_ATTACK; ++i) if (Item* item = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), false)) @@ -5285,7 +5285,7 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8 target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(GetAmount()), apply); target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_PCT, float(GetAmount()), apply); - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->ToPlayer()->ApplyPercentModFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, float (GetAmount()), apply); } else @@ -5315,7 +5315,7 @@ void AuraEffect::HandleShieldBlockValue(AuraApplication const* aurApp, uint8 mod if (GetAuraType() == SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT) modType = PCT_MOD; - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->ToPlayer()->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(GetAmount()), apply); } @@ -5513,7 +5513,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool target->GetMotionMaster()->MoveFall(); break; case 46699: // Requires No Ammo - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->ToPlayer()->RemoveAmmo(); // not use ammo and not allow use break; case 71563: @@ -5599,7 +5599,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool { case 2584: // Waiting to Resurrect // Waiting to resurrect spell cancel, we must remove player from resurrect queue - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) { if (Battleground* bg = target->ToPlayer()->GetBattleground()) bg->RemovePlayerFromResurrectQueue(target->ToPlayer()); @@ -5646,7 +5646,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool if (target->isDead() && GetBase() && target->GetTypeId() == TYPEID_UNIT && target->GetEntry() == 24601) { auto caster2 = GetBase()->GetCaster(); - if (caster2 && caster2->GetTypeId() == TYPEID_PLAYER) + if (caster2 && caster2->IsPlayer()) { caster2->ToPlayer()->KilledMonsterCredit(25987); } @@ -5744,7 +5744,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool } // LK Intro VO (1) case 58204: - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) { // Play part 1 if (apply) @@ -5756,7 +5756,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool break; // LK Intro VO (2) case 58205: - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) { // Play part 2 if (apply) @@ -5987,13 +5987,13 @@ void AuraEffect::HandleAuraModFaction(AuraApplication const* aurApp, uint8 mode, if (apply) { target->SetFaction(GetMiscValue()); - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->RemoveUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED); } else { target->RestoreFaction(); - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED); } } @@ -6366,7 +6366,7 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) case 30427: { // move loot to player inventory and despawn target - if (caster && caster->GetTypeId() == TYPEID_PLAYER && + if (caster && caster->IsPlayer() && target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_GAS_CLOUD) { @@ -7134,7 +7134,7 @@ void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) cons { Powers PowerType = Powers(GetMiscValue()); - if (target->GetTypeId() == TYPEID_PLAYER && !target->HasActivePowerType(PowerType) && !m_spellInfo->HasAttribute(SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED)) + if (target->IsPlayer() && !target->HasActivePowerType(PowerType) && !m_spellInfo->HasAttribute(SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED)) return; if (!target->IsAlive() || !target->GetMaxPower(PowerType)) diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index cbaa8b1ec..051c30310 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -486,7 +486,7 @@ AuraObjectType Aura::GetType() const return UNIT_AURA_TYPE; } - return (m_owner->GetTypeId() == TYPEID_DYNAMICOBJECT) ? DYNOBJ_AURA_TYPE : UNIT_AURA_TYPE; + return (m_owner->IsDynamicObject()) ? DYNOBJ_AURA_TYPE : UNIT_AURA_TYPE; } void Aura::_ApplyForTarget(Unit* target, Unit* caster, AuraApplication* auraApp) @@ -559,7 +559,7 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication* auraAp } } - if (caster && caster->GetTypeId() == TYPEID_PLAYER) + if (caster && caster->IsPlayer()) { if (GetSpellInfo()->IsCooldownStartedOnEvent() && !m_castItemGuid) { @@ -1350,7 +1350,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b switch (GetId()) { case 32474: // Buffeting Winds of Susurrus - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->ToPlayer()->ActivateTaxiPathTo(506, GetId()); break; case 33572: // Gronn Lord's Grasp, becomes stoned @@ -1362,7 +1362,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b target->CastSpell(target, 50812, true); break; case 60970: // Heroic Fury (remove Intercept cooldown) - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->ToPlayer()->RemoveSpellCooldown(20252, true); break; } @@ -1587,7 +1587,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b break; case SPELLFAMILY_POTION: // Alchemy: Mixology - if (caster && caster->HasAura(53042) && caster->GetTypeId() == TYPEID_PLAYER && !caster->ToPlayer()->GetSession()->PlayerLoading()) + if (caster && caster->HasAura(53042) && caster->IsPlayer() && !caster->ToPlayer()->GetSession()->PlayerLoading()) { if (sSpellMgr->GetSpellGroup(GetId()) == 1) /*Elixirs*/ { @@ -1726,7 +1726,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b if (Aura const* aura = caster->GetAuraOfRankedSpell(47535)) { // check cooldown - if (caster->GetTypeId() == TYPEID_PLAYER) + if (caster->IsPlayer()) { if (caster->ToPlayer()->HasSpellCooldown(aura->GetId())) { @@ -2266,7 +2266,7 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI // do that only for passive spells /// @todo: this needs to be unified for all kinds of auras Unit* target = aurApp->GetTarget(); - if (IsPassive() && target->GetTypeId() == TYPEID_PLAYER && GetSpellInfo()->EquippedItemClass != -1) + if (IsPassive() && target->IsPlayer() && GetSpellInfo()->EquippedItemClass != -1) { if (!GetSpellInfo()->HasAttribute(SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT)) { diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index ea4c3383e..774f77171 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -481,7 +481,7 @@ void SpellCastTargets::Update(Unit* caster) m_objectTarget = m_objectTargetGUID ? ((m_objectTargetGUID == caster->GetGUID()) ? caster : ObjectAccessor::GetWorldObject(*caster, m_objectTargetGUID)) : nullptr; m_itemTarget = nullptr; - if (caster->GetTypeId() == TYPEID_PLAYER) + if (caster->IsPlayer()) { Player* player = caster->ToPlayer(); if (m_targetMask & TARGET_FLAG_ITEM) @@ -609,7 +609,7 @@ Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, if (m_attackType == RANGED_ATTACK) // wand case - if ((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER) + if ((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->IsPlayer()) if (Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK)) m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetTemplate()->Damage[0].DamageType); @@ -2031,7 +2031,7 @@ void Spell::SelectEffectTypeImplicitTargets(uint8 effIndex) { case SPELL_EFFECT_SUMMON_RAF_FRIEND: case SPELL_EFFECT_SUMMON_PLAYER: - if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->GetTarget()) + if (m_caster->IsPlayer() && m_caster->ToPlayer()->GetTarget()) { WorldObject* target = ObjectAccessor::FindPlayer(m_caster->ToPlayer()->GetTarget()); @@ -2718,7 +2718,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) m_needComboPoints = false; // Restore spell mods for a miss/dodge/parry Cold Blood /// @todo: check how broad this rule should be - if (m_caster->GetTypeId() == TYPEID_PLAYER && (missInfo == SPELL_MISS_MISS || missInfo == SPELL_MISS_DODGE || missInfo == SPELL_MISS_PARRY)) + if (m_caster->IsPlayer() && (missInfo == SPELL_MISS_MISS || missInfo == SPELL_MISS_DODGE || missInfo == SPELL_MISS_PARRY)) m_caster->ToPlayer()->RestoreSpellMods(this, 14177); } @@ -2890,7 +2890,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) Unit::ProcDamageAndSpell(caster, unitTarget, procAttacker, procVictim, procEx, damageInfo.damage, m_attackType, m_spellInfo, m_triggeredByAuraSpell.spellInfo, m_triggeredByAuraSpell.effectIndex, this, &dmgInfo); - if (caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->HasAttribute(SPELL_ATTR0_CANCELS_AUTO_ATTACK_COMBAT) == 0 && + if (caster->IsPlayer() && m_spellInfo->HasAttribute(SPELL_ATTR0_CANCELS_AUTO_ATTACK_COMBAT) == 0 && m_spellInfo->HasAttribute(SPELL_ATTR4_SUPRESS_WEAPON_PROCS) == 0 && (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)) caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx); } @@ -2912,7 +2912,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) // Xinef: eg. rogue poisons can proc off cheap shot, etc. so this block should be here also // Xinef: ofc count only spells that HIT the target, little hack used to fool the system - if ((procEx & PROC_EX_NORMAL_HIT || procEx & PROC_EX_CRITICAL_HIT) && caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->HasAttribute(SPELL_ATTR0_CANCELS_AUTO_ATTACK_COMBAT) == 0 && + if ((procEx & PROC_EX_NORMAL_HIT || procEx & PROC_EX_CRITICAL_HIT) && caster->IsPlayer() && m_spellInfo->HasAttribute(SPELL_ATTR0_CANCELS_AUTO_ATTACK_COMBAT) == 0 && m_spellInfo->HasAttribute(SPELL_ATTR4_SUPRESS_WEAPON_PROCS) == 0 && (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)) caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim | PROC_FLAG_TAKEN_DAMAGE, procEx); } @@ -2985,7 +2985,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) // if target is fallged for pvp also flag caster if a player // xinef: do not flag spells with aura bind sight (no special attribute) if (effectUnit->IsPvP() && effectUnit != m_caster && effectUnit->GetOwnerGUID() != m_caster->GetGUID() && - m_caster->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NO_PVP_FLAG)) + m_caster->IsPlayer() && !m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NO_PVP_FLAG)) { m_caster->ToPlayer()->UpdatePvP(true); } @@ -3033,14 +3033,14 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA if (!effectMask) return returnVal; - if (unit->GetTypeId() == TYPEID_PLAYER) + if (unit->IsPlayer()) { unit->ToPlayer()->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, m_spellInfo->Id); unit->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, m_spellInfo->Id, 0, m_caster); unit->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, m_spellInfo->Id, 0, m_caster); } - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { m_caster->ToPlayer()->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_CASTER, m_spellInfo->Id); m_caster->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, m_spellInfo->Id, 0, unit); @@ -3067,14 +3067,14 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA { // for delayed spells ignore negative spells (after duel end) for friendly targets /// @todo: this cause soul transfer bugged - if(!IsTriggered() && m_spellInfo->Speed > 0.0f && unit->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->IsPositive()) + if(!IsTriggered() && m_spellInfo->Speed > 0.0f && unit->IsPlayer() && !m_spellInfo->IsPositive()) return SPELL_MISS_EVADE; // assisting case, healing and resurrection if (unit->HasUnitState(UNIT_STATE_ATTACK_PLAYER)) { m_caster->SetContestedPvP(); - if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NO_PVP_FLAG)) + if (m_caster->IsPlayer() && !m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NO_PVP_FLAG)) m_caster->ToPlayer()->UpdatePvP(true); } @@ -3549,7 +3549,7 @@ SpellCastResult Spell::prepare(SpellCastTargets const* targets, AuraEffect const // for example bladestorm aura should be removed on disarm as of patch 3.3.5 // channeled periodic spells should be affected by this (arcane missiles, penance, etc) // a possible alternative sollution for those would be validating aura target on unit state change - if (m_caster->GetTypeId() == TYPEID_PLAYER && triggeredByAura && triggeredByAura->IsPeriodic() && !triggeredByAura->GetBase()->IsPassive()) + if (m_caster->IsPlayer() && triggeredByAura && triggeredByAura->IsPeriodic() && !triggeredByAura->GetBase()->IsPassive()) { SendChannelUpdate(0); triggeredByAura->GetBase()->SetDuration(0); @@ -3571,13 +3571,13 @@ SpellCastResult Spell::prepare(SpellCastTargets const* targets, AuraEffect const // calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail) m_casttime = HasTriggeredCastFlag(TRIGGERED_CAST_DIRECTLY) ? 0 : m_spellInfo->CalcCastTime(m_caster, this); - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_CASTTIME)) m_casttime = 0; // don't allow channeled spells / spells with cast time to be casted while moving // (even if they are interrupted on moving, spells with almost immediate effect get to have their effect processed before movement interrupter kicks in) - if ((m_spellInfo->IsChanneled() || m_casttime) && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->isMoving() && m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT && !IsTriggered()) + if ((m_spellInfo->IsChanneled() || m_casttime) && m_caster->IsPlayer() && m_caster->isMoving() && m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT && !IsTriggered()) { // 1. Has casttime, 2. Or doesn't have flag to allow action during channel if (m_casttime || !m_spellInfo->IsActionAllowedChannel()) @@ -3722,7 +3722,7 @@ void Spell::cancel(bool bySelf) CancelGlobalCooldown(); SendCastResult(SPELL_FAILED_INTERRUPTED); - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { if (m_caster->ToPlayer()->NeedSendSpectatorData()) ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, bySelf ? 99998 : 99999); @@ -3747,7 +3747,7 @@ void Spell::cancel(bool bySelf) SendInterrupted(SPELL_FAILED_INTERRUPTED); } - if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->NeedSendSpectatorData()) + if (m_caster->IsPlayer() && m_caster->ToPlayer()->NeedSendSpectatorData()) ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, bySelf ? 99998 : 99999); // spell is canceled-take mods and clear list @@ -3816,7 +3816,7 @@ void Spell::_cast(bool skipCheck) // Xinef: implement attribute SPELL_ATTR1_DISMISS_PET_FIRST, on spell cast current pet is dismissed and charms are removed if (m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET_FIRST)) { - if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->HasEffect(SPELL_EFFECT_SUMMON_PET)) + if (m_caster->IsPlayer() && !m_spellInfo->HasEffect(SPELL_EFFECT_SUMMON_PET)) if (Pet* pet = m_caster->ToPlayer()->GetPet()) m_caster->ToPlayer()->RemovePet(pet, PET_SAVE_AS_CURRENT); @@ -3869,7 +3869,7 @@ void Spell::_cast(bool skipCheck) // if trade not complete then remember it in trade data if (m_targets.GetTargetMask() & TARGET_FLAG_TRADE_ITEM) { - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { if (TradeData* my_trade = m_caster->ToPlayer()->GetTradeData()) { @@ -3921,7 +3921,7 @@ void Spell::_cast(bool skipCheck) // set to real guid to be sent later to the client m_targets.UpdateTradeSlotItem(); - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_CAST_ITEM) && m_CastItem) { @@ -4092,11 +4092,11 @@ void Spell::_cast(bool skipCheck) // xinef: start combat at cast for delayed spells, only for explicit target if (Unit* target = m_targets.GetUnitTarget()) - if (m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->IsPet() && m_caster->IsControlledByPlayer())) + if (m_caster->IsPlayer() || (m_caster->IsPet() && m_caster->IsControlledByPlayer())) if (GetDelayMoment() > 0 && !m_caster->IsFriendlyTo(target) && !m_spellInfo->HasAura(SPELL_AURA_BIND_SIGHT) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL))) m_caster->CombatStartOnCast(target, !m_spellInfo->HasAttribute(SPELL_ATTR3_SUPRESS_TARGET_PROCS), GetDelayMoment() + 500); // xinef: increase this time so we dont leave and enter combat in a moment - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_COOLDOWN)) m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true); @@ -4300,7 +4300,7 @@ void Spell::_handle_finish_phase() { // Xinef: Properly clear infinite cooldowns in some cases if (ihit->targetGUID == m_caster->GetGUID() && ihit->missCondition != SPELL_MISS_NONE) - if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->IsCooldownStartedOnEvent()) + if (m_caster->IsPlayer() && m_spellInfo->IsCooldownStartedOnEvent()) m_caster->ToPlayer()->SendCooldownEvent(m_spellInfo); } @@ -4408,7 +4408,7 @@ void Spell::update(uint32 difftime) // check if the player caster has moved before the spell finished // xinef: added preparing state (real cast, skip channels as they have other flags for this) - if ((m_caster->GetTypeId() == TYPEID_PLAYER && m_timer != 0) && + if ((m_caster->IsPlayer() && m_timer != 0) && m_caster->isMoving() && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT) && m_spellState == SPELL_STATE_PREPARING && (m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK || !m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR))) { @@ -4486,7 +4486,7 @@ void Spell::finish(bool ok) m_caster->ClearUnitState(UNIT_STATE_CASTING); // Unsummon summon as possessed creatures on spell cancel - if (m_spellInfo->IsChanneled() && m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_spellInfo->IsChanneled() && m_caster->IsPlayer()) { if (Unit* charm = m_caster->GetCharm()) if (charm->GetTypeId() == TYPEID_UNIT @@ -4500,7 +4500,7 @@ void Spell::finish(bool ok) if (!ok) { - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { // Xinef: Restore spell mods in case of fail cast m_caster->ToPlayer()->RestoreSpellMods(this); @@ -4530,7 +4530,7 @@ void Spell::finish(bool ok) } // potions disabled by client, send event "not in combat" if need - if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_triggeredByAuraSpell) + if (m_caster->IsPlayer() && !m_triggeredByAuraSpell) m_caster->ToPlayer()->UpdatePotionCooldown(this); // Take mods after trigger spell (needed for 14177 to affect 48664) @@ -4715,7 +4715,7 @@ void Spell::SendSpellStart() if (m_spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA)) castFlags |= CAST_FLAG_PROJECTILE; - if (m_caster->GetTypeId() == TYPEID_PLAYER || m_caster->IsPet()) + if (m_caster->IsPlayer() || m_caster->IsPet()) { switch (m_spellInfo->PowerType) { @@ -4776,7 +4776,7 @@ void Spell::SendSpellStart() m_caster->SendMessageToSet(&data, true); - if (!m_spellInfo->IsChanneled() && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->NeedSendSpectatorData()) + if (!m_spellInfo->IsChanneled() && m_caster->IsPlayer() && m_caster->ToPlayer()->NeedSendSpectatorData()) ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, m_timer); } @@ -4798,7 +4798,7 @@ void Spell::SendSpellGo() castFlags |= CAST_FLAG_PROJECTILE; // arrows/bullets visual // should only be sent to self, but the current messaging doesn't make that possible - if (m_caster->GetTypeId() == TYPEID_PLAYER || m_caster->IsPet()) + if (m_caster->IsPlayer() || m_caster->IsPet()) { switch (m_spellInfo->PowerType) { @@ -4816,7 +4816,7 @@ void Spell::SendSpellGo() } } - if ((m_caster->GetTypeId() == TYPEID_PLAYER) + if ((m_caster->IsPlayer()) && (m_caster->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY)) && m_spellInfo->RuneCostID && m_spellInfo->PowerType == POWER_RUNE) @@ -4916,7 +4916,7 @@ void Spell::WriteAmmoToPacket(WorldPacket* data) uint32 ammoInventoryType = 0; uint32 ammoDisplayID = 0; - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); if (pItem) @@ -5203,7 +5203,7 @@ void Spell::SendChannelStart(uint32 duration) m_caster->SendMessageToSet(&data, true); - if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->NeedSendSpectatorData()) + if (m_caster->IsPlayer() && m_caster->ToPlayer()->NeedSendSpectatorData()) ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, -((int32)duration)); m_timer = duration; @@ -5217,7 +5217,7 @@ void Spell::SendResurrectRequest(Player* target) { // get resurrector name for creature resurrections, otherwise packet will be not accepted // for player resurrections the name is looked up by guid - std::string const sentName(m_caster->GetTypeId() == TYPEID_PLAYER + std::string const sentName(m_caster->IsPlayer() ? "" : m_caster->GetNameForLocaleIdx(target->GetSession()->GetSessionDbLocaleIndex())); @@ -5228,7 +5228,7 @@ void Spell::SendResurrectRequest(Player* target) data << sentName; data << uint8(0); // null terminator - data << uint8(m_caster->GetTypeId() == TYPEID_PLAYER ? 0 : 1); // "you'll be afflicted with resurrection sickness" + data << uint8(m_caster->IsPlayer() ? 0 : 1); // "you'll be afflicted with resurrection sickness" // override delay sent with SMSG_CORPSE_RECLAIM_DELAY, set instant resurrection for spells with this attribute if (m_spellInfo->HasAttribute(SPELL_ATTR3_NO_RES_TIMER)) data << uint32(0); @@ -5304,13 +5304,13 @@ void Spell::TakePower() return; //Don't take power if the spell is cast while .cheat power is enabled. - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_POWER)) return; Powers PowerType = Powers(m_spellInfo->PowerType); bool hit = true; - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { if (PowerType == POWER_RAGE || PowerType == POWER_ENERGY || PowerType == POWER_RUNE || PowerType == POWER_RUNIC_POWER) if (ObjectGuid targetGUID = m_targets.GetUnitTargetGUID()) @@ -5364,7 +5364,7 @@ void Spell::TakePower() void Spell::TakeAmmo() { - if (m_attackType == RANGED_ATTACK && m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_attackType == RANGED_ATTACK && m_caster->IsPlayer()) { Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); @@ -5643,7 +5643,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_CASTER_DEAD; // Spectator check - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) if (((Player const*)m_caster)->IsSpectator() && m_spellInfo->Id != SPECTATOR_SPELL_BINDSIGHT) return SPELL_FAILED_NOT_HERE; @@ -5657,7 +5657,7 @@ SpellCastResult Spell::CheckCast(bool strict) // check cooldowns to prevent cheating if (!m_spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE)) { - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { //can cast triggered (by aura only?) spells while have this flag if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_CASTER_AURASTATE) && m_caster->ToPlayer()->HasPlayerFlag(PLAYER_ALLOW_ONLY_ABILITY) && !IsNextMeleeSwingSpell()) @@ -5690,12 +5690,12 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_NOT_READY; // only triggered spells can be processed an ended battleground - if (!IsTriggered() && m_caster->GetTypeId() == TYPEID_PLAYER) + if (!IsTriggered() && m_caster->IsPlayer()) if (Battleground* bg = m_caster->ToPlayer()->GetBattleground()) if (bg->GetStatus() == STATUS_WAIT_LEAVE) return SPELL_FAILED_DONT_REPORT; - if (m_caster->GetTypeId() == TYPEID_PLAYER /*&& VMAP::VMapFactory::createOrGetVMapMgr()->isLineOfSightCalcEnabled()*/) // pussywizard: optimization (commented) + if (m_caster->IsPlayer() /*&& VMAP::VMapFactory::createOrGetVMapMgr()->isLineOfSightCalcEnabled()*/) // pussywizard: optimization (commented) { if (m_spellInfo->HasAttribute(SPELL_ATTR0_ONLY_OUTDOORS) && !m_caster->IsOutdoors()) @@ -5774,7 +5774,7 @@ SpellCastResult Spell::CheckCast(bool strict) // Xinef: exploit protection if (reqCombat && !m_spellInfo->CanBeUsedInCombat() && (m_spellInfo->HasEffect(SPELL_EFFECT_RESURRECT) || m_spellInfo->HasEffect(SPELL_EFFECT_RESURRECT_NEW))) { - if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->GetMap()->IsDungeon()) + if (m_caster->IsPlayer() && m_caster->GetMap()->IsDungeon()) if (InstanceScript* instanceScript = m_caster->GetInstanceScript()) if (instanceScript->IsEncounterInProgress()) { @@ -5795,7 +5795,7 @@ SpellCastResult Spell::CheckCast(bool strict) // cancel autorepeat spells if cast start when moving // (not wand currently autorepeat cast delayed to moving stop anyway in spell update code) - if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving() && !IsTriggered()) + if (m_caster->IsPlayer() && m_caster->ToPlayer()->isMoving() && !IsTriggered()) { // skip stuck spell to allow use it in falling case and apply spell limitations at movement if ((!m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR) || m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK) && @@ -5828,7 +5828,7 @@ SpellCastResult Spell::CheckCast(bool strict) // All creatures should be able to cast as passengers freely, restriction and attribute are only for players VehicleSeatEntry const* vehicleSeat = vehicle->GetSeatForPassenger(m_caster); if (!m_spellInfo->HasAttribute(SPELL_ATTR6_ALLOW_WHILE_RIDING_VEHICLE) && !m_spellInfo->HasAttribute(SPELL_ATTR0_ALLOW_WHILE_MOUNTED) - && (vehicleSeat->m_flags & checkMask) != checkMask && m_caster->GetTypeId() == TYPEID_PLAYER) + && (vehicleSeat->m_flags & checkMask) != checkMask && m_caster->IsPlayer()) return SPELL_FAILED_DONT_REPORT; } @@ -5968,7 +5968,7 @@ SpellCastResult Spell::CheckCast(bool strict) } } // Spell casted only on battleground - if (m_spellInfo->HasAttribute(SPELL_ATTR3_ONLY_BATTLEGROUNDS) && m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_spellInfo->HasAttribute(SPELL_ATTR3_ONLY_BATTLEGROUNDS) && m_caster->IsPlayer()) if (!m_caster->ToPlayer()->InBattleground()) return SPELL_FAILED_ONLY_BATTLEGROUNDS; @@ -5988,13 +5988,13 @@ SpellCastResult Spell::CheckCast(bool strict) m_caster->GetZoneAndAreaId(zone, area); SpellCastResult locRes = m_spellInfo->CheckLocation(m_caster->GetMapId(), zone, area, - m_caster->GetTypeId() == TYPEID_PLAYER ? m_caster->ToPlayer() : nullptr); + m_caster->IsPlayer() ? m_caster->ToPlayer() : nullptr); if (locRes != SPELL_CAST_OK) return locRes; } // not let players cast spells at mount (and let do it to creatures) - if (m_caster->IsMounted() && m_caster->GetTypeId() == TYPEID_PLAYER && !HasTriggeredCastFlag(TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE) && + if (m_caster->IsMounted() && m_caster->IsPlayer() && !HasTriggeredCastFlag(TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE) && !m_spellInfo->IsPassive() && !m_spellInfo->HasAttribute(SPELL_ATTR0_ALLOW_WHILE_MOUNTED)) { if (m_caster->IsInFlight()) @@ -6189,7 +6189,7 @@ SpellCastResult Spell::CheckCast(bool strict) case SPELL_EFFECT_POWER_DRAIN: { // Can be area effect, Check only for players and not check if target - caster (spell can have multiply drain/burn effects) - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) if (Unit* target = m_targets.GetUnitTarget()) if (target != m_caster && !target->HasActivePowerType(Powers(m_spellInfo->Effects[i].MiscValue))) return SPELL_FAILED_BAD_TARGETS; @@ -6216,7 +6216,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_ROOTED; } } - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) if (Unit* target = m_targets.GetUnitTarget()) if (!target->IsAlive()) return SPELL_FAILED_BAD_TARGETS; @@ -6426,7 +6426,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_ALREADY_HAVE_CHARM; } - if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->IsClass(CLASS_WARLOCK, CLASS_CONTEXT_PET) && strict) + if (m_caster->IsPlayer() && m_caster->IsClass(CLASS_WARLOCK, CLASS_CONTEXT_PET) && strict) if (Pet* pet = m_caster->ToPlayer()->GetPet()) pet->CastSpell(pet, 32752, true, nullptr, nullptr, pet->GetGUID()); //starting cast, trigger pet stun (cast by pet so it doesn't attack player) @@ -6526,7 +6526,7 @@ SpellCastResult Spell::CheckCast(bool strict) case SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER: { //Do not allow to cast it before BG starts. - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground()) if (bg->GetStatus() != STATUS_IN_PROGRESS) return SPELL_FAILED_TRY_AGAIN; @@ -6560,7 +6560,7 @@ SpellCastResult Spell::CheckCast(bool strict) { if (m_caster->HasUnitState(UNIT_STATE_ROOT)) { - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) return SPELL_FAILED_ROOTED; else return SPELL_FAILED_DONT_REPORT; @@ -6579,7 +6579,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!sScriptMgr->CanSelectSpecTalent(this)) return SPELL_FAILED_DONT_REPORT; // can't change during already started arena/battleground - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground()) if (bg->GetStatus() == STATUS_IN_PROGRESS) return SPELL_FAILED_NOT_IN_BATTLEGROUND; @@ -6665,7 +6665,7 @@ SpellCastResult Spell::CheckCast(bool strict) InstanceTemplate const* it = sObjectMgr->GetInstanceTemplate(m_caster->GetMapId()); if (it) allowMount = it->AllowMount; - if (m_caster->GetTypeId() == TYPEID_PLAYER && !allowMount && !m_spellInfo->AreaGroupId) + if (m_caster->IsPlayer() && !allowMount && !m_spellInfo->AreaGroupId) return SPELL_FAILED_NO_MOUNTS_ALLOWED; if (m_caster->IsInDisallowedMountForm()) @@ -6700,7 +6700,7 @@ SpellCastResult Spell::CheckCast(bool strict) // not allow cast fly spells if not have req. skills (all spells is self target) // allow always ghost flight spells - if (m_originalCaster && m_originalCaster->GetTypeId() == TYPEID_PLAYER && m_originalCaster->IsAlive()) + if (m_originalCaster && m_originalCaster->IsPlayer() && m_originalCaster->IsAlive()) { Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(m_originalCaster->GetZoneId()); if (AreaTableEntry const* pArea = sAreaTableStore.LookupEntry(m_originalCaster->GetAreaId())) @@ -7088,7 +7088,7 @@ SpellCastResult Spell::CheckRange(bool strict) return SPELL_FAILED_TOO_CLOSE; } - if (m_caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc(static_cast(M_PI), target)) + if (m_caster->IsPlayer() && (m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc(static_cast(M_PI), target)) return SPELL_FAILED_UNIT_NOT_INFRONT; } @@ -7123,7 +7123,7 @@ SpellCastResult Spell::CheckPower() return SPELL_CAST_OK; //While .cheat power is enabled dont check if we need power to cast the spell - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_POWER)) { @@ -7264,7 +7264,7 @@ SpellCastResult Spell::CheckItems() { // Xinef: this is not true in my opinion, in eg bladestorm will not be canceled after disarm //if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_EQUIPPED_ITEM_REQUIREMENT)) - if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_caster->ToPlayer()->HasItemFitToSpellRequirements(m_spellInfo)) + if (m_caster->IsPlayer() && !m_caster->ToPlayer()->HasItemFitToSpellRequirements(m_spellInfo)) return SPELL_FAILED_EQUIPPED_ITEM_CLASS; } @@ -7358,7 +7358,7 @@ SpellCastResult Spell::CheckItems() { // m_targets.GetUnitTarget() means explicit cast, otherwise we dont check for possible equip error Unit* target = m_targets.GetUnitTarget() ? m_targets.GetUnitTarget() : player; - if (target->GetTypeId() == TYPEID_PLAYER && !IsTriggered()) + if (target->IsPlayer() && !IsTriggered()) { // SPELL_EFFECT_CREATE_ITEM_2 differs from SPELL_EFFECT_CREATE_ITEM in that it picks the random item to create from a pool of potential items, // so we need to make sure there is at least one free space in the player's inventory @@ -7855,7 +7855,7 @@ bool Spell::UpdatePointers() m_originalCaster = nullptr; } - if (m_castItemGUID && m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_castItemGUID && m_caster->IsPlayer()) { m_CastItem = m_caster->ToPlayer()->GetItemByGuid(m_castItemGUID); // cast item not found, somehow the item is no longer where we expected @@ -8118,7 +8118,7 @@ SpellEvent::~SpellEvent() else { LOG_ERROR("spells", "~SpellEvent: {} {} tried to delete non-deletable spell {}. Was not deleted, causes memory leak.", - (m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUID().ToString(), m_Spell->m_spellInfo->Id); + (m_Spell->GetCaster()->IsPlayer() ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUID().ToString(), m_Spell->m_spellInfo->Id); ABORT(); } } @@ -8308,7 +8308,7 @@ void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier) if (m_spellInfo->Effects[i].IsAreaAuraEffect() || m_spellInfo->Effects[i].IsTargetingArea() || (m_spellInfo->Effects[i].ChainTarget > 1 && m_spellInfo->DmgClass != SPELL_DAMAGE_CLASS_MAGIC)) { m_damage = unit->CalculateAOEDamageReduction(m_damage, m_spellInfo->SchoolMask, m_caster); - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { uint32 targetAmount = m_UniqueTargetInfo.size(); if (targetAmount > 10) @@ -8817,7 +8817,7 @@ bool Spell::HasGlobalCooldown() const // Only player or controlled units have global cooldown if (m_caster->GetCharmInfo()) return m_caster->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(m_spellInfo); - else if (m_caster->GetTypeId() == TYPEID_PLAYER) + else if (m_caster->IsPlayer()) return m_caster->ToPlayer()->GetGlobalCooldownMgr().HasGlobalCooldown(m_spellInfo); else return false; @@ -8835,7 +8835,7 @@ void Spell::TriggerGlobalCooldown() return; } - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_COOLDOWN)) return; @@ -8845,7 +8845,7 @@ void Spell::TriggerGlobalCooldown() if (m_spellInfo->StartRecoveryTime >= MIN_GCD && m_spellInfo->StartRecoveryTime <= MAX_GCD) { // gcd modifier auras are applied only to own spells and only players have such mods - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) m_caster->ToPlayer()->ApplySpellMod(m_spellInfo->Id, SPELLMOD_GLOBAL_COOLDOWN, gcd, this); // Apply haste rating @@ -8864,7 +8864,7 @@ void Spell::TriggerGlobalCooldown() // Only players or controlled units have global cooldown if (m_caster->GetCharmInfo()) m_caster->GetCharmInfo()->GetGlobalCooldownMgr().AddGlobalCooldown(m_spellInfo, gcd); - else if (m_caster->GetTypeId() == TYPEID_PLAYER) + else if (m_caster->IsPlayer()) m_caster->ToPlayer()->GetGlobalCooldownMgr().AddGlobalCooldown(m_spellInfo, gcd); } @@ -8880,7 +8880,7 @@ void Spell::CancelGlobalCooldown() // Only players or controlled units have global cooldown if (m_caster->GetCharmInfo()) m_caster->GetCharmInfo()->GetGlobalCooldownMgr().CancelGlobalCooldown(m_spellInfo); - else if (m_caster->GetTypeId() == TYPEID_PLAYER) + else if (m_caster->IsPlayer()) m_caster->ToPlayer()->GetGlobalCooldownMgr().CancelGlobalCooldown(m_spellInfo); } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 9e1d22a08..2a3d7b008 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -283,7 +283,7 @@ void Spell::EffectInstaKill(SpellEffIndex /*effIndex*/) if (!unitTarget || !unitTarget->IsAlive() || unitTarget->HasAura(27827)) // Spirit of redemption doesn't make you death, but can cause infinite loops return; - if (unitTarget->GetTypeId() == TYPEID_PLAYER) + if (unitTarget->IsPlayer()) if (unitTarget->ToPlayer()->GetCommandStatus(CHEAT_GOD)) return; @@ -473,7 +473,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) case SPELLFAMILY_DRUID: { // Ferocious Bite - if (m_caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags[0] & 0x000800000) && m_spellInfo->SpellVisual[0] == 6587) + if (m_caster->IsPlayer() && (m_spellInfo->SpellFamilyFlags[0] & 0x000800000) && m_spellInfo->SpellVisual[0] == 6587) { // converts each extra point of energy into ($f1+$AP/410) additional damage float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); @@ -545,7 +545,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) // Eviscerate else if (m_spellInfo->SpellFamilyFlags[0] & 0x00020000) { - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { if (uint32 combo = m_caster->ToPlayer()->GetComboPoints()) { @@ -712,7 +712,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) // HoL, Arc Weld case 59086: { - if( m_caster && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving() ) + if( m_caster && m_caster->IsPlayer() && m_caster->ToPlayer()->isMoving() ) m_caster->CastSpell(m_caster, 59097, true); return; @@ -934,7 +934,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) } // Remove spell cooldown (not category) if spell triggering spell with cooldown and same category - if (m_caster->GetTypeId() == TYPEID_PLAYER && spellInfo->CategoryRecoveryTime && m_spellInfo->GetCategory() == spellInfo->GetCategory()) + if (m_caster->IsPlayer() && spellInfo->CategoryRecoveryTime && m_spellInfo->GetCategory() == spellInfo->GetCategory()) { m_caster->ToPlayer()->RemoveSpellCooldown(spellInfo->Id); } @@ -988,7 +988,7 @@ void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex) } // Remove spell cooldown (not category) if spell triggering spell with cooldown and same category - if (m_caster->GetTypeId() == TYPEID_PLAYER && spellInfo->CategoryRecoveryTime && m_spellInfo->GetCategory() == spellInfo->GetCategory()) + if (m_caster->IsPlayer() && spellInfo->CategoryRecoveryTime && m_spellInfo->GetCategory() == spellInfo->GetCategory()) { m_caster->ToPlayer()->RemoveSpellCooldown(spellInfo->Id); } @@ -1085,7 +1085,7 @@ void Spell::EffectJump(SpellEffIndex effIndex) CalculateJumpSpeeds(effIndex, m_caster->GetExactDist2d(unitTarget), speedXY, speedZ); m_caster->GetMotionMaster()->MoveJump(*unitTarget, speedXY, speedZ); - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer()); } @@ -1124,7 +1124,7 @@ void Spell::EffectJumpDest(SpellEffIndex effIndex) player->SetCanTeleport(true); } - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer()); } @@ -1148,7 +1148,7 @@ void Spell::EffectJumpDest(SpellEffIndex effIndex) } m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ); - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer()); } @@ -1173,7 +1173,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/) if (!unitTarget || unitTarget->IsInFlight()) return; - if (unitTarget->GetTypeId() == TYPEID_PLAYER) + if (unitTarget->IsPlayer()) { sScriptMgr->AnticheatSetUnderACKmount(unitTarget->ToPlayer()); } @@ -1215,13 +1215,13 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/) unitTarget->GetVehicleKit()->TeleportVehicle(x, y, z, orientation); else { - bool withPet = unitTarget->GetTypeId() == TYPEID_PLAYER && m_spellInfo->SpellFamilyName == SPELLFAMILY_GENERIC && unitTarget->GetMap()->IsDungeon() && unitTarget->GetExactDist(x, y, z) > 50.0f; + bool withPet = unitTarget->IsPlayer() && m_spellInfo->SpellFamilyName == SPELLFAMILY_GENERIC && unitTarget->GetMap()->IsDungeon() && unitTarget->GetExactDist(x, y, z) > 50.0f; unitTarget->NearTeleportTo(x, y, z, orientation, unitTarget == m_caster, false, withPet, true); - if (unitTarget->GetTypeId() == TYPEID_PLAYER) // pussywizard: for units it's done inside NearTeleportTo + if (unitTarget->IsPlayer()) // pussywizard: for units it's done inside NearTeleportTo unitTarget->UpdateObjectVisibility(true); } } - else if (unitTarget->GetTypeId() == TYPEID_PLAYER) + else if (unitTarget->IsPlayer()) unitTarget->ToPlayer()->TeleportTo(mapid, x, y, z, orientation, unitTarget == m_caster ? TELE_TO_SPELL : 0); else { @@ -1878,7 +1878,7 @@ void Spell::EffectEnergize(SpellEffIndex effIndex) Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue); - if (unitTarget->GetTypeId() == TYPEID_PLAYER && !unitTarget->HasActivePowerType(power) && m_spellInfo->SpellFamilyName != SPELLFAMILY_POTION + if (unitTarget->IsPlayer() && !unitTarget->HasActivePowerType(power) && m_spellInfo->SpellFamilyName != SPELLFAMILY_POTION && !m_spellInfo->HasAttribute(SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED)) return; @@ -1983,7 +1983,7 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex) Powers power = Powers(m_spellInfo->Effects[effIndex].MiscValue); - if (unitTarget->GetTypeId() == TYPEID_PLAYER && !unitTarget->HasActivePowerType(power) && !m_spellInfo->HasAttribute(SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED)) + if (unitTarget->IsPlayer() && !unitTarget->HasActivePowerType(power) && !m_spellInfo->HasAttribute(SPELL_ATTR7_ONLY_IN_SPELLBOOK_UNTIL_LEARNED)) return; uint32 maxPower = unitTarget->GetMaxPower(power); @@ -2725,7 +2725,7 @@ void Spell::EffectUntrainTalents(SpellEffIndex /*effIndex*/) if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; - if (!unitTarget || m_caster->GetTypeId() == TYPEID_PLAYER) + if (!unitTarget || m_caster->IsPlayer()) return; if (ObjectGuid guid = m_caster->GetGUID()) // the trainer is the caster @@ -3108,7 +3108,7 @@ void Spell::EffectTameCreature(SpellEffIndex /*effIndex*/) pet->InitTalentForLevel(); - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { pet->SavePetToDB(PET_SAVE_AS_CURRENT); m_caster->ToPlayer()->PetSpellInitialize(); @@ -3187,7 +3187,7 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex) return; } - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) owner->ToPlayer()->RemovePet(OldSummon, PET_SAVE_NOT_IN_SLOT, false); else return; @@ -3367,7 +3367,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) AddComboPointGain(unitTarget, 1); } // 50% more damage with daggers - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) if (Item* item = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType, true)) if (item->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER) AddPct(totalDamagePercentMod, 50.0f); @@ -4018,7 +4018,7 @@ void Spell::EffectSanctuary(SpellEffIndex /*effIndex*/) if (m_spellInfo->Id != 59646) unitTarget->getHostileRefMgr().addThreatPercent(-100); - if (unitTarget->GetTypeId() == TYPEID_PLAYER) + if (unitTarget->IsPlayer()) unitTarget->ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel } else @@ -4669,7 +4669,7 @@ void Spell::EffectParry(SpellEffIndex /*effIndex*/) if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) m_caster->ToPlayer()->SetCanParry(true); } @@ -4678,7 +4678,7 @@ void Spell::EffectBlock(SpellEffIndex /*effIndex*/) if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) m_caster->ToPlayer()->SetCanBlock(true); } @@ -4949,7 +4949,7 @@ void Spell::EffectChargeDest(SpellEffIndex /*effIndex*/) m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ); - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer()); } @@ -5007,7 +5007,7 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex) unitTarget->KnockbackFrom(x, y, speedxy, speedz); - if (unitTarget->GetTypeId() == TYPEID_PLAYER) + if (unitTarget->IsPlayer()) { sScriptMgr->AnticheatSetUnderACKmount(unitTarget->ToPlayer()); } @@ -5026,13 +5026,13 @@ void Spell::EffectLeapBack(SpellEffIndex effIndex) //1891: Disengage m_caster->JumpTo(speedxy, speedz, m_spellInfo->SpellFamilyName != SPELLFAMILY_HUNTER); - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer()); } // xinef: changes fall time - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) m_caster->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), m_caster->GetPositionZ()); } @@ -5125,7 +5125,7 @@ void Spell::EffectPullTowards(SpellEffIndex effIndex) unitTarget->GetMotionMaster()->MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), speedXY, speedZ); - if (unitTarget->GetTypeId() == TYPEID_PLAYER) + if (unitTarget->IsPlayer()) { sScriptMgr->AnticheatSetUnderACKmount(unitTarget->ToPlayer()); } @@ -5421,7 +5421,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) } case GAMEOBJECT_TYPE_SUMMONING_RITUAL: { - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { pGameObj->AddUniqueUse(m_caster->ToPlayer()); m_caster->AddGameObject(pGameObj); // will be removed at spell cancel @@ -5836,7 +5836,7 @@ void Spell::EffectCreateTamedPet(SpellEffIndex effIndex) pet->InitTalentForLevel(); - if (unitTarget->GetTypeId() == TYPEID_PLAYER) + if (unitTarget->IsPlayer()) { pet->SavePetToDB(PET_SAVE_AS_CURRENT); unitTarget->ToPlayer()->PetSpellInitialize(); @@ -5867,7 +5867,7 @@ void Spell::EffectTitanGrip(SpellEffIndex /*effIndex*/) if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->IsPlayer()) { if (Aura* aur = m_caster->GetAura(49152)) aur->RecalculateAmountOfEffects(); @@ -5942,7 +5942,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* uint8 summonLevel = caster->GetLevel(); // level of pet summoned using engineering item based at engineering skill level - if (m_CastItem && caster->GetTypeId() == TYPEID_PLAYER) + if (m_CastItem && caster->IsPlayer()) if (ItemTemplate const* proto = m_CastItem->GetTemplate()) { // xinef: few special cases diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 444817c23..9069edb00 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1784,7 +1784,7 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta if (caster != unitTarget) { - if (caster->GetTypeId() == TYPEID_PLAYER) + if (caster->IsPlayer()) { // Do not allow these spells to target creatures not tapped by us (Banish, Polymorph, many quest spells) if (AttributesEx2 & SPELL_ATTR2_CANNOT_CAST_ON_TAPPED) @@ -1880,14 +1880,14 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta if (!CheckTargetCreatureType(unitTarget)) { - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) return SPELL_FAILED_TARGET_IS_PLAYER; else return SPELL_FAILED_BAD_TARGETS; } // check GM mode and GM invisibility - only for player casts (npc casts are controlled by AI) and negative spells - if (unitTarget != caster && (caster->IsControlledByPlayer() || !IsPositive()) && unitTarget->GetTypeId() == TYPEID_PLAYER) + if (unitTarget != caster && (caster->IsControlledByPlayer() || !IsPositive()) && unitTarget->IsPlayer()) { if (!unitTarget->ToPlayer()->IsVisible()) return SPELL_FAILED_BM_OR_INVISGOD; @@ -1974,7 +1974,7 @@ bool SpellInfo::CheckTargetCreatureType(Unit const* target) const if (SpellFamilyName == SPELLFAMILY_WARLOCK && GetCategory() == 1179) { // not allow cast at player - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) return false; else return true; diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 286282bd3..3053564e6 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -1134,7 +1134,7 @@ public: return true; // check index - if (unit->GetTypeId() == TYPEID_PLAYER) + if (unit->IsPlayer()) { if (index >= PLAYER_END) return true; diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 57ac36b43..3dbcf6908 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -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 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 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())) { diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 91a8706ff..df975ac6e 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -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; } diff --git a/src/server/scripts/Commands/cs_pet.cpp b/src/server/scripts/Commands/cs_pet.cpp index afd83c1a6..22b74bfa3 100644 --- a/src/server/scripts/Commands/cs_pet.cpp +++ b/src/server/scripts/Commands/cs_pet.cpp @@ -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; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp index a0d42df32..a356db01a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp @@ -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()); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp index 59dfb2990..e4e5bab49 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp @@ -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); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp index cd9de7f46..93e90ca33 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp @@ -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); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 517df06cc..f95f8e99a 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -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); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index a3a8aa10e..e9313e0f7 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -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; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index 361fe22ef..12d1df540 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -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())); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp index 4530fcb95..3b5092fab 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp @@ -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); } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index 71d8671ed..d81b298cd 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -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; diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index 2fa74afae..305091957 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -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); diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp index 07ae7403f..225933956 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp @@ -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); } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp index abcf65c0e..6dbf562d7 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp @@ -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); } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index 8e936fddc..eb9e7777b 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -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()) { diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp index b9593257a..1fdb6a115 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp @@ -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); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp index b093ac8a0..88375cdde 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp @@ -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); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 8abab9d79..d832b3088 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -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); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index 5b5a9a52f..ea6b27523 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -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); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 83444a7a2..163b60d6d 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -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); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index 84fcd4a2a..ffdb70f6f 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -135,7 +135,7 @@ public: void KilledUnit(Unit* who) override { - if (who->GetTypeId() == TYPEID_PLAYER) + if (who->IsPlayer()) Talk(SAY_KILL); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index da0969143..1f9e44d78 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -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); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp index 6a14947e6..60ae3fa1c 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp @@ -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); } diff --git a/src/server/scripts/EasternKingdoms/zone_duskwood.cpp b/src/server/scripts/EasternKingdoms/zone_duskwood.cpp index 2accdfa58..a0a49c5dd 100644 --- a/src/server/scripts/EasternKingdoms/zone_duskwood.cpp +++ b/src/server/scripts/EasternKingdoms/zone_duskwood.cpp @@ -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); diff --git a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp index 8322ac80c..6bff7a27d 100644 --- a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp +++ b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp @@ -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(); diff --git a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp index 1b4f06fe1..976162d5f 100644 --- a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp +++ b/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp @@ -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(); } diff --git a/src/server/scripts/Events/brewfest.cpp b/src/server/scripts/Events/brewfest.cpp index 9dcb005c5..b04f32701 100644 --- a/src/server/scripts/Events/brewfest.cpp +++ b/src/server/scripts/Events/brewfest.cpp @@ -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; diff --git a/src/server/scripts/Events/love_in_air.cpp b/src/server/scripts/Events/love_in_air.cpp index a5fc27c93..9fbeed766 100644 --- a/src/server/scripts/Events/love_in_air.cpp +++ b/src/server/scripts/Events/love_in_air.cpp @@ -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(); } diff --git a/src/server/scripts/Events/midsummer.cpp b/src/server/scripts/Events/midsummer.cpp index b395f1c4b..3e4eacfc1 100644 --- a/src/server/scripts/Events/midsummer.cpp +++ b/src/server/scripts/Events/midsummer.cpp @@ -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); } } diff --git a/src/server/scripts/Events/pilgrims_bounty.cpp b/src/server/scripts/Events/pilgrims_bounty.cpp index ffdc46c76..86e7ed523 100644 --- a/src/server/scripts/Events/pilgrims_bounty.cpp +++ b/src/server/scripts/Events/pilgrims_bounty.cpp @@ -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); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index 2c5516ddd..4dcd08647 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -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); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp index 2bf4030a5..a47a8b90f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp @@ -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); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_lieutenant_drake.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_lieutenant_drake.cpp index 99c4cbfa3..a00d4276c 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_lieutenant_drake.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_lieutenant_drake.cpp @@ -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); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp index d0854a318..f80ed1b28 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp @@ -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); diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp index 0da86e7da..fa7c56048 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp @@ -106,7 +106,7 @@ struct boss_buru : public BossAI void KilledUnit(Unit* victim) override { - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) ChaseNewVictim(); } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index 5ae2e5079..e7222bf41 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -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) diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp index 2f28174f8..e3cc20498 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp @@ -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()) { diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp index 531b2ed5a..091bb2837 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp @@ -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); } diff --git a/src/server/scripts/Kalimdor/boss_azuregos.cpp b/src/server/scripts/Kalimdor/boss_azuregos.cpp index dba69cfa8..bb73f7219 100644 --- a/src/server/scripts/Kalimdor/boss_azuregos.cpp +++ b/src/server/scripts/Kalimdor/boss_azuregos.cpp @@ -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); diff --git a/src/server/scripts/Kalimdor/zone_azshara.cpp b/src/server/scripts/Kalimdor/zone_azshara.cpp index c8fb68c0a..b88ff0e68 100644 --- a/src/server/scripts/Kalimdor/zone_azshara.cpp +++ b/src/server/scripts/Kalimdor/zone_azshara.cpp @@ -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; diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp index e3f09cd1f..d9a734b97 100644 --- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp @@ -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); diff --git a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp index c5a2f55e7..e062e1782 100644 --- a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp @@ -70,7 +70,7 @@ public: { if (Unit* owner = killer->GetOwner()) { - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) { owner->ToPlayer()->KilledMonsterCredit(NPC_EXPEDITION_RESEARCHER); } diff --git a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp index 9fa7fc585..802739571 100644 --- a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp @@ -99,7 +99,7 @@ class spell_energize_aoe : public SpellScript { for (std::list::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++); diff --git a/src/server/scripts/Kalimdor/zone_orgrimmar.cpp b/src/server/scripts/Kalimdor/zone_orgrimmar.cpp index 2f2b39fbf..886759de5 100644 --- a/src/server/scripts/Kalimdor/zone_orgrimmar.cpp +++ b/src/server/scripts/Kalimdor/zone_orgrimmar.cpp @@ -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(); diff --git a/src/server/scripts/Kalimdor/zone_tanaris.cpp b/src/server/scripts/Kalimdor/zone_tanaris.cpp index a011bc2f9..419fe473f 100644 --- a/src/server/scripts/Kalimdor/zone_tanaris.cpp +++ b/src/server/scripts/Kalimdor/zone_tanaris.cpp @@ -121,7 +121,7 @@ public: { if (SendItemTimer <= diff) { - if (me->GetVictim()->GetTypeId() == TYPEID_PLAYER) + if (me->GetVictim()->IsPlayer()) SendItem(me->GetVictim()); SendItemTimer = 5000; } diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp index 18535e2f7..4408d6f2e 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp @@ -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); diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp index 464ea8f6a..914dd5118 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp @@ -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); } diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp index 29b290ae0..54a382f5b 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp @@ -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)) { diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp index de20a754b..2bf096992 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp @@ -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; } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp index b1388a95d..fe4ad7c8a 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp @@ -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); } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index 5c0ee5587..7e4e3d92a 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -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); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index 3688d0394..554ae002c 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -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); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp index dec97a49e..0b2a7ffc5 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp @@ -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; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index 6a8872aef..6dfdf56a0 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -385,7 +385,7 @@ public: void KilledUnit(Unit* who) override { - if( who->GetTypeId() == TYPEID_PLAYER ) + if( who->IsPlayer() ) Talk(SAY_KILL_PLAYER); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index ffb39e14d..72aa2abfc 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -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); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index dd88510df..5423cf881 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -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; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 5885e4843..e3f805fb7 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -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() ) diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp index 47aa96029..7b3ab1688 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp @@ -155,7 +155,7 @@ public: void OnUnitDeath(Unit* u) override { - if (bNooneDied && u->GetTypeId() == TYPEID_PLAYER) + if (bNooneDied && u->IsPlayer()) { bNooneDied = false; SaveToDB(); diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp index 0ad8fb6bb..3c82020a0 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp @@ -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(); diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp index 46fe03035..d08cddca6 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp @@ -190,7 +190,7 @@ public: void KilledUnit(Unit* who) override { - if (who->GetTypeId() == TYPEID_PLAYER) + if (who->IsPlayer()) Talk(SAY_SLAY); } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp index bc895a169..d5e01c2da 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp @@ -161,7 +161,7 @@ public: void KilledUnit(Unit* who) override { - if (who->GetTypeId() == TYPEID_PLAYER) + if (who->IsPlayer()) Talk(SAY_SLAY); } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp index 75d715112..ae13defb1 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp @@ -154,7 +154,7 @@ public: void KilledUnit(Unit* who) override { - if (who->GetTypeId() == TYPEID_PLAYER) + if (who->IsPlayer()) Talk(SAY_SLAY); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index 954d08c12..12fc5a6f0 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -280,7 +280,7 @@ public: void KilledUnit(Unit* who) override { - if (who->GetTypeId() == TYPEID_PLAYER) + if (who->IsPlayer()) Talk(SAY_SLAY); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp index 79f233de6..d2babe69a 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp @@ -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); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp index acbe71b8a..e49c9ee7a 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -209,7 +209,7 @@ public: void KilledUnit(Unit* who) override { - if (who->GetTypeId() == TYPEID_PLAYER) + if (who->IsPlayer()) Talk(SAY_SLAY); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp index 35901db4d..3dcfa3e42 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp @@ -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); diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp index e43f4555b..8a9463b51 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp @@ -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; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 5697c129a..c1193e442 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -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); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index 3b1dd9843..7686841c6 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -268,7 +268,7 @@ public: void KilledUnit(Unit* victim) override { - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) Talk(SAY_KILL); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index 08058a970..eb84105c7 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -341,7 +341,7 @@ public: void KilledUnit(Unit* victim) override { - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) Talk(SAY_KILL); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp index de01ce804..0073e7cb5 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp @@ -162,7 +162,7 @@ public: void KilledUnit(Unit* victim) override { - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) Talk(SAY_KILL); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp index 5edeaa542..cac357457 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp @@ -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*/) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index 4e28ec371..cc36837f7 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -544,7 +544,7 @@ public: void KilledUnit(Unit* victim) override { - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) Talk(SAY_KILL); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index cccefd795..17d68df61 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -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; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index 6b528dfef..8753fefb4 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -333,7 +333,7 @@ public: void KilledUnit(Unit* victim) override { - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) Talk(SAY_KILL); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index 710a4d13f..b0b845e3d 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -216,7 +216,7 @@ public: void KilledUnit(Unit* victim) override { - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) Talk(SAY_KILL); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 7f084643f..1295c9d1a 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -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))); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 1a64dd1f6..6285b3500 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -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; } }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index 97485ee5b..fae3bb8b7 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -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(); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index b94169666..86adf4725 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -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(); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp index 3a0b3edd0..f4f6ca1d6 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp @@ -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; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp index 243622c3e..db38740c3 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp @@ -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; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp index 2875f1818..c3fd79e3a 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp @@ -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); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 424738730..d2ebea1ae 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -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); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp index d45d378e2..39a84201e 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp @@ -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); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index a58e419da..725e0c0f1 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -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); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp index fb15e6e42..52a0b4fe5 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp @@ -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); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp index 508e340c9..e2f22a615 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp @@ -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); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp index f86b4b55d..53a488598 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp @@ -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); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp index 597769e4e..acad7283e 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp @@ -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()) diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 3162814de..68491abc5 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -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); diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp index 0f8403d9e..3de2a1263 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp @@ -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) { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 46a9dc8c3..471f6784d 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -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); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp index 4c562f651..872d9340d 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp @@ -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); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp index a8eac4757..e526e3299 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp @@ -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()); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp index 8c66fc036..7277c0257 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp @@ -290,7 +290,7 @@ public: void KilledUnit(Unit* victim) override { - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) Talk(SAY_SLAY); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index 34e213d04..f9210e80c 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -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)) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp index 90ada7fc1..a80545c36 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp @@ -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); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp index f9e6743a7..f516bfc84 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp @@ -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))) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp index 362256a0a..98e944888 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp @@ -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); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index f3c4850b0..df26adcb6 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -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; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.cpp index 90890f2f1..be980bd55 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.cpp @@ -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)) diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index af0ae9cc3..aa7d0e250 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -205,7 +205,7 @@ public: instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, 26555, 1, nullptr); } - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) Talk(SAY_SLAY); } diff --git a/src/server/scripts/Northrend/isle_of_conquest.cpp b/src/server/scripts/Northrend/isle_of_conquest.cpp index efcb07efc..9555f7c81 100644 --- a/src/server/scripts/Northrend/isle_of_conquest.cpp +++ b/src/server/scripts/Northrend/isle_of_conquest.cpp @@ -376,7 +376,7 @@ class spell_ioc_gunship_portal : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleScript(SpellEffIndex effIndex) diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index deae2396b..4355e2109 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -224,7 +224,7 @@ public: { if (Unit* owner = who->GetOwner()) { - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) { owner->CastSpell(owner, SPELL_MAMMOTH_CALF_ESCORT_CREDIT, true); who->ToCreature()->DespawnOrUnsummon(); @@ -746,7 +746,7 @@ public: void SpellHit(Unit* unit, SpellInfo const* spell) override { - if (spell->Id == SPELL_NEURAL_NEEDLE && unit->GetTypeId() == TYPEID_PLAYER) + if (spell->Id == SPELL_NEURAL_NEEDLE && unit->IsPlayer()) { if (Player* player = unit->ToPlayer()) { diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp index db8e98df7..9d0a4f893 100644 --- a/src/server/scripts/Northrend/zone_dragonblight.cpp +++ b/src/server/scripts/Northrend/zone_dragonblight.cpp @@ -917,7 +917,7 @@ public: void DamageTaken(Unit* who, uint32&, DamageEffectType, SpellSchoolMask) override { - if (who && who->GetTypeId() == TYPEID_PLAYER) + if (who && who->IsPlayer()) { me->SetLootRecipient(who); me->LowerPlayerDamageReq(me->GetMaxHealth()); @@ -1567,7 +1567,7 @@ public: void KilledUnit(Unit* who) override { - if (who->GetTypeId() == TYPEID_PLAYER) + if (who->IsPlayer()) Talk(2); } diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp index 038d7b367..06974fad7 100644 --- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp +++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp @@ -797,7 +797,7 @@ public: void SpellHit(Unit* caster, SpellInfo const* spell) override { - if (spell->Id == SPELL_SMOKE_BOMB && caster->GetTypeId() == TYPEID_PLAYER) + if (spell->Id == SPELL_SMOKE_BOMB && caster->IsPlayer()) { me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); me->SetImmuneToPC(true); @@ -1000,7 +1000,7 @@ class spell_infected_worgen_bite_aura : public AuraScript void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) if (GetStackAmount() == GetSpellInfo()->StackAmount) { SetDuration(0); diff --git a/src/server/scripts/Northrend/zone_howling_fjord.cpp b/src/server/scripts/Northrend/zone_howling_fjord.cpp index 5c258276e..79cfb26da 100644 --- a/src/server/scripts/Northrend/zone_howling_fjord.cpp +++ b/src/server/scripts/Northrend/zone_howling_fjord.cpp @@ -303,7 +303,7 @@ public: ObjectGuid summonerGUID; if (me->IsSummon()) if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit()) - if (summoner->GetTypeId() == TYPEID_PLAYER) + if (summoner->IsPlayer()) summonerGUID = summoner->GetGUID(); if (!summonerGUID) diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp index 8fd47bde8..8e49b983e 100644 --- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp +++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp @@ -1342,7 +1342,7 @@ public: void PassengerBoarded(Unit* passenger, int8 /*seatId*/, bool apply) override { - if (apply && passenger->GetTypeId() == TYPEID_PLAYER) + if (apply && passenger->IsPlayer()) { Movement::PointsArray pathPoints; pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); @@ -1401,7 +1401,7 @@ public: if (spell->Id == SPELL_LAND) { Unit* passenger = me->GetVehicleKit()->GetPassenger(1); // player should be on seat 1 - if (passenger && passenger->GetTypeId() == TYPEID_PLAYER) + if (passenger && passenger->IsPlayer()) passenger->CastSpell(passenger, SPELL_CREDIT, true); me->DespawnOrUnsummon(); diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp index 57c1bb537..8ab42c3f9 100644 --- a/src/server/scripts/Northrend/zone_storm_peaks.cpp +++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp @@ -49,7 +49,7 @@ public: void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply) override { - if (who->GetTypeId() == TYPEID_PLAYER) + if (who->IsPlayer()) { if (apply) { @@ -869,7 +869,7 @@ public: case EVENT_REACHED_HOME: if (Vehicle* vehicle = me->GetVehicleKit()) if (Unit* player = vehicle->GetPassenger(0)) - if (player->GetTypeId() == TYPEID_PLAYER) + if (player->IsPlayer()) { // for each prisoner on drake, give credit for (uint8 i = 1; i < 4; ++i) @@ -910,7 +910,7 @@ public: void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply) override { - if (who->GetTypeId() == TYPEID_PLAYER) + if (who->IsPlayer()) { if (apply) Start(false, true, who->GetGUID()); @@ -1116,7 +1116,7 @@ public: { if (Unit* player = vehicle->GetPassenger(0)) { - if (player->GetTypeId() == TYPEID_PLAYER) + if (player->IsPlayer()) { player->m_Events.AddEventAtOffset([player]() { @@ -1136,7 +1136,7 @@ public: { if (Unit* player = vehicle->GetPassenger(0)) { - if (player->GetTypeId() == TYPEID_PLAYER) + if (player->IsPlayer()) { player->m_Events.AddEventAtOffset([player]() { diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp index 1b4af9044..9114f4b6b 100644 --- a/src/server/scripts/Northrend/zone_zuldrak.cpp +++ b/src/server/scripts/Northrend/zone_zuldrak.cpp @@ -413,7 +413,7 @@ public: void MoveInLineOfSight(Unit* who) override { - if (who->GetTypeId() == TYPEID_PLAYER) + if (who->IsPlayer()) { if (playerGUID) { diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index 24ed4e368..f8b8664d7 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -74,7 +74,7 @@ void OutdoorPvPNA::HandleKill(Player* killer, Unit* killed) void OutdoorPvPNA::HandleKillImpl(Player* player, Unit* killed) { - if (killed->GetTypeId() == TYPEID_PLAYER && player->GetTeamId() != killed->ToPlayer()->GetTeamId()) + if (killed->IsPlayer() && player->GetTeamId() != killed->ToPlayer()->GetTeamId()) { player->KilledMonsterCredit(NA_CREDIT_MARKER); player->CastSpell(player, player->GetTeamId() == TEAM_ALLIANCE ? NA_KILL_TOKEN_ALLIANCE : NA_KILL_TOKEN_HORDE, true); diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp index 8e29442a2..072df72a2 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp @@ -83,7 +83,7 @@ struct boss_exarch_maladaar : public BossAI void MoveInLineOfSight(Unit* who) override { - if (!_talked && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 150.0f)) + if (!_talked && who->IsPlayer() && me->IsWithinDistInMap(who, 150.0f)) { _talked = true; Talk(SAY_INTRO); diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp index 07f5762e5..7066d91b9 100644 --- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp +++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp @@ -77,7 +77,7 @@ struct boss_nexusprince_shaffar : public BossAI void MoveInLineOfSight(Unit* who) override { - if (!HasTaunted && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 100.0f)) + if (!HasTaunted && who->IsPlayer() && me->IsWithinDistInMap(who, 100.0f)) { HasTaunted = true; Talk(SAY_INTRO); @@ -133,7 +133,7 @@ struct boss_nexusprince_shaffar : public BossAI void KilledUnit(Unit* victim) override { - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) { Talk(SAY_SLAY); } diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp index e859d4d76..76ec3b329 100644 --- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp +++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp @@ -101,7 +101,7 @@ struct boss_pandemonius : public BossAI void KilledUnit(Unit* victim) override { - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) Talk(SAY_KILL); } diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp index 46f00e2c1..1b249d31b 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp @@ -97,7 +97,7 @@ struct boss_darkweaver_syth : public BossAI void KilledUnit(Unit* victim) override { - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) { Talk(SAY_SLAY); } diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp index fc59e7c3d..1717a518d 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp @@ -186,7 +186,7 @@ struct boss_grandmaster_vorpil : public BossAI void MoveInLineOfSight(Unit* who) override { ScriptedAI::MoveInLineOfSight(who); - if (!sayIntro && who->GetTypeId() == TYPEID_PLAYER) + if (!sayIntro && who->IsPlayer()) { Talk(SAY_INTRO); sayIntro = true; diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp index 4e9be02a2..e0098c694 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp @@ -99,7 +99,7 @@ struct boss_najentus : public BossAI void KilledUnit(Unit* victim) override { - if (victim->GetTypeId() == TYPEID_PLAYER && _canTalk) + if (victim->IsPlayer() && _canTalk) { Talk(SAY_SLAY); _canTalk = false; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index 448b3aef2..7207b2841 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -170,7 +170,7 @@ struct boss_lady_vashj : public BossAI void MoveInLineOfSight(Unit* who) override { - if (!_intro && who->GetTypeId() == TYPEID_PLAYER) + if (!_intro && who->IsPlayer()) { _intro = true; Talk(SAY_INTRO); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp index eeb30a8fc..2526702ea 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp @@ -62,7 +62,7 @@ struct boss_warlord_kalithresh : public BossAI void MoveInLineOfSight(Unit* who) override { - if (!_introDone && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 35.0f)) + if (!_introDone && who->IsPlayer() && me->IsWithinDistInMap(who, 35.0f)) { Talk(SAY_INTRO); _introDone = true; diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp index 67d2c0da9..8494992f7 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp @@ -71,7 +71,7 @@ struct boss_the_maker : public BossAI void KilledUnit(Unit* victim) override { - if (victim->GetTypeId() == TYPEID_PLAYER && urand(0, 1)) + if (victim->IsPlayer() && urand(0, 1)) { Talk(SAY_KILL); } diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp index abb59bf54..a81cd8944 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp @@ -100,7 +100,7 @@ struct boss_watchkeeper_gargolmar : public BossAI { if (!_taunted) { - if (who->GetTypeId() == TYPEID_PLAYER) + if (who->IsPlayer()) { _taunted = true; Talk(SAY_TAUNT); diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp index 61f702131..638570c64 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp @@ -226,7 +226,7 @@ struct boss_warbringer_omrogg : public BossAI void KilledUnit(Unit* victim) override { - if (victim && victim->GetTypeId() == TYPEID_PLAYER) + if (victim && victim->IsPlayer()) HandleHeadTalk(SAY_ON_KILL); } diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp index c06e03c46..a190b744b 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp @@ -157,7 +157,7 @@ struct boss_warchief_kargath_bladefist : public BossAI void KilledUnit(Unit* victim) override { - if (victim && victim->GetTypeId() == TYPEID_PLAYER) + if (victim && victim->IsPlayer()) Talk(SAY_SLAY); } diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index dc1b9a02c..309fd555f 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -108,7 +108,7 @@ struct boss_high_astromancer_solarian : public BossAI void KilledUnit(Unit* victim) override { - if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50)) + if (victim->IsPlayer() && roll_chance_i(50)) { Talk(SAY_KILL); } diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index 833d8b368..8ff0f0512 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -315,7 +315,7 @@ struct boss_kaelthas : public BossAI void MoveInLineOfSight(Unit* who) override { - if (_phase == PHASE_NONE && who->GetTypeId() == TYPEID_PLAYER && me->IsValidAttackTarget(who)) + if (_phase == PHASE_NONE && who->IsPlayer() && me->IsValidAttackTarget(who)) { _phase = PHASE_SINGLE_ADVISOR; me->SetInCombatWithZone(); @@ -345,7 +345,7 @@ struct boss_kaelthas : public BossAI void KilledUnit(Unit* victim) override { - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) Talk(SAY_SLAY); } @@ -1270,7 +1270,7 @@ class spell_kaelthas_nether_beam : public SpellScript for (ThreatContainer::StorageType::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) { Unit* target = ObjectAccessor::GetUnit(*GetCaster(), (*itr)->getUnitGuid()); - if (target && target->GetTypeId() == TYPEID_PLAYER) + if (target && target->IsPlayer()) targetList.push_back(target); } diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp index 1aafd0fd3..5129a51e7 100644 --- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp +++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp @@ -116,7 +116,7 @@ public: void KilledUnit(Unit* victim) override { - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->IsPlayer()) { Talk(SAY_KILL); DoCastSelf(SPELL_CAPTURE_SOUL); diff --git a/src/server/scripts/Outland/boss_doomwalker.cpp b/src/server/scripts/Outland/boss_doomwalker.cpp index fe3351f75..774dcfe58 100644 --- a/src/server/scripts/Outland/boss_doomwalker.cpp +++ b/src/server/scripts/Outland/boss_doomwalker.cpp @@ -105,7 +105,7 @@ struct boss_doomwalker : public ScriptedAI void MoveInLineOfSight(Unit* who) override { - if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsValidAttackTarget(who)) + if (who && who->IsPlayer() && me->IsValidAttackTarget(who)) { if (who->HasAura(SPELL_MARK_DEATH) && !who->HasAura(27827)) // Spirit of Redemption { diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp index 9f549e2b7..638c2bbce 100644 --- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp @@ -332,7 +332,7 @@ public: void SpellHit(Unit* caster, SpellInfo const* spell) override { - if (spell->Id == SPELL_T_PHASE_MODULATOR && caster->GetTypeId() == TYPEID_PLAYER) + if (spell->Id == SPELL_T_PHASE_MODULATOR && caster->IsPlayer()) { const uint32 entry_list[4] = {ENTRY_PROTO, ENTRY_ADOLE, ENTRY_MATUR, ENTRY_NIHIL}; int cid = rand() % (4 - 1); @@ -466,7 +466,7 @@ public: void MoveInLineOfSight(Unit* who) override { - if (who->GetTypeId() == TYPEID_PLAYER) + if (who->IsPlayer()) { if (who->HasAura(SPELL_LASHHAN_CHANNEL) && me->IsWithinDistInMap(who, 10.0f)) { diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp index a52f2089d..717232742 100644 --- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp @@ -170,7 +170,7 @@ public: { npc_ancestral_wolfAI(Creature* creature) : npc_escortAI(creature) { - if (creature->GetOwner() && creature->GetOwner()->GetTypeId() == TYPEID_PLAYER) + if (creature->GetOwner() && creature->GetOwner()->IsPlayer()) Start(false, false, creature->GetOwner()->GetGUID()); creature->SetSpeed(MOVE_WALK, 1.5f); DoCast(SPELL_GUIDED_BY_THE_SPIRITS); diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index 7fdf0c55a..1cf8e89f7 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -323,7 +323,7 @@ public: if (bCanEat || bIsEating) return; - if (pCaster->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_PLACE_CARCASS && !me->HasAura(SPELL_JUST_EATEN)) + if (pCaster->IsPlayer() && spell->Id == SPELL_PLACE_CARCASS && !me->HasAura(SPELL_JUST_EATEN)) { uiPlayerGUID = pCaster->GetGUID(); bCanEat = true; @@ -599,7 +599,7 @@ public: PlayerGUID = caster->GetGUID(); - if (caster->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_POISON && !Tapped) + if (caster->IsPlayer() && spell->Id == SPELL_POISON && !Tapped) { Tapped = true; caster->GetClosePoint(x, y, z, me->GetObjectSize()); @@ -1278,7 +1278,7 @@ public: { if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) { - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) { DoCast(target, SpawnCast[1].SpellId); //Focused Bursts SpellTimer1 = SpawnCast[1].Timer2 + (rand() % 5 * 1000); diff --git a/src/server/scripts/Pet/pet_dk.cpp b/src/server/scripts/Pet/pet_dk.cpp index 6a1b1c714..959649e0f 100644 --- a/src/server/scripts/Pet/pet_dk.cpp +++ b/src/server/scripts/Pet/pet_dk.cpp @@ -103,7 +103,7 @@ public: void MySelectNextTarget() { Unit* owner = me->GetOwner(); - if (owner && owner->GetTypeId() == TYPEID_PLAYER && (!me->GetVictim() || me->GetVictim()->IsImmunedToSpell(sSpellMgr->GetSpellInfo(51963)) || !me->IsValidAttackTarget(me->GetVictim()) || !owner->CanSeeOrDetect(me->GetVictim()))) + if (owner && owner->IsPlayer() && (!me->GetVictim() || me->GetVictim()->IsImmunedToSpell(sSpellMgr->GetSpellInfo(51963)) || !me->IsValidAttackTarget(me->GetVictim()) || !owner->CanSeeOrDetect(me->GetVictim()))) { Unit* selection = owner->ToPlayer()->GetSelectedUnit(); if (selection && selection != me->GetVictim() && me->IsValidAttackTarget(selection)) diff --git a/src/server/scripts/Pet/pet_generic.cpp b/src/server/scripts/Pet/pet_generic.cpp index 3fa21a51c..539b29bc1 100644 --- a/src/server/scripts/Pet/pet_generic.cpp +++ b/src/server/scripts/Pet/pet_generic.cpp @@ -528,7 +528,7 @@ struct npc_pet_gen_imp_in_a_bottle : public NullCreatureAI if (TempSummon* summon = me->ToTempSummon()) if (Unit* owner = summon->GetSummonerUnit()) - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) { _ownerGUID = owner->GetGUID(); if (owner->ToPlayer()->GetGroup()) diff --git a/src/server/scripts/Pet/pet_mage.cpp b/src/server/scripts/Pet/pet_mage.cpp index 2bb4f209c..d498af4d9 100644 --- a/src/server/scripts/Pet/pet_mage.cpp +++ b/src/server/scripts/Pet/pet_mage.cpp @@ -158,7 +158,7 @@ struct npc_pet_mage_mirror_image : CasterAI _ebonGargoyleGUID.Clear(); } Unit* owner = me->GetOwner(); - if (owner && owner->GetTypeId() == TYPEID_PLAYER) + if (owner && owner->IsPlayer()) { Unit* selection = owner->ToPlayer()->GetSelectedUnit(); diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 53b447fe5..4134a6931 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -360,14 +360,14 @@ class spell_dk_master_of_ghouls : public AuraScript void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->ToPlayer()->SetShowDKPet(true); } void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - if (target->GetTypeId() == TYPEID_PLAYER) + if (target->IsPlayer()) target->ToPlayer()->SetShowDKPet(false); } @@ -780,7 +780,7 @@ class spell_dk_pet_scaling : public AuraScript amount = CalculatePct(std::max(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier); // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); } } @@ -1014,7 +1014,7 @@ class spell_dk_blood_boil : public SpellScript bool Load() override { _executed = false; - return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY); + return GetCaster()->IsPlayer() && GetCaster()->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY); } void HandleAfterHit() @@ -1291,7 +1291,7 @@ class spell_dk_death_grip : public SpellScript Unit* caster = GetCaster(); Unit* target = GetExplTargetUnit(); - if (target->GetTypeId() == TYPEID_PLAYER && caster->GetExactDist(target) < 8.0f) // xinef: should be 8.0f, but we have to add target size (1.5f) + if (target->IsPlayer() && caster->GetExactDist(target) < 8.0f) // xinef: should be 8.0f, but we have to add target size (1.5f) return SPELL_FAILED_TOO_CLOSE; if (caster->HasUnitState(UNIT_STATE_JUMPING) || caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING)) @@ -1569,7 +1569,7 @@ class spell_dk_icebound_fortitude : public AuraScript bool Load() override { Unit* caster = GetCaster(); - return caster && caster->GetTypeId() == TYPEID_PLAYER; + return caster && caster->IsPlayer(); } void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) @@ -1881,7 +1881,7 @@ class spell_dk_raise_dead : public SpellScript { _result = SPELL_CAST_OK; _corpse = false; - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } SpellCastResult CheckCast() diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 7b74bea2c..2057df054 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -355,7 +355,7 @@ class spell_dru_treant_scaling : public AuraScript amount = CalculatePct(std::max(0, nature), 15); // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); } } @@ -791,7 +791,7 @@ class spell_dru_rip : public AuraScript bool Load() override { Unit* caster = GetCaster(); - return caster && caster->GetTypeId() == TYPEID_PLAYER; + return caster && caster->IsPlayer(); } void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) @@ -1005,7 +1005,7 @@ class spell_dru_swift_flight_passive : public AuraScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) @@ -1063,7 +1063,7 @@ class spell_dru_t10_restoration_4p_bonus : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void FilterTargets(std::list& targets) @@ -1151,7 +1151,7 @@ class spell_dru_berserk : public SpellScript { Unit* caster = GetCaster(); - if (caster->GetTypeId() == TYPEID_PLAYER) + if (caster->IsPlayer()) { // Remove tiger fury / mangle(bear) const uint32 TigerFury[6] = { 5217, 6793, 9845, 9846, 50212, 50213 }; diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index e5e281d57..0b39de333 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -644,7 +644,7 @@ class spell_gen_area_aura_select_players : public AuraScript bool CheckAreaTarget(Unit* target) { - return target->GetTypeId() == TYPEID_PLAYER; + return target->IsPlayer(); } void Register() override { @@ -662,7 +662,7 @@ class spell_gen_area_aura_select_players_and_caster : public AuraScript bool CheckAreaTarget(Unit* target) { - return target->GetTypeId() == TYPEID_PLAYER || target == GetCaster(); + return target->IsPlayer() || target == GetCaster(); } void Register() override { @@ -1692,7 +1692,7 @@ class spell_gen_pet_summoned : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleScript(SpellEffIndex /*effIndex*/) @@ -1973,7 +1973,7 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spellInfo*/) override @@ -2097,7 +2097,7 @@ class spell_gen_divine_storm_cd_reset : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spellInfo*/) override @@ -2128,7 +2128,7 @@ class spell_gen_profession_research : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } SpellCastResult CheckRequirement() @@ -2358,7 +2358,7 @@ class spell_gen_seaforium_blast : public SpellScript bool Load() override { // OriginalCaster is always available in Spell::prepare - return GetOriginalCaster()->GetTypeId() == TYPEID_PLAYER; + return GetOriginalCaster()->IsPlayer(); } void AchievementCredit(SpellEffIndex /*effIndex*/) @@ -2501,7 +2501,7 @@ class spell_gen_vehicle_scaling_aura: public AuraScript bool Load() override { - return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER && GetOwner()->GetTypeId() == TYPEID_UNIT; + return GetCaster() && GetCaster()->IsPlayer() && GetOwner()->GetTypeId() == TYPEID_UNIT; } void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) @@ -2547,7 +2547,7 @@ class spell_gen_oracle_wolvar_reputation : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleDummy(SpellEffIndex effIndex) @@ -2667,7 +2667,7 @@ class spell_gen_spirit_healer_res : public SpellScript bool Load() override { - return GetOriginalCaster() && GetOriginalCaster()->GetTypeId() == TYPEID_PLAYER; + return GetOriginalCaster() && GetOriginalCaster()->IsPlayer(); } void HandleDummy(SpellEffIndex /* effIndex */) @@ -3243,7 +3243,7 @@ class spell_gen_tournament_duel : public SpellScript } else if (Unit* unitTarget = GetHitUnit()) { - if (unitTarget->GetCharmer() && unitTarget->GetCharmer()->GetTypeId() == TYPEID_PLAYER && unitTarget->GetCharmer()->HasAura(SPELL_ON_TOURNAMENT_MOUNT)) + if (unitTarget->GetCharmer() && unitTarget->GetCharmer()->IsPlayer() && unitTarget->GetCharmer()->HasAura(SPELL_ON_TOURNAMENT_MOUNT)) rider->CastSpell(unitTarget->GetCharmer(), SPELL_MOUNTED_DUEL, true); } } @@ -3450,7 +3450,7 @@ class spell_gen_on_tournament_mount : public AuraScript bool Load() override { _pennantSpellId = 0; - return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster() && GetCaster()->IsPlayer(); } void HandleApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -3630,7 +3630,7 @@ class spell_gen_tournament_pennant : public AuraScript bool Load() override { - return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster() && GetCaster()->IsPlayer(); } void HandleApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -3953,7 +3953,7 @@ public: { if (GetCaster()) if (Unit* owner = GetCaster()->GetOwner()) - if (owner->GetTypeId() == TYPEID_PLAYER) /// @todo this check is maybe wrong + if (owner->IsPlayer()) /// @todo this check is maybe wrong owner->ToPlayer()->RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true); } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 86d3abd9c..378604983 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -231,7 +231,7 @@ class spell_hun_generic_scaling : public AuraScript amount = CalculatePct(std::max(0, owner->GetTotalAttackPowerValue(RANGED_ATTACK)), modifier); // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); } } @@ -322,7 +322,7 @@ class spell_hun_aspect_of_the_beast : public AuraScript bool Load() override { - return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster() && GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spellInfo*/) override @@ -655,7 +655,7 @@ class spell_hun_readiness : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleDummy(SpellEffIndex /*effIndex*/) @@ -708,7 +708,7 @@ class spell_hun_scatter_shot : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleDummy(SpellEffIndex /*effIndex*/) @@ -930,7 +930,7 @@ class spell_hun_disengage : public SpellScript SpellCastResult CheckCast() { Unit* caster = GetCaster(); - if (caster->GetTypeId() == TYPEID_PLAYER && !caster->IsInCombat()) + if (caster->IsPlayer() && !caster->IsInCombat()) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; return SPELL_CAST_OK; diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 680f25c0d..343a5d514 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -608,7 +608,7 @@ class spell_item_feast : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleScriptEffect(SpellEffIndex effIndex) @@ -1275,7 +1275,7 @@ class spell_item_summon_argent_knight : public SpellScript { if (Unit* caster = GetCaster()) { - if (caster->GetTypeId() == TYPEID_PLAYER) + if (caster->IsPlayer()) { // summoning the "Argent Knight (Horde)" is default for spell 54307; if (caster->ToPlayer()->GetTeamId() == TEAM_ALLIANCE) @@ -1585,7 +1585,7 @@ class spell_item_deviate_fish : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spellInfo*/) override @@ -1813,7 +1813,7 @@ class spell_item_make_a_wish : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spellInfo*/) override @@ -2032,7 +2032,7 @@ class spell_item_noggenfogger_elixir : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spellInfo*/) override @@ -2102,7 +2102,7 @@ class spell_item_savory_deviate_delight : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spellInfo*/) override @@ -2156,7 +2156,7 @@ class spell_item_scroll_of_recall : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleScript(SpellEffIndex effIndex) @@ -2215,7 +2215,7 @@ class spell_item_dimensional_ripper_area52 : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleScript(SpellEffIndex /* effIndex */) @@ -2571,7 +2571,7 @@ class spell_item_underbelly_elixir : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spellInfo*/) override { @@ -2619,7 +2619,7 @@ class spell_item_book_of_glyph_mastery : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } SpellCastResult CheckRequirement() @@ -2735,7 +2735,7 @@ class spell_item_ashbringer : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void OnDummyEffect(SpellEffIndex effIndex) @@ -2832,7 +2832,7 @@ class spell_item_purify_helboar_meat : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spell*/) override @@ -3042,7 +3042,7 @@ class spell_item_demon_broiled_surprise : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleDummy(SpellEffIndex /* effIndex */) @@ -3249,7 +3249,7 @@ class spell_item_teach_language : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spell*/) override @@ -3282,7 +3282,7 @@ class spell_item_rocket_boots : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spell*/) override @@ -3320,7 +3320,7 @@ class spell_item_healing_injector : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleHeal(SpellEffIndex /*effIndex*/) @@ -3342,7 +3342,7 @@ class spell_item_mana_injector : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleEnergize(SpellEffIndex /*effIndex*/) @@ -3431,7 +3431,7 @@ class spell_item_chicken_cover : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spell*/) override @@ -3834,7 +3834,7 @@ class spell_item_worn_troll_dice : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleScript(SpellEffIndex /*effIndex*/) diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index c509365d9..13fbefcdd 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -267,7 +267,7 @@ class spell_mage_pet_scaling : public AuraScript amount = CalculatePct(std::max(0, frost), 33); // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); } } @@ -459,7 +459,7 @@ class spell_mage_cold_snap : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleDummy(SpellEffIndex /*effIndex*/) diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index d7d3bdb9a..155c6276b 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -178,7 +178,7 @@ class spell_pal_divine_intervention : public AuraScript void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (!GetTarget()->IsInCombat() && GetTarget()->GetTypeId() == TYPEID_PLAYER) + if (!GetTarget()->IsInCombat() && GetTarget()->IsPlayer()) GetTarget()->RemoveAurasDueToSpell(GetTarget()->ToPlayer()->GetTeamId() == TEAM_ALLIANCE ? 57723 : 57724); } @@ -329,7 +329,7 @@ private: { healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); - return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER; + return GetUnitOwner()->IsPlayer(); } void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) @@ -518,7 +518,7 @@ class spell_pal_divine_sacrifice : public AuraScript { if (Unit* caster = GetCaster()) { - if (caster->GetTypeId() == TYPEID_PLAYER) + if (caster->IsPlayer()) { if (caster->ToPlayer()->GetGroup()) groupSize = caster->ToPlayer()->GetGroup()->GetMembersCount(); diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 3feb296fc..0d02279f2 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -118,7 +118,7 @@ class spell_pri_shadowfiend_scaling : public AuraScript amount = CalculatePct(std::max(0, shadow), 30); // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); } } @@ -552,7 +552,7 @@ class spell_pri_penance : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* spellInfo) override @@ -782,7 +782,7 @@ class spell_pri_renew : public AuraScript bool Load() override { - return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster() && GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spellInfo*/) override diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 3ff5ca339..cfcad45ee 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -201,7 +201,7 @@ class spell_q11026_a11051_banish_the_demons : public SpellScript { if (Unit* target = GetHitUnit()) if (Unit* owner = target->ToTempSummon()->GetSummonerUnit()) - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) owner->ToPlayer()->KilledMonsterCredit(23327); // Some trigger, just count } @@ -652,7 +652,7 @@ class spell_q13369_fate_up_against_your_will : public SpellScript { // Fate, Up Against Your Will (13369) if (Unit* caster = GetCaster()) - if (caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->GetQuestStatus(13369) >= QUEST_STATUS_COMPLETE) + if (caster->IsPlayer() && caster->ToPlayer()->GetQuestStatus(13369) >= QUEST_STATUS_COMPLETE) return SPELL_CAST_OK; return SPELL_FAILED_DONT_REPORT; } @@ -864,7 +864,7 @@ class spell_q5206_test_fetid_skull : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spellInfo*/) override @@ -903,7 +903,7 @@ class spell_q6124_6129_apply_salve : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleDummy(SpellEffIndex /*effIndex*/) @@ -1108,7 +1108,7 @@ class spell_q11730_ultrasonic_screwdriver : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCastItem(); + return GetCaster()->IsPlayer() && GetCastItem(); } bool Validate(SpellInfo const* /*spellInfo*/) override @@ -1346,7 +1346,7 @@ class spell_q12937_relief_for_the_fallen : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spellInfo*/) override @@ -1452,7 +1452,7 @@ class spell_q12659_ahunaes_knife : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleDummy(SpellEffIndex /*effIndex*/) @@ -1483,7 +1483,7 @@ class spell_q9874_liquid_fire : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleDummy(SpellEffIndex /*effIndex*/) @@ -1515,7 +1515,7 @@ class spell_q12805_lifeblood_dummy : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleScript(SpellEffIndex /*effIndex*/) @@ -1616,7 +1616,7 @@ class spell_q9452_cast_net : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } SpellCastResult CheckCast() diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 43699a6dd..bbdb9314a 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -201,7 +201,7 @@ class spell_rog_deadly_poison : public SpellScript { _stackAmount = 0; // at this point CastItem must already be initialized - return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCastItem(); + return GetCaster()->IsPlayer() && GetCastItem(); } void HandleBeforeHit(SpellMissInfo missInfo) @@ -438,7 +438,7 @@ class spell_rog_preparation : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spellInfo*/) override @@ -505,7 +505,7 @@ class spell_rog_prey_on_the_weak : public AuraScript { Unit* target = GetTarget(); Unit* victim = target->GetVictim(); - if (!victim && target->GetTypeId() == TYPEID_PLAYER) + if (!victim && target->IsPlayer()) victim = target->ToPlayer()->GetSelectedUnit(); if (victim && (target->GetHealthPct() > victim->GetHealthPct())) @@ -534,7 +534,7 @@ class spell_rog_rupture : public AuraScript bool Load() override { Unit* caster = GetCaster(); - return caster && caster->GetTypeId() == TYPEID_PLAYER; + return caster && caster->IsPlayer(); } void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) @@ -574,7 +574,7 @@ class spell_rog_shiv : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spellInfo*/) override diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index a5ae2c12e..28b61ef54 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -215,7 +215,7 @@ class spell_sha_feral_spirit_scaling : public AuraScript amount = CalculatePct(std::max(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier); // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); } } @@ -324,7 +324,7 @@ class spell_sha_fire_elemental_scaling : public AuraScript amount = CalculatePct(std::max(0, fire), 100); // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); } } @@ -951,7 +951,7 @@ class spell_sha_lava_lash : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } void HandleDummy(SpellEffIndex /*effIndex*/) @@ -1049,7 +1049,7 @@ class spell_sha_sentry_totem : public AuraScript void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Unit* caster = GetCaster()) - if (caster->GetTypeId() == TYPEID_PLAYER) + if (caster->IsPlayer()) caster->ToPlayer()->StopCastingBindSight(); } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index b96ec620b..c27856ccd 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -171,7 +171,7 @@ class spell_warl_improved_demonic_tactics : public AuraScript bool Load() override { - return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER; + return GetUnitOwner()->IsPlayer(); } void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) @@ -223,7 +223,7 @@ class spell_warl_ritual_of_summoning : public SpellScript SpellCastResult CheckCast() { - if (GetCaster()->GetTypeId() == TYPEID_PLAYER) + if (GetCaster()->IsPlayer()) if (GetCaster()->ToPlayer()->InBattleground()) return SPELL_FAILED_NOT_IN_BATTLEGROUND; return SPELL_CAST_OK; @@ -339,7 +339,7 @@ class spell_warl_generic_scaling : public AuraScript amount = CalculatePct(std::max(0, maximum), 15); // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); } } @@ -450,7 +450,7 @@ class spell_warl_infernal_scaling : public AuraScript amount = CalculatePct(std::max(0, maximum), 15); // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) + if (owner->IsPlayer()) owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); } } @@ -900,7 +900,7 @@ class spell_warl_life_tap : public SpellScript bool Load() override { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->IsPlayer(); } bool Validate(SpellInfo const* /*spell*/) override @@ -1147,7 +1147,7 @@ class spell_warl_curse_of_doom : public AuraScript bool Load() override { - return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster() && GetCaster()->IsPlayer(); } void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) @@ -1322,7 +1322,7 @@ class spell_warl_drain_soul : public AuraScript Unit* caster = GetCaster(); Unit* target = GetTarget(); - if (caster && caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->isHonorOrXPTarget(target)) + if (caster && caster->IsPlayer() && caster->ToPlayer()->isHonorOrXPTarget(target)) { if (roll_chance_i(20)) { diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp index 55d188a1c..2cf818614 100644 --- a/src/server/scripts/World/boss_emerald_dragons.cpp +++ b/src/server/scripts/World/boss_emerald_dragons.cpp @@ -114,7 +114,7 @@ struct emerald_dragonAI : public WorldBossAI // Target killed during encounter, mark them as suspectible for Aura Of Nature void KilledUnit(Unit* who) override { - if (who->GetTypeId() == TYPEID_PLAYER) + if (who->IsPlayer()) who->CastSpell(who, SPELL_MARK_OF_NATURE, true); } @@ -431,7 +431,7 @@ public: void SpellHitTarget(Unit* target, SpellInfo const* spell) override { - if (spell->Id == SPELL_DRAW_SPIRIT && target->GetTypeId() == TYPEID_PLAYER) + if (spell->Id == SPELL_DRAW_SPIRIT && target->IsPlayer()) { Position targetPos = target->GetPosition(); me->SummonCreature(NPC_SPIRIT_SHADE, targetPos, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 50000); @@ -531,7 +531,7 @@ public: void KilledUnit(Unit* who) override { - if (who->GetTypeId() == TYPEID_PLAYER) + if (who->IsPlayer()) { who->CastSpell(who, SPELL_PUTRID_MUSHROOM, true); } diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp index 6e483cba2..f49afe314 100644 --- a/src/server/scripts/World/guards.cpp +++ b/src/server/scripts/World/guards.cpp @@ -81,7 +81,7 @@ public: else if (banishTimer <= diff) { Unit* temp = me->GetVictim(); - if (temp && temp->GetTypeId() == TYPEID_PLAYER) + if (temp && temp->IsPlayer()) { DoCast(temp, SPELL_BANISHED_SHATTRATH_A); banishTimer = 9000; @@ -148,7 +148,7 @@ public: else if (banishTimer <= diff) { Unit* temp = me->GetVictim(); - if (temp && temp->GetTypeId() == TYPEID_PLAYER) + if (temp && temp->IsPlayer()) { DoCast(temp, SPELL_BANISHED_SHATTRATH_S); banishTimer = 9000; diff --git a/src/server/scripts/World/npc_stave_of_ancients.cpp b/src/server/scripts/World/npc_stave_of_ancients.cpp index 8793f5b54..bf80e6bd5 100644 --- a/src/server/scripts/World/npc_stave_of_ancients.cpp +++ b/src/server/scripts/World/npc_stave_of_ancients.cpp @@ -55,7 +55,7 @@ void NPCStaveQuestAI::StorePlayerGUID() for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) { - if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER) + if ((*itr)->getTarget()->IsPlayer()) { playerGUID = (*itr)->getUnitGuid(); }