mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: add WoW compatibility stubs for broader addon support
Add error handling (geterrorhandler, seterrorhandler, debugstack, securecall, issecurevariable), CVar system (GetCVar, GetCVarBool, SetCVar), screen/state queries (GetScreenWidth/Height, GetFramerate, GetNetStats, IsLoggedIn, IsMounted, IsFlying, etc.), UI stubs (StaticPopup_Show/Hide, StopSound), and RAID_CLASS_COLORS table. Prevents common addon load errors.
This commit is contained in:
parent
ae30137705
commit
dbac4eb4f0
1 changed files with 36 additions and 0 deletions
|
|
@ -1128,9 +1128,45 @@ void LuaEngine::registerCoreAPI() {
|
|||
"function SetPortraitTexture() end\n"
|
||||
"function PlaySound() end\n"
|
||||
"function PlaySoundFile() end\n"
|
||||
"function StopSound() end\n"
|
||||
"function UIParent_OnEvent() end\n"
|
||||
"UIParent = CreateFrame('Frame', 'UIParent')\n"
|
||||
"WorldFrame = CreateFrame('Frame', 'WorldFrame')\n"
|
||||
// Error handling stubs (used by many addons)
|
||||
"local _errorHandler = function(err) return err end\n"
|
||||
"function geterrorhandler() return _errorHandler end\n"
|
||||
"function seterrorhandler(fn) if type(fn)=='function' then _errorHandler=fn end end\n"
|
||||
"function debugstack(start, count1, count2) return '' end\n"
|
||||
"function securecall(fn, ...) if type(fn)=='function' then return fn(...) end end\n"
|
||||
"function issecurevariable(...) return false end\n"
|
||||
"function issecure() return false end\n"
|
||||
// CVar stubs (many addons check settings)
|
||||
"local _cvars = {}\n"
|
||||
"function GetCVar(name) return _cvars[name] or '0' end\n"
|
||||
"function GetCVarBool(name) return _cvars[name] == '1' end\n"
|
||||
"function SetCVar(name, value) _cvars[name] = tostring(value) end\n"
|
||||
// Misc compatibility stubs
|
||||
"function GetScreenWidth() return 1920 end\n"
|
||||
"function GetScreenHeight() return 1080 end\n"
|
||||
"function GetFramerate() return 60 end\n"
|
||||
"function GetNetStats() return 0, 0, 0, 0 end\n"
|
||||
"function IsLoggedIn() return true end\n"
|
||||
"function IsResting() return false end\n"
|
||||
"function IsMounted() return false end\n"
|
||||
"function IsFlying() return false end\n"
|
||||
"function IsSwimming() return false end\n"
|
||||
"function IsFalling() return false end\n"
|
||||
"function IsStealthed() return false end\n"
|
||||
"function GetNumLootItems() return 0 end\n"
|
||||
"function StaticPopup_Show() end\n"
|
||||
"function StaticPopup_Hide() end\n"
|
||||
"RAID_CLASS_COLORS = {\n"
|
||||
" WARRIOR={r=0.78,g=0.61,b=0.43}, PALADIN={r=0.96,g=0.55,b=0.73},\n"
|
||||
" HUNTER={r=0.67,g=0.83,b=0.45}, ROGUE={r=1.0,g=0.96,b=0.41},\n"
|
||||
" PRIEST={r=1.0,g=1.0,b=1.0}, DEATHKNIGHT={r=0.77,g=0.12,b=0.23},\n"
|
||||
" SHAMAN={r=0.0,g=0.44,b=0.87}, MAGE={r=0.41,g=0.80,b=0.94},\n"
|
||||
" WARLOCK={r=0.58,g=0.51,b=0.79}, DRUID={r=1.0,g=0.49,b=0.04},\n"
|
||||
"}\n"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue