From 2ac6380202ca38da318d5f147d0e33fddea9488e Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 15 Aug 2013 16:32:22 +0200 Subject: Core/Auras: Allow preventing whole aura proc default handler from script hooks, just how it is possible for separate effects --- src/server/game/Entities/Unit/Unit.cpp | 7 +++---- src/server/game/Spells/Auras/SpellAuras.cpp | 6 +++++- src/server/game/Spells/Auras/SpellAuras.h | 2 +- src/server/game/Spells/SpellScript.cpp | 2 ++ 4 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index fd5b13c3d28..a51207ce531 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -14064,11 +14064,10 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u if (spellInfo->AttributesEx3 & SPELL_ATTR3_DISABLE_PROC) SetCantProc(true); - i->aura->CallScriptProcHandlers(aurApp, eventInfo); + bool handled = i->aura->CallScriptProcHandlers(aurApp, eventInfo); - // This bool is needed till separate aura effect procs are still here - bool handled = false; - if (HandleAuraProc(target, damage, i->aura, procSpell, procFlag, procExtra, cooldown, &handled)) + // "handled" is needed as long as proc can be handled in multiple places + if (!handled && HandleAuraProc(target, damage, i->aura, procSpell, procFlag, procExtra, cooldown, &handled)) { TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), Id); takeCharges = true; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 2846137ad95..51a04749c30 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -2269,8 +2269,9 @@ bool Aura::CallScriptPrepareProcHandlers(AuraApplication const* aurApp, ProcEven return prepare; } -void Aura::CallScriptProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo) +bool Aura::CallScriptProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo) { + bool handled = false; for (std::list::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_PROC, aurApp); @@ -2278,8 +2279,11 @@ void Aura::CallScriptProcHandlers(AuraApplication const* aurApp, ProcEventInfo& for (; hookItr != hookItrEnd; ++hookItr) hookItr->Call(*scritr, eventInfo); + handled |= (*scritr)->_IsDefaultActionPrevented(); (*scritr)->_FinishScriptCall(); } + + return handled; } void Aura::CallScriptAfterProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo) diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index e865d415438..9e7d0cce82c 100644 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -229,7 +229,7 @@ class Aura // Spell Proc Hooks bool CallScriptCheckProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo); bool CallScriptPrepareProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo); - void CallScriptProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo); + bool CallScriptProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo); void CallScriptAfterProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo); bool CallScriptEffectProcHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, ProcEventInfo& eventInfo); void CallScriptAfterEffectProcHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, ProcEventInfo& eventInfo); diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 5fb4d69cd02..bb9aab023af 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -909,6 +909,7 @@ bool AuraScript::_IsDefaultActionPrevented() case AURA_SCRIPT_HOOK_EFFECT_ABSORB: case AURA_SCRIPT_HOOK_EFFECT_SPLIT: case AURA_SCRIPT_HOOK_PREPARE_PROC: + case AURA_SCRIPT_HOOK_PROC: case AURA_SCRIPT_HOOK_EFFECT_PROC: return m_defaultActionPrevented; default: @@ -927,6 +928,7 @@ void AuraScript::PreventDefaultAction() case AURA_SCRIPT_HOOK_EFFECT_ABSORB: case AURA_SCRIPT_HOOK_EFFECT_SPLIT: case AURA_SCRIPT_HOOK_PREPARE_PROC: + case AURA_SCRIPT_HOOK_PROC: case AURA_SCRIPT_HOOK_EFFECT_PROC: m_defaultActionPrevented = true; break; -- cgit v1.2.3 From d1bb6da668c15e6b359c7b1ef0287d1004fcbe58 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 15 Aug 2013 16:34:57 +0200 Subject: Core/Spells: Fixed cast time mods using two charges on every cast --- src/server/game/Entities/Unit/Unit.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index a51207ce531..274e9303946 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2968,11 +2968,11 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]) { // break autorepeat if not Auto Shot - if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75) + if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->GetSpellInfo()->Id != 75) InterruptSpell(CURRENT_AUTOREPEAT_SPELL); m_AutoRepeatFirstCast = true; } - if (pSpell->m_spellInfo->CalcCastTime(this) > 0) + if (pSpell->GetCastTime() > 0) AddUnitState(UNIT_STATE_CASTING); break; @@ -2985,7 +2985,7 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) // it also does break autorepeat if not Auto Shot if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && - m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75) + m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->GetSpellInfo()->Id != 75) InterruptSpell(CURRENT_AUTOREPEAT_SPELL); AddUnitState(UNIT_STATE_CASTING); @@ -2994,7 +2994,7 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) case CURRENT_AUTOREPEAT_SPELL: { // only Auto Shoot does not break anything - if (pSpell->m_spellInfo->Id != 75) + if (pSpell->GetSpellInfo()->Id != 75) { // generic autorepeats break generic non-delayed and channeled non-delayed spells InterruptSpell(CURRENT_GENERIC_SPELL, false); -- cgit v1.2.3 From c52f9aa3157bddc7dffb67ac03b3bfdf7977c55c Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 15 Aug 2013 16:37:18 +0200 Subject: Core/Spells: Refactored SpellInfo::CalcCastTime() to prevent accidental mod charge losses caused by its incorrect usage --- src/server/game/Spells/Spell.cpp | 22 ++++++++++++---------- src/server/game/Spells/SpellInfo.cpp | 6 +++--- src/server/game/Spells/SpellInfo.h | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 82460b7b218..be88179b168 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3050,18 +3050,20 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered // Prepare data for triggers prepareDataForTriggerSystem(triggeredByAura); - if (m_caster->GetTypeId() == TYPEID_PLAYER) - m_caster->ToPlayer()->SetSpellModTakingSpell(this, true); - // calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail) - m_casttime = m_spellInfo->CalcCastTime(m_caster, this); - if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (Player* player = m_caster->ToPlayer()) { - m_caster->ToPlayer()->SetSpellModTakingSpell(this, false); - - // Set casttime to 0 if .cheat casttime is enabled. - if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_CASTTIME)) - m_casttime = 0; + if (!m_caster->ToPlayer()->GetCommandStatus(CHEAT_CASTTIME)) + { + m_caster->ToPlayer()->SetSpellModTakingSpell(this, true); + // calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail) + m_casttime = m_spellInfo->CalcCastTime(this); + m_caster->ToPlayer()->SetSpellModTakingSpell(this, false); + } + else + m_casttime = 0; // Set cast time to 0 if .cheat casttime is enabled. } + else + m_casttime = m_spellInfo->CalcCastTime(this); // don't allow channeled spells / spells with cast time to be casted while moving // (even if they are interrupted on moving, spells with almost immediate effect get to have their effect processed before movement interrupter kicks in) diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 3ac1351c135..04437b82f2d 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -2057,7 +2057,7 @@ int32 SpellInfo::GetMaxDuration() const return (DurationEntry->Duration[2] == -1) ? -1 : abs(DurationEntry->Duration[2]); } -uint32 SpellInfo::CalcCastTime(Unit* caster, Spell* spell) const +uint32 SpellInfo::CalcCastTime(Spell* spell /*= NULL*/) const { // not all spells have cast time index and this is all is pasiive abilities if (!CastTimeEntry) @@ -2065,8 +2065,8 @@ uint32 SpellInfo::CalcCastTime(Unit* caster, Spell* spell) const int32 castTime = CastTimeEntry->CastTime; - if (caster) - caster->ModSpellCastTime(this, castTime, spell); + if (spell) + spell->GetCaster()->ModSpellCastTime(this, castTime, spell); if (Attributes & SPELL_ATTR0_REQ_AMMO && (!IsAutoRepeatRangedSpell())) castTime += 500; diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index 82fa1129429..6acde5afa74 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -444,7 +444,7 @@ public: uint32 GetMaxTicks() const; - uint32 CalcCastTime(Unit* caster = NULL, Spell* spell = NULL) const; + uint32 CalcCastTime(Spell* spell = NULL) const; uint32 GetRecoveryTime() const; int32 CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask) const; -- cgit v1.2.3 From a647d3590c91816272b94a1c9d31dcfe378e22a2 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 15 Aug 2013 16:38:35 +0200 Subject: Core/Spells: Fixed Execute rolling for procs twice --- src/server/game/Spells/SpellMgr.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index d8094488fcd..94454e8440d 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3106,6 +3106,17 @@ void SpellMgr::LoadSpellInfoCorrections() // Entries were not updated after spell effect change, we have to do that manually :/ spellInfo->AttributesEx3 |= SPELL_ATTR3_CAN_PROC_WITH_TRIGGERED; break; + case 5308: // Execute (Rank 1) + case 20658: // Execute (Rank 2) + case 20660: // Execute (Rank 3) + case 20661: // Execute (Rank 4) + case 20662: // Execute (Rank 5) + case 25234: // Execute (Rank 6) + case 25236: // Execute (Rank 7) + case 47470: // Execute (Rank 8) + case 47471: // Execute (Rank 9) + spellInfo->AttributesEx3 |= SPELL_ATTR3_CANT_TRIGGER_PROC; + break; case 59725: // Improved Spell Reflection - aoe aura // Target entry seems to be wrong for this spell :/ spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER_AREA_PARTY); -- cgit v1.2.3 From 4d260a54aebbdabdb9982e297d1e5086f8a68fa9 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 15 Aug 2013 16:39:31 +0200 Subject: Core/Spells: Fixed warrior T10 4p dps bonus Closes #493 --- sql/updates/world/2013_08_15_02_world_spell_proc_event.sql | 3 +++ src/server/scripts/Spells/spell_warrior.cpp | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 sql/updates/world/2013_08_15_02_world_spell_proc_event.sql (limited to 'src') diff --git a/sql/updates/world/2013_08_15_02_world_spell_proc_event.sql b/sql/updates/world/2013_08_15_02_world_spell_proc_event.sql new file mode 100644 index 00000000000..4e2b04faea4 --- /dev/null +++ b/sql/updates/world/2013_08_15_02_world_spell_proc_event.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_proc_event` WHERE `entry`=46916; +INSERT INTO `spell_proc_event` (`entry`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`) VALUES +(46916,4,0x200000,0x0,0x0); diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 78dcaaa669c..d022eef65b9 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -578,9 +578,8 @@ class spell_warr_slam : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - int32 bp0 = GetEffectValue(); if (GetHitUnit()) - GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_WARRIOR_SLAM, &bp0, NULL, NULL, true, 0); + GetCaster()->CastCustomSpell(SPELL_WARRIOR_SLAM, SPELLVALUE_BASE_POINT0, GetEffectValue(), GetHitUnit(), TRIGGERED_FULL_MASK); } void Register() OVERRIDE -- cgit v1.2.3