diff --git a/GlobalMethods.h b/GlobalMethods.h index d15b831..d11b6f7 100644 --- a/GlobalMethods.h +++ b/GlobalMethods.h @@ -460,7 +460,24 @@ namespace LuaGlobalFunctions return 1; } - /* OTHER */ + /** + * Registers a packet event + * + *
+     * enum PacketEvents
+     * {
+     *     PACKET_EVENT_ON_PACKET_RECEIVE          =     5,
+     *     PACKET_EVENT_ON_PACKET_RECEIVE_UNKNOWN  =     6,
+     *     PACKET_EVENT_ON_PACKET_SEND             =     7,
+     *
+     *     PACKET_EVENT_COUNT
+     * };
+     * 
+ * + * @param uint32 entry : opcode + * @param uint32 event : packet event Id, refer to PacketEvents above + * @param function function : function to register + */ int RegisterPacketEvent(lua_State* L) { uint32 entry = Eluna::CHECKVAL(L, 1); @@ -473,6 +490,69 @@ namespace LuaGlobalFunctions return 0; } + /** + * Registers a server event + * + *
+     * enum ServerEvents
+     * {
+     *     // Server
+     *     SERVER_EVENT_ON_NETWORK_START           =     1,       // Not Implemented
+     *     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_UNKNOWN  =     6,       // Not Implemented
+     *     SERVER_EVENT_ON_PACKET_SEND             =     7,       // (event, packet, player) - Player only if accessible. Can return false or a new packet
+     *
+     *     // World
+     *     WORLD_EVENT_ON_OPEN_STATE_CHANGE        =     8,        // (event, open) - Needs core support on Mangos
+     *     WORLD_EVENT_ON_CONFIG_LOAD              =     9,        // (event, reload)
+     *     // UNUSED                               =     10,
+     *     WORLD_EVENT_ON_SHUTDOWN_INIT            =     11,       // (event, code, mask)
+     *     WORLD_EVENT_ON_SHUTDOWN_CANCEL          =     12,       // (event)
+     *     WORLD_EVENT_ON_UPDATE                   =     13,       // (event, diff)
+     *     WORLD_EVENT_ON_STARTUP                  =     14,       // (event)
+     *     WORLD_EVENT_ON_SHUTDOWN                 =     15,       // (event)
+     *
+     *     // 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)
+     *     MAP_EVENT_ON_DESTROY                    =     18,       // (event, map)
+     *     MAP_EVENT_ON_GRID_LOAD                  =     19,       // Not Implemented
+     *     MAP_EVENT_ON_GRID_UNLOAD                =     20,       // Not Implemented
+     *     MAP_EVENT_ON_PLAYER_ENTER               =     21,       // (event, map, player)
+     *     MAP_EVENT_ON_PLAYER_LEAVE               =     22,       // (event, map, player)
+     *     MAP_EVENT_ON_UPDATE                     =     23,       // (event, map, diff)
+     *
+     *     // Area trigger
+     *     TRIGGER_EVENT_ON_TRIGGER                =     24,       // (event, player, triggerId)
+     *
+     *     // Weather
+     *     WEATHER_EVENT_ON_CHANGE                 =     25,       // (event, weather, 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
+     *
+     *     // AddOns
+     *     ADDON_EVENT_ON_MESSAGE                  =     30,       // (event, sender, type, prefix, msg, target) - target can be nil/whisper_target/guild/group/channel
+     *
+     *     WORLD_EVENT_ON_DELETE_CREATURE          =     31,       // (event, creature)
+     *     WORLD_EVENT_ON_DELETE_GAMEOBJECT        =     32,       // (event, gameobject)
+     *
+     *     SERVER_EVENT_COUNT
+     * };
+     * 
+ * + * @param uint32 event : server event Id, refer to ServerEvents above + * @param function function : function to register + */ int RegisterServerEvent(lua_State* L) { uint32 ev = Eluna::CHECKVAL(L, 1); @@ -484,6 +564,64 @@ namespace LuaGlobalFunctions return 0; } + /** + * Registers a [Player] event + * + *
+     * enum PlayerEvents
+     * {
+     *     PLAYER_EVENT_ON_CHARACTER_CREATE        =     1,        // (event, player)
+     *     PLAYER_EVENT_ON_CHARACTER_DELETE        =     2,        // (event, guid)
+     *     PLAYER_EVENT_ON_LOGIN                   =     3,        // (event, player)
+     *     PLAYER_EVENT_ON_LOGOUT                  =     4,        // (event, player)
+     *     PLAYER_EVENT_ON_SPELL_CAST              =     5,        // (event, player, spell, skipCheck)
+     *     PLAYER_EVENT_ON_KILL_PLAYER             =     6,        // (event, killer, killed)
+     *     PLAYER_EVENT_ON_KILL_CREATURE           =     7,        // (event, killer, killed)
+     *     PLAYER_EVENT_ON_KILLED_BY_CREATURE      =     8,        // (event, killer, killed)
+     *     PLAYER_EVENT_ON_DUEL_REQUEST            =     9,        // (event, target, challenger)
+     *     PLAYER_EVENT_ON_DUEL_START              =     10,       // (event, player1, player2)
+     *     PLAYER_EVENT_ON_DUEL_END                =     11,       // (event, winner, loser, type)
+     *     PLAYER_EVENT_ON_GIVE_XP                 =     12,       // (event, player, amount, victim) - Can return new XP amount
+     *     PLAYER_EVENT_ON_LEVEL_CHANGE            =     13,       // (event, player, oldLevel)
+     *     PLAYER_EVENT_ON_MONEY_CHANGE            =     14,       // (event, player, amount)
+     *     PLAYER_EVENT_ON_REPUTATION_CHANGE       =     15,       // (event, player, factionId, standing, incremental) - Can return new standing
+     *     PLAYER_EVENT_ON_TALENTS_CHANGE          =     16,       // (event, player, points)
+     *     PLAYER_EVENT_ON_TALENTS_RESET           =     17,       // (event, player, noCost)
+     *     PLAYER_EVENT_ON_CHAT                    =     18,       // (event, player, msg, Type, lang) - Can return false or new msg
+     *     PLAYER_EVENT_ON_WHISPER                 =     19,       // (event, player, msg, Type, lang, receiver) - Can return false or new msg
+     *     PLAYER_EVENT_ON_GROUP_CHAT              =     20,       // (event, player, msg, Type, lang, group) - Can return false or new msg
+     *     PLAYER_EVENT_ON_GUILD_CHAT              =     21,       // (event, player, msg, Type, lang, guild) - Can return false or new msg
+     *     PLAYER_EVENT_ON_CHANNEL_CHAT            =     22,       // (event, player, msg, Type, lang, channel) - Can return false or new msg
+     *     PLAYER_EVENT_ON_EMOTE                   =     23,       // (event, player, emote) - Not triggered on any known emote
+     *     PLAYER_EVENT_ON_TEXT_EMOTE              =     24,       // (event, player, textEmote, emoteNum, guid)
+     *     PLAYER_EVENT_ON_SAVE                    =     25,       // (event, player)
+     *     PLAYER_EVENT_ON_BIND_TO_INSTANCE        =     26,       // (event, player, difficulty, mapid, permanent)
+     *     PLAYER_EVENT_ON_UPDATE_ZONE             =     27,       // (event, player, newZone, newArea)
+     *     PLAYER_EVENT_ON_MAP_CHANGE              =     28,       // (event, player)
+     *
+     *     // Custom
+     *     PLAYER_EVENT_ON_EQUIP                   =     29,       // (event, player, item, bag, slot)
+     *     PLAYER_EVENT_ON_FIRST_LOGIN             =     30,       // (event, player)
+     *     PLAYER_EVENT_ON_CAN_USE_ITEM            =     31,       // (event, player, itemEntry)
+     *     PLAYER_EVENT_ON_LOOT_ITEM               =     32,       // (event, player, item, count)
+     *     PLAYER_EVENT_ON_ENTER_COMBAT            =     33,       // (event, player, enemy)
+     *     PLAYER_EVENT_ON_LEAVE_COMBAT            =     34,       // (event, player)
+     *     PLAYER_EVENT_ON_REPOP                   =     35,       // (event, player)
+     *     PLAYER_EVENT_ON_RESURRECT               =     36,       // (event, player)
+     *     PLAYER_EVENT_ON_LOOT_MONEY              =     37,       // (event, player, amount)
+     *     PLAYER_EVENT_ON_QUEST_ABANDON           =     38,       // (event, player, questId)
+     *     // UNUSED                               =     39,       // (event, player)
+     *     // UNUSED                               =     40,       // (event, player)
+     *     // UNUSED                               =     41,       // (event, player)
+     *     PLAYER_EVENT_ON_COMMAND                 =     42,       // (event, player, command) - player is nil if command used from console. Can return false
+     *
+     *     PLAYER_EVENT_COUNT
+     * };
+     * 
+ * + * @param uint32 event : [Player] event Id, refer to PlayerEvents above + * @param function function : function to register + */ int RegisterPlayerEvent(lua_State* L) { uint32 ev = Eluna::CHECKVAL(L, 1); @@ -495,6 +633,32 @@ namespace LuaGlobalFunctions return 0; } + /** + * Registers a [Guild] event + * + *
+     * enum GuildEvents
+     * {
+     *     // Guild
+     *     GUILD_EVENT_ON_ADD_MEMBER               =     1,       // (event, guild, player, rank)
+     *     GUILD_EVENT_ON_REMOVE_MEMBER            =     2,       // (event, guild, isDisbanding)
+     *     GUILD_EVENT_ON_MOTD_CHANGE              =     3,       // (event, guild, newMotd)
+     *     GUILD_EVENT_ON_INFO_CHANGE              =     4,       // (event, guild, newInfo)
+     *     GUILD_EVENT_ON_CREATE                   =     5,       // (event, guild, leader, name)  // Not on TC
+     *     GUILD_EVENT_ON_DISBAND                  =     6,       // (event, guild)
+     *     GUILD_EVENT_ON_MONEY_WITHDRAW           =     7,       // (event, guild, player, amount, isRepair)
+     *     GUILD_EVENT_ON_MONEY_DEPOSIT            =     8,       // (event, guild, player, amount)
+     *     GUILD_EVENT_ON_ITEM_MOVE                =     9,       // (event, guild, player, item, isSrcBank, srcContainer, srcSlotId, isDestBank, destContainer, destSlotId)   // TODO
+     *     GUILD_EVENT_ON_EVENT                    =     10,      // (event, guild, eventType, plrGUIDLow1, plrGUIDLow2, newRank)  // TODO
+     *     GUILD_EVENT_ON_BANK_EVENT               =     11,      // (event, guild, eventType, tabId, playerGUIDLow, itemOrMoney, itemStackCount, destTabId)
+     *
+     *     GUILD_EVENT_COUNT
+     * };
+     * 
+ * + * @param uint32 event : [Guild] event Id, refer to GuildEvents above + * @param function function : function to register + */ int RegisterGuildEvent(lua_State* L) { uint32 ev = Eluna::CHECKVAL(L, 1); @@ -506,6 +670,27 @@ namespace LuaGlobalFunctions return 0; } + /** + * Registers a [Group] event + * + *
+     * enum GroupEvents
+     * {
+     *     // Group
+     *     GROUP_EVENT_ON_MEMBER_ADD               =     1,       // (event, group, guid)
+     *     GROUP_EVENT_ON_MEMBER_INVITE            =     2,       // (event, group, guid)
+     *     GROUP_EVENT_ON_MEMBER_REMOVE            =     3,       // (event, group, guid, method, kicker, reason)
+     *     GROUP_EVENT_ON_LEADER_CHANGE            =     4,       // (event, group, newLeaderGuid, oldLeaderGuid)
+     *     GROUP_EVENT_ON_DISBAND                  =     5,       // (event, group)
+     *     GROUP_EVENT_ON_CREATE                   =     6,       // (event, group, leaderGuid, groupType)
+     *
+     *     GROUP_EVENT_COUNT
+     * };
+     * 
+ * + * @param uint32 event : [Group] event Id, refer to GroupEvents above + * @param function function : function to register + */ int RegisterGroupEvent(lua_State* L) { uint32 ev = Eluna::CHECKVAL(L, 1); @@ -517,6 +702,22 @@ namespace LuaGlobalFunctions return 0; } + /** + * Registers a [Creature] gossip event + * + *
+     * enum GossipEvents
+     * {
+     *     GOSSIP_EVENT_ON_HELLO                           = 1,    // (event, player, object) - Object is the Creature/GameObject/Item. For item gossip can return false to stop spell *casting.
+     *     GOSSIP_EVENT_ON_SELECT                          = 2,    // (event, player, object, sender, intid, code, menu_id) - Object is the Creature/GameObject/Item/Player, menu_id is *only for player gossip
+     *     GOSSIP_EVENT_COUNT
+     * };
+     * 
+ * + * @param uint32 menu_id : [Creature] entry Id + * @param uint32 event : [Creature] gossip event Id, refer to GossipEvents above + * @param function function : function to register + */ int RegisterCreatureGossipEvent(lua_State* L) { uint32 entry = Eluna::CHECKVAL(L, 1); @@ -529,6 +730,22 @@ namespace LuaGlobalFunctions return 0; } + /** + * Registers a [GameObject] gossip event + * + *
+     * enum GossipEvents
+     * {
+     *     GOSSIP_EVENT_ON_HELLO                           = 1,    // (event, player, object) - Object is the Creature/GameObject/Item. For item gossip can return false to stop spell *casting.
+     *     GOSSIP_EVENT_ON_SELECT                          = 2,    // (event, player, object, sender, intid, code, menu_id) - Object is the Creature/GameObject/Item/Player, menu_id is *only for player gossip
+     *     GOSSIP_EVENT_COUNT
+     * };
+     * 
+ * + * @param uint32 menu_id : [GameObject] entry Id + * @param uint32 event : [GameObject] gossip event Id, refer to GossipEvents above + * @param function function : function to register + */ int RegisterGameObjectGossipEvent(lua_State* L) { uint32 entry = Eluna::CHECKVAL(L, 1); @@ -541,6 +758,25 @@ namespace LuaGlobalFunctions return 0; } + /** + * Registers an [Item] event + * + *
+     * enum ItemEvents
+     * {
+     *     ITEM_EVENT_ON_DUMMY_EFFECT                      = 1,    // (event, caster, spellid, effindex, item)
+     *     ITEM_EVENT_ON_USE                               = 2,    // (event, player, item, target) - Can return false to stop the spell casting
+     *     ITEM_EVENT_ON_QUEST_ACCEPT                      = 3,    // (event, player, item, quest)
+     *     ITEM_EVENT_ON_EXPIRE                            = 4,    // (event, player, itemid)
+     *     ITEM_EVENT_ON_REMOVE                            = 5,    // (event, player, item)
+     *     ITEM_EVENT_COUNT
+     * };
+     * 
+ * + * @param uint32 entry : [Item] entry Id + * @param uint32 event : [Item] event Id, refer to ItemEvents above + * @param function function : function to register + */ int RegisterItemEvent(lua_State* L) { uint32 entry = Eluna::CHECKVAL(L, 1); @@ -553,6 +789,22 @@ namespace LuaGlobalFunctions return 0; } + /** + * Registers an [Item] gossip event + * + *
+     * enum GossipEvents
+     * {
+     *     GOSSIP_EVENT_ON_HELLO                           = 1,    // (event, player, object) - Object is the Creature/GameObject/Item. For item gossip can return false to stop spell *casting.
+     *     GOSSIP_EVENT_ON_SELECT                          = 2,    // (event, player, object, sender, intid, code, menu_id) - Object is the Creature/GameObject/Item/Player, menu_id is *only for player gossip
+     *     GOSSIP_EVENT_COUNT
+     * };
+     * 
+ * + * @param uint32 entry : [Item] entry Id + * @param uint32 event : [Item] gossip event Id, refer to GossipEvents above + * @param function function : function to register + */ int RegisterItemGossipEvent(lua_State* L) { uint32 entry = Eluna::CHECKVAL(L, 1); @@ -565,6 +817,22 @@ namespace LuaGlobalFunctions return 0; } + /** + * Registers a [Player] gossip event + * + *
+     * enum GossipEvents
+     * {
+     *     GOSSIP_EVENT_ON_HELLO                           = 1,    // (event, player, object) - Object is the Creature/GameObject/Item. For item gossip can return false to stop spell *casting.
+     *     GOSSIP_EVENT_ON_SELECT                          = 2,    // (event, player, object, sender, intid, code, menu_id) - Object is the Creature/GameObject/Item/Player, menu_id is *only for player gossip
+     *     GOSSIP_EVENT_COUNT
+     * };
+     * 
+ * + * @param uint32 menu_id : [Player] gossip menu Id + * @param uint32 event : [Player] gossip event Id, refer to GossipEvents above + * @param function function : function to register + */ int RegisterPlayerGossipEvent(lua_State* L) { uint32 menu_id = Eluna::CHECKVAL(L, 1); @@ -577,6 +845,57 @@ namespace LuaGlobalFunctions return 0; } + /** + * Registers a [Creature] event + * + *
+     * enum CreatureEvents
+     * {
+     *     CREATURE_EVENT_ON_ENTER_COMBAT                    = 1,  // (event, creature, target)
+     *     CREATURE_EVENT_ON_LEAVE_COMBAT                    = 2,  // (event, creature)
+     *     CREATURE_EVENT_ON_TARGET_DIED                     = 3,  // (event, creature, victim)
+     *     CREATURE_EVENT_ON_DIED                            = 4,  // (event, creature, killer)
+     *     CREATURE_EVENT_ON_SPAWN                           = 5,  // (event, creature)
+     *     CREATURE_EVENT_ON_REACH_WP                        = 6,  // (event, creature, type, id)
+     *     CREATURE_EVENT_ON_AIUPDATE                        = 7,  // (event, creature, diff)
+     *     CREATURE_EVENT_ON_RECEIVE_EMOTE                   = 8,  // (event, creature, player, emoteid)
+     *     CREATURE_EVENT_ON_DAMAGE_TAKEN                    = 9,  // (event, creature, attacker, damage) - Can return new damage
+     *     CREATURE_EVENT_ON_PRE_COMBAT                      = 10, // (event, creature, target)
+     *     CREATURE_EVENT_ON_ATTACKED_AT                     = 11, // (event, creature, attacker)
+     *     CREATURE_EVENT_ON_OWNER_ATTACKED                  = 12, // (event, creature, target)    // Not on mangos
+     *     CREATURE_EVENT_ON_OWNER_ATTACKED_AT               = 13, // (event, creature, attacker)  // Not on mangos
+     *     CREATURE_EVENT_ON_HIT_BY_SPELL                    = 14, // (event, creature, caster, spellid)
+     *     CREATURE_EVENT_ON_SPELL_HIT_TARGET                = 15, // (event, creature, target, spellid)
+     *     // UNUSED                                         = 16, // (event, creature)
+     *     // UNUSED                                         = 17, // (event, creature)
+     *     // UNUSED                                         = 18, // (event, creature)
+     *     CREATURE_EVENT_ON_JUST_SUMMONED_CREATURE          = 19, // (event, creature, summon)
+     *     CREATURE_EVENT_ON_SUMMONED_CREATURE_DESPAWN       = 20, // (event, creature, summon)
+     *     CREATURE_EVENT_ON_SUMMONED_CREATURE_DIED          = 21, // (event, creature, summon, killer)    // Not on mangos
+     *     CREATURE_EVENT_ON_SUMMONED                        = 22, // (event, creature, summoner)
+     *     CREATURE_EVENT_ON_RESET                           = 23, // (event, creature)
+     *     CREATURE_EVENT_ON_REACH_HOME                      = 24, // (event, creature)
+     *     // UNUSED                                         = 25, // (event, creature)
+     *     CREATURE_EVENT_ON_CORPSE_REMOVED                  = 26, // (event, creature, respawndelay) - Can return new respawndelay
+     *     CREATURE_EVENT_ON_MOVE_IN_LOS                     = 27, // (event, creature, unit) - Does not actually check LOS. Just uses the sight range
+     *     // UNUSED                                         = 28, // (event, creature)
+     *     // UNUSED                                         = 29, // (event, creature)
+     *     CREATURE_EVENT_ON_DUMMY_EFFECT                    = 30, // (event, caster, spellid, effindex, creature)
+     *     CREATURE_EVENT_ON_QUEST_ACCEPT                    = 31, // (event, player, creature, quest)
+     *     // UNUSED                                         = 32, // (event, creature)
+     *     // UNUSED                                         = 33, // (event, creature)
+     *     CREATURE_EVENT_ON_QUEST_REWARD                    = 34, // (event, player, creature, quest, opt)
+     *     CREATURE_EVENT_ON_DIALOG_STATUS                   = 35, // (event, player, creature)
+     *     CREATURE_EVENT_ON_ADD                             = 36, // (event, creature)
+     *     CREATURE_EVENT_ON_REMOVE                          = 37, // (event, creature)
+     *     CREATURE_EVENT_COUNT
+     * };
+     * 
+ * + * @param uint32 entry : [Creature] entry Id + * @param uint32 event : [Creature] event Id, refer to CreatureEvents above + * @param function function : function to register + */ int RegisterCreatureEvent(lua_State* L) { uint32 entry = Eluna::CHECKVAL(L, 1); @@ -589,6 +908,33 @@ namespace LuaGlobalFunctions return 0; } + /** + * Registers a [GameObject] event + * + *
+     * enum GameObjectEvents
+     * {
+     *     GAMEOBJECT_EVENT_ON_AIUPDATE                    = 1,    // (event, go, diff)
+     *     GAMEOBJECT_EVENT_ON_SPAWN                       = 2,    // (event, go)
+     *     GAMEOBJECT_EVENT_ON_DUMMY_EFFECT                = 3,    // (event, caster, spellid, effindex, go)
+     *     GAMEOBJECT_EVENT_ON_QUEST_ACCEPT                = 4,    // (event, player, go, quest)
+     *     GAMEOBJECT_EVENT_ON_QUEST_REWARD                = 5,    // (event, player, go, quest, opt)
+     *     GAMEOBJECT_EVENT_ON_DIALOG_STATUS               = 6,    // (event, player, go)
+     *     GAMEOBJECT_EVENT_ON_DESTROYED                   = 7,    // (event, go, player)
+     *     GAMEOBJECT_EVENT_ON_DAMAGED                     = 8,    // (event, go, player)
+     *     GAMEOBJECT_EVENT_ON_LOOT_STATE_CHANGE           = 9,    // (event, go, state)
+     *     GAMEOBJECT_EVENT_ON_GO_STATE_CHANGED            = 10,   // (event, go, state)
+     *     // UNUSED                                       = 11,   // (event, gameobject)
+     *     GAMEOBJECT_EVENT_ON_ADD                         = 12,   // (event, gameobject)
+     *     GAMEOBJECT_EVENT_ON_REMOVE                      = 13,   // (event, gameobject)
+     *     GAMEOBJECT_EVENT_COUNT
+     * };
+     * 
+ * + * @param uint32 entry : [GameObject] entry Id + * @param uint32 event : [GameObject] event Id, refer to GameObjectEvents above + * @param function function : function to register + */ int RegisterGameObjectEvent(lua_State* L) { uint32 entry = Eluna::CHECKVAL(L, 1); @@ -601,6 +947,23 @@ namespace LuaGlobalFunctions return 0; } + /** + * Registers a [Battleground] event + * + *
+     * enum BGEvents
+     * {
+     *     BG_EVENT_ON_START                               = 1,    // (event, bg, bgId, instanceId) - Needs to be added to TC
+     *     BG_EVENT_ON_END                                 = 2,    // (event, bg, bgId, instanceId, winner) - Needs to be added to TC
+     *     BG_EVENT_ON_CREATE                              = 3,    // (event, bg, bgId, instanceId) - Needs to be added to TC
+     *     BG_EVENT_ON_PRE_DESTROY                         = 4,    // (event, bg, bgId, instanceId) - Needs to be added to TC
+     *     BG_EVENT_COUNT
+     * };
+     * 
+ * + * @param uint32 event : [Battleground] event Id, refer to BGEvents above + * @param function function : function to register + */ int RegisterBGEvent(lua_State* L) { uint32 ev = Eluna::CHECKVAL(L, 1); @@ -612,12 +975,21 @@ namespace LuaGlobalFunctions return 0; } + /** + * Reloads the Lua Engine + * + */ int ReloadEluna(lua_State* /*L*/) { Eluna::reload = true; return 0; } + /** + * Sends a message to the world + * + * @param string message : message to send + */ int SendWorldMessage(lua_State* L) { const char* message = Eluna::CHECKVAL(L, 1); diff --git a/HookMgr.h b/HookMgr.h index ebd1027..063448e 100644 --- a/HookMgr.h +++ b/HookMgr.h @@ -50,7 +50,7 @@ namespace HookMgr 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 - // World + // World WORLD_EVENT_ON_OPEN_STATE_CHANGE = 8, // (event, open) - Needs core support on Mangos WORLD_EVENT_ON_CONFIG_LOAD = 9, // (event, reload) // UNUSED = 10, diff --git a/SpellMethods.h b/SpellMethods.h index b1bf7ee..3658267 100644 --- a/SpellMethods.h +++ b/SpellMethods.h @@ -152,11 +152,11 @@ namespace LuaSpell /** * Casts the [Spell]. * - * May need further documentation. + * @param bool skipCheck : skips initial checks to see if the [Spell] can be casted or not, this is optional */ int Cast(lua_State* L, Spell* spell) { - bool skipCheck = Eluna::CHECKVAL(L, 2); + bool skipCheck = Eluna::CHECKVAL(L, 2, false); spell->cast(skipCheck); return 0; } @@ -164,7 +164,6 @@ namespace LuaSpell /** * Cancels the [Spell]. * - * May need further documentation. */ int Cancel(lua_State* /*L*/, Spell* spell) { @@ -175,7 +174,6 @@ namespace LuaSpell /** * Finishes the [Spell]. * - * May need further documentation. */ int Finish(lua_State* /*L*/, Spell* spell) {