From b442332403b01f689a136816a30a1280c5cb6e3c Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 20 Mar 2011 07:15:14 +0300 Subject: [PATCH] [11267] Restore itemset 647 4p bonus affect work. --- src/game/Unit.h | 1 + src/game/UnitAuraProcHandler.cpp | 69 +++++++++++++++++++++++++++----- src/shared/revision_nr.h | 2 +- 3 files changed, 60 insertions(+), 12 deletions(-) diff --git a/src/game/Unit.h b/src/game/Unit.h index c52cda59c..c894f430d 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1853,6 +1853,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject SpellAuraProcResult HandleAddPctModifierAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); SpellAuraProcResult HandleModDamagePercentDoneAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); SpellAuraProcResult HandleModRating(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + SpellAuraProcResult HandleManaShieldAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); SpellAuraProcResult HandleNULLProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown) { // no proc handler for this aura type diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp index 630fb896a..bb526b890 100644 --- a/src/game/UnitAuraProcHandler.cpp +++ b/src/game/UnitAuraProcHandler.cpp @@ -129,7 +129,7 @@ pAuraProcHandler AuraProcHandler[TOTAL_AURAS]= &Unit::HandleNULLProc, // 94 SPELL_AURA_INTERRUPT_REGEN &Unit::HandleNULLProc, // 95 SPELL_AURA_GHOST &Unit::HandleNULLProc, // 96 SPELL_AURA_SPELL_MAGNET - &Unit::HandleNULLProc, // 97 SPELL_AURA_MANA_SHIELD + &Unit::HandleManaShieldAuraProc, // 97 SPELL_AURA_MANA_SHIELD &Unit::HandleNULLProc, // 98 SPELL_AURA_MOD_SKILL_TALENT &Unit::HandleNULLProc, // 99 SPELL_AURA_MOD_ATTACK_POWER &Unit::HandleNULLProc, //100 SPELL_AURA_AURAS_VISIBLE obsolete 3.x? all player can see all auras now, but still have 2 spells including GM-spell (1852,2855) @@ -1086,16 +1086,6 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura target = this; break; } - // Incanter's Regalia set (add trigger chance to Mana Shield) - if (dummySpell->SpellFamilyFlags & UI64LIT(0x0000000000008000)) - { - if (GetTypeId() != TYPEID_PLAYER) - return SPELL_AURA_PROC_FAILED; - - target = this; - triggered_spell_id = 37436; - break; - } switch(dummySpell->Id) { // Ignite @@ -3888,3 +3878,60 @@ SpellAuraProcResult Unit::HandleModRating(Unit* /*pVictim*/, uint32 /*damage*/, return SPELL_AURA_PROC_OK; } + +SpellAuraProcResult Unit::HandleManaShieldAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown) +{ + SpellEntry const *dummySpell = triggeredByAura->GetSpellProto (); + + Item* castItem = !triggeredByAura->GetCastItemGuid().IsEmpty() && GetTypeId()==TYPEID_PLAYER + ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGuid()) : NULL; + + uint32 triggered_spell_id = 0; + Unit* target = pVictim; + + switch(dummySpell->SpellFamilyName) + { + case SPELLFAMILY_MAGE: + { + // Incanter's Regalia set (add trigger chance to Mana Shield) + if (dummySpell->SpellFamilyFlags & UI64LIT(0x0000000000008000)) + { + if (GetTypeId() != TYPEID_PLAYER) + return SPELL_AURA_PROC_FAILED; + + target = this; + triggered_spell_id = 37436; + break; + } + break; + } + default: + break; + } + + // processed charge only counting case + if (!triggered_spell_id) + return SPELL_AURA_PROC_OK; + + SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id); + + if (!triggerEntry) + { + sLog.outError("Unit::HandleManaShieldAuraProc: Spell %u have nonexistent triggered spell %u",dummySpell->Id,triggered_spell_id); + return SPELL_AURA_PROC_FAILED; + } + + // default case + if (!target || (target != this && !target->isAlive())) + return SPELL_AURA_PROC_FAILED; + + if (cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) + return SPELL_AURA_PROC_FAILED; + + CastSpell(target, triggered_spell_id, true, castItem, triggeredByAura); + + if (cooldown && GetTypeId()==TYPEID_PLAYER) + ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown); + + return SPELL_AURA_PROC_OK; +} diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7aad8bff8..1741994bb 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 "11266" + #define REVISION_NR "11267" #endif // __REVISION_NR_H__