-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Breakables.lua
1887 lines (1668 loc) · 52.9 KB
/
Breakables.lua
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
local L = LibStub("AceLocale-3.0"):GetLocale("Breakables", false)
Breakables = LibStub("AceAddon-3.0"):NewAddon("Breakables", "AceConsole-3.0", "AceEvent-3.0")
local babbleInv = LibStub("LibBabble-Inventory-3.0"):GetLookupTable()
local LBF = LibStub("Masque", true)
local lbfGroup
local IsArtifactRelicItem, GetBagName, GetContainerNumSlots, GetContainerItemInfo, GetContainerItemLink =
IsArtifactRelicItem, GetBagName, GetContainerNumSlots, GetContainerItemInfo, GetContainerItemLink
if not IsArtifactRelicItem then
IsArtifactRelicItem = function()
return false
end
end
if C_Container then
if C_Container.GetBagName then
GetBagName = C_Container.GetBagName
end
if C_Container.GetContainerNumSlots then
GetContainerNumSlots = C_Container.GetContainerNumSlots
end
if C_Container.GetContainerItemInfo then
GetContainerItemInfo = function(bagId, slotId)
local info = C_Container.GetContainerItemInfo(bagId, slotId)
if not info then
return nil
end
return info.iconFileID, info.stackCount
end
end
if C_Container.GetContainerItemLink then
GetContainerItemLink = C_Container.GetContainerItemLink
end
end
local GetSpellInfo = GetSpellInfo
if not GetSpellInfo and C_Spell and C_Spell.GetSpellInfo then
GetSpellInfo = function(id)
if not id then
return nil
end
local info = C_Spell.GetSpellInfo(id)
if info then
return info.name, nil, info.iconID
end
end
end
local IsUsableSpell = IsUsableSpell
if not IsUsableSpell and C_Spell and C_Spell.IsSpellUsable then
IsUsableSpell = C_Spell.IsSpellUsable
end
local EQUIPPED_LAST = EQUIPPED_LAST
if not EQUIPPED_LAST then
EQUIPPED_LAST = INVSLOT_LAST_EQUIPPED
end
local WowVer = select(4, GetBuildInfo())
local IsClassic = false
local IsClassicBC = false
local IsClassicWrath = false
local IsClassicCataclysm = false
if GetClassicExpansionLevel then
IsClassic = GetClassicExpansionLevel() == 0
IsClassicBC = GetClassicExpansionLevel() == 1
IsClassicWrath = GetClassicExpansionLevel() == 2
IsClassicCataclysm = GetClassicExpansionLevel() == 3
else
IsClassic = WOW_PROJECT_ID and WOW_PROJECT_ID == WOW_PROJECT_CLASSIC
IsClassicBC = false
IsClassicWrath = false
IsClassicCataclysm = false
if WOW_PROJECT_ID and WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC then
if not LE_EXPANSION_LEVEL_CURRENT or LE_EXPANSION_LEVEL_CURRENT == LE_EXPANSION_BURNING_CRUSADE then
IsClassicBC = true
elseif LE_EXPANSION_LEVEL_CURRENT == LE_EXPANSION_WRATH_OF_THE_LICH_KING then
IsClassicWrath = true
end
elseif WOW_PROJECT_WRATH_CLASSIC and WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC then
IsClassicWrath = true
elseif WOW_PROJECT_CATACLYSM_CLASSIC and WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC then
IsClassicCataclysm = true
end
end
local ShouldHookTradeskillUpdate = WowVer < 80000
local ShouldShowTabardControls = WowVer >= 80000
local UseNonNativeEqManagerChecks = WowVer < 80000
local IgnoreEnchantingSkillLevelForDisenchant = WowVer >= 80000
local MillingId = 51005
local MillingItemSubType = babbleInv["Herb"]
local MillingItemSecondarySubType = babbleInv["Other"]
local CanMill = false
local AdditionalMillableItems = {
-- WoD herbs
109124,
109125,
109126,
109127,
109128,
109129,
-- Legion herbs
124101,
124102,
124103,
124104,
124105,
124106,
128304,
151565,
-- BfA herbs
152505,
152506,
152507,
152508,
152509,
152510,
152511,
168487,
-- Shadowlands herbs
168586, -- rising glory
168589, -- marrowroot
170554, -- vigil's torch
168583, -- widowbloom
169701, -- death blossom
171315, -- nightshade
187699, -- first flower, 9.2.0
}
local AdditionalProspectableItems = {
-- Legion ore
123918,
123919,
151564,
-- BfA ore
152512,
152513,
152579,
168185,
-- Shadowlands ore
171828, -- laestrite
171833, -- elethium
171829, -- solenium
171830, -- oxxein
171831, -- phaedrum
171832, -- sinvyr
187700, -- progenium ore, 9.2.0
}
local MassMilling = {
-- wod
[109124] = 190381,
[109125] = 190382,
[109126] = 190383,
[109127] = 190384,
[109128] = 190385,
[109129] = 190386,
-- legion
[124101] = 209658,
[124102] = 209659,
[124103] = 209660,
[124104] = 209661,
[124105] = 209662,
[124106] = 209664,
[128304] = 210116,
[151565] = 247861,
-- shadowlands
[168586] = 311417,
[168589] = 311416,
[170554] = 311414,
[168583] = 311415,
[169701] = 311413,
[171315] = 311418,
[187699] = 359490,
}
local HerbCombineItems = {
-- MoP
97619, -- torn green tea leaf
97620, -- rain poppy petal
97621, -- silkweed stem
97622, -- snow lily petal
97623, -- fool's cap spores
97624, -- desecrated herb pod
-- WoD
109624, -- broken frostweed stem
109625, -- broken fireweed stem
109626, -- gorgrond flytrap ichor
109627, -- starflower petal
109628, -- nagrand arrowbloom petal
109629, -- talador orchid petal
-- shadowlands
169550, -- rising glory petal
168591, -- marrowroot petal
169699, -- vigil's torch petal
169698, -- widowbloom petal
169700, -- death blossom petal
169697, -- nightshade petal
}
local UnProspectableItems = {
109119, -- WoD True Iron Ore
}
local ProspectingId = 31252
local ProspectingItemSubType = babbleInv["Metal & Stone"]
local CanProspect = false
local OreCombineItems = {
-- MoP
97512, -- ghost iron nugget
97546, -- kyparite fragment
90407, -- sparkling shard
-- WoD
109991, -- true iron nugget
109992, -- blackrock fragment
}
local DisenchantId = 13262
local DisenchantTypes = {babbleInv["Armor"], babbleInv["Weapon"]}
local DisenchantEquipSlots = {"INVTYPE_PROFESSION_GEAR", "INVTYPE_PROFESSION_TOOL"}
local CanDisenchant = false
local EnchantingProfessionId = 333
local AdditionalDisenchantableItems = {
137195, -- highmountain armor
-- dragonflight
-- specialization items (Mystics)
200939, -- Chromatic Pocketwatch
200940, -- Everflowing Inkwell
200941, -- Seal of Order
200942, -- Vibrant Emulsion
200943, -- Whispering Band
200945, -- Valiant Hammer
200946, -- Thunderous Blade
200947, -- Carving of Awakening
}
local PickLockId = 1804
local PickableItems = {
16882, -- battered junkbox
16883, -- worn junkbox
16884, -- sturdy junkbox
16885, -- heavy junkbox
29569, -- strong junkbox
43575, -- reinforced junkbox
63349, -- flame-scarred junkbox
88165, -- vine-cracked junkbox
106895, -- iron-bound junkbox
4632, -- ornate bronze lockbox
4633, -- heavy bronze lockbox
4634, -- iron lockbox
4636, -- strong iron lockbox
4637, -- steel lockbox
4638, -- reinforced steel lockbox
5758, -- mithril lockbox
5759, -- throium lockbox
5760, -- eternium lockbox
31952, -- khorium lockbox
43622, -- froststeel lockbox
43624, -- titanium lockbox
45986, -- tiny titanium lockbox
68729, -- elementium lockbox
88567, -- ghost iron lockbox
116920, -- true steel lockbox
121331, -- leystone lockbox
169475, -- barnacled lockbox
-- shadowlands
179311, -- venthyr
180532, -- maldraxxi
180533, -- kyrian
180522, -- night fae
186161, -- stygian lockbox, 9.1.0
-- dragonflight
190954, -- serevite lockbox
}
local CanPickLock = false
-- item rarity must meet or surpass this to be considered for disenchantability (is that a word?)
local RARITY_UNCOMMON = 2
local RARITY_RARE = 3
local RARITY_EPIC = 4
local RARITY_HEIRLOOM = 7
local IDX_LINK = 1
local IDX_COUNT = 2
local IDX_TYPE = 3
local IDX_TEXTURE = 4
local IDX_BAG = 5
local IDX_SLOT = 6
local IDX_SUBTYPE = 7
local IDX_LEVEL = 8
local IDX_BREAKABLETYPE = 9
local IDX_SOULBOUND = 10
local IDX_NAME = 11
local IDX_RARITY = 12
local IDX_EQUIPSLOT = 13
local BREAKABLE_HERB = 1
local BREAKABLE_ORE = 2
local BREAKABLE_DE = 3
local BREAKABLE_PICK = 4
local BREAKABLE_COMBINE = 5
local BagUpdateCheckDelay = 0.1
local PickLockFinishedDelay = 1
local nextCheck = {}
for i=0,NUM_BAG_SLOTS do
nextCheck[i] = -1
end
local buttonSize = 45
local _G = _G
local validGrowDirections = {L["Left"], L["Right"], L["Up"], L["Down"]}
-- can be 1, 2, or 3 (in the case of a rogue with pick lock)
local numEligibleProfessions = 0
local showingTooltip = nil
Breakables.optionsFrame = {}
Breakables.justClicked = false
Breakables.justClickedBag = -1
Breakables.justClickedSlot = -1
Breakables.justPickedBag = -1
Breakables.justPickedSlot = -1
function Breakables:OnInitialize()
self.defaults = {
profile = {
buttonFrameLeft = {100, 100},
buttonFrameTop = {700, 650},
hideIfNoBreakables = true,
maxBreakablesToShow = 5,
showSoulbound = false,
hideEqManagerItems = true,
hide = false,
hideInCombat = false,
hideInPetBattle = true,
buttonScale = 1,
fontSize = 11,
growDirection = 2,
ignoreList = {},
showTooltipForBreakables = true,
showTooltipForProfession = true,
}
}
self.db = LibStub("AceDB-3.0"):New("BreakablesDB", self.defaults, true)
self.settings = self.db.profile
self:RegisterChatCommand("brk", "OnSlashCommand")
if type(self.settings.buttonFrameLeft) ~= "table" then
local old = self.settings.buttonFrameLeft
self.settings.buttonFrameLeft = {}
self.settings.buttonFrameLeft[1] = old
self.settings.buttonFrameLeft[2] = self.defaults.profile.buttonFrameLeft[2]
end
if type(self.settings.buttonFrameTop) ~= "table" then
local old = self.settings.buttonFrameTop
self.settings.buttonFrameTop = {}
self.settings.buttonFrameTop[1] = old
self.settings.buttonFrameTop[2] = self.defaults.profile.buttonFrameTop[2]
end
self:InitLDB()
end
function Breakables:ButtonFacadeCallback(Group, SkinID, Gloss, Backdrop, Colors, Disabled)
if not Group then
self.settings.SkinID = SkinID
self.settings.Gloss = Gloss
self.settings.Backdrop = Backdrop
self.settings.Colors = Colors
end
end
function Breakables:InitLDB()
local LDB = LibStub and LibStub("LibDataBroker-1.1", true)
if (LDB) then
local ldbButton = LDB:NewDataObject("Breakables", {
type = "launcher",
text = L["Breakables"],
icon = "Interface\\Icons\\ability_warrior_sunder",
OnClick = function(button, msg)
self:OnSlashCommand()
end,
})
if ldbButton then
function ldbButton:OnTooltipShow()
self:AddLine(L["Breakables"] .. " @project-version@")
self:AddLine(L["Click to open Breakables options."], 1, 1, 1)
end
end
end
end
function Breakables:SetCapabilities()
CanMill = IsUsableSpell(GetSpellInfo(MillingId))
CanProspect = IsUsableSpell(GetSpellInfo(ProspectingId))
CanDisenchant = IsUsableSpell(GetSpellInfo(DisenchantId))
CanPickLock = IsUsableSpell(GetSpellInfo(PickLockId))
end
function Breakables:OnSpellsChanged()
local couldMill = CanMill
local couldProspect = CanProspect
local couldDisenchant = CanDisenchant
local couldPick = CanPickLock
self:SetCapabilities()
if couldMill ~= CanMill or couldProspect ~= CanProspect or couldDisenchant ~= CanDisenchant or couldPick ~= CanPickLock then
self:SetupButtons()
end
end
function Breakables:OnEnable()
self:SetCapabilities()
self.EnchantingLevel = 0
LibStub("AceConfig-3.0"):RegisterOptionsTable("Breakables", self:GetOptions(), "breakables")
self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Breakables")
if LBF then
LBF:Register("Breakables", self.ButtonFacadeCallback, self)
lbfGroup = LBF:Group("Breakables")
if lbfGroup then
lbfGroup:ReSkin()
end
end
self:RegisterEvents()
self:SetupButtons()
end
local canBreakSomething = function()
return CanMill or CanProspect or CanDisenchant or CanPickLock
end
function Breakables:SetupButtons()
numEligibleProfessions = 0
if canBreakSomething() then
if CanMill then
numEligibleProfessions = numEligibleProfessions + 1
end
if CanProspect then
numEligibleProfessions = numEligibleProfessions + 1
end
if CanDisenchant then
numEligibleProfessions = numEligibleProfessions + 1
self:GetEnchantingLevel()
end
if CanPickLock then
numEligibleProfessions = numEligibleProfessions + 1
end
self:CreateButtonFrame()
if self.settings.hide then
self:ToggleButtonFrameVisibility(false)
else
self:FindBreakables()
end
if not self.frame.OnUpdateFunc then
self.frame.OnUpdateFunc = function() self:CheckShouldFindBreakables() end
end
self.frame:SetScript("OnUpdate", self.frame.OnUpdateFunc)
else
self:CreateButtonFrame()
end
end
function Breakables:ToggleButtonFrameVisibility(show)
for i=1,numEligibleProfessions do
if self.buttonFrame[i] then
if show == nil then
show = not self.buttonFrame[i]:IsVisible()
end
if not show then
self.buttonFrame[i]:Hide()
else
self.buttonFrame[i]:Show()
end
end
end
end
function Breakables:RegisterEvents()
-- would have used ITEM_PUSH here, but that seems to fire after looting and before the bag actually gets the item
-- another alternative is to parse the chat msg, but that seems lame...however, that should only fire once as opposed to BAG_UPDATE's potential double-fire
self:RegisterEvent("BAG_UPDATE", "OnItemReceived")
self:RegisterEvent("PLAYER_REGEN_DISABLED", "OnEnterCombat")
self:RegisterEvent("PLAYER_REGEN_ENABLED", "OnLeaveCombat")
self:RegisterEvent("SPELLS_CHANGED", "OnSpellsChanged")
-- this will show lockboxes if the player gains a level that then enables opening that box
self:RegisterEvent("PLAYER_LEVEL_UP", "FindBreakables")
if ShouldHookTradeskillUpdate then
self:RegisterEvent("TRADE_SKILL_UPDATE", "OnTradeSkillUpdate")
end
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED", "OnSpellCastSucceeded")
if UnitCanPetBattle then
self:RegisterEvent("PET_BATTLE_OPENING_START", "PetBattleStarted")
self:RegisterEvent("PET_BATTLE_OVER", "PetBattleEnded")
end
end
function Breakables:OnDisable()
self:UnregisterAllEvents()
self.frame:SetScript("OnUpdate", nil)
end
function Breakables:OnSlashCommand(input)
if InterfaceOptionsFrame_OpenToCategory then
InterfaceOptionsFrame_OpenToCategory(self.optionsFrame)
else
Settings.OpenToCategory("Breakables")
end
end
function Breakables:OnItemReceived(event, bag)
if self.justClicked then
self:FindBreakables()
self.justClicked = false
self:OnLeaveProfessionButton()
elseif not bag or bag >= 0 then
nextCheck[bag] = GetTime() + BagUpdateCheckDelay
end
end
local STATE_IDLE, STATE_SCANNING = 0, 1
local currState = STATE_IDLE
function Breakables:CheckShouldFindBreakables()
if currState == STATE_SCANNING then
self:FindBreakables()
return
end
local latestTime = -1
for i=0,#nextCheck do
if nextCheck[i] and nextCheck[i] > latestTime then
latestTime = nextCheck[i]
end
end
if latestTime > 0 and latestTime <= GetTime() then
for i=0,#nextCheck do
nextCheck[i] = -1
end
self:FindBreakables()
end
end
function Breakables:OnEnterCombat()
self.bCombat = true
if self.settings.hideInCombat then
self:ToggleButtonFrameVisibility(false)
end
end
function Breakables:OnLeaveCombat()
self.bCombat = false
if self.bPendingUpdate or self.settings.hideInCombat then
self.bPendingUpdate = false
self:FindBreakables()
end
end
function Breakables:OnTradeSkillUpdate()
if not CanDisenchant then
return
end
self:GetEnchantingLevel()
self:FindBreakables()
end
function Breakables:OnSpellCastSucceeded(evt, unit, guid, spell)
if spell ~= PickLockId or not CanPickLock then
return
end
self.justPickedBag = self.justClickedBag
self.justPickedSlot = self.justClickedSlot
self:FindBreakables()
nextCheck[0] = GetTime() + PickLockFinishedDelay
end
function Breakables:PetBattleStarted()
if self.settings.hideInPetBattle then
self:ToggleButtonFrameVisibility(false)
end
end
function Breakables:PetBattleEnded()
self:ToggleButtonFrameVisibility(true)
end
function Breakables:FindLevelOfProfessionIndex(idx)
if idx ~= nil then
local name, texture, rank, maxRank, numSpells, spelloffset, skillLine = GetProfessionInfo(idx)
return skillLine, rank
end
end
function Breakables:GetEnchantingLevel()
if GetProfessions then
local prof1, prof2 = GetProfessions()
local skillId, rank = self:FindLevelOfProfessionIndex(prof1)
if skillId ~= nil and skillId == EnchantingProfessionId then
self.EnchantingLevel = rank
else
skillId, rank = self:FindLevelOfProfessionIndex(prof2)
if skillId ~= nil and skillId == EnchantingProfessionId then
self.EnchantingLevel = rank
end
end
elseif GetSkillLineInfo then
for i=1,100 do
local skillName, header, isExpanded, skillRank, numTempPoints, skillModifier, skillMaxRank, isAbandonable, stepCost, rankCost, minLevel, skillCostType = GetSkillLineInfo(i)
if skillName == babbleInv["Enchanting"] then
self.EnchantingLevel = skillRank
break
end
end
end
end
local function GetIgnoreListOptions()
local ret = {}
for k,v in pairs(Breakables.settings.ignoreList) do
local name, _, _, _, _, _, _, _, _, texture = GetItemInfo(k)
if texture ~= nil and name ~= nil then
ret[k] = ("|T%s:0|t %s"):format(texture, name)
end
end
return ret
end
local function IsIgnoringAnything()
for k,v in pairs(Breakables.settings.ignoreList) do
if v ~= nil then
return true
end
end
return false
end
function Breakables:GetOptions()
local opts = {
name = L["Breakables"],
handler = Breakables,
type = "group",
args = {
intro = {
type = "description",
fontSize = "small",
name = L["Welcome"],
order = 0,
},
mainSettings = {
name = L["Settings"],
type = "group",
order = 1,
args = {
hideAlways = {
type = "toggle",
name = L["Hide bar"],
desc = L["This will completely hide the breakables bar whether you have anything to break down or not. Note that you can toggle this in a macro using the /breakables command as well."],
get = function(info)
return self.settings.hide
end,
set = function(info, v)
self.settings.hide = v
if info.uiType == "cmd" then
print("|cff33ff99Breakables|r: set |cffffff78hideAlways|r to " .. tostring(self.settings.hide))
end
self:ToggleButtonFrameVisibility(not v)
if not v then
self:FindBreakables()
end
end,
order = 1
},
hideNoBreakables = {
type = "toggle",
name = L["Hide if no breakables"],
desc = L["Whether or not to hide the action bar if no breakables are present in your bags"],
get = function(info)
return self.settings.hideIfNoBreakables
end,
set = function(info, v)
self.settings.hideIfNoBreakables = v
if info.uiType == "cmd" then
print("|cff33ff99Breakables|r: set |cffffff78hideNoBreakables|r to " .. tostring(self.settings.hideIfNoBreakables))
end
self:FindBreakables()
end,
order = 2,
},
hideInCombat = {
type = "toggle",
name = L["Hide during combat"],
desc = L["Whether or not to hide the breakables bar when you enter combat and show it again when leaving combat."],
get = function(info)
return self.settings.hideInCombat
end,
set = function(info, v)
self.settings.hideInCombat = v
if info.uiType == "cmd" then
print("|cff33ff99Breakables|r: set |cffffff78hideInCombat|r to " .. tostring(self.settings.hideInCombat))
end
end,
order = 3,
},
maxBreakables = {
type = 'range',
name = L["Max number to display"],
desc = L["How many breakable buttons to display next to the profession button at maximum"],
min = 1,
max = 50,
step = 1,
get = function(info)
return self.settings.maxBreakablesToShow
end,
set = function(info, v)
self.settings.maxBreakablesToShow = v
if info.uiType == "cmd" then
print("|cff33ff99Breakables|r: set |cffffff78maxBreakables|r to " .. tostring(self.settings.maxBreakablesToShow))
end
self:FindBreakables()
end,
order = 4,
},
buttonScale = {
type = 'range',
name = L["Button scale"],
desc = L["This will scale the size of each button up or down."],
min = 0.1,
max = 2,
step = 0.01,
get = function(info)
return self.settings.buttonScale
end,
set = function(info, v)
self.settings.buttonScale = v
Breakables:ApplyScale()
if info.uiType == "cmd" then
print("|cff33ff99Breakables|r: set |cffffff78buttonScale|r to " .. tostring(self.settings.buttonScale))
end
end,
order = 5,
},
fontSize = {
type = 'range',
name = L["Font size"],
desc = L["This sets the size of the text that shows how many items you have to break."],
min = 4,
max = 90,
step = 1,
get = function(info)
return self.settings.fontSize
end,
set = function(info, v)
self.settings.fontSize = v
Breakables:ApplyScale()
if info.uiType == "cmd" then
print("|cff33ff99Breakables|r: set |cffffff78fontSize|r to " .. tostring(self.settings.fontSize))
end
end,
order = 6,
},
growDirection = {
type = 'select',
name = L["Button grow direction"],
desc = L["This controls which direction the breakable buttons grow toward."],
values = validGrowDirections,
get = function()
return self.settings.growDirection
end,
set = function(info, v)
self.settings.growDirection = v
self:FindBreakables()
if info.uiType == "cmd" then
print("|cff33ff99Breakables|r: set |cffffff78growDirection|r to " .. tostring(self.settings.growDirection))
end
end,
order = 7,
},
showTooltipForBreakables = {
type = "toggle",
name = L["Show tooltip on breakables"],
desc = L["Whether or not to show an item tooltip when hovering over a breakable item button."],
get = function(info)
return self.settings.showTooltipForBreakables
end,
set = function(info, v)
self.settings.showTooltipForBreakables = v
if info.uiType == "cmd" then
print("|cff33ff99Breakables|r: set |cffffff78showTooltipForBreakables|r to " .. tostring(self.settings.showTooltipForBreakables))
end
end,
order = 8,
},
showTooltipForProfession = {
type = "toggle",
name = L["Show tooltip on profession"],
desc = L["Whether or not to show an item tooltip when hovering over a profession button on the Breakables bar."],
get = function(info)
return self.settings.showTooltipForProfession
end,
set = function(info, v)
self.settings.showTooltipForProfession = v
if info.uiType == "cmd" then
print("|cff33ff99Breakables|r: set |cffffff78showTooltipForProfession|r to " .. tostring(self.settings.showTooltipForProfession))
end
end,
order = 9,
},
showNonUnlockableItems = {
type = 'toggle',
name = L['Show high-level lockboxes'],
desc = L['If checked, a lockbox that is too high level for the player to pick will still be shown in the list, otherwise it will be hidden.'],
get = function(info)
return self.settings.showNonUnlockableItems
end,
set = function(info, v)
self.settings.showNonUnlockableItems = v
self:FindBreakables()
if info.uiType == "cmd" then
print("|cff33ff99Breakables|r: set |cffffff78showNonUnlockableItems|r to " .. tostring(self.settings.showNonUnlockableItems))
end
end,
hidden = function()
return not CanPickLock or not C_TooltipInfo
end,
order = 10,
},
ignoreList = {
type = 'multiselect',
name = L["Ignore list"],
desc = L["Items that have been right-clicked to exclude from the breakable list. Un-check the box to remove the item from the ignore list."],
get = function(info, key)
return true
end,
set = function(info, key)
Breakables.settings.ignoreList[key] = nil
Breakables:FindBreakables()
end,
confirm = function()
return L["Are you sure you want to remove this item from the ignore list?"]
end,
values = GetIgnoreListOptions,
hidden = function() return not IsIgnoringAnything() end,
order = 30,
},
clearIgnoreList = {
type = 'execute',
func = function()
for k,v in pairs(Breakables.settings.ignoreList) do
Breakables.settings.ignoreList[k] = nil
end
Breakables:FindBreakables()
end,
name = L["Clear ignore list"],
confirm = function()
return L["Are you sure you want to clear the ignore list?"]
end,
hidden = function() return not IsIgnoringAnything() end,
order = 31,
},
showSoulbound = {
type = "toggle",
name = L["Show soulbound items"],
desc = L["Whether or not to display soulbound items as breakables."],
get = function(info)
return self.settings.showSoulbound
end,
set = function(info, v)
self.settings.showSoulbound = v
if info.uiType == "cmd" then
print("|cff33ff99Breakables|r: set |cffffff78showSoulbound|r to " .. tostring(self.settings.showSoulbound))
end
self:FindBreakables()
end,
hidden = function()
return not CanDisenchant
end,
order = 20,
},
},
},
reset = {
name = L["Reset"],
type = "group",
order = 2,
args = {
resetPlacement = {
type = "execute",
name = L["Reset placement"],
desc = L["Resets where the buttons are placed on the screen to the default location."],
func = function(info)
self.settings.buttonFrameLeft = self.defaults.profile.buttonFrameLeft
self.settings.buttonFrameTop = self.defaults.profile.buttonFrameTop
self:CreateButtonFrame()
if info.uiType == "cmd" then
print("|cff33ff99Breakables|r: reset placement of button")
end
end,
order = 30,
},
},
},
},
}
if GetNumEquipmentSets or C_EquipmentSet then
opts.args.mainSettings.args.hideEqManagerItems = {
type = "toggle",
name = L["Hide Eq. Mgr items"],
desc = L["Whether or not to hide items that are part of an equipment set in the game's equipment manager."],
get = function(info)
return self.settings.hideEqManagerItems
end,
set = function(info, v)
self.settings.hideEqManagerItems = v
if info.uiType == "cmd" then
print("|cff33ff99Breakables|r: set |cffffff78hideEqManagerItems|r to " .. tostring(self.settings.hideEqManagerItems))
end
self:FindBreakables()
end,
hidden = function()
return not CanDisenchant and not self.settings.showSoulbound
end,
order = 21,
}
end
if ShouldShowTabardControls then
opts.args.mainSettings.args.hideTabards = {
type = "toggle",
name = L["Hide Tabards"],
desc = L["Whether or not to hide tabards from the disenchantable items list."],
get = function(info)
return self.settings.hideTabards
end,
set = function(info, v)
self.settings.hideTabards = v
if info.uiType == "cmd" then
print("|cff33ff99Breakables|r: set |cffffff78hideTabards|r to " .. tostring(self.settings.hideTabards))
end
self:FindBreakables()
end,
order = 22,
}
end
if not IgnoreEnchantingSkillLevelForDisenchant then
opts.args.mainSettings.args.ignoreEnchantingSkillLevel = {
type = "toggle",
name = L["Ignore Enchanting skill level"],
desc = L["Whether or not items should be shown when Breakables thinks you don't have the appropriate skill level to disenchant it."],
get = function(info)
return self.settings.ignoreEnchantingSkillLevel
end,
set = function(info, v)
self.settings.ignoreEnchantingSkillLevel = v
self:FindBreakables()
if info.uiType == "cmd" then
print("|cff33ff99Breakables|r: set |cffffff78ignoreEnchantingSkillLevel|r to " .. tostring(self.settings.ignoreEnchantingSkillLevel))
end
end,
order = 10,
}
end
if UnitCanPetBattle then
opts.args.mainSettings.args.hideInPetBattle = {