From 89dc95a7462d30ede75c6a734dcc1f1726f4c83f Mon Sep 17 00:00:00 2001 From: Easelm Date: Sat, 26 Apr 2014 15:09:09 -0400 Subject: [PATCH] Added Global Method * GetAreaName(area or zone ID) - Returns area or zone (string) name by area or zone ID (WIKI: http://wiki.emudevs.com/doku.php?id=eluna_global_method_getareaname) --- GlobalMethods.h | 11 +++++++++++ LuaFunctions.cpp | 1 + 2 files changed, 12 insertions(+) diff --git a/GlobalMethods.h b/GlobalMethods.h index 82f9de4..bbf1c57 100644 --- a/GlobalMethods.h +++ b/GlobalMethods.h @@ -267,6 +267,17 @@ namespace LuaGlobalFunctions return 1; } + int GetAreaName(lua_State* L) + { + uint32 areaOrZoneId = sEluna->CHECKVAL(L, 1); + AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaOrZoneId); + if (!areaEntry) + return luaL_argerror(L, 1, "Invalid Area or Zone ID"); + + sEluna->Push(L, areaEntry->area_name[sWorld->GetDefaultDbcLocale()]); + return 1; + } + /* OTHER */ int RegisterPacketEvent(lua_State* L) { diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index 54d1b98..d3f7827 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -64,6 +64,7 @@ void RegisterGlobals(lua_State* L) 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, "GetAreaName", &LuaGlobalFunctions::GetAreaName); // GetAreaName(area or zone ID) - Returns area or zone (string) name by area or zone ID 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