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
+13 -10
View File
@@ -197,12 +197,13 @@ local profList = {
3274, -- Journeyman 150
3273, -- Apprentice 75
}, --FIRSTAID
{13977860}, --WOODCUTTING
{13977860, Name = "Woodcutting"}, --WOODCUTTING
{
1005011, -- Artisan 300
1005010, -- Expert 225
1005009, -- Journeyman 150
1005008, -- Apprentice 75
Name = "Woodworking",
}, --WOODWORKING
}
@@ -372,7 +373,7 @@ function PM:AddProfessions()
local function getProfessionRanks(compName)
for skillIndex = 1, GetNumSkillLines() do
local name, _, _, rank, _, _, maxRank, _, _, _, _, _, _ = GetSkillLineInfo(skillIndex)
if compName:match(name) then
if compName == name then
return rank, maxRank
end
end
@@ -391,13 +392,13 @@ function PM:AddProfessions()
end
local rank, maxRank = getProfessionRanks(profName)
if not self.db.hideRank and self.db.hideMaxRank then
name = name .. " |cFF00FFFF("..rank..")"
if rank then name = name .. " |cFF00FFFF("..rank..")" end
end
if not self.db.hideMaxRank and self.db.hideRank then
name = name .. " |cFF00FFFF("..maxRank..")"
if maxRank then name = name .. " |cFF00FFFF("..maxRank..")" end
end
if not self.db.hideMaxRank and not self.db.hideRank then
name = name .. " |cFF00FFFF("..rank.."/"..maxRank..")"
if rank and maxRank then name = name .. " |cFF00FFFF("..rank.."/"..maxRank..")" end
end
local secure = {
type1 = 'spell',
@@ -604,11 +605,13 @@ function PM:CreateUI()
end
PM:CreateUI()
InterfaceOptionsFrame:HookScript("OnShow", function()
if InterfaceOptionsFrame and ProfessionMenuOptionsFrame:IsVisible() then
ProfessionMenu_OpenOptions()
end
end)
if InterfaceOptionsFrame then
InterfaceOptionsFrame:HookScript("OnShow", function()
if InterfaceOptionsFrame and ProfessionMenuOptionsFrame:IsVisible() then
ProfessionMenu_OpenOptions()
end
end)
end
-- toggle the main button frame
function PM:ToggleMainFrame()