Skip to content

Commit

Permalink
Fix crafting multiple items
Browse files Browse the repository at this point in the history
Add Wowhead URL to recipe right-click dropdown
Add salvage output item to Auctionator shopping list
  • Loading branch information
b-morgan committed Sep 28, 2024
1 parent 4d2e66a commit cdc304f
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Plugins/Auctionator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ function Skillet:AuctionatorSearch(whichOne)
local scrollName = C_Item.GetItemInfo(recipe.scrollID)
table.insert(items, scrollName)
end
elseif not recipe.salvage then
else
table.insert(items, shoppingListName)
end
end
Expand Down
47 changes: 33 additions & 14 deletions SkilletQueue.lua
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ function Skillet:AddToQueue(command, first)
if (not command.complex) then
--
-- Check if we can add this queue entry to any of the other entries
-- Add a new entry to either the beginning or the end of the queue
--
local added
for i=1,#queue,1 do
Expand All @@ -279,13 +280,23 @@ function Skillet:AddToQueue(command, first)
end
end
if not added then
table.insert(queue, command)
if first then
table.insert(queue, 1, command)
else
table.insert(queue, command)
end
end
elseif queue and #queue > 0 then
--
-- Check last item in queue - add current if they are the same
-- Complex command, check first or last item in queue - add to current entry if they are the same and
-- add to the beginning or the end of the queue if they are not the same.
--
local i = #queue
local i
if first then
i = 1
else
i = #queue
end
if queue[i].op == "iterate" and queue[i].recipeID == command.recipeID and queue[i].recipeLevel == command.recipeLevel and sameOptionals(queue[i], command) then
queue[i].count = queue[i].count + command.count
else
Expand Down Expand Up @@ -638,6 +649,9 @@ function Skillet:ProcessQueue(altMode)
recipeLevel = command.recipeLevel
end
if self.db.profile.queue_one_at_a_time then
--
-- Craft one item at a time.
--
self.processingLevel = recipeLevel
self.optionalReagentsArray = {}
if command.modifiedReagents then
Expand Down Expand Up @@ -676,9 +690,14 @@ function Skillet:ProcessQueue(altMode)
--DA.DEBUG(1,"ProcessQueue: recipeLevel= "..tostring(recipeLevel)..", optionalReagentsArray= "..DA.DUMP(self.optionalReagentsArray))
command.optionalReagentsArray = self.optionalReagentsArray
else
self.recipeTransaction = CreateProfessionsRecipeTransaction(C_TradeSkillUI.GetRecipeSchematic(command.recipeID, false, recipeLevel))
--
-- Craft all items in this queue entry at once.
--
self.recipeSchematic = C_TradeSkillUI.GetRecipeSchematic(command.recipeID, false, recipeLevel)
DA.DEBUG(1,"ProcessQueue: recipeID= "..tostring(command.recipeID)..", recipeLevel= "..tostring(recipeLevel)..", recipeSchematic= "..DA.DUMP(self.recipeSchematic))
self.recipeTransaction = CreateProfessionsRecipeTransaction(self.recipeSchematic)
ApplyAllocations(self.recipeTransaction, command.modifiedReagents, command.requiredReagents, command.optionalReagents, command.finishingReagents)
DA.DEBUG(1,"ProcessQueue: recipeLevel= "..tostring(recipeLevel)..", recipeTransaction= "..DA.DUMP(self.recipeTransaction))
DA.DEBUG(1,"ProcessQueue: recipeTransaction= "..DA.DUMP(self.recipeTransaction))
end
--
-- For debugging, save the command and TraceLog setting. Restored in ContinueCast.
Expand All @@ -689,9 +708,9 @@ function Skillet:ProcessQueue(altMode)
--DA.TraceLog = true
if self.FakeIt then
if self.db.profile.queue_one_at_a_time then
DA.DEBUG(1,"ProcessQueue: recipeLevel= "..tostring(recipeLevel)..", optionalReagentsArray= "..DA.DUMP(command.optionalReagentsArray))
DA.DEBUG(1,"ProcessQueue: recipeID= "..tostring(command.recipeID)..",recipeLevel= "..tostring(recipeLevel)..", optionalReagentsArray= "..DA.DUMP(command.optionalReagentsArray))
else
DA.DEBUG(1,"ProcessQueue: recipeLevel= "..tostring(recipeLevel)..", recipeTransaction= "..DA.DUMP(self.recipeTransaction))
DA.DEBUG(1,"ProcessQueue: recipeID= "..tostring(command.recipeID)..",recipeLevel= "..tostring(recipeLevel)..", recipeTransaction= "..DA.DUMP(self.recipeTransaction))
local reagentInfoTbl = self.recipeTransaction:CreateCraftingReagentInfoTbl()
DA.DEBUG(1,"ProcessQueue: reagentInfoTbl= "..DA.DUMP(reagentInfoTbl))
if not self.recipeTransaction:HasAllAllocations(command.count) then
Expand All @@ -700,16 +719,16 @@ function Skillet:ProcessQueue(altMode)
end
else
if self.db.profile.queue_one_at_a_time then
DA.DEBUG(1,"ProcessQueue: recipeID= "..tostring(command.recipeID)..", recipeLevel= "..tostring(recipeLevel)..", optionalReagentsArray= "..DA.DUMP(command.optionalReagentsArray))
C_TradeSkillUI.CraftRecipe(command.recipeID, command.count, command.optionalReagentsArray, recipeLevel)
else
local reagentInfoTbl = self.recipeTransaction:CreateCraftingReagentInfoTbl()
if self.recipeTransaction:HasAllAllocations(command.count) then
DA.DEBUG(1,"ProcessQueue: reagentInfoTbl= "..DA.DUMP(reagentInfoTbl))
DA.DEBUG(1,"ProcessQueue: reagentInfoTbl= "..DA.DUMP(reagentInfoTbl))
-- if self.recipeTransaction:HasAllAllocations(command.count) then
C_TradeSkillUI.CraftRecipe(command.recipeID, command.count, reagentInfoTbl, recipeLevel)
else
DA.MARK3("Insufficient (Required) Materials available")
DA.DEBUG(1,"ProcessQueue: reagentInfoTbl= "..DA.DUMP(reagentInfoTbl))
end
-- else
-- DA.MARK3("Insufficient (Required) Materials available")
-- end
end
end
else
Expand All @@ -726,7 +745,7 @@ function Skillet:ProcessQueue(altMode)
DA.DEBUG(1,"ProcessQueue(R): command= "..DA.DUMP(command))
DA.DEBUG(1,"ProcessQueue(R): recipe= "..DA.DUMP(recipe))
elseif command.recipeType == Enum.TradeskillRecipeType.Salvage then
local numAvailable
local numAvailable = 0
local itemLocation
DA.DEBUG(1,"ProcessQueue(S): salvageItem= "..tostring(command.salvageItem))
local targetItems = C_TradeSkillUI.GetCraftingTargetItems(recipe.salvage)
Expand Down
55 changes: 55 additions & 0 deletions UI/MainFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1847,6 +1847,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 @@ -2308,6 +2362,7 @@ local function SkillMenuList(SkilletSkillMenu, rootDescription)
rootDescription:CreateTitle(title);
end
rootDescription:CreateButton(L["Link Recipe"], function() Skillet:SkillButton_LinkRecipe() end);
rootDescription:CreateButton(L["Wowhead URL"], function() Skillet:SkillButton_WowheadURL() end);
if Skillet.isLocked then
rootDescription:CreateButton(L["Add to Ignore Materials"], function()
local skill = Skillet.menuButton.skill
Expand Down

0 comments on commit cdc304f

Please sign in to comment.