aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r--src/server/game/Spells/Spell.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 3dff5e0439e..a72bffb6aa3 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -2691,7 +2691,7 @@ SpellMissInfo Spell::PreprocessSpellHit(Unit* unit, bool scaleAura, TargetInfo&
if (m_caster != unit)
{
// Recheck UNIT_FLAG_NON_ATTACKABLE for delayed spells
- if (m_spellInfo->Speed > 0.0f && unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID())
+ if (m_spellInfo->Speed > 0.0f && unit->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE) && unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID())
return SPELL_MISS_EVADE;
if (m_caster->IsValidAttackTarget(unit, m_spellInfo))
@@ -2714,7 +2714,7 @@ SpellMissInfo Spell::PreprocessSpellHit(Unit* unit, bool scaleAura, TargetInfo&
if (m_originalCaster && unit->IsInCombat() && m_spellInfo->HasInitialAggro())
{
- if (m_originalCaster->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) // only do explicit combat forwarding for PvP enabled units
+ if (m_originalCaster->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED)) // only do explicit combat forwarding for PvP enabled units
m_originalCaster->GetCombatManager().InheritCombatStatesFrom(unit); // for creature v creature combat, the threat forward does it for us
unit->GetThreatManager().ForwardThreatForAssistingMe(m_originalCaster, 0.0f, nullptr, true);
}
@@ -3099,7 +3099,7 @@ SpellCastResult Spell::prepare(SpellCastTargets const& targets, AuraEffect const
}
// Creatures focus their target when possible
- if (m_casttime && m_caster->IsCreature() && !m_spellInfo->IsNextMeleeSwingSpell() && !IsAutoRepeat() && !m_caster->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED))
+ if (m_casttime && m_caster->IsCreature() && !m_spellInfo->IsNextMeleeSwingSpell() && !IsAutoRepeat() && !m_caster->ToUnit()->HasUnitFlag(UNIT_FLAG_POSSESSED))
{
// Channeled spells and some triggered spells do not focus a cast target. They face their target later on via channel object guid and via spell attribute or not at all
bool const focusTarget = !m_spellInfo->IsChanneled() && !(_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING);
@@ -3352,7 +3352,7 @@ void Spell::_cast(bool skipCheck)
}
// The spell focusing is making sure that we have a valid cast target guid when we need it so only check for a guid value here.
if (Creature* creatureCaster = m_caster->ToCreature())
- if (!creatureCaster->GetTarget().IsEmpty() && !creatureCaster->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED))
+ if (!creatureCaster->GetTarget().IsEmpty() && !creatureCaster->HasUnitFlag(UNIT_FLAG_POSSESSED))
if (WorldObject const* target = ObjectAccessor::GetUnit(*creatureCaster, creatureCaster->GetTarget()))
creatureCaster->SetInFront(target);
@@ -4364,13 +4364,13 @@ void Spell::UpdateSpellCastDataAmmo(WorldPackets::Spells::SpellAmmo& ammo)
}
}
}
- else if (m_caster->GetTypeId() == TYPEID_UNIT)
+ else if (Unit const* unitCaster = m_caster->ToUnit())
{
uint32 nonRangedAmmoDisplayID = 0;
uint32 nonRangedAmmoInventoryType = 0;
for (uint8 i = BASE_ATTACK; i < MAX_ATTACK; ++i)
{
- if (uint32 item_id = m_caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i))
+ if (uint32 item_id = unitCaster->GetVirtualItemId(i))
{
if (ItemEntry const* itemEntry = sItemStore.LookupEntry(item_id))
{
@@ -4583,7 +4583,7 @@ void Spell::SendChannelUpdate(uint32 time)
if (time == 0)
{
unitCaster->SetChannelObjectGuid(ObjectGuid::Empty);
- unitCaster->SetUInt32Value(UNIT_CHANNEL_SPELL, 0);
+ unitCaster->SetChannelSpellId(0);
}
WorldPacket data(MSG_CHANNEL_UPDATE, 8+4);
@@ -4622,7 +4622,7 @@ void Spell::SendChannelStart(uint32 duration)
creatureCaster->SetSpellFocus(this, ObjectAccessor::GetWorldObject(*creatureCaster, channelTarget));
}
- unitCaster->SetUInt32Value(UNIT_CHANNEL_SPELL, m_spellInfo->Id);
+ unitCaster->SetChannelSpellId(m_spellInfo->Id);
}
void Spell::SendResurrectRequest(Player* target)
@@ -5082,7 +5082,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
// Prevent cheating in case the player has an immunity effect and tries to interact with a non-allowed gameobject. The error message is handled by the client so we don't report anything here
if (m_caster->ToPlayer() && m_targets.GetGOTarget())
{
- if (m_targets.GetGOTarget()->GetGOInfo()->CannotBeUsedUnderImmunity() && m_caster->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE))
+ if (m_targets.GetGOTarget()->GetGOInfo()->CannotBeUsedUnderImmunity() && m_caster->ToUnit()->HasUnitFlag(UNIT_FLAG_IMMUNE))
return SPELL_FAILED_DONT_REPORT;
}
@@ -5109,7 +5109,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
}
}
- if (m_spellInfo->HasAttribute(SPELL_ATTR7_IS_CHEAT_SPELL) && !m_caster->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS))
+ if (m_spellInfo->HasAttribute(SPELL_ATTR7_IS_CHEAT_SPELL) && m_caster->IsUnit() && !m_caster->ToUnit()->HasUnitFlag2(UNIT_FLAG2_ALLOW_CHEAT_SPELLS))
{
m_customError = SPELL_CUSTOM_ERROR_GM_ONLY;
return SPELL_FAILED_CUSTOM_ERROR;
@@ -5591,7 +5591,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
if (m_caster->GetTypeId() != TYPEID_PLAYER || !m_targets.GetUnitTarget() || m_targets.GetUnitTarget()->GetTypeId() != TYPEID_UNIT)
return SPELL_FAILED_BAD_TARGETS;
- if (!(m_targets.GetUnitTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & UNIT_FLAG_SKINNABLE))
+ if (!m_targets.GetUnitTarget()->HasUnitFlag(UNIT_FLAG_SKINNABLE))
return SPELL_FAILED_TARGET_UNSKINNABLE;
Creature* creature = m_targets.GetUnitTarget()->ToCreature();
@@ -5843,8 +5843,8 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
dispelMask = SpellInfo::GetDispelMask(DispelType(spellEffectInfo.MiscValue));
bool hasStealableAura = false;
- Unit::VisibleAuraMap const* visibleAuras = m_targets.GetUnitTarget()->GetVisibleAuras();
- for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr)
+ Unit::VisibleAuraMap const& visibleAuras = m_targets.GetUnitTarget()->GetVisibleAuras();
+ for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras.begin(); itr != visibleAuras.end(); ++itr)
{
if (!itr->second->IsPositive())
continue;
@@ -6159,7 +6159,7 @@ SpellCastResult Spell::CheckCasterAuras(uint32* param1) const
SpellCastResult result = SPELL_CAST_OK;
// Get unit state
- uint32 const unitflag = unitCaster->GetUInt32Value(UNIT_FIELD_FLAGS);
+ uint32 const unitflag = unitCaster->GetUnitFlags();
// this check should only be done when player does cast directly
// (ie not when it's called from a script) Breaks for example PlayerAI when charmed
@@ -7324,7 +7324,7 @@ bool Spell::CheckEffectTarget(Unit const* target, SpellEffectInfo const& spellEf
{
if (!m_targets.GetCorpseTargetGUID())
{
- if (target->IsWithinLOSInMap(m_caster, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::M2) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE))
+ if (target->IsWithinLOSInMap(m_caster, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::M2) && target->HasUnitFlag(UNIT_FLAG_SKINNABLE))
return true;
return false;
@@ -7389,7 +7389,7 @@ bool Spell::IsProcDisabled() const
bool Spell::IsChannelActive() const
{
- return m_caster->GetUInt32Value(UNIT_CHANNEL_SPELL) != 0;
+ return m_caster->IsUnit() && m_caster->ToUnit()->GetChannelSpellId() != 0;
}
bool Spell::IsAutoActionResetSpell() const