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

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

View file

@ -33,7 +33,7 @@ int32 PetAI::Permissible(Creature const* creature)
{
if (creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
{
if (reinterpret_cast<Guardian const*>(creature)->GetOwner()->GetTypeId() == TYPEID_PLAYER)
if (reinterpret_cast<Guardian const*>(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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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<Player*>(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<Player*>(this); else return nullptr; }
[[nodiscard]] Player const* ToPlayer() const { if (IsPlayer()) return reinterpret_cast<Player const*>(this); else return nullptr; }
Creature* ToCreature() { if (GetTypeId() == TYPEID_UNIT) return reinterpret_cast<Creature*>(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<Creature const*>(this); else return nullptr; }
Unit* ToUnit() { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Unit*>(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<GameObject*>(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<Unit*>(this); else return nullptr; }
[[nodiscard]] Unit const* ToUnit() const { if (GetTypeId() == TYPEID_UNIT || IsPlayer()) return reinterpret_cast<Unit const*>(this); else return nullptr; }
Corpse* ToCorpse() { if (GetTypeId() == TYPEID_CORPSE) return reinterpret_cast<Corpse*>(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<GameObject*>(this); else return nullptr; }
[[nodiscard]] GameObject const* ToGameObject() const { if (IsGameObject()) return reinterpret_cast<GameObject const*>(this); else return nullptr; }
DynamicObject* ToDynObject() { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast<DynamicObject*>(this); else return nullptr; }
[[nodiscard]] DynamicObject const* ToDynObject() const { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast<DynamicObject const*>(this); else return nullptr; }
[[nodiscard]] inline bool IsCorpse() const { return GetTypeId() == TYPEID_CORPSE; }
Corpse* ToCorpse() { if (IsCorpse()) return reinterpret_cast<Corpse*>(this); else return nullptr; }
[[nodiscard]] Corpse const* ToCorpse() const { if (IsCorpse()) return reinterpret_cast<Corpse const*>(this); else return nullptr; }
[[nodiscard]] inline bool IsDynamicObject() const { return GetTypeId() == TYPEID_DYNAMICOBJECT; }
DynamicObject* ToDynObject() { if (IsDynamicObject()) return reinterpret_cast<DynamicObject*>(this); else return nullptr; }
[[nodiscard]] DynamicObject const* ToDynObject() const { if (IsDynamicObject()) return reinterpret_cast<DynamicObject const*>(this); else return nullptr; }
[[nodiscard]] inline bool IsItem() const { return GetTypeId() == TYPEID_ITEM; }
virtual std::string GetDebugInfo() const;

View file

@ -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<PetLoadQueryHolder>(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();
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

File diff suppressed because it is too large Load diff

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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<uint8>(obj->GetTypeId()));
//ASSERT(obj->GetTypeId() == TYPEID_CORPSE);
//ASSERT(obj->IsCorpse());
obj->RemoveFromWorld();
obj->ResetMap();
}

View file

@ -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<Creature>(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<Player>(), MOTION_SLOT_CONTROLLED);
@ -305,16 +305,16 @@ void MotionMaster::MoveChase(Unit* target, std::optional<ChaseRange> 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<Player>(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<Creature>(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<Player>(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<Creature>(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<Player>(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<Player>(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<Player>(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<Player>(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<Player>(path_id, repeatable)):
Mutate(new WaypointMovementGenerator<Creature>(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)

View file

@ -85,7 +85,7 @@ bool ChaseMovementGenerator<T>::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<T>::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())
{

View file

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

View file

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

View file

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

View file

@ -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<float>(M_PI), target))
if (m_caster->IsPlayer() && (m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc(static_cast<float>(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);
}

View file

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

View file

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

View file

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

View file

@ -1130,7 +1130,7 @@ public:
return false;
}
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
{
if (handler->HasLowerSecurity(target->ToPlayer()))
{
@ -2659,7 +2659,7 @@ public:
return false;
}
handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUID().ToString());
handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->IsPlayer() ? "Player" : "Creature"), unit->GetGUID().ToString());
MotionMaster* motionMaster = unit->GetMotionMaster();
float x, y, z;
@ -2694,7 +2694,7 @@ public:
case CHASE_MOTION_TYPE:
{
Unit* target = nullptr;
if (unit->GetTypeId() == TYPEID_PLAYER)
if (unit->IsPlayer())
{
target = static_cast<ChaseMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
}
@ -2707,7 +2707,7 @@ public:
{
handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL);
}
else if (target->GetTypeId() == TYPEID_PLAYER)
else if (target->IsPlayer())
{
handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUID().ToString());
}
@ -2720,7 +2720,7 @@ public:
case FOLLOW_MOTION_TYPE:
{
Unit* target = nullptr;
if (unit->GetTypeId() == TYPEID_PLAYER)
if (unit->IsPlayer())
{
target = static_cast<FollowMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
}
@ -2733,7 +2733,7 @@ public:
{
handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL);
}
else if (target->GetTypeId() == TYPEID_PLAYER)
else if (target->IsPlayer())
{
handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUID().ToString());
}
@ -2809,7 +2809,7 @@ public:
return false;
}
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
{
if (handler->HasLowerSecurity(target->ToPlayer()))
{

View file

@ -355,7 +355,7 @@ public:
return false;
}
if (target->GetTypeId() == TYPEID_PLAYER)
if (target->IsPlayer())
{
// check online security
if (handler->HasLowerSecurity(target->ToPlayer()))
@ -370,7 +370,7 @@ public:
else if (target->IsPet())
{
Unit* owner = target->GetOwner();
if (owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet*)target)->IsPermanentPetFor(owner->ToPlayer()))
if (owner && owner->IsPlayer() && ((Pet*)target)->IsPermanentPetFor(owner->ToPlayer()))
{
// check online security
if (handler->HasLowerSecurity(owner->ToPlayer()))
@ -666,7 +666,7 @@ public:
}
// check online security
if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer()))
if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer()))
{
return false;
}
@ -843,7 +843,7 @@ public:
{
target = handler->GetSession()->GetPlayer();
}
else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer())) // check online security
else if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer())) // check online security
{
return false;
}
@ -860,7 +860,7 @@ public:
{
target = handler->GetSession()->GetPlayer();
}
else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer())) // check online security
else if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer())) // check online security
{
return false;
}
@ -873,7 +873,7 @@ public:
{
Player* target = handler->getSelectedPlayerOrSelf();
if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer())) // check online security
if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer())) // check online security
return false;
if (!target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).empty())
@ -892,7 +892,7 @@ public:
{
target = handler->GetSession()->GetPlayer();
}
else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer())) // check online security
else if (target->IsPlayer() && handler->HasLowerSecurity(target->ToPlayer())) // check online security
{
return false;
}

View file

@ -54,7 +54,7 @@ public:
Player* player = handler->GetSession()->GetPlayer();
Creature* creatureTarget = handler->getSelectedCreature();
if (!creatureTarget || creatureTarget->IsPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
if (!creatureTarget || creatureTarget->IsPet() || creatureTarget->IsPlayer())
{
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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