Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
b-morgan committed Oct 11, 2024
1 parent 9a7ad59 commit 9988dcb
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 90 deletions.
180 changes: 94 additions & 86 deletions SkilletData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -720,22 +720,26 @@ local function GetRecipeList(player, tradeID)
if recipeInfo.categoryID ~= currentCategoryID then
currentCategoryID = recipeInfo.categoryID
categoryData = Skillet.db.global.Categories[tradeID][currentCategoryID]
--DA.DEBUG(3,"GetRecipeList: categoryData= "..DA.DUMP1(categoryData))
--DA.DEBUG(3,"GetRecipeList: categoryData.name= "..tostring(categoryData.name)..", type= "..tostring(categoryData.type)..", uiOrder= "..tostring(categoryData.uiOrder))
isCurrentCategoryEnabled = categoryData.enabled
if categoryData.parentCategoryID ~= currentParentCategoryID then
--DA.DEBUG(3,"GetRecipeList: categoryData.parentCategoryID= "..tostring(categoryData.parentCategoryID))
currentParentCategoryID = categoryData.parentCategoryID
if currentParentCategoryID then
parentCategoryData = Skillet.db.global.Categories[tradeID][currentParentCategoryID]
--DA.DEBUG(3,"GetRecipeList: parentCategoryData= "..DA.DUMP1(parentCategoryData))
--DA.DEBUG(3,"GetRecipeList: parentCategoryData.name= "..tostring(parentCategoryData.name)..", type= "..tostring(parentCategoryData.type)..", uiOrder= "..tostring(parentCategoryData.uiOrder))
isCurrentParentCategoryEnabled = parentCategoryData.enabled
if categoryData then
--DA.DEBUG(3,"GetRecipeList: categoryData= "..DA.DUMP1(categoryData))
--DA.DEBUG(3,"GetRecipeList: categoryData.name= "..tostring(categoryData.name)..", type= "..tostring(categoryData.type)..", uiOrder= "..tostring(categoryData.uiOrder))
isCurrentCategoryEnabled = categoryData.enabled
if categoryData.parentCategoryID ~= currentParentCategoryID then
--DA.DEBUG(3,"GetRecipeList: categoryData.parentCategoryID= "..tostring(categoryData.parentCategoryID))
currentParentCategoryID = categoryData.parentCategoryID
if currentParentCategoryID then
parentCategoryData = Skillet.db.global.Categories[tradeID][currentParentCategoryID]
--DA.DEBUG(3,"GetRecipeList: parentCategoryData= "..DA.DUMP1(parentCategoryData))
--DA.DEBUG(3,"GetRecipeList: parentCategoryData.name= "..tostring(parentCategoryData.name)..", type= "..tostring(parentCategoryData.type)..", uiOrder= "..tostring(parentCategoryData.uiOrder))
isCurrentParentCategoryEnabled = parentCategoryData.enabled
else
isCurrentParentCategoryEnabled = true
end
else
isCurrentParentCategoryEnabled = true
--DA.DEBUG(3,"GetRecipeList: categoryData.parentCategoryID equals currentParentCategoryID")
end
else
--DA.DEBUG(3,"GetRecipeList: categoryData.parentCategoryID equals currentParentCategoryID")
DA.DEBUG(3,"GetRecipeList: No categoryData for currentCategoryID= "..tostring(currentCategoryID))
end
end
if isCurrentCategoryEnabled and isCurrentParentCategoryEnabled then
Expand Down Expand Up @@ -909,91 +913,95 @@ local function ScanTrade()
-- This category (header) hasn't been seen yet. Stack it (and its unseen parents)
--
local category = recipeInfo.categoryID
headerUsed[category] = true
local headerType = Skillet.db.global.Categories[tradeID][category].type
local headerName = Skillet.db.global.Categories[tradeID][category].name
local headerUIOrder = Skillet.db.global.Categories[tradeID][category].uiOrder
--DA.DEBUG(2,"ScanTrade: category="..tostring(category))
local numCat = 1
local catStack = {}
catStack[numCat] = category
while headerType == "subheader" do
if Skillet.db.global.Categories[tradeID][category].parentCategoryID then
parent = Skillet.db.global.Categories[tradeID][category].parentCategoryID
if Skillet.db.global.Categories[tradeID][parent] then
if not headerUsed[parent] then
headerUsed[parent] = true
numCat = numCat + 1
catStack[numCat] = parent
if not category or category == 0 then
DA.DEBUG(2,"ScanTrade: j= "..tostring(j)..", tradeID= "..tostring(tradeID)..", recipeID= "..tostring(recipeID)..", recipeInfo= "..DA.DUMP1(recipeInfo))
else
headerUsed[category] = true
local headerType = Skillet.db.global.Categories[tradeID][category].type
local headerName = Skillet.db.global.Categories[tradeID][category].name
local headerUIOrder = Skillet.db.global.Categories[tradeID][category].uiOrder
local numCat = 1
local catStack = {}
catStack[numCat] = category
while headerType == "subheader" do
if Skillet.db.global.Categories[tradeID][category].parentCategoryID then
parent = Skillet.db.global.Categories[tradeID][category].parentCategoryID
if Skillet.db.global.Categories[tradeID][parent] then
if not headerUsed[parent] then
headerUsed[parent] = true
numCat = numCat + 1
catStack[numCat] = parent
end
--DA.DEBUG(3,"ScanTrade: tradeID= "..tostring(tradeID)..", parent="..tostring(parent)..", recipeID="..tostring(recipeID))
--DA.DEBUG(3,"ScanTrade: Categories= "..DA.DUMP(Skillet.db.global.Categories[tradeID][parent]))
headerType = Skillet.db.global.Categories[tradeID][parent].type
else
Skillet.db.global.Categories[tradeID][category].type = "header"
headerType = "header"
end
--DA.DEBUG(3,"ScanTrade: tradeID= "..tostring(tradeID)..", parent="..tostring(parent)..", recipeID="..tostring(recipeID))
--DA.DEBUG(3,"ScanTrade: Categories= "..DA.DUMP(Skillet.db.global.Categories[tradeID][parent]))
headerType = Skillet.db.global.Categories[tradeID][parent].type
else
Skillet.db.global.Categories[tradeID][category].type = "header"
headerType = "header"
end
end
category = parent
end -- while
--DA.DEBUG(2,"ScanTrade: numCat= "..tostring(numCat)..", catStack= "..DA.DUMP1(catStack))
category = parent
end -- while
--DA.DEBUG(2,"ScanTrade: numCat= "..tostring(numCat)..", catStack= "..DA.DUMP1(catStack))
--
-- Make sure any base-level empty categories with higher priority are added.
--
local emptyCategoriesToAdd = Skillet.emptyCategoriesToAdd
if emptyCategoriesToAdd then
--DA.DEBUG(2,"ScanTrade: emptyCategory= "..DA.DUMP1(emptyCategoriesToAdd[1]))
local lastCat = catStack[numCat]
--DA.DEBUG(2,"ScanTrade: catStack["..tostring(numCat).."]= "..DA.DUMP1(Skillet.db.global.Categories[tradeID][lastCat]))
while (#emptyCategoriesToAdd > 0) and (emptyCategoriesToAdd[1].uiOrder < Skillet.db.global.Categories[tradeID][lastCat].uiOrder) do
--DA.DEBUG(3,"ScanTrade: adding emptyCategory= "..tostring(emptyCategoriesToAdd[1].name)..", type= "..tostring(emptyCategoriesToAdd[1].type))
parent = emptyCategoriesToAdd[1].categoryID
if not headerUsed[parent] then
headerUsed[parent] = true
numCat = numCat + 1
catStack[numCat] = parent
local emptyCategoriesToAdd = Skillet.emptyCategoriesToAdd
if emptyCategoriesToAdd then
--DA.DEBUG(2,"ScanTrade: emptyCategory= "..DA.DUMP1(emptyCategoriesToAdd[1]))
local lastCat = catStack[numCat]
--DA.DEBUG(2,"ScanTrade: catStack["..tostring(numCat).."]= "..DA.DUMP1(Skillet.db.global.Categories[tradeID][lastCat]))
while (#emptyCategoriesToAdd > 0) and (emptyCategoriesToAdd[1].uiOrder < Skillet.db.global.Categories[tradeID][lastCat].uiOrder) do
--DA.DEBUG(3,"ScanTrade: adding emptyCategory= "..tostring(emptyCategoriesToAdd[1].name)..", type= "..tostring(emptyCategoriesToAdd[1].type))
parent = emptyCategoriesToAdd[1].categoryID
if not headerUsed[parent] then
headerUsed[parent] = true
numCat = numCat + 1
catStack[numCat] = parent
end
table.remove(emptyCategoriesToAdd, 1)
end
table.remove(emptyCategoriesToAdd, 1)
--DA.DEBUG(2,"ScanTrade: emptyCat= "..tostring(numCat)..", catStack= "..DA.DUMP1(catStack))
end
--DA.DEBUG(2,"ScanTrade: emptyCat= "..tostring(numCat)..", catStack= "..DA.DUMP1(catStack))
end

while numCat > 0 do
while numCat > 0 do
--
-- We have a stack of headers. Output them to the skillDB.
--
category = catStack[numCat]
headerType = Skillet.db.global.Categories[tradeID][category].type
headerName = Skillet.db.global.Categories[tradeID][category].name
--DA.DEBUG(2,"ScanTrade: headerType= "..tostring(headerType)..", headerName= "..tostring(headerName))
local groupName
if groupList[headerName] then
groupList[headerName] = groupList[headerName]+1
groupName = headerName..":"..groupList[headerName]
else
groupList[headerName] = 1
groupName = headerName
end
--DA.DEBUG(2,"ScanTrade: groupList[headerName]= "..tostring(groupList[headerName])..", groupName= "..tostring(groupName))
if Skillet.db.global.Categories[tradeID][category].hasProgressBar then
skillDB[i] = "header "..headerName..":"..tostring(category)
Skillet.hasProgressBar[headerName] = category
else
skillDB[i] = "header "..headerName
end
skillData[i] = nil
currentGroup = Skillet:RecipeGroupNew(player, tradeID, "Blizzard", groupName)
currentGroup.autoGroup = true
if headerType == "header" then
parentGroup = currentGroup
Skillet:RecipeGroupAddSubGroup(mainGroup, currentGroup, i)
else
Skillet:RecipeGroupAddSubGroup(parentGroup, currentGroup, i)
end
numHeaders = numHeaders + 1
numCat = numCat - 1
i = i + 1
end -- while
category = catStack[numCat]
headerType = Skillet.db.global.Categories[tradeID][category].type
headerName = Skillet.db.global.Categories[tradeID][category].name
--DA.DEBUG(2,"ScanTrade: headerType= "..tostring(headerType)..", headerName= "..tostring(headerName))
local groupName
if groupList[headerName] then
groupList[headerName] = groupList[headerName]+1
groupName = headerName..":"..groupList[headerName]
else
groupList[headerName] = 1
groupName = headerName
end
--DA.DEBUG(2,"ScanTrade: groupList[headerName]= "..tostring(groupList[headerName])..", groupName= "..tostring(groupName))
if Skillet.db.global.Categories[tradeID][category].hasProgressBar then
skillDB[i] = "header "..headerName..":"..tostring(category)
Skillet.hasProgressBar[headerName] = category
else
skillDB[i] = "header "..headerName
end
skillData[i] = nil
currentGroup = Skillet:RecipeGroupNew(player, tradeID, "Blizzard", groupName)
currentGroup.autoGroup = true
if headerType == "header" then
parentGroup = currentGroup
Skillet:RecipeGroupAddSubGroup(mainGroup, currentGroup, i)
else
Skillet:RecipeGroupAddSubGroup(parentGroup, currentGroup, i)
end
numHeaders = numHeaders + 1
numCat = numCat - 1
i = i + 1
end -- while
end -- category
end -- headerUsed
if currentGroup then
Skillet:RecipeGroupAddRecipe(currentGroup, recipeID, i)
Expand Down
1 change: 1 addition & 0 deletions SkilletNewsData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Skillet.NewsData = {
data = {
{ header = "Warband Bank", body = "Keep track of Warband (Account) bank" },
{ header = "Wowhead URL", body = "Add to recipe right-click menu" },
{ header = "Queuing", body = "Add more right-click queue to top" },
},
},
{ name = "Fixes",
Expand Down
12 changes: 8 additions & 4 deletions SkilletQueue.lua
Original file line number Diff line number Diff line change
Expand Up @@ -767,28 +767,32 @@ function Skillet:ProcessQueue(altMode)
DA.DEBUG(1,"ProcessQueue(R): recipe= "..DA.DUMP(recipe))
elseif command.recipeType == Enum.TradeskillRecipeType.Salvage then
local numAvailable = 0
local itemLocation
DA.DEBUG(1,"ProcessQueue(S): salvageItem= "..tostring(command.salvageItem))
local targetItems = C_TradeSkillUI.GetCraftingTargetItems(recipe.salvage)
DA.DEBUG(2,"ProcessQueue(S): targetItems= "..DA.DUMP1(targetItems))
for i,targetItem in pairs(targetItems) do
if targetItem.itemID == command.salvageItem then
itemLocation = C_Item.GetItemLocation(targetItem.itemGUID)
self.itemLocation = C_Item.GetItemLocation(targetItem.itemGUID)
numAvailable = targetItem.quantity / (recipe.numUsed or 1)
end
end
--DA.DEBUG(1,"ProcessQueue(S): itemLocation= "..DA.DUMP1(itemLocation))
command.itemLocation = itemLocation
DA.DEBUG(1,"ProcessQueue(S): itemLocation= "..DA.DUMP1(self.itemLocation))
command.itemLocation = self.itemLocation
if command.count > numAvailable then
command.count = numAvailable
end
if not command.useConcentration then
command.useConcentration = false
end
self.command = command
self.processingSpell = self:GetRecipeName(command.recipeID)
self.processingSpellID = command.recipeID
self.processingPosition = qpos
self.processingCommand = command
self.processingCount = command.count
self.salvageItem = command.salvageItem
self.queuecasting = true
-- C_TradeSkillUI.CraftSalvage(recipeSpellID, [numCasts], itemTarget [, craftingReagents [, applyConcentration]])
C_TradeSkillUI.CraftSalvage(command.recipeID, command.count, command.itemLocation)
end
else
Expand Down

0 comments on commit 9988dcb

Please sign in to comment.