mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-25 00:20:16 +00:00
feat: add GetMaxPlayerLevel and GetAccountExpansionLevel
GetMaxPlayerLevel() returns the level cap for the active expansion: 60 (Classic/Turtle), 70 (TBC), 80 (WotLK). Used by XP bar addons and leveling trackers. GetAccountExpansionLevel() returns the expansion tier: 1 (Classic), 2 (TBC), 3 (WotLK). Used by addons that adapt features based on which expansion is active. Both read from the ExpansionRegistry's active profile at runtime.
This commit is contained in:
parent
bafe036e79
commit
02456ec7c6
1 changed files with 17 additions and 0 deletions
|
|
@ -7,6 +7,7 @@
|
|||
#include "core/application.hpp"
|
||||
#include "rendering/renderer.hpp"
|
||||
#include "audio/ui_sound_manager.hpp"
|
||||
#include "game/expansion_profile.hpp"
|
||||
#include <imgui.h>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
|
|
@ -4935,6 +4936,22 @@ void LuaEngine::registerCoreAPI() {
|
|||
{"IsInRaid", lua_IsInRaid},
|
||||
{"GetPlayerMapPosition", lua_GetPlayerMapPosition},
|
||||
{"GetPlayerFacing", lua_GetPlayerFacing},
|
||||
{"GetMaxPlayerLevel", [](lua_State* L) -> int {
|
||||
auto* reg = core::Application::getInstance().getExpansionRegistry();
|
||||
auto* prof = reg ? reg->getActive() : nullptr;
|
||||
if (prof && prof->id == "wotlk") lua_pushnumber(L, 80);
|
||||
else if (prof && prof->id == "tbc") lua_pushnumber(L, 70);
|
||||
else lua_pushnumber(L, 60);
|
||||
return 1;
|
||||
}},
|
||||
{"GetAccountExpansionLevel", [](lua_State* L) -> int {
|
||||
auto* reg = core::Application::getInstance().getExpansionRegistry();
|
||||
auto* prof = reg ? reg->getActive() : nullptr;
|
||||
if (prof && prof->id == "wotlk") lua_pushnumber(L, 3);
|
||||
else if (prof && prof->id == "tbc") lua_pushnumber(L, 2);
|
||||
else lua_pushnumber(L, 1);
|
||||
return 1;
|
||||
}},
|
||||
{"PlaySound", lua_PlaySound},
|
||||
{"PlaySoundFile", lua_PlaySoundFile},
|
||||
{"GetCVar", lua_GetCVar},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue