fix: guard InterfaceOptions globals, SetHighlightTexture, dynamic class list

CoA-Beta client compat:

  - L15198 InterfaceOptions_AddCategory is nil on the CoA reworked
    FrameXML; guard with 'if InterfaceOptions_AddCategory then ... end'
    so the Plus options panel registration is skipped silently rather
    than aborting addon init.

  - L16477-16478 InterfaceOptionsFrame:HookScript and
    VideoOptionsFrame:HookScript are nil on the CoA client; guard each
    individually so PLAYER_LOGIN doesn't crash.

  - L17186 SetHighlightTexture(0) passes the integer 0 (FDID style)
    which silently no-ops on 3.3.5. Use "" so the highlight is
    actually cleared on locked Plus option buttons.

  - L20066 hardcoded 9-class list excluded DEATHKNIGHT and all CoA
    custom classes from LeaPlusDB.Cooldowns. Build the list dynamically
    via GetNumClasses + GetClassInfo so every playable class on the
    realm gets a cooldown table.
This commit is contained in:
2026-05-24 18:26:43 +02:00
parent eab55eddb8
commit 9157d38c40
+10 -6
View File
@@ -15164,7 +15164,7 @@ function LeaPlusLC:Player()
pTex:SetAlpha(0.2)
pTex:SetTexCoord(0, 1, 1, 0)
InterfaceOptions_AddCategory(interPanel)
if InterfaceOptions_AddCategory then InterfaceOptions_AddCategory(interPanel) end
end
@@ -16443,8 +16443,8 @@ function LeaPlusLC:RunOnce()
----------------------------------------------------------------------
-- Hide Leatrix Plus if game options panel is shown
InterfaceOptionsFrame:HookScript("OnShow", LeaPlusLC.HideFrames);
VideoOptionsFrame:HookScript("OnShow", LeaPlusLC.HideFrames);
if InterfaceOptionsFrame then InterfaceOptionsFrame:HookScript("OnShow", LeaPlusLC.HideFrames); end
if VideoOptionsFrame then VideoOptionsFrame:HookScript("OnShow", LeaPlusLC.HideFrames); end
----------------------------------------------------------------------
-- Block friend requests
@@ -17150,7 +17150,7 @@ local function eventHandler(self, event, arg1, arg2, ...)
-- Remove hover from configuration button if there is one
local temp = { LeaPlusCB[option]:GetChildren() }
if temp and temp[1] and temp[1].t and temp[1].t:GetTexture() == "Interface\\WorldMap\\Gear_64.png" then
temp[1]:SetHighlightTexture(0)
temp[1]:SetHighlightTexture("")
temp[1]:SetScript("OnEnter", nil)
end
end
@@ -20027,8 +20027,12 @@ function LeaPlusLC:SlashFunc(str)
-- Create main table
LeaPlusDB["Cooldowns"] = {}
-- Create class tables
local classList = { "WARRIOR", "PALADIN", "HUNTER", "SHAMAN", "ROGUE", "DRUID", "MAGE", "WARLOCK", "PRIEST" }
-- Create class tables (dynamic: covers DEATHKNIGHT and CoA custom classes)
local classList = {}
for i = 1, GetNumClasses() do
local _, classFile = GetClassInfo(i)
if classFile then tinsert(classList, classFile) end
end
for index = 1, #classList do
if LeaPlusDB["Cooldowns"][classList[index]] == nil then
LeaPlusDB["Cooldowns"][classList[index]] = {}