Updated GetAreaName with locale being an optional argument

WIKI: http://wiki.emudevs.com/doku.php?id=eluna_global_method_getareaname
This commit is contained in:
Easelm
2014-04-26 16:51:50 -04:00
committed by Foereaper
parent 89dc95a746
commit bae4bd18be
2 changed files with 6 additions and 2 deletions

View File

@@ -270,11 +270,15 @@ namespace LuaGlobalFunctions
int GetAreaName(lua_State* L)
{
uint32 areaOrZoneId = sEluna->CHECKVAL<uint32>(L, 1);
int locale = sEluna->CHECKVAL<int>(L, 2, DEFAULT_LOCALE);
if (locale < 0 || locale >= MAX_LOCALES)
return luaL_argerror(L, 2, "Invalid locale specified");
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()]);
sEluna->Push(L, areaEntry->area_name[locale]);
return 1;
}