Skip to content

Commit f276d1c

Browse files
committed
Prevent swallowing preventDefault.
1 parent 054c4d7 commit f276d1c

2 files changed

Lines changed: 17 additions & 14 deletions

File tree

LuaEngine.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,10 +653,10 @@ class ELUNA_GAME_API Eluna
653653
void OnObjectAreaTargetSelect(Spell* pSpell, uint8 effIndex, std::list<WorldObject*>& targets);
654654
void OnObjectTargetSelect(Spell* pSpell, uint8 effIndex, WorldObject*& target);
655655
void OnDestinationTargetSelect(Spell* pSpell, uint8 effIndex, SpellDestination& target);
656-
bool OnEffectLaunch(Spell* pSpell, uint8 effIndex, uint8 mode);
657-
bool OnEffectLaunchTarget(Spell* pSpell, uint8 effIndex, uint8 mode);
658-
bool OnEffectHit(Spell* pSpell, uint8 effIndex, uint8 mode);
659-
bool OnEffectHitTarget(Spell* pSpell, uint8 effIndex, uint8 mode);
656+
bool OnEffectLaunch(Spell* pSpell, uint8 effIndex, uint8 mode, bool preventDefault);
657+
bool OnEffectLaunchTarget(Spell* pSpell, uint8 effIndex, uint8 mode, bool preventDefault);
658+
bool OnEffectHit(Spell* pSpell, uint8 effIndex, uint8 mode, bool preventDefault);
659+
bool OnEffectHitTarget(Spell* pSpell, uint8 effIndex, uint8 mode, bool preventDefault);
660660
void OnBeforeSpellHit(Spell* pSpell, uint8 missInfo);
661661
void OnSpellHit(Spell* pSpell);
662662
void OnAfterSpellHit(Spell* pSpell);

hooks/SpellHooks.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ void Eluna::OnDestinationTargetSelect(Spell* pSpell, uint8 effIndex, SpellDestin
209209
target._position.SetOrientation(orientation);
210210
}
211211

212-
bool Eluna::OnEffectLaunch(Spell* pSpell, uint8 effIndex, uint8 mode)
212+
bool Eluna::OnEffectLaunch(Spell* pSpell, uint8 effIndex, uint8 mode, bool preventDefault)
213213
{
214214
START_HOOK_WITH_RETVAL(SPELL_EVENT_ON_EFFECT_LAUNCH, pSpell, false);
215215
HookPush(pSpell);
@@ -218,31 +218,34 @@ bool Eluna::OnEffectLaunch(Spell* pSpell, uint8 effIndex, uint8 mode)
218218
return CallAllFunctionsBool(binding, key, false);
219219
}
220220

221-
bool Eluna::OnEffectLaunchTarget(Spell* pSpell, uint8 effIndex, uint8 mode)
221+
bool Eluna::OnEffectLaunchTarget(Spell* pSpell, uint8 effIndex, uint8 mode, bool preventDefault)
222222
{
223-
START_HOOK_WITH_RETVAL(SPELL_EVENT_ON_EFFECT_LAUNCH_TARGET, pSpell, false);
223+
START_HOOK_WITH_RETVAL(SPELL_EVENT_ON_EFFECT_LAUNCH_TARGET, pSpell, preventDefault);
224224
HookPush(pSpell);
225225
HookPush(effIndex);
226226
HookPush(mode);
227-
return CallAllFunctionsBool(binding, key, false);
227+
preventDefault = CallAllFunctionsBool(binding, key, preventDefault);
228+
return preventDefault;
228229
}
229230

230-
bool Eluna::OnEffectHit(Spell* pSpell, uint8 effIndex, uint8 mode)
231+
bool Eluna::OnEffectHit(Spell* pSpell, uint8 effIndex, uint8 mode, bool preventDefault)
231232
{
232-
START_HOOK_WITH_RETVAL(SPELL_EVENT_ON_EFFECT_HIT, pSpell, false);
233+
START_HOOK_WITH_RETVAL(SPELL_EVENT_ON_EFFECT_HIT, pSpell, preventDefault);
233234
HookPush(pSpell);
234235
HookPush(effIndex);
235236
HookPush(mode);
236-
return CallAllFunctionsBool(binding, key, false);
237+
preventDefault = CallAllFunctionsBool(binding, key, preventDefault);
238+
return preventDefault;
237239
}
238240

239-
bool Eluna::OnEffectHitTarget(Spell* pSpell, uint8 effIndex, uint8 mode)
241+
bool Eluna::OnEffectHitTarget(Spell* pSpell, uint8 effIndex, uint8 mode, bool preventDefault)
240242
{
241-
START_HOOK_WITH_RETVAL(SPELL_EVENT_ON_EFFECT_HIT_TARGET, pSpell, false);
243+
START_HOOK_WITH_RETVAL(SPELL_EVENT_ON_EFFECT_HIT_TARGET, pSpell, preventDefault);
242244
HookPush(pSpell);
243245
HookPush(effIndex);
244246
HookPush(mode);
245-
return CallAllFunctionsBool(binding, key, false);
247+
preventDefault = CallAllFunctionsBool(binding, key, preventDefault);
248+
return preventDefault;
246249
}
247250

248251
void Eluna::OnBeforeSpellHit(Spell* pSpell, uint8 missInfo)

0 commit comments

Comments
 (0)