@@ -184,7 +184,7 @@ function CraftSim.CRAFT_RESULTS.FRAMES:InitStatisticsTrackerTab(statisticsTracke
184
184
content .resultDistributionList = GGUI .FrameList {
185
185
anchorPoints = { { anchorParent = content , anchorA = " TOPLEFT" , anchorB = " TOPLEFT" , offsetX = 10 , offsetY = - 100 } },
186
186
parent = content ,
187
- sizeY = 250 ,
187
+ sizeY = 150 ,
188
188
showBorder = true ,
189
189
columnOptions = {
190
190
{
@@ -229,7 +229,7 @@ function CraftSim.CRAFT_RESULTS.FRAMES:InitStatisticsTrackerTab(statisticsTracke
229
229
content .multicraftStatisticsList = GGUI .FrameList {
230
230
anchorPoints = { { anchorParent = content .resultDistributionList .frame , anchorA = " TOPLEFT" , anchorB = " TOPRIGHT" , offsetX = 30 , } },
231
231
parent = content ,
232
- sizeY = 250 ,
232
+ sizeY = 150 ,
233
233
showBorder = true ,
234
234
columnOptions = {
235
235
{
@@ -267,7 +267,7 @@ function CraftSim.CRAFT_RESULTS.FRAMES:InitStatisticsTrackerTab(statisticsTracke
267
267
content .resourcefulnessStatisticsList = GGUI .FrameList {
268
268
anchorPoints = { { anchorParent = content .multicraftStatisticsList .frame , anchorA = " TOPLEFT" , anchorB = " TOPRIGHT" , offsetX = 30 , } },
269
269
parent = content ,
270
- sizeY = 250 ,
270
+ sizeY = 150 ,
271
271
showBorder = true ,
272
272
columnOptions = {
273
273
{
@@ -301,6 +301,55 @@ function CraftSim.CRAFT_RESULTS.FRAMES:InitStatisticsTrackerTab(statisticsTracke
301
301
anchorPoints = { { anchorParent = content .resourcefulnessStatisticsList .frame , anchorA = " BOTTOM" , anchorB = " TOP" , offsetY = 2 } },
302
302
text = " Resourcefulness"
303
303
}
304
+
305
+ content .yieldStatisticsList = GGUI .FrameList {
306
+ anchorPoints = { { anchorParent = content .multicraftStatisticsList .frame , anchorA = " TOP" , anchorB = " BOTTOM" , offsetY = - 20 , offsetX = - 5 } },
307
+ parent = content ,
308
+ sizeY = 160 ,
309
+ showBorder = true ,
310
+ columnOptions = {
311
+ {
312
+ width = 170 ,
313
+ },
314
+ {
315
+ width = 40 ,
316
+ },
317
+ {
318
+ width = 40 ,
319
+ }
320
+ },
321
+ selectionOptions = { noSelectionColor = true },
322
+ rowConstructor = function (columns , row )
323
+ --- @class CraftSim.CRAFT_RESULTS.STATISTICS_TRACKER_TAB.YIELD_STATISTICS_LIST.STATISTICS_COLUMN : Frame
324
+ local itemColumn = columns [1 ]
325
+ --- @class CraftSim.CRAFT_RESULTS.STATISTICS_TRACKER_TAB.YIELD_STATISTICS_LIST.YIELD_COLUMN : Frame
326
+ local yieldColumn = columns [2 ]
327
+ --- @class CraftSim.CRAFT_RESULTS.STATISTICS_TRACKER_TAB.YIELD_STATISTICS_LIST.DIST_COLUMN : Frame
328
+ local distColumn = columns [3 ]
329
+
330
+ itemColumn .text = GGUI .Text {
331
+ parent = itemColumn ,
332
+ anchorPoints = { { anchorParent = itemColumn , anchorA = " LEFT" , anchorB = " LEFT" , } },
333
+ justifyOptions = { type = " H" , align = " LEFT" }
334
+ }
335
+
336
+ yieldColumn .text = GGUI .Text {
337
+ parent = yieldColumn ,
338
+ anchorPoints = { { anchorParent = yieldColumn } },
339
+ }
340
+
341
+ distColumn .text = GGUI .Text {
342
+ parent = distColumn ,
343
+ anchorPoints = { { anchorParent = distColumn } },
344
+ }
345
+ end ,
346
+ }
347
+
348
+ GGUI .Text {
349
+ parent = content ,
350
+ anchorPoints = { { anchorParent = content .yieldStatisticsList .frame , anchorA = " BOTTOM" , anchorB = " TOP" , offsetY = 2 } },
351
+ text = " Yield Distribution"
352
+ }
304
353
end
305
354
306
355
function CraftSim .CRAFT_RESULTS .FRAMES :UpdateItemList ()
@@ -560,9 +609,8 @@ function CraftSim.CRAFT_RESULTS.FRAMES:UpdateRecipeData(recipeID)
560
609
.numMulticraft , 2 )
561
610
end
562
611
addStatistic (" Ø Additional Yield:" , additionalYield )
563
-
564
- multicraftStatisticsList :UpdateDisplay ()
565
612
end
613
+ multicraftStatisticsList :UpdateDisplay ()
566
614
end
567
615
568
616
-- Resourcefulness Statistics
@@ -587,9 +635,79 @@ function CraftSim.CRAFT_RESULTS.FRAMES:UpdateRecipeData(recipeID)
587
635
local distribution = GUTIL :Round (
588
636
(craftRecipeData .numResourcefulness / (craftRecipeData .numCrafts / 100 )) / 100 , 2 )
589
637
addStatistic (" Distribution:" , distribution )
638
+ end
639
+ resourcefulnessStatisticsList :UpdateDisplay ()
640
+ end
590
641
591
- resourcefulnessStatisticsList :UpdateDisplay ()
642
+ -- Yield Statistics
643
+ do
644
+ local yieldStatisticsList = statisticsTrackerTabContent .yieldStatisticsList
645
+ yieldStatisticsList :Remove ()
646
+
647
+ if craftRecipeData .numCrafts > 0 then
648
+ local yieldDistributionMap = {}
649
+ for _ , craftResult in pairs (craftRecipeData .craftResults ) do
650
+ local itemResultCountMap = {}
651
+ for _ , craftResultItem in pairs (craftResult .craftResultItems ) do
652
+ local itemLink = craftResultItem .item :GetItemLink ()
653
+ itemResultCountMap [itemLink ] = itemResultCountMap [itemLink ] or 0
654
+ itemResultCountMap [itemLink ] = itemResultCountMap [itemLink ] + craftResultItem .quantity +
655
+ craftResultItem .quantityMulticraft
656
+ end
657
+
658
+ for itemLink , count in pairs (itemResultCountMap ) do
659
+ yieldDistributionMap [itemLink ] = yieldDistributionMap [itemLink ] or {}
660
+ yieldDistributionMap [itemLink ].distributions = yieldDistributionMap [itemLink ].distributions or {}
661
+ yieldDistributionMap [itemLink ].totalDistributionCount = yieldDistributionMap [itemLink ]
662
+ .totalDistributionCount or 0
663
+
664
+ if not yieldDistributionMap [itemLink ].distributions [count ] then
665
+ yieldDistributionMap [itemLink ].distributions [count ] = 0
666
+ end
667
+
668
+ yieldDistributionMap [itemLink ].distributions [count ] = yieldDistributionMap [itemLink ]
669
+ .distributions [count ] + 1
670
+ yieldDistributionMap [itemLink ].totalDistributionCount = yieldDistributionMap [itemLink ]
671
+ .totalDistributionCount + 1
672
+ end
673
+ end
674
+
675
+ for itemLink , distributionData in pairs (yieldDistributionMap ) do
676
+ for yield , count in pairs (distributionData .distributions ) do
677
+ yieldStatisticsList :Add (function (row , columns )
678
+ --- @class CraftSim.CRAFT_RESULTS.STATISTICS_TRACKER_TAB.YIELD_STATISTICS_LIST.STATISTICS_COLUMN : Frame
679
+ local itemColumn = columns [1 ]
680
+ --- @class CraftSim.CRAFT_RESULTS.STATISTICS_TRACKER_TAB.YIELD_STATISTICS_LIST.YIELD_COLUMN : Frame
681
+ local yieldColumn = columns [2 ]
682
+ --- @class CraftSim.CRAFT_RESULTS.STATISTICS_TRACKER_TAB.YIELD_STATISTICS_LIST.DIST_COLUMN : Frame
683
+ local distColumn = columns [3 ]
684
+
685
+ itemColumn .text :SetText (itemLink )
686
+ local dist = GUTIL :Round (
687
+ (count / (distributionData .totalDistributionCount / 100 )) / 100 , 2 )
688
+ distColumn .text :SetText (dist )
689
+ yieldColumn .text :SetText (" x " .. yield )
690
+ row .yield = yield
691
+ row .itemLink = itemLink
692
+ row .tooltipOptions = {
693
+ itemID = GUTIL :GetItemIDByLink (itemLink ),
694
+ anchor = " ANCHOR_RIGHT" ,
695
+ owner = row .frameList .frame
696
+ }
697
+ end )
698
+ end
699
+ end
592
700
end
701
+
702
+ yieldStatisticsList :UpdateDisplay (function (rowA , rowB )
703
+ if rowA .itemLink > rowB .itemLink then
704
+ return true
705
+ elseif rowA .itemLink < rowB .itemLink then
706
+ return false
707
+ end
708
+
709
+ return rowA .yield > rowB .yield
710
+ end )
593
711
end
594
712
end
595
713
end
0 commit comments