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
This commit is contained in:
Foereaper
2014-09-10 22:38:21 +02:00
parent f2a591b87b
commit 0bfdf632e7
8 changed files with 308 additions and 2 deletions

View File

@@ -104,6 +104,7 @@ GameObjectEventBindings(new EntryBind<HookMgr::GameObjectEvents>("GameObjectEven
GameObjectGossipBindings(new EntryBind<HookMgr::GossipEvents>("GossipEvents (gameobject)", *this)),
ItemEventBindings(new EntryBind<HookMgr::ItemEvents>("ItemEvents", *this)),
ItemGossipBindings(new EntryBind<HookMgr::GossipEvents>("GossipEvents (item)", *this)),
BGEventBindings(new EntryBind<HookMgr::BGEvents>("BGEvents", *this)),
playerGossipBindings(new EntryBind<HookMgr::GossipEvents>("GossipEvents (player)", *this))
{
// open base lua
@@ -151,6 +152,7 @@ Eluna::~Eluna()
delete ItemEventBindings;
delete ItemGossipBindings;
delete playerGossipBindings;
delete BGEventBindings;
// Must close lua state after deleting stores and mgr
lua_close(L);
@@ -769,6 +771,21 @@ void Eluna::Register(uint8 regtype, uint32 id, uint32 evt, int functionRef)
return;
}
break;
case HookMgr::REGTYPE_BG:
if (evt < HookMgr::BG_EVENT_COUNT)
{
if (!BattleGroundTypeId(id))
{
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
luaL_error(L, "Couldn't find battleground with type (ID: %d)!", id);
return;
}
BGEventBindings->Insert(id, evt, functionRef);
return;
}
break;
}
luaL_unref(L, LUA_REGISTRYINDEX, functionRef);
luaL_error(L, "Unknown event type (regtype %d, id %d, event %d)", regtype, id, evt);