Commit Graph

79 Commits

Author SHA1 Message Date
Patman64
f38591565f Move On_Reset calls in HookMgr.
On_Reset should be called whether or not the hooks that call it have
events.
2015-01-06 20:03:00 -05:00
Rochet2
5e7b0ee0f7 Fix TC build, analysis warnings and triggering addon message hooks 2015-01-06 12:43:53 +02:00
Patman64
6371728547 Return from hooks early if no bindings exist.
Also add locking to the bindings to allow for thread-safe checking if
bindings exist.
2015-01-05 23:48:18 -05:00
Patman64
15f161fa1e Clean-up Eluna lock macro. 2015-01-05 22:52:46 -05:00
Patman64
e2f81b7336 Make the Eluna mutex static.
It was previously unsafe to reload Eluna because it had to be reloaded
with the mutex unlocked. This is because the mutex's lifespan was shorter
than the Eluna instance it was guarding.
2015-01-05 22:50:51 -05:00
Patman64
1678b3e40f Invalidate ElunaObjects after hook calls. 2015-01-05 21:24:55 -05:00
Patman64
1194074fb2 Simplify ReplaceArgument. 2015-01-05 21:20:14 -05:00
Rochet2
0e7367e23d Fix hookmgr rewrite
Fix:
 - crash on reload
 - crash on error in call
 - a warning from type change
2015-01-05 16:38:19 +02:00
Patman64
2ff25ee205 Fix getting results from event handlers. 2015-01-04 22:31:51 -05:00
Patman64
4349a80d8e Allow updating argument values between handler calls.
This allows handlers that return values to see the returned values of previous
handlers. E.g. if Handler A modifies the value from 10 to 20, Handler B
will receive 20 as an argument instead of the original 10.
2015-01-04 21:38:18 -05:00
Patman64
717d1b698d Re-write HookMgr macros into functions and clean-up HookMgr.cpp. 2015-01-04 20:30:31 -05:00
Rochet2
092c61c20b Eluna add mutex lock for hook calls 2015-01-03 22:20:30 +02:00
Tommy
803a835668 Happy New Year 2015 2015-01-01 13:59:33 -05:00
Rochet2
07d25f5031 Eluna Fix static analysis noted warnings and errors 2014-12-23 23:21:13 +02:00
Rochet2
dcd0a0e89c Fix linux build and warnings 2014-12-20 18:24:54 +02:00
Rochet2
78d18e8fee Fix previous commits to be more efficient overall and have better logic. Also try fix clang error. 2014-12-20 18:24:53 +02:00
Patman64
ed8edf065c Fix bug in previous commit that caused temporary bindings to die early.
Instead of decrementing all their counters every time an event occurs,
only the counters of the bindings being executed will be decremented.

`_LuaTemporariesDied` is a small optimization to prevent unnecessary calls
to `UpdateTemporaryBindings`. It will only be called when a temporary
binding has run out of shots and needs to be cleaned up.
2014-12-19 00:46:50 -05:00
Patman64
8c40dd1692 Allow temporary event handlers for all events.
This allows you to register a handler to only fire N times.

Dynamic event handler binding/unbinding is now possible.

For backwards compatibility, if the number of shots is missing, the event
handler will never be removed from the event.
2014-12-18 22:09:34 -05:00
Rochet2
7671054425 Eluna fix TC errors from previous commits, fix merge and fix a crash on osx 2014-12-15 23:25:09 +02:00
Patman64
3ff4c5f26e Allow multiple callbacks for the same entry/event combo.
The callbacks will be called in reverse-order of registration.
2014-12-15 02:16:37 -05:00
Patman64
3f08b37fd0 Make ReactorAI the default AI on mangos and allow overriding.
All AI event handlers (except OnReset) can now override the default AI
behavior on both mangos and Trinity by returning true.

For default behavior, return false or nothing.

Fixes #124.
2014-12-14 23:24:41 -05:00
Rochet2
6268216a64 Eluna implement changes from new_mthread to master ~ Does not add multithread support 2014-11-30 01:37:45 +02:00
Rochet2
4784c2052a Eluna: Correct whitespace 2014-09-20 22:07:24 +03:00
emudevs
0dfa5b3968 Added missing parameter OnQuestReward
Cleaned commented code
2014-09-15 16:00:06 -04:00
Rochet2
28a06b88fc Eluna: Remove on quest end hook because it doesnt function correctly and there is a replacement 2014-09-15 10:04:42 +03:00
Rochet2
e956e00a03 Eluna: Fix issues with SD2 compatibility 2014-09-13 20:12:30 +03:00
Rochet2
61551494e8 Merge branch 'master' of https://github.com/ElunaLuaEngine/Eluna into luaevents 2014-09-13 16:05:30 +03:00
Rochet2
06be9650bb Eluna fix crash in timed events and prepare some for future changes. Ditched EventProcessor 2014-09-13 16:05:16 +03:00
Foereaper
731682708f Added more BG hooks, fixed a few issues 2014-09-10 23:42:20 +02:00
Foereaper
0bfdf632e7 Added base BG methods and hooks
This has only been tested on Mangos Zero and will definitely need tweaking on Trinity

More methods will be added SHORTLY
2014-09-10 22:38:21 +02:00
Foereaper
7be917335a Added new hook for post reload 2014-09-10 01:28:52 +02:00
Rochet2
b6663ba2d1 Eluna fix previous commit (tested TC wotlk) 2014-08-23 15:41:19 +03:00
Rochet2
4c1a03cb0b Eluna fix chat hooks 2014-08-13 00:10:09 +03:00
Rochet2
30e5c418ba Eluna fix doc style and prepare merge a PR 2014-08-09 01:26:14 +03:00
Rochet2
a3359062e5 Eluna/Core Refactor code making LuaEngine.h lighter and splitting entities to their own files. Fixed reload crash for timed events 2014-07-16 16:12:07 +03:00
Rochet2
1447e0da57 Eluna improve object variable extension 2014-07-11 00:20:25 +03:00
Rochet2
dc8afa45b2 Eluna add new hook (need to think where to place this) and corrected Power functions 2014-07-09 21:18:20 +03:00
Rochet2
d09b5b04ba Eluna Closes:
#70, #69, #83, http://emudevs.com/showthread.php/3438-Custom-Items-and-On-Item-Use-Events
Fixes Object::~Object crash log from #71
2014-07-01 00:35:06 +03:00
Rochet2
1f75dc7843 Eluna change definition checks from mangos to tc 2014-06-29 21:29:03 +02:00
Rochet2
fdd63cd716 Eluna fix classic and TBC return false for item use 2014-06-29 21:29:02 +02:00
Rochet2
6cd2ed2b6f Eluna fix mangos build 2014-06-29 21:29:01 +02:00
Rochet2
0f8f37678d Eluna fix crash on InterruptSpell. Make item use and item gossip hooks to be able to return false to stop spell casting. 2014-06-29 21:29:01 +02:00
Rochet2
580b3f7a25 Fix linux warnings Implement #72 2014-06-29 21:28:59 +02:00
Rochet2
aa78932fd1 Eluna fix invalid stack state error 2014-06-29 21:28:59 +02:00
Rochet2
34517d77d1 Eluna fix crash on deleted item. Closes #66 2014-06-29 21:28:58 +02:00
Rochet2
aa96c42eb0 Eluna misc fixes 2014-06-29 21:28:58 +02:00
Rochet2
d294405272 Eluna fix invalid errors 2014-06-29 21:28:57 +02:00
Rochet2
0fd1615887 Eluna add event group type name to the error messages 2014-06-29 21:28:57 +02:00
Rochet2
79fd1d5bab Eluna fix crash on reload eluna used from console 2014-06-29 21:28:57 +02:00
Rochet2
45c5c876dd Eluna remove crash possibility of using ReloadEluna global function on returning hooks, restrict the use of the reload command 2014-06-29 21:28:55 +02:00