diff --git a/ProfessionMenu/ProfessionMenu.lua b/ProfessionMenu/ProfessionMenu.lua index d072ad1..5e0363b 100644 --- a/ProfessionMenu/ProfessionMenu.lua +++ b/ProfessionMenu/ProfessionMenu.lua @@ -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() diff --git a/ProfessionMenu/ProfessionMenuOptions.lua b/ProfessionMenu/ProfessionMenuOptions.lua index bf5a1a9..ba86347 100644 --- a/ProfessionMenu/ProfessionMenuOptions.lua +++ b/ProfessionMenu/ProfessionMenuOptions.lua @@ -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; };