added option to display profession rank and max rank beside the name
This commit is contained in:
@@ -26,7 +26,9 @@ local DefaultSettings = {
|
||||
{ TableName = "autoMenu", false, CheckBox = "ProfessionMenuOptions_AutoMenu"},
|
||||
{ TableName = "FilterList", {false,false,false,false} },
|
||||
{ TableName = "BagFilter", {false,false,false,false,false} },
|
||||
{ TableName = "ItemBlacklist", { [9149] = true }}
|
||||
{ TableName = "ItemBlacklist", { [9149] = true }},
|
||||
{ TableName = "hideMaxRank", false, CheckBox = "ProfessionMenuOptions_HideMaxRank"},
|
||||
{ TableName = "hideRank", false, CheckBox = "ProfessionMenuOptions_HideRank"}
|
||||
}
|
||||
|
||||
--[[ TableName = Name of the saved setting
|
||||
@@ -264,7 +266,55 @@ function PM:AddDividerLine(maxLenght)
|
||||
return true
|
||||
end
|
||||
|
||||
function PM:GetProfessions()
|
||||
local function getProfessionRanks(compName)
|
||||
for skillIndex = 1, GetNumSkillLines() do
|
||||
local name, _, _, rank, _, _, maxRank, _, _, _, _, _, _ = GetSkillLineInfo(skillIndex)
|
||||
if compName:match(name) then
|
||||
return rank, maxRank
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for _, prof in ipairs(profList) do
|
||||
for _, spellID in ipairs(prof) do
|
||||
if CA_IsSpellKnown(spellID) then
|
||||
local name, _, icon = GetSpellInfo(spellID)
|
||||
local rank, maxRank = getProfessionRanks(name)
|
||||
if not PM.db.hideRank and PM.db.hideMaxRank then
|
||||
name = name .. " |cFF00FFFF("..rank..")"
|
||||
end
|
||||
if not PM.db.hideMaxRank and PM.db.hideRank then
|
||||
name = name .. " |cFF00FFFF("..maxRank..")"
|
||||
end
|
||||
if not PM.db.hideMaxRank and not PM.db.hideRank then
|
||||
name = name .. " |cFF00FFFF("..rank.."/"..maxRank..")"
|
||||
end
|
||||
local secure = {
|
||||
type1 = 'spell',
|
||||
spell = spellID
|
||||
}
|
||||
local openFrame, tooltipTitle, tooltipText
|
||||
if prof.frame then
|
||||
openFrame = true
|
||||
tooltipTitle = prof.frame[2]
|
||||
tooltipText = prof.frame[3]
|
||||
end
|
||||
dewdrop:AddLine(
|
||||
'text', name,
|
||||
'icon', icon,
|
||||
'secure', secure,
|
||||
'closeWhenClicked', true,
|
||||
'funcRight', function() PM:InventoryFrame_Open(openFrame) end,
|
||||
'textHeight', PM.db.txtSize,
|
||||
'textWidth', PM.db.txtSize,
|
||||
'tooltipTitle', tooltipTitle,
|
||||
'tooltipText', tooltipText
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--sets up the drop down menu for specs
|
||||
local function ProfessionMenu_DewdropRegister(self)
|
||||
@@ -281,34 +331,7 @@ local function ProfessionMenu_DewdropRegister(self)
|
||||
'isTitle', true,
|
||||
'notCheckable', true
|
||||
)
|
||||
for _, prof in ipairs(profList) do
|
||||
for _, spellID in ipairs(prof) do
|
||||
if CA_IsSpellKnown(spellID) then
|
||||
local name, _, icon = GetSpellInfo(spellID)
|
||||
local secure = {
|
||||
type1 = 'spell',
|
||||
spell = spellID
|
||||
}
|
||||
local openFrame, tooltipTitle, tooltipText
|
||||
if prof.frame then
|
||||
openFrame = true
|
||||
tooltipTitle = prof.frame[2]
|
||||
tooltipText = prof.frame[3]
|
||||
end
|
||||
dewdrop:AddLine(
|
||||
'text', name,
|
||||
'icon', icon,
|
||||
'secure', secure,
|
||||
'closeWhenClicked', true,
|
||||
'funcRight', function() PM:InventoryFrame_Open(openFrame) end,
|
||||
'textHeight', PM.db.txtSize,
|
||||
'textWidth', PM.db.txtSize,
|
||||
'tooltipTitle', tooltipTitle,
|
||||
'tooltipText', tooltipText
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
PM:GetProfessions()
|
||||
local divider
|
||||
|
||||
local SummonItems = returnItemIDs()
|
||||
@@ -537,6 +560,9 @@ function PM:OnEnable()
|
||||
SlashCommand(msg)
|
||||
end
|
||||
PM:RegisterEvent("ADDON_LOADED")
|
||||
|
||||
--Add the ProfessionMenu Extract Frame to the special frames tables to enable closing wih the ESC key
|
||||
tinsert(UISpecialFrames, "ProfessionMenuExtractFrame")
|
||||
end
|
||||
|
||||
local function GetTipAnchor(frame)
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
## X-Category: Profession
|
||||
## X-OptionsFrame: ProfessionMenuOptionsFrame
|
||||
## DefaultState: enabled
|
||||
## Version: 1.1
|
||||
## Version: 1.2
|
||||
|
||||
embeds.xml
|
||||
|
||||
@@ -85,8 +85,24 @@ end
|
||||
autoMenu.Lable:SetText("Show menu on hover")
|
||||
autoMenu:SetScript("OnClick", function() PM.db.autoMenu = not PM.db.autoMenu end)
|
||||
|
||||
local hideRank = CreateFrame("CheckButton", "ProfessionMenuOptions_HideRank", ProfessionMenuOptionsFrame, "UICheckButtonTemplate")
|
||||
hideRank:SetPoint("TOPLEFT", 15, -235)
|
||||
hideRank.Lable = hideRank:CreateFontString(nil , "BORDER", "GameFontNormal")
|
||||
hideRank.Lable:SetJustifyH("LEFT")
|
||||
hideRank.Lable:SetPoint("LEFT", 30, 0)
|
||||
hideRank.Lable:SetText("Hide profession rank")
|
||||
hideRank:SetScript("OnClick", function() PM.db.hideRank = not PM.db.hideRank end)
|
||||
|
||||
local hideMaxRank = CreateFrame("CheckButton", "ProfessionMenuOptions_HideMaxRank", ProfessionMenuOptionsFrame, "UICheckButtonTemplate")
|
||||
hideMaxRank:SetPoint("TOPLEFT", 15, -270)
|
||||
hideMaxRank.Lable = hideMaxRank:CreateFontString(nil , "BORDER", "GameFontNormal")
|
||||
hideMaxRank.Lable:SetJustifyH("LEFT")
|
||||
hideMaxRank.Lable:SetPoint("LEFT", 30, 0)
|
||||
hideMaxRank.Lable:SetText("Hide profession max rank")
|
||||
hideMaxRank:SetScript("OnClick", function() PM.db.hideMaxRank = not PM.db.hideMaxRank end)
|
||||
|
||||
local txtSize = CreateFrame("Button", "ProfessionMenuOptions_TxtSizeMenu", ProfessionMenuOptionsFrame, "UIDropDownMenuTemplate")
|
||||
txtSize:SetPoint("TOPLEFT", 15, -240)
|
||||
txtSize:SetPoint("TOPLEFT", 15, -310)
|
||||
txtSize.Lable = txtSize:CreateFontString(nil , "BORDER", "GameFontNormal")
|
||||
txtSize.Lable:SetJustifyH("LEFT")
|
||||
txtSize.Lable:SetPoint("LEFT", txtSize, 190, 0)
|
||||
|
||||
Reference in New Issue
Block a user