-
Notifications
You must be signed in to change notification settings - Fork 399
Expand file tree
/
Copy pathCompareTab.lua
More file actions
4895 lines (4401 loc) · 192 KB
/
Copy pathCompareTab.lua
File metadata and controls
4895 lines (4401 loc) · 192 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- Path of Building
--
-- Module: Compare Tab
-- Manages build comparison state and renders the comparison screen.
--
local t_insert = table.insert
local t_remove = table.remove
local m_min = math.min
local m_max = math.max
local m_floor = math.floor
local s_format = string.format
local dkjson = require "dkjson"
local tradeHelpers = LoadModule("Classes/TradeHelpers")
local buySimilar = LoadModule("Classes/CompareBuySimilar")
local calcsHelpers = LoadModule("Classes/CompareCalcsHelpers")
local buildListHelpers = LoadModule("Modules/BuildListHelpers")
-- Node IDs below this value are normal passive tree nodes; IDs at or above are cluster jewel nodes
local CLUSTER_NODE_OFFSET = 65536
-- Wrap a string into lines for a given pixel width at font height 14 ("VAR").
local function wrapInfoLine(str, width)
local lines = {}
if not str or str == "" or type(width) ~= "number" or width <= 0 then
return lines
end
local lineStart = 1
local lineEnd = 0
for wordStart, wordEnd in str:gmatch("()%S+()") do
local candidate = str:sub(lineStart, wordEnd - 1)
if lineEnd >= lineStart and DrawStringWidth(14, "VAR", candidate) > width then
t_insert(lines, str:sub(lineStart, lineEnd))
lineStart = wordStart
end
lineEnd = wordEnd - 1
end
if lineEnd >= lineStart then
t_insert(lines, str:sub(lineStart, lineEnd))
end
return lines
end
-- Layout constants (shared across Draw, DrawConfig, DrawItems, DrawCalcs, etc.)
local LAYOUT = {
-- Main tab control bar
controlBarHeight = 126,
-- Tree view header/footer
treeHeaderHeight = 74,
treeFooterHeight = 30,
treeOverlayCheckX = 155,
-- Summary view columns
summaryCol1 = 10,
summaryCol2Right = 440,
summaryCol3Right = 580,
summaryCol4 = 600,
summaryHeaderHeight = 38,
-- Items view
itemsCheckboxOffset = 78,
itemsCopyBtnW = 60,
itemsEquipBtnW = 60,
itemsCopyBtnH = 18,
itemsBuyBtnW = 60,
itemsHScrollBarHeight = 16,
compareColGap = 48,
skillsHeaderHeight = 24,
skillsHScrollBarHeight = 16,
-- Calcs view
calcsMaxCardWidth = 400,
calcsLabelWidth = 132,
calcsSepW = 2,
calcsHeaderBarHeight = 12,
-- Power report section (inside Summary view)
powerReportLeft = 10,
-- Config view (shared between Draw() layout and DrawConfig())
configRowHeight = 22,
configColumnHeaderHeight = 20,
configFixedHeaderHeight = 92,
configSectionWidth = 560,
configSectionGap = 18,
configSectionInnerPad = 20,
configLabelOffset = 10,
configCol2 = 234,
configCol3 = 400,
}
-- Flag matching for stat filtering
local function matchFlags(reqFlags, notFlags, flags)
if type(reqFlags) == "string" then
reqFlags = { reqFlags }
end
if reqFlags then
for _, flag in ipairs(reqFlags) do
if not flags[flag] then
return
end
end
end
if type(notFlags) == "string" then
notFlags = { notFlags }
end
if notFlags then
for _, flag in ipairs(notFlags) do
if flags[flag] then
return
end
end
end
return true
end
local CompareTabClass = newClass("CompareTab", "ControlHost", "Control", function(self, primaryBuild)
self.ControlHost()
self.Control()
self.primaryBuild = primaryBuild
-- Comparison entries (indexed 1..N for future 3+ build support)
self.compareEntries = {}
self.activeCompareIndex = 0
-- Sub-view mode
self.compareViewMode = "SUMMARY"
-- Scroll offset for scrollable views
self.scrollY = 0
-- Tree layout cache (set in Draw, used by DrawTree)
self.treeLayout = nil
-- Track when tree search fields need syncing with viewer state
self.treeSearchNeedsSync = true
-- Tree overlay mode (false = side-by-side, true = overlay with green/red/blue nodes)
self.treeOverlayMode = true
-- Tooltip for item hover in Items view
self.itemTooltip = new("Tooltip")
-- Items expanded mode (false = compact names only, true = full item details inline)
self.itemsExpandedMode = false
-- Tooltip for calcs hover breakdown
self.calcsTooltip = new("Tooltip")
self.calcsShowOnlyDifferences = true
-- Interactive config controls state
self.configControls = {} -- { var -> { control, varData } }
self.configControlList = {} -- ordered list for layout
self.configNeedsRebuild = true -- trigger initial build
self.configCompareId = nil -- track which compare entry controls were built for
self.configToggle = false -- show all / hide ineligible toggle
self.configSections = {} -- section groups from ConfigOptions
self.configSectionLayout = {} -- computed section layout for drawing
self.configTotalContentHeight = 0
-- Compare power report state
self.comparePowerStat = nil -- selected data.powerStatList entry
self.comparePowerCategories = { treeNodes = true, items = true, skillGems = true, supportGems = true, config = true }
self.comparePowerResults = nil -- sorted list of result entries
self.comparePowerCoroutine = nil -- active coroutine
self.comparePowerProgress = 0 -- 0-100
self.comparePowerDirty = false -- flag to restart calculation
self.comparePowerCompareId = nil -- track which compare entry was calculated
-- Pre-load static module data
self.configOptions = LoadModule("Modules/ConfigOptions")
self.calcSections = LoadModule("Modules/CalcSections")
self.calcs = LoadModule("Modules/Calcs")
-- Controls for the comparison screen
self:InitControls()
end)
function CompareTabClass:InitControls()
-- Sub-tab buttons
local subTabs = { "Summary", "Tree", "Skills", "Items", "Calcs", "Config" }
local subTabModes = { "SUMMARY", "TREE", "SKILLS", "ITEMS", "CALCS", "CONFIG" }
self.controls.subTabAnchor = new("Control", nil, {0, 0, 0, 20})
for i, tabName in ipairs(subTabs) do
local mode = subTabModes[i]
local prevName = i > 1 and ("subTab" .. subTabs[i-1]) or "subTabAnchor"
local anchor = i == 1
and {"TOPLEFT", self.controls.subTabAnchor, "TOPLEFT"}
or {"LEFT", self.controls[prevName], "RIGHT"}
self.controls["subTab" .. tabName] = new("ButtonControl", anchor, {i == 1 and 0 or 4, 0, 72, 20}, tabName, function()
-- Clear tree overlay compareSpec when leaving TREE mode
if self.compareViewMode == "TREE" and self.treeOverlayMode
and self.primaryBuild.treeTab and self.primaryBuild.treeTab.viewer then
self.primaryBuild.treeTab.viewer.compareSpec = nil
end
self.compareViewMode = mode
self.scrollY = 0
if mode == "TREE" then
self.treeSearchNeedsSync = true
end
end)
self.controls["subTab" .. tabName].shown = function()
return #self.compareEntries > 0
end
self.controls["subTab" .. tabName].locked = function()
return self.compareViewMode == mode
end
end
-- Build B selector dropdown
self.controls.compareBuildLabel = new("LabelControl", {"TOPLEFT", self.controls.subTabAnchor, "TOPLEFT"}, {0, -88, 0, 16}, "^7Compare with:")
self.controls.compareBuildSelect = new("DropDownControl", {"LEFT", self.controls.compareBuildLabel, "RIGHT"}, {4, 0, 250, 20}, {}, function(index, value)
if index and index > 0 and index <= #self.compareEntries then
self.activeCompareIndex = index
self.treeSearchNeedsSync = true
end
end)
self.controls.compareBuildSelect.enabled = function()
return #self.compareEntries > 0
end
-- Import button (opens import popup)
self.controls.importBtn = new("ButtonControl", {"LEFT", self.controls.compareBuildSelect, "RIGHT"}, {8, 0, 100, 20}, "Import...", function()
self:OpenImportPopup()
end)
-- Re-import current build button
self.controls.reimportBtn = new("ButtonControl", {"LEFT", self.controls.importBtn, "RIGHT"}, {4, 0, 140, 20}, "Re-import Current", function()
self:ReimportPrimary()
end)
self.controls.reimportBtn.tooltipFunc = function(tooltip)
tooltip:Clear()
local importTab = self.primaryBuild.importTab
if importTab and importTab.charImportMode == "SELECTCHAR" then
local charSelect = importTab.controls.charSelect
local charData = charSelect and charSelect.list and charSelect.list[charSelect.selIndex]
if charData and charData.char then
tooltip:AddLine(16, "Re-import character from the game server:")
tooltip:AddLine(14, "^7" .. charData.char.name .. " (" .. charData.char.class .. ", " .. charData.char.league .. ")")
else
tooltip:AddLine(16, "Re-import the currently selected character.")
end
tooltip:AddLine(14, "^7Refreshes passive tree, jewels, items, and skills.")
else
tooltip:AddLine(16, "^7No character selected.")
tooltip:AddLine(14, "^7Go to Import/Export Build tab and select a character first.")
end
end
self.controls.reimportBtn.enabled = function()
local importTab = self.primaryBuild.importTab
return importTab and importTab.charImportMode == "SELECTCHAR"
end
-- Remove comparison build button
self.controls.removeBtn = new("ButtonControl", {"LEFT", self.controls.reimportBtn, "RIGHT"}, {4, 0, 70, 20}, "Remove", function()
if self.activeCompareIndex > 0 and self.activeCompareIndex <= #self.compareEntries then
self:RemoveBuild(self.activeCompareIndex)
end
end)
self.controls.removeBtn.enabled = function()
return #self.compareEntries > 0
end
-- ============================================================
-- Comparison build set selectors (row between build selector and sub-tabs)
-- ============================================================
local setsEnabled = function()
return #self.compareEntries > 0
end
-- Tree spec selector for comparison build
self.controls.compareSpecLabel = new("LabelControl", {"TOPLEFT", self.controls.subTabAnchor, "TOPLEFT"}, {0, -54, 0, 16}, "^7Tree set:")
self.controls.compareSpecLabel.shown = setsEnabled
self.controls.compareSpecSelect = new("DropDownControl", {"LEFT", self.controls.compareSpecLabel, "RIGHT"}, {2, 0, 150, 20}, {}, function(index, value)
local entry = self:GetActiveCompare()
if entry and entry.treeTab and entry.treeTab.specList[index] then
entry:SetActiveSpec(index)
-- Restore primary build's window title (SetActiveSpec changes it)
if self.primaryBuild.spec then
self.primaryBuild.spec:SetWindowTitleWithBuildClass()
end
end
end)
self.controls.compareSpecSelect.enabled = setsEnabled
self.controls.compareSpecSelect.maxDroppedWidth = 500
self.controls.compareSpecSelect.enableDroppedWidth = true
-- Skill set selector for comparison build
self.controls.compareSkillSetLabel = new("LabelControl", {"LEFT", self.controls.compareSpecSelect, "RIGHT"}, {8, 0, 0, 16}, "^7Skill set:")
self.controls.compareSkillSetLabel.shown = setsEnabled
self.controls.compareSkillSetSelect = new("DropDownControl", {"LEFT", self.controls.compareSkillSetLabel, "RIGHT"}, {2, 0, 150, 20}, {}, function(index, value)
local entry = self:GetActiveCompare()
if entry and entry.skillsTab and entry.skillsTab.skillSetOrderList[index] then
entry:SetActiveSkillSet(entry.skillsTab.skillSetOrderList[index])
end
end)
self.controls.compareSkillSetSelect.enabled = setsEnabled
-- Item set selector for comparison build
self.controls.compareItemSetLabel = new("LabelControl", {"LEFT", self.controls.compareSkillSetSelect, "RIGHT"}, {8, 0, 0, 16}, "^7Item set:")
self.controls.compareItemSetLabel.shown = setsEnabled
self.controls.compareItemSetSelect = new("DropDownControl", {"LEFT", self.controls.compareItemSetLabel, "RIGHT"}, {2, 0, 150, 20}, {}, function(index, value)
local entry = self:GetActiveCompare()
if entry and entry.itemsTab and entry.itemsTab.itemSetOrderList[index] then
entry:SetActiveItemSet(entry.itemsTab.itemSetOrderList[index])
end
end)
self.controls.compareItemSetSelect.enabled = setsEnabled
-- Config set selector for comparison build
self.controls.compareConfigSetLabel = new("LabelControl", {"LEFT", self.controls.compareItemSetSelect, "RIGHT"}, {8, 0, 0, 16}, "^7Config set:")
self.controls.compareConfigSetLabel.shown = setsEnabled
self.controls.compareConfigSetSelect = new("DropDownControl", {"LEFT", self.controls.compareConfigSetLabel, "RIGHT"}, {2, 0, 150, 20}, {}, function(index, value)
local entry = self:GetActiveCompare()
if entry and entry.configTab then
local setId = entry.configTab.configSetOrderList[index]
if setId then
entry.configTab:SetActiveConfigSet(setId)
entry.buildFlag = true
self.configNeedsRebuild = true
end
end
end)
self.controls.compareConfigSetSelect.enabled = setsEnabled
self.controls.compareConfigSetSelect.enableDroppedWidth = true
-- ============================================================
-- Comparison build main skill selector (row between sets and sub-tabs)
-- ============================================================
self.controls.cmpSkillLabel = new("LabelControl", {"TOPLEFT", self.controls.subTabAnchor, "TOPLEFT"}, {0, -32, 0, 16}, "^7Skill:")
self.controls.cmpSkillLabel.shown = setsEnabled
-- Socket group dropdown
self.controls.cmpSocketGroup = new("DropDownControl", {"LEFT", self.controls.cmpSkillLabel, "RIGHT"}, {4, 0, 200, 20}, {}, function(index, value)
local entry = self:GetActiveCompare()
if entry then
entry:SetMainSocketGroup(index)
end
end)
self.controls.cmpSocketGroup.shown = setsEnabled
self.controls.cmpSocketGroup.maxDroppedWidth = 500
self.controls.cmpSocketGroup.enableDroppedWidth = true
-- Active skill within group
self.controls.cmpMainSkill = new("DropDownControl", {"LEFT", self.controls.cmpSocketGroup, "RIGHT"}, {4, 0, 225, 20}, {}, function(index, value)
local entry = self:GetActiveCompare()
if entry then
local mainSocketGroup = entry.skillsTab.socketGroupList[entry.mainSocketGroup]
if mainSocketGroup then
mainSocketGroup.mainActiveSkill = index
entry.buildFlag = true
end
end
end)
self.controls.cmpMainSkill.shown = false
self.controls.cmpStatSet = new("DropDownControl", {"LEFT", self.controls.cmpMainSkill, "RIGHT"}, {2, 0, 150, 20}, {}, function(index, value)
local entry = self:GetActiveCompare()
local mainSocketGroup = entry.skillsTab.socketGroupList[entry.mainSocketGroup]
if mainSocketGroup then
local srcInstance = mainSocketGroup.displaySkillList[mainSocketGroup.mainActiveSkill].activeEffect.srcInstance
srcInstance.statSet = srcInstance.statSet or { }
srcInstance.statSet[value.grantedEffectId] = index
entry.buildFlag = true
end
end)
self.controls.cmpStatSet.shown = false
-- Skill part (multi-part skills)
self.controls.cmpSkillPart = new("DropDownControl", {"LEFT", self.controls.cmpStatSet, "RIGHT"}, {4, 0, 200, 20}, {}, function(index, value)
local entry = self:GetActiveCompare()
if entry then
local mainSocketGroup = entry.skillsTab.socketGroupList[entry.mainSocketGroup]
if mainSocketGroup then
local displaySkillList = mainSocketGroup.displaySkillList
local activeSkill = displaySkillList and displaySkillList[mainSocketGroup.mainActiveSkill or 1]
if activeSkill and activeSkill.activeEffect then
activeSkill.activeEffect.srcInstance.skillPart = index
entry.buildFlag = true
end
end
end
end)
self.controls.cmpSkillPart.shown = false
-- Stage count
self.controls.cmpStageCountLabel = new("LabelControl", {"LEFT", self.controls.cmpSkillPart, "RIGHT"}, {6, 0, 0, 16}, "^7Stages:")
self.controls.cmpStageCountLabel.shown = function() return self.controls.cmpStageCount.shown end
self.controls.cmpStageCount = new("EditControl", {"LEFT", self.controls.cmpStageCountLabel, "RIGHT"}, {4, 0, 52, 20}, "", nil, "%D", 5, function(buf)
local entry = self:GetActiveCompare()
if entry then
local mainSocketGroup = entry.skillsTab.socketGroupList[entry.mainSocketGroup]
if mainSocketGroup then
local displaySkillList = mainSocketGroup.displaySkillList
local activeSkill = displaySkillList and displaySkillList[mainSocketGroup.mainActiveSkill or 1]
if activeSkill and activeSkill.activeEffect then
activeSkill.activeEffect.srcInstance.skillStageCount = tonumber(buf)
entry.buildFlag = true
end
end
end
end)
self.controls.cmpStageCount.shown = false
-- Mine count
self.controls.cmpMineCountLabel = new("LabelControl", {"LEFT", self.controls.cmpStageCount, "RIGHT"}, {6, 0, 0, 16}, "^7Mines:")
self.controls.cmpMineCountLabel.shown = function() return self.controls.cmpMineCount.shown end
self.controls.cmpMineCount = new("EditControl", {"LEFT", self.controls.cmpMineCountLabel, "RIGHT"}, {4, 0, 52, 20}, "", nil, "%D", 5, function(buf)
local entry = self:GetActiveCompare()
if entry then
local mainSocketGroup = entry.skillsTab.socketGroupList[entry.mainSocketGroup]
if mainSocketGroup then
local displaySkillList = mainSocketGroup.displaySkillList
local activeSkill = displaySkillList and displaySkillList[mainSocketGroup.mainActiveSkill or 1]
if activeSkill and activeSkill.activeEffect then
activeSkill.activeEffect.srcInstance.skillMineCount = tonumber(buf)
entry.buildFlag = true
end
end
end
end)
self.controls.cmpMineCount.shown = false
-- Minion selector
self.controls.cmpMinion = new("DropDownControl", {"LEFT", self.controls.cmpMineCount, "RIGHT"}, {6, 0, 140, 20}, {}, function(index, value)
local entry = self:GetActiveCompare()
if entry then
local mainSocketGroup = entry.skillsTab.socketGroupList[entry.mainSocketGroup]
if mainSocketGroup then
local displaySkillList = mainSocketGroup.displaySkillList
local activeSkill = displaySkillList and displaySkillList[mainSocketGroup.mainActiveSkill or 1]
if activeSkill and activeSkill.activeEffect then
local selected = self.controls.cmpMinion.list[index]
if selected then
if selected.itemSetId then
activeSkill.activeEffect.srcInstance.skillMinionItemSet = selected.itemSetId
elseif selected.minionId then
activeSkill.activeEffect.srcInstance.skillMinion = selected.minionId
end
entry.buildFlag = true
end
end
end
end
end)
self.controls.cmpMinion.shown = false
-- Minion skill selector
self.controls.cmpMinionSkill = new("DropDownControl", {"LEFT", self.controls.cmpMinion, "RIGHT"}, {4, 0, 140, 20}, {}, function(index, value)
local entry = self:GetActiveCompare()
if entry then
local mainSocketGroup = entry.skillsTab.socketGroupList[entry.mainSocketGroup]
if mainSocketGroup then
local displaySkillList = mainSocketGroup.displaySkillList
local activeSkill = displaySkillList and displaySkillList[mainSocketGroup.mainActiveSkill or 1]
if activeSkill and activeSkill.activeEffect then
activeSkill.activeEffect.srcInstance.skillMinionSkill = index
entry.buildFlag = true
end
end
end
end)
self.controls.cmpMinionSkill.shown = false
-- Minion skill stat set selector
self.controls.cmpMinionSkillStatSet = new("DropDownControl", {"LEFT", self.controls.cmpMinionSkill, "RIGHT"}, {2, 0, 140, 20}, {}, function(index, value)
local entry = self:GetActiveCompare()
local mainSocketGroup = entry.skillsTab.socketGroupList[entry.mainSocketGroup]
if mainSocketGroup then
local srcInstance = mainSocketGroup.displaySkillList[mainSocketGroup.mainActiveSkill].activeEffect.srcInstance
srcInstance.skillMinionSkillStatSetIndexLookup = srcInstance.skillMinionSkillStatSetIndexLookup or { }
srcInstance.skillMinionSkillStatSetIndexLookup[value.grantedEffectId] = srcInstance.skillMinionSkillStatSetIndexLookup[value.grantedEffectId] or { }
srcInstance.skillMinionSkillStatSetIndexLookup[value.grantedEffectId][srcInstance.skillMinionSkill] = index
entry.buildFlag = true
end
end)
self.controls.cmpMinionSkillStatSet.shown = false
-- ============================================================
-- Calcs view skill detail controls (per-build, independent of sidebar & regular Calcs tab)
-- ============================================================
local calcsBuffModeDropList = {
{ label = "Unbuffed", buffMode = "UNBUFFED" },
{ label = "Buffed", buffMode = "BUFFED" },
{ label = "In Combat", buffMode = "COMBAT" },
{ label = "Effective DPS", buffMode = "EFFECTIVE" },
}
-- Primary build calcs skill controls
self.controls.primCalcsSocketGroup = new("DropDownControl", nil, {0, 0, 200, 18}, {}, function(index, value)
self.primaryBuild.calcsTab.input.skill_number = index
self.primaryBuild.buildFlag = true
end)
self.controls.primCalcsSocketGroup.shown = false
self.controls.primCalcsSocketGroup.maxDroppedWidth = 400
self.controls.primCalcsSocketGroup.enableDroppedWidth = true
self.controls.primCalcsMainSkill = new("DropDownControl", nil, {0, 0, 200, 18}, {}, function(index, value)
local mainSocketGroup = self.primaryBuild.skillsTab.socketGroupList[self.primaryBuild.calcsTab.input.skill_number]
if mainSocketGroup then
mainSocketGroup.mainActiveSkillCalcs = index
self.primaryBuild.buildFlag = true
end
end)
self.controls.primCalcsMainSkill.shown = false
self.controls.primCalcsSkillPart = new("DropDownControl", nil, {0, 0, 150, 18}, {}, function(index, value)
local mainSocketGroup = self.primaryBuild.skillsTab.socketGroupList[self.primaryBuild.calcsTab.input.skill_number]
if mainSocketGroup then
local displaySkillList = mainSocketGroup.displaySkillListCalcs
local activeSkill = displaySkillList and displaySkillList[mainSocketGroup.mainActiveSkillCalcs or 1]
if activeSkill and activeSkill.activeEffect then
activeSkill.activeEffect.srcInstance.skillPartCalcs = index
self.primaryBuild.buildFlag = true
end
end
end)
self.controls.primCalcsSkillPart.shown = false
self.controls.primCalcsStageCount = new("EditControl", nil, {0, 0, 52, 18}, "", nil, "%D", 5, function(buf)
local mainSocketGroup = self.primaryBuild.skillsTab.socketGroupList[self.primaryBuild.calcsTab.input.skill_number]
if mainSocketGroup then
local displaySkillList = mainSocketGroup.displaySkillListCalcs
local activeSkill = displaySkillList and displaySkillList[mainSocketGroup.mainActiveSkillCalcs or 1]
if activeSkill and activeSkill.activeEffect then
activeSkill.activeEffect.srcInstance.skillStageCountCalcs = tonumber(buf)
self.primaryBuild.buildFlag = true
end
end
end)
self.controls.primCalcsStageCount.shown = false
self.controls.primCalcsMineCount = new("EditControl", nil, {0, 0, 52, 18}, "", nil, "%D", 5, function(buf)
local mainSocketGroup = self.primaryBuild.skillsTab.socketGroupList[self.primaryBuild.calcsTab.input.skill_number]
if mainSocketGroup then
local displaySkillList = mainSocketGroup.displaySkillListCalcs
local activeSkill = displaySkillList and displaySkillList[mainSocketGroup.mainActiveSkillCalcs or 1]
if activeSkill and activeSkill.activeEffect then
activeSkill.activeEffect.srcInstance.skillMineCountCalcs = tonumber(buf)
self.primaryBuild.buildFlag = true
end
end
end)
self.controls.primCalcsMineCount.shown = false
self.controls.primCalcsShowMinion = new("CheckBoxControl", nil, {0, 0, 18}, nil, function(state)
self.primaryBuild.calcsTab.input.showMinion = state
self.primaryBuild.buildFlag = true
end, "Show stats for the minion instead of the player.")
self.controls.primCalcsShowMinion.shown = false
self.controls.primCalcsMinion = new("DropDownControl", nil, {0, 0, 140, 18}, {}, function(index, value)
local mainSocketGroup = self.primaryBuild.skillsTab.socketGroupList[self.primaryBuild.calcsTab.input.skill_number]
if mainSocketGroup then
local displaySkillList = mainSocketGroup.displaySkillListCalcs
local activeSkill = displaySkillList and displaySkillList[mainSocketGroup.mainActiveSkillCalcs or 1]
if activeSkill and activeSkill.activeEffect then
local selected = self.controls.primCalcsMinion.list[index]
if selected then
if selected.itemSetId then
activeSkill.activeEffect.srcInstance.skillMinionItemSetCalcs = selected.itemSetId
elseif selected.minionId then
activeSkill.activeEffect.srcInstance.skillMinionCalcs = selected.minionId
end
self.primaryBuild.buildFlag = true
end
end
end
end)
self.controls.primCalcsMinion.shown = false
self.controls.primCalcsMinionSkill = new("DropDownControl", nil, {0, 0, 140, 18}, {}, function(index, value)
local mainSocketGroup = self.primaryBuild.skillsTab.socketGroupList[self.primaryBuild.calcsTab.input.skill_number]
if mainSocketGroup then
local displaySkillList = mainSocketGroup.displaySkillListCalcs
local activeSkill = displaySkillList and displaySkillList[mainSocketGroup.mainActiveSkillCalcs or 1]
if activeSkill and activeSkill.activeEffect then
activeSkill.activeEffect.srcInstance.skillMinionSkillCalcs = index
self.primaryBuild.buildFlag = true
end
end
end)
self.controls.primCalcsMinionSkill.shown = false
self.controls.primCalcsMinionSkillStatSet = new("DropDownControl", {"TOPLEFT",self.controls.mainSkillMinionSkill,"BOTTOMLEFT",true}, {0, 0, 150, 16}, nil, function(index, value)
local mainSocketGroup = self.primaryBuild.skillsTab.socketGroupList[self.primaryBuild.calcsTab.input.skill_number]
if mainSocketGroup then
local srcInstance = mainSocketGroup.displaySkillListCalcs[mainSocketGroup.mainActiveSkillCalcs].activeEffect.srcInstance
srcInstance.skillMinionSkillStatSetIndexLookupCalcs = srcInstance.skillMinionSkillStatSetIndexLookupCalcs or { }
srcInstance.skillMinionSkillStatSetIndexLookupCalcs[value.grantedEffectId] = srcInstance.skillMinionSkillStatSetIndexLookupCalcs[value.grantedEffectId] or { }
srcInstance.skillMinionSkillStatSetIndexLookupCalcs[value.grantedEffectId][srcInstance.skillMinionSkillCalcs] = index
self.primaryBuild.buildFlag = true
end
end)
self.controls.primCalcsMinionSkillStatSet.shown = false
self.controls.primCalcsStatSet = new("DropDownControl", nil, {0, 0, 200, 18}, nil, function(index, value)
local mainSocketGroup = self.primaryBuild.skillsTab.socketGroupList[self.primaryBuild.calcsTab.input.skill_number]
if mainSocketGroup then
local srcInstance = mainSocketGroup.displaySkillListCalcs[mainSocketGroup.mainActiveSkillCalcs].activeEffect.srcInstance
srcInstance.statSetCalcs = srcInstance.statSetCalcs or { }
srcInstance.statSetCalcs[value.grantedEffectId] = index
self.primaryBuild.buildFlag = true
end
end)
self.controls.primCalcsStatSet.shown = false
self.controls.primCalcsMode = new("DropDownControl", nil, {0, 0, 120, 18}, calcsBuffModeDropList, function(index, value)
self.primaryBuild.calcsTab.input.misc_buffMode = value.buffMode
self.primaryBuild.buildFlag = true
end)
self.controls.primCalcsMode.shown = false
-- Compare build calcs skill controls
self.controls.cmpCalcsSocketGroup = new("DropDownControl", nil, {0, 0, 200, 18}, {}, function(index, value)
local entry = self:GetActiveCompare()
if entry then
entry.calcsTab.input.skill_number = index
entry.buildFlag = true
end
end)
self.controls.cmpCalcsSocketGroup.shown = false
self.controls.cmpCalcsSocketGroup.maxDroppedWidth = 400
self.controls.cmpCalcsSocketGroup.enableDroppedWidth = true
self.controls.cmpCalcsMainSkill = new("DropDownControl", nil, {0, 0, 200, 18}, {}, function(index, value)
local entry = self:GetActiveCompare()
if entry then
local mainSocketGroup = entry.skillsTab.socketGroupList[entry.calcsTab.input.skill_number]
if mainSocketGroup then
mainSocketGroup.mainActiveSkillCalcs = index
entry.buildFlag = true
end
end
end)
self.controls.cmpCalcsMainSkill.shown = false
self.controls.cmpCalcsSkillPart = new("DropDownControl", nil, {0, 0, 150, 18}, {}, function(index, value)
local entry = self:GetActiveCompare()
if entry then
local mainSocketGroup = entry.skillsTab.socketGroupList[entry.calcsTab.input.skill_number]
if mainSocketGroup then
local displaySkillList = mainSocketGroup.displaySkillListCalcs
local activeSkill = displaySkillList and displaySkillList[mainSocketGroup.mainActiveSkillCalcs or 1]
if activeSkill and activeSkill.activeEffect then
activeSkill.activeEffect.srcInstance.skillPartCalcs = index
entry.buildFlag = true
end
end
end
end)
self.controls.cmpCalcsSkillPart.shown = false
self.controls.cmpCalcsStageCount = new("EditControl", nil, {0, 0, 52, 18}, "", nil, "%D", 5, function(buf)
local entry = self:GetActiveCompare()
if entry then
local mainSocketGroup = entry.skillsTab.socketGroupList[entry.calcsTab.input.skill_number]
if mainSocketGroup then
local displaySkillList = mainSocketGroup.displaySkillListCalcs
local activeSkill = displaySkillList and displaySkillList[mainSocketGroup.mainActiveSkillCalcs or 1]
if activeSkill and activeSkill.activeEffect then
activeSkill.activeEffect.srcInstance.skillStageCountCalcs = tonumber(buf)
entry.buildFlag = true
end
end
end
end)
self.controls.cmpCalcsStageCount.shown = false
self.controls.cmpCalcsMineCount = new("EditControl", nil, {0, 0, 52, 18}, "", nil, "%D", 5, function(buf)
local entry = self:GetActiveCompare()
if entry then
local mainSocketGroup = entry.skillsTab.socketGroupList[entry.calcsTab.input.skill_number]
if mainSocketGroup then
local displaySkillList = mainSocketGroup.displaySkillListCalcs
local activeSkill = displaySkillList and displaySkillList[mainSocketGroup.mainActiveSkillCalcs or 1]
if activeSkill and activeSkill.activeEffect then
activeSkill.activeEffect.srcInstance.skillMineCountCalcs = tonumber(buf)
entry.buildFlag = true
end
end
end
end)
self.controls.cmpCalcsMineCount.shown = false
self.controls.cmpCalcsShowMinion = new("CheckBoxControl", nil, {0, 0, 18}, nil, function(state)
local entry = self:GetActiveCompare()
if entry then
entry.calcsTab.input.showMinion = state
entry.buildFlag = true
end
end, "Show stats for the minion instead of the player.")
self.controls.cmpCalcsShowMinion.shown = false
self.controls.cmpCalcsMinion = new("DropDownControl", nil, {0, 0, 140, 18}, {}, function(index, value)
local entry = self:GetActiveCompare()
if entry then
local mainSocketGroup = entry.skillsTab.socketGroupList[entry.calcsTab.input.skill_number]
if mainSocketGroup then
local displaySkillList = mainSocketGroup.displaySkillListCalcs
local activeSkill = displaySkillList and displaySkillList[mainSocketGroup.mainActiveSkillCalcs or 1]
if activeSkill and activeSkill.activeEffect then
local selected = self.controls.cmpCalcsMinion.list[index]
if selected then
if selected.itemSetId then
activeSkill.activeEffect.srcInstance.skillMinionItemSetCalcs = selected.itemSetId
elseif selected.minionId then
activeSkill.activeEffect.srcInstance.skillMinionCalcs = selected.minionId
end
entry.buildFlag = true
end
end
end
end
end)
self.controls.cmpCalcsMinion.shown = false
self.controls.cmpCalcsMinionSkill = new("DropDownControl", nil, {0, 0, 140, 18}, {}, function(index, value)
local entry = self:GetActiveCompare()
if entry then
local mainSocketGroup = entry.skillsTab.socketGroupList[entry.calcsTab.input.skill_number]
if mainSocketGroup then
local displaySkillList = mainSocketGroup.displaySkillListCalcs
local activeSkill = displaySkillList and displaySkillList[mainSocketGroup.mainActiveSkillCalcs or 1]
if activeSkill and activeSkill.activeEffect then
activeSkill.activeEffect.srcInstance.skillMinionSkillCalcs = index
entry.buildFlag = true
end
end
end
end)
self.controls.cmpCalcsMinionSkill.shown = false
self.controls.cmpCalcsMinionSkillStatSet = new("DropDownControl", nil, {0, 0, 150, 16}, nil, function(index, value)
local entry = self:GetActiveCompare()
local mainSocketGroup = entry.skillsTab.socketGroupList[entry.calcsTab.input.skill_number]
if mainSocketGroup then
local srcInstance = mainSocketGroup.displaySkillListCalcs[mainSocketGroup.mainActiveSkillCalcs].activeEffect.srcInstance
srcInstance.skillMinionSkillStatSetIndexLookupCalcs = srcInstance.skillMinionSkillStatSetIndexLookupCalcs or { }
srcInstance.skillMinionSkillStatSetIndexLookupCalcs[value.grantedEffectId] = srcInstance.skillMinionSkillStatSetIndexLookupCalcs[value.grantedEffectId] or { }
srcInstance.skillMinionSkillStatSetIndexLookupCalcs[value.grantedEffectId][srcInstance.skillMinionSkillCalcs] = index
entry.buildFlag = true
end
end)
self.controls.cmpCalcsMinionSkillStatSet.shown = false
self.controls.cmpCalcsStatSet = new("DropDownControl", nil, {0, 0, 200, 18}, nil, function(index, value)
local entry = self:GetActiveCompare()
local mainSocketGroup = entry.skillsTab.socketGroupList[entry.calcsTab.input.skill_number]
if mainSocketGroup then
local srcInstance = mainSocketGroup.displaySkillListCalcs[mainSocketGroup.mainActiveSkillCalcs].activeEffect.srcInstance
srcInstance.statSetCalcs = srcInstance.statSetCalcs or { }
srcInstance.statSetCalcs[value.grantedEffectId] = index
entry.buildFlag = true
end
end)
self.controls.cmpCalcsStatSet.shown = false
self.controls.cmpCalcsMode = new("DropDownControl", nil, {0, 0, 120, 18}, calcsBuffModeDropList, function(index, value)
local entry = self:GetActiveCompare()
if entry then
entry.calcsTab.input.misc_buffMode = value.buffMode
entry.buildFlag = true
end
end)
self.controls.cmpCalcsMode.shown = false
self.controls.calcsShowOnlyDifferencesCheck = new("CheckBoxControl", nil, {0, 0, 18}, "Show only differences", function(state)
self.calcsShowOnlyDifferences = state
end, "Show only rows that differ between both builds. Disable to include unchanged rows.")
self.controls.calcsShowOnlyDifferencesCheck.shown = function()
return self.compareViewMode == "CALCS" and self:GetActiveCompare() ~= nil
end
-- ============================================================
-- Tree footer controls (visible only in TREE view mode with a comparison loaded)
-- ============================================================
local treeFooterShown = function()
return self.compareViewMode == "TREE" and self:GetActiveCompare() ~= nil
end
local treeSideBySideShown = function()
return self.compareViewMode == "TREE" and self:GetActiveCompare() ~= nil and not self.treeOverlayMode
end
-- Build version dropdown list (shared between left and right)
self.treeVersionDropdownList = {}
for _, num in ipairs(treeVersionList) do
t_insert(self.treeVersionDropdownList, {
label = treeVersions[num].display,
value = num
})
end
-- Overlay toggle checkbox
self.controls.treeOverlayCheck = new("CheckBoxControl", nil, {0, 0, 20}, "Overlay comparison", function(state)
self.treeOverlayMode = state
self.treeSearchNeedsSync = true
if not state and self.primaryBuild.treeTab and self.primaryBuild.treeTab.viewer then
self.primaryBuild.treeTab.viewer.compareSpec = nil
end
end, nil, true)
self.controls.treeOverlayCheck.shown = treeFooterShown
-- Overlay-mode search (single search for primary viewer)
self.controls.overlayTreeSearch = new("EditControl", nil, {0, 0, 300, 20}, "", "Search", "%c", 100, function(buf)
if self.primaryBuild.treeTab and self.primaryBuild.treeTab.viewer then
self.primaryBuild.treeTab.viewer.searchStr = buf
end
end, nil, nil, true)
self.controls.overlayTreeSearch.shown = function()
return self.compareViewMode == "TREE" and self:GetActiveCompare() ~= nil and self.treeOverlayMode
end
-- Items expanded mode toggle
self.controls.itemsExpandedCheck = new("CheckBoxControl", nil, {0, 0, 20}, "Expanded mode", function(state)
self.itemsExpandedMode = state
self.scrollY = 0
end)
self.controls.itemsExpandedCheck.shown = function()
return self.compareViewMode == "ITEMS" and self:GetActiveCompare() ~= nil
end
-- Item set dropdown for primary build
local itemsShown = function()
return self.compareViewMode == "ITEMS" and self:GetActiveCompare() ~= nil
end
self.controls.primaryItemSetLabel = new("LabelControl", nil, {0, 0, 0, 16}, "^7Item set:")
self.controls.primaryItemSetLabel.shown = itemsShown
self.controls.primaryItemSetSelect = new("DropDownControl", nil, {0, 0, 216, 20}, {}, function(index, value)
if self.primaryBuild.itemsTab and self.primaryBuild.itemsTab.itemSetOrderList[index] then
self.primaryBuild.itemsTab:SetActiveItemSet(self.primaryBuild.itemsTab.itemSetOrderList[index])
self.primaryBuild.itemsTab:AddUndoState()
end
end)
self.controls.primaryItemSetSelect.enabled = itemsShown
self.controls.primaryItemSetSelect.shown = itemsShown
-- Item set dropdown for compare build
self.controls.compareItemSetLabel2 = new("LabelControl", nil, {0, 0, 0, 16}, "^7Item set:")
self.controls.compareItemSetLabel2.shown = itemsShown
self.controls.compareItemSetSelect2 = new("DropDownControl", nil, {0, 0, 216, 20}, {}, function(index, value)
local entry = self:GetActiveCompare()
if entry and entry.itemsTab and entry.itemsTab.itemSetOrderList[index] then
entry:SetActiveItemSet(entry.itemsTab.itemSetOrderList[index])
end
end)
self.controls.compareItemSetSelect2.enabled = itemsShown
self.controls.compareItemSetSelect2.shown = itemsShown
-- Tree set dropdown for primary build
self.controls.primaryTreeSetLabel = new("LabelControl", nil, {0, 0, 0, 16}, "^7Tree set:")
self.controls.primaryTreeSetLabel.shown = itemsShown
self.controls.primaryTreeSetSelect = new("DropDownControl", nil, {0, 0, 216, 20}, {}, function(index, value)
if self.primaryBuild.treeTab and self.primaryBuild.treeTab.specList[index] then
self.primaryBuild.modFlag = true
self.primaryBuild.treeTab:SetActiveSpec(index)
end
end)
self.controls.primaryTreeSetSelect.enabled = itemsShown
self.controls.primaryTreeSetSelect.shown = itemsShown
self.controls.primaryTreeSetSelect.maxDroppedWidth = 500
self.controls.primaryTreeSetSelect.enableDroppedWidth = true
-- Tree set dropdown for compare build
self.controls.compareTreeSetLabel = new("LabelControl", nil, {0, 0, 0, 16}, "^7Tree set:")
self.controls.compareTreeSetLabel.shown = itemsShown
self.controls.compareTreeSetSelect = new("DropDownControl", nil, {0, 0, 216, 20}, {}, function(index, value)
local entry = self:GetActiveCompare()
if entry and entry.treeTab and entry.treeTab.specList[index] then
entry:SetActiveSpec(index)
if self.primaryBuild.spec then
self.primaryBuild.spec:SetWindowTitleWithBuildClass()
end
end
end)
self.controls.compareTreeSetSelect.enabled = itemsShown
self.controls.compareTreeSetSelect.shown = itemsShown
self.controls.compareTreeSetSelect.maxDroppedWidth = 500
self.controls.compareTreeSetSelect.enableDroppedWidth = true
-- Footer anchor controls (side-by-side only)
self.controls.leftFooterAnchor = new("Control", nil, {0, 0, 0, 20})
self.controls.leftFooterAnchor.shown = treeSideBySideShown
self.controls.rightFooterAnchor = new("Control", nil, {0, 0, 0, 20})
self.controls.rightFooterAnchor.shown = treeSideBySideShown
-- Left side (primary build) spec/version controls (header, both modes)
self.controls.leftSpecSelect = new("DropDownControl", nil, {0, 0, 180, 20}, {}, function(index, value)
if self.primaryBuild.treeTab and self.primaryBuild.treeTab.specList[index] then
self.primaryBuild.modFlag = true
self.primaryBuild.treeTab:SetActiveSpec(index)
end
end)
self.controls.leftSpecSelect.shown = treeFooterShown
self.controls.leftSpecSelect.maxDroppedWidth = 500
self.controls.leftSpecSelect.enableDroppedWidth = true
self.controls.leftVersionSelect = new("DropDownControl", {"LEFT", self.controls.leftSpecSelect, "RIGHT"}, {4, 0, 100, 20}, self.treeVersionDropdownList, function(index, selected)
if selected and selected.value and self.primaryBuild.spec and selected.value ~= self.primaryBuild.spec.treeVersion then
self.primaryBuild.treeTab:OpenVersionConvertPopup(selected.value, true)
end
end)
self.controls.leftVersionSelect.shown = treeFooterShown
-- Left search (footer, side-by-side only)
self.controls.leftTreeSearch = new("EditControl", {"TOPLEFT", self.controls.leftFooterAnchor, "TOPLEFT"}, {0, 0, 200, 20}, "", "Search", "%c", 100, function(buf)
if self.primaryBuild.treeTab and self.primaryBuild.treeTab.viewer then
self.primaryBuild.treeTab.viewer.searchStr = buf
end
end, nil, nil, true)
self.controls.leftTreeSearch.shown = treeSideBySideShown
-- Right side (compare build) spec/version controls (header, both modes)
self.controls.rightSpecSelect = new("DropDownControl", nil, {0, 0, 180, 20}, {}, function(index, value)
local entry = self:GetActiveCompare()
if entry and entry.treeTab and entry.treeTab.specList[index] then
entry:SetActiveSpec(index)
-- Restore primary build's window title (compare entry's SetActiveSpec changes it)
if self.primaryBuild.spec then
self.primaryBuild.spec:SetWindowTitleWithBuildClass()
end
end
end)
self.controls.rightSpecSelect.shown = treeFooterShown
self.controls.rightSpecSelect.maxDroppedWidth = 500
self.controls.rightSpecSelect.enableDroppedWidth = true
self.controls.rightVersionSelect = new("DropDownControl", {"LEFT", self.controls.rightSpecSelect, "RIGHT"}, {4, 0, 100, 20}, self.treeVersionDropdownList, function(index, selected)
local entry = self:GetActiveCompare()
if entry and selected and selected.value and entry.spec then
if selected.value ~= entry.spec.treeVersion then
entry.treeTab:OpenVersionConvertPopup(selected.value, true)
end
end
end)
self.controls.rightVersionSelect.shown = treeFooterShown
-- Copy compared tree to primary build
self.controls.copySpecBtn = new("ButtonControl", {"LEFT", self.controls.rightVersionSelect, "RIGHT"}, {4, 0, 76, 20}, "Copy tree", function()
self:CopyCompareSpecToPrimary(false)
end)
self.controls.copySpecBtn.shown = treeFooterShown
self.controls.copySpecBtn.enabled = function()
local entry = self:GetActiveCompare()
return entry and entry.treeTab and entry.treeTab.specList[entry.treeTab.activeSpec] ~= nil
end
self.controls.copySpecUseBtn = new("ButtonControl", {"LEFT", self.controls.copySpecBtn, "RIGHT"}, {2, 0, 100, 20}, "Copy and use", function()
self:CopyCompareSpecToPrimary(true)
end)
self.controls.copySpecUseBtn.shown = treeFooterShown
self.controls.copySpecUseBtn.enabled = self.controls.copySpecBtn.enabled
-- Right search (footer, side-by-side only)
self.controls.rightTreeSearch = new("EditControl", {"TOPLEFT", self.controls.rightFooterAnchor, "TOPLEFT"}, {0, 0, 200, 20}, "", "Search", "%c", 100, function(buf)
local entry = self:GetActiveCompare()
if entry and entry.treeTab and entry.treeTab.viewer then
entry.treeTab.viewer.searchStr = buf
end
end, nil, nil, true)
self.controls.rightTreeSearch.shown = treeSideBySideShown
-- Config view: "Copy Config from Compare Build" button
self.controls.copyConfigBtn = new("ButtonControl", nil, {0, 0, 240, 20},
"Copy Config from Compare Build",
function() self:CopyCompareConfig() end)
self.controls.copyConfigBtn.shown = function()
return self.compareViewMode == "CONFIG" and self:GetActiveCompare() ~= nil
end
-- Config view: "Show All / Hide Ineligible" toggle button
self.controls.configToggleBtn = new("ButtonControl", nil, {0, 0, 240, 20},
function()
return self.configToggle and "Hide Ineligible Configurations" or "Show All Configurations"
end,
function()
self.configToggle = not self.configToggle
end)
self.controls.configToggleBtn.shown = function()
return self.compareViewMode == "CONFIG" and self:GetActiveCompare() ~= nil
end
-- Config view: search bar
self.controls.configSearchEdit = new("EditControl", nil, {0, 0, 240, 20}, "", "Search", "%c", 100, nil, nil, nil, true)
self.controls.configSearchEdit.shown = function()
return self.compareViewMode == "CONFIG" and self:GetActiveCompare() ~= nil
end
-- Config view: primary build config set dropdown
local configShown = function()
return self.compareViewMode == "CONFIG" and self:GetActiveCompare() ~= nil
end
self.controls.configPrimarySetLabel = new("LabelControl", nil, {0, 0, 0, 16}, "^7Config set:")
self.controls.configPrimarySetLabel.shown = configShown
self.controls.configPrimarySetSelect = new("DropDownControl", nil, {0, 0, 150, 20}, nil, function(index, value)
local configTab = self.primaryBuild.configTab
local setId = configTab.configSetOrderList[index]
if setId then
configTab:SetActiveConfigSet(setId)
self.configNeedsRebuild = true
end