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
189 changed files with 783 additions and 775 deletions

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