From 07fdfc0f9b40839042855d24bd6f0cfd9d77f1be Mon Sep 17 00:00:00 2001 From: Anch Date: Fri, 27 Oct 2023 00:59:21 +1300 Subject: [PATCH] added campfire, sanguine workbenchs and woodcutting --- ProfessionMenu/ProfessionMenu.lua | 78 ++++++++++++++++++++++--------- ProfessionMenu/ProfessionMenu.toc | 2 +- 2 files changed, 56 insertions(+), 24 deletions(-) diff --git a/ProfessionMenu/ProfessionMenu.lua b/ProfessionMenu/ProfessionMenu.lua index 6767296..a207253 100644 --- a/ProfessionMenu/ProfessionMenu.lua +++ b/ProfessionMenu/ProfessionMenu.lua @@ -136,8 +136,14 @@ local profList = { 3274, -- Journeyman 150 3273, -- Apprentice 75 }, --FIRSTAID + {13977860}, --WOODCUTTING } +local profSubList = { + 13262, + 31252, + 818, +} function PM:UNIT_SPELLCAST_SUCCEEDED(event, arg1, arg2) PM:RemoveItem(arg2) end @@ -162,6 +168,8 @@ end local items = { 1777028, -- thermal anvil + 1904514, -- sanguine workbench vanity + 1904515, } -- deletes any mystic altars in the players inventory function PM:RemoveItem(arg2) @@ -176,10 +184,29 @@ function PM:RemoveItem(arg2) PM:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED") end +local function returnItemIDs() + local list = {} + for _, itemID in ipairs(items) do + if PM:HasItem(itemID) or C_VanityCollection.IsCollectionItemOwned(itemID) then + tinsert(list, itemID) + end + end + return list +end + +-- returns a list of known spellIDs +local function returnSpellIDs() + local list = {} + for _, spellID in ipairs(profSubList) do + if CA_IsSpellKnown(spellID) then + tinsert(list, spellID) + end + end + return list +end -- add altar summon button via dewdrop secure -function PM:AddItem(itemID) - if not C_VanityCollection.IsCollectionItemOwned(itemID) then return end +local function addItem(itemID) local name, _, _, _, _, _, _, _, _, icon = GetItemInfo(itemID) local startTime, duration = GetItemCooldown(itemID) local cooldown = math.ceil(((duration - (GetTime() - startTime))/60)) @@ -211,6 +238,7 @@ function PM:AddDividerLine(maxLenght) 'isTitle', true, "notCheckable", true ) + return true end --sets up the drop down menu for specs @@ -241,35 +269,39 @@ local function ProfessionMenu_DewdropRegister(self, frame) 'secure', secure, 'closeWhenClicked', true, 'textHeight', PM.db.txtSize, - 'textWidth', PM.db.txtSize + 'textWidth', PM.db.txtSize, + 'func', function() print(spellID) end ) end end end - if CA_IsSpellKnown(750750) or C_VanityCollection.IsCollectionItemOwned(1777028) then - PM:AddDividerLine(35) - if C_VanityCollection.IsCollectionItemOwned(1777028) then - PM:AddItem(1777028) + local divider + + local SummonItems = returnItemIDs() + + if #SummonItems > 0 then + if not divider then divider = PM:AddDividerLine(35) end + for _, itemID in ipairs(SummonItems) do + addItem(itemID) end - if CA_IsSpellKnown(750750) then - local name, _, icon = GetSpellInfo(750750) + end + + if CA_IsSpellKnown(750750) then + if not divider then divider = PM:AddDividerLine(35) end + local name, _, icon = GetSpellInfo(750750) + local secure = { type1 = 'spell', spell = name } + dewdrop:AddLine( 'text', name, 'icon', icon, 'secure', secure, 'closeWhenClicked', true, 'textHeight', PM.db.txtSize, 'textWidth', PM.db.txtSize) + end + + local spellIDs = returnSpellIDs() + if #spellIDs > 0 then + PM:AddDividerLine(35) + for _, spellID in ipairs(spellIDs) do + local name, _, icon = GetSpellInfo(spellID) local secure = { type1 = 'spell', spell = name } - dewdrop:AddLine( 'text', name, 'icon', icon, 'secure', secure, 'closeWhenClicked', true, 'textHeight', PM.db.txtSize, 'textWidth', PM.db.txtSize) + dewdrop:AddLine( 'text', name, 'icon', icon,'secure', secure, 'closeWhenClicked', true, 'textHeight', PM.db.txtSize, 'textWidth', PM.db.txtSize) end end - if CA_IsSpellKnown(13262) or CA_IsSpellKnown(31252) then - PM:AddDividerLine(35) - end - if CA_IsSpellKnown(13262) then - local name, _, icon = GetSpellInfo(13262) - local secure = { type1 = 'spell', spell = name } - dewdrop:AddLine( 'text', name, 'icon', icon, 'secure', secure, 'closeWhenClicked', true, 'textHeight', PM.db.txtSize, 'textWidth', PM.db.txtSize) - end - if CA_IsSpellKnown(31252) then - local name, _, icon = GetSpellInfo(31252) - local secure = { type1 = 'spell', spell = name } - dewdrop:AddLine( 'text', name, 'icon', icon, 'secure', secure, 'closeWhenClicked', true, 'textHeight', PM.db.txtSize, 'textWidth', PM.db.txtSize) - end PM:AddDividerLine(35) if frame == "ProfessionMenuFrame_Menu" then dewdrop:AddLine( diff --git a/ProfessionMenu/ProfessionMenu.toc b/ProfessionMenu/ProfessionMenu.toc index b1f1c25..f4717d6 100644 --- a/ProfessionMenu/ProfessionMenu.toc +++ b/ProfessionMenu/ProfessionMenu.toc @@ -7,6 +7,6 @@ ## X-Category: Profession ## X-OptionsFrame: ProfessionMenuOptionsFrame ## DefaultState: enabled -## Version: 0.4 +## Version: 0.5 embeds.xml