forked from Niitek/LUI-Classic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLUI.lua
1954 lines (1765 loc) · 64.6 KB
/
LUI.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
--[[
Project.: LUI NextGenWoWUserInterface
File....: LUI_tbcc.lua
Version.: 3.403
Rev Date: 13/02/2011
Author..: Louí [EU-Das Syndikat] <In Fidem>
]]
local addonname, LUI = ...
local L = LUI.L
local AceAddon = LibStub("AceAddon-3.0")
-- this is a temp globalization (should make it check for alpha verion to globalize or not once all other files don't need global)
_G.LUI = LUI
_G.oUF = LUI.oUF
local Media = LibStub("LibSharedMedia-3.0")
local Profiler = LUI.Profiler
local widgetLists = AceGUIWidgetLSMlists
local ACD = LibStub("AceConfigDialog-3.0")
local ACR = LibStub("AceConfigRegistry-3.0")
LUI.Versions = {lui = 3403}
LUI.dummy = function() return end
local LIVE_TOC = 90001
local LIVE_BUILD = 36322 --36322, 90001
-- Check the build to compare with PTR
local _, CURRENT_BUILD, _, CURRENT_TOC = GetBuildInfo()
if tonumber(CURRENT_BUILD) > LIVE_BUILD then
LUI.PTR = true
--LUI:Print("Using Code Designed for New Patch")
end
local ProfileName = UnitName("player").." - "..GetRealmName()
-- Work around for IsDisabledByParentalControls() errors. Simply hide the frame. It will still error but that's OK.
UIParent:HookScript("OnEvent", function(s, e, a1, a2) if e:find("ACTION_FORBIDDEN") and ((a1 or "")..(a2 or "")):find("IsDisabledByParentalControls") then StaticPopup_Hide(e) end; end)
-- Come on Blizzard, please fix this soon!
-- REGISTER FONTS
Media:Register("font", "vibrocen", [[Interface\Addons\LUI\media\fonts\vibrocen.ttf]])
Media:Register("font", "vibroceb", [[Interface\Addons\LUI\media\fonts\vibroceb.ttf]])
Media:Register("font", "Prototype", [[Interface\Addons\LUI\media\fonts\prototype.ttf]])
Media:Register("font", "neuropol", [[Interface\AddOns\LUI\media\fonts\neuropol.ttf]])
Media:Register("font", "AvantGarde_LT_Medium", [[Interface\AddOns\LUI\media\fonts\AvantGarde_LT_Medium.ttf]])
Media:Register("font", "Arial Narrow", [[Interface\AddOns\LUI\media\fonts\ARIALN.TTF]])
Media:Register("font", "Pepsi", [[Interface\AddOns\LUI\media\fonts\pepsi.ttf]])
-- REGISTER BORDERS
Media:Register("border", "glow", [[Interface\Addons\LUI\media\textures\borders\glow.tga]])
Media:Register("border", "Stripped", [[Interface\Addons\LUI\media\textures\borders\Stripped.tga]])
Media:Register("border", "Stripped_hard", [[Interface\Addons\LUI\media\textures\borders\Stripped_hard.tga]])
Media:Register("border", "Stripped_medium", [[Interface\Addons\LUI\media\textures\borders\Stripped_medium.tga]])
-- REGISTER STATUSBARS
Media:Register("statusbar", "oUF LUI", [[Interface\AddOns\LUI\media\textures\statusbars\oUF_LUI.tga]])
Media:Register("statusbar", "LUI_Gradient", [[Interface\AddOns\LUI\media\textures\statusbars\gradient32x32.tga]])
Media:Register("statusbar", "LUI_Minimalist", [[Interface\AddOns\LUI\media\textures\statusbars\Minimalist.tga]])
Media:Register("statusbar", "LUI_Ruben", [[Interface\AddOns\LUI\media\textures\statusbars\Ruben.tga]])
Media:Register("statusbar", "Smelly", [[Interface\AddOns\LUI\media\textures\statusbars\Smelly.tga]])
Media:Register("statusbar", "Neal", [[Interface\AddOns\LUI\media\textures\statusbars\Neal]])
Media:Register("statusbar", "RenaitreMinion", [[Interface\AddOns\LUI\media\textures\statusbars\RenaitreMinion.tga]])
Media:Register("statusbar", "Otravi", [[Interface\AddOns\LUI\media\textures\statusbars\Otravi.tga]])
Media:Register("statusbar", "Empty", [[Interface\AddOns\LUI\media\textures\blank]])
local fdir = "Interface\\AddOns\\LUI\\media\\templates\\v3\\"
LUI.Media = {
["blank"] = [[Interface\AddOns\LUI\media\textures\blank]],
["normTex"] = [[Interface\AddOns\LUI\media\textures\statusbars\normTex]], -- texture used for nameplates healthbar
["glowTex"] = [[Interface\AddOns\LUI\media\textures\statusbars\glowTex]], -- the glow texture around some frame.
["cross"] = [[Interface\AddOns\LUI\media\textures\icons\cross]], -- Worldmap Move Button.
["party"] = [[Interface\AddOns\LUI\media\textures\icons\Party]], -- Worldmap Party Icon.
["raid"] = [[Interface\AddOns\LUI\media\textures\icons\Raid]], -- Worldmap Raid Icon.
["mail"] = [[Interface\AddOns\LUI\media\textures\icons\mail]], -- Minimap Mail Icon.
["btn_normal"] = [[Interface\AddOns\LUI\media\textures\buttons\Normal]], -- Standard Button Texture example: Auras
["btn_border"] = [[Interface\AddOns\LUI\media\textures\buttons\Border]], -- Button Border
["btn_gloss"] = [[Interface\AddOns\LUI\media\textures\buttons\Gloss]], -- Button Overlay
}
LUI.FontFlags = {
NONE = L["None"],
OUTLINE = L["Outline"],
THICKOUTLINE = L["Thick Outline"],
MONOCHROME = L["Monochrome"],
}
LUI.Points = {
CENTER = L["Center"],
TOP = L["Top"],
BOTTOM = L["Bottom"],
LEFT = L["Left"],
RIGHT = L["Right"],
TOPLEFT = L["Top Left"],
TOPRIGHT = L["Top Right"],
BOTTOMLEFT = L["Bottom Left"],
BOTTOMRIGHT = L["Bottom Right"],
}
LUI.Corners = {
TOPLEFT = L["Top Left"],
TOPRIGHT = L["Top Right"],
BOTTOMLEFT = L["Bottom Left"],
BOTTOMRIGHT = L["Bottom Right"],
}
LUI.Sides = {
TOP = L["Top"],
BOTTOM = L["Bottom"],
LEFT = L["Left"],
RIGHT = L["Right"],
}
LUI.Opposites = {
-- Sides
TOP = "BOTTOM",
BOTTOM = "TOP",
LEFT = "RIGHT",
RIGHT = "LEFT",
-- Corners
TOPLEFT = "BOTTOMRIGHT",
TOPRIGHT = "BOTTOMLEFT",
BOTTOMLEFT = "TOPRIGHT",
BOTTOMRIGHT = "TOPLEFT",
}
local screen_height, screen_width = 1920, 1080
local screenRes = {GetScreenResolutions()}
local currentRes = GetCurrentResolution()
if currentRes == 0 then currentRes = #screenRes end
if screenRes[currentRes] then
screen_height = string.match(screenRes[currentRes], "%d+x(%d+)")
screen_width = string.match(screenRes[currentRes], "(%d+)x%d+")
end
local _, class = UnitClass("player")
------------------------------------------------------
-- / CREATING DEFAULTS / --
------------------------------------------------------
LUI.defaults = {
profile = {
General = {
IsConfigured = false,
HideErrors = false,
HideTalentSpam = false,
AutoInvite = false,
AutoInviteOnlyFriend = true,
AutoInviteKeyword = "",
AutoAcceptInvite = false,
BlizzFrameScale = 1,
ModuleMessages = true,
DamageFont = "neuropol",
DamageFontSize = 25,
DamageFontSizeCrit = 34,
["*"] = {},
},
Recount = {
Font = "vibrocen",
FontHack = true,
FontSize = 13,
},
},
global = {
luiconfig = {},
},
}
local db_
local db = setmetatable({}, {
__index = function(t, k)
return db_[k]
end,
__newindex = function(t, k, v)
db_[k] = v
end
})
local function CheckResolution()
local ScreenWidth = string.match(({GetScreenResolutions()})[GetCurrentResolution()], "(%d+)x%d+")
local ScreenHeight = string.match(({GetScreenResolutions()})[GetCurrentResolution()], "%d+x(%d+)")
if ScreenWidth == "1280" and ScreenHeight == "1024" then
-- Repostion Info Texts
local Infotext = LUI:Module("Infotext", true)
if Infotext and false then -- broken with false until proper positions have been determined
Infotext.db.defaults.profile.Bags.X = -100
Infotext.db.defaults.profile.Durability.X = 10
Infotext.db.defaults.profile.FPS.X = 120
Infotext.db.defaults.profile.Memory.X = 190
end
LUI.defaults.profile.Frames.Dps.X = -968
LUI.defaults.profile.Frames.Dps.Y = 863
LUI.defaults.profile.Frames.Tps.X = 5
LUI.defaults.profile.Frames.Tps.Y = 882
-- Reposition Auras
local auras = LUI:Module("Auras")
auras.db.General.Anchor = "TOPRIGHT"
auras.db.Buffs.X = -170
auras.db.Buffs.Y = -75
auras.db.Debuffs.X = -170
auras.db.Debuffs.Y = -185
end
end
local function RGBToHex(r, g, b)
r = r <= 255 and r >= 0 and r or 0
g = g <= 255 and g >= 0 and g or 0
b = b <= 255 and b >= 0 and b or 0
return string.format("%02x%02x%02x", r, g, b)
end
function LUI:Kill(object)
object.Show = LUI.dummy
object:Hide()
end
local function scale(x)
local scaleUI = UIParent:GetEffectiveScale()
local mult = 768/screen_height/scaleUI
LUI.mult = mult
return mult*math.floor(x/mult+.5)
end
function LUI:Scale(x) return scale(x) end
function LUI:CreatePanel(f, w, h, a1, p, a2, x, y)
local sh = scale(h)
local sw = scale(w)
f:SetFrameLevel(1)
f:SetHeight(sh)
f:SetWidth(sw)
f:SetFrameStrata("BACKGROUND")
f:SetPoint(a1, p, a2, x, y)
Mixin(f, BackdropTemplateMixin)
f:SetBackdrop({
bgFile = LUI.Media.blank,
edgeFile = LUI.Media.blank,
tile = false, tileSize = 0, edgeSize = LUI.mult,
insets = { left = -LUI.mult, right = -LUI.mult, top = -LUI.mult, bottom = -LUI.mult}
})
f:SetBackdropColor(.1,.1,.1,1)
f:SetBackdropBorderColor(.6,.6,.6,1)
end
function LUI:StyleButton(b, checked)
local name = b:GetName()
local button = _G[name]
local icon = _G[name.."Icon"]
local count = _G[name.."Count"]
local border = _G[name.."Border"]
local hotkey = _G[name.."HotKey"]
local cooldown = _G[name.."Cooldown"]
local nametext = _G[name.."Name"]
local flash = _G[name.."Flash"]
local normaltexture = _G[name.."NormalTexture"]
local icontexture = _G[name.."IconTexture"]
local hover = b:CreateTexture("frame", nil, self) -- hover
hover:SetColorTexture(1,1,1,0.2)
hover:SetHeight(button:GetHeight())
hover:SetWidth(button:GetWidth())
hover:SetPoint("TOPLEFT",button,2,-2)
hover:SetPoint("BOTTOMRIGHT",button,-2,2)
button:SetHighlightTexture(hover)
local pushed = b:CreateTexture("frame", nil, self) -- pushed
pushed:SetColorTexture(0.9,0.8,0.1,0.3)
pushed:SetHeight(button:GetHeight())
pushed:SetWidth(button:GetWidth())
pushed:SetPoint("TOPLEFT",button,2,-2)
pushed:SetPoint("BOTTOMRIGHT",button,-2,2)
button:SetPushedTexture(pushed)
local Infotext = self:Module("Infotext", true)
count:SetFont(Media:Fetch("font", (Infotext and Infotext.db.profile.FPS.Font or "vibroceb")), (Infotext and Infotext.db.profile.FPS.FontSize or 12), "OUTLINE")
if checked then
local checked = b:CreateTexture("frame", nil, self) -- checked
checked:SetColorTexture(0,1,0,0.3)
checked:SetHeight(button:GetHeight())
checked:SetWidth(button:GetWidth())
checked:SetPoint("TOPLEFT",button,2,-2)
checked:SetPoint("BOTTOMRIGHT",button,-2,2)
button:SetCheckedTexture(checked)
end
end
------------------------------------------------------
-- / CREATE ME A FRAME FUNC / --
------------------------------------------------------
function LUI:CreateMeAFrame(fart,fname,fparent,fwidth,fheight,fscale,fstrata,flevel,
fpoint,frelativeFrame,frelativePoint,fofsx,fofsy,falpha,finherit)
local f = CreateFrame(fart,fname,fparent,finherit)
if BackdropTemplateMixin then Mixin(f, BackdropTemplateMixin) end
local sw = scale(fwidth)
local sh = scale(fheight)
local sx = scale(fofsx)
local sy = scale(fofsy)
f:SetWidth(sw)
f:SetHeight(sh)
--f:SetScale(fscale)
f:SetFrameStrata(fstrata)
f:SetFrameLevel(flevel)
f:SetPoint(fpoint,frelativeFrame,frelativePoint,sx,sy)
f:SetAlpha(falpha)
return f
end
------------------------------------------------------
-- / SYNC ADDON VERSION / --
------------------------------------------------------
function LUI:SyncAddonVersion()
local luiversion, version, newVersion = GetAddOnMetadata(addonname, "Version"), "", ""
local myRealm, myFaction, inGroup = GetRealmName(), (UnitFactionGroup("player") == "Horde" and 0 or 1), false
while luiversion ~= nil do
local pos = strfind(luiversion, "%.")
if pos then
version = version .. format("%03d.", strsub(luiversion, 1, pos-1))
luiversion = strsub(luiversion, pos+1)
else
version = version .. format("%03d", luiversion)
luiversion = nil
newVersion = version
end
end
local function sendVersion(distribution, target) -- (distribution [, target])
if distribution == "WHISPER" and not target then
return
elseif distribution == "RAID" or distribution == "PARTY" then
if IsInGroup(LE_PARTY_CATEGORY_INSTANCE) then
self.channel = "INSTANCE_CHAT"
end
end
LUI:SendCommMessage("LUI_Version", version, distribution, target)
end
local function checkVersion(prefix, text, distribution, from)
if version < text and newVersion < text then -- your version out of date (only print once)
newVersion = text
LUI:Print(format(L["Version %s available for download."], gsub(text, "%d+", tonumber)))
elseif version > text and distribution ~= "WHISPER" then -- their version out of date (tell them)
sendVersion("WHISPER", from)
end
end
local function groupUpdate(groupType)
if not groupType then return end
if groupType == "Party" and GetNumGroupMembers() > 0 then return end
if (groupType == "Party" and (GetNumSubgroupMembers() >= 1) or (GetNumGroupMembers() >= 1)) then
if inGroup then return end
inGroup = true
sendVersion("RAID")
else
inGroup = false
end
end
LUI:RegisterComm("LUI_Version", checkVersion)
for i = 1, C_FriendList.GetNumFriends() do -- send to friends via whisper on login
local friend = C_FriendList.GetFriendInfoByIndex(i)
if friend.name and friend.connected then
sendVersion("WHISPER", name)
end
end
--[[ for i = 1, BNGetNumFriends() do -- send to BN friends (on your realm) via whisper on login
local friend = C_BattleNet.GetFriendAccountInfo(i)
local toon = friend.gameAccountInfo
if toon.characterName and toon.isOnline and toon.clientProgram == "WoW" then
if toon.realmName == myRealm and toon.factionName == myFaction then
sendVersion("WHISPER", toon.characterName)
end
end
end ]]
sendVersion("GUILD") -- send to guild on login
LUI:RegisterEvent("GROUP_ROSTER_UPDATE", groupUpdate, "Party") -- send to party on join party
LUI:RegisterEvent("GROUP_ROSTER_UPDATE", groupUpdate, "Raid") -- send to raid on join raid
end
------------------------------------------------------
-- / SET DAMAGE FONT / --
------------------------------------------------------
function LUI:SetDamageFont()
local DamageFont = Media:Fetch("font", db.General.DamageFont)
_G.COMBAT_TEXT_SCROLLSPEED = 1.9
_G.COMBAT_TEXT_FADEOUT_TIME = 1.3
_G.DAMAGE_TEXT_FONT = DamageFont
_G.COMBAT_TEXT_HEIGHT = db.General.DamageFontSize
_G.COMBAT_TEXT_CRIT_MAXHEIGHT = db.General.DamageFontSizeCrit
_G.COMBAT_TEXT_CRIT_MINHEIGHT = db.General.DamageFontSizeCrit - 2
end
------------------------------------------------------
-- / LOAD EXTRA MODULES / --
------------------------------------------------------
function LUI:LoadExtraModules()
for i=1, GetNumAddOns() do
local name, _, _, enabled, loadable = GetAddOnInfo(i)
if strfind(name, "LUI_") and enabled and loadable then
LoadAddOn(i)
end
end
end
------------------------------------------------------
-- / UPDATE / --
------------------------------------------------------
function LUI:Update()
local updateBG = LUI:CreateMeAFrame("FRAME","updateBG",UIParent,2400,2000,1,"HIGH",5,"CENTER",UIParent,"CENTER",0,0,1)
updateBG:SetBackdrop({bgFile="Interface\\Tooltips\\UI-Tooltip-Background", edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", edgeSize=1, insets={left=0, right=0, top=0, bottom=0}})
updateBG:SetBackdropColor(0,0,0,1)
updateBG:SetBackdropBorderColor(0,0,0,0)
updateBG:SetAlpha(1)
updateBG:Show()
local updatelogo = LUI:CreateMeAFrame("FRAME","updatelogo",UIParent,512,512,1,"HIGH",6,"CENTER",UIParent,"CENTER",0,150,1)
updatelogo:SetBackdrop({bgFile=fdir.."logo", edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", edgeSize=1, insets={left=0, right=0, top=0, bottom=0}})
updatelogo:SetBackdropBorderColor(0,0,0,0)
updatelogo:Show()
local update = LUI:CreateMeAFrame("FRAME","update",updatelogo,512,512,1,"HIGH",6,"BOTTOM",updatelogo,"BOTTOM",0,-130,1)
update:SetBackdrop({bgFile=fdir.."update", edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", edgeSize=1, insets={left=0, right=0, top=0, bottom=0}})
update:SetBackdropColor(1,1,1,1)
update:SetBackdropBorderColor(0,0,0,0)
update:Show()
local update_hover = LUI:CreateMeAFrame("FRAME","update_hover",updatelogo,512,512,1,"HIGH",7,"BOTTOM",updatelogo,"BOTTOM",0,-130,1)
update_hover:SetBackdrop({bgFile=fdir.."update_hover", edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", edgeSize=1, insets={left=0, right=0, top=0, bottom=0}})
update_hover:SetBackdropColor(1,1,1,1)
update_hover:SetBackdropBorderColor(0,0,0,0)
update_hover:Hide()
local update_frame = LUI:CreateMeAFrame("BUTTON","update_frame",updatelogo,310,80,1,"HIGH",8,"BOTTOM",updatelogo,"BOTTOM",-5,90,1)
update_frame:SetBackdrop({bgFile="Interface\\Tooltips\\UI-Tooltip-Background", edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", edgeSize=1, insets={left=0, right=0, top=0, bottom=0}})
update_frame:SetBackdropColor(1,1,1,0)
update_frame:SetBackdropBorderColor(0,0,0,0)
update_frame:Show()
update_frame:SetScript("OnEnter", function(self)
update:Hide()
update_hover:Show()
end)
update_frame:SetScript("OnLeave", function(self)
update_hover:Hide()
update:Show()
end)
update_frame:RegisterForClicks("AnyUp")
update_frame:SetScript("OnClick", function(self)
if IsAddOnLoaded("Plexus") then
LUI.db.global.luiconfig[ProfileName].Versions.plexus = nil
LUI:InstallPlexus()
end
if IsAddOnLoaded("Recount") then
LUI.db.global.luiconfig[ProfileName].Versions.recount = nil
LUI:InstallRecount()
end
if IsAddOnLoaded("Details") then
LUICONFIG.Versions.details = nil
LUI:InstallDetails()
end
if IsAddOnLoaded("Omen") or IsAddOnLoaded("Omen3") then
LUI.db.global.luiconfig[ProfileName].Versions.omen = nil
LUI:InstallOmen()
end
LUI.db.global.luiconfig[ProfileName].Versions.lui = LUI.Versions.lui
ReloadUI()
end)
end
------------------------------------------------------
-- / CONFIGURE / --
------------------------------------------------------
function LUI:Configure()
if InterfaceOptionsFrame:IsShown() then
InterfaceOptionsFrame:Hide()
end
local configureBG = LUI:CreateMeAFrame("FRAME","configureBG",UIParent,2400,2000,1,"HIGH",5,"CENTER",UIParent,"CENTER",0,0,1)
configureBG:SetBackdrop({bgFile="Interface\\Tooltips\\UI-Tooltip-Background", edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", edgeSize=1, insets={left=0, right=0, top=0, bottom=0}})
configureBG:SetBackdropColor(0,0,0,1)
configureBG:SetBackdropBorderColor(0,0,0,0)
configureBG:SetAlpha(1)
configureBG:Show()
local logo = LUI:CreateMeAFrame("FRAME","logo",UIParent,512,512,1,"HIGH",6,"CENTER",UIParent,"CENTER",0,150,1)
logo:SetBackdrop({bgFile=fdir.."logo", edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", edgeSize=1, insets={left=0, right=0, top=0, bottom=0}})
logo:SetBackdropBorderColor(0,0,0,0)
logo:Show()
local install = LUI:CreateMeAFrame("FRAME","install",logo,512,512,1,"HIGH",6,"BOTTOM",logo,"BOTTOM",0,-130,1)
install:SetBackdrop({bgFile=fdir.."install", edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", edgeSize=1, insets={left=0, right=0, top=0, bottom=0}})
install:SetBackdropColor(1,1,1,1)
install:SetBackdropBorderColor(0,0,0,0)
install:Show()
local install_hover = LUI:CreateMeAFrame("FRAME","install_hover",logo,512,512,1,"HIGH",7,"BOTTOM",logo,"BOTTOM",0,-130,1)
install_hover:SetBackdrop({bgFile=fdir.."install_hover", edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", edgeSize=1, insets={left=0, right=0, top=0, bottom=0}})
install_hover:SetBackdropColor(1,1,1,1)
install_hover:SetBackdropBorderColor(0,0,0,0)
install_hover:Hide()
local install_frame = LUI:CreateMeAFrame("BUTTON","install_frame",logo,310,80,1,"HIGH",8,"BOTTOM",logo,"BOTTOM",-5,90,1)
install_frame:SetBackdrop({bgFile="Interface\\Tooltips\\UI-Tooltip-Background", edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", edgeSize=1, insets={left=0, right=0, top=0, bottom=0}})
install_frame:SetBackdropColor(1,1,1,0)
install_frame:SetBackdropBorderColor(0,0,0,0)
install_frame:Show()
install_frame:SetScript("OnEnter", function(self)
install:Hide()
install_hover:Show()
end)
install_frame:SetScript("OnLeave", function(self)
install_hover:Hide()
install:Show()
end)
install_frame:RegisterForClicks("AnyUp")
install_frame:SetScript("OnClick", function(self)
SetCVar("buffDurations", 1)
SetCVar("scriptErrors", 1)
SetCVar("uiScale", 0.6949)
SetCVar("useUiScale", 1)
SetCVar("chatMouseScroll", 1)
SetCVar("chatStyle", "classic")
if LUI.db.global.luiconfig[ProfileName].Versions then
wipe(LUI.db.global.luiconfig[ProfileName].Versions)
end
LUI:InstallPlexus()
LUI:InstallRecount()
LUI:InstallOmen()
LUI:InstallBartender()
LUI:InstallDetails()
LUI.db.global.luiconfig[ProfileName].Versions.lui = LUI.Versions.lui
LUI.db.global.luiconfig[ProfileName].IsConfigured = true
-- This is commented out for now as it causes issues.
-- Sorry, if you're using 1280x1024 things might look
-- funky, but LUI will at least install properly.
--CheckResolution()
ReloadUI()
end)
end
------------------------------------------------------
-- / MODULES / --
------------------------------------------------------
local function getModulePrototype(parent)
local prototype = {
Toggle = parent.Toggle,
GetDBVar = parent.GetDBVar,
SetDBVar = parent.SetDBVar,
GetDefaultVal = parent.GetDefaultVal,
}
if parent == LUI then
prototype.Module = parent.Module
prototype.Namespace = parent.Namespace
end
return prototype
end
-- LUI:Module(name [, silent]) to get module (if silent is true and the module does not exist, it will not be created)
-- LUI:Module(name [, prototype] [, libs...]) -- to create module or add to module
function LUI:Module(name, prototype, ...)
local i = 1
local module = self:GetModule(name, true)
if module then
if type(prototype) == "string" then
AceAddon:EmbedLibraries(module, prototype, ...)
elseif type(prototype) == "table" then
AceAddon:EmbedLibraries(module, ...)
-- set prototype
local mt = getmetatable(module)
if self.defaultModulePrototype then
mt.__index = setmetatable(prototype, {__index = self.defaultModulePrototype})
else
mt.__index = prototype
end
setmetatable(module, mt)
end
elseif prototype ~= true then -- check silent
if not next(self.modules) then
self:SetDefaultModuleLibraries("LUIDevAPI")
self:SetDefaultModulePrototype(getModulePrototype(self))
end
-- add the defaultPrototype as a metatable to the prototype if it exists
if type(prototype) == "table" and self.defaultModulePrototype then
setmetatable(prototype, {__index = self.defaultModulePrototype})
end
module = self:NewModule(name, prototype, ...)
if self ~= LUI then
module.isNestedModule = true
end
end
return module
end
function LUI:Toggle(state)
if state == nil then
state = not self:IsEnabled()
end
state = state and "Enable" or "Disable"
local success = self[state](self)
if self.db.parent then
self.db.parent.profile.modules[self:GetName()] = self:IsEnabled()
end
return success
end
function LUI:GetDBVar(info)
local value = self.db.profile
local start = self.isNestedModule and 3 or 2
for i=start, #info-1 do
value = value[info[i]]
if type(value) ~= "table" then
error("Error accessing db\nCould not access "..strjoin(".", info[start-1], "db.profile", unpack(info, start, value == nil and i or i+1)).."\ndb layout must be the same as info", 2)
end
end
return value[info[#info]]
end
function LUI:SetDBVar(info, value)
local dbloc = self.db.profile
local start = self.isNestedModule and 3 or 2
for i=start, #info-1 do
dbloc = dbloc[info[i]]
if type(dbloc) ~= "table" then
error("Error accessing db\nCould not access "..strjoin(".", info[start-1], "db.profile", unpack(info, start, dbloc == nil and i or i+1)).."\ndb layout must be the same as info", 2)
end
end
dbloc[info[#info]] = value
end
function LUI:GetDefaultVal(info)
local dbloc = self.db.defaults.profile
local start = self.isNestedModule and 3 or 2
for i=start, #info-1 do
local key = info[i]
if not dbloc[key] then
key = "*"
end
dbloc = dbloc[key]
if type(dbloc) ~= "table" then
error("Error accessing defaults\nCould not access "..strjoin(".", info[start-1], "db.defaults.profile", unpack(info, start, dbloc == nil and i or i+1)).."\ndefaults layout must be the same as info", 2)
end
end
local key = info[#info]
if dbloc[key] == nil then
key = "*"
end
return dbloc[key]
end
local function conflictChecker(...)
for i=1, select("#", ...) do
if IsAddOnLoaded(select(i, ...)) then
return select(i, ...)
end
end
end
function LUI:CheckConflict(...) -- self is module
local conflict = false
if type(self.conflicts) == "table" then
conflict = conflictChecker(unpack(self.conflicts))
else
conflict = conflictChecker((";"):split(self.conflicts))
end
if conflict then
-- disable without calling OnDisable function
AceAddon.statuses[self.name] = false
self:SetEnabledState(false)
-- same for child modules
for name, module in self:IterateModules() do
AceAddon.statuses[module.name] = false
module:SetEnabledState(false)
end
if db.General.ModuleMessages then
LUI:Printf("|cffFF0000%s could not be enabled because of a conflicting addon: %s.", self:GetName(), conflict)
end
return
else
return LUI.hooks[self].OnEnable(self, ...)
end
end
------------------------------------------------------
-- / SCRIPTS / --
------------------------------------------------------
do
local scripts = {}
function LUI:NewScript(name, ...)
local script = {}
scripts[name] = script
local errormsg
for i=1, select("#", ...) do
local lib = select(i, ...)
if type(lib) ~= "string" then
errormsg = "Error generating script: "..name.." - library names must be string values!"
elseif not LibStub(lib, true) then
errormsg = "Error generating script: "..name.." - '"..lib.."' library does not exist!"
elseif type(LibStub(lib).Embed) ~= "function" then
errormsg = "Error generating script: "..name.." - '"..lib.."' library is not Embedable!"
end
if errormsg then
return self:Print(errormsg)
end
LibStub(lib):Embed(script)
end
return script
end
function LUI:FetchScript(name)
return scripts[name]
end
end
------------------------------------------------------
-- / OPTIONS MENU / --
------------------------------------------------------
local options, moduleList, moduleOptions, newModuleOptions, frameOptions = nil, {}, {}, {}, {}
function LUI:MergeOptions(target, source, sort)
if type(target) ~= "table" then target = {} end
for k, v in pairs(target) do
if k == "type" and v ~= "group" then
target = {}
break
end
end
for k, v in pairs(source) do
if type(v) == "table" then
target[k] = self:MergeOptions(target[k], v)
-- Sort modules by name if they don't have an order.
if sort then target[k].order = target[k].order or 10 end
else
target[k] = v
end
end
return target
end
local function getOptions()
if not LUI.options then
LUI.options = {
name = "LUI",
type = "group",
args = {
General = {
name = "General",
order = 1,
type = "group",
childGroups = "tab",
args = {
Welcome = {
name = "Welcome",
type = "group",
order = 1,
args = {
IntroImage = {
order = 1,
image = [[Interface\AddOns\LUI\media\textures\logo]],
imageWidth = 512,
width = "full",
imageHeight = 128,
imageCoords = { 0, 1, 0, 1 },
type = "description",
name = " ",
},
empty5 = {
name = " ",
width = "full",
type = "description",
order = 2,
},
IntroText = {
order = 3,
width = "full",
type = "description",
name = L["Welcome to LUI v3"].."\n\n"..L["Please read the FAQ"].."\n\n\n",
},
VerText = {
order = 4,
width = "full",
type = "description",
fontSize = "large",
name = function()
local version, alpha, git = strsplit("-", LUI.Rev)
if not version then
return "Version: "..GetAddOnMetadata(addonname, "Version")
elseif not alpha then
return "Version: "..version
else
return format("Version: %s Alpha %s", version, alpha)
end
end,
},
},
},
Settings = {
name = "Settings",
type = "group",
order = 2,
args = {
header2 = {
name = "General Options",
type = "header",
order = 1,
},
empty5 = {
name = " ",
width = "full",
type = "description",
order = 2,
},
empty512s = {
name = " ",
width = "full",
type = "description",
order = 3,
},
AlwaysShowDesc = {
order = 4,
width = "full",
type = "description",
name = "LUI will show automatically all Frames which were shown after logging out.\n\nYou can set some Rules here that LUI should always show some Frames regardless of how you are logging off."
},
empty6 = {
name = " ",
width = "full",
type = "description",
order = 5,
},
alwaysShowMinimap = {
name = "Show Minimap",
desc = "Whether you want to show the Minimap by entering World or not.\n",
type = "toggle",
get = function() return LUI:Module("Panels").db.profile.Minimap.AlwaysShow end,
set = function()
local a = LUI:Module("Panels").db.profile.Minimap
a.AlwaysShow = not a.AlwaysShow
end,
order = 6,
},
alwaysShowChat = {
name = "Show Chat",
desc = "Whether you want to show the Chat Panel by entering World or not.\n",
type = "toggle",
get = function() return LUI:Module("Panels").db.profile.Chat.AlwaysShow end,
set = function()
local a = LUI:Module("Panels").db.profile.Chat
a.AlwaysShow = not a.AlwaysShow
end,
order = 7,
},
alwaysShowOmen = {
name = "Show TPS",
desc = "Whether you want to show your TPS Panel by entering World or not.\n",
type = "toggle",
get = function() return LUI:Module("Panels").db.profile.Tps.AlwaysShow end,
set = function()
local a = LUI:Module("Panels").db.profile.Tps
a.AlwaysShow = not a.AlwaysShow
end,
order = 8,
},
alwaysShowRecount = {
name = "Show DPS",
desc = "Whether you want to show your DPS Panel by entering World or not.\n",
type = "toggle",
get = function() return LUI:Module("Panels").db.profile.Dps.AlwaysShow end,
set = function()
local a = LUI:Module("Panels").db.profile.Dps
a.AlwaysShow = not a.AlwaysShow
end,
order = 9,
},
alwaysShowPlexus = {
name = "Show Raid",
desc = "Whether you want to show your Raid Panel by entering World or not.\n",
type = "toggle",
get = function() return LUI:Module("Panels").db.profile.Raid.AlwaysShow end,
set = function()
local a = LUI:Module("Panels").db.profile.Raid
a.AlwaysShow = not a.AlwaysShow
end,
order = 10,
},
alwaysShowMicroMenu = {
name = "Show MicroMenu",
desc = "Whether you want to show the Micromenu by entering World or not.\n",
type = "toggle",
get = function() return LUI:Module("Panels").db.profile.MicroMenu.AlwaysShow end,
set = function()
local a = LUI:Module("Panels").db.profile.MicroMenu
a.AlwaysShow = not a.AlwaysShow
end,
order = 12,
},
empty22225 = {
name = " ",
width = "full",
type = "description",
order = 13,
},
header90 = {
name = "Misc Options",
type = "header",
order = 30,
},
BlizzFrameScale = {
name = "Blizzard Frame Scale",
desc = "Set the scale of the Blizzard Frames.\nEx: CharacterFrame, SpellBookFrame, etc...",
type = "range",
min = 0.5,
max = 2.0,
step = 0.05,
isPercent = true,
width = "double",
get = function() return db.General.BlizzFrameScale end,
set = function(info, value)
if scale == nil or scale == "" then scale = 1 end
db.General.BlizzFrameScale = value
LUI:FetchScript("BlizzScale"):ApplyBlizzScaling()
end,
order = 32,
},
empty3 = {
name = " ",
width = "full",
type = "description",
order = 33,
},
BlockErrors = {
name = "Hide Blizzard Error Messages",
desc = "Hide Blizzard Errors like: Not enough energy or Not enough Mana",
type = "toggle",
width = "full",
get = function() return db.General.HideErrors end,
set = function(info, value)
db.General.HideErrors = value
LUI:FetchScript("ErrorHider"):ErrorMessageHandler()
end,
order = 34,
},
HideTalentSpam = {
name = "Hide Talent Change Spam",
desc = "Filters out the chat window spam that occurs when you switch specs",
type = "toggle",