From d22f915c2ceacbceaabe447ee95c094de36ce083 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Thu, 22 Jan 2009 00:53:01 +0300 Subject: [PATCH] [7139] Implement 227 aura SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE Signed-off-by: DiSlord --- src/game/SpellAuraDefines.h | 2 +- src/game/SpellAuras.cpp | 46 ++++++++++++++++++++++++++++++------- src/game/SpellAuras.h | 4 ++-- src/shared/revision_nr.h | 2 +- 4 files changed, 42 insertions(+), 12 deletions(-) diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h index 633a0505b..be56a1dc5 100644 --- a/src/game/SpellAuraDefines.h +++ b/src/game/SpellAuraDefines.h @@ -269,7 +269,7 @@ enum AuraType SPELL_AURA_224 = 224, SPELL_AURA_PRAYER_OF_MENDING = 225, SPELL_AURA_PERIODIC_DUMMY = 226, - SPELL_AURA_227 = 227, + SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE = 227, SPELL_AURA_DETECT_STEALTH = 228, SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE = 229, SPELL_AURA_230 = 230, diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index e3d54cbdb..04f1a4b2f 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -277,7 +277,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleUnused, //224 unused &Aura::HandleNoImmediateEffect, //225 SPELL_AURA_PRAYER_OF_MENDING &Aura::HandleAuraPeriodicDummy, //226 SPELL_AURA_PERIODIC_DUMMY - &Aura::HandleNULL, //227 periodic trigger spell + &Aura::HandlePeriodicTriggerSpellWithValue, //227 SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE &Aura::HandleNoImmediateEffect, //228 stealth detection &Aura::HandleNULL, //229 SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE &Aura::HandleAuraModIncreaseMaxHealth, //230 Commanding Shout @@ -340,7 +340,7 @@ Aura::Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, U m_spellmod(NULL), m_caster_guid(0), m_castItemGuid(castItem?castItem->GetGUID():0), m_target(target), m_timeCla(1000), m_periodicTimer(0), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_AuraDRGroup(DIMINISHING_NONE), m_effIndex(eff), m_auraSlot(MAX_AURAS), m_auraFlags(AFLAG_NONE), m_auraLevel(1), m_procCharges(0), m_stackAmount(1), -m_positive(false), m_permanent(false), m_isPeriodic(false), m_isTrigger(false), m_isAreaAura(false), m_isPersistent(false), +m_positive(false), m_permanent(false), m_isPeriodic(false), m_isAreaAura(false), m_isPersistent(false), m_updated(false), m_isRemovedOnShapeLost(true), m_in_use(false) { assert(target); @@ -620,11 +620,7 @@ void Aura::Update(uint32 diff) } // update before applying (aura can be removed in TriggerSpell or PeriodicTick calls) m_periodicTimer += m_modifier.periodictime; - - if(m_isTrigger) - TriggerSpell(); - else - PeriodicTick(); + PeriodicTick(); } } } @@ -1317,6 +1313,7 @@ void Aura::HandleAddTargetTrigger(bool apply, bool Real) m_spellmod = NULL; } } + void Aura::TriggerSpell() { Unit* caster = GetCaster(); @@ -2007,6 +2004,22 @@ void Aura::TriggerSpell() spell->prepare(&targets, this); } +void Aura::TriggerSpellWithValue() +{ + Unit* caster = GetCaster(); + Unit* target = GetTriggerTarget(); + + if(!caster || !target) + return; + + // generic casting code with custom spells and target/caster customs + uint32 trigger_spell_id = GetSpellProto()->EffectTriggerSpell[m_effIndex]; + int32 basepoints0 = this->GetModifier()->m_amount; + uint64 originalCasterGUID = GetCasterGUID(); + + caster->CastCustomSpell(target, trigger_spell_id, &basepoints0, 0, 0, true, 0, this); +} + /*********************************************************/ /*** AURA EFFECTS ***/ /*********************************************************/ @@ -4070,7 +4083,14 @@ void Aura::HandlePeriodicTriggerSpell(bool apply, bool Real) m_periodicTimer += m_modifier.periodictime; m_isPeriodic = apply; - m_isTrigger = apply; +} + +void Aura::HandlePeriodicTriggerSpellWithValue(bool apply, bool Real) +{ + if (m_periodicTimer <= 0) + m_periodicTimer += m_modifier.periodictime; + + m_isPeriodic = apply; } void Aura::HandlePeriodicEnergize(bool apply, bool Real) @@ -6194,6 +6214,16 @@ void Aura::PeriodicTick() PeriodicDummyTick(); break; } + case SPELL_AURA_PERIODIC_TRIGGER_SPELL: + { + TriggerSpell(); + break; + } + case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE: + { + TriggerSpellWithValue(); + break; + } default: break; } diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index b3718e3eb..2f0de60cf 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -110,6 +110,7 @@ class MANGOS_DLL_SPEC Aura void HandleAuraModRegenInterrupt(bool Apply, bool Real); void HandleHaste(bool Apply, bool Real); void HandlePeriodicTriggerSpell(bool Apply, bool Real); + void HandlePeriodicTriggerSpellWithValue(bool apply, bool Real); void HandlePeriodicEnergize(bool Apply, bool Real); void HandleAuraModResistanceExclusive(bool Apply, bool Real); void HandleAuraModPetTalentsPoints(bool Apply, bool Real); @@ -288,7 +289,6 @@ class MANGOS_DLL_SPEC Aura bool IsPermanent() const { return m_permanent; } bool IsAreaAura() const { return m_isAreaAura; } bool IsPeriodic() const { return m_isPeriodic; } - bool IsTrigger() const { return m_isTrigger; } bool IsPassive() const { return m_isPassive; } bool IsPersistent() const { return m_isPersistent; } bool IsDeathPersistent() const { return m_isDeathPersist; } @@ -315,6 +315,7 @@ class MANGOS_DLL_SPEC Aura DiminishingGroup getDiminishGroup() const { return m_AuraDRGroup; } void TriggerSpell(); + void TriggerSpellWithValue(); void PeriodicTick(); void PeriodicDummyTick(); @@ -351,7 +352,6 @@ class MANGOS_DLL_SPEC Aura bool m_positive:1; bool m_permanent:1; bool m_isPeriodic:1; - bool m_isTrigger:1; bool m_isAreaAura:1; bool m_isPassive:1; bool m_isPersistent:1; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f454fd35e..02209c3ad 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7138" + #define REVISION_NR "7139" #endif // __REVISION_NR_H__