diff options
| author | Malcrom <malcromdev@gmail.com> | 2012-02-14 19:42:07 -0330 |
|---|---|---|
| committer | Malcrom <malcromdev@gmail.com> | 2012-02-14 19:42:07 -0330 |
| commit | 4dd96f27656fd49e0023ddad22afe606b53ed2cb (patch) | |
| tree | 889742c5f965e23cd498602e96c8d0600c234d1f /src/server/game/Spells | |
| parent | 7965eed4e15a5662a85a800dac162e945b03cdd1 (diff) | |
| parent | 60adf066d90b9bc9696bce8f750f9abc79a61f8e (diff) | |
Merge branch 'master' of git://github.com/TrinityCore/TrinityCore
Diffstat (limited to 'src/server/game/Spells')
| -rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.h | 7 | ||||
| -rwxr-xr-x | src/server/game/Spells/Auras/SpellAuras.cpp | 36 | ||||
| -rwxr-xr-x | src/server/game/Spells/Auras/SpellAuras.h | 40 | ||||
| -rwxr-xr-x | src/server/game/Spells/Spell.cpp | 48 |
4 files changed, 62 insertions, 69 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 31dd3ad7471..490f33f46e1 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -95,18 +95,19 @@ class AuraEffect Aura* const m_base; SpellInfo const* const m_spellInfo; - uint8 const m_effIndex; int32 const m_baseAmount; int32 m_amount; - bool m_canBeRecalculated; SpellModifier* m_spellmod; - bool m_isPeriodic; int32 m_periodicTimer; int32 m_amplitude; uint32 m_tickNumber; + + uint8 const m_effIndex; + bool m_canBeRecalculated; + bool m_isPeriodic; private: bool IsPeriodicTickCrit(Unit* target, Unit const* caster) const; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index d49ac829ef9..4bc193b49d2 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -37,8 +37,8 @@ #include "Vehicle.h" AuraApplication::AuraApplication(Unit* target, Unit* caster, Aura* aura, uint8 effMask): -m_target(target), m_base(aura), m_slot(MAX_AURAS), m_flags(AFLAG_NONE), -m_effectsToApply(effMask), m_removeMode(AURA_REMOVE_NONE), m_needClientUpdate(false) +_target(target), _base(aura), _slot(MAX_AURAS), _flags(AFLAG_NONE), +_effectsToApply(effMask), _removeMode(AURA_REMOVE_NONE), _needClientUpdate(false) { ASSERT(GetTarget() && GetBase()); @@ -70,7 +70,7 @@ m_effectsToApply(effMask), m_removeMode(AURA_REMOVE_NONE), m_needClientUpdate(fa // Register Visible Aura if (slot < MAX_AURAS) { - m_slot = slot; + _slot = slot; GetTarget()->SetVisibleAura(slot, this); SetNeedClientUpdate(); sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Aura: %u Effect: %d put to unit visible auras slot: %u", GetBase()->GetId(), GetEffectMask(), slot); @@ -89,7 +89,7 @@ void AuraApplication::_Remove() if (slot >= MAX_AURAS) return; - if (AuraApplication * foundAura = m_target->GetAuraApplication(GetBase()->GetId(), GetBase()->GetCasterGUID(), GetBase()->GetCastItemGUID())) + if (AuraApplication * foundAura = _target->GetAuraApplication(GetBase()->GetId(), GetBase()->GetCasterGUID(), GetBase()->GetCastItemGUID())) { // Reuse visible aura slot by aura which is still applied - prevent storing dead pointers if (slot == foundAura->GetSlot()) @@ -115,7 +115,7 @@ void AuraApplication::_Remove() void AuraApplication::_InitFlags(Unit* caster, uint8 effMask) { // mark as selfcasted if needed - m_flags |= (GetBase()->GetCasterGUID() == GetTarget()->GetGUID()) ? AFLAG_CASTER : AFLAG_NONE; + _flags |= (GetBase()->GetCasterGUID() == GetTarget()->GetGUID()) ? AFLAG_CASTER : AFLAG_NONE; // aura is casted by self or an enemy // one negative effect and we know aura is negative @@ -130,7 +130,7 @@ void AuraApplication::_InitFlags(Unit* caster, uint8 effMask) break; } } - m_flags |= negativeFound ? AFLAG_NEGATIVE : AFLAG_POSITIVE; + _flags |= negativeFound ? AFLAG_NEGATIVE : AFLAG_POSITIVE; } // aura is casted by friend // one positive effect and we know aura is positive @@ -145,7 +145,7 @@ void AuraApplication::_InitFlags(Unit* caster, uint8 effMask) break; } } - m_flags |= positiveFound ? AFLAG_POSITIVE : AFLAG_NEGATIVE; + _flags |= positiveFound ? AFLAG_POSITIVE : AFLAG_NEGATIVE; } } @@ -154,19 +154,19 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply) AuraEffect* aurEff = GetBase()->GetEffect(effIndex); ASSERT(aurEff); ASSERT(HasEffect(effIndex) == (!apply)); - ASSERT((1<<effIndex) & m_effectsToApply); + ASSERT((1<<effIndex) & _effectsToApply); sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraApplication::_HandleEffect: %u, apply: %u: amount: %u", aurEff->GetAuraType(), apply, aurEff->GetAmount()); if (apply) { - ASSERT(!(m_flags & (1<<effIndex))); - m_flags |= 1<<effIndex; + ASSERT(!(_flags & (1<<effIndex))); + _flags |= 1<<effIndex; aurEff->HandleEffect(this, AURA_EFFECT_HANDLE_REAL, true); } else { - ASSERT(m_flags & (1<<effIndex)); - m_flags &= ~(1<<effIndex); + ASSERT(_flags & (1<<effIndex)); + _flags &= ~(1<<effIndex); aurEff->HandleEffect(this, AURA_EFFECT_HANDLE_REAL, false); // Remove all triggered by aura spells vs unlimited duration @@ -177,19 +177,19 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply) void AuraApplication::BuildUpdatePacket(ByteBuffer& data, bool remove) const { - data << uint8(m_slot); + data << uint8(_slot); if (remove) { - ASSERT(!m_target->GetVisibleAura(m_slot)); + ASSERT(!_target->GetVisibleAura(_slot)); data << uint32(0); return; } - ASSERT(m_target->GetVisibleAura(m_slot)); + ASSERT(_target->GetVisibleAura(_slot)); Aura const* aura = GetBase(); data << uint32(aura->GetId()); - uint32 flags = m_flags; + uint32 flags = _flags; if (aura->GetMaxDuration() > 0 && !(aura->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_HIDE_DURATION)) flags |= AFLAG_DURATION; data << uint8(flags); @@ -210,13 +210,13 @@ void AuraApplication::BuildUpdatePacket(ByteBuffer& data, bool remove) const void AuraApplication::ClientUpdate(bool remove) { - m_needClientUpdate = false; + _needClientUpdate = false; WorldPacket data(SMSG_AURA_UPDATE); data.append(GetTarget()->GetPackGUID()); BuildUpdatePacket(data, remove); - m_target->SendMessageToSet(&data, true); + _target->SendMessageToSet(&data, true); } uint8 Aura::BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 avalibleEffectMask, WorldObject* owner) diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index 4d87abccda3..0af8d132211 100755 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -46,13 +46,13 @@ class AuraApplication friend void Unit::RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode); friend AuraApplication * Unit::_CreateAuraApplication(Aura* aura, uint8 effMask); private: - Unit* const m_target; - Aura* const m_base; - uint8 m_slot; // Aura slot on unit - uint8 m_flags; // Aura info flag - uint8 m_effectsToApply; // Used only at spell hit to determine which effect should be applied - AuraRemoveMode m_removeMode:8; // Store info for know remove aura reason - bool m_needClientUpdate:1; + Unit* const _target; + Aura* const _base; + AuraRemoveMode _removeMode:8; // Store info for know remove aura reason + uint8 _slot; // Aura slot on unit + uint8 _flags; // Aura info flag + uint8 _effectsToApply; // Used only at spell hit to determine which effect should be applied + bool _needClientUpdate:1; explicit AuraApplication(Unit* target, Unit* caster, Aura* base, uint8 effMask); void _Remove(); @@ -61,22 +61,22 @@ class AuraApplication void _HandleEffect(uint8 effIndex, bool apply); public: - Unit* GetTarget() const { return m_target; } - Aura* GetBase() const { return m_base; } + Unit* GetTarget() const { return _target; } + Aura* GetBase() const { return _base; } - uint8 GetSlot() const { return m_slot; } - uint8 GetFlags() const { return m_flags; } - uint8 GetEffectMask() const { return m_flags & (AFLAG_EFF_INDEX_0 | AFLAG_EFF_INDEX_1 | AFLAG_EFF_INDEX_2); } - bool HasEffect(uint8 effect) const { ASSERT(effect < MAX_SPELL_EFFECTS); return m_flags & (1<<effect); } - bool IsPositive() const { return m_flags & AFLAG_POSITIVE; } - bool IsSelfcasted() const { return m_flags & AFLAG_CASTER; } - uint8 GetEffectsToApply() const { return m_effectsToApply; } + uint8 GetSlot() const { return _slot; } + uint8 GetFlags() const { return _flags; } + uint8 GetEffectMask() const { return _flags & (AFLAG_EFF_INDEX_0 | AFLAG_EFF_INDEX_1 | AFLAG_EFF_INDEX_2); } + bool HasEffect(uint8 effect) const { ASSERT(effect < MAX_SPELL_EFFECTS); return _flags & (1<<effect); } + bool IsPositive() const { return _flags & AFLAG_POSITIVE; } + bool IsSelfcasted() const { return _flags & AFLAG_CASTER; } + uint8 GetEffectsToApply() const { return _effectsToApply; } - void SetRemoveMode(AuraRemoveMode mode) { m_removeMode = mode; } - AuraRemoveMode GetRemoveMode() const {return m_removeMode;} + void SetRemoveMode(AuraRemoveMode mode) { _removeMode = mode; } + AuraRemoveMode GetRemoveMode() const {return _removeMode;} - void SetNeedClientUpdate() { m_needClientUpdate = true;} - bool IsNeedClientUpdate() const { return m_needClientUpdate;} + void SetNeedClientUpdate() { _needClientUpdate = true;} + bool IsNeedClientUpdate() const { return _needClientUpdate;} void BuildUpdatePacket(ByteBuffer& data, bool remove) const; void ClientUpdate(bool remove = false); }; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index fda186f9c64..670b743d725 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1928,15 +1928,15 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType, Spe for (ConditionList::const_iterator i_spellST = conditions.begin(); i_spellST != conditions.end(); ++i_spellST) { - if ((*i_spellST)->mConditionType != CONDITION_SPELL_SCRIPT_TARGET) + if ((*i_spellST)->ConditionType != CONDITION_SPELL_SCRIPT_TARGET) continue; - if ((*i_spellST)->mConditionValue3 && !((*i_spellST)->mConditionValue3 & (1 << uint32(effIndex)))) + if ((*i_spellST)->ConditionValue3 && !((*i_spellST)->ConditionValue3 & (1 << uint32(effIndex)))) continue; - switch ((*i_spellST)->mConditionValue1) + switch ((*i_spellST)->ConditionValue1) { case SPELL_TARGET_TYPE_CONTROLLED: for (Unit::ControlList::iterator itr = m_caster->m_Controlled.begin(); itr != m_caster->m_Controlled.end(); ++itr) - if ((*itr)->GetEntry() == (*i_spellST)->mConditionValue2 && (*itr)->IsWithinDistInMap(m_caster, range)) + if ((*itr)->GetEntry() == (*i_spellST)->ConditionValue2 && (*itr)->IsWithinDistInMap(m_caster, range)) { goScriptTarget = NULL; creatureScriptTarget = (*itr)->ToCreature(); @@ -1944,9 +1944,9 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType, Spe } break; case SPELL_TARGET_TYPE_GAMEOBJECT: - if ((*i_spellST)->mConditionValue2) + if ((*i_spellST)->ConditionValue2) { - if (GameObject* go = m_caster->FindNearestGameObject((*i_spellST)->mConditionValue2, range)) + if (GameObject* go = m_caster->FindNearestGameObject((*i_spellST)->ConditionValue2, range)) { // remember found target and range, next attempt will find more near target with another entry goScriptTarget = go; @@ -1966,11 +1966,11 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType, Spe } break; case SPELL_TARGET_TYPE_CREATURE: - if (m_targets.GetUnitTarget() && m_targets.GetUnitTarget()->GetEntry() == (*i_spellST)->mConditionValue2) + if (m_targets.GetUnitTarget() && m_targets.GetUnitTarget()->GetEntry() == (*i_spellST)->ConditionValue2) return m_targets.GetUnitTarget(); case SPELL_TARGET_TYPE_DEAD: default: - if (Creature* cre = m_caster->FindNearestCreature((*i_spellST)->mConditionValue2, range, (*i_spellST)->mConditionValue1 != SPELL_TARGET_TYPE_DEAD)) + if (Creature* cre = m_caster->FindNearestCreature((*i_spellST)->ConditionValue2, range, (*i_spellST)->ConditionValue1 != SPELL_TARGET_TYPE_DEAD)) { creatureScriptTarget = cre; goScriptTarget = NULL; @@ -2531,16 +2531,16 @@ uint32 Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) { for (ConditionList::const_iterator i_spellST = conditions.begin(); i_spellST != conditions.end(); ++i_spellST) { - if ((*i_spellST)->mConditionType != CONDITION_SPELL_SCRIPT_TARGET) + if ((*i_spellST)->ConditionType != CONDITION_SPELL_SCRIPT_TARGET) continue; - if ((*i_spellST)->mConditionValue3 && !((*i_spellST)->mConditionValue3 & effectMask)) + if ((*i_spellST)->ConditionValue3 && !((*i_spellST)->ConditionValue3 & effectMask)) continue; - if ((*i_spellST)->mConditionValue1 == SPELL_TARGET_TYPE_CREATURE) - SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ENTRY, (*i_spellST)->mConditionValue2); - else if ((*i_spellST)->mConditionValue1 == SPELL_TARGET_TYPE_CONTROLLED) + if ((*i_spellST)->ConditionValue1 == SPELL_TARGET_TYPE_CREATURE) + SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ENTRY, (*i_spellST)->ConditionValue2); + else if ((*i_spellST)->ConditionValue1 == SPELL_TARGET_TYPE_CONTROLLED) { for (Unit::ControlList::iterator itr = m_caster->m_Controlled.begin(); itr != m_caster->m_Controlled.end(); ++itr) - if ((*itr)->GetEntry() == (*i_spellST)->mConditionValue2 && + if ((*itr)->GetEntry() == (*i_spellST)->ConditionValue2 && (*itr)->IsInMap(m_caster)) // For 60243 and 52173 need skip radius check or use range (no radius entry for effect) unitList.push_back(*itr); } @@ -2626,12 +2626,12 @@ uint32 Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) { for (ConditionList::const_iterator i_spellST = conditions.begin(); i_spellST != conditions.end(); ++i_spellST) { - if ((*i_spellST)->mConditionType != CONDITION_SPELL_SCRIPT_TARGET) + if ((*i_spellST)->ConditionType != CONDITION_SPELL_SCRIPT_TARGET) continue; - if ((*i_spellST)->mConditionValue3 && !((*i_spellST)->mConditionValue3 & effectMask)) + if ((*i_spellST)->ConditionValue3 && !((*i_spellST)->ConditionValue3 & effectMask)) continue; - if ((*i_spellST)->mConditionValue1 == SPELL_TARGET_TYPE_GAMEOBJECT) - SearchGOAreaTarget(gobjectList, radius, pushType, SPELL_TARGETS_GO, (*i_spellST)->mConditionValue2); + if ((*i_spellST)->ConditionValue1 == SPELL_TARGET_TYPE_GAMEOBJECT) + SearchGOAreaTarget(gobjectList, radius, pushType, SPELL_TARGETS_GO, (*i_spellST)->ConditionValue2); } } else @@ -3481,14 +3481,6 @@ void Spell::update(uint32 difftime) { if (m_timer > 0) { - // Cancel the cast if the target is not in line of sight - if (m_targets.GetUnitTarget() && !m_caster->IsWithinLOSInMap(m_targets.GetUnitTarget())) - { - SendCastResult(SPELL_FAILED_LINE_OF_SIGHT); - cancel(); - return; - } - if (difftime >= (uint32)m_timer) m_timer = 0; else @@ -4736,8 +4728,8 @@ SpellCastResult Spell::CheckCast(bool strict) if (Player* playerCaster = m_caster->ToPlayer()) { if (playerCaster->GetSession() && condInfo.mLastFailedCondition - && condInfo.mLastFailedCondition->ErrorTextd) - playerCaster->GetSession()->SendNotification(condInfo.mLastFailedCondition->ErrorTextd); + && condInfo.mLastFailedCondition->ErrorTextId) + playerCaster->GetSession()->SendNotification(condInfo.mLastFailedCondition->ErrorTextId); } return SPELL_FAILED_DONT_REPORT; } |
