/*
* Copyright (C) 2010 - 2014 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
// Eluna
#include "LuaEngine.h"
// Methods
#include "GlobalMethods.h"
#include "ObjectMethods.h"
#include "WorldObjectMethods.h"
#include "UnitMethods.h"
#include "PlayerMethods.h"
#include "CreatureMethods.h"
#include "GroupMethods.h"
#include "GuildMethods.h"
#include "GameObjectMethods.h"
#include "QueryMethods.h"
#include "AuraMethods.h"
#include "ItemMethods.h"
#include "WorldPacketMethods.h"
#include "SpellMethods.h"
#include "QuestMethods.h"
#include "MapMethods.h"
#include "CorpseMethods.h"
#include "WeatherMethods.h"
#include "VehicleMethods.h"
void RegisterGlobals(lua_State* L)
{
// Hooks
lua_register(L, "RegisterPacketEvent", &LuaGlobalFunctions::RegisterPacketEvent); // RegisterPacketEvent(opcodeID, function)
lua_register(L, "RegisterServerEvent", &LuaGlobalFunctions::RegisterServerEvent); // RegisterServerEvent(event, function)
lua_register(L, "RegisterPlayerEvent", &LuaGlobalFunctions::RegisterPlayerEvent); // RegisterPlayerEvent(event, function)
lua_register(L, "RegisterGuildEvent", &LuaGlobalFunctions::RegisterGuildEvent); // RegisterGuildEvent(event, function)
lua_register(L, "RegisterGroupEvent", &LuaGlobalFunctions::RegisterGroupEvent); // RegisterGroupEvent(event, function)
lua_register(L, "RegisterCreatureEvent", &LuaGlobalFunctions::RegisterCreatureEvent); // RegisterCreatureEvent(entry, event, function)
lua_register(L, "RegisterCreatureGossipEvent", &LuaGlobalFunctions::RegisterCreatureGossipEvent); // RegisterCreatureGossipEvent(entry, event, function)
lua_register(L, "RegisterGameObjectEvent", &LuaGlobalFunctions::RegisterGameObjectEvent); // RegisterGameObjectEvent(entry, event, function)
lua_register(L, "RegisterGameObjectGossipEvent", &LuaGlobalFunctions::RegisterGameObjectGossipEvent); // RegisterGameObjectGossipEvent(entry, event, function)
lua_register(L, "RegisterItemEvent", &LuaGlobalFunctions::RegisterItemEvent); // RegisterItemEvent(entry, event, function)
lua_register(L, "RegisterItemGossipEvent", &LuaGlobalFunctions::RegisterItemGossipEvent); // RegisterItemGossipEvent(entry, event, function)
lua_register(L, "RegisterPlayerGossipEvent", &LuaGlobalFunctions::RegisterPlayerGossipEvent); // RegisterPlayerGossipEvent(menu_id, event, function)
// Getters
lua_register(L, "GetLuaEngine", &LuaGlobalFunctions::GetLuaEngine); // GetLuaEngine() - Returns ElunaEngine
lua_register(L, "GetCoreName", &LuaGlobalFunctions::GetCoreName); // GetCoreName() - Returns core name
lua_register(L, "GetCoreVersion", &LuaGlobalFunctions::GetCoreVersion); // GetCoreVersion() - Returns core version string
lua_register(L, "GetQuest", &LuaGlobalFunctions::GetQuest); // GetQuest(questId) - Returns quest object
lua_register(L, "GetPlayerByGUID", &LuaGlobalFunctions::GetPlayerByGUID); // GetPlayerByGUID(guid) - Returns player object by GUID
lua_register(L, "GetPlayerByName", &LuaGlobalFunctions::GetPlayerByName); // GetPlayerByName(name) - Returns player object by player name
lua_register(L, "GetGameTime", &LuaGlobalFunctions::GetGameTime); // GetGameTime() - Returns game time
lua_register(L, "GetPlayersInWorld", &LuaGlobalFunctions::GetPlayersInWorld); // GetPlayersInWorld([team, onlyGM]) - Returns a table with all player objects. Team can be 0 for ally, 1 for horde and 2 for neutral
lua_register(L, "GetPlayersInMap", &LuaGlobalFunctions::GetPlayersInMap); // GetPlayersInWorld(mapId[, instanceId, team]) - Returns a table with all player objects in map. Team can be 0 for ally, 1 for horde and 2 for neutral
lua_register(L, "GetGuildByName", &LuaGlobalFunctions::GetGuildByName); // GetGuildByName(name) - Returns guild object by the guild name
lua_register(L, "GetGuildByLeaderGUID", &LuaGlobalFunctions::GetGuildByLeaderGUID); // GetGuildByLeaderGUID(guid) - Returns guild by it's leader's guid
lua_register(L, "GetPlayerCount", &LuaGlobalFunctions::GetPlayerCount); // GetPlayerCount() - Returns the server's player count
lua_register(L, "GetPlayerGUID", &LuaGlobalFunctions::GetPlayerGUID); // GetPlayerGUID(lowguid) - Generates GUID (uint64) string from player lowguid UNDOCUMENTED
lua_register(L, "GetItemGUID", &LuaGlobalFunctions::GetItemGUID); // GetItemGUID(lowguid) - Generates GUID (uint64) string from item lowguid UNDOCUMENTED
lua_register(L, "GetObjectGUID", &LuaGlobalFunctions::GetObjectGUID); // GetObjectGUID(lowguid, entry) - Generates GUID (uint64) string from gameobject lowguid and entry UNDOCUMENTED
lua_register(L, "GetUnitGUID", &LuaGlobalFunctions::GetUnitGUID); // GetUnitGUID(lowguid, entry) - Generates GUID (uint64) string from unit (creature) lowguid and entry UNDOCUMENTED
lua_register(L, "GetGUIDLow", &LuaGlobalFunctions::GetGUIDLow); // GetGUIDLow(guid) - Returns GUIDLow (uint32) from guid (uint64 as string) UNDOCUMENTED
lua_register(L, "GetGUIDType", &LuaGlobalFunctions::GetGUIDType); // GetGUIDType(guid) - Returns Type (uint32) from guid (uint64 as string) UNDOCUMENTED
lua_register(L, "GetGUIDEntry", &LuaGlobalFunctions::GetGUIDEntry); // GetGUIDEntry(guid) - Returns Entry (uint32) from guid (uint64 as string), may be always 0 UNDOCUMENTED
lua_register(L, "bit_not", &LuaGlobalFunctions::bit_not); // bit_not(a) - Returns ~a UNDOCUMENTED
lua_register(L, "bit_xor", &LuaGlobalFunctions::bit_xor); // bit_xor(a, b) - Returns a ^ b UNDOCUMENTED
lua_register(L, "bit_rshift", &LuaGlobalFunctions::bit_rshift); // bit_rshift(a, b) - Returns a >> b UNDOCUMENTED
lua_register(L, "bit_lshift", &LuaGlobalFunctions::bit_lshift); // bit_lshift(a, b) - Returns a << b UNDOCUMENTED
lua_register(L, "bit_or", &LuaGlobalFunctions::bit_or); // bit_or(a, b) - Returns a | b UNDOCUMENTED
lua_register(L, "bit_and", &LuaGlobalFunctions::bit_and); // bit_and(a, b) - Returns a & b UNDOCUMENTED
lua_register(L, "GetItemLink", &LuaGlobalFunctions::GetItemLink); // GetItemLink(entry[, localeIndex]) - Returns the shift clickable link of the item. Item name translated if translate available for provided locale index UNDOCUMENTED
lua_register(L, "GetMapById", &LuaGlobalFunctions::GetMapById); // GetMapById(mapId, instance) - Returns map object of id specified. UNDOCUMENTED
// Other
// lua_register(L, "ReloadEluna", &LuaGlobalFunctions::ReloadEluna); // ReloadEluna() - Reload's Eluna engine. Returns true if reload succesful.
lua_register(L, "SendWorldMessage", &LuaGlobalFunctions::SendWorldMessage); // SendWorldMessage(msg) - Sends a broadcast message to everyone
lua_register(L, "WorldDBQuery", &LuaGlobalFunctions::WorldDBQuery); // WorldDBQuery(sql) - Executes given SQL query to world database instantly and returns a QueryResult object
lua_register(L, "WorldDBExecute", &LuaGlobalFunctions::WorldDBExecute); // WorldDBExecute(sql) - Executes given SQL query to world database (not instant)
lua_register(L, "CharDBQuery", &LuaGlobalFunctions::CharDBQuery); // CharDBQuery(sql) - Executes given SQL query to character database instantly and returns a QueryResult object
lua_register(L, "CharDBExecute", &LuaGlobalFunctions::CharDBExecute); // CharDBExecute(sql) - Executes given SQL query to character database (not instant)
lua_register(L, "AuthDBQuery", &LuaGlobalFunctions::AuthDBQuery); // AuthDBQuery(sql) - Executes given SQL query to auth/logon database instantly and returns a QueryResult object
lua_register(L, "AuthDBExecute", &LuaGlobalFunctions::AuthDBExecute); // AuthDBExecute(sql) - Executes given SQL query to auth/logon database (not instant)
lua_register(L, "CreateLuaEvent", &LuaGlobalFunctions::CreateLuaEvent); // CreateLuaEvent(function, delay, calls) - Creates a global timed event. Returns Event ID. Calls set to 0 calls infinitely.
lua_register(L, "RemoveEventById", &LuaGlobalFunctions::RemoveEventById); // RemoveEventById(eventId, [all_events]) - Removes a global timed event by it's ID. If all_events is true, can remove any timed event by ID (unit, gameobject, global..)
lua_register(L, "RemoveEvents", &LuaGlobalFunctions::RemoveEvents); // RemoveEvents([all_events]) - Removes all global timed events. Removes all timed events (unit, gameobject, global) if all_events is true
lua_register(L, "PerformIngameSpawn", &LuaGlobalFunctions::PerformIngameSpawn); // PerformIngameSpawn(spawntype, entry, mapid, instanceid, x, y, z, o[, save, DurOrResptime, phase]) - spawntype: 1 Creature, 2 Object. DurOrResptime is respawntime for gameobjects and despawntime for creatures if creature is not saved. Returns spawned creature/gameobject
lua_register(L, "CreatePacket", &LuaGlobalFunctions::CreatePacket); // CreatePacket(opcode, size) - Creates a new packet object
lua_register(L, "AddVendorItem", &LuaGlobalFunctions::AddVendorItem); // AddVendorItem(entry, itemId, maxcount, incrtime, extendedcost) - Adds an item to vendor entry.
lua_register(L, "VendorRemoveItem", &LuaGlobalFunctions::VendorRemoveItem); // VendorRemoveItem(entry, item) - Removes an item from vendor entry
lua_register(L, "VendorRemoveAllItems", &LuaGlobalFunctions::VendorRemoveAllItems); // VendorRemoveAllItems(entry) - Removes all items from vendor entry
lua_register(L, "Kick", &LuaGlobalFunctions::Kick); // Kick(player) - Kicks given player
lua_register(L, "Ban", &LuaGlobalFunctions::Ban); // Ban(banMode(integer), nameOrIP(string), duration(string), reason(string), player(whoBanned)) - Banmode: 0 account, 1 character, 2 IP
lua_register(L, "SaveAllPlayers", &LuaGlobalFunctions::SaveAllPlayers); // SaveAllPlayers() - Saves all players
lua_register(L, "SendMail", &LuaGlobalFunctions::SendMail); // SendMail(subject, text, receiverLowGUID[, sender, stationary, delay, itemEntry, itemAmount, itemEntry2, itemAmount2...]) - Sends a mail to player with lowguid. use nil to use default values on optional arguments. Sender is an optional player object. UNDOCUMENTED
lua_register(L, "AddTaxiPath", &LuaGlobalFunctions::AddTaxiPath); // AddTaxiPath(pathTable, mountA, mountH[, price, pathId]) - Adds a new taxi path. Returns the path's ID. Will replace an existing path if pathId provided and already used. path table structure: T = {{map, x, y, z[, actionFlag, delay, arrivalEvId, departEvId]}, {...}, ...} UDOCUMENTED
lua_register(L, "AddCorpse", &LuaGlobalFunctions::AddCorpse); // AddCorpse(corpse) - Adds the player's corpse to the world. More specifically, the cell.
lua_register(L, "RemoveCorpse", &LuaGlobalFunctions::RemoveCorpse); // RemoveCorpse(corpse) - Removes the player's corpse from the world.
lua_register(L, "ConvertCorpseForPlayer", &LuaGlobalFunctions::ConvertCorpseForPlayer); // ConvertCorpseFromPlayer(guid[, insignia]) - Converts the player's corpse to bones. Adding insignia for PvP is optional (true or false).
lua_register(L, "RemoveOldCorpses", &LuaGlobalFunctions::RemoveOldCorpses); // RemoveOldCorpses() - Converts (removes) old corpses that aren't bones.
lua_register(L, "FindWeather", &LuaGlobalFunctions::FindWeather); // FindWeather(zoneId) - Finds the weather by zoneId and returns the weather
lua_register(L, "AddWeather", &LuaGlobalFunctions::AddWeather); // AddWeather(zoneId) - Adds weather to the following zone, also returns weather
lua_register(L, "RemoveWeather", &LuaGlobalFunctions::RemoveWeather); // RemoveWeather(zoneId) - Removes weather from a zone
lua_register(L, "SendFineWeatherToPlayer", &LuaGlobalFunctions::SendFineWeatherToPlayer); // SendFineWeatherToPlayer(player) - Sends WEATHER_STATE_FINE weather to the
}
ElunaRegister