mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-26 16:50:15 +00:00
feat: add GetDifficultyInfo for instance difficulty display
GetDifficultyInfo(id) returns name, groupType, isHeroic, maxPlayers for WotLK instance difficulties: 0: "5 Player" (party, normal, 5) 1: "5 Player (Heroic)" (party, heroic, 5) 2: "10 Player" (raid, normal, 10) 3: "25 Player" (raid, normal, 25) 4/5: 10/25 Heroic raids Used by boss mod addons (DBM, BigWigs) and instance info displays to show the current dungeon difficulty.
This commit is contained in:
parent
d1d3645d2b
commit
df610ff472
1 changed files with 26 additions and 0 deletions
|
|
@ -5062,6 +5062,32 @@ void LuaEngine::registerCoreAPI() {
|
|||
lua_pushboolean(L, 1); // isCastable
|
||||
return 4;
|
||||
}},
|
||||
// --- Instance ---
|
||||
{"GetDifficultyInfo", [](lua_State* L) -> int {
|
||||
// GetDifficultyInfo(id) → name, groupType, isHeroic, maxPlayers
|
||||
int diff = static_cast<int>(luaL_checknumber(L, 1));
|
||||
struct DiffInfo { const char* name; const char* group; int heroic; int maxPlayers; };
|
||||
static const DiffInfo infos[] = {
|
||||
{"5 Player", "party", 0, 5}, // 0: Normal 5-man
|
||||
{"5 Player (Heroic)", "party", 1, 5}, // 1: Heroic 5-man
|
||||
{"10 Player", "raid", 0, 10}, // 2: 10-man Normal
|
||||
{"25 Player", "raid", 0, 25}, // 3: 25-man Normal
|
||||
{"10 Player (Heroic)", "raid", 1, 10}, // 4: 10-man Heroic
|
||||
{"25 Player (Heroic)", "raid", 1, 25}, // 5: 25-man Heroic
|
||||
};
|
||||
if (diff >= 0 && diff < 6) {
|
||||
lua_pushstring(L, infos[diff].name);
|
||||
lua_pushstring(L, infos[diff].group);
|
||||
lua_pushboolean(L, infos[diff].heroic);
|
||||
lua_pushnumber(L, infos[diff].maxPlayers);
|
||||
} else {
|
||||
lua_pushstring(L, "Unknown");
|
||||
lua_pushstring(L, "party");
|
||||
lua_pushboolean(L, 0);
|
||||
lua_pushnumber(L, 5);
|
||||
}
|
||||
return 4;
|
||||
}},
|
||||
// --- Weather ---
|
||||
{"GetWeatherInfo", [](lua_State* L) -> int {
|
||||
auto* gh = getGameHandler(L);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue