fix: name+guard Woodcutting/Woodworking, drop regex+deprecated this+InterfaceOptions guards

ProfessionMenu.lua:
- profList: add Name="Woodcutting" (spell 13977860) and Name="Woodworking"
  (spells 1005008-1005011) so getProfessionRanks can find the matching
  GetSkillLineInfo entry. Without Name, both fell through GetSpellInfo+match
  with no result and returned nil,nil.
- getProfessionRanks: replace compName:match(name) (regex) with compName == name
  (plain compare); GetSkillLineInfo names are exact, regex was a bug magnet.
- Guard rank concat at lines ~394/397/400: skip the " (rank)" / " (max)" /
  " (rank/max)" append when getProfessionRanks returns nil so unknown
  skill lines don't error.
- InterfaceOptionsFrame:HookScript: wrap in 'if InterfaceOptionsFrame then';
  CoA's reworked FrameXML has no InterfaceOptionsFrame.

ProfessionMenuOptions.lua:
- Guard InterfaceOptionsFrame / InterfaceOptionsFrame_OpenToCategory /
  InterfaceOptions_AddCategory call sites (Options_Toggle, ProfessionMenu_
  OpenOptions, CreateOptionsUI). All nil on CoA's FrameXML.
- TxtSize dropdown func: drop deprecated WoW-2.x global 'this'; use
  UIDropDownMenu_GetSelectedID(ProfessionMenuOptions_TxtSizeMenu) instead.
This commit is contained in:
2026-05-24 17:40:22 +02:00
parent 6d099f6db1
commit 6ef1f9dab8
2 changed files with 25 additions and 17 deletions
+12 -7
View File
@@ -1,15 +1,18 @@
local PM = LibStub("AceAddon-3.0"):GetAddon("ProfessionMenu")
function PM:Options_Toggle()
if not InterfaceOptionsFrame then return end
if InterfaceOptionsFrame:IsVisible() then
InterfaceOptionsFrame:Hide()
else
InterfaceOptionsFrame_OpenToCategory("ProfessionMenu")
if InterfaceOptionsFrame_OpenToCategory then
InterfaceOptionsFrame_OpenToCategory("ProfessionMenu")
end
end
end
function ProfessionMenu_OpenOptions()
if InterfaceOptionsFrame:GetWidth() < 850 then InterfaceOptionsFrame:SetWidth(850) end
if InterfaceOptionsFrame and InterfaceOptionsFrame:GetWidth() < 850 then InterfaceOptionsFrame:SetWidth(850) end
ProfessionMenu_DropDownInitialize()
UIDropDownMenu_SetText(ProfessionMenuOptions_TxtSizeMenu, PM.db.txtSize)
end
@@ -17,14 +20,16 @@ end
--Creates the options frame and all its assets
function PM:CreateOptionsUI()
if InterfaceOptionsFrame:GetWidth() < 850 then InterfaceOptionsFrame:SetWidth(850) end
if InterfaceOptionsFrame and InterfaceOptionsFrame:GetWidth() < 850 then InterfaceOptionsFrame:SetWidth(850) end
local mainframe = {}
mainframe.panel = CreateFrame("FRAME", "ProfessionMenuOptionsFrame", UIParent, nil)
local fstring = mainframe.panel:CreateFontString(mainframe, "OVERLAY", "GameFontNormal")
fstring:SetText("Profession Menu Settings")
fstring:SetPoint("TOPLEFT", 15, -15)
mainframe.panel.name = "ProfessionMenu"
InterfaceOptions_AddCategory(mainframe.panel)
if InterfaceOptions_AddCategory then
InterfaceOptions_AddCategory(mainframe.panel)
end
local hideMenu = CreateFrame("CheckButton", "ProfessionMenuOptions_HideMenu", ProfessionMenuOptionsFrame, "UICheckButtonTemplate")
hideMenu:SetPoint("TOPLEFT", 15, -60)
@@ -143,9 +148,9 @@ PM:CreateOptionsUI()
for i = 10, 25 do
info = {
text = i;
func = function()
PM.db.txtSize = i
local thisID = this:GetID();
func = function()
PM.db.txtSize = i
local thisID = UIDropDownMenu_GetSelectedID(ProfessionMenuOptions_TxtSizeMenu)
UIDropDownMenu_SetSelectedID(ProfessionMenuOptions_TxtSizeMenu, thisID)
end;
};