Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
HookMgr.cpp
Go to the documentation of this file.
1/*
2* Copyright (C) 2010 - 2013 Eluna Lua Engine <http://emudevs.com/>
3* This program is free software licensed under GPL version 3
4* Please see the included DOCS/LICENSE.TXT for more information
5*/
6
7#include "HookMgr.h"
8#include "LuaEngine.h"
9
10#include "GossipDef.h"
11#include "ObjectAccessor.h"
12#include "Player.h"
13#include "Spell.h"
14#include "SpellInfo.h"
15
17{
18 static HookMgr instance;
19 return &instance;
20}
21
23{
24 sEluna->m_EventMgr.Update(diff);
25 for (std::vector<int>::const_iterator itr = sEluna->ServerEventBindings[WORLD_EVENT_ON_UPDATE].begin();
26 itr != sEluna->ServerEventBindings[WORLD_EVENT_ON_UPDATE].end(); ++itr)
27 {
28 sEluna->BeginCall((*itr));
30 sEluna->Push(sEluna->L, diff);
31 sEluna->ExecuteCall(2, 0);
32 }
33}
34
35void HookMgr::OnLootItem(Player* pPlayer, Item* pItem, uint32 count, uint64 guid)
36{
37 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_LOOT_ITEM].begin();
38 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_LOOT_ITEM].end(); ++itr)
39 {
40 sEluna->BeginCall((*itr));
42 sEluna->Push(sEluna->L, pPlayer);
43 sEluna->Push(sEluna->L, pItem);
44 sEluna->Push(sEluna->L, count);
45 sEluna->Push(sEluna->L, guid);
46 sEluna->ExecuteCall(5, 0);
47 }
48}
49
50void HookMgr::OnLootMoney(Player* pPlayer, uint32 amount)
51{
52 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_LOOT_MONEY].begin();
53 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_LOOT_MONEY].end(); ++itr)
54 {
55 sEluna->BeginCall((*itr));
57 sEluna->Push(sEluna->L, pPlayer);
58 sEluna->Push(sEluna->L, amount);
59 sEluna->ExecuteCall(3, 0);
60 }
61}
62
64{
65 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_FIRST_LOGIN].begin();
66 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_FIRST_LOGIN].end(); ++itr)
67 {
68 sEluna->BeginCall((*itr));
70 sEluna->Push(sEluna->L, pPlayer);
71 sEluna->ExecuteCall(2, 0);
72 }
73}
74
76{
77 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_REPOP].begin();
78 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_REPOP].end(); ++itr)
79 {
80 sEluna->BeginCall((*itr));
82 sEluna->Push(sEluna->L, pPlayer);
83 sEluna->ExecuteCall(2, 0);
84 }
85}
86
88{
89 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_RESURRECT].begin();
90 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_RESURRECT].end(); ++itr)
91 {
92 sEluna->BeginCall((*itr));
94 sEluna->Push(sEluna->L, pPlayer);
95 sEluna->ExecuteCall(2, 0);
96 }
97}
98
99void HookMgr::OnEquip(Player* pPlayer, Item* pItem, uint8 bag, uint8 slot)
100{
101 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_EQUIP].begin();
102 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_EQUIP].end(); ++itr)
103 {
104 sEluna->BeginCall((*itr));
106 sEluna->Push(sEluna->L, pPlayer);
107 sEluna->Push(sEluna->L, pItem);
108 sEluna->Push(sEluna->L, bag);
109 sEluna->Push(sEluna->L, slot);
110 sEluna->ExecuteCall(5, 0);
111 }
112}
113
115{
117 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_CAN_USE_ITEM].begin();
118 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_CAN_USE_ITEM].end(); ++itr)
119 {
120 sEluna->BeginCall((*itr));
122 sEluna->Push(sEluna->L, pPlayer);
123 sEluna->Push(sEluna->L, itemEntry);
124 if (sEluna->ExecuteCall(3, 1))
125 {
126 lua_State* L = sEluna->L;
127 if (!lua_isnoneornil(L, 1))
128 result = (InventoryResult)lua_tounsigned(L, 1);
129 sEluna->EndCall(1);
130 }
131 }
132 return result;
133}
134
135void HookMgr::HandleGossipSelectOption(Player* pPlayer, Item* item, uint32 sender, uint32 action, std::string code)
136{
137 int bind = sEluna->ItemGossipBindings->GetBind(item->GetEntry(), GOSSIP_EVENT_ON_SELECT);
138 if (bind)
139 {
140 pPlayer->PlayerTalkClass->ClearMenus();
141 sEluna->BeginCall(bind);
143 sEluna->Push(sEluna->L, pPlayer);
144 sEluna->Push(sEluna->L, item);
145 sEluna->Push(sEluna->L, sender);
146 sEluna->Push(sEluna->L, action);
147 if (code.empty())
148 lua_pushnil(sEluna->L);
149 else
150 sEluna->Push(sEluna->L, code);
151 sEluna->ExecuteCall(6, 0);
152 }
153}
154
155void HookMgr::HandleGossipSelectOption(Player* pPlayer, uint32 menuId, uint32 sender, uint32 action, std::string code)
156{
157 int bind = sEluna->playerGossipBindings->GetBind(menuId, GOSSIP_EVENT_ON_SELECT);
158 if (bind)
159 {
160 pPlayer->PlayerTalkClass->ClearMenus();
161 sEluna->BeginCall(bind);
163 sEluna->Push(sEluna->L, pPlayer); // receiver
164 sEluna->Push(sEluna->L, pPlayer); // sender, just not to mess up the amount of args.
165 sEluna->Push(sEluna->L, sender);
166 sEluna->Push(sEluna->L, action);
167 if (code.empty())
168 lua_pushnil(sEluna->L);
169 else
170 sEluna->Push(sEluna->L, code);
171 sEluna->Push(sEluna->L, menuId);
172 sEluna->ExecuteCall(7, 0);
173 }
174}
175
177{
178 for (std::vector<int>::const_iterator itr = sEluna->ServerEventBindings[ELUNA_EVENT_ON_RESTART].begin();
179 itr != sEluna->ServerEventBindings[ELUNA_EVENT_ON_RESTART].end(); ++itr)
180 {
181 sEluna->BeginCall((*itr));
183 sEluna->ExecuteCall(1, 0);
184 }
185}
186
187// item
188bool HookMgr::OnDummyEffect(Unit* pCaster, uint32 spellId, SpellEffIndex effIndex, Item* pTarget)
189{
190 int bind = sEluna->ItemEventBindings->GetBind(pTarget->GetEntry(), ITEM_EVENT_ON_DUMMY_EFFECT);
191 if (!bind)
192 return false;
193 sEluna->BeginCall(bind);
195 sEluna->Push(sEluna->L, pCaster);
196 sEluna->Push(sEluna->L, spellId);
197 sEluna->Push(sEluna->L, effIndex);
198 sEluna->Push(sEluna->L, pTarget);
199 sEluna->ExecuteCall(5, 0);
200 return true;
201}
202
203bool HookMgr::OnQuestAccept(Player* pPlayer, Item* pItem, Quest const* pQuest)
204{
205 int bind = sEluna->ItemEventBindings->GetBind(pItem->GetEntry(), ITEM_EVENT_ON_QUEST_ACCEPT);
206 if (!bind)
207 return false;
208 sEluna->BeginCall(bind);
210 sEluna->Push(sEluna->L, pPlayer);
211 sEluna->Push(sEluna->L, pItem);
212 sEluna->Push(sEluna->L, pQuest);
213 sEluna->ExecuteCall(4, 0);
214 return true;
215}
216
217bool HookMgr::OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets)
218{
219 int bind1 = sEluna->ItemGossipBindings->GetBind(pItem->GetEntry(), GOSSIP_EVENT_ON_HELLO);
220 int bind2 = sEluna->ItemEventBindings->GetBind(pItem->GetEntry(), ITEM_EVENT_ON_USE);
221 if (!bind1 && !bind2)
222 return false;
223 if (bind1)
224 {
225 pPlayer->PlayerTalkClass->ClearMenus();
226 sEluna->BeginCall(bind1);
228 sEluna->Push(sEluna->L, pPlayer);
229 sEluna->Push(sEluna->L, pItem);
230 sEluna->ExecuteCall(3, 0);
231 }
232 if (bind2)
233 {
234 sEluna->BeginCall(bind2);
236 sEluna->Push(sEluna->L, pPlayer);
237 sEluna->Push(sEluna->L, pItem);
238 if (GameObject* target = targets.GetGOTarget())
239 sEluna->Push(sEluna->L, target);
240 else if (Item* target = targets.GetItemTarget())
241 sEluna->Push(sEluna->L, target);
242 else if (Unit* target = targets.GetUnitTarget())
243 sEluna->Push(sEluna->L, target);
244 else
245 sEluna->Push(sEluna->L);
246 sEluna->ExecuteCall(4, 0);
247 }
248 // pPlayer->SendEquipError((InventoryResult)83, pItem, NULL);
249 return false;
250}
251
252bool HookMgr::OnExpire(Player* pPlayer, ItemTemplate const* pProto)
253{
254 int bind = sEluna->ItemEventBindings->GetBind(pProto->ItemId, ITEM_EVENT_ON_EXPIRE);
255 if (!bind)
256 return false;
257 sEluna->BeginCall(bind);
259 sEluna->Push(sEluna->L, pPlayer);
260 sEluna->Push(sEluna->L, pProto->ItemId);
261 sEluna->ExecuteCall(3, 0);
262 return true;
263}
264// creature
265bool HookMgr::OnDummyEffect(Unit* pCaster, uint32 spellId, SpellEffIndex effIndex, Creature* pTarget)
266{
267 int bind = sEluna->CreatureEventBindings->GetBind(pTarget->GetEntry(), CREATURE_EVENT_ON_DUMMY_EFFECT);
268 if (!bind)
269 return false;
270 sEluna->BeginCall(bind);
272 sEluna->Push(sEluna->L, pCaster);
273 sEluna->Push(sEluna->L, spellId);
274 sEluna->Push(sEluna->L, effIndex);
275 sEluna->Push(sEluna->L, pTarget);
276 sEluna->ExecuteCall(5, 0);
277 return true;
278}
279
280bool HookMgr::OnGossipHello(Player* pPlayer, Creature* pCreature)
281{
282 int bind = sEluna->CreatureGossipBindings->GetBind(pCreature->GetEntry(), GOSSIP_EVENT_ON_HELLO);
283 if (!bind)
284 return false;
285 pPlayer->PlayerTalkClass->ClearMenus();
286 sEluna->BeginCall(bind);
288 sEluna->Push(sEluna->L, pPlayer);
289 sEluna->Push(sEluna->L, pCreature);
290 sEluna->ExecuteCall(3, 0);
291 return true;
292}
293
294bool HookMgr::OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action)
295{
296 int bind = sEluna->CreatureGossipBindings->GetBind(pCreature->GetEntry(), GOSSIP_EVENT_ON_SELECT);
297 if (!bind)
298 return false;
299 pPlayer->PlayerTalkClass->ClearMenus();
300 sEluna->BeginCall(bind);
302 sEluna->Push(sEluna->L, pPlayer);
303 sEluna->Push(sEluna->L, pCreature);
304 sEluna->Push(sEluna->L, sender);
305 sEluna->Push(sEluna->L, action);
306 sEluna->ExecuteCall(5, 0);
307 return true;
308}
309
310bool HookMgr::OnGossipSelectCode(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action, const char* code)
311{
312 int bind = sEluna->CreatureGossipBindings->GetBind(pCreature->GetEntry(), GOSSIP_EVENT_ON_SELECT);
313 if (!bind)
314 return false;
315 pPlayer->PlayerTalkClass->ClearMenus();
316 sEluna->BeginCall(bind);
318 sEluna->Push(sEluna->L, pPlayer);
319 sEluna->Push(sEluna->L, pCreature);
320 sEluna->Push(sEluna->L, sender);
321 sEluna->Push(sEluna->L, action);
322 sEluna->Push(sEluna->L, code);
323 sEluna->ExecuteCall(6, 0);
324 return true;
325}
326
327bool HookMgr::OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
328{
329 int bind = sEluna->CreatureEventBindings->GetBind(pCreature->GetEntry(), CREATURE_EVENT_ON_QUEST_ACCEPT);
330 if (!bind)
331 return false;
332 sEluna->BeginCall(bind);
334 sEluna->Push(sEluna->L, pPlayer);
335 sEluna->Push(sEluna->L, pCreature);
336 sEluna->Push(sEluna->L, pQuest);
337 sEluna->ExecuteCall(4, 0);
338 return true;
339}
340
341bool HookMgr::OnQuestSelect(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
342{
343 int bind = sEluna->CreatureEventBindings->GetBind(pCreature->GetEntry(), CREATURE_EVENT_ON_QUEST_SELECT);
344 if (!bind)
345 return false;
346 sEluna->BeginCall(bind);
348 sEluna->Push(sEluna->L, pPlayer);
349 sEluna->Push(sEluna->L, pCreature);
350 sEluna->Push(sEluna->L, pQuest);
351 sEluna->ExecuteCall(4, 0);
352 return true;
353}
354
355bool HookMgr::OnQuestComplete(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
356{
357 int bind = sEluna->CreatureEventBindings->GetBind(pCreature->GetEntry(), CREATURE_EVENT_ON_QUEST_COMPLETE);
358 if (!bind)
359 return false;
360 sEluna->BeginCall(bind);
362 sEluna->Push(sEluna->L, pPlayer);
363 sEluna->Push(sEluna->L, pCreature);
364 sEluna->Push(sEluna->L, pQuest);
365 sEluna->ExecuteCall(4, 0);
366 return true;
367}
368
369bool HookMgr::OnQuestReward(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
370{
371 int bind = sEluna->CreatureEventBindings->GetBind(pCreature->GetEntry(), CREATURE_EVENT_ON_QUEST_REWARD);
372 if (!bind)
373 return false;
374 sEluna->BeginCall(bind);
376 sEluna->Push(sEluna->L, pPlayer);
377 sEluna->Push(sEluna->L, pCreature);
378 sEluna->Push(sEluna->L, pQuest);
379 sEluna->ExecuteCall(4, 0);
380 return true;
381}
382
384{
385 int bind = sEluna->CreatureEventBindings->GetBind(pCreature->GetEntry(), CREATURE_EVENT_ON_DIALOG_STATUS);
386 if (!bind)
387 return std::nullopt;
388 sEluna->BeginCall(bind);
390 sEluna->Push(sEluna->L, pPlayer);
391 sEluna->Push(sEluna->L, pCreature);
392 sEluna->ExecuteCall(3, 0);
394}
395// gameobject
396bool HookMgr::OnDummyEffect(Unit* pCaster, uint32 spellId, SpellEffIndex effIndex, GameObject* pTarget)
397{
398 int bind = sEluna->GameObjectEventBindings->GetBind(pTarget->GetEntry(), GAMEOBJECT_EVENT_ON_DUMMY_EFFECT);
399 if (!bind)
400 return false;
401 sEluna->BeginCall(bind);
403 sEluna->Push(sEluna->L, pCaster);
404 sEluna->Push(sEluna->L, spellId);
405 sEluna->Push(sEluna->L, effIndex);
406 sEluna->Push(sEluna->L, pTarget);
407 sEluna->ExecuteCall(5, 0);
408 return true;
409}
410
411bool HookMgr::OnGossipHello(Player* pPlayer, GameObject* pGameObject)
412{
413 int bind = sEluna->GameObjectGossipBindings->GetBind(pGameObject->GetEntry(), GOSSIP_EVENT_ON_HELLO);
414 if (!bind)
415 return false;
416 pPlayer->PlayerTalkClass->ClearMenus();
417 sEluna->BeginCall(bind);
419 sEluna->Push(sEluna->L, pPlayer);
420 sEluna->Push(sEluna->L, pGameObject);
421 sEluna->ExecuteCall(3, 0);
422 return true;
423}
424
425bool HookMgr::OnGossipSelect(Player* pPlayer, GameObject* pGameObject, uint32 sender, uint32 action)
426{
427 int bind = sEluna->GameObjectGossipBindings->GetBind(pGameObject->GetEntry(), GOSSIP_EVENT_ON_SELECT);
428 if (!bind)
429 return false;
430 pPlayer->PlayerTalkClass->ClearMenus();
431 sEluna->BeginCall(bind);
433 sEluna->Push(sEluna->L, pPlayer);
434 sEluna->Push(sEluna->L, pGameObject);
435 sEluna->Push(sEluna->L, sender);
436 sEluna->Push(sEluna->L, action);
437 sEluna->ExecuteCall(5, 0);
438 return true;
439}
440
441bool HookMgr::OnGossipSelectCode(Player* pPlayer, GameObject* pGameObject, uint32 sender, uint32 action, const char* code)
442{
443 int bind = sEluna->GameObjectGossipBindings->GetBind(pGameObject->GetEntry(), GOSSIP_EVENT_ON_SELECT);
444 if (!bind)
445 return false;
446 pPlayer->PlayerTalkClass->ClearMenus();
447 sEluna->BeginCall(bind);
449 sEluna->Push(sEluna->L, pPlayer);
450 sEluna->Push(sEluna->L, pGameObject);
451 sEluna->Push(sEluna->L, sender);
452 sEluna->Push(sEluna->L, action);
453 sEluna->Push(sEluna->L, code);
454 sEluna->ExecuteCall(6, 0);
455 return true;
456}
457
458bool HookMgr::OnQuestAccept(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest)
459{
460 int bind = sEluna->GameObjectEventBindings->GetBind(pGameObject->GetEntry(), GAMEOBJECT_EVENT_ON_QUEST_ACCEPT);
461 if (!bind)
462 return false;
463 sEluna->BeginCall(bind);
465 sEluna->Push(sEluna->L, pPlayer);
466 sEluna->Push(sEluna->L, pGameObject);
467 sEluna->Push(sEluna->L, pQuest);
468 sEluna->ExecuteCall(4, 0);
469 return true;
470}
471
472bool HookMgr::OnQuestComplete(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest)
473{
474 int bind = sEluna->CreatureEventBindings->GetBind(pGameObject->GetEntry(), GAMEOBJECT_EVENT_ON_QUEST_COMPLETE);
475 if (!bind)
476 return false;
477 sEluna->BeginCall(bind);
479 sEluna->Push(sEluna->L, pPlayer);
480 sEluna->Push(sEluna->L, pGameObject);
481 sEluna->Push(sEluna->L, pQuest);
482 sEluna->ExecuteCall(4, 0);
483 return true;
484}
485
486bool HookMgr::OnQuestReward(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest)
487{
488 int bind = sEluna->GameObjectEventBindings->GetBind(pGameObject->GetEntry(), GAMEOBJECT_EVENT_ON_QUEST_REWARD);
489 if (!bind)
490 return false;
491 sEluna->BeginCall(bind);
493 sEluna->Push(sEluna->L, pPlayer);
494 sEluna->Push(sEluna->L, pGameObject);
495 sEluna->Push(sEluna->L, pQuest);
496 sEluna->ExecuteCall(4, 0);
497 return true;
498}
499
501{
502 int bind = sEluna->GameObjectEventBindings->GetBind(pGameObject->GetEntry(), GAMEOBJECT_EVENT_ON_DIALOG_STATUS);
503 if (!bind)
504 return std::nullopt;
505 sEluna->BeginCall(bind);
507 sEluna->Push(sEluna->L, pPlayer);
508 sEluna->Push(sEluna->L, pGameObject);
509 sEluna->ExecuteCall(3, 0);
511}
512
513void HookMgr::OnDestroyed(GameObject* pGameObject, Player* pPlayer)
514{
515 int bind = sEluna->GameObjectEventBindings->GetBind(pGameObject->GetEntry(), GAMEOBJECT_EVENT_ON_DESTROYED);
516 if (!bind)
517 return;
518 sEluna->BeginCall(bind);
520 sEluna->Push(sEluna->L, pGameObject);
521 sEluna->Push(sEluna->L, pPlayer);
522 sEluna->ExecuteCall(3, 0);
523}
524
525void HookMgr::OnDamaged(GameObject* pGameObject, Player* pPlayer)
526{
527 int bind = sEluna->GameObjectEventBindings->GetBind(pGameObject->GetEntry(), GAMEOBJECT_EVENT_ON_DAMAGED);
528 if (!bind)
529 return;
530 sEluna->BeginCall(bind);
532 sEluna->Push(sEluna->L, pGameObject);
533 sEluna->Push(sEluna->L, pPlayer);
534 sEluna->ExecuteCall(3, 0);
535}
536
537void HookMgr::OnLootStateChanged(GameObject* pGameObject, uint32 state, Unit* pUnit)
538{
539 int bind = sEluna->GameObjectEventBindings->GetBind(pGameObject->GetEntry(), GAMEOBJECT_EVENT_ON_LOOT_STATE_CHANGE);
540 if (!bind)
541 return;
542 sEluna->BeginCall(bind);
544 sEluna->Push(sEluna->L, pGameObject);
545 sEluna->Push(sEluna->L, state);
546 sEluna->Push(sEluna->L, pUnit);
547 sEluna->ExecuteCall(4, 0);
548}
549
551{
552 int bind = sEluna->GameObjectEventBindings->GetBind(pGameObject->GetEntry(), GAMEOBJECT_EVENT_ON_GO_STATE_CHANGED);
553 if (!bind)
554 return;
555 sEluna->BeginCall(bind);
557 sEluna->Push(sEluna->L, pGameObject);
558 sEluna->Push(sEluna->L, state);
559 sEluna->ExecuteCall(3, 0);
560}
561// Player
563{
564 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_ENTER_COMBAT].begin();
565 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_ENTER_COMBAT].end(); ++itr)
566 {
567 sEluna->BeginCall((*itr));
569 sEluna->Push(sEluna->L, pPlayer);
570 sEluna->Push(sEluna->L, pEnemy);
571 sEluna->ExecuteCall(3, 0);
572 }
573}
574
576{
577 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_LEAVE_COMBAT].begin();
578 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_LEAVE_COMBAT].end(); ++itr)
579 {
580 sEluna->BeginCall((*itr));
582 sEluna->Push(sEluna->L, pPlayer);
583 sEluna->ExecuteCall(2, 0);
584 }
585}
586
587void HookMgr::OnPVPKill(Player* pKiller, Player* pKilled)
588{
589 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_KILL_PLAYER].begin();
590 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_KILL_PLAYER].end(); ++itr)
591 {
592 sEluna->BeginCall((*itr));
594 sEluna->Push(sEluna->L, pKiller);
595 sEluna->Push(sEluna->L, pKilled);
596 sEluna->ExecuteCall(3, 0);
597 }
598}
599
601{
602 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_KILL_CREATURE].begin();
603 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_KILL_CREATURE].end(); ++itr)
604 {
605 sEluna->BeginCall((*itr));
607 sEluna->Push(sEluna->L, pKiller);
608 sEluna->Push(sEluna->L, pKilled);
609 sEluna->ExecuteCall(3, 0);
610 }
611}
612
614{
615 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_KILLED_BY_CREATURE].begin();
616 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_KILLED_BY_CREATURE].end(); ++itr)
617 {
618 sEluna->BeginCall((*itr));
620 sEluna->Push(sEluna->L, pKiller);
621 sEluna->Push(sEluna->L, pKilled);
622 sEluna->ExecuteCall(3, 0);
623 }
624}
625
626void HookMgr::OnLevelChanged(Player* pPlayer, uint8 oldLevel)
627{
628 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_LEVEL_CHANGE].begin();
629 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_LEVEL_CHANGE].end(); ++itr)
630 {
631 sEluna->BeginCall((*itr));
633 sEluna->Push(sEluna->L, pPlayer);
634 sEluna->Push(sEluna->L, oldLevel);
635 sEluna->ExecuteCall(3, 0);
636 }
637}
638
640{
641 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_TALENTS_CHANGE].begin();
642 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_TALENTS_CHANGE].end(); ++itr)
643 {
644 sEluna->BeginCall((*itr));
646 sEluna->Push(sEluna->L, pPlayer);
647 sEluna->Push(sEluna->L, newPoints);
648 sEluna->ExecuteCall(3, 0);
649 }
650}
651
652void HookMgr::OnTalentsReset(Player* pPlayer, bool noCost)
653{
654 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_TALENTS_RESET].begin();
655 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_TALENTS_RESET].end(); ++itr)
656 {
657 sEluna->BeginCall((*itr));
659 sEluna->Push(sEluna->L, pPlayer);
660 sEluna->Push(sEluna->L, noCost);
661 sEluna->ExecuteCall(3, 0);
662 }
663}
664
665void HookMgr::OnMoneyChanged(Player* pPlayer, int64& amount)
666{
667 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_MONEY_CHANGE].begin();
668 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_MONEY_CHANGE].end(); ++itr)
669 {
670 sEluna->BeginCall((*itr));
672 sEluna->Push(sEluna->L, pPlayer);
673 sEluna->Push(sEluna->L, amount);
674 sEluna->ExecuteCall(3, 0);
675 }
676}
677
678void HookMgr::OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim)
679{
680 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_GIVE_XP].begin();
681 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_GIVE_XP].end(); ++itr)
682 {
683 sEluna->BeginCall((*itr));
685 sEluna->Push(sEluna->L, pPlayer);
686 sEluna->Push(sEluna->L, amount);
687 sEluna->Push(sEluna->L, pVictim);
688 sEluna->ExecuteCall(4, 0);
689 }
690}
691
692void HookMgr::OnReputationChange(Player* pPlayer, uint32 factionID, int32& standing, bool incremental)
693{
694 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_REPUTATION_CHANGE].begin();
695 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_REPUTATION_CHANGE].end(); ++itr)
696 {
697 sEluna->BeginCall((*itr));
699 sEluna->Push(sEluna->L, pPlayer);
700 sEluna->Push(sEluna->L, factionID);
701 sEluna->Push(sEluna->L, standing);
702 sEluna->Push(sEluna->L, incremental);
703 sEluna->ExecuteCall(5, 0);
704 }
705}
706
707void HookMgr::OnDuelRequest(Player* pTarget, Player* pChallenger)
708{
709 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_DUEL_REQUEST].begin();
710 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_DUEL_REQUEST].end(); ++itr)
711 {
712 sEluna->BeginCall((*itr));
714 sEluna->Push(sEluna->L, pTarget);
715 sEluna->Push(sEluna->L, pChallenger);
716 sEluna->ExecuteCall(3, 0);
717 }
718}
719
720void HookMgr::OnDuelStart(Player* pStarter, Player* pChallenger)
721{
722 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_DUEL_START].begin();
723 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_DUEL_START].end(); ++itr)
724 {
725 sEluna->BeginCall((*itr));
727 sEluna->Push(sEluna->L, pStarter);
728 sEluna->Push(sEluna->L, pChallenger);
729 sEluna->ExecuteCall(3, 0);
730 }
731}
732
734{
735 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_DUEL_END].begin();
736 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_DUEL_END].end(); ++itr)
737 {
738 sEluna->BeginCall((*itr));
740 sEluna->Push(sEluna->L, pWinner);
741 sEluna->Push(sEluna->L, pLoser);
742 sEluna->Push(sEluna->L, type);
743 sEluna->ExecuteCall(4, 0);
744 }
745}
746
747void HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Player* pReceiver)
748{
749 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_WHISPER].begin();
750 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_WHISPER].end(); ++itr)
751 {
752 sEluna->BeginCall((*itr));
754 sEluna->Push(sEluna->L, pPlayer);
755 sEluna->Push(sEluna->L, msg);
756 sEluna->Push(sEluna->L, type);
757 sEluna->Push(sEluna->L, lang);
758 sEluna->Push(sEluna->L, pReceiver);
759 sEluna->ExecuteCall(6, 0);
760 }
761}
762
763void HookMgr::OnEmote(Player* pPlayer, uint32 emote)
764{
765 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_EMOTE].begin();
766 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_EMOTE].end(); ++itr)
767 {
768 sEluna->BeginCall((*itr));
770 sEluna->Push(sEluna->L, pPlayer);
771 sEluna->Push(sEluna->L, emote);
772 sEluna->ExecuteCall(3, 0);
773 }
774}
775
776void HookMgr::OnTextEmote(Player* pPlayer, uint32 textEmote, uint32 emoteNum, uint64 guid)
777{
778 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_TEXT_EMOTE].begin();
779 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_TEXT_EMOTE].end(); ++itr)
780 {
781 sEluna->BeginCall((*itr));
783 sEluna->Push(sEluna->L, pPlayer);
784 sEluna->Push(sEluna->L, textEmote);
785 sEluna->Push(sEluna->L, emoteNum);
786 sEluna->Push(sEluna->L, guid);
787 sEluna->ExecuteCall(5, 0);
788 }
789}
790
791void HookMgr::OnSpellCast(Player* pPlayer, Spell* pSpell, bool skipCheck)
792{
793 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_SPELL_CAST].begin();
794 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_SPELL_CAST].end(); ++itr)
795 {
796 sEluna->BeginCall((*itr));
798 sEluna->Push(sEluna->L, pPlayer);
799 sEluna->Push(sEluna->L, pSpell);
800 sEluna->Push(sEluna->L, skipCheck);
801 sEluna->ExecuteCall(4, 0);
802 }
803}
804
806{
807 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_LOGIN].begin();
808 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_LOGIN].end(); ++itr)
809 {
810 sEluna->BeginCall((*itr));
812 sEluna->Push(sEluna->L, pPlayer);
813 sEluna->ExecuteCall(2, 0);
814 }
815}
816
818{
819 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_LOGOUT].begin();
820 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_LOGOUT].end(); ++itr)
821 {
822 sEluna->BeginCall((*itr));
824 sEluna->Push(sEluna->L, pPlayer);
825 sEluna->ExecuteCall(2, 0);
826 }
827}
828
830{
831 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_CHARACTER_CREATE].begin();
832 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_CHARACTER_CREATE].end(); ++itr)
833 {
834 sEluna->BeginCall((*itr));
836 sEluna->Push(sEluna->L, pPlayer);
837 sEluna->ExecuteCall(2, 0);
838 }
839}
840
842{
843 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_CHARACTER_DELETE].begin();
844 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_CHARACTER_DELETE].end(); ++itr)
845 {
846 sEluna->BeginCall((*itr));
848 sEluna->Push(sEluna->L, guidlow);
849 sEluna->ExecuteCall(2, 0);
850 }
851}
852
854{
855 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_SAVE].begin();
856 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_SAVE].end(); ++itr)
857 {
858 sEluna->BeginCall((*itr));
860 sEluna->Push(sEluna->L, pPlayer);
861 sEluna->ExecuteCall(2, 0);
862 }
863}
864
865void HookMgr::OnBindToInstance(Player* pPlayer, Difficulty difficulty, uint32 mapid, bool permanent)
866{
867 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_BIND_TO_INSTANCE].begin();
868 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_BIND_TO_INSTANCE].end(); ++itr)
869 {
870 sEluna->BeginCall((*itr));
872 sEluna->Push(sEluna->L, pPlayer);
873 sEluna->Push(sEluna->L, difficulty);
874 sEluna->Push(sEluna->L, mapid);
875 sEluna->Push(sEluna->L, permanent);
876 sEluna->ExecuteCall(5, 0);
877 }
878}
879
880void HookMgr::OnUpdateZone(Player* pPlayer, uint32 newZone, uint32 newArea)
881{
882 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_UPDATE_ZONE].begin();
883 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_UPDATE_ZONE].end(); ++itr)
884 {
885 sEluna->BeginCall((*itr));
887 sEluna->Push(sEluna->L, pPlayer);
888 sEluna->Push(sEluna->L, newZone);
889 sEluna->Push(sEluna->L, newArea);
890 sEluna->ExecuteCall(4, 0);
891 }
892}
893
895{
896 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_MAP_CHANGE].begin();
897 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_MAP_CHANGE].end(); ++itr)
898 {
899 sEluna->BeginCall((*itr));
901 sEluna->Push(sEluna->L, player);
902 sEluna->ExecuteCall(2, 0);
903 }
904}
905
906bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg)
907{
908 bool Result = true;
909 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_CHAT].begin();
910 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_CHAT].end(); ++itr)
911 {
912 sEluna->BeginCall((*itr));
914 sEluna->Push(sEluna->L, pPlayer);
915 sEluna->Push(sEluna->L, msg);
916 sEluna->Push(sEluna->L, type);
917 sEluna->Push(sEluna->L, lang);
918 if (sEluna->ExecuteCall(5, 1))
919 {
920 lua_State* L = sEluna->L;
921 if (!lua_isnoneornil(L, 1) && !lua_toboolean(L, 1))
922 Result = false;
923 sEluna->EndCall(1);
924 }
925 }
926 return Result;
927}
928
929bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Group* pGroup)
930{
931 bool Result = true;
932 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_GROUP_CHAT].begin();
933 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_GROUP_CHAT].end(); ++itr)
934 {
935 sEluna->BeginCall((*itr));
937 sEluna->Push(sEluna->L, pPlayer);
938 sEluna->Push(sEluna->L, msg);
939 sEluna->Push(sEluna->L, type);
940 sEluna->Push(sEluna->L, lang);
941 sEluna->Push(sEluna->L, pGroup);
942 if (sEluna->ExecuteCall(6, 1))
943 {
944 lua_State* L = sEluna->L;
945 if (!lua_isnoneornil(L, 1) && !lua_toboolean(L, 1))
946 Result = false;
947 sEluna->EndCall(1);
948 }
949 }
950 return Result;
951}
952
953bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Guild* pGuild)
954{
955 bool Result = true;
956 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_GUILD_CHAT].begin();
957 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_GUILD_CHAT].end(); ++itr)
958 {
959 sEluna->BeginCall((*itr));
961 sEluna->Push(sEluna->L, pPlayer);
962 sEluna->Push(sEluna->L, msg);
963 sEluna->Push(sEluna->L, type);
964 sEluna->Push(sEluna->L, lang);
965 sEluna->Push(sEluna->L, pGuild);
966 if (sEluna->ExecuteCall(6, 1))
967 {
968 lua_State* L = sEluna->L;
969 if (!lua_isnoneornil(L, 1) && !lua_toboolean(L, 1))
970 Result = false;
971 sEluna->EndCall(1);
972 }
973 }
974 return Result;
975}
976
977bool HookMgr::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Channel* pChannel)
978{
979 bool Result = true;
980 for (std::vector<int>::const_iterator itr = sEluna->PlayerEventBindings[PLAYER_EVENT_ON_CHANNEL_CHAT].begin();
981 itr != sEluna->PlayerEventBindings[PLAYER_EVENT_ON_CHANNEL_CHAT].end(); ++itr)
982 {
983 sEluna->BeginCall((*itr));
985 sEluna->Push(sEluna->L, pPlayer);
986 sEluna->Push(sEluna->L, msg);
987 sEluna->Push(sEluna->L, type);
988 sEluna->Push(sEluna->L, lang);
989 sEluna->Push(sEluna->L, pChannel->GetChannelId());
990 if (sEluna->ExecuteCall(6, 1))
991 {
992 lua_State* L = sEluna->L;
993 if (!lua_isnoneornil(L, 1) && !lua_toboolean(L, 1))
994 Result = false;
995 sEluna->EndCall(1);
996 }
997 }
998 return Result;
999}
1000// Vehicle
1002{
1003 for (std::vector<int>::const_iterator itr = sEluna->VehicleEventBindings[VEHICLE_EVENT_ON_INSTALL].begin();
1004 itr != sEluna->VehicleEventBindings[VEHICLE_EVENT_ON_INSTALL].end(); ++itr)
1005 {
1006 sEluna->BeginCall((*itr));
1008 sEluna->Push(sEluna->L, vehicle);
1009 sEluna->ExecuteCall(2, 0);
1010 }
1011}
1012
1014{
1015 for (std::vector<int>::const_iterator itr = sEluna->VehicleEventBindings[VEHICLE_EVENT_ON_UNINSTALL].begin();
1016 itr != sEluna->VehicleEventBindings[VEHICLE_EVENT_ON_UNINSTALL].end(); ++itr)
1017 {
1018 sEluna->BeginCall((*itr));
1020 sEluna->Push(sEluna->L, vehicle);
1021 sEluna->ExecuteCall(2, 0);
1022 }
1023}
1024
1026{
1027 for (std::vector<int>::const_iterator itr = sEluna->VehicleEventBindings[VEHICLE_EVENT_ON_RESET].begin();
1028 itr != sEluna->VehicleEventBindings[VEHICLE_EVENT_ON_RESET].end(); ++itr)
1029 {
1030 sEluna->BeginCall((*itr));
1032 sEluna->Push(sEluna->L, vehicle);
1033 sEluna->ExecuteCall(2, 0);
1034 }
1035}
1036
1038{
1039 for (std::vector<int>::const_iterator itr = sEluna->VehicleEventBindings[VEHICLE_EVENT_ON_INSTALL_ACCESSORY].begin();
1040 itr != sEluna->VehicleEventBindings[VEHICLE_EVENT_ON_INSTALL_ACCESSORY].end(); ++itr)
1041 {
1042 sEluna->BeginCall((*itr));
1044 sEluna->Push(sEluna->L, vehicle);
1045 sEluna->Push(sEluna->L, accessory);
1046 sEluna->ExecuteCall(3, 0);
1047 }
1048}
1049
1050void HookMgr::OnAddPassenger(Vehicle* vehicle, Unit* passenger, int8 seatId)
1051{
1052 for (std::vector<int>::const_iterator itr = sEluna->VehicleEventBindings[VEHICLE_EVENT_ON_ADD_PASSENGER].begin();
1053 itr != sEluna->VehicleEventBindings[VEHICLE_EVENT_ON_ADD_PASSENGER].end(); ++itr)
1054 {
1055 sEluna->BeginCall((*itr));
1057 sEluna->Push(sEluna->L, vehicle);
1058 sEluna->Push(sEluna->L, passenger);
1059 sEluna->Push(sEluna->L, seatId);
1060 sEluna->ExecuteCall(4, 0);
1061 }
1062}
1063
1064void HookMgr::OnRemovePassenger(Vehicle* vehicle, Unit* passenger)
1065{
1066 for (std::vector<int>::const_iterator itr = sEluna->VehicleEventBindings[VEHICLE_EVENT_ON_REMOVE_PASSENGER].begin();
1067 itr != sEluna->VehicleEventBindings[VEHICLE_EVENT_ON_REMOVE_PASSENGER].end(); ++itr)
1068 {
1069 sEluna->BeginCall((*itr));
1071 sEluna->Push(sEluna->L, vehicle);
1072 sEluna->Push(sEluna->L, passenger);
1073 sEluna->ExecuteCall(3, 0);
1074 }
1075}
1076
1077// areatrigger
1078bool HookMgr::OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger, bool entered)
1079{
1080 for (std::vector<int>::const_iterator itr = sEluna->ServerEventBindings[TRIGGER_EVENT_ON_TRIGGER].begin();
1081 itr != sEluna->ServerEventBindings[TRIGGER_EVENT_ON_TRIGGER].end(); ++itr)
1082 {
1083 sEluna->BeginCall((*itr));
1085 sEluna->Push(sEluna->L, pPlayer);
1086 sEluna->Push(sEluna->L, pTrigger->id);
1087 sEluna->Push(sEluna->L, entered);
1088 sEluna->ExecuteCall(4, 0);
1089 }
1090 return false;
1091}
1092// weather
1093void HookMgr::OnChange(Weather* weather, WeatherState state, float grade)
1094{
1095 for (std::vector<int>::const_iterator itr = sEluna->ServerEventBindings[WEATHER_EVENT_ON_CHANGE].begin();
1096 itr != sEluna->ServerEventBindings[WEATHER_EVENT_ON_CHANGE].end(); ++itr)
1097 {
1098 sEluna->BeginCall((*itr));
1100 sEluna->Push(sEluna->L, (weather->GetZone()));
1101 sEluna->Push(sEluna->L, state);
1102 sEluna->Push(sEluna->L, grade);
1103 sEluna->ExecuteCall(4, 0);
1104 }
1105}
1106// transport
1108{
1109}
1111{
1112}
1114{
1115}
1116void HookMgr::OnRelocate(Transport* transport, uint32 waypointId, uint32 mapId, float x, float y, float z)
1117{
1118}
1119// Auction House
1121{
1122 for (std::vector<int>::const_iterator itr = sEluna->ServerEventBindings[AUCTION_EVENT_ON_ADD].begin();
1123 itr != sEluna->ServerEventBindings[AUCTION_EVENT_ON_ADD].end(); ++itr)
1124 {
1125 sEluna->BeginCall((*itr));
1127 sEluna->Push(sEluna->L, (ah));
1128 sEluna->ExecuteCall(2, 0);
1129 }
1130}
1131
1133{
1134 for (std::vector<int>::const_iterator itr = sEluna->ServerEventBindings[AUCTION_EVENT_ON_REMOVE].begin();
1135 itr != sEluna->ServerEventBindings[AUCTION_EVENT_ON_REMOVE].end(); ++itr)
1136 {
1137 sEluna->BeginCall((*itr));
1139 sEluna->Push(sEluna->L, (ah));
1140 sEluna->ExecuteCall(2, 0);
1141 }
1142}
1143
1145{
1146 for (std::vector<int>::const_iterator itr = sEluna->ServerEventBindings[AUCTION_EVENT_ON_SUCCESSFUL].begin();
1147 itr != sEluna->ServerEventBindings[AUCTION_EVENT_ON_SUCCESSFUL].end(); ++itr)
1148 {
1149 sEluna->BeginCall((*itr));
1151 sEluna->Push(sEluna->L, (ah));
1152 sEluna->ExecuteCall(2, 0);
1153 }
1154}
1155
1157{
1158 for (std::vector<int>::const_iterator itr = sEluna->ServerEventBindings[AUCTION_EVENT_ON_EXPIRE].begin();
1159 itr != sEluna->ServerEventBindings[AUCTION_EVENT_ON_EXPIRE].end(); ++itr)
1160 {
1161 sEluna->BeginCall((*itr));
1163 sEluna->Push(sEluna->L, (ah));
1164 sEluna->ExecuteCall(2, 0);
1165 }
1166}
1167
1169{
1170public:
1171 ElunaWorldAI() : WorldScript("ElunaWorldAI") { }
1173
1174 void OnOpenStateChange(bool open) override
1175 {
1176 for (std::vector<int>::const_iterator itr = sEluna->ServerEventBindings[WORLD_EVENT_ON_OPEN_STATE_CHANGE].begin();
1177 itr != sEluna->ServerEventBindings[WORLD_EVENT_ON_OPEN_STATE_CHANGE].end(); ++itr)
1178 {
1179 sEluna->BeginCall((*itr));
1181 sEluna->Push(sEluna->L, open);
1182 sEluna->ExecuteCall(2, 0);
1183 }
1184 }
1185
1186 void OnConfigLoad(bool reload) override
1187 {
1188 for (std::vector<int>::const_iterator itr = sEluna->ServerEventBindings[WORLD_EVENT_ON_CONFIG_LOAD].begin();
1189 itr != sEluna->ServerEventBindings[WORLD_EVENT_ON_CONFIG_LOAD].end(); ++itr)
1190 {
1191 sEluna->BeginCall((*itr));
1193 sEluna->Push(sEluna->L, reload);
1194 sEluna->ExecuteCall(2, 0);
1195 }
1196 }
1197
1198 void OnMotdChange(std::string& newMotd) override
1199 {
1200 for (std::vector<int>::const_iterator itr = sEluna->ServerEventBindings[WORLD_EVENT_ON_MOTD_CHANGE].begin();
1201 itr != sEluna->ServerEventBindings[WORLD_EVENT_ON_MOTD_CHANGE].end(); ++itr)
1202 {
1203 sEluna->BeginCall((*itr));
1205 sEluna->Push(sEluna->L, newMotd);
1206 sEluna->ExecuteCall(2, 0);
1207 }
1208 }
1209
1211 {
1212 for (std::vector<int>::const_iterator itr = sEluna->ServerEventBindings[WORLD_EVENT_ON_SHUTDOWN_INIT].begin();
1213 itr != sEluna->ServerEventBindings[WORLD_EVENT_ON_SHUTDOWN_INIT].end(); ++itr)
1214 {
1215 sEluna->BeginCall((*itr));
1217 sEluna->Push(sEluna->L, code);
1218 sEluna->Push(sEluna->L, mask);
1219 sEluna->ExecuteCall(3, 0);
1220 }
1221 }
1222
1223 void OnShutdownCancel() override
1224 {
1225 for (std::vector<int>::const_iterator itr = sEluna->ServerEventBindings[WORLD_EVENT_ON_SHUTDOWN_CANCEL].begin();
1226 itr != sEluna->ServerEventBindings[WORLD_EVENT_ON_SHUTDOWN_CANCEL].end(); ++itr)
1227 {
1228 sEluna->BeginCall((*itr));
1230 sEluna->ExecuteCall(1, 0);
1231 }
1232 }
1233
1234 void OnUpdate(uint32 diff) override
1235 {
1236 sEluna->m_EventMgr.Update(diff);
1237 for (std::vector<int>::const_iterator itr = sEluna->ServerEventBindings[WORLD_EVENT_ON_UPDATE].begin();
1238 itr != sEluna->ServerEventBindings[WORLD_EVENT_ON_UPDATE].end(); ++itr)
1239 {
1240 sEluna->BeginCall((*itr));
1242 sEluna->Push(sEluna->L, diff);
1243 sEluna->ExecuteCall(2, 0);
1244 }
1245 }
1246 // executed when a timed event fires
1247 void OnScriptEvent(int funcRef, uint32 delay, uint32 calls)
1248 {
1249 sEluna->BeginCall(funcRef);
1250 sEluna->Push(sEluna->L, funcRef);
1251 sEluna->Push(sEluna->L, delay);
1252 sEluna->Push(sEluna->L, calls);
1253 sEluna->ExecuteCall(3, 0);
1254 }
1255
1256 void OnStartup() override
1257 {
1258 for (std::vector<int>::const_iterator itr = sEluna->ServerEventBindings[WORLD_EVENT_ON_STARTUP].begin();
1259 itr != sEluna->ServerEventBindings[WORLD_EVENT_ON_STARTUP].end(); ++itr)
1260 {
1261 sEluna->BeginCall((*itr));
1263 sEluna->ExecuteCall(1, 0);
1264 }
1265 }
1266
1267 void OnShutdown() override
1268 {
1269 for (std::vector<int>::const_iterator itr = sEluna->ServerEventBindings[WORLD_EVENT_ON_SHUTDOWN].begin();
1270 itr != sEluna->ServerEventBindings[WORLD_EVENT_ON_SHUTDOWN].end(); ++itr)
1271 {
1272 sEluna->BeginCall((*itr));
1274 sEluna->ExecuteCall(1, 0);
1275 }
1276 }
1277};
1278
1280{
1281 ElunaCreatureAI(Creature* creature) : ScriptedAI(creature) { }
1283
1284 //Called at World update tick
1285 void UpdateAI(uint32 diff) override
1286 {
1288 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_AIUPDATE);
1289 if (!bind)
1290 return;
1291 sEluna->BeginCall(bind);
1293 sEluna->Push(sEluna->L, me);
1294 sEluna->Push(sEluna->L, diff);
1295 sEluna->ExecuteCall(3, 0);
1296 }
1297
1298 //Called for reaction at enter to combat if not in combat yet (enemy can be NULL)
1299 //Called at creature aggro either by MoveInLOS or Attack Start
1300 void EnterCombat(Unit* target) override
1301 {
1303 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_ENTER_COMBAT);
1304 if (!bind)
1305 return;
1306 sEluna->BeginCall(bind);
1308 sEluna->Push(sEluna->L, me);
1309 sEluna->Push(sEluna->L, target);
1310 sEluna->ExecuteCall(3, 0);
1311 }
1312
1313 // Called at any Damage from any attacker (before damage apply)
1314 void DamageTaken(Unit* attacker, uint32& damage) override
1315 {
1316 ScriptedAI::DamageTaken(attacker, damage);
1317 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_DAMAGE_TAKEN);
1318 if (!bind)
1319 return;
1320 sEluna->BeginCall(bind);
1322 sEluna->Push(sEluna->L, me);
1323 sEluna->Push(sEluna->L, attacker);
1324 sEluna->Push(sEluna->L, damage);
1325 sEluna->ExecuteCall(4, 0);
1326 }
1327
1328 //Called at creature death
1329 void JustDied(Unit* killer) override
1330 {
1331 ScriptedAI::JustDied(killer);
1332 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_DIED);
1333 if (!bind)
1334 return;
1335 sEluna->BeginCall(bind);
1337 sEluna->Push(sEluna->L, me);
1338 sEluna->Push(sEluna->L, killer);
1339 sEluna->ExecuteCall(3, 0);
1340 }
1341
1342 //Called at creature killing another unit
1343 void KilledUnit(Unit* victim) override
1344 {
1345 ScriptedAI::KilledUnit(victim);
1346 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_TARGET_DIED);
1347 if (!bind)
1348 return;
1349 sEluna->BeginCall(bind);
1351 sEluna->Push(sEluna->L, me);
1352 sEluna->Push(sEluna->L, victim);
1353 sEluna->ExecuteCall(3, 0);
1354 }
1355
1356 // Called when the creature summon successfully other creature
1357 void JustSummoned(Creature* summon) override
1358 {
1360 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_JUST_SUMMONED_CREATURE);
1361 if (!bind)
1362 return;
1363 sEluna->BeginCall(bind);
1365 sEluna->Push(sEluna->L, me);
1366 sEluna->Push(sEluna->L, summon);
1367 sEluna->ExecuteCall(3, 0);
1368 }
1369
1370 // Called when a summoned creature is despawned
1371 void SummonedCreatureDespawn(Creature* summon) override
1372 {
1374 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_SUMMONED_CREATURE_DESPAWN);
1375 if (!bind)
1376 return;
1377 sEluna->BeginCall(bind);
1379 sEluna->Push(sEluna->L, me);
1380 sEluna->Push(sEluna->L, summon);
1381 sEluna->ExecuteCall(3, 0);
1382 }
1383
1384 // Called when hit by a spell
1385 void SpellHit(Unit* caster, SpellInfo const* spell) override
1386 {
1387 ScriptedAI::SpellHit(caster, spell);
1388 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_HIT_BY_SPELL);
1389 if (!bind)
1390 return;
1391 sEluna->BeginCall(bind);
1393 sEluna->Push(sEluna->L, me);
1394 sEluna->Push(sEluna->L, caster);
1395 sEluna->Push(sEluna->L, spell->Id); // Pass spell object?
1396 sEluna->ExecuteCall(4, 0);
1397 }
1398
1399 // Called when spell hits a target
1400 void SpellHitTarget(Unit* target, SpellInfo const* spell) override
1401 {
1402 ScriptedAI::SpellHitTarget(target, spell);
1403 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_SPELL_HIT_TARGET);
1404 if (!bind)
1405 return;
1406 sEluna->BeginCall(bind);
1408 sEluna->Push(sEluna->L, me);
1409 sEluna->Push(sEluna->L, target);
1410 sEluna->Push(sEluna->L, spell->Id); // Pass spell object?
1411 sEluna->ExecuteCall(4, 0);
1412 }
1413
1414 //Called at waypoint reached or PointMovement end
1415 void MovementInform(uint32 type, uint32 id) override
1416 {
1418 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_REACH_WP);
1419 if (!bind)
1420 return;
1421 sEluna->BeginCall(bind);
1423 sEluna->Push(sEluna->L, me);
1424 sEluna->Push(sEluna->L, type);
1425 sEluna->Push(sEluna->L, id);
1426 sEluna->ExecuteCall(4, 0);
1427 }
1428
1429 // Called when AI is temporarily replaced or put back when possess is applied or removed
1430 void OnPossess(bool apply)
1431 {
1432 ScriptedAI::OnPossess(apply);
1433 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_POSSESS);
1434 if (!bind)
1435 return;
1436 sEluna->BeginCall(bind);
1438 sEluna->Push(sEluna->L, me);
1439 sEluna->Push(sEluna->L, apply);
1440 sEluna->ExecuteCall(3, 0);
1441 }
1442
1443 //Called at creature reset either by death or evade
1444 void Reset() override
1445 {
1447 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_RESET);
1448 if (!bind)
1449 return;
1450 sEluna->BeginCall(bind);
1452 sEluna->Push(sEluna->L, me);
1453 sEluna->ExecuteCall(2, 0);
1454 }
1455
1456 // Called before JustEngagedWith even before the creature is in combat.
1457 void AttackStart(Unit* target) override
1458 {
1460 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_PRE_COMBAT);
1461 if (!bind)
1462 return;
1463 sEluna->BeginCall(bind);
1465 sEluna->Push(sEluna->L, me);
1466 sEluna->Push(sEluna->L, target);
1467 sEluna->ExecuteCall(3, 0);
1468 }
1469
1470 // Called in Creature::Update when deathstate = DEAD. Inherited classes may maniuplate the ability to respawn based on scripted events.
1471 bool CanRespawn() override
1472 {
1474 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_CAN_RESPAWN);
1475 if (!bind)
1476 return true;
1477 sEluna->BeginCall(bind);
1479 sEluna->Push(sEluna->L, me);
1480 sEluna->ExecuteCall(2, 0);
1481 return true;
1482 }
1483
1484 // Called for reaction at stopping attack at no attackers or targets
1485 void EnterEvadeMode() override
1486 {
1488 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_LEAVE_COMBAT);
1489 if (!bind)
1490 return;
1491 sEluna->BeginCall(bind);
1493 sEluna->Push(sEluna->L, me);
1494 sEluna->ExecuteCall(2, 0);
1495 }
1496
1497 // Called when the creature is summoned successfully by other creature
1498 void IsSummonedBy(Unit* summoner) override
1499 {
1500 ScriptedAI::IsSummonedBy(summoner);
1501 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_SUMMONED);
1502 if (!bind)
1503 return;
1504 sEluna->BeginCall(bind);
1506 sEluna->Push(sEluna->L, me);
1507 sEluna->Push(sEluna->L, summoner);
1508 sEluna->ExecuteCall(3, 0);
1509 }
1510
1511 void SummonedCreatureDies(Creature* summon, Unit* killer) override
1512 {
1513 ScriptedAI::SummonedCreatureDies(summon, killer);
1514 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_SUMMONED_CREATURE_DIED);
1515 if (!bind)
1516 return;
1517 sEluna->BeginCall(bind);
1519 sEluna->Push(sEluna->L, me);
1520 sEluna->Push(sEluna->L, summon);
1521 sEluna->Push(sEluna->L, killer);
1522 sEluna->ExecuteCall(4, 0);
1523 }
1524
1525 // Called when the creature is target of hostile action: swing, hostile spell landed, fear/etc)
1526 void AttackedBy(Unit* attacker) override
1527 {
1528 /*
1529 ScriptedAI::AttackedBy(attacker);
1530 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_ATTACKED_AT);
1531 if (!bind)
1532 return;
1533 sEluna->BeginCall(bind);
1534 sEluna->Push(sEluna->L, CREATURE_EVENT_ON_ATTACKED_AT);
1535 sEluna->Push(sEluna->L, me);
1536 sEluna->Push(sEluna->L, attacker);
1537 sEluna->ExecuteCall(3, 0);
1538 */
1539 }
1540
1541 // Called when creature is spawned or respawned (for reseting variables)
1542 void JustRespawned() override
1543 {
1545 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_SPAWN);
1546 if (!bind)
1547 return;
1548 sEluna->BeginCall(bind);
1550 sEluna->Push(sEluna->L, me);
1551 sEluna->ExecuteCall(2, 0);
1552 }
1553
1554 void OnCharmed(bool apply) override
1555 {
1556 ScriptedAI::OnCharmed(apply);
1557 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_CHARMED);
1558 if (!bind)
1559 return;
1560 sEluna->BeginCall(bind);
1562 sEluna->Push(sEluna->L, me);
1563 sEluna->Push(sEluna->L, apply);
1564 sEluna->ExecuteCall(3, 0);
1565 }
1566
1567 // Called at reaching home after evade
1568 void JustReachedHome() override
1569 {
1571 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_REACH_HOME);
1572 if (!bind)
1573 return;
1574 sEluna->BeginCall(bind);
1576 sEluna->Push(sEluna->L, me);
1577 sEluna->ExecuteCall(2, 0);
1578 }
1579
1580 // Called at text emote receive from player
1581 void ReceiveEmote(Player* player, uint32 emoteId) override
1582 {
1583 ScriptedAI::ReceiveEmote(player, emoteId);
1584 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_RECEIVE_EMOTE);
1585 if (!bind)
1586 return;
1587 sEluna->BeginCall(bind);
1589 sEluna->Push(sEluna->L, me);
1590 sEluna->Push(sEluna->L, player);
1591 sEluna->Push(sEluna->L, emoteId);
1592 sEluna->ExecuteCall(4, 0);
1593 }
1594
1595 // Called when owner takes damage
1596 void OwnerAttackedBy(Unit* attacker) override
1597 {
1598 /*
1599 ScriptedAI::OwnerAttackedBy(attacker);
1600 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_OWNER_ATTACKED_AT);
1601 if (!bind)
1602 return;
1603 sEluna->BeginCall(bind);
1604 sEluna->Push(sEluna->L, CREATURE_EVENT_ON_OWNER_ATTACKED_AT);
1605 sEluna->Push(sEluna->L, me);
1606 sEluna->Push(sEluna->L, attacker);
1607 sEluna->ExecuteCall(3, 0);
1608 */
1609 }
1610
1611 // Called when owner attacks something
1612 void OwnerAttacked(Unit* target) override
1613 {
1615 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_OWNER_ATTACKED);
1616 if (!bind)
1617 return;
1618 sEluna->BeginCall(bind);
1620 sEluna->Push(sEluna->L, me);
1621 sEluna->Push(sEluna->L, target);
1622 sEluna->ExecuteCall(3, 0);
1623 }
1624
1625 // called when the corpse of this creature gets removed
1626 void CorpseRemoved(uint32& respawnDelay) override
1627 {
1628 ScriptedAI::CorpseRemoved(respawnDelay);
1629 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_CORPSE_REMOVED);
1630 if (!bind)
1631 return;
1632 sEluna->BeginCall(bind);
1634 sEluna->Push(sEluna->L, me);
1635 sEluna->Push(sEluna->L, respawnDelay);
1636 sEluna->ExecuteCall(3, 0);
1637 }
1638
1639 void PassengerBoarded(Unit* passenger, int8 seatId, bool apply) override
1640 {
1641 ScriptedAI::PassengerBoarded(passenger, seatId, apply);
1642 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_PASSANGER_BOARDED);
1643 if (!bind)
1644 return;
1645 sEluna->BeginCall(bind);
1647 sEluna->Push(sEluna->L, me);
1648 sEluna->Push(sEluna->L, passenger);
1649 sEluna->Push(sEluna->L, seatId);
1650 sEluna->Push(sEluna->L, apply);
1651 sEluna->ExecuteCall(5, 0);
1652 }
1653
1654 void OnSpellClick(Unit* clicker, bool& result) override
1655 {
1656 /*
1657 ScriptedAI::OnSpellClick(clicker, result);
1658 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_SPELL_CLICK);
1659 if (!bind)
1660 return;
1661 sEluna->BeginCall(bind);
1662 sEluna->Push(sEluna->L, CREATURE_EVENT_ON_SPELL_CLICK);
1663 sEluna->Push(sEluna->L, me);
1664 sEluna->Push(sEluna->L, clicker);
1665 sEluna->Push(sEluna->L, result);
1666 sEluna->ExecuteCall(4, 0);
1667 */
1668 }
1669
1670 void MoveInLineOfSight(Unit* who) override
1671 {
1673 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_MOVE_IN_LOS);
1674 if (!bind)
1675 return;
1676 sEluna->BeginCall(bind);
1678 sEluna->Push(sEluna->L, me);
1679 sEluna->Push(sEluna->L, who);
1680 sEluna->ExecuteCall(3, 0);
1681 }
1682
1683 // Called if IsVisible(Unit* who) is true at each who move, reaction at visibility zone enter
1685 {
1687 int bind = sEluna->CreatureEventBindings->GetBind(me->GetEntry(), CREATURE_EVENT_ON_VISIBLE_MOVE_IN_LOS);
1688 if (!bind)
1689 return;
1690 sEluna->BeginCall(bind);
1692 sEluna->Push(sEluna->L, me);
1693 sEluna->Push(sEluna->L, who);
1694 sEluna->ExecuteCall(3, 0);
1695 }
1696};
1697
1699{
1702 {
1703 }
1704
1705 void UpdateAI(uint32 diff) override
1706 {
1707 int bind = sEluna->GameObjectEventBindings->GetBind(go->GetEntry(), GAMEOBJECT_EVENT_ON_AIUPDATE);
1708 if (!bind)
1709 return;
1710 sEluna->BeginCall(bind);
1712 sEluna->Push(sEluna->L, go);
1713 sEluna->Push(sEluna->L, diff);
1714 sEluna->ExecuteCall(3, 0);
1715 }
1716
1717 // executed when a timed event fires
1718 void OnScriptEvent(int funcRef, uint32 delay, uint32 calls)
1719 {
1720 sEluna->BeginCall(funcRef);
1721 sEluna->Push(sEluna->L, funcRef);
1722 sEluna->Push(sEluna->L, delay);
1723 sEluna->Push(sEluna->L, calls);
1724 sEluna->Push(sEluna->L, go);
1725 sEluna->ExecuteCall(4, 0);
1726 }
1727
1728 void Reset() override
1729 {
1730 sEluna->BeginCall(sEluna->GameObjectEventBindings->GetBind(go->GetEntry(), GAMEOBJECT_EVENT_ON_RESET));
1732 sEluna->Push(sEluna->L, go);
1733 sEluna->ExecuteCall(2, 0);
1734 }
1735};
1736
1737void HookMgr::OnAddMember(Guild* guild, Player* player, uint32 plRank)
1738{
1739 for (std::vector<int>::const_iterator itr = sEluna->GuildEventBindings[GUILD_EVENT_ON_ADD_MEMBER].begin();
1740 itr != sEluna->GuildEventBindings[GUILD_EVENT_ON_ADD_MEMBER].end(); ++itr)
1741 {
1742 sEluna->BeginCall((*itr));
1744 sEluna->Push(sEluna->L, guild);
1745 sEluna->Push(sEluna->L, player);
1746 sEluna->Push(sEluna->L, plRank);
1747 sEluna->ExecuteCall(4, 0);
1748 }
1749}
1750
1751void HookMgr::OnRemoveMember(Guild* guild, Player* player, bool isDisbanding, bool isKicked) // IsKicked not a part of Mangos, implement?
1752{
1753 for (std::vector<int>::const_iterator itr = sEluna->GuildEventBindings[GUILD_EVENT_ON_REMOVE_MEMBER].begin();
1754 itr != sEluna->GuildEventBindings[GUILD_EVENT_ON_REMOVE_MEMBER].end(); ++itr)
1755 {
1756 sEluna->BeginCall((*itr));
1758 sEluna->Push(sEluna->L, guild);
1759 sEluna->Push(sEluna->L, player);
1760 sEluna->Push(sEluna->L, isDisbanding);
1761 sEluna->Push(sEluna->L, isKicked); // IsKicked not a part of Mangos, implement?
1762 sEluna->ExecuteCall(5, 0);
1763 }
1764}
1765
1766void HookMgr::OnMOTDChanged(Guild* guild, const std::string& newMotd)
1767{
1768 for (std::vector<int>::const_iterator itr = sEluna->GuildEventBindings[GUILD_EVENT_ON_MOTD_CHANGE].begin();
1769 itr != sEluna->GuildEventBindings[GUILD_EVENT_ON_MOTD_CHANGE].end(); ++itr)
1770 {
1771 sEluna->BeginCall((*itr));
1773 sEluna->Push(sEluna->L, guild);
1774 sEluna->Push(sEluna->L, newMotd);
1775 sEluna->ExecuteCall(3, 0);
1776 }
1777}
1778
1779void HookMgr::OnInfoChanged(Guild* guild, const std::string& newInfo)
1780{
1781 for (std::vector<int>::const_iterator itr = sEluna->GuildEventBindings[GUILD_EVENT_ON_INFO_CHANGE].begin();
1782 itr != sEluna->GuildEventBindings[GUILD_EVENT_ON_INFO_CHANGE].end(); ++itr)
1783 {
1784 sEluna->BeginCall((*itr));
1786 sEluna->Push(sEluna->L, guild);
1787 sEluna->Push(sEluna->L, newInfo);
1788 sEluna->ExecuteCall(3, 0);
1789 }
1790}
1791
1792void HookMgr::OnCreate(Guild* guild, Player* leader, const std::string& name)
1793{
1794 for (std::vector<int>::const_iterator itr = sEluna->GuildEventBindings[GUILD_EVENT_ON_CREATE].begin();
1795 itr != sEluna->GuildEventBindings[GUILD_EVENT_ON_CREATE].end(); ++itr)
1796 {
1797 sEluna->BeginCall((*itr));
1799 sEluna->Push(sEluna->L, guild);
1800 sEluna->Push(sEluna->L, leader);
1801 sEluna->Push(sEluna->L, name);
1802 sEluna->ExecuteCall(4, 0);
1803 }
1804}
1805
1807{
1808 for (std::vector<int>::const_iterator itr = sEluna->GuildEventBindings[GUILD_EVENT_ON_DISBAND].begin();
1809 itr != sEluna->GuildEventBindings[GUILD_EVENT_ON_DISBAND].end(); ++itr)
1810 {
1811 sEluna->BeginCall((*itr));
1813 sEluna->Push(sEluna->L, guild);
1814 sEluna->ExecuteCall(2, 0);
1815 }
1816}
1817
1818void HookMgr::OnMemberWitdrawMoney(Guild* guild, Player* player, uint64 &amount, bool isRepair) // isRepair not a part of Mangos, implement?
1819{
1820 for (std::vector<int>::const_iterator itr = sEluna->GuildEventBindings[GUILD_EVENT_ON_MONEY_WITHDRAW].begin();
1821 itr != sEluna->GuildEventBindings[GUILD_EVENT_ON_MONEY_WITHDRAW].end(); ++itr)
1822 {
1823 sEluna->BeginCall((*itr));
1825 sEluna->Push(sEluna->L, guild);
1826 sEluna->Push(sEluna->L, player);
1827 sEluna->Push(sEluna->L, amount);
1828 sEluna->Push(sEluna->L, isRepair); // isRepair not a part of Mangos, implement?
1829 sEluna->ExecuteCall(5, 0);
1830 }
1831}
1832
1833void HookMgr::OnMemberDepositMoney(Guild* guild, Player* player, uint64 &amount)
1834{
1835 for (std::vector<int>::const_iterator itr = sEluna->GuildEventBindings[GUILD_EVENT_ON_MONEY_DEPOSIT].begin();
1836 itr != sEluna->GuildEventBindings[GUILD_EVENT_ON_MONEY_DEPOSIT].end(); ++itr)
1837 {
1838 sEluna->BeginCall((*itr));
1840 sEluna->Push(sEluna->L, guild);
1841 sEluna->Push(sEluna->L, player);
1842 sEluna->Push(sEluna->L, amount);
1843 sEluna->ExecuteCall(4, 0);
1844 }
1845}
1846
1847void HookMgr::OnItemMove(Guild* guild, Player* player, Item* pItem, bool isSrcBank, uint8 srcContainer, uint8 srcSlotId,
1848 bool isDestBank, uint8 destContainer, uint8 destSlotId)
1849{
1850 for (std::vector<int>::const_iterator itr = sEluna->GuildEventBindings[GUILD_EVENT_ON_ITEM_MOVE].begin();
1851 itr != sEluna->GuildEventBindings[GUILD_EVENT_ON_ITEM_MOVE].end(); ++itr)
1852 {
1853 sEluna->BeginCall((*itr));
1855 sEluna->Push(sEluna->L, guild);
1856 sEluna->Push(sEluna->L, player);
1857 sEluna->Push(sEluna->L, pItem);
1858 sEluna->Push(sEluna->L, isSrcBank);
1859 sEluna->Push(sEluna->L, srcContainer);
1860 sEluna->Push(sEluna->L, srcSlotId);
1861 sEluna->Push(sEluna->L, isDestBank);
1862 sEluna->Push(sEluna->L, destContainer);
1863 sEluna->Push(sEluna->L, destSlotId);
1864 sEluna->ExecuteCall(10, 0);
1865 }
1866}
1867
1868void HookMgr::OnEvent(Guild* guild, uint8 eventType, uint32 playerGuid1, uint32 playerGuid2, uint8 newRank)
1869{
1870 for (std::vector<int>::const_iterator itr = sEluna->GuildEventBindings[GUILD_EVENT_ON_EVENT].begin();
1871 itr != sEluna->GuildEventBindings[GUILD_EVENT_ON_EVENT].end(); ++itr)
1872 {
1873 sEluna->BeginCall((*itr));
1875 sEluna->Push(sEluna->L, guild);
1876 sEluna->Push(sEluna->L, eventType);
1877 sEluna->Push(sEluna->L, playerGuid1);
1878 sEluna->Push(sEluna->L, playerGuid2);
1879 sEluna->Push(sEluna->L, newRank);
1880 sEluna->ExecuteCall(6, 0);
1881 }
1882}
1883
1884void HookMgr::OnBankEvent(Guild* guild, uint8 eventType, uint8 tabId, uint32 playerGuid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId)
1885{
1886 for (std::vector<int>::const_iterator itr = sEluna->GuildEventBindings[GUILD_EVENT_ON_BANK_EVENT].begin();
1887 itr != sEluna->GuildEventBindings[GUILD_EVENT_ON_BANK_EVENT].end(); ++itr)
1888 {
1889 sEluna->BeginCall((*itr));
1891 sEluna->Push(sEluna->L, guild);
1892 sEluna->Push(sEluna->L, eventType);
1893 sEluna->Push(sEluna->L, tabId);
1894 sEluna->Push(sEluna->L, playerGuid);
1895 sEluna->Push(sEluna->L, itemOrMoney);
1896 sEluna->Push(sEluna->L, itemStackCount);
1897 sEluna->Push(sEluna->L, destTabId);
1898 sEluna->ExecuteCall(8, 0);
1899 }
1900}
1901// Group
1903{
1904 for (std::vector<int>::const_iterator itr = sEluna->GroupEventBindings[GROUP_EVENT_ON_MEMBER_ADD].begin();
1905 itr != sEluna->GroupEventBindings[GROUP_EVENT_ON_MEMBER_ADD].end(); ++itr)
1906 {
1907 sEluna->BeginCall((*itr));
1909 sEluna->Push(sEluna->L, group);
1910 sEluna->Push(sEluna->L, guid);
1911 sEluna->ExecuteCall(3, 0);
1912 }
1913}
1914
1916{
1917 for (std::vector<int>::const_iterator itr = sEluna->GroupEventBindings[GROUP_EVENT_ON_MEMBER_INVITE].begin();
1918 itr != sEluna->GroupEventBindings[GROUP_EVENT_ON_MEMBER_INVITE].end(); ++itr)
1919 {
1920 sEluna->BeginCall((*itr));
1922 sEluna->Push(sEluna->L, group);
1923 sEluna->Push(sEluna->L, guid);
1924 sEluna->ExecuteCall(3, 0);
1925 }
1926}
1927
1928void HookMgr::OnRemoveMember(Group* group, uint64 guid, uint8 method, uint64 kicker, const char* reason) // Kicker and Reason not a part of Mangos, implement?
1929{
1930 for (std::vector<int>::const_iterator itr = sEluna->GroupEventBindings[GROUP_EVENT_ON_MEMBER_REMOVE].begin();
1931 itr != sEluna->GroupEventBindings[GROUP_EVENT_ON_MEMBER_REMOVE].end(); ++itr)
1932 {
1933 sEluna->BeginCall((*itr));
1935 sEluna->Push(sEluna->L, group);
1936 sEluna->Push(sEluna->L, guid);
1937 sEluna->Push(sEluna->L, method);
1938 sEluna->Push(sEluna->L, kicker); // Kicker and Reason not a part of Mangos, implement?
1939 sEluna->Push(sEluna->L, reason);
1940 sEluna->ExecuteCall(6, 0);
1941 }
1942}
1943
1944void HookMgr::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid)
1945{
1946 for (std::vector<int>::const_iterator itr = sEluna->GroupEventBindings[GROUP_EVENT_ON_LEADER_CHANGE].begin();
1947 itr != sEluna->GroupEventBindings[GROUP_EVENT_ON_LEADER_CHANGE].end(); ++itr)
1948 {
1949 sEluna->BeginCall((*itr));
1951 sEluna->Push(sEluna->L, group);
1952 sEluna->Push(sEluna->L, newLeaderGuid);
1953 sEluna->Push(sEluna->L, oldLeaderGuid);
1954 sEluna->ExecuteCall(4, 0);
1955 }
1956}
1957
1959{
1960 for (std::vector<int>::const_iterator itr = sEluna->GroupEventBindings[GROUP_EVENT_ON_DISBAND].begin();
1961 itr != sEluna->GroupEventBindings[GROUP_EVENT_ON_DISBAND].end(); ++itr)
1962 {
1963 sEluna->BeginCall((*itr));
1965 sEluna->Push(sEluna->L, group);
1966 sEluna->ExecuteCall(2, 0);
1967 }
1968}
1969
1970void HookMgr::OnCreate(Group* group, uint64 leaderGuid, GroupType groupType)
1971{
1972 for (std::vector<int>::const_iterator itr = sEluna->GroupEventBindings[GROUP_EVENT_ON_CREATE].begin();
1973 itr != sEluna->GroupEventBindings[GROUP_EVENT_ON_CREATE].end(); ++itr)
1974 {
1975 sEluna->BeginCall((*itr));
1977 sEluna->Push(sEluna->L, group);
1978 sEluna->Push(sEluna->L, leaderGuid);
1979 sEluna->Push(sEluna->L, groupType);
1980 sEluna->ExecuteCall(4, 0);
1981 }
1982}
1983
1985{
1986 if (!sEluna->CreatureEventBindings->GetBindMap(creature->GetEntry()))
1987 return NULL;
1988 return new ElunaCreatureAI(creature);
1989}
1990
1992{
1993 if (!sEluna->GameObjectEventBindings->GetBindMap(gameObject->GetEntry()))
1994 return NULL;
1995 return new ElunaGameObjectAI(gameObject);
1996}
1997
1999{
2001}
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
std::int8_t int8
Definition Define.h:75
std::uint64_t uint64
Definition Define.h:76
std::int64_t int64
Definition Define.h:72
std::uint16_t uint16
Definition Define.h:78
std::optional< T > Optional
DifficultyID Difficulty
GroupType
Definition Group.h:61
void AddElunaScripts()
Definition HookMgr.cpp:1998
@ CREATURE_EVENT_ON_CHARMED
Definition HookMgr.h:206
@ CREATURE_EVENT_ON_RESET
Definition HookMgr.h:212
@ CREATURE_EVENT_ON_PASSANGER_BOARDED
Definition HookMgr.h:218
@ CREATURE_EVENT_ON_CAN_RESPAWN
Definition HookMgr.h:214
@ CREATURE_EVENT_ON_DAMAGE_TAKEN
Definition HookMgr.h:198
@ CREATURE_EVENT_ON_OWNER_ATTACKED
Definition HookMgr.h:201
@ CREATURE_EVENT_ON_DUMMY_EFFECT
Definition HookMgr.h:219
@ CREATURE_EVENT_ON_SUMMONED_CREATURE_DESPAWN
Definition HookMgr.h:209
@ CREATURE_EVENT_ON_RECEIVE_EMOTE
Definition HookMgr.h:197
@ CREATURE_EVENT_ON_REACH_HOME
Definition HookMgr.h:213
@ CREATURE_EVENT_ON_REACH_WP
Definition HookMgr.h:195
@ CREATURE_EVENT_ON_AIUPDATE
Definition HookMgr.h:196
@ CREATURE_EVENT_ON_QUEST_ACCEPT
Definition HookMgr.h:220
@ CREATURE_EVENT_ON_QUEST_COMPLETE
Definition HookMgr.h:222
@ CREATURE_EVENT_ON_MOVE_IN_LOS
Definition HookMgr.h:216
@ CREATURE_EVENT_ON_DIED
Definition HookMgr.h:193
@ CREATURE_EVENT_ON_SPAWN
Definition HookMgr.h:194
@ CREATURE_EVENT_ON_SUMMONED
Definition HookMgr.h:211
@ CREATURE_EVENT_ON_QUEST_REWARD
Definition HookMgr.h:223
@ CREATURE_EVENT_ON_LEAVE_COMBAT
Definition HookMgr.h:191
@ CREATURE_EVENT_ON_HIT_BY_SPELL
Definition HookMgr.h:203
@ CREATURE_EVENT_ON_SPELL_HIT_TARGET
Definition HookMgr.h:204
@ CREATURE_EVENT_ON_VISIBLE_MOVE_IN_LOS
Definition HookMgr.h:217
@ CREATURE_EVENT_ON_POSSESS
Definition HookMgr.h:207
@ CREATURE_EVENT_ON_DIALOG_STATUS
Definition HookMgr.h:224
@ CREATURE_EVENT_ON_QUEST_SELECT
Definition HookMgr.h:221
@ CREATURE_EVENT_ON_CORPSE_REMOVED
Definition HookMgr.h:215
@ CREATURE_EVENT_ON_SUMMONED_CREATURE_DIED
Definition HookMgr.h:210
@ CREATURE_EVENT_ON_TARGET_DIED
Definition HookMgr.h:192
@ CREATURE_EVENT_ON_ENTER_COMBAT
Definition HookMgr.h:190
@ CREATURE_EVENT_ON_PRE_COMBAT
Definition HookMgr.h:199
@ CREATURE_EVENT_ON_JUST_SUMMONED_CREATURE
Definition HookMgr.h:208
@ GUILD_EVENT_ON_MONEY_WITHDRAW
Definition HookMgr.h:164
@ GUILD_EVENT_ON_CREATE
Definition HookMgr.h:162
@ GUILD_EVENT_ON_MOTD_CHANGE
Definition HookMgr.h:160
@ GUILD_EVENT_ON_BANK_EVENT
Definition HookMgr.h:168
@ GUILD_EVENT_ON_EVENT
Definition HookMgr.h:167
@ GUILD_EVENT_ON_DISBAND
Definition HookMgr.h:163
@ GUILD_EVENT_ON_ADD_MEMBER
Definition HookMgr.h:158
@ GUILD_EVENT_ON_INFO_CHANGE
Definition HookMgr.h:161
@ GUILD_EVENT_ON_MONEY_DEPOSIT
Definition HookMgr.h:165
@ GUILD_EVENT_ON_REMOVE_MEMBER
Definition HookMgr.h:159
@ GUILD_EVENT_ON_ITEM_MOVE
Definition HookMgr.h:166
@ ITEM_EVENT_ON_QUEST_ACCEPT
Definition HookMgr.h:250
@ ITEM_EVENT_ON_DUMMY_EFFECT
Definition HookMgr.h:248
@ ITEM_EVENT_ON_USE
Definition HookMgr.h:249
@ ITEM_EVENT_ON_EXPIRE
Definition HookMgr.h:251
@ PLAYER_EVENT_ON_KILL_CREATURE
Definition HookMgr.h:105
@ PLAYER_EVENT_ON_CAN_USE_ITEM
Definition HookMgr.h:130
@ PLAYER_EVENT_ON_CHARACTER_CREATE
Definition HookMgr.h:99
@ PLAYER_EVENT_ON_EQUIP
Definition HookMgr.h:128
@ PLAYER_EVENT_ON_WHISPER
Definition HookMgr.h:117
@ PLAYER_EVENT_ON_SPELL_CAST
Definition HookMgr.h:103
@ PLAYER_EVENT_ON_DUEL_START
Definition HookMgr.h:108
@ PLAYER_EVENT_ON_EMOTE
Definition HookMgr.h:121
@ PLAYER_EVENT_ON_LEVEL_CHANGE
Definition HookMgr.h:111
@ PLAYER_EVENT_ON_LOGIN
Definition HookMgr.h:101
@ PLAYER_EVENT_ON_RESURRECT
Definition HookMgr.h:135
@ PLAYER_EVENT_ON_GIVE_XP
Definition HookMgr.h:110
@ PLAYER_EVENT_ON_CHARACTER_DELETE
Definition HookMgr.h:100
@ PLAYER_EVENT_ON_CHAT
Definition HookMgr.h:116
@ PLAYER_EVENT_ON_DUEL_END
Definition HookMgr.h:109
@ PLAYER_EVENT_ON_KILL_PLAYER
Definition HookMgr.h:104
@ PLAYER_EVENT_ON_LOOT_ITEM
Definition HookMgr.h:131
@ PLAYER_EVENT_ON_REPOP
Definition HookMgr.h:134
@ PLAYER_EVENT_ON_MONEY_CHANGE
Definition HookMgr.h:112
@ PLAYER_EVENT_ON_FIRST_LOGIN
Definition HookMgr.h:129
@ PLAYER_EVENT_ON_LEAVE_COMBAT
Definition HookMgr.h:133
@ PLAYER_EVENT_ON_TEXT_EMOTE
Definition HookMgr.h:122
@ PLAYER_EVENT_ON_REPUTATION_CHANGE
Definition HookMgr.h:113
@ PLAYER_EVENT_ON_GUILD_CHAT
Definition HookMgr.h:119
@ PLAYER_EVENT_ON_SAVE
Definition HookMgr.h:123
@ PLAYER_EVENT_ON_LOGOUT
Definition HookMgr.h:102
@ PLAYER_EVENT_ON_UPDATE_ZONE
Definition HookMgr.h:125
@ PLAYER_EVENT_ON_DUEL_REQUEST
Definition HookMgr.h:107
@ PLAYER_EVENT_ON_LOOT_MONEY
Definition HookMgr.h:136
@ PLAYER_EVENT_ON_BIND_TO_INSTANCE
Definition HookMgr.h:124
@ PLAYER_EVENT_ON_TALENTS_RESET
Definition HookMgr.h:115
@ PLAYER_EVENT_ON_CHANNEL_CHAT
Definition HookMgr.h:120
@ PLAYER_EVENT_ON_GROUP_CHAT
Definition HookMgr.h:118
@ PLAYER_EVENT_ON_ENTER_COMBAT
Definition HookMgr.h:132
@ PLAYER_EVENT_ON_MAP_CHANGE
Definition HookMgr.h:126
@ PLAYER_EVENT_ON_KILLED_BY_CREATURE
Definition HookMgr.h:106
@ PLAYER_EVENT_ON_TALENTS_CHANGE
Definition HookMgr.h:114
@ AUCTION_EVENT_ON_SUCCESSFUL
Definition HookMgr.h:90
@ WORLD_EVENT_ON_CONFIG_LOAD
Definition HookMgr.h:61
@ AUCTION_EVENT_ON_ADD
Definition HookMgr.h:88
@ WORLD_EVENT_ON_SHUTDOWN
Definition HookMgr.h:67
@ WORLD_EVENT_ON_MOTD_CHANGE
Definition HookMgr.h:62
@ TRIGGER_EVENT_ON_TRIGGER
Definition HookMgr.h:82
@ AUCTION_EVENT_ON_EXPIRE
Definition HookMgr.h:91
@ WORLD_EVENT_ON_OPEN_STATE_CHANGE
Definition HookMgr.h:60
@ WORLD_EVENT_ON_SHUTDOWN_INIT
Definition HookMgr.h:63
@ WORLD_EVENT_ON_UPDATE
Definition HookMgr.h:65
@ AUCTION_EVENT_ON_REMOVE
Definition HookMgr.h:89
@ WORLD_EVENT_ON_SHUTDOWN_CANCEL
Definition HookMgr.h:64
@ WORLD_EVENT_ON_STARTUP
Definition HookMgr.h:66
@ ELUNA_EVENT_ON_RESTART
Definition HookMgr.h:70
@ WEATHER_EVENT_ON_CHANGE
Definition HookMgr.h:85
@ GROUP_EVENT_ON_MEMBER_ADD
Definition HookMgr.h:177
@ GROUP_EVENT_ON_DISBAND
Definition HookMgr.h:181
@ GROUP_EVENT_ON_MEMBER_REMOVE
Definition HookMgr.h:179
@ GROUP_EVENT_ON_CREATE
Definition HookMgr.h:182
@ GROUP_EVENT_ON_MEMBER_INVITE
Definition HookMgr.h:178
@ GROUP_EVENT_ON_LEADER_CHANGE
Definition HookMgr.h:180
@ VEHICLE_EVENT_ON_INSTALL_ACCESSORY
Definition HookMgr.h:147
@ VEHICLE_EVENT_ON_ADD_PASSENGER
Definition HookMgr.h:148
@ VEHICLE_EVENT_ON_INSTALL
Definition HookMgr.h:144
@ VEHICLE_EVENT_ON_REMOVE_PASSENGER
Definition HookMgr.h:149
@ VEHICLE_EVENT_ON_UNINSTALL
Definition HookMgr.h:145
@ VEHICLE_EVENT_ON_RESET
Definition HookMgr.h:146
@ GAMEOBJECT_EVENT_ON_LOOT_STATE_CHANGE
Definition HookMgr.h:239
@ GAMEOBJECT_EVENT_ON_QUEST_ACCEPT
Definition HookMgr.h:234
@ GAMEOBJECT_EVENT_ON_RESET
Definition HookMgr.h:232
@ GAMEOBJECT_EVENT_ON_AIUPDATE
Definition HookMgr.h:231
@ GAMEOBJECT_EVENT_ON_DUMMY_EFFECT
Definition HookMgr.h:233
@ GAMEOBJECT_EVENT_ON_DESTROYED
Definition HookMgr.h:237
@ GAMEOBJECT_EVENT_ON_DIALOG_STATUS
Definition HookMgr.h:236
@ GAMEOBJECT_EVENT_ON_DAMAGED
Definition HookMgr.h:238
@ GAMEOBJECT_EVENT_ON_QUEST_REWARD
Definition HookMgr.h:235
@ GAMEOBJECT_EVENT_ON_GO_STATE_CHANGED
Definition HookMgr.h:240
@ GAMEOBJECT_EVENT_ON_QUEST_COMPLETE
Definition HookMgr.h:241
@ GOSSIP_EVENT_ON_HELLO
Definition HookMgr.h:261
@ GOSSIP_EVENT_ON_SELECT
Definition HookMgr.h:262
InventoryResult
Definition Item.h:27
@ EQUIP_ERR_OK
Definition Item.h:28
#define sEluna
Definition LuaEngine.h:710
@ DIALOG_STATUS_INCOMPLETE
Definition QuestDef.h:104
SpellEffIndex
DuelCompleteType
uint32 GetChannelId() const
Definition Channel.h:139
virtual void OwnerAttacked(Unit *)
Definition CreatureAI.h:134
virtual void MoveInLineOfSight(Unit *)
virtual bool CanRespawn()
Definition CreatureAI.h:83
virtual void IsSummonedBy(Unit *)
Definition CreatureAI.h:99
virtual void JustRespawned()
Definition CreatureAI.h:115
virtual void JustReachedHome()
Definition CreatureAI.h:123
virtual void SummonedCreatureDies(Creature *, Unit *)
Definition CreatureAI.h:102
virtual void ReceiveEmote(Player *, uint32)
Definition CreatureAI.h:128
virtual void PassengerBoarded(Unit *, int8, bool)
== Fields =======================================
Definition CreatureAI.h:163
virtual void CorpseRemoved(uint32 &)
== State checks =================================
Definition CreatureAI.h:153
void MoveInLineOfSight_Safe(Unit *who)
== Reactions At =================================
virtual void EnterEvadeMode()
GameObject *const go
GameObjectAI(GameObject *g)
Definition Group.h:147
Definition Guild.h:324
Definition Item.h:202
uint32 GetEntry() const
Definition Object.h:125
PlayerMenu * PlayerTalkClass
Definition Player.h:2680
void ClearMenus()
GameObject * GetGOTarget() const
Definition Spell.cpp:251
Item * GetItemTarget() const
Definition Spell.h:193
Unit * GetUnitTarget() const
Definition Spell.cpp:221
Definition Spell.h:289
uint32 Id
Definition SpellInfo.h:160
virtual void OnCharmed(bool apply)=0
Definition Unit.h:1367
Weather for one zone.
Definition Weather.h:53
WorldScript(const char *name)
ShutdownMask
Definition World.h:57
WeatherState
Definition Weather.h:34
ShutdownExitCode
Definition World.h:63
uint32 GetZone() const
For which zone is this weather?
Definition Weather.h:66
uint32 id
void AttackedBy(Unit *attacker) override
Definition HookMgr.cpp:1526
void EnterEvadeMode() override
Definition HookMgr.cpp:1485
void JustSummoned(Creature *summon) override
Definition HookMgr.cpp:1357
void OwnerAttackedBy(Unit *attacker) override
Definition HookMgr.cpp:1596
void SummonedCreatureDies(Creature *summon, Unit *killer) override
Definition HookMgr.cpp:1511
void JustReachedHome() override
Definition HookMgr.cpp:1568
void Reset() override
Definition HookMgr.cpp:1444
void OwnerAttacked(Unit *target) override
Definition HookMgr.cpp:1612
void MoveInLineOfSight(Unit *who) override
Definition HookMgr.cpp:1670
ElunaCreatureAI(Creature *creature)
Definition HookMgr.cpp:1281
void OnPossess(bool apply)
Definition HookMgr.cpp:1430
void EnterCombat(Unit *target) override
Definition HookMgr.cpp:1300
void OnSpellClick(Unit *clicker, bool &result) override
Definition HookMgr.cpp:1654
void IsSummonedBy(Unit *summoner) override
Definition HookMgr.cpp:1498
void JustRespawned() override
Definition HookMgr.cpp:1542
void MovementInform(uint32 type, uint32 id) override
Definition HookMgr.cpp:1415
bool CanRespawn() override
Definition HookMgr.cpp:1471
void CorpseRemoved(uint32 &respawnDelay) override
== State checks =================================
Definition HookMgr.cpp:1626
void UpdateAI(uint32 diff) override
== Triggered Actions Requested ==================
Definition HookMgr.cpp:1285
void ReceiveEmote(Player *player, uint32 emoteId) override
Definition HookMgr.cpp:1581
void SummonedCreatureDespawn(Creature *summon) override
Definition HookMgr.cpp:1371
void OnCharmed(bool apply) override
Definition HookMgr.cpp:1554
void AttackStart(Unit *target) override
Definition HookMgr.cpp:1457
void DamageTaken(Unit *attacker, uint32 &damage) override
Definition HookMgr.cpp:1314
void MoveInLineOfSight_Safe(Unit *who)
Definition HookMgr.cpp:1684
void KilledUnit(Unit *victim) override
Definition HookMgr.cpp:1343
void JustDied(Unit *killer) override
Definition HookMgr.cpp:1329
void PassengerBoarded(Unit *passenger, int8 seatId, bool apply) override
== Fields =======================================
Definition HookMgr.cpp:1639
void SpellHit(Unit *caster, SpellInfo const *spell) override
Definition HookMgr.cpp:1385
void SpellHitTarget(Unit *target, SpellInfo const *spell) override
Definition HookMgr.cpp:1400
void UpdateAI(uint32 diff) override
Definition HookMgr.cpp:1705
ElunaGameObjectAI(GameObject *_go)
Definition HookMgr.cpp:1700
void OnScriptEvent(int funcRef, uint32 delay, uint32 calls)
Definition HookMgr.cpp:1718
void OnScriptEvent(int funcRef, uint32 delay, uint32 calls)
Definition HookMgr.cpp:1247
void OnMotdChange(std::string &newMotd) override
Definition HookMgr.cpp:1198
void OnShutdown() override
Definition HookMgr.cpp:1267
void OnOpenStateChange(bool open) override
Definition HookMgr.cpp:1174
void OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask) override
Definition HookMgr.cpp:1210
void OnConfigLoad(bool reload) override
Definition HookMgr.cpp:1186
void OnStartup() override
Definition HookMgr.cpp:1256
void OnShutdownCancel() override
Definition HookMgr.cpp:1223
void OnUpdate(uint32 diff) override
Definition HookMgr.cpp:1234
void OnTextEmote(Player *pPlayer, uint32 textEmote, uint32 emoteNum, uint64 guid)
Definition HookMgr.cpp:776
void OnMapChanged(Player *pPlayer)
Definition HookMgr.cpp:894
void OnItemMove(Guild *guild, Player *player, Item *pItem, bool isSrcBank, uint8 srcContainer, uint8 srcSlotId, bool isDestBank, uint8 destContainer, uint8 destSlotId)
Definition HookMgr.cpp:1847
void OnDelete(uint32 guid)
Definition HookMgr.cpp:841
void OnRepop(Player *pPlayer)
Definition HookMgr.cpp:75
void OnInstallAccessory(Vehicle *vehicle, Creature *accessory)
Definition HookMgr.cpp:1037
void OnFreeTalentPointsChanged(Player *pPlayer, uint32 newPoints)
Definition HookMgr.cpp:639
void OnSuccessful(AuctionHouseObject *ah)
Definition HookMgr.cpp:1144
void OnSave(Player *pPlayer)
Definition HookMgr.cpp:853
void OnAdd(AuctionHouseObject *ah)
Definition HookMgr.cpp:1120
void OnUpdateZone(Player *pPlayer, uint32 newZone, uint32 newArea)
Definition HookMgr.cpp:880
void OnBindToInstance(Player *pPlayer, Difficulty difficulty, uint32 mapid, bool permanent)
Definition HookMgr.cpp:865
void OnTalentsReset(Player *pPlayer, bool noCost)
Definition HookMgr.cpp:652
void OnBankEvent(Guild *guild, uint8 eventType, uint8 tabId, uint32 playerGuid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId)
Definition HookMgr.cpp:1884
bool OnQuestComplete(Player *pPlayer, Creature *pCreature, Quest const *pQuest)
Definition HookMgr.cpp:355
void OnEmote(Player *pPlayer, uint32 emote)
Definition HookMgr.cpp:763
void OnFirstLogin(Player *pPlayer)
Definition HookMgr.cpp:63
void OnGameObjectStateChanged(GameObject *pGameObject, uint32 state)
Definition HookMgr.cpp:550
void OnInfoChanged(Guild *guild, const std::string &newInfo)
Definition HookMgr.cpp:1779
bool OnUse(Player *pPlayer, Item *pItem, SpellCastTargets const &targets)
Definition HookMgr.cpp:217
bool OnDummyEffect(Unit *pCaster, uint32 spellId, SpellEffIndex effIndex, Item *pTarget)
Definition HookMgr.cpp:188
bool OnGossipSelectCode(Player *pPlayer, Creature *pCreature, uint32 sender, uint32 action, const char *code)
Definition HookMgr.cpp:310
void OnRemovePassenger(Vehicle *vehicle, Unit *passenger)
Definition HookMgr.cpp:1064
void OnDisband(Guild *guild)
Definition HookMgr.cpp:1806
void OnUninstall(Vehicle *vehicle)
Definition HookMgr.cpp:1013
void OnAddMember(Guild *guild, Player *player, uint32 plRank)
Definition HookMgr.cpp:1737
void OnCreatureKill(Player *pKiller, Creature *pKilled)
Definition HookMgr.cpp:600
void OnPlayerKilledByCreature(Creature *pKiller, Player *pKilled)
Definition HookMgr.cpp:613
void OnLootMoney(Player *pPlayer, uint32 amount)
Definition HookMgr.cpp:50
void OnDuelStart(Player *pStarter, Player *pChallenger)
Definition HookMgr.cpp:720
void OnPVPKill(Player *pKiller, Player *pKilled)
Definition HookMgr.cpp:587
void OnMoneyChanged(Player *pPlayer, int64 &amount)
Definition HookMgr.cpp:665
bool OnExpire(Player *pPlayer, ItemTemplate const *pProto)
Definition HookMgr.cpp:252
bool OnQuestSelect(Player *pPlayer, Creature *pCreature, Quest const *pQuest)
Definition HookMgr.cpp:341
bool OnQuestAccept(Player *pPlayer, Item *pItem, Quest const *pQuest)
Definition HookMgr.cpp:203
void HandleGossipSelectOption(Player *pPlayer, Item *item, uint32 sender, uint32 action, std::string code)
Definition HookMgr.cpp:135
void OnEngineRestart()
Definition HookMgr.cpp:176
void OnRelocate(Transport *transport, uint32 waypointId, uint32 mapId, float x, float y, float z)
Definition HookMgr.cpp:1116
void OnEquip(Player *pPlayer, Item *pItem, uint8 bag, uint8 slot)
Definition HookMgr.cpp:99
bool OnGossipSelect(Player *pPlayer, Creature *pCreature, uint32 sender, uint32 action)
Definition HookMgr.cpp:294
void OnChangeLeader(Group *group, uint64 newLeaderGuid, uint64 oldLeaderGuid)
Definition HookMgr.cpp:1944
void OnCreate(Player *pPlayer)
Definition HookMgr.cpp:829
void OnDuelEnd(Player *pWinner, Player *pLoser, DuelCompleteType type)
Definition HookMgr.cpp:733
void OnWorldUpdate(uint32 diff)
Definition HookMgr.cpp:22
void OnLootItem(Player *pPlayer, Item *pItem, uint32 count, uint64 guid)
Definition HookMgr.cpp:35
void OnAddCreaturePassenger(Transport *transport, Creature *creature)
Definition HookMgr.cpp:1110
void OnLogin(Player *pPlayer)
Definition HookMgr.cpp:805
CreatureAI * GetAI(Creature *creature)
Definition HookMgr.cpp:1984
void OnReset(Vehicle *vehicle)
Definition HookMgr.cpp:1025
void OnDuelRequest(Player *pTarget, Player *pChallenger)
Definition HookMgr.cpp:707
void OnResurrect(Player *pPlayer)
Definition HookMgr.cpp:87
void OnAddPassenger(Vehicle *vehicle, Unit *passenger, int8 seatId)
Definition HookMgr.cpp:1050
void OnLootStateChanged(GameObject *pGameObject, uint32 state, Unit *pUnit)
Definition HookMgr.cpp:537
void OnGiveXP(Player *pPlayer, uint32 &amount, Unit *pVictim)
Definition HookMgr.cpp:678
void OnChange(Weather *weather, WeatherState state, float grade)
Definition HookMgr.cpp:1093
static HookMgr * instance()
Definition HookMgr.cpp:16
void OnEvent(Guild *guild, uint8 eventType, uint32 playerGuid1, uint32 playerGuid2, uint8 newRank)
Definition HookMgr.cpp:1868
void OnRemove(AuctionHouseObject *ah)
Definition HookMgr.cpp:1132
void OnMOTDChanged(Guild *guild, const std::string &newMotd)
Definition HookMgr.cpp:1766
void OnDestroyed(GameObject *pGameObject, Player *pPlayer)
Definition HookMgr.cpp:513
void OnInviteMember(Group *group, uint64 guid)
Definition HookMgr.cpp:1915
void OnRemoveMember(Guild *guild, Player *player, bool isDisbanding, bool isKicked)
Definition HookMgr.cpp:1751
InventoryResult OnCanUseItem(const Player *pPlayer, uint32 itemEntry)
Definition HookMgr.cpp:114
void OnMemberDepositMoney(Guild *guild, Player *player, uint64 &amount)
Definition HookMgr.cpp:1833
void OnMemberWitdrawMoney(Guild *guild, Player *player, uint64 &amount, bool isRepair)
Definition HookMgr.cpp:1818
Optional< QuestGiverStatus > GetDialogStatus(Player *pPlayer, Creature *pCreature)
Definition HookMgr.cpp:383
void OnDamaged(GameObject *pGameObject, Player *pPlayer)
Definition HookMgr.cpp:525
void OnReputationChange(Player *pPlayer, uint32 factionID, int32 &standing, bool incremental)
Definition HookMgr.cpp:692
void OnInstall(Vehicle *vehicle)
Definition HookMgr.cpp:1001
void OnSpellCast(Player *pPlayer, Spell *pSpell, bool skipCheck)
Definition HookMgr.cpp:791
bool OnGossipHello(Player *pPlayer, Creature *pCreature)
Definition HookMgr.cpp:280
void OnPlayerJustEngagedWith(Player *pPlayer, Unit *pEnemy)
Definition HookMgr.cpp:562
bool OnAreaTrigger(Player *pPlayer, AreaTriggerEntry const *pTrigger, bool entered)
Definition HookMgr.cpp:1078
void OnLogout(Player *pPlayer)
Definition HookMgr.cpp:817
void OnChat(Player *pPlayer, uint32 type, uint32 lang, std::string &msg, Player *pReceiver)
Definition HookMgr.cpp:747
void OnPlayerLeaveCombat(Player *pPlayer)
Definition HookMgr.cpp:575
bool OnQuestReward(Player *pPlayer, Creature *pCreature, Quest const *pQuest)
Definition HookMgr.cpp:369
void OnLevelChanged(Player *pPlayer, uint8 oldLevel)
Definition HookMgr.cpp:626
void DamageTaken(Unit *, uint32 &) OVERRIDE
void KilledUnit(Unit *) OVERRIDE
void SpellHit(Unit *, SpellInfo const *) OVERRIDE
void Reset() OVERRIDE
void SummonedCreatureDespawn(Creature *) OVERRIDE
void JustSummoned(Creature *) OVERRIDE
Creature * me
void SpellHitTarget(Unit *, SpellInfo const *) OVERRIDE
void OnPossess(bool)
void EnterCombat(Unit *) OVERRIDE
void MovementInform(uint32, uint32) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void JustDied(Unit *) OVERRIDE
ScriptedAI(Creature *creature)
void AttackStart(Unit *) OVERRIDE