Skip to content

Commit

Permalink
Add Wowhead_URL to recipe right-click menu
Browse files Browse the repository at this point in the history
  • Loading branch information
b-morgan committed Oct 8, 2024
1 parent 2466c81 commit 00504ff
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions UI/MainFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2289,6 +2289,60 @@ function Skillet:SkillButton_LinkRecipe()
end
end

--
-- Inspired by Kaliel's Tracker
--
StaticPopupDialogs["SKILLET_WowheadURL"] = {
text = "Skillet - Wowhead URL",
button2 = CLOSE,
hasEditBox = 1,
editBoxWidth = 300,
EditBoxOnTextChanged = function(self)
self:SetText(self.text)
self:HighlightText()
end,
EditBoxOnEnterPressed = function(self)
self:GetParent():Hide()
end,
EditBoxOnEscapePressed = function(self)
self:GetParent():Hide()
end,
OnShow = function(self)
local url = "https://www.wowhead.com/"
if WOW_PROJECT_ID == WOW_PROJECT_CLASSIC then
url = url.."classic/"
elseif WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC then
url = url.."cata/"
end
local param = "item="..self.text.text_arg1
self.text:SetText(self.text:GetText().."\n\n"..self.text.text_arg2)
self.editBox.text = url..param
self.editBox:SetText(self.editBox.text)
self.editBox:SetFocus()
end,
timeout = 0,
whileDead = 1,
hideOnEscape = 1
}

--
-- Pop up a dialog with a Wowhead URL
--
function Skillet:SkillButton_WowheadURL()
DA.DEBUG(0,"SkillButton_WowheadURL()")
local skill = Skillet.menuButton.skill
--DA.DEBUG(1,"SkillButton_WowheadURL: skill= "..DA.DUMP1(skill,1))
if skill and skill.recipeID then
--DA.DEBUG(1,"SkillButton_WowheadURL: recipeID= "..tostring(skill.recipeID)..", name= "..tostring(skill.name))
local recipe = self:GetRecipe(skill.recipeID)
--DA.DEBUG(2,"SkillButton_WowheadURL: recipe= "..DA.DUMP1(recipe,1))
if recipe and recipe.itemID then
--DA.DEBUG(2,"SkillButton_WowheadURL: itemID= "..tostring(recipe.itemID)..", name= "..tostring(recipe.name))
StaticPopup_Show("SKILLET_WowheadURL", recipe.itemID, recipe.name)
end
end
end

function Skillet:SkillButton_CopySelected()
DA.DEBUG(0,"SkillButton_CopySelected()")
local skillListKey = self.currentPlayer..":"..self.currentTrade..":"..self.currentGroupLabel
Expand Down Expand Up @@ -3179,6 +3233,10 @@ local skillMenuList = {
text = L["Link Recipe"],
func = function() Skillet:SkillButton_LinkRecipe() end,
},
{
text = L["Wowhead URL"],
func = function() Skillet:SkillButton_WowheadURL() end,
},
{
text = L["New Group"],
hasArrow = true,
Expand Down Expand Up @@ -3234,6 +3292,10 @@ local skillMenuListLocked = {
text = L["Link Recipe"],
func = function() Skillet:SkillButton_LinkRecipe() end,
},
{
text = L["Wowhead URL"],
func = function() Skillet:SkillButton_WowheadURL() end,
},
{
text = L["Selection"],
hasArrow = true,
Expand Down

0 comments on commit 00504ff

Please sign in to comment.