-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcore.lua
1494 lines (1358 loc) · 52.4 KB
/
core.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 _, ImproveAny = ...
-- TAINTFREE SLASH COMMANDS --
local lastMessage = ""
local cmds = {}
if ChatEdit_ParseText then
hooksecurefunc(
"ChatEdit_ParseText",
function(editBox, send, parseIfNoSpace)
if send == 0 then
lastMessage = editBox:GetText()
end
end
)
else
ImproveAny:MSG("FAILED TO ADD SLASH HANDLE #1")
end
if ChatFrame_DisplayHelpTextSimple then
hooksecurefunc(
"ChatFrame_DisplayHelpTextSimple",
function(frame)
if lastMessage and lastMessage ~= "" then
local cmd = string.upper(lastMessage)
cmd = strsplit(" ", cmd)
if cmds[cmd] ~= nil then
local count = 1
local numMessages = frame:GetNumMessages()
local function predicateFunction(entry)
if count == numMessages and entry == HELP_TEXT_SIMPLE then return true end
count = count + 1
end
frame:RemoveMessagesByPredicate(predicateFunction)
cmds[cmd]()
end
end
end
)
else
ImproveAny:MSG("FAILED TO ADD SLASH HANDLE #2")
end
function ImproveAny:InitSlash()
cmds["/IMPROVE"] = ImproveAny.ToggleSettings
cmds["/IMPROVEANY"] = ImproveAny.ToggleSettings
if C_UI then
cmds["/RL"] = C_UI.Reload
cmds["/REL"] = C_UI.Reload
else
cmds["/RL"] = ReloadUi
cmds["/REL"] = ReloadUi
end
end
-- TAINTFREE SLASH COMMANDS --
IAHIDDEN = CreateFrame("FRAME", "IAHIDDEN")
IAHIDDEN:Hide()
local IAMaxZoom = 5
function ImproveAny:GetMaxZoom()
return IAMaxZoom
end
for i = 2.6, 5.0, 0.1 do
ConsoleExec("cameraDistanceMaxZoomFactor " .. i)
end
IAMaxZoom = tonumber(GetCVar("cameraDistanceMaxZoomFactor")) or 4
function ImproveAny:UpdateMaxZoom()
ConsoleExec("cameraDistanceMaxZoomFactor " .. ImproveAny:IAGV("MAXZOOM", ImproveAny:GetMaxZoom()))
end
function ImproveAny:UpdateWorldTextScale()
ConsoleExec("WorldTextScale " .. ImproveAny:IAGV("WORLDTEXTSCALE", 1.0))
end
function ImproveAny:CheckCVars()
if ImproveAny:IAGV("MAXZOOM", ImproveAny:GetMaxZoom()) ~= tonumber(GetCVar("cameraDistanceMaxZoomFactor")) then
ImproveAny:UpdateMaxZoom()
end
if ImproveAny:IAGV("WORLDTEXTSCALE", 1.0) ~= tonumber(GetCVar("WorldTextScale")) then
ImproveAny:UpdateWorldTextScale()
end
ImproveAny:Debug("CHECK CVARS", "retry")
C_Timer.After(5, ImproveAny.CheckCVars)
end
function ImproveAny:AddRightClick()
if not InCombatLockdown() then
local bars = {"MainMenuBarArtFrame", "MultiBarBottomLeft", "MultiBarBottomRight", "MultiBarRight", "MultiBarLeft", "PossessBarFrame", "MAActionBar1", "MAActionBar2", "MAActionBar3", "MAActionBar4", "MAActionBar5", "MAActionBar6", "MAActionBar7", "MAActionBar8", "MAActionBar9", "MAActionBar10"}
for i, v in ipairs(bars) do
local bar = _G[v]
if bar ~= nil then
bar:SetAttribute("unit2", "player")
end
end
else
ImproveAny:Debug("AdddRightClick")
C_Timer.After(0.1, ImproveAny.AddRightClick)
end
end
function ImproveAny:IsOnActionbar(spellID)
for i = 1, 120 do
local actionType, id, _ = GetActionInfo(i)
if actionType == "macro" then
id = GetMacroSpell(id)
end
if id == spellID then return true end
end
if GetShapeshiftFormInfo then
for i = 1, 10 do
local _, _, _, id = GetShapeshiftFormInfo(i)
if id == spellID then return true end
end
end
return false
end
function ImproveAny:InitSpellBookFix()
hooksecurefunc(
"SpellBookFrame_UpdateSpells",
function()
for i = 1, SPELLS_PER_PAGE do
local sel = _G["SpellButton" .. i]
local slot, slotType = SpellBook_GetSpellBookSlot(sel)
if slot and slotType ~= "FUTURESPELL" then
local texture = GetSpellTexture(slot, SpellBookFrame.bookType)
local spellName, _, spellID = GetSpellBookItemName(slot, SpellBookFrame.bookType)
local isPassive = IsPassiveSpell(slot, SpellBookFrame.bookType)
if isPassive or spellName == nil or texture == 134419 then
sel:SetChecked(false)
else
if spellName and spellID and not ImproveAny:IsOnActionbar(spellID) then
sel:SetChecked(true)
else
sel:SetChecked(false)
end
end
else
sel:SetChecked(false)
end
end
end
)
end
local warningEnhanceDressup = false
local warningEnhanceQuestLog = false
local warningEnhanceTrainers = false
function ImproveAny:Event(event, ...)
if ImproveAny.Setup == nil then
ImproveAny.Setup = true
if ImproveAny:IsAddOnLoaded("D4KiR MoveAndImprove") then
ImproveAny:MSG("DON'T use MoveAndImprove, when you use ImproveAny")
end
ImproveAny:InitSlash()
ImproveAny:InitDB()
ImproveAny:InitIASettings()
if ImproveAny:IAGV("fontName", "Default") ~= "Default" and ImproveAny.Fonts then
ImproveAny:Fonts()
end
if ImproveAny:IsEnabled("CASTBAR", false) and ImproveAny.InitCastBar then
ImproveAny:InitCastBar()
end
if ImproveAny:IsEnabled("DURABILITY", false) and ImproveAny.InitDurabilityFrame then
ImproveAny:InitDurabilityFrame()
end
local f = CreateFrame("Frame")
f:RegisterEvent("MERCHANT_SHOW")
f:SetScript(
"OnEvent",
function(sel)
if ImproveAny:IsEnabled("AUTOSELLJUNK", true) then
for bag = 0, 4 do
for slot = 1, C_Container.GetContainerNumSlots(bag) do
local itemLink = C_Container.GetContainerItemLink(bag, slot)
if itemLink then
local _, _, itemRarity, _, _, _, _, _, _, _, itemSellPrice = GetItemInfo(itemLink)
if itemRarity == 0 and itemSellPrice > 0 then
C_Container.UseContainerItem(bag, slot) -- Sell the item
end
end
end
end
end
if ImproveAny:IsEnabled("AUTOREPAIR", true) and CanMerchantRepair() then
local repairCost, canRepair = GetRepairAllCost()
if canRepair and repairCost > 0 then
RepairAllItems()
end
end
end
)
if ImproveAny.InitItemLevel then
ImproveAny:InitItemLevel()
end
if ImproveAny.InitMinimap then
ImproveAny:InitMinimap()
end
if ImproveAny.InitMoneyBar then
ImproveAny:InitMoneyBar()
end
if ImproveAny.InitTokenBar then
ImproveAny:InitTokenBar()
end
if ImproveAny.InitIAILVLBar then
ImproveAny:InitIAILVLBar()
end
if ImproveAny.InitSkillBars then
ImproveAny:InitSkillBars()
end
if ImproveAny.InitBags then
ImproveAny:InitBags()
end
if ImproveAny:IsEnabled("WORLDMAP", false) and ImproveAny.InitWorldMapFrame then
ImproveAny:InitWorldMapFrame()
end
if (ImproveAny:IsEnabled("AUTOACCEPTQUESTS", false) or ImproveAny:IsEnabled("AUTOCHECKINQUESTS", false)) and ImproveAny.InitAutoAcceptQuests then
ImproveAny:InitAutoAcceptQuests()
end
if ImproveAny.InitCombatText then
ImproveAny:InitCombatText()
end
if ImproveAny.InitXPBar then
ImproveAny:InitXPBar()
end
if ImproveAny.InitSuperTrackedFrame then
ImproveAny:InitSuperTrackedFrame()
end
if ImproveAny.InitMicroMenu then
ImproveAny:InitMicroMenu()
end
if ImproveAny.InitRaidFrames then
ImproveAny:InitRaidFrames()
end
if ImproveAny.InitPartyFrames then
ImproveAny:InitPartyFrames()
end
if ImproveAny.InitLFGFrame then
ImproveAny:InitLFGFrame()
end
if ImproveAny.UpdateUIParentAttribute then
ImproveAny:UpdateUIParentAttribute()
end
if ImproveAny.UpdateStatusBar then
ImproveAny:UpdateStatusBar()
end
if ImproveAny.InitIAPingFrame then
ImproveAny:InitIAPingFrame()
end
if ImproveAny.InitIACoordsFrame then
ImproveAny:InitIACoordsFrame()
end
if ImproveAny:GetWoWBuild() ~= "RETAIL" then
ImproveAny:InitSpellBookFix()
end
IATAB["VERSION"] = IATAB["VERSION"] or 0
if IATAB["VERSION"] < 1 then
IATAB["VERSION"] = 1
ImproveAny:MSG(ImproveAny:GT("NEW") .. ":", ImproveAny:GT("AUTOSELLJUNK"))
ImproveAny:MSG(ImproveAny:GT("NEW") .. ":", ImproveAny:GT("AUTOREPAIR"))
end
if CharacterFrameExpandButton and ImproveAny:IsEnabled("CHARACTERFRAMEAUTOEXPAND", true) then
if CharacterFrame then
CharacterFrame:HookScript(
"OnShow",
function()
CharacterFrameExpandButton:Click()
end
)
end
if CharacterFrameTab1 then
CharacterFrameTab1:HookScript(
"OnClick",
function()
CharacterFrameExpandButton:Click()
end
)
end
end
if ImproveAny:IsEnabled("RIGHTCLICKSELFCAST", false) then
ImproveAny:Debug("RIGHTCLICKSELFCAST")
C_Timer.After(
2,
function()
ImproveAny:AddRightClick()
end
)
end
function ImproveAny:UpdateMinimapButton()
if ImproveAny:IsEnabled("SHOWMINIMAPBUTTON", ImproveAny:GetWoWBuild() ~= "RETAIL") then
ImproveAny:ShowMMBtn("ImproveAny")
else
ImproveAny:HideMMBtn("ImproveAny")
end
end
if ExtraActionButton1 and ExtraActionButton1.style and ImproveAny:IsEnabled("HIDEEXTRAACTIONBUTTONARTWORK", false) then
hooksecurefunc(
ExtraActionButton1.style,
"Show",
function(sel, ...)
sel:Hide()
end
)
ExtraActionButton1.style:Hide()
end
local mmbtn = nil
ImproveAny:CreateMinimapButton(
{
["name"] = "ImproveAny",
["icon"] = 136033,
["var"] = mmbtn,
["dbtab"] = IATAB,
["vTT"] = {{"ImproveAny |T136033:16:16:0:0|t", "v|cff3FC7EB0.9.131"}, {ImproveAny:GT("LEFTCLICK"), ImproveAny:GT("MMBTNLEFT")}, {ImproveAny:GT("RIGHTCLICK"), ImproveAny:GT("MMBTNRIGHT")}},
["funcL"] = function()
ImproveAny:ToggleSettings()
end,
["funcR"] = function()
ImproveAny:MSG("Minimap Button is now hidden.")
ImproveAny:SetEnabled("SHOWMINIMAPBUTTON", false)
ImproveAny:HideMMBtn("ImproveAny")
end,
}
)
ImproveAny:UpdateMinimapButton()
ImproveAny:UpdateMaxZoom()
ImproveAny:UpdateWorldTextScale()
ImproveAny:CheckCVars()
if ImproveAny:IsEnabled("HIDEPVPBADGE", false) then
if PlayerFrame and PlayerFrame.PlayerFrameContent and PlayerFrame.PlayerFrameContent.PlayerFrameContentContextual then
hooksecurefunc(
PlayerFrame.PlayerFrameContent.PlayerFrameContentContextual.PrestigePortrait,
"Show",
function(sel)
sel:Hide()
end
)
PlayerFrame.PlayerFrameContent.PlayerFrameContentContextual.PrestigePortrait:Hide()
hooksecurefunc(
PlayerFrame.PlayerFrameContent.PlayerFrameContentContextual.PrestigeBadge,
"Show",
function(sel)
sel:Hide()
end
)
PlayerFrame.PlayerFrameContent.PlayerFrameContentContextual.PrestigeBadge:Hide()
end
if TargetFrame and TargetFrame.TargetFrameContent and TargetFrame.TargetFrameContent.TargetFrameContentContextual then
hooksecurefunc(
TargetFrame.TargetFrameContent.TargetFrameContentContextual.PrestigePortrait,
"Show",
function(sel)
sel:Hide()
end
)
TargetFrame.TargetFrameContent.TargetFrameContentContextual.PrestigePortrait:Hide()
hooksecurefunc(
TargetFrame.TargetFrameContent.TargetFrameContentContextual.PrestigeBadge,
"Show",
function(sel)
sel:Hide()
end
)
TargetFrame.TargetFrameContent.TargetFrameContentContextual.PrestigeBadge:Hide()
end
if FocusFrame and FocusFrame.TargetFrameContent and FocusFrame.TargetFrameContent.TargetFrameContentContextual then
hooksecurefunc(
FocusFrame.TargetFrameContent.TargetFrameContentContextual.PrestigePortrait,
"Show",
function(sel)
sel:Hide()
end
)
FocusFrame.TargetFrameContent.TargetFrameContentContextual.PrestigePortrait:Hide()
hooksecurefunc(
FocusFrame.TargetFrameContent.TargetFrameContentContextual.PrestigeBadge,
"Show",
function(sel)
sel:Hide()
end
)
FocusFrame.TargetFrameContent.TargetFrameContentContextual.PrestigeBadge:Hide()
end
if PlayerPVPIcon then
hooksecurefunc(
PlayerPVPIcon,
"Show",
function(sel)
sel:Hide()
end
)
PlayerPVPIcon:Hide()
end
if TargetFrameTextureFramePVPIcon then
hooksecurefunc(
TargetFrameTextureFramePVPIcon,
"Show",
function(sel)
sel:Hide()
end
)
TargetFrameTextureFramePVPIcon:Hide()
end
if FocusFrameTextureFramePVPIcon then
hooksecurefunc(
FocusFrameTextureFramePVPIcon,
"Show",
function(sel)
sel:Hide()
end
)
FocusFrameTextureFramePVPIcon:Hide()
end
end
local tts = {GameTooltip, ItemRefTooltip, ItemRefShoppingTooltip1, ItemRefShoppingTooltip2, ShoppingTooltip1, ShoppingTooltip2, EmbeddedItemTooltip,}
local function OnTooltipSetItem(tt, data)
if not tContains(tts, tt) then return end
local spellID = nil
local itemId = nil
if tt.GetTooltipData then
local tooltipData = tt:GetTooltipData()
if tooltipData and tooltipData.id then
if tooltipData.type == 0 then
itemId = tooltipData.id
elseif tooltipData.type == 1 then
spellID = tooltipData.id
end
end
else
if tt.GetSpell then
_, spellID = tt:GetSpell()
else
local _, itemLink = tt:GetItem()
if itemLink then
itemId = string.match(itemLink, "item:(%d*)")
end
end
end
if spellID and ImproveAny:IsEnabled("SETTINGS", false) then
tt:AddDoubleLine("SpellID" .. ":", "|cFFFFFFFF" .. spellID)
end
if itemId then
local _, _, _, _, _, _, _, itemStackCount, _, _, price, _, _, _, expacID, _, _ = ImproveAny:GetItemInfo(itemId)
if expacID and ImproveAny:IsEnabled("TOOLTIPEXPANSION", false) then
local textcolor = "|cFFFF1111"
if expacID >= GetExpansionLevel() then
textcolor = "|cFF11FF11"
end
if ImproveAny:GetWoWBuild() == "RETAIL" and expacID < GetExpansionLevel() then
tt:AddDoubleLine(ImproveAny:GT("ADDEDIN"), format(ImproveAny:GT("EXPANSION"), textcolor, _G["EXPANSION_NAME" .. expacID]))
end
end
if price and tt.shownMoneyFrames == nil and price > 0 and GetItemCount and GetCoinTextureString then
local count = GetItemCount(itemId)
if ImproveAny:IsEnabled("TOOLTIPSELLPRICE", false) then
if count and count > 1 and itemStackCount and AUCTION_BROWSE_UNIT_PRICE_SORT then
tt:AddDoubleLine(AUCTION_BROWSE_UNIT_PRICE_SORT .. "", GetCoinTextureString(price))
tt:AddDoubleLine(SELL_PRICE .. " (" .. count .. "/" .. itemStackCount .. ")", GetCoinTextureString(price * count))
else
tt:AddDoubleLine(SELL_PRICE .. ":", GetCoinTextureString(price))
end
end
end
end
end
if TooltipDataProcessor and TooltipDataProcessor.AddTooltipPostCall then
TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, OnTooltipSetItem)
TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Spell, OnTooltipSetItem)
else
for _, frame in pairs{GameTooltip, ItemRefTooltip, WhatevahTooltip} do
if frame then
frame:HookScript(
"OnTooltipSetSpell",
function(tt)
local _, spellID = tt:GetSpell()
if spellID and ImproveAny:IsEnabled("SETTINGS", false) then
tt:AddDoubleLine("SpellID" .. ":", "|cFFFFFFFF" .. spellID)
end
end
)
end
end
for _, frame in pairs{GameTooltip, ItemRefTooltip, WhatevahTooltip} do
if frame then
frame:HookScript(
"OnTooltipSetItem",
function(tt)
local _, itemLink = tt:GetItem()
if itemLink then
local itemId = tonumber(strmatch(itemLink, "item:(%d*)"))
if itemId then
local _, _, _, _, _, _, _, itemStackCount, _, _, price, _, _, _, _, _, _ = ImproveAny:GetItemInfo(itemId)
if price and tt.shownMoneyFrames == nil and price > 0 and GetItemCount and GetCoinTextureString then
local count = GetItemCount(itemId)
if ImproveAny:IsEnabled("TOOLTIPSELLPRICE", false) then
if count and count > 1 and itemStackCount and AUCTION_BROWSE_UNIT_PRICE_SORT then
tt:AddDoubleLine(AUCTION_BROWSE_UNIT_PRICE_SORT .. "", GetCoinTextureString(price))
tt:AddDoubleLine(SELL_PRICE .. " (" .. count .. "/" .. itemStackCount .. ")", GetCoinTextureString(price * count))
else
tt:AddDoubleLine(SELL_PRICE .. ":", GetCoinTextureString(price))
end
end
end
end
end
end
)
end
end
end
local ids = {}
ids[138019] = 1 -- Mythic Legion Added in patch 7.1.5.23360
ids[158923] = 1 -- Mythic BFA Added in patch 8.0.1.26903
ids[180653] = 1 -- Mythic SL, DF Added in patch 9.0.1.36216
ids[151086] = 1 -- Mythic Invitational Keystone Added in patch 9.2.0.42698
ids[186159] = 1 -- Mythic DF? Added in patch 10.0.0.44592
local MythicAuto = CreateFrame("Frame")
MythicAuto:RegisterEvent("ADDON_LOADED")
MythicAuto:SetScript(
"OnEvent",
function(sel, event2, addon)
if addon ~= "Blizzard_ChallengesUI" then return end
if ChallengesKeystoneFrame then
ChallengesKeystoneFrame:HookScript(
"OnShow",
function()
for bagId = 0, Constants.InventoryConstants.NumBagSlots do
for slotId = 1, C_Container.GetContainerNumSlots(bagId) do
local id = C_Container.GetContainerItemID(bagId, slotId)
if id and ids[id] then return C_Container.UseContainerItem(bagId, slotId) end
end
end
end
)
sel:UnregisterEvent(event2)
end
end
)
if ImproveAny:GetWoWBuild() ~= "RETAIL" and ImproveAny:IsEnabled("WIDEFRAMES", false) then
if not warningEnhanceDressup and LeaPlusDB and LeaPlusDB["EnhanceDressup"] and LeaPlusDB["EnhanceDressup"] == "On" then
ImproveAny:MSG("LeatrixPlus \"EnhanceDressup\" is enabled, may break WideFrames")
warningEnhanceDressup = true
end
if not warningEnhanceQuestLog and LeaPlusDB and LeaPlusDB["EnhanceQuestLog"] and LeaPlusDB["EnhanceQuestLog"] == "On" then
ImproveAny:MSG("LeatrixPlus \"EnhanceQuestLog\" is enabled, may break WideFrames")
warningEnhanceQuestLog = true
end
if not warningEnhanceTrainers and LeaPlusDB and LeaPlusDB["EnhanceTrainers"] and LeaPlusDB["EnhanceTrainers"] == "On" then
ImproveAny:MSG("LeatrixPlus \"EnhanceTrainers\" is enabled, may break WideFrames")
warningEnhanceTrainers = true
end
if ImproveAny:GetWoWBuild() == "CLASSIC" then
local tall, numTallQuests = 74, 22
UIPanelWindows["QuestLogFrame"] = {
area = "override",
pushable = 0,
xoffset = -16,
yoffset = 12,
bottomClampOverride = 140 + 12,
width = 714,
height = 487,
whileDead = 1
}
QuestLogFrame:SetWidth(714)
QuestLogFrame:SetHeight(487 + tall)
QuestLogTitleText:ClearAllPoints()
QuestLogTitleText:SetPoint("TOP", QuestLogFrame, "TOP", 0, -17)
QuestLogDetailScrollFrame:ClearAllPoints()
QuestLogDetailScrollFrame:SetPoint("TOPLEFT", QuestLogListScrollFrame, "TOPRIGHT", 31, 1)
QuestLogDetailScrollFrame:SetHeight(336 + tall)
QuestLogListScrollFrame:SetHeight(336 + tall)
local oldQuestsDisplayed = QUESTS_DISPLAYED
_G.QUESTS_DISPLAYED = _G.QUESTS_DISPLAYED + numTallQuests
for i = oldQuestsDisplayed + 1, QUESTS_DISPLAYED do
local button = CreateFrame("Button", "QuestLogTitle" .. i, QuestLogFrame, "QuestLogTitleButtonTemplate")
button:SetID(i)
button:Hide()
button:ClearAllPoints()
button:SetPoint("TOPLEFT", _G["QuestLogTitle" .. (i - 1)], "BOTTOMLEFT", 0, 1)
end
local regions = {QuestLogFrame:GetRegions()}
regions[3]:SetSize(1024, 512)
regions[3]:SetTexture("Interface\\AddOns\\ImproveAny\\media\\wideframe")
regions[3]:SetTexCoord(0, 1, 0, 1)
regions[4].Show = regions[4].Hide
regions[4]:Hide()
for i = 5, 6 do
if regions[i] then
regions[i]:Hide()
end
end
QuestLogFrameAbandonButton:SetSize(110, 21)
QuestLogFrameAbandonButton:SetText(ABANDON_QUEST_ABBREV)
QuestLogFrameAbandonButton:ClearAllPoints()
QuestLogFrameAbandonButton:SetPoint("BOTTOMLEFT", QuestLogFrame, "BOTTOMLEFT", 17, 54)
QuestFramePushQuestButton:SetSize(100, 21)
QuestFramePushQuestButton:SetText(SHARE_QUEST_ABBREV)
QuestFramePushQuestButton:ClearAllPoints()
QuestFramePushQuestButton:SetPoint("LEFT", QuestLogFrameAbandonButton, "RIGHT", -3, 0)
local mapButton = CreateFrame("Button", nil, QuestLogFrame, "UIPanelButtonTemplate")
mapButton:SetText("Map")
mapButton:ClearAllPoints()
mapButton:SetPoint("LEFT", QuestFramePushQuestButton, "RIGHT", -3, 0)
mapButton:SetSize(100, 21)
mapButton:SetScript("OnClick", ToggleWorldMap)
if QuestFrameExitButton then
QuestFrameExitButton:SetSize(80, 22)
QuestFrameExitButton:SetText(CLOSE)
QuestFrameExitButton:ClearAllPoints()
QuestFrameExitButton:SetPoint("BOTTOMRIGHT", QuestLogFrame, "BOTTOMRIGHT", -42, 54)
end
QuestLogNoQuestsText:ClearAllPoints()
QuestLogNoQuestsText:SetPoint("TOP", QuestLogListScrollFrame, 0, -50)
hooksecurefunc(
EmptyQuestLogFrame,
"Show",
function()
EmptyQuestLogFrame:ClearAllPoints()
EmptyQuestLogFrame:SetPoint("BOTTOMLEFT", QuestLogFrame, "BOTTOMLEFT", 20, -76)
EmptyQuestLogFrame:SetHeight(487)
end
)
end
if true then
local tall, numTallProfs = 73, 19
local function TradeSkillFunc(frame)
UIPanelWindows["TradeSkillFrame"] = {
area = "override",
pushable = 1,
xoffset = -16,
yoffset = 12,
bottomClampOverride = 140 + 12,
width = 714,
height = 487,
whileDead = 1
}
_G["TradeSkillFrame"]:SetWidth(714)
_G["TradeSkillFrame"]:SetHeight(487 + tall)
_G["TradeSkillFrameTitleText"]:ClearAllPoints()
_G["TradeSkillFrameTitleText"]:SetPoint("TOP", _G["TradeSkillFrame"], "TOP", 0, -18)
_G["TradeSkillListScrollFrame"]:ClearAllPoints()
_G["TradeSkillListScrollFrame"]:SetPoint("TOPLEFT", _G["TradeSkillFrame"], "TOPLEFT", 25, -75)
_G["TradeSkillListScrollFrame"]:SetSize(295, 336 + tall)
local oldTradeSkillsDisplayed = TRADE_SKILLS_DISPLAYED
for i = 1 + 1, TRADE_SKILLS_DISPLAYED do
_G["TradeSkillSkill" .. i]:ClearAllPoints()
_G["TradeSkillSkill" .. i]:SetPoint("TOPLEFT", _G["TradeSkillSkill" .. (i - 1)], "BOTTOMLEFT", 0, 1)
end
_G.TRADE_SKILLS_DISPLAYED = _G.TRADE_SKILLS_DISPLAYED + numTallProfs
for i = oldTradeSkillsDisplayed + 1, TRADE_SKILLS_DISPLAYED do
local button = CreateFrame("Button", "TradeSkillSkill" .. i, TradeSkillFrame, "TradeSkillSkillButtonTemplate")
button:SetID(i)
button:Hide()
button:ClearAllPoints()
button:SetPoint("TOPLEFT", _G["TradeSkillSkill" .. (i - 1)], "BOTTOMLEFT", 0, 1)
end
hooksecurefunc(
_G["TradeSkillHighlightFrame"],
"Show",
function()
_G["TradeSkillHighlightFrame"]:SetWidth(290)
end
)
_G["TradeSkillDetailScrollFrame"]:ClearAllPoints()
_G["TradeSkillDetailScrollFrame"]:SetPoint("TOPLEFT", _G["TradeSkillFrame"], "TOPLEFT", 352, -74)
_G["TradeSkillDetailScrollFrame"]:SetSize(298, 336 + tall)
_G["TradeSkillDetailScrollFrameTop"]:SetAlpha(0)
_G["TradeSkillDetailScrollFrameBottom"]:SetAlpha(0)
local RecipeInset = _G["TradeSkillFrame"]:CreateTexture(nil, "ARTWORK")
RecipeInset:SetSize(304, 361 + tall)
RecipeInset:SetPoint("TOPLEFT", _G["TradeSkillFrame"], "TOPLEFT", 16, -72)
RecipeInset:SetTexture("Interface\\RAIDFRAME\\UI-RaidFrame-GroupBg")
local DetailsInset = _G["TradeSkillFrame"]:CreateTexture(nil, "ARTWORK")
DetailsInset:SetSize(302, 339 + tall)
DetailsInset:SetPoint("TOPLEFT", _G["TradeSkillFrame"], "TOPLEFT", 348, -72)
DetailsInset:SetTexture("Interface\\ACHIEVEMENTFRAME\\UI-GuildAchievement-Parchment-Horizontal-Desaturated")
_G["TradeSkillExpandTabLeft"]:Hide()
local regions = {_G["TradeSkillFrame"]:GetRegions()}
for i, v in pairs(regions) do
if i > 1 then
if ImproveAny:GetWoWBuild() == "CLASSIC" then
if i == 2 then
regions[i]:SetSize(1024, 512)
regions[i]:SetTexture("Interface\\AddOns\\ImproveAny\\media\\wideframe")
regions[i]:SetTexCoord(0, 1, 0, 1)
elseif i == 3 then
regions[i].Show = regions[i].Hide
regions[i]:Hide()
elseif regions[i] then
regions[i]:Hide()
end
else
if i == 3 then
regions[i]:SetSize(1024, 512)
regions[i]:SetTexture("Interface\\AddOns\\ImproveAny\\media\\wideframe")
regions[i]:SetTexCoord(0, 1, 0, 1)
elseif i == 4 then
regions[i].Show = regions[i].Hide
regions[i]:Hide()
elseif regions[i] then
regions[i]:Hide()
end
end
end
end
if TradeSkillRankFrame and TradeSkillLinkButton then
TradeSkillLinkButton:ClearAllPoints()
TradeSkillLinkButton:SetPoint("TOP", TradeSkillFrame, "TOP", 0, -15)
end
if TradeSkillRankFrame and TradeSkillRankFrameSkillRank then
TradeSkillRankFrameSkillRank:ClearAllPoints()
TradeSkillRankFrameSkillRank:SetPoint("CENTER", TradeSkillRankFrame, "CENTER", 0, 0)
end
_G["TradeSkillCreateButton"]:ClearAllPoints()
_G["TradeSkillCreateButton"]:SetPoint("RIGHT", _G["TradeSkillCancelButton"], "LEFT", -1, 0)
_G["TradeSkillCancelButton"]:SetSize(80, 22)
_G["TradeSkillCancelButton"]:SetText(CLOSE)
_G["TradeSkillCancelButton"]:ClearAllPoints()
_G["TradeSkillCancelButton"]:SetPoint("BOTTOMRIGHT", _G["TradeSkillFrame"], "BOTTOMRIGHT", -42, 54)
_G["TradeSkillFrameCloseButton"]:ClearAllPoints()
_G["TradeSkillFrameCloseButton"]:SetPoint("TOPRIGHT", _G["TradeSkillFrame"], "TOPRIGHT", -30, -8)
if TradeSkillInvSlotDropDown then
TradeSkillInvSlotDropDown:ClearAllPoints()
TradeSkillInvSlotDropDown:SetPoint("TOPLEFT", TradeSkillFrame, "TOPLEFT", 510, -40)
elseif TradeSkillInvSlotDropdown then
TradeSkillInvSlotDropdown:ClearAllPoints()
TradeSkillInvSlotDropdown:SetPoint("TOPLEFT", TradeSkillFrame, "TOPLEFT", 510, -40)
end
if TradeSkillSubClassDropDown then
TradeSkillSubClassDropDown:ClearAllPoints()
TradeSkillSubClassDropDown:SetPoint("RIGHT", TradeSkillInvSlotDropDown, "LEFT", 0, 0)
elseif TradeSkillSubClassDropdown then
TradeSkillSubClassDropdown:ClearAllPoints()
TradeSkillSubClassDropdown:SetPoint("RIGHT", TradeSkillInvSlotDropdown, "LEFT", 0, -0)
end
if ImproveAny:IsAddOnLoaded("ClassicProfessionFilter") and TradeSkillFrame.SearchBox and TradeSkillFrame.HaveMats and TradeSkillFrame.HaveMats.text and ImproveAny:GetWoWBuild() ~= "RETAIL" and ImproveAny:GetWoWBuild() ~= "CATA" then
TradeSkillFrame.SearchBox:ClearAllPoints()
TradeSkillFrame.SearchBox:SetPoint("LEFT", TradeSkillRankFrame, "RIGHT", 20, -10)
TradeSkillFrame.HaveMats:ClearAllPoints()
TradeSkillFrame.HaveMats:SetPoint("LEFT", TradeSkillFrame.SearchBox, "RIGHT", 10, 8)
TradeSkillFrame.HaveMats.text:SetText("Have Materials?")
TradeSkillFrame.HaveMats:SetHitRectInsets(0, -TradeSkillFrame.HaveMats.text:GetStringWidth() + 4, 0, 0)
TradeSkillFrame.HaveMats.text:SetJustifyH("LEFT")
TradeSkillFrame.HaveMats.text:SetWordWrap(false)
if TradeSkillFrame.HaveMats.text:GetWidth() > 80 then
TradeSkillFrame.HaveMats.text:SetWidth(80)
TradeSkillFrame.HaveMats:SetHitRectInsets(0, -80 + 4, 0, 0)
end
TradeSkillFrame.SearchMats:ClearAllPoints()
TradeSkillFrame.SearchMats:SetPoint("BOTTOMLEFT", TradeSkillFrame.HaveMats, "BOTTOMLEFT", 0, -16)
TradeSkillFrame.SearchMats.text:SetText("Search")
TradeSkillFrame.SearchMats:SetHitRectInsets(0, -TradeSkillFrame.SearchMats.text:GetStringWidth() + 2, 0, 0)
TradeSkillFrame.SearchMats.text:SetJustifyH("LEFT")
TradeSkillFrame.SearchMats.text:SetWordWrap(false)
if TradeSkillFrame.SearchMats.text:GetWidth() > 80 then
TradeSkillFrame.SearchMats.text:SetWidth(80)
TradeSkillFrame.SearchMats:SetHitRectInsets(0, -80 + 4, 0, 0)
end
end
end
if ImproveAny:IsAddOnLoaded("Blizzard_TradeSkillUI") then
TradeSkillFunc("TradeSkill")
else
local waitFrame = CreateFrame("FRAME")
waitFrame:RegisterEvent("ADDON_LOADED")
waitFrame:SetScript(
"OnEvent",
function(sel, even, arg1)
if arg1 == "Blizzard_TradeSkillUI" then
TradeSkillFunc("TradeSkill")
waitFrame:UnregisterAllEvents()
end
end
)
end
local function CraftFunc()
UIPanelWindows["CraftFrame"] = {
area = "override",
pushable = 1,
xoffset = -16,
yoffset = 12,
bottomClampOverride = 140 + 12,
width = 714,
height = 487,
whileDead = 1
}
_G["CraftFrame"]:SetWidth(714)
_G["CraftFrame"]:SetHeight(487 + tall)
_G["CraftFrameTitleText"]:ClearAllPoints()
_G["CraftFrameTitleText"]:SetPoint("TOP", _G["CraftFrame"], "TOP", 0, -18)
_G["CraftListScrollFrame"]:ClearAllPoints()
_G["CraftListScrollFrame"]:SetPoint("TOPLEFT", _G["CraftFrame"], "TOPLEFT", 25, -75)
_G["CraftListScrollFrame"]:SetSize(295, 336 + tall)
local oldCraftsDisplayed = CRAFTS_DISPLAYED
_G["Craft1Cost"]:ClearAllPoints()
_G["Craft1Cost"]:SetPoint("RIGHT", _G["Craft1"], "RIGHT", -30, 0)
for i = 1 + 1, CRAFTS_DISPLAYED do
_G["Craft" .. i]:ClearAllPoints()
_G["Craft" .. i]:SetPoint("TOPLEFT", _G["Craft" .. (i - 1)], "BOTTOMLEFT", 0, 1)
_G["Craft" .. i .. "Cost"]:ClearAllPoints()
_G["Craft" .. i .. "Cost"]:SetPoint("RIGHT", _G["Craft" .. i], "RIGHT", -30, 0)
end
_G.CRAFTS_DISPLAYED = _G.CRAFTS_DISPLAYED + numTallProfs
for i = oldCraftsDisplayed + 1, CRAFTS_DISPLAYED do
local button = CreateFrame("Button", "Craft" .. i, CraftFrame, "CraftButtonTemplate")
button:SetID(i)
button:Hide()
button:ClearAllPoints()
button:SetPoint("TOPLEFT", _G["Craft" .. (i - 1)], "BOTTOMLEFT", 0, 1)
_G["Craft" .. i .. "Cost"]:ClearAllPoints()
_G["Craft" .. i .. "Cost"]:SetPoint("RIGHT", _G["Craft" .. i], "RIGHT", -30, 0)
end
CraftFramePointsLabel:ClearAllPoints()
CraftFramePointsLabel:SetPoint("TOPLEFT", CraftFrame, "TOPLEFT", 100, -50)
CraftFramePointsText:ClearAllPoints()
CraftFramePointsText:SetPoint("LEFT", CraftFramePointsLabel, "RIGHT", 3, 0)
hooksecurefunc(
"CraftFrame_Update",
function()
for i = 1, CRAFTS_DISPLAYED do
if _G["Craft" .. i] then
local craftButtonCost = _G["Craft" .. i .. "Cost"]
if craftButtonCost then
craftButtonCost:SetPoint("RIGHT", -30, 0)
end
end
end
end
)
hooksecurefunc(
_G["CraftHighlightFrame"],
"Show",
function()
_G["CraftHighlightFrame"]:SetWidth(290)
end
)
_G["CraftDetailScrollFrame"]:ClearAllPoints()
_G["CraftDetailScrollFrame"]:SetPoint("TOPLEFT", _G["CraftFrame"], "TOPLEFT", 352, -74)
_G["CraftDetailScrollFrame"]:SetSize(298, 336 + tall)
_G["CraftDetailScrollFrameTop"]:SetAlpha(0)
_G["CraftDetailScrollFrameBottom"]:SetAlpha(0)
local RecipeInset = _G["CraftFrame"]:CreateTexture(nil, "ARTWORK")
RecipeInset:SetSize(304, 361 + tall)
RecipeInset:SetPoint("TOPLEFT", _G["CraftFrame"], "TOPLEFT", 16, -72)
RecipeInset:SetTexture("Interface\\RAIDFRAME\\UI-RaidFrame-GroupBg")
local DetailsInset = _G["CraftFrame"]:CreateTexture(nil, "ARTWORK")
DetailsInset:SetSize(302, 339 + tall)
DetailsInset:SetPoint("TOPLEFT", _G["CraftFrame"], "TOPLEFT", 348, -72)
DetailsInset:SetTexture("Interface\\ACHIEVEMENTFRAME\\UI-GuildAchievement-Parchment-Horizontal-Desaturated")
_G["CraftExpandTabLeft"]:Hide()
local regions = {_G["CraftFrame"]:GetRegions()}
regions[2]:SetSize(1024, 512)
regions[2]:SetTexture("Interface\\AddOns\\ImproveAny\\media\\wideframe")
regions[2]:SetTexCoord(0, 1, 0, 1)
regions[3].Show = regions[3].Hide
regions[3]:Hide()
for i = 4, 10 do
if regions[i] then
regions[i]:Hide()
end
end
_G["CraftCreateButton"]:ClearAllPoints()
_G["CraftCreateButton"]:SetPoint("RIGHT", _G["CraftCancelButton"], "LEFT", -1, 0)
_G["CraftCancelButton"]:SetSize(80, 22)
_G["CraftCancelButton"]:SetText(CLOSE)
_G["CraftCancelButton"]:ClearAllPoints()
_G["CraftCancelButton"]:SetPoint("BOTTOMRIGHT", _G["CraftFrame"], "BOTTOMRIGHT", -42, 54)
_G["CraftFrameCloseButton"]:ClearAllPoints()
_G["CraftFrameCloseButton"]:SetPoint("TOPRIGHT", _G["CraftFrame"], "TOPRIGHT", -30, -8)
hooksecurefunc(
CraftCreateButton,
"SetFrameLevel",
function()
CraftCreateButton:ClearAllPoints()
CraftCreateButton:SetPoint("RIGHT", CraftCancelButton, "LEFT", -1, 0)
end
)
if ImproveAny:IsAddOnLoaded("ClassicProfessionFilter") and CraftFrame.SearchBox and CraftFrame.HaveMats and CraftFrame.HaveMats.text and CraftFrame.SearchMats and CraftFrame.SearchMats.text then
CraftFrame.SearchBox:ClearAllPoints()
CraftFrame.SearchBox:SetPoint("LEFT", CraftRankFrame, "RIGHT", 20, -10)
CraftFrame.HaveMats:ClearAllPoints()
CraftFrame.HaveMats:SetPoint("LEFT", CraftFrame.SearchBox, "RIGHT", 10, 8)
CraftFrame.HaveMats.text:SetText("Have Materials?")
CraftFrame.HaveMats:SetHitRectInsets(0, -CraftFrame.HaveMats.text:GetStringWidth() + 4, 0, 0)
CraftFrame.HaveMats.text:SetJustifyH("LEFT")
CraftFrame.HaveMats.text:SetWordWrap(false)
if CraftFrame.HaveMats.text:GetWidth() > 80 then
CraftFrame.HaveMats.text:SetWidth(80)
CraftFrame.HaveMats:SetHitRectInsets(0, -80 + 4, 0, 0)
end
CraftFrame.SearchMats:ClearAllPoints()
CraftFrame.SearchMats:SetPoint("BOTTOMLEFT", CraftFrame.HaveMats, "BOTTOMLEFT", 0, -16)
CraftFrame.SearchMats.text:SetText("Search")
CraftFrame.SearchMats:SetHitRectInsets(0, -CraftFrame.SearchMats.text:GetStringWidth() + 2, 0, 0)
CraftFrame.SearchMats.text:SetJustifyH("LEFT")
CraftFrame.SearchMats.text:SetWordWrap(false)
if CraftFrame.SearchMats.text:GetWidth() > 80 then
CraftFrame.SearchMats.text:SetWidth(80)
CraftFrame.SearchMats:SetHitRectInsets(0, -80 + 4, 0, 0)
end
end
end
if ImproveAny:IsAddOnLoaded("Blizzard_CraftUI") then
CraftFunc()
else
local waitFrame = CreateFrame("FRAME")
waitFrame:RegisterEvent("ADDON_LOADED")