Add GetRealmID

This commit is contained in:
Foereaper
2020-09-12 18:05:11 +02:00
parent 4c7ad83e06
commit 9c821527eb
2 changed files with 19 additions and 0 deletions

View File

@@ -51,6 +51,24 @@ namespace LuaGlobalFunctions
return 1;
}
/**
* Returns emulator .conf RealmID
*
* - for MaNGOS returns the realmID as it is stored in the core.
* - for TrinityCore returns the realmID as it is in the conf file.
* @return uint32 realm ID
*/
int GetRealmID(lua_State* L)
{
#ifdef MANGOS
Eluna::Push(L, eWorld->GetRealmID());
#else
Eluna::Push(L, sConfigMgr->GetIntDefault("RealmID", 1));
#endif
return 1;
}
/**
* Returns emulator version
*

View File

@@ -77,6 +77,7 @@ luaL_Reg GlobalMethods[] =
// Getters
{ "GetLuaEngine", &LuaGlobalFunctions::GetLuaEngine },
{ "GetCoreName", &LuaGlobalFunctions::GetCoreName },
{ "GetRealmID", &LuaGlobalFunctions::GetRealmID },
{ "GetCoreVersion", &LuaGlobalFunctions::GetCoreVersion },
{ "GetCoreExpansion", &LuaGlobalFunctions::GetCoreExpansion },
{ "GetQuest", &LuaGlobalFunctions::GetQuest },