Skip to content

Commit

Permalink
Fix/craft queue pvp item bug (#738)
Browse files Browse the repository at this point in the history
* fixed

* lib update
  • Loading branch information
derfloh205 authored Nov 22, 2024
1 parent 787b9e2 commit 62a0cc5
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
41 changes: 36 additions & 5 deletions Classes/RecipeData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -479,19 +479,50 @@ end

--- also sets a requiredSelectionReagent if not yet set
function CraftSim.RecipeData:SetNonQualityReagentsMax()
local print = CraftSim.DEBUG:RegisterDebugID("Classes.RecipeData.SetNonQualityReagentsMax")
print("SetNonQualityReagentsMax", false, true)
for _, reagent in pairs(self.reagentData.requiredReagents) do
if not reagent.hasQuality then
reagent.items[1].quantity = reagent.requiredQuantity
end
end

if self.reagentData:HasRequiredSelectableReagent() then
print("- HasRequiredSelectableReagent", false, false)
if not self.reagentData.requiredSelectableReagentSlot.activeReagent then
for _, possibleRequiredSelectableReagent in pairs(self.reagentData.requiredSelectableReagentSlot.possibleReagents or {}) do
if possibleRequiredSelectableReagent:IsOrderReagentIn(self) then
self.reagentData.requiredSelectableReagentSlot:SetReagent(possibleRequiredSelectableReagent.item
:GetItemID())
break
print("- No active reagent", false, false)
local orderReagent = GUTIL:Find(self.reagentData.requiredSelectableReagentSlot.possibleReagents or {},
function(possibleOrderReagent)
if possibleOrderReagent:IsOrderReagentIn(self) then
return true
end
return false
end)
if orderReagent then
self.reagentData.requiredSelectableReagentSlot:SetReagent(orderReagent.item:GetItemID())
else
local cheapestReagent
local cheapestPrice
local possibleReagents = GUTIL:Filter(
self.reagentData.requiredSelectableReagentSlot.possibleReagents or {}, function(optionalReagent)
return not GUTIL:isItemSoulbound(optionalReagent.item:GetItemID())
end)
for _, optionalReagent in ipairs(possibleReagents) do
local reagentPrice = CraftSim.PRICE_SOURCE:GetMinBuyoutByItemID(optionalReagent.item:GetItemID(),
true, false, true)
if not cheapestReagent then
cheapestReagent = optionalReagent
cheapestPrice = reagentPrice
else
if reagentPrice < cheapestPrice then
cheapestPrice = reagentPrice
cheapestReagent = optionalReagent
end
end
end

if cheapestReagent then
self.reagentData.requiredSelectableReagentSlot:SetReagent(cheapestReagent.item:GetItemID())
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion CraftSim.toc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Title: CraftSim
## Notes: Calculates the average profit based on your profession stats and other tools for the war within gold making
## Author: genju
## Version: 19.6.2
## Version: 19.6.3
## X-Curse-Project-ID: 705015
## X-Wago-ID: 0mNwaPKo
## X-WoWI-ID: 26519
Expand Down
3 changes: 3 additions & 0 deletions Data/News.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ function CraftSim.NEWS:GET_NEWS(itemMap)
local news = {
f.bb(" Hello and thank you for using CraftSim!\n"),
f.bb(" ( You are awesome! )"),
newP("19.6.3"),
f.s .. "Fixed " .. f.bb("CraftLog") .. " PvP Item Bug",
f.s .. "Fixed " .. f.bb("CraftQueue") .. " PvP Item Queueing",
newP("19.6.2"),
f.s .. f.bb("Craft Log"),
f.a .. "- Fixed not updating the graph",
Expand Down
2 changes: 1 addition & 1 deletion Libs/GUTIL
Submodule GUTIL updated 1 files
+1 −1 GUTIL.lua

0 comments on commit 62a0cc5

Please sign in to comment.