- updated to delete sanguine workbench after dropping with the item delete setting
- added open menu on mouse over of the button
- Woodcutting now works
This commit is contained in:
Anch
2023-10-27 04:54:22 +13:00
parent 3b9afb28d7
commit ea692c38ef
3 changed files with 55 additions and 39 deletions
+43 -35
View File
@@ -22,7 +22,8 @@ local DefaultSettings = {
{ TableName = "HideMenu", false, Frame = "ProfessionMenuFrame", CheckBox = "ProfessionMenuOptions_HideMenu"}, { TableName = "HideMenu", false, Frame = "ProfessionMenuFrame", CheckBox = "ProfessionMenuOptions_HideMenu"},
{ TableName = "DeleteItem", false, CheckBox = "ProfessionMenuOptions_DeleteMenu"}, { TableName = "DeleteItem", false, CheckBox = "ProfessionMenuOptions_DeleteMenu"},
{ TableName = "minimap", false, CheckBox = "ProfessionMenuOptions_HideMinimap"}, { TableName = "minimap", false, CheckBox = "ProfessionMenuOptions_HideMinimap"},
{ TableName = "txtSize", 12 } { TableName = "txtSize", 12},
{ TableName = "autoMenu", false, CheckBox = "ProfessionMenuOptions_AutoMenu"}
} }
--[[ TableName = Name of the saved setting --[[ TableName = Name of the saved setting
@@ -167,28 +168,31 @@ function PM:HasItem(itemID)
end end
local items = { local items = {
1777028, -- thermal anvil {1777028, "Summon Thermal Anvil"}, -- thermal anvil
1904514, -- sanguine workbench vanity {1904514, "Summon Sanguine Workbench"}, -- sanguine workbench vanity
1904515, {1904515},
} }
-- deletes any mystic altars in the players inventory
-- deletes item from players inventory if value 2 in the items table is set
function PM:RemoveItem(arg2) function PM:RemoveItem(arg2)
if arg2 ~= "Summon Thermal Anvil" or not PM.db.DeleteItem then return end if not PM.db.DeleteItem then return end
for _, itemID in pairs(items) do for _, item in ipairs(items) do
local found, bag, slot = PM:HasItem(itemID) if arg2 == item[2] then
if found then local found, bag, slot = PM:HasItem(item[1])
PickupContainerItem(bag, slot) if found then
DeleteCursorItem() PickupContainerItem(bag, slot)
end DeleteCursorItem()
end
end
end end
PM:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED") PM:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED")
end end
local function returnItemIDs() local function returnItemIDs()
local list = {} local list = {}
for _, itemID in ipairs(items) do for _, item in ipairs(items) do
if PM:HasItem(itemID) or C_VanityCollection.IsCollectionItemOwned(itemID) then if PM:HasItem(item[1]) or C_VanityCollection.IsCollectionItemOwned(item[1]) then
tinsert(list, itemID) tinsert(list, item[1])
end end
end end
return list return list
@@ -242,7 +246,8 @@ function PM:AddDividerLine(maxLenght)
end end
--sets up the drop down menu for specs --sets up the drop down menu for specs
local function ProfessionMenu_DewdropRegister(self, frame) local function ProfessionMenu_DewdropRegister(self)
if dewdrop:IsOpen(self) then dewdrop:Close() return end
dewdrop:Register(self, dewdrop:Register(self,
'point', function(parent) 'point', function(parent)
return "TOP", "BOTTOM" return "TOP", "BOTTOM"
@@ -261,7 +266,7 @@ local function ProfessionMenu_DewdropRegister(self, frame)
local name, _, icon = GetSpellInfo(spellID) local name, _, icon = GetSpellInfo(spellID)
local secure = { local secure = {
type1 = 'spell', type1 = 'spell',
spell = name spell = spellID
} }
dewdrop:AddLine( dewdrop:AddLine(
'text', name, 'text', name,
@@ -288,7 +293,7 @@ local function ProfessionMenu_DewdropRegister(self, frame)
if CA_IsSpellKnown(750750) then if CA_IsSpellKnown(750750) then
if not divider then divider = PM:AddDividerLine(35) end if not divider then divider = PM:AddDividerLine(35) end
local name, _, icon = GetSpellInfo(750750) local name, _, icon = GetSpellInfo(750750)
local secure = { type1 = 'spell', spell = name } local secure = { type1 = 'spell', spell = 750750 }
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
@@ -297,12 +302,12 @@ local function ProfessionMenu_DewdropRegister(self, frame)
PM:AddDividerLine(35) PM:AddDividerLine(35)
for _, spellID in ipairs(spellIDs) do for _, spellID in ipairs(spellIDs) do
local name, _, icon = GetSpellInfo(spellID) local name, _, icon = GetSpellInfo(spellID)
local secure = { type1 = 'spell', spell = name } local secure = { type1 = 'spell', spell = spellID }
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
end end
PM:AddDividerLine(35) PM:AddDividerLine(35)
if frame == "ProfessionMenuFrame_Menu" then if self.show then
dewdrop:AddLine( dewdrop:AddLine(
'text', "Unlock Frame", 'text', "Unlock Frame",
'textHeight', PM.db.txtSize, 'textHeight', PM.db.txtSize,
@@ -333,13 +338,8 @@ local function ProfessionMenu_DewdropRegister(self, frame)
end, end,
'dontHook', true 'dontHook', true
) )
end
local function mainButton_OnClick(self, arg1)
if dewdrop:IsOpen() then PM:OnEnter(self) dewdrop:Close() return end
GameTooltip:Hide()
ProfessionMenu_DewdropRegister(self, "ProfessionMenuFrame_Menu")
dewdrop:Open(self) dewdrop:Open(self)
GameTooltip:Hide()
end end
local function toggleMainButton(toggle) local function toggleMainButton(toggle)
@@ -418,8 +418,12 @@ end
professionbutton:SetPoint("BOTTOM", ProfessionMenuFrame, "BOTTOM", 0, 2) professionbutton:SetPoint("BOTTOM", ProfessionMenuFrame, "BOTTOM", 0, 2)
professionbutton:RegisterForClicks("LeftButtonDown", "RightButtonDown") professionbutton:RegisterForClicks("LeftButtonDown", "RightButtonDown")
professionbutton:Show() professionbutton:Show()
professionbutton:SetScript("OnClick", function(self, btnclick) mainButton_OnClick(self, btnclick) end) professionbutton:SetScript("OnClick", function(self, btnclick) if not PM.db.autoMenu then ProfessionMenu_DewdropRegister(self) end end)
professionbutton.show = true
professionbutton:SetScript("OnEnter", function(self) professionbutton:SetScript("OnEnter", function(self)
if PM.db.autoMenu then
ProfessionMenu_DewdropRegister(self)
end
if not dewdrop:IsOpen() then if not dewdrop:IsOpen() then
PM:OnEnter(self) PM:OnEnter(self)
end end
@@ -505,9 +509,9 @@ end
function minimap.OnClick(self, button) function minimap.OnClick(self, button)
GameTooltip:Hide() GameTooltip:Hide()
if dewdrop:IsOpen() then dewdrop:Close() return end if not PM.db.autoMenu then
ProfessionMenu_DewdropRegister(self) ProfessionMenu_DewdropRegister(self)
dewdrop:Open(self) end
end end
function minimap.OnLeave() function minimap.OnLeave()
@@ -515,11 +519,15 @@ function minimap.OnLeave()
end end
function PM:OnEnter(self) function PM:OnEnter(self)
GameTooltip:SetOwner(self, 'ANCHOR_NONE') if PM.db.autoMenu then
GameTooltip:SetPoint(GetTipAnchor(self)) ProfessionMenu_DewdropRegister(self)
GameTooltip:ClearLines() else
GameTooltip:AddLine("ProfessionMenu") GameTooltip:SetOwner(self, 'ANCHOR_NONE')
GameTooltip:Show() GameTooltip:SetPoint(GetTipAnchor(self))
GameTooltip:ClearLines()
GameTooltip:AddLine("ProfessionMenu")
GameTooltip:Show()
end
end end
function minimap.OnEnter(self) function minimap.OnEnter(self)
+1 -1
View File
@@ -7,6 +7,6 @@
## X-Category: Profession ## X-Category: Profession
## X-OptionsFrame: ProfessionMenuOptionsFrame ## X-OptionsFrame: ProfessionMenuOptionsFrame
## DefaultState: enabled ## DefaultState: enabled
## Version: 0.6 ## Version: 0.7
embeds.xml embeds.xml
+11 -3
View File
@@ -45,7 +45,7 @@ end
hideHover.Lable = hideHover:CreateFontString(nil , "BORDER", "GameFontNormal") hideHover.Lable = hideHover:CreateFontString(nil , "BORDER", "GameFontNormal")
hideHover.Lable:SetJustifyH("LEFT") hideHover.Lable:SetJustifyH("LEFT")
hideHover.Lable:SetPoint("LEFT", 30, 0) hideHover.Lable:SetPoint("LEFT", 30, 0)
hideHover.Lable:SetText("Only Show Menu on Hover") hideHover.Lable:SetText("Only Show Standalone Button on Hover")
hideHover:SetScript("OnClick", function() hideHover:SetScript("OnClick", function()
if PM.db.ShowMenuOnHover then if PM.db.ShowMenuOnHover then
ProfessionMenuFrame_Menu:Show() ProfessionMenuFrame_Menu:Show()
@@ -74,11 +74,19 @@ end
itemDel.Lable = itemDel:CreateFontString(nil , "BORDER", "GameFontNormal") itemDel.Lable = itemDel:CreateFontString(nil , "BORDER", "GameFontNormal")
itemDel.Lable:SetJustifyH("LEFT") itemDel.Lable:SetJustifyH("LEFT")
itemDel.Lable:SetPoint("LEFT", 30, 0) itemDel.Lable:SetPoint("LEFT", 30, 0)
itemDel.Lable:SetText("Delete anvil after summoning") itemDel.Lable:SetText("Delete vanity items after summoning")
itemDel:SetScript("OnClick", function() PM.db.DeleteItem = not PM.db.DeleteItem end) itemDel:SetScript("OnClick", function() PM.db.DeleteItem = not PM.db.DeleteItem end)
local autoMenu = CreateFrame("CheckButton", "ProfessionMenuOptions_AutoMenu", ProfessionMenuOptionsFrame, "UICheckButtonTemplate")
autoMenu:SetPoint("TOPLEFT", 15, -200)
autoMenu.Lable = autoMenu:CreateFontString(nil , "BORDER", "GameFontNormal")
autoMenu.Lable:SetJustifyH("LEFT")
autoMenu.Lable:SetPoint("LEFT", 30, 0)
autoMenu.Lable:SetText("Show menu on hover")
autoMenu:SetScript("OnClick", function() PM.db.autoMenu = not PM.db.autoMenu end)
local txtSize = CreateFrame("Button", "ProfessionMenuOptions_TxtSizeMenu", ProfessionMenuOptionsFrame, "UIDropDownMenuTemplate") local txtSize = CreateFrame("Button", "ProfessionMenuOptions_TxtSizeMenu", ProfessionMenuOptionsFrame, "UIDropDownMenuTemplate")
txtSize:SetPoint("TOPLEFT", 15, -200) txtSize:SetPoint("TOPLEFT", 15, -240)
txtSize.Lable = txtSize:CreateFontString(nil , "BORDER", "GameFontNormal") txtSize.Lable = txtSize:CreateFontString(nil , "BORDER", "GameFontNormal")
txtSize.Lable:SetJustifyH("LEFT") txtSize.Lable:SetJustifyH("LEFT")
txtSize.Lable:SetPoint("LEFT", txtSize, 190, 0) txtSize.Lable:SetPoint("LEFT", txtSize, 190, 0)