Skip to content

Commit 62a0cc5

Browse files
authored
Fix/craft queue pvp item bug (#738)
* fixed * lib update
1 parent 787b9e2 commit 62a0cc5

File tree

4 files changed

+41
-7
lines changed

4 files changed

+41
-7
lines changed

Classes/RecipeData.lua

+36-5
Original file line numberDiff line numberDiff line change
@@ -479,19 +479,50 @@ end
479479

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

488490
if self.reagentData:HasRequiredSelectableReagent() then
491+
print("- HasRequiredSelectableReagent", false, false)
489492
if not self.reagentData.requiredSelectableReagentSlot.activeReagent then
490-
for _, possibleRequiredSelectableReagent in pairs(self.reagentData.requiredSelectableReagentSlot.possibleReagents or {}) do
491-
if possibleRequiredSelectableReagent:IsOrderReagentIn(self) then
492-
self.reagentData.requiredSelectableReagentSlot:SetReagent(possibleRequiredSelectableReagent.item
493-
:GetItemID())
494-
break
493+
print("- No active reagent", false, false)
494+
local orderReagent = GUTIL:Find(self.reagentData.requiredSelectableReagentSlot.possibleReagents or {},
495+
function(possibleOrderReagent)
496+
if possibleOrderReagent:IsOrderReagentIn(self) then
497+
return true
498+
end
499+
return false
500+
end)
501+
if orderReagent then
502+
self.reagentData.requiredSelectableReagentSlot:SetReagent(orderReagent.item:GetItemID())
503+
else
504+
local cheapestReagent
505+
local cheapestPrice
506+
local possibleReagents = GUTIL:Filter(
507+
self.reagentData.requiredSelectableReagentSlot.possibleReagents or {}, function(optionalReagent)
508+
return not GUTIL:isItemSoulbound(optionalReagent.item:GetItemID())
509+
end)
510+
for _, optionalReagent in ipairs(possibleReagents) do
511+
local reagentPrice = CraftSim.PRICE_SOURCE:GetMinBuyoutByItemID(optionalReagent.item:GetItemID(),
512+
true, false, true)
513+
if not cheapestReagent then
514+
cheapestReagent = optionalReagent
515+
cheapestPrice = reagentPrice
516+
else
517+
if reagentPrice < cheapestPrice then
518+
cheapestPrice = reagentPrice
519+
cheapestReagent = optionalReagent
520+
end
521+
end
522+
end
523+
524+
if cheapestReagent then
525+
self.reagentData.requiredSelectableReagentSlot:SetReagent(cheapestReagent.item:GetItemID())
495526
end
496527
end
497528
end

CraftSim.toc

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Title: CraftSim
55
## Notes: Calculates the average profit based on your profession stats and other tools for the war within gold making
66
## Author: genju
7-
## Version: 19.6.2
7+
## Version: 19.6.3
88
## X-Curse-Project-ID: 705015
99
## X-Wago-ID: 0mNwaPKo
1010
## X-WoWI-ID: 26519

Data/News.lua

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ function CraftSim.NEWS:GET_NEWS(itemMap)
1717
local news = {
1818
f.bb(" Hello and thank you for using CraftSim!\n"),
1919
f.bb(" ( You are awesome! )"),
20+
newP("19.6.3"),
21+
f.s .. "Fixed " .. f.bb("CraftLog") .. " PvP Item Bug",
22+
f.s .. "Fixed " .. f.bb("CraftQueue") .. " PvP Item Queueing",
2023
newP("19.6.2"),
2124
f.s .. f.bb("Craft Log"),
2225
f.a .. "- Fixed not updating the graph",

Libs/GUTIL

Submodule GUTIL updated 1 file

0 commit comments

Comments
 (0)