aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Conditions/DisableMgr.cpp2
-rw-r--r--src/server/game/Entities/Player/Player.cpp4
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp18
-rw-r--r--src/server/game/Handlers/PetHandler.cpp8
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp20
-rw-r--r--src/server/game/Spells/Spell.cpp4
-rw-r--r--src/server/game/Spells/SpellEffects.cpp4
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp2
8 files changed, 31 insertions, 31 deletions
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp
index fac8484e77f..6f77d2af66b 100644
--- a/src/server/game/Conditions/DisableMgr.cpp
+++ b/src/server/game/Conditions/DisableMgr.cpp
@@ -309,7 +309,7 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
if (unit)
{
if ((spellFlags & SPELL_DISABLE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) ||
- (unit->GetTypeId() == TYPEID_UNIT && ((unit->ToCreature()->IsPet() && spellFlags & SPELL_DISABLE_PET) || spellFlags & SPELL_DISABLE_CREATURE)))
+ (unit->GetTypeId() == TYPEID_UNIT && ((unit->IsPet() && spellFlags & SPELL_DISABLE_PET) || spellFlags & SPELL_DISABLE_CREATURE)))
{
if (spellFlags & SPELL_DISABLE_MAP)
{
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 02c6f98a48f..dec48712e03 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -22192,7 +22192,7 @@ inline void BeforeVisibilityDestroy(T* /*t*/, Player* /*p*/) { }
template<>
inline void BeforeVisibilityDestroy<Creature>(Creature* t, Player* p)
{
- if (p->GetPetGUID() == t->GetGUID() && t->ToCreature()->IsPet())
+ if (p->GetPetGUID() == t->GetGUID() && t->IsPet())
((Pet*)t)->Remove(PET_SAVE_NOT_IN_SLOT, true);
}
@@ -23593,7 +23593,7 @@ bool Player::isHonorOrXPTarget(Unit* victim) const
if (victim->GetTypeId() == TYPEID_UNIT)
{
if (victim->ToCreature()->IsTotem() ||
- victim->ToCreature()->IsPet() ||
+ victim->IsPet() ||
victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL)
return false;
}
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index d03deeaed0a..bec32e4c421 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -330,7 +330,7 @@ void Unit::Update(uint32 p_time)
SendThreatListUpdate();
// update combat timer only for players and pets (only pets with PetAI)
- if (IsInCombat() && (GetTypeId() == TYPEID_PLAYER || (ToCreature()->IsPet() && IsControlledByPlayer())))
+ if (IsInCombat() && (GetTypeId() == TYPEID_PLAYER || (IsPet() && IsControlledByPlayer())))
{
// Check UNIT_STATE_MELEE_ATTACKING or UNIT_STATE_CHASE (without UNIT_STATE_FOLLOW in this case) so pets can reach far away
// targets without stopping half way there and running off.
@@ -2131,8 +2131,8 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
// Max 40% chance to score a glancing blow against mobs that are higher level (can do only players and pets and not with ranged weapon)
if (attType != RANGED_ATTACK &&
- (GetTypeId() == TYPEID_PLAYER || ToCreature()->IsPet()) &&
- victim->GetTypeId() != TYPEID_PLAYER && !victim->ToCreature()->IsPet() &&
+ (GetTypeId() == TYPEID_PLAYER || IsPet()) &&
+ victim->GetTypeId() != TYPEID_PLAYER && !victim->IsPet() &&
getLevel() < victim->getLevelForTarget(this))
{
// cap possible value (with bonuses > max skill)
@@ -8984,7 +8984,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
//if (GetTypeId() == TYPEID_UNIT)
// ToCreature()->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
- if (GetTypeId() == TYPEID_UNIT && !ToCreature()->IsPet())
+ if (GetTypeId() == TYPEID_UNIT && !IsPet())
{
// should not let player enter combat by right clicking target - doesn't helps
SetInCombatWith(victim);
@@ -9726,7 +9726,7 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius)
if (GetTypeId() == TYPEID_PLAYER)
player = ToPlayer();
// Should we enable this also for charmed units?
- else if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsPet())
+ else if (GetTypeId() == TYPEID_UNIT && IsPet())
player = GetOwner()->ToPlayer();
if (!player)
@@ -10014,7 +10014,7 @@ float Unit::SpellDamagePctDone(Unit* victim, SpellInfo const* spellProto, Damage
float DoneTotalMod = 1.0f;
// Pet damage?
- if (GetTypeId() == TYPEID_UNIT && !ToCreature()->IsPet())
+ if (GetTypeId() == TYPEID_UNIT && !IsPet())
DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank);
AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
@@ -14518,7 +14518,7 @@ Player* Unit::GetSpellModOwner() const
if (Player* player = const_cast<Unit*>(this)->ToPlayer())
return player;
- if (ToCreature()->IsPet() || ToCreature()->IsTotem())
+ if (IsPet() || ToCreature()->IsTotem())
{
if (Unit* owner = GetOwner())
if (Player* player = owner->ToPlayer())
@@ -14789,7 +14789,7 @@ void Unit::ApplyCastTimePercentMod(float val, bool apply)
uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const
{
// Not apply this to creature cast spells with casttime == 0
- if (CastingTime == 0 && GetTypeId() == TYPEID_UNIT && !ToCreature()->IsPet())
+ if (CastingTime == 0 && GetTypeId() == TYPEID_UNIT && !IsPet())
return 3500;
if (CastingTime > 7000) CastingTime = 7000;
@@ -14889,7 +14889,7 @@ void Unit::UpdateAuraForGroup(uint8 slot)
player->SetAuraUpdateMaskForRaid(slot);
}
}
- else if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsPet())
+ else if (GetTypeId() == TYPEID_UNIT && IsPet())
{
Pet* pet = ((Pet*)this);
if (pet->isControlled())
diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp
index 0bf33eee234..0035ec1db85 100644
--- a/src/server/game/Handlers/PetHandler.cpp
+++ b/src/server/game/Handlers/PetHandler.cpp
@@ -217,7 +217,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
pet->ToCreature()->AI()->AttackStart(TargetUnit);
//10% chance to play special pet attack talk, else growl
- if (pet->ToCreature()->IsPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && urand(0, 100) < 10)
+ if (pet->IsPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && urand(0, 100) < 10)
pet->SendPetTalk((uint32)PET_TALK_ATTACK);
else
{
@@ -349,7 +349,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
//10% chance to play special pet attack talk, else growl
//actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell
- if (pet->ToCreature()->IsPet() && (((Pet*)pet)->getPetType() == SUMMON_PET) && (pet != unit_target) && (urand(0, 100) < 10))
+ if (pet->IsPet() && (((Pet*)pet)->getPetType() == SUMMON_PET) && (pet != unit_target) && (urand(0, 100) < 10))
pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);
else
{
@@ -555,7 +555,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData)
//sign for autocast
if (act_state == ACT_ENABLED)
{
- if (pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->IsPet())
+ if (pet->GetTypeId() == TYPEID_UNIT && pet->IsPet())
((Pet*)pet)->ToggleAutocast(spellInfo, true);
else
for (Unit::ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
@@ -565,7 +565,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData)
//sign for no/turn off autocast
else if (act_state == ACT_DISABLED)
{
- if (pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->IsPet())
+ if (pet->GetTypeId() == TYPEID_UNIT && pet->IsPet())
((Pet*)pet)->ToggleAutocast(spellInfo, false);
else
for (Unit::ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 2fe4b624164..9ba7a62e215 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -2799,7 +2799,7 @@ void AuraEffect::HandleModPossessPet(AuraApplication const* aurApp, uint8 mode,
// return;
Unit* target = aurApp->GetTarget();
- if (target->GetTypeId() != TYPEID_UNIT || !target->ToCreature()->IsPet())
+ if (target->GetTypeId() != TYPEID_UNIT || !target->IsPet())
return;
Pet* pet = target->ToPet();
@@ -3464,7 +3464,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->ToCreature()->IsPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
target->ApplyResistanceBuffModsMod(SpellSchools(x), GetAmount() > 0, (float)GetAmount(), apply);
}
}
@@ -3481,7 +3481,7 @@ void AuraEffect::HandleAuraModBaseResistancePCT(AuraApplication const* aurApp, u
if (target->GetTypeId() != TYPEID_PLAYER)
{
//pets only have base armor
- if (target->ToCreature()->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
+ if (target->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
target->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(GetAmount()), apply);
}
else
@@ -3518,7 +3518,7 @@ void AuraEffect::HandleModResistancePercent(AuraApplication const* aurApp, uint8
}
}
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(GetAmount()), apply);
- if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
{
target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, (float)GetAmount(), apply);
target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, (float)GetAmount(), apply);
@@ -3538,7 +3538,7 @@ void AuraEffect::HandleModBaseResistance(AuraApplication const* aurApp, uint8 mo
if (target->GetTypeId() != TYPEID_PLAYER)
{
//only pets have base stats
- if (target->ToCreature()->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
+ if (target->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
target->HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(GetAmount()), apply);
}
else
@@ -3595,13 +3595,13 @@ void AuraEffect::HandleAuraModStat(AuraApplication const* aurApp, uint8 mode, bo
if (spellGroupVal)
{
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(spellGroupVal), !apply);
- if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
target->ApplyStatBuffMod(Stats(i), float(spellGroupVal), !apply);
}
//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->ToCreature()->IsPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
target->ApplyStatBuffMod(Stats(i), (float)GetAmount(), apply);
}
}
@@ -3728,7 +3728,7 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8
if (GetMiscValue() == i || GetMiscValue() == -1) // affect the same stats
{
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(spellGroupVal), !apply);
- if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
target->ApplyStatPercentBuffMod(Stats(i), float(spellGroupVal), !apply);
}
}
@@ -3749,12 +3749,12 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8
if (spellGroupVal2)
{
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(spellGroupVal2), !apply);
- if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
target->ApplyStatPercentBuffMod(Stats(i), float(spellGroupVal2), !apply);
}
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(GetAmount()), apply);
- if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->IsPet())
+ if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
target->ApplyStatPercentBuffMod(Stats(i), float(GetAmount()), apply);
}
}
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index a8ff36a94b6..9edf07a4fd7 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -3773,7 +3773,7 @@ void Spell::SendSpellStart()
if (m_spellInfo->HasAttribute(SPELL_ATTR0_REQ_AMMO))
castFlags |= CAST_FLAG_AMMO;
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
- (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsPet()))
+ (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->IsPet()))
&& m_spellInfo->PowerType != POWER_HEALTH)
castFlags |= CAST_FLAG_POWER_LEFT_SELF;
@@ -3827,7 +3827,7 @@ void Spell::SendSpellGo()
castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
- (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsPet()))
+ (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->IsPet()))
&& m_spellInfo->PowerType != POWER_HEALTH)
castFlags |= CAST_FLAG_POWER_LEFT_SELF; // should only be sent to self, but the current messaging doesn't make that possible
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 69607b43785..2ede2657dbc 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -441,7 +441,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
// Shadow Bite
else if (m_spellInfo->SpellFamilyFlags[1] & 0x400000)
{
- if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsPet())
+ if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->IsPet())
{
if (Player* owner = m_caster->GetOwner()->ToPlayer())
{
@@ -5718,7 +5718,7 @@ void Spell::EffectRenamePet(SpellEffIndex /*effIndex*/)
return;
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT ||
- !unitTarget->ToCreature()->IsPet() || ((Pet*)unitTarget)->getPetType() != HUNTER_PET)
+ !unitTarget->IsPet() || ((Pet*)unitTarget)->getPetType() != HUNTER_PET)
return;
unitTarget->SetByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED);
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index 54d1f314140..9fd0260ed2e 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -421,7 +421,7 @@ public:
target->ToPlayer()->SendTalentsInfoData(false);
return true;
}
- else if (target->ToCreature()->IsPet())
+ else if (target->IsPet())
{
Unit* owner = target->GetOwner();
if (owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet*)target)->IsPermanentPetFor(owner->ToPlayer()))