@@ -175,12 +175,17 @@ function CraftSim.CRAFTQ:CRAFTINGORDERS_CLAIMED_ORDER_REMOVED()
175
175
end
176
176
177
177
function CraftSim .CRAFTQ :QueueWorkOrders ()
178
+ local print = CraftSim .DEBUG :RegisterDebugID (" Modules.CraftQueue.QueueWorkOrders" )
179
+ print (" QueueWorkOrders" , false , true )
178
180
local profession = C_TradeSkillUI .GetChildProfessionInfo ().profession
179
181
local normalizedRealmName = GetNormalizedRealmName ()
180
182
local realmName = GetRealmName ()
181
183
local cleanedCrafterUIDs = GUTIL :Map (CraftSim .DB .CRAFTER :GetCrafterUIDs (), function (crafterUID )
182
184
return select (1 , gsub (crafterUID , " -" .. normalizedRealmName , " " ))
183
185
end )
186
+
187
+ local maxKPCost = CraftSim .DB .OPTIONS :Get (" CRAFTQUEUE_QUEUE_PATRON_ORDERS_KP_MAX_COST" )
188
+
184
189
-- TODO: Public Orders
185
190
local workOrderTypes = {
186
191
CraftSim .DB .OPTIONS :Get (" CRAFTQUEUE_WORK_ORDERS_INCLUDE_PATRON_ORDERS" ) and Enum .CraftingOrderType .Npc ,
@@ -325,16 +330,22 @@ function CraftSim.CRAFTQ:QueueWorkOrders()
325
330
recipeData :SetCheapestQualityReagentsMax () -- considers patron reagents
326
331
recipeData :Update ()
327
332
328
- if isPatronOrder and knowledgePointsRewarded > 0 and recipeData .averageProfitCached < 0 then
329
- local maxKPCost = CraftSim .DB .OPTIONS :Get (
330
- " CRAFTQUEUE_QUEUE_PATRON_ORDERS_KP_MAX_COST" )
331
- local kpCost = math.abs (recipeData .averageProfitCached /
332
- knowledgePointsRewarded )
333
+ print (" - Knowledge Points Rewarded: " .. tostring (knowledgePointsRewarded ))
333
334
334
- if kpCost >= maxKPCost then
335
- distributor :Continue ()
336
- return
335
+
336
+ local function withinKPCost (averageProfit )
337
+ if isPatronOrder and knowledgePointsRewarded > 0 and averageProfit < 0 then
338
+
339
+ local kpCost = math.abs (averageProfit / knowledgePointsRewarded )
340
+
341
+ print (" - kpCost: " .. GUTIL :FormatMoney (kpCost , true , nil , true ))
342
+
343
+ if kpCost >= maxKPCost then
344
+ return false
345
+ end
346
+ return true
337
347
end
348
+ return true
338
349
end
339
350
340
351
local function queueRecipe ()
@@ -343,16 +354,23 @@ function CraftSim.CRAFTQ:QueueWorkOrders()
343
354
local forceConcentration = CraftSim .DB .OPTIONS :Get (
344
355
" CRAFTQUEUE_WORK_ORDERS_FORCE_CONCENTRATION" )
345
356
-- check if the min quality is reached, if not do not queue
357
+ local queueAble = false
346
358
if recipeData .resultData .expectedQuality >= order .minQuality then
347
- CraftSim . CRAFTQ : AddRecipe { recipeData = recipeData }
359
+ queueAble = true
348
360
end
349
361
350
362
if (forceConcentration or allowConcentration ) and
351
363
recipeData .resultData .expectedQualityConcentration == order .minQuality then
352
364
-- use concentration to reach and then queue
353
365
recipeData .concentrating = true
354
366
recipeData :Update ()
355
- CraftSim .CRAFTQ :AddRecipe { recipeData = recipeData }
367
+ queueAble = true
368
+ end
369
+
370
+ if queueAble then
371
+ if withinKPCost (recipeData .averageProfitCached ) then
372
+ CraftSim .CRAFTQ :AddRecipe { recipeData = recipeData }
373
+ end
356
374
end
357
375
358
376
distributor :Continue ()
0 commit comments