mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-27 15:46:24 +00:00
refactor(Core): Make more use of helpers. (#19835)
* Init. * Reword. * Update codestyle script. Co-Authored-By: Kitzunu <24550914+Kitzunu@users.noreply.github.com> * Add gameobject type ID check, reorder checks. * Add helper/codestyle check for unit type. * `IsUnit()` -> `IsCreature()` * Add `IsUnit()` method. * Use type mask. https: //github.com/TrinityCore/TrinityCore/commit/cc71da35b5dc74abf71f8691161525a23d870bb5 Co-Authored-By: Giacomo Pozzoni <giacomopoz@gmail.com> Co-Authored-By: Ovahlord <18347559+Ovahlord@users.noreply.github.com> * Replace instances of `isType` with `IsUnit`. --------- Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Co-authored-by: Giacomo Pozzoni <giacomopoz@gmail.com> Co-authored-by: Ovahlord <18347559+Ovahlord@users.noreply.github.com>
This commit is contained in:
@@ -798,7 +798,7 @@ void AuraEffect::HandleEffect(Unit* target, uint8 mode, bool apply)
|
||||
|
||||
void AuraEffect::ApplySpellMod(Unit* target, bool apply)
|
||||
{
|
||||
if (!m_spellmod || target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_spellmod || !target->IsPlayer())
|
||||
return;
|
||||
|
||||
target->ToPlayer()->AddSpellMod(m_spellmod, apply);
|
||||
@@ -951,7 +951,7 @@ void AuraEffect::UpdatePeriodic(Unit* caster)
|
||||
case 49472: // Drink Coffee
|
||||
case 57073:
|
||||
case 61830:
|
||||
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!caster || !caster->IsPlayer())
|
||||
return;
|
||||
// Get SPELL_AURA_MOD_POWER_REGEN aura from spell
|
||||
if (AuraEffect* aurEff = GetBase()->GetEffect(0))
|
||||
@@ -1712,7 +1712,7 @@ void AuraEffect::HandleDetectAmore(AuraApplication const* aurApp, uint8 mode, bo
|
||||
}
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1744,7 +1744,7 @@ void AuraEffect::HandleSpiritOfRedemption(AuraApplication const* aurApp, uint8 m
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
// prepare spirit state
|
||||
@@ -1779,7 +1779,7 @@ void AuraEffect::HandleAuraGhost(AuraApplication const* aurApp, uint8 mode, bool
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
if (apply)
|
||||
@@ -2178,7 +2178,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode,
|
||||
// Orb of Deception
|
||||
case 16739:
|
||||
{
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
switch (target->getRace())
|
||||
@@ -2237,7 +2237,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode,
|
||||
// Corsair Costume
|
||||
case 51926:
|
||||
{
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
switch (target->getRace())
|
||||
@@ -2811,7 +2811,7 @@ void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, boo
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
if (Player* targetPlayer = target->ToPlayer())
|
||||
@@ -2842,7 +2842,7 @@ void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, boo
|
||||
if ((*iter)->GetCurrentSpell(i) && (*iter)->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == target->GetGUID())
|
||||
{
|
||||
SpellInfo const* si = (*iter)->GetCurrentSpell(i)->GetSpellInfo();
|
||||
if (si->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT) && (*iter)->GetTypeId() == TYPEID_UNIT)
|
||||
if (si->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT) && (*iter)->IsCreature())
|
||||
{
|
||||
Creature* c = (*iter)->ToCreature();
|
||||
if ((!c->IsPet() && c->GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS) || c->isWorldBoss() || c->IsDungeonBoss())
|
||||
@@ -3009,7 +3009,7 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode,
|
||||
if (apply)
|
||||
target->SetFlag(field, flag);
|
||||
|
||||
if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->GetCurrentEquipmentId())
|
||||
if (target->IsCreature() && target->ToCreature()->GetCurrentEquipmentId())
|
||||
target->UpdateDamagePhysical(attType);
|
||||
}
|
||||
|
||||
@@ -3112,7 +3112,7 @@ void AuraEffect::HandleAuraTrackCreatures(AuraApplication const* aurApp, uint8 m
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
if (apply)
|
||||
@@ -3128,7 +3128,7 @@ void AuraEffect::HandleAuraTrackResources(AuraApplication const* aurApp, uint8 m
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
if (apply)
|
||||
@@ -3144,7 +3144,7 @@ void AuraEffect::HandleAuraTrackStealthed(AuraApplication const* aurApp, uint8 m
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
if (!(apply))
|
||||
@@ -3206,7 +3206,7 @@ void AuraEffect::HandleAuraModPetTalentsPoints(AuraApplication const* aurApp, ui
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
// Recalculate pet talent points
|
||||
@@ -3220,7 +3220,7 @@ void AuraEffect::HandleAuraModSkill(AuraApplication const* aurApp, uint8 mode, b
|
||||
return;
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
uint32 prot = GetMiscValue();
|
||||
@@ -3318,7 +3318,7 @@ void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode
|
||||
|
||||
target->SetCanFly(apply);
|
||||
|
||||
if (!apply && target->GetTypeId() == TYPEID_UNIT && !target->IsLevitating())
|
||||
if (!apply && target->IsCreature() && !target->IsLevitating())
|
||||
target->GetMotionMaster()->MoveFall();
|
||||
}
|
||||
|
||||
@@ -3444,7 +3444,7 @@ void AuraEffect::HandleAuraModTotalThreat(AuraApplication const* aurApp, uint8 m
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (!target->IsAlive() || target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsAlive() || !target->IsPlayer())
|
||||
return;
|
||||
|
||||
Unit* caster = GetCaster();
|
||||
@@ -3547,7 +3547,7 @@ void AuraEffect::HandleModPossess(AuraApplication const* aurApp, uint8 mode, boo
|
||||
Unit* caster = GetCaster();
|
||||
|
||||
// no support for posession AI yet
|
||||
if (caster && caster->GetTypeId() == TYPEID_UNIT)
|
||||
if (caster && caster->IsCreature())
|
||||
{
|
||||
HandleModCharm(aurApp, mode, apply);
|
||||
return;
|
||||
@@ -3567,7 +3567,7 @@ void AuraEffect::HandleModPossessPet(AuraApplication const* aurApp, uint8 mode,
|
||||
return;
|
||||
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!caster || !caster->IsPlayer())
|
||||
return;
|
||||
|
||||
//seems it may happen that when removing it is no longer owner's pet
|
||||
@@ -3575,7 +3575,7 @@ void AuraEffect::HandleModPossessPet(AuraApplication const* aurApp, uint8 mode,
|
||||
// return;
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
if (target->GetTypeId() != TYPEID_UNIT || !target->IsPet())
|
||||
if (!target->IsCreature() || !target->IsPet())
|
||||
return;
|
||||
|
||||
Pet* pet = target->ToPet();
|
||||
@@ -3675,7 +3675,7 @@ void AuraEffect::HandleAuraControlVehicle(AuraApplication const* aurApp, uint8 m
|
||||
if (GetId() == 53111) // Devour Humanoid
|
||||
{
|
||||
Unit::Kill(target, caster);
|
||||
if (caster->GetTypeId() == TYPEID_UNIT)
|
||||
if (caster->IsCreature())
|
||||
caster->ToCreature()->RemoveCorpse();
|
||||
}
|
||||
|
||||
@@ -3725,7 +3725,7 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp,
|
||||
{
|
||||
target->SetCanFly(apply);
|
||||
|
||||
if (!apply && target->GetTypeId() == TYPEID_UNIT && !target->IsLevitating())
|
||||
if (!apply && target->IsCreature() && !target->IsLevitating())
|
||||
target->GetMotionMaster()->MoveFall();
|
||||
}
|
||||
|
||||
@@ -4464,8 +4464,8 @@ void AuraEffect::HandleModPercentStat(AuraApplication const* aurApp, uint8 mode,
|
||||
return;
|
||||
}
|
||||
|
||||
// only players have base stats
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
// only players currently use base stats
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
|
||||
@@ -4482,7 +4482,7 @@ void AuraEffect::HandleModSpellDamagePercentFromStat(AuraApplication const* aurA
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
// Magic damage modifiers implemented in Unit::SpellDamageBonus
|
||||
@@ -4498,7 +4498,7 @@ void AuraEffect::HandleModSpellHealingPercentFromStat(AuraApplication const* aur
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
// Recalculate bonus
|
||||
@@ -4512,7 +4512,7 @@ void AuraEffect::HandleModSpellDamagePercentFromAttackPower(AuraApplication cons
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
// Magic damage modifiers implemented in Unit::SpellDamageBonus
|
||||
@@ -4528,7 +4528,7 @@ void AuraEffect::HandleModSpellHealingPercentFromAttackPower(AuraApplication con
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
// Recalculate bonus
|
||||
@@ -4542,7 +4542,7 @@ void AuraEffect::HandleModHealingDone(AuraApplication const* aurApp, uint8 mode,
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
// implemented in Unit::SpellHealingBonus
|
||||
// this information is for client side only
|
||||
@@ -4613,7 +4613,7 @@ void AuraEffect::HandleAuraModResistenceOfStatPercent(AuraApplication const* aur
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
if (GetMiscValue() != SPELL_SCHOOL_MASK_NORMAL)
|
||||
@@ -4635,7 +4635,7 @@ void AuraEffect::HandleAuraModExpertise(AuraApplication const* aurApp, uint8 mod
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
target->ToPlayer()->UpdateExpertise(BASE_ATTACK);
|
||||
@@ -4652,7 +4652,7 @@ void AuraEffect::HandleModPowerRegen(AuraApplication const* aurApp, uint8 mode,
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
// Update manaregen value
|
||||
@@ -4675,7 +4675,7 @@ void AuraEffect::HandleModManaRegen(AuraApplication const* aurApp, uint8 mode, b
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
//Note: an increase in regen does NOT cause threat.
|
||||
@@ -4815,7 +4815,7 @@ void AuraEffect::HandleAuraModParryPercent(AuraApplication const* aurApp, uint8
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
if (!target->ToPlayer()->CanParry())
|
||||
@@ -4831,7 +4831,7 @@ void AuraEffect::HandleAuraModDodgePercent(AuraApplication const* aurApp, uint8
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
target->ToPlayer()->UpdateDodgePercentage();
|
||||
@@ -4844,7 +4844,7 @@ void AuraEffect::HandleAuraModBlockPercent(AuraApplication const* aurApp, uint8
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
target->ToPlayer()->UpdateBlockPercentage();
|
||||
@@ -4862,7 +4862,7 @@ void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const* aurApp, u
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
for (int i = 0; i < MAX_ATTACK; ++i)
|
||||
@@ -4937,7 +4937,7 @@ void AuraEffect::HandleModSpellCritChanceShool(AuraApplication const* aurApp, ui
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school)
|
||||
@@ -4952,7 +4952,7 @@ void AuraEffect::HandleAuraModCritPct(AuraApplication const* aurApp, uint8 mode,
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
{
|
||||
target->m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount();
|
||||
return;
|
||||
@@ -5051,7 +5051,7 @@ void AuraEffect::HandleRangedAmmoHaste(AuraApplication const* aurApp, uint8 mode
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
|
||||
@@ -5068,7 +5068,7 @@ void AuraEffect::HandleModRating(AuraApplication const* aurApp, uint8 mode, bool
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
|
||||
@@ -5083,7 +5083,7 @@ void AuraEffect::HandleModRatingFromStat(AuraApplication const* aurApp, uint8 mo
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
// Just recalculate ratings
|
||||
@@ -5202,7 +5202,7 @@ void AuraEffect::HandleModDamageDone(AuraApplication const* aurApp, uint8 mode,
|
||||
if ((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) != 0 && sScriptMgr->CanModAuraEffectDamageDone(this, target, aurApp, mode, apply))
|
||||
{
|
||||
// apply generic physical damage bonuses including wand case
|
||||
if (GetSpellInfo()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (GetSpellInfo()->EquippedItemClass == -1 || !target->IsPlayer())
|
||||
{
|
||||
target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, float(GetAmount()), apply);
|
||||
target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(GetAmount()), apply);
|
||||
@@ -5279,7 +5279,7 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8
|
||||
target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(item, WeaponAttackType(i), this, apply);
|
||||
}
|
||||
|
||||
if ((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) && (GetSpellInfo()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER))
|
||||
if ((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) && (GetSpellInfo()->EquippedItemClass == -1 || !target->IsPlayer()))
|
||||
{
|
||||
target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, float(GetAmount()), apply);
|
||||
target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(GetAmount()), apply);
|
||||
@@ -5373,7 +5373,7 @@ void AuraEffect::HandleNoReagentUseAura(AuraApplication const* aurApp, uint8 mod
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
flag96 mask;
|
||||
@@ -5393,7 +5393,7 @@ void AuraEffect::HandleAuraRetainComboPoints(AuraApplication const* aurApp, uint
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
// combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
|
||||
@@ -5609,7 +5609,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
|
||||
break;
|
||||
case 43681: // Inactive
|
||||
{
|
||||
if (target->GetTypeId() != TYPEID_PLAYER || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
|
||||
if (!target->IsPlayer() || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
|
||||
return;
|
||||
|
||||
if (target->GetMap()->IsBattleground())
|
||||
@@ -5643,7 +5643,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
|
||||
break;
|
||||
case 46374: // quest The Power of the Elements (11893)
|
||||
{
|
||||
if (target->isDead() && GetBase() && target->GetTypeId() == TYPEID_UNIT && target->GetEntry() == 24601)
|
||||
if (target->isDead() && GetBase() && target->IsCreature() && target->GetEntry() == 24601)
|
||||
{
|
||||
auto caster2 = GetBase()->GetCaster();
|
||||
if (caster2 && caster2->IsPlayer())
|
||||
@@ -5716,7 +5716,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
|
||||
case 57821: // Champion of the Kirin Tor
|
||||
case 57822: // Wyrmrest Champion
|
||||
{
|
||||
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!caster || !caster->IsPlayer())
|
||||
break;
|
||||
|
||||
uint32 FactionID = 0;
|
||||
@@ -5860,7 +5860,7 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod
|
||||
|
||||
Unit* caster = GetCaster();
|
||||
|
||||
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!caster || !caster->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* plCaster = caster->ToPlayer();
|
||||
@@ -5904,7 +5904,7 @@ void AuraEffect::HandleBindSight(AuraApplication const* aurApp, uint8 mode, bool
|
||||
|
||||
Unit* caster = GetCaster();
|
||||
|
||||
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!caster || !caster->IsPlayer())
|
||||
return;
|
||||
|
||||
caster->ToPlayer()->SetViewpoint(target, apply);
|
||||
@@ -5918,7 +5918,7 @@ void AuraEffect::HandleFarSight(AuraApplication const* /*aurApp*/, uint8 mode, b
|
||||
}
|
||||
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!caster || !caster->IsPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -5943,7 +5943,7 @@ void AuraEffect::HandleForceReaction(AuraApplication const* aurApp, uint8 mode,
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* player = target->ToPlayer();
|
||||
@@ -6023,7 +6023,7 @@ void AuraEffect::HandleAuraConvertRune(AuraApplication const* aurApp, uint8 mode
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* player = target->ToPlayer();
|
||||
@@ -6095,7 +6095,7 @@ void AuraEffect::HandleAuraOpenStable(AuraApplication const* aurApp, uint8 mode,
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER || !target->IsInWorld())
|
||||
if (!target->IsPlayer() || !target->IsInWorld())
|
||||
return;
|
||||
|
||||
if (apply)
|
||||
@@ -6154,7 +6154,7 @@ void AuraEffect::HandleAuraSetVehicle(AuraApplication const* aurApp, uint8 mode,
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER || !target->IsInWorld())
|
||||
if (!target->IsPlayer() || !target->IsInWorld())
|
||||
return;
|
||||
|
||||
uint32 vehicleId = GetMiscValue();
|
||||
@@ -6184,7 +6184,7 @@ void AuraEffect::HandlePreventResurrection(AuraApplication const* aurApp, uint8
|
||||
if (!(mode & AURA_EFFECT_HANDLE_REAL))
|
||||
return;
|
||||
|
||||
if (aurApp->GetTarget()->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!aurApp->GetTarget()->IsPlayer())
|
||||
return;
|
||||
|
||||
if (apply)
|
||||
@@ -6270,7 +6270,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
|
||||
// Death Rune Mastery
|
||||
if (GetSpellInfo()->SpellIconID == 3041 || GetSpellInfo()->SpellIconID == 22 || GetSpellInfo()->SpellIconID == 2622)
|
||||
{
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
return;
|
||||
if (!target->ToPlayer()->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY))
|
||||
return;
|
||||
@@ -6355,7 +6355,7 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
|
||||
return;
|
||||
// Inoculate Nestlewood Owlkin
|
||||
case 29528:
|
||||
if (target->GetTypeId() != TYPEID_UNIT) // prevent error reports in case ignored player target
|
||||
if (!target->IsCreature()) // prevent error reports in case ignored player target
|
||||
return;
|
||||
break;
|
||||
// Feed Captured Animal
|
||||
@@ -6367,7 +6367,7 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
|
||||
{
|
||||
// move loot to player inventory and despawn target
|
||||
if (caster && caster->IsPlayer() &&
|
||||
target->GetTypeId() == TYPEID_UNIT &&
|
||||
target->IsCreature() &&
|
||||
target->ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_GAS_CLOUD)
|
||||
{
|
||||
Player* player = caster->ToPlayer();
|
||||
|
||||
@@ -380,7 +380,7 @@ Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne
|
||||
casterGUID = caster->GetGUID();
|
||||
|
||||
// check if aura can be owned by owner
|
||||
if (owner->isType(TYPEMASK_UNIT))
|
||||
if (owner->IsUnit())
|
||||
if (!owner->IsInWorld() || ((Unit*)owner)->IsDuringRemoveFromWorld())
|
||||
// owner not in world so don't allow to own not self casted single target auras
|
||||
if (casterGUID != owner->GetGUID() && spellproto->IsSingleTarget())
|
||||
@@ -1789,7 +1789,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
|
||||
{
|
||||
if (removeMode != AURA_REMOVE_BY_EXPIRE)
|
||||
break;
|
||||
if (caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!caster->IsPlayer())
|
||||
break;
|
||||
|
||||
Player* player = caster->ToPlayer();
|
||||
@@ -1860,7 +1860,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
|
||||
{
|
||||
if (!GetEffect(0) || GetEffect(0)->GetAuraType() != SPELL_AURA_PERIODIC_DUMMY)
|
||||
break;
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!target->IsPlayer())
|
||||
break;
|
||||
if (!target->ToPlayer()->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY))
|
||||
break;
|
||||
|
||||
@@ -743,7 +743,7 @@ void Spell::InitExplicitTargets(SpellCastTargets const& targets)
|
||||
unit = selectedUnit;
|
||||
}
|
||||
// try to use attacked unit as a target
|
||||
else if ((m_caster->GetTypeId() == TYPEID_UNIT) && neededTargets & (TARGET_FLAG_UNIT_ENEMY | TARGET_FLAG_UNIT))
|
||||
else if ((m_caster->IsCreature()) && neededTargets & (TARGET_FLAG_UNIT_ENEMY | TARGET_FLAG_UNIT))
|
||||
unit = m_caster->GetVictim();
|
||||
|
||||
// didn't find anything - let's use self as target
|
||||
@@ -1788,7 +1788,7 @@ void Spell::SelectImplicitCasterObjectTargets(SpellEffIndex effIndex, SpellImpli
|
||||
case TARGET_UNIT_PASSENGER_5:
|
||||
case TARGET_UNIT_PASSENGER_6:
|
||||
case TARGET_UNIT_PASSENGER_7:
|
||||
if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsVehicle())
|
||||
if (m_caster->IsCreature() && m_caster->ToCreature()->IsVehicle())
|
||||
target = m_caster->GetVehicleKit()->GetPassenger(targetType.GetTarget() - TARGET_UNIT_PASSENGER_0);
|
||||
break;
|
||||
default:
|
||||
@@ -2365,7 +2365,7 @@ void Spell::prepareDataForTriggerSystem(AuraEffect const* /*triggeredByAura*/)
|
||||
m_procEx |= PROC_EX_INTERNAL_TRIGGERED;
|
||||
}
|
||||
// Totem casts require spellfamilymask defined in spell_proc_event to proc
|
||||
if (m_originalCaster && m_caster != m_originalCaster && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsTotem() && m_caster->IsControlledByPlayer())
|
||||
if (m_originalCaster && m_caster != m_originalCaster && m_caster->IsCreature() && m_caster->ToCreature()->IsTotem() && m_caster->IsControlledByPlayer())
|
||||
m_procEx |= PROC_EX_INTERNAL_REQ_FAMILY;
|
||||
}
|
||||
|
||||
@@ -2692,7 +2692,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
|
||||
{
|
||||
spellHitTarget = m_caster;
|
||||
unitTarget = m_caster;
|
||||
if (m_caster->GetTypeId() == TYPEID_UNIT)
|
||||
if (m_caster->IsCreature())
|
||||
m_caster->ToCreature()->LowerPlayerDamageReq(target->damage);
|
||||
}
|
||||
}
|
||||
@@ -2919,7 +2919,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
|
||||
}
|
||||
|
||||
// Failed Pickpocket, reveal rogue
|
||||
if (missInfo == SPELL_MISS_RESIST && m_spellInfo->HasAttribute(SPELL_ATTR0_CU_PICKPOCKET) && unitTarget->GetTypeId() == TYPEID_UNIT && m_caster)
|
||||
if (missInfo == SPELL_MISS_RESIST && m_spellInfo->HasAttribute(SPELL_ATTR0_CU_PICKPOCKET) && unitTarget->IsCreature() && m_caster)
|
||||
{
|
||||
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK);
|
||||
if (unitTarget->ToCreature()->IsAIEnabled)
|
||||
@@ -2965,19 +2965,19 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
|
||||
}
|
||||
|
||||
// Check for SPELL_ATTR7_CAN_CAUSE_INTERRUPT
|
||||
if (m_spellInfo->HasAttribute(SPELL_ATTR7_CAN_CAUSE_INTERRUPT) && effectUnit->GetTypeId() != TYPEID_PLAYER)
|
||||
if (m_spellInfo->HasAttribute(SPELL_ATTR7_CAN_CAUSE_INTERRUPT) && !effectUnit->IsPlayer())
|
||||
caster->CastSpell(effectUnit, SPELL_INTERRUPT_NONPLAYER, true);
|
||||
|
||||
if (spellHitTarget)
|
||||
{
|
||||
//AI functions
|
||||
if (spellHitTarget->GetTypeId() == TYPEID_UNIT)
|
||||
if (spellHitTarget->IsCreature())
|
||||
{
|
||||
if (spellHitTarget->ToCreature()->IsAIEnabled)
|
||||
spellHitTarget->ToCreature()->AI()->SpellHit(m_caster, m_spellInfo);
|
||||
}
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsAIEnabled)
|
||||
if (m_caster->IsCreature() && m_caster->ToCreature()->IsAIEnabled)
|
||||
m_caster->ToCreature()->AI()->SpellHitTarget(spellHitTarget, m_spellInfo);
|
||||
|
||||
// Needs to be called after dealing damage/healing to not remove breaking on damage auras
|
||||
@@ -3053,7 +3053,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
|
||||
// Xinef: Also check evade state
|
||||
if (m_spellInfo->Speed > 0.0f)
|
||||
{
|
||||
if (unit->GetTypeId() == TYPEID_UNIT && unit->ToCreature()->IsInEvadeMode())
|
||||
if (unit->IsCreature() && unit->ToCreature()->IsInEvadeMode())
|
||||
return SPELL_MISS_EVADE;
|
||||
|
||||
if (unit->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE) && unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID())
|
||||
@@ -3101,12 +3101,12 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
|
||||
// Xinef: Do not increase diminishing level for self cast
|
||||
m_diminishGroup = GetDiminishingReturnsGroupForSpell(m_spellInfo, m_triggeredByAuraSpell.spellInfo);
|
||||
// xinef: do not increase diminish level for bosses (eg. Void Reaver silence is never diminished)
|
||||
if (((m_spellFlags & SPELL_FLAG_REFLECTED) && !(unit->HasAuraType(SPELL_AURA_REFLECT_SPELLS))) || (aura_effmask && m_diminishGroup && unit != m_caster && (m_caster->GetTypeId() != TYPEID_UNIT || !m_caster->ToCreature()->isWorldBoss())))
|
||||
if (((m_spellFlags & SPELL_FLAG_REFLECTED) && !(unit->HasAuraType(SPELL_AURA_REFLECT_SPELLS))) || (aura_effmask && m_diminishGroup && unit != m_caster && (!m_caster->IsCreature() || !m_caster->ToCreature()->isWorldBoss())))
|
||||
{
|
||||
m_diminishLevel = unit->GetDiminishing(m_diminishGroup);
|
||||
DiminishingReturnsType type = GetDiminishingReturnsGroupType(m_diminishGroup);
|
||||
|
||||
uint32 flagsExtra = unit->GetTypeId() == TYPEID_UNIT ? unit->ToCreature()->GetCreatureTemplate()->flags_extra : 0;
|
||||
uint32 flagsExtra = unit->IsCreature() ? unit->ToCreature()->GetCreatureTemplate()->flags_extra : 0;
|
||||
|
||||
// Increase Diminishing on unit, current informations for actually casts will use values above
|
||||
if ((type == DRTYPE_PLAYER && (unit->IsCharmedOwnedByPlayerOrPlayer() || flagsExtra & CREATURE_FLAG_EXTRA_ALL_DIMINISH ||
|
||||
@@ -3685,7 +3685,7 @@ SpellCastResult Spell::prepare(SpellCastTargets const* targets, AuraEffect const
|
||||
// set target for proper facing
|
||||
if ((m_casttime || m_spellInfo->IsChanneled()) && !HasTriggeredCastFlag(TRIGGERED_IGNORE_SET_FACING))
|
||||
{
|
||||
if (m_caster->GetTypeId() == TYPEID_UNIT && !m_caster->ToCreature()->IsInEvadeMode() &&
|
||||
if (m_caster->IsCreature() && !m_caster->ToCreature()->IsInEvadeMode() &&
|
||||
((m_targets.GetObjectTarget() && m_caster != m_targets.GetObjectTarget()) || m_spellInfo->IsPositive()))
|
||||
{
|
||||
// Xinef: Creature should focus to cast target if there is explicit target or self if casting positive spell
|
||||
@@ -3838,14 +3838,14 @@ void Spell::_cast(bool skipCheck)
|
||||
if (!playerCaster->m_Controlled.empty())
|
||||
for (Unit::ControlSet::iterator itr = playerCaster->m_Controlled.begin(); itr != playerCaster->m_Controlled.end(); ++itr)
|
||||
if (Unit* pet = *itr)
|
||||
if (pet->IsAlive() && pet->GetTypeId() == TYPEID_UNIT)
|
||||
if (pet->IsAlive() && pet->IsCreature())
|
||||
pet->ToCreature()->AI()->OwnerAttacked(m_targets.GetUnitTarget());
|
||||
}
|
||||
|
||||
SetExecutedCurrently(true);
|
||||
|
||||
if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_SET_FACING))
|
||||
if (m_caster->GetTypeId() == TYPEID_UNIT && m_targets.GetObjectTarget() && m_caster != m_targets.GetObjectTarget())
|
||||
if (m_caster->IsCreature() && m_targets.GetObjectTarget() && m_caster != m_targets.GetObjectTarget())
|
||||
m_caster->SetInFront(m_targets.GetObjectTarget());
|
||||
|
||||
CallScriptBeforeCastHandlers();
|
||||
@@ -4087,7 +4087,7 @@ void Spell::_cast(bool skipCheck)
|
||||
// handle this here, in other places SpellHitTarget can be set to nullptr, if there is an error in this function
|
||||
if (m_spellInfo->HasAttribute(SPELL_ATTR7_CAN_CAUSE_INTERRUPT))
|
||||
if (Unit* target = m_targets.GetUnitTarget())
|
||||
if (target->GetTypeId() == TYPEID_UNIT)
|
||||
if (target->IsCreature())
|
||||
m_caster->CastSpell(target, 32747, true);
|
||||
|
||||
// xinef: start combat at cast for delayed spells, only for explicit target
|
||||
@@ -4346,7 +4346,7 @@ void Spell::_handle_finish_phase()
|
||||
void Spell::SendSpellCooldown()
|
||||
{
|
||||
// xinef: properly add creature cooldowns
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
{
|
||||
if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD))
|
||||
{
|
||||
@@ -4489,7 +4489,7 @@ void Spell::finish(bool ok)
|
||||
if (m_spellInfo->IsChanneled() && m_caster->IsPlayer())
|
||||
{
|
||||
if (Unit* charm = m_caster->GetCharm())
|
||||
if (charm->GetTypeId() == TYPEID_UNIT
|
||||
if (charm->IsCreature()
|
||||
&& charm->ToCreature()->HasUnitTypeMask(UNIT_MASK_PUPPET)
|
||||
&& charm->GetUInt32Value(UNIT_CREATED_BY_SPELL) == m_spellInfo->Id)
|
||||
((Puppet*)charm)->UnSummon();
|
||||
@@ -4521,7 +4521,7 @@ void Spell::finish(bool ok)
|
||||
if (m_spellInfo->HasAttribute(SPELL_ATTR0_CU_ENCOUNTER_REWARD) && m_caster->FindMap())
|
||||
m_caster->FindMap()->UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, m_spellInfo->Id, m_caster);
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsSummon())
|
||||
if (m_caster->IsCreature() && m_caster->ToCreature()->IsSummon())
|
||||
{
|
||||
// Unsummon statue
|
||||
uint32 spell = m_caster->GetUInt32Value(UNIT_CREATED_BY_SPELL);
|
||||
@@ -4673,7 +4673,7 @@ void Spell::SendCastResult(SpellCastResult result)
|
||||
if (result == SPELL_CAST_OK)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER || m_caster->IsCharmed())
|
||||
if (!m_caster->IsPlayer() || m_caster->IsCharmed())
|
||||
return;
|
||||
|
||||
if (m_caster->ToPlayer()->GetSession()->PlayerLoading()) // don't send cast results at loading time
|
||||
@@ -5242,7 +5242,7 @@ void Spell::SendResurrectRequest(Player* target)
|
||||
|
||||
void Spell::TakeCastItem()
|
||||
{
|
||||
if (!m_CastItem || m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_CastItem || !m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
// not remove cast item at triggered spell (equipping, weapon damage, etc)
|
||||
@@ -5401,7 +5401,7 @@ SpellCastResult Spell::CheckRuneCost(uint32 RuneCostID)
|
||||
if (m_spellInfo->PowerType != POWER_RUNE || !RuneCostID)
|
||||
return SPELL_CAST_OK;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return SPELL_CAST_OK;
|
||||
|
||||
Player* player = m_caster->ToPlayer();
|
||||
@@ -5452,7 +5452,7 @@ SpellCastResult Spell::CheckRuneCost(uint32 RuneCostID)
|
||||
|
||||
void Spell::TakeRunePower(bool didHit)
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER || !m_caster->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY))
|
||||
if (!m_caster->IsPlayer() || !m_caster->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY))
|
||||
return;
|
||||
|
||||
SpellRuneCostEntry const* runeCostData = sSpellRuneCostStore.LookupEntry(m_spellInfo->RuneCostID);
|
||||
@@ -5521,7 +5521,7 @@ void Spell::TakeRunePower(bool didHit)
|
||||
|
||||
void Spell::TakeReagents()
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
ItemTemplate const* castItemTemplate = m_CastItem ? m_CastItem->GetTemplate() : nullptr;
|
||||
@@ -5680,7 +5680,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if (m_caster->ToPlayer()->GetLastPotionId() && m_CastItem && (m_CastItem->IsPotion() || m_spellInfo->IsCooldownStartedOnEvent()))
|
||||
return SPELL_FAILED_NOT_READY;
|
||||
}
|
||||
else if (!IsTriggered() && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsSpellProhibited(m_spellInfo->GetSchoolMask()))
|
||||
else if (!IsTriggered() && m_caster->IsCreature() && m_caster->ToCreature()->IsSpellProhibited(m_spellInfo->GetSchoolMask()))
|
||||
return SPELL_FAILED_NOT_READY;
|
||||
}
|
||||
|
||||
@@ -5987,7 +5987,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
return SPELL_FAILED_NOT_IN_ARENA;
|
||||
|
||||
// zone check
|
||||
if (m_caster->GetTypeId() == TYPEID_UNIT || !m_caster->ToPlayer()->IsGameMaster())
|
||||
if (m_caster->IsCreature() || !m_caster->ToPlayer()->IsGameMaster())
|
||||
{
|
||||
uint32 zone, area;
|
||||
m_caster->GetZoneAndAreaId(zone, area);
|
||||
@@ -6114,7 +6114,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
{
|
||||
case SPELL_EFFECT_LEARN_SPELL:
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
if (m_spellInfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_PET)
|
||||
@@ -6140,7 +6140,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
// check target only for unit target case
|
||||
if (Unit* unitTarget = m_targets.GetUnitTarget())
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
Pet* pet = unitTarget->ToPet();
|
||||
@@ -6167,7 +6167,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
}
|
||||
case SPELL_EFFECT_FEED_PET:
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
Item* foodItem = m_targets.GetItemTarget();
|
||||
@@ -6260,7 +6260,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
}
|
||||
case SPELL_EFFECT_SKINNING:
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER || !m_targets.GetUnitTarget() || m_targets.GetUnitTarget()->GetTypeId() != TYPEID_UNIT)
|
||||
if (!m_caster->IsPlayer() || !m_targets.GetUnitTarget() || !m_targets.GetUnitTarget()->IsCreature())
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
if (!(m_targets.GetUnitTarget()->GetUnitFlags() & UNIT_FLAG_SKINNABLE))
|
||||
@@ -6286,7 +6286,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
m_spellInfo->Effects[i].TargetA.GetTarget() != TARGET_GAMEOBJECT_ITEM_TARGET)
|
||||
break;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER // only players can open locks, gather etc.
|
||||
if (!m_caster->IsPlayer() // only players can open locks, gather etc.
|
||||
// we need a go target in case of TARGET_GAMEOBJECT_TARGET
|
||||
|| (m_spellInfo->Effects[i].TargetA.GetTarget() == TARGET_GAMEOBJECT_TARGET && !m_targets.GetGOTarget()))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
@@ -6410,7 +6410,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
{
|
||||
if (m_targets.GetUnitTarget())
|
||||
{
|
||||
if (m_targets.GetUnitTarget()->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_targets.GetUnitTarget()->IsPlayer())
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
if (m_targets.GetUnitTarget()->GetPetGUID())
|
||||
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
|
||||
@@ -6472,7 +6472,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
}
|
||||
case SPELL_EFFECT_SUMMON_PLAYER:
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
if (!m_caster->GetTarget())
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
@@ -6507,7 +6507,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
// RETURN HERE
|
||||
case SPELL_EFFECT_SUMMON_RAF_FRIEND:
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
Player* playerCaster = m_caster->ToPlayer();
|
||||
@@ -6602,7 +6602,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
break;
|
||||
case SPELL_AURA_MOD_POSSESS_PET:
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return SPELL_FAILED_NO_PET;
|
||||
|
||||
Pet* pet = m_caster->ToPlayer()->GetPet();
|
||||
@@ -6637,7 +6637,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
|
||||
if (Unit* target = m_targets.GetUnitTarget())
|
||||
{
|
||||
if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsVehicle())
|
||||
if (target->IsCreature() && target->ToCreature()->IsVehicle())
|
||||
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
|
||||
|
||||
if (target->IsMounted())
|
||||
@@ -6719,7 +6719,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if (m_spellInfo->Effects[i].IsTargetingArea())
|
||||
break;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER || m_CastItem)
|
||||
if (!m_caster->IsPlayer() || m_CastItem)
|
||||
break;
|
||||
|
||||
if (!m_targets.GetUnitTarget())
|
||||
@@ -6757,7 +6757,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if (m_CastItem)
|
||||
return SPELL_FAILED_ITEM_ENCHANT_TRADE_WINDOW;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return SPELL_FAILED_NOT_TRADING;
|
||||
|
||||
TradeData* my_trade = m_caster->ToPlayer()->GetTradeData();
|
||||
@@ -7058,7 +7058,7 @@ SpellCastResult Spell::CheckRange(bool strict)
|
||||
float min_range = m_caster->GetSpellMinRangeForTarget(target, m_spellInfo);
|
||||
|
||||
// xinef: hack for npc shooters
|
||||
if (min_range && GetCaster()->GetTypeId() == TYPEID_UNIT && !GetCaster()->GetOwnerGUID().IsPlayer() && min_range <= 6.0f)
|
||||
if (min_range && GetCaster()->IsCreature() && !GetCaster()->GetOwnerGUID().IsPlayer() && min_range <= 6.0f)
|
||||
range_type = SPELL_RANGE_RANGED;
|
||||
|
||||
if (Player* modOwner = m_caster->GetSpellModOwner())
|
||||
@@ -7076,7 +7076,7 @@ SpellCastResult Spell::CheckRange(bool strict)
|
||||
if (range_type == SPELL_RANGE_MELEE)
|
||||
{
|
||||
float real_max_range = max_range;
|
||||
if (m_caster->GetTypeId() != TYPEID_UNIT && m_caster->isMoving() && target->isMoving() && !m_caster->IsWalking() && !target->IsWalking())
|
||||
if (!m_caster->IsCreature() && m_caster->isMoving() && target->isMoving() && !m_caster->IsWalking() && !target->IsWalking())
|
||||
real_max_range -= MIN_MELEE_REACH; // Because of lag, we can not check too strictly here (is only used if both caster and target are moving)
|
||||
else
|
||||
real_max_range -= 2 * MIN_MELEE_REACH;
|
||||
@@ -7255,7 +7255,7 @@ SpellCastResult Spell::CheckItems()
|
||||
// check target item
|
||||
if (m_targets.GetItemTargetGUID())
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
if (!m_targets.GetItemTarget())
|
||||
@@ -7606,7 +7606,7 @@ SpellCastResult Spell::CheckItems()
|
||||
case SPELL_EFFECT_WEAPON_DAMAGE:
|
||||
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return SPELL_FAILED_TARGET_NOT_PLAYER;
|
||||
|
||||
if (m_attackType != RANGED_ATTACK)
|
||||
@@ -7760,7 +7760,7 @@ SpellCastResult Spell::CheckSpellFocus()
|
||||
|
||||
void Spell::Delayed() // only called in DealDamage()
|
||||
{
|
||||
if (!m_caster)// || m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster)// || !m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
//if (m_spellState == SPELL_STATE_DELAYED)
|
||||
@@ -7805,7 +7805,7 @@ void Spell::Delayed() // only called in DealDamage()
|
||||
|
||||
void Spell::DelayedChannel()
|
||||
{
|
||||
if (!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER || getState() != SPELL_STATE_CASTING)
|
||||
if (!m_caster || !m_caster->IsPlayer() || getState() != SPELL_STATE_CASTING)
|
||||
return;
|
||||
|
||||
if (isDelayableNoMore()) // Spells may only be delayed twice
|
||||
@@ -7919,7 +7919,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const
|
||||
case SPELL_AURA_MOD_CHARM:
|
||||
case SPELL_AURA_MOD_POSSESS_PET:
|
||||
case SPELL_AURA_AOE_CHARM:
|
||||
if (target->GetTypeId() == TYPEID_UNIT && target->IsVehicle())
|
||||
if (target->IsCreature() && target->IsVehicle())
|
||||
return false;
|
||||
if (target->IsMounted())
|
||||
return false;
|
||||
@@ -7935,7 +7935,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const
|
||||
|
||||
// xinef: skip los checking if spell has appropriate attribute, or target requires specific entry
|
||||
// this is only for target addition and target has to have unselectable flag, this is valid for FLAG_EXTRA_TRIGGER and quest triggers however there are some without this flag, used not_selectable
|
||||
if (m_spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) || (target->GetTypeId() == TYPEID_UNIT && target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE) && (m_spellInfo->Effects[eff].TargetA.GetCheckType() == TARGET_CHECK_ENTRY || m_spellInfo->Effects[eff].TargetB.GetCheckType() == TARGET_CHECK_ENTRY)))
|
||||
if (m_spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) || (target->IsCreature() && target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE) && (m_spellInfo->Effects[eff].TargetA.GetCheckType() == TARGET_CHECK_ENTRY || m_spellInfo->Effects[eff].TargetB.GetCheckType() == TARGET_CHECK_ENTRY)))
|
||||
return true;
|
||||
|
||||
// if spell is triggered, need to check for LOS disable on the aura triggering it and inherit that behaviour
|
||||
@@ -7992,7 +7992,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const
|
||||
}
|
||||
break;
|
||||
case SPELL_EFFECT_SUMMON_RAF_FRIEND:
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER || target->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer() || !target->IsPlayer())
|
||||
return false;
|
||||
if (m_caster->ToPlayer()->GetSession()->IsARecruiter() && target->ToPlayer()->GetSession()->GetRecruiterId() != m_caster->ToPlayer()->GetSession()->GetAccountId())
|
||||
return false;
|
||||
@@ -8385,7 +8385,7 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
|
||||
reqSkillValue = lockInfo->Skill[j];
|
||||
|
||||
// castitem check: rogue using skeleton keys. the skill values should not be added in this case.
|
||||
skillValue = m_CastItem || m_caster->GetTypeId() != TYPEID_PLAYER ?
|
||||
skillValue = m_CastItem || !m_caster->IsPlayer() ?
|
||||
0 : m_caster->ToPlayer()->GetSkillValue(skillId);
|
||||
|
||||
// skill bonus provided by casting spell (mostly item spells)
|
||||
@@ -9035,14 +9035,14 @@ namespace Acore
|
||||
|
||||
bool WorldObjectSpellAreaTargetCheck::operator()(WorldObject* target)
|
||||
{
|
||||
if (target->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
if (target->IsGameObject())
|
||||
{
|
||||
if (!target->ToGameObject()->IsInRange(_position->GetPositionX(), _position->GetPositionY(), _position->GetPositionZ(), _range))
|
||||
return false;
|
||||
}
|
||||
else if (!target->IsWithinDist3d(_position, _range))
|
||||
return false;
|
||||
else if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsAvoidingAOE()) // pussywizard
|
||||
else if (target->IsCreature() && target->ToCreature()->IsAvoidingAOE()) // pussywizard
|
||||
return false;
|
||||
return WorldObjectSpellTargetCheck::operator ()(target);
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ void Spell::EffectResurrectNew(SpellEffIndex effIndex)
|
||||
if (!unitTarget || unitTarget->IsAlive())
|
||||
return;
|
||||
|
||||
if (unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!unitTarget->IsPlayer())
|
||||
return;
|
||||
|
||||
if (!unitTarget->IsInWorld())
|
||||
@@ -435,7 +435,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
|
||||
// Shadow Bite
|
||||
else if (m_spellInfo->SpellFamilyFlags[1] & 0x400000)
|
||||
{
|
||||
if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->IsPet())
|
||||
if (m_caster->IsCreature() && m_caster->IsPet())
|
||||
{
|
||||
if (Player* owner = m_caster->GetOwner()->ToPlayer())
|
||||
{
|
||||
@@ -776,7 +776,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
sScriptMgr->OnDummyEffect(m_caster, m_spellInfo->Id, effIndex, gameObjTarget);
|
||||
}
|
||||
else if (unitTarget && unitTarget->GetTypeId() == TYPEID_UNIT)
|
||||
else if (unitTarget && unitTarget->IsCreature())
|
||||
{
|
||||
sScriptMgr->OnDummyEffect(m_caster, m_spellInfo->Id, effIndex, unitTarget->ToCreature());
|
||||
}
|
||||
@@ -2065,7 +2065,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
{
|
||||
LOG_DEBUG("spells.aura", "WORLD: Open Lock - No Player Caster!");
|
||||
return;
|
||||
@@ -2182,7 +2182,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* player = m_caster->ToPlayer();
|
||||
@@ -2291,7 +2291,7 @@ void Spell::EffectProficiency(SpellEffIndex /*effIndex*/)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
Player* p_target = m_caster->ToPlayer();
|
||||
|
||||
@@ -2524,7 +2524,7 @@ void Spell::EffectLearnSpell(SpellEffIndex effIndex)
|
||||
if (!unitTarget)
|
||||
return;
|
||||
|
||||
if (unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!unitTarget->IsPlayer())
|
||||
{
|
||||
if (unitTarget->ToPet())
|
||||
EffectLearnPetSpell(effIndex);
|
||||
@@ -2686,7 +2686,7 @@ void Spell::EffectPickPocket(SpellEffIndex /*effIndex*/)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
m_caster->ToPlayer()->SendLoot(unitTarget->GetGUID(), LOOT_PICKPOCKETING);
|
||||
@@ -2697,7 +2697,7 @@ void Spell::EffectAddFarsight(SpellEffIndex effIndex)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
float radius = m_spellInfo->Effects[effIndex].CalcRadius();
|
||||
@@ -2751,7 +2751,7 @@ void Spell::EffectLearnSkill(SpellEffIndex effIndex)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!unitTarget->IsPlayer())
|
||||
return;
|
||||
|
||||
if (damage < 0)
|
||||
@@ -2767,7 +2767,7 @@ void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!unitTarget->IsPlayer())
|
||||
return;
|
||||
|
||||
// not scale value for item based reward (/10 value expected)
|
||||
@@ -2801,7 +2801,7 @@ void Spell::EffectTradeSkill(SpellEffIndex /*effIndex*/)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
// uint32 skillid = m_spellInfo->Effects[i].MiscValue;
|
||||
// uint16 skillmax = unitTarget->ToPlayer()->(skillid);
|
||||
@@ -2813,7 +2813,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
if (!itemTarget)
|
||||
return;
|
||||
@@ -2869,7 +2869,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
if (!itemTarget)
|
||||
return;
|
||||
@@ -2923,7 +2923,7 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* p_caster = m_caster->ToPlayer();
|
||||
@@ -3070,7 +3070,7 @@ void Spell::EffectTameCreature(SpellEffIndex /*effIndex*/)
|
||||
if (!unitTarget)
|
||||
return;
|
||||
|
||||
if (unitTarget->GetTypeId() != TYPEID_UNIT)
|
||||
if (!unitTarget->IsCreature())
|
||||
return;
|
||||
|
||||
Creature* creatureTarget = unitTarget->ToCreature();
|
||||
@@ -3199,7 +3199,7 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex)
|
||||
if (!pet)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_UNIT)
|
||||
if (m_caster->IsCreature())
|
||||
{
|
||||
if (m_caster->ToCreature()->IsTotem())
|
||||
pet->SetReactState(REACT_AGGRESSIVE);
|
||||
@@ -3831,7 +3831,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
|
||||
/*// Mug Transformation
|
||||
case 41931:
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
uint8 bag = 19;
|
||||
@@ -3874,12 +3874,12 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
|
||||
}
|
||||
case 52173: // Coyote Spirit Despawn
|
||||
case 60243: // Blood Parrot Despawn
|
||||
if (unitTarget->GetTypeId() == TYPEID_UNIT && unitTarget->ToCreature()->IsSummon())
|
||||
if (unitTarget->IsCreature() && unitTarget->ToCreature()->IsSummon())
|
||||
unitTarget->ToTempSummon()->UnSummon();
|
||||
return;
|
||||
case 57347: // Retrieving (Wintergrasp RP-GG pickup spell)
|
||||
{
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!unitTarget || !unitTarget->IsCreature() || !m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
unitTarget->ToCreature()->DespawnOrUnsummon();
|
||||
@@ -3888,7 +3888,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
|
||||
}
|
||||
case 57349: // Drop RP-GG (Wintergrasp RP-GG at death drop spell)
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
// Delete item from inventory at death
|
||||
@@ -3899,7 +3899,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
|
||||
case 58418: // Portal to Orgrimmar
|
||||
case 58420: // Portal to Stormwind
|
||||
{
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER || effIndex != 0)
|
||||
if (!unitTarget || !unitTarget->IsPlayer() || effIndex != 0)
|
||||
return;
|
||||
|
||||
uint32 spellID = m_spellInfo->Effects[EFFECT_0].CalcValue();
|
||||
@@ -4041,7 +4041,7 @@ void Spell::EffectSanctuary(SpellEffIndex /*effIndex*/)
|
||||
if ((*iter)->GetCurrentSpell(i) && (*iter)->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == unitTarget->GetGUID())
|
||||
{
|
||||
SpellInfo const* si = (*iter)->GetCurrentSpell(i)->GetSpellInfo();
|
||||
if (si->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT) && (*iter)->GetTypeId() == TYPEID_UNIT)
|
||||
if (si->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT) && (*iter)->IsCreature())
|
||||
{
|
||||
Creature* c = (*iter)->ToCreature();
|
||||
if ((!c->IsPet() && c->GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS) || c->isWorldBoss() || c->IsDungeonBoss())
|
||||
@@ -4085,7 +4085,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (!unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!unitTarget || !m_caster->IsPlayer() || !unitTarget->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* caster = m_caster->ToPlayer();
|
||||
@@ -4161,7 +4161,7 @@ void Spell::EffectStuck(SpellEffIndex /*effIndex*/)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* target = m_caster->ToPlayer();
|
||||
@@ -4311,7 +4311,7 @@ void Spell::EffectApplyGlyph(SpellEffIndex effIndex)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER || m_glyphIndex >= MAX_GLYPH_SLOT_INDEX)
|
||||
if (!m_caster->IsPlayer() || m_glyphIndex >= MAX_GLYPH_SLOT_INDEX)
|
||||
return;
|
||||
|
||||
Player* player = m_caster->ToPlayer();
|
||||
@@ -4770,7 +4770,7 @@ void Spell::EffectForceDeselect(SpellEffIndex /*effIndex*/)
|
||||
// xinef: we should also force pets to remove us from current target
|
||||
Unit::AttackerSet attackerSet;
|
||||
for (Unit::AttackerSet::const_iterator itr = m_caster->getAttackers().begin(); itr != m_caster->getAttackers().end(); ++itr)
|
||||
if ((*itr)->GetTypeId() == TYPEID_UNIT && !(*itr)->CanHaveThreatList())
|
||||
if ((*itr)->IsCreature() && !(*itr)->CanHaveThreatList())
|
||||
attackerSet.insert(*itr);
|
||||
|
||||
for (Unit::AttackerSet::const_iterator itr = attackerSet.begin(); itr != attackerSet.end(); ++itr)
|
||||
@@ -4801,7 +4801,7 @@ void Spell::EffectForceDeselect(SpellEffIndex /*effIndex*/)
|
||||
if (spell->m_targets.GetUnitTargetGUID() == m_caster->GetGUID())
|
||||
{
|
||||
SpellInfo const* si = spell->GetSpellInfo();
|
||||
if (si->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT) && (*iter)->GetTypeId() == TYPEID_UNIT)
|
||||
if (si->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT) && (*iter)->IsCreature())
|
||||
{
|
||||
Creature* c = (*iter)->ToCreature();
|
||||
if ((!c->IsPet() && c->GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS) || c->isWorldBoss() || c->IsDungeonBoss())
|
||||
@@ -4832,7 +4832,7 @@ void Spell::EffectSelfResurrect(SpellEffIndex effIndex)
|
||||
|
||||
if (!m_caster || m_caster->IsAlive())
|
||||
return;
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
if (!m_caster->IsInWorld())
|
||||
return;
|
||||
@@ -4870,9 +4870,9 @@ void Spell::EffectSkinning(SpellEffIndex /*effIndex*/)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (unitTarget->GetTypeId() != TYPEID_UNIT)
|
||||
if (!unitTarget->IsCreature())
|
||||
return;
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
Creature* creature = unitTarget->ToCreature();
|
||||
@@ -5472,7 +5472,7 @@ void Spell::EffectProspecting(SpellEffIndex /*effIndex*/)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* p_caster = m_caster->ToPlayer();
|
||||
@@ -5497,7 +5497,7 @@ void Spell::EffectMilling(SpellEffIndex /*effIndex*/)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* p_caster = m_caster->ToPlayer();
|
||||
@@ -5535,7 +5535,7 @@ void Spell::EffectSpiritHeal(SpellEffIndex /*effIndex*/)
|
||||
return;
|
||||
|
||||
/*
|
||||
if (unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!unitTarget->IsPlayer())
|
||||
return;
|
||||
if (!unitTarget->IsInWorld())
|
||||
return;
|
||||
@@ -5554,7 +5554,7 @@ void Spell::EffectSkinPlayerCorpse(SpellEffIndex /*effIndex*/)
|
||||
return;
|
||||
|
||||
LOG_DEBUG("spells.aura", "Effect: SkinPlayerCorpse");
|
||||
if ((m_caster->GetTypeId() != TYPEID_PLAYER) || (unitTarget->GetTypeId() != TYPEID_PLAYER) || (unitTarget->IsAlive()))
|
||||
if ((!m_caster->IsPlayer()) || (!unitTarget->IsPlayer()) || (unitTarget->IsAlive()))
|
||||
return;
|
||||
|
||||
unitTarget->ToPlayer()->RemovedInsignia(m_caster->ToPlayer());
|
||||
@@ -5747,7 +5747,7 @@ void Spell::EffectActivateRune(SpellEffIndex effIndex)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* player = m_caster->ToPlayer();
|
||||
@@ -5820,7 +5820,7 @@ void Spell::EffectCreateTamedPet(SpellEffIndex effIndex)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER || unitTarget->GetPetGUID() || !unitTarget->IsClass(CLASS_HUNTER, CLASS_CONTEXT_PET))
|
||||
if (!unitTarget || !unitTarget->IsPlayer() || unitTarget->GetPetGUID() || !unitTarget->IsClass(CLASS_HUNTER, CLASS_CONTEXT_PET))
|
||||
return;
|
||||
|
||||
uint32 creatureEntry = m_spellInfo->Effects[effIndex].MiscValue;
|
||||
@@ -6088,7 +6088,7 @@ void Spell::EffectRenamePet(SpellEffIndex /*effIndex*/)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT ||
|
||||
if (!unitTarget || !unitTarget->IsCreature() ||
|
||||
!unitTarget->IsPet() || unitTarget->ToPet()->getPetType() != HUNTER_PET)
|
||||
return;
|
||||
|
||||
@@ -6199,7 +6199,7 @@ void Spell::EffectCastButtons(SpellEffIndex effIndex)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* p_caster = m_caster->ToPlayer();
|
||||
@@ -6242,7 +6242,7 @@ void Spell::EffectRechargeManaGem(SpellEffIndex /*effIndex*/)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!unitTarget || !unitTarget->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* player = m_caster->ToPlayer();
|
||||
@@ -6319,7 +6319,7 @@ void Spell::EffectSummonRaFFriend(SpellEffIndex /*effIndex*/)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!m_caster->IsPlayer())
|
||||
return;
|
||||
|
||||
if (!unitTarget)
|
||||
|
||||
Reference in New Issue
Block a user