aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2016-10-08 16:48:03 -0300
committerariel- <ariel-@users.noreply.github.com>2016-10-08 16:48:03 -0300
commit11650e4008871138cfec61f84e280adb2cdd2d5d (patch)
tree5b0264197c35ef9c8a13ef8c1139e2d15359e112
parenteb1a7297cfa6cd9e2e516161d4f101f936f78aa2 (diff)
Core/Scripts: updated Lock and Load script with new hooks, DamageInfo might be null, so check for that too
-rw-r--r--sql/updates/world/3.3.5/2016_10_08_07_world_335.sql3
-rw-r--r--src/server/scripts/Spells/spell_hunter.cpp69
2 files changed, 57 insertions, 15 deletions
diff --git a/sql/updates/world/3.3.5/2016_10_08_07_world_335.sql b/sql/updates/world/3.3.5/2016_10_08_07_world_335.sql
new file mode 100644
index 00000000000..d2d0a865af6
--- /dev/null
+++ b/sql/updates/world/3.3.5/2016_10_08_07_world_335.sql
@@ -0,0 +1,3 @@
+DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_hun_lock_and_load_dummy';
+INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
+(56342, 'spell_hun_lock_and_load_dummy');
diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp
index a6f9008955d..71efe85219b 100644
--- a/src/server/scripts/Spells/spell_hunter.cpp
+++ b/src/server/scripts/Spells/spell_hunter.cpp
@@ -621,26 +621,33 @@ class spell_hun_lock_and_load : public SpellScriptLoader
{
if (eventInfo.GetActor()->HasAura(SPELL_HUNTER_LOCK_AND_LOAD_MARKER))
return false;
-
return true;
}
- template <uint32 mask>
- void HandleProcs(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
+ bool CheckTrapProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
- PreventDefaultAction();
+ if (!(eventInfo.GetTypeMask() & PROC_FLAG_DONE_TRAP_ACTIVATION))
+ return false;
- if (!(eventInfo.GetTypeMask() & mask))
- return;
+ // Do not proc on traps for immolation/explosive trap
+ DamageInfo* damageInfo = eventInfo.GetDamageInfo();
+ if (!damageInfo || !(damageInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST))
+ return false;
- // Additional check: do not proc on traps for immolation/explosive trap
- // (But still do it for the periodic damage part)
- if (mask == PROC_FLAG_DONE_TRAP_ACTIVATION)
- if (!(eventInfo.GetDamageInfo()->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST))
- return;
+ return roll_chance_i(aurEff->GetAmount());
+ }
- if (!roll_chance_i(aurEff->GetAmount()))
- return;
+ bool CheckPeriodicProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
+ {
+ if (!(eventInfo.GetTypeMask() & PROC_FLAG_DONE_PERIODIC))
+ return false;
+
+ return roll_chance_i(aurEff->GetAmount());
+ }
+
+ void HandleProc(ProcEventInfo& eventInfo)
+ {
+ PreventDefaultAction();
Unit* caster = eventInfo.GetActor();
caster->CastSpell(caster, SPELL_HUNTER_LOCK_AND_LOAD_TRIGGER, true);
@@ -651,8 +658,10 @@ class spell_hun_lock_and_load : public SpellScriptLoader
{
DoCheckProc += AuraCheckProcFn(spell_hun_lock_and_load_AuraScript::CheckProc);
- OnEffectProc += AuraEffectProcFn(spell_hun_lock_and_load_AuraScript::HandleProcs<PROC_FLAG_DONE_TRAP_ACTIVATION>, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
- OnEffectProc += AuraEffectProcFn(spell_hun_lock_and_load_AuraScript::HandleProcs<PROC_FLAG_DONE_PERIODIC>, EFFECT_1, SPELL_AURA_DUMMY);
+ DoCheckEffectProc += AuraCheckEffectProcFn(spell_hun_lock_and_load_AuraScript::CheckTrapProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
+ DoCheckEffectProc += AuraCheckEffectProcFn(spell_hun_lock_and_load_AuraScript::CheckPeriodicProc, EFFECT_1, SPELL_AURA_DUMMY);
+
+ OnProc += AuraProcFn(spell_hun_lock_and_load_AuraScript::HandleProc);
}
};
@@ -662,6 +671,35 @@ class spell_hun_lock_and_load : public SpellScriptLoader
}
};
+// 56342 - Lock and Load (Rank 1)
+class spell_hun_lock_and_load_dummy : public SpellScriptLoader
+{
+ public:
+ spell_hun_lock_and_load_dummy() : SpellScriptLoader("spell_hun_lock_and_load_dummy") { }
+
+ class spell_hun_lock_and_load_dummy_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_hun_lock_and_load_dummy_AuraScript);
+
+ bool DummyCheck(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
+ {
+ // Prevents Aura proc from this dummy effect
+ // Only rank 1 has this aura
+ return false;
+ }
+
+ void Register() override
+ {
+ DoCheckEffectProc += AuraCheckEffectProcFn(spell_hun_lock_and_load_dummy_AuraScript::DummyCheck, EFFECT_2, SPELL_AURA_DUMMY);
+ }
+ };
+
+ AuraScript* GetAuraScript() const override
+ {
+ return new spell_hun_lock_and_load_dummy_AuraScript();
+ }
+};
+
// 53271 - Masters Call
class spell_hun_masters_call : public SpellScriptLoader
{
@@ -1476,6 +1514,7 @@ void AddSC_hunter_spell_scripts()
new spell_hun_kill_command_pet();
new spell_hun_last_stand_pet();
new spell_hun_lock_and_load();
+ new spell_hun_lock_and_load_dummy();
new spell_hun_masters_call();
new spell_hun_misdirection();
new spell_hun_misdirection_proc();