This commit is contained in:
Rochet2
2017-07-19 18:41:39 +03:00
parent 48313dd0db
commit 8b3cbd1c7d
4 changed files with 33 additions and 11 deletions

View File

@@ -568,9 +568,9 @@ namespace LuaGlobalFunctions
* SERVER_EVENT_ON_NETWORK_STOP = 2, // Not Implemented
* SERVER_EVENT_ON_SOCKET_OPEN = 3, // Not Implemented
* SERVER_EVENT_ON_SOCKET_CLOSE = 4, // Not Implemented
* SERVER_EVENT_ON_PACKET_RECEIVE = 5, // (event, packet, player) - Player only if accessible. Can return false or a new packet
* SERVER_EVENT_ON_PACKET_RECEIVE = 5, // (event, packet, player) - Player only if accessible. Can return false, newPacket
* SERVER_EVENT_ON_PACKET_RECEIVE_UNKNOWN = 6, // Not Implemented
* SERVER_EVENT_ON_PACKET_SEND = 7, // (event, packet, player) - Player only if accessible. Can return false or a new packet
* SERVER_EVENT_ON_PACKET_SEND = 7, // (event, packet, player) - Player only if accessible. Can return false, newPacket
*
* // World
* WORLD_EVENT_ON_OPEN_STATE_CHANGE = 8, // (event, open) - Needs core support on Mangos
@@ -584,7 +584,6 @@ namespace LuaGlobalFunctions
*
* // Eluna
* ELUNA_EVENT_ON_LUA_STATE_CLOSE = 16, // (event) - triggers just before shutting down eluna (on shutdown and restart)
* ELUNA_EVENT_ON_LUA_STATE_OPEN = 33, // (event) - triggers after all scripts are loaded
*
* // Map
* MAP_EVENT_ON_CREATE = 17, // (event, map)
@@ -596,24 +595,28 @@ namespace LuaGlobalFunctions
* MAP_EVENT_ON_UPDATE = 23, // (event, map, diff)
*
* // Area trigger
* TRIGGER_EVENT_ON_TRIGGER = 24, // (event, player, triggerId)
* TRIGGER_EVENT_ON_TRIGGER = 24, // (event, player, triggerId) - Can return true
*
* // Weather
* WEATHER_EVENT_ON_CHANGE = 25, // (event, weather, state, grade)
* WEATHER_EVENT_ON_CHANGE = 25, // (event, zoneId, state, grade)
*
* // Auction house
* AUCTION_EVENT_ON_ADD = 26, // (event, AHObject)
* AUCTION_EVENT_ON_REMOVE = 27, // (event, AHObject)
* AUCTION_EVENT_ON_SUCCESSFUL = 28, // (event, AHObject) // Not Implemented
* AUCTION_EVENT_ON_EXPIRE = 29, // (event, AHObject) // Not Implemented
* AUCTION_EVENT_ON_ADD = 26, // (event, auctionId, owner, item, expireTime, buyout, startBid, currentBid, bidderGUIDLow)
* AUCTION_EVENT_ON_REMOVE = 27, // (event, auctionId, owner, item, expireTime, buyout, startBid, currentBid, bidderGUIDLow)
* AUCTION_EVENT_ON_SUCCESSFUL = 28, // (event, auctionId, owner, item, expireTime, buyout, startBid, currentBid, bidderGUIDLow)
* AUCTION_EVENT_ON_EXPIRE = 29, // (event, auctionId, owner, item, expireTime, buyout, startBid, currentBid, bidderGUIDLow)
*
* // AddOns
* ADDON_EVENT_ON_MESSAGE = 30, // (event, sender, type, prefix, msg, target) - target can be nil/whisper_target/guild/group/channel
* ADDON_EVENT_ON_MESSAGE = 30, // (event, sender, type, prefix, msg, target) - target can be nil/whisper_target/guild/group/channel. Can return false
*
* WORLD_EVENT_ON_DELETE_CREATURE = 31, // (event, creature)
* WORLD_EVENT_ON_DELETE_GAMEOBJECT = 32, // (event, gameobject)
*
* SERVER_EVENT_COUNT
* // Eluna
* ELUNA_EVENT_ON_LUA_STATE_OPEN = 33, // (event) - triggers after all scripts are loaded
*
* GAME_EVENT_START = 34, // (event, gameeventid)
* GAME_EVENT_STOP = 35, // (event, gameeventid)
* };
*
* @proto cancel = (event, function)

View File

@@ -152,6 +152,9 @@ namespace Hooks
// Eluna
ELUNA_EVENT_ON_LUA_STATE_OPEN = 33, // (event) - triggers after all scripts are loaded
GAME_EVENT_START = 34, // (event, gameeventid)
GAME_EVENT_STOP = 35, // (event, gameeventid)
SERVER_EVENT_COUNT
};

View File

@@ -523,6 +523,8 @@ public:
void OnShutdownCancel();
void OnStartup();
void OnShutdown();
void OnGameEventStart(uint32 eventid);
void OnGameEventStop(uint32 eventid);
/* Battle Ground */
void OnBGStart(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId);

View File

@@ -85,6 +85,20 @@ void Eluna::OnTimedEvent(int funcRef, uint32 delay, uint32 calls, WorldObject* o
InvalidateObjects();
}
void Eluna::OnGameEventStart(uint32 eventid)
{
START_HOOK(GAME_EVENT_START);
Push(eventid);
CallAllFunctions(ServerEventBindings, key);
}
void Eluna::OnGameEventStop(uint32 eventid)
{
START_HOOK(GAME_EVENT_STOP);
Push(eventid);
CallAllFunctions(ServerEventBindings, key);
}
void Eluna::OnLuaStateClose()
{
START_HOOK(ELUNA_EVENT_ON_LUA_STATE_CLOSE);