-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEPGP.lua
2785 lines (2391 loc) · 146 KB
/
EPGP.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
if WOTLKEPGP == nil then WOTLKEPGP = {} end
WOTLKEPGP.Events = {}
WOTLKEPGP.Version = 42
local AddOnName = "Wrath EPGP"
local UpdateFrame, EventFrame, EPGPOptionsPanel = nil, nil, nil
local EPGPUserFrame, UserScrollPanel = nil, nil
local EPGPAdminFrame, AdminScrollPanel = nil, nil
local EPGPLootFrame, LootScrollPanel = nil, nil
local EPGPChangeLogFrame, ChangeLogScrollPanel = nil, nil
local adminPlayerFrames, userPlayerFrames = {}, {}
local EPGPActiveLootItems, LootItemFrames = {}, {}
local ChangeLogsFrames = {}
local sortCol, sortDir, filteredPlayers = nil, "Asc", nil
local addonLoaded, variablesLoaded = false, false
local FilterButtonFrame = nil
local FilterRaid = false
local DecayConfirmWindow = nil
local ReceiveSyncFrame = nil
local NewPlayers = {}
local NumPlayersInSync = 0
local CurrentSyncTicker = nil
local SyncQueue = {}
if WOTLKEPGPShowAdminView == nil then WOTLKEPGPShowAdminView = false end
if EPGPChangeLog == nil then EPGPChangeLog = {} end
local classInfo =
{
[1] = {ClassName = "Warrior", ClassColor = "FFC69B6D"},
[2] = {ClassName = "Paladin", ClassColor = "FFF48CBA"},
[3] = {ClassName = "Hunter", ClassColor = "FFAAD372"},
[4] = {ClassName = "Rogue", ClassColor = "FFFFF468"},
[5] = {ClassName = "Priest", ClassColor = "FFFFFFFF"},
[7] = {ClassName = "Shaman", ClassColor = "FF0070DD"},
[8] = {ClassName = "Mage", ClassColor = "FF3FC7EB"},
[9] = {ClassName = "Warlock", ClassColor = "FF8788EE"},
[11] = {ClassName = "Druid", ClassColor = "FFFF7C0A"},
}
local filteredClasses =
{
[1] = false,
[2] = false,
[3] = false,
[4] = false,
[5] = false,
[7] = false,
[8] = false,
[9] = false,
[11] = false,
}
function WOTLKEPGP:OnLoad()
C_ChatInfo.RegisterAddonMessagePrefix("WOTLKEPGP")
C_ChatInfo.RegisterAddonMessagePrefix("WOTLKEPGPItem")
C_ChatInfo.RegisterAddonMessagePrefix("WOTLKEPGPRoll")
C_ChatInfo.RegisterAddonMessagePrefix("WOTLKEPGPVersion")
EventFrame = CreateFrame("Frame", nil, UIParent)
WOTLKEPGP:RegisterEvents("ADDON_LOADED", function(...) WOTLKEPGP.Events:AddonLoaded(...) end)
WOTLKEPGP:RegisterEvents("VARIABLES_LOADED", function(...) WOTLKEPGP.Events:VariablesLoaded(...) end)
WOTLKEPGP:RegisterEvents("CHAT_MSG_ADDON", function(...) WOTLKEPGP.Events:ChatMsgAddon(...) end)
WOTLKEPGP:RegisterEvents("GROUP_ROSTER_UPDATE", function(...) WOTLKEPGP.Events:GroupRosterUpdate(...) end)
WOTLKEPGP:RegisterEvents("LOOT_OPENED", function(...) WOTLKEPGP.Events:LootOpened(...) end)
EventFrame:SetScript("OnEvent", function(...) WOTLKEPGP:OnEvent(...) end)
UpdateFrame = CreateFrame("Frame", nil, UIParent, "BackdropTemplate")
UpdateFrame:SetPoint("CENTER", 0, 250)
UpdateFrame:SetSize(400, 100)
UpdateFrame:SetBackdrop({
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize = 12,
insets = { left = 1, right = 1, top = 1, bottom = 1 },
})
UpdateFrame:SetBackdropColor(0.25, 0.25, 0.25, 0.80)
UpdateFrame.header = UpdateFrame:CreateFontString("UpdateFrame", "ARTWORK", "GameFontNormalHuge")
UpdateFrame.header:SetPoint("TOP", 0, -10)
UpdateFrame.header:SetText("|cFFFF0000" .. AddOnName .. " out of date!|r")
UpdateFrame.text = UpdateFrame:CreateFontString("UpdateFrame", "ARTWORK", "GameFontNormal")
UpdateFrame.text:SetPoint("TOP", 0, -30)
UpdateFrame.text:SetText("-----")
local UpdateFrameCloseButton = CreateFrame("Button", nil, UpdateFrame, "UIPanelCloseButton")
UpdateFrameCloseButton:SetWidth(25)
UpdateFrameCloseButton:SetHeight(25)
UpdateFrameCloseButton:SetPoint("TOPRIGHT", UpdateFrame, "TOPRIGHT", 2, 2)
UpdateFrameCloseButton:SetScript("OnClick", function() UpdateFrame:Hide() end )
UpdateFrame:Hide()
EPGPOptionsPanel = CreateFrame("FRAME", nil)
EPGPOptionsPanel.name = "Wrath EPGP"
InterfaceOptions_AddCategory(EPGPOptionsPanel)
EPGPOptionsPanel.header = EPGPOptionsPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalHuge")
EPGPOptionsPanel.header:SetPoint("TOP", 0, -10)
EPGPOptionsPanel.header:SetText("|cFF00FFFFWotLK EPGP Options!|r")
EPGPOptionsPanel.subheader = EPGPOptionsPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
EPGPOptionsPanel.subheader:SetPoint("TOP", 0, -35)
EPGPOptionsPanel.subheader:SetText("|cFF00FFFFBy AzerPUG and Punch&Pie!|r")
EPGPOptionsPanel.adminsEditBoxText = EPGPOptionsPanel:CreateFontString(nil, "ARTWORK", "GameFontNormal")
EPGPOptionsPanel.adminsEditBoxText:SetSize(200, 25)
EPGPOptionsPanel.adminsEditBoxText:SetPoint("TOPLEFT", 25, -100)
EPGPOptionsPanel.adminsEditBoxText:SetText("Add Admins for Sync\n(multi-names split by a space)")
EPGPOptionsPanel.adminsEditBox = CreateFrame("EditBox", nil, EPGPOptionsPanel, "InputBoxTemplate")
EPGPOptionsPanel.adminsEditBox:SetSize(200, 25)
EPGPOptionsPanel.adminsEditBox:SetPoint("TOP", EPGPOptionsPanel.adminsEditBoxText, "BOTTOM", 0, -5)
EPGPOptionsPanel.adminsEditBox:SetAutoFocus(false)
EPGPOptionsPanel.adminsEditBox:SetScript("OnEditFocusLost", function() WOTLKEPGPAdminList = WOTLKEPGP:splitCharacterNames(EPGPOptionsPanel.adminsEditBox:GetText()) end)
EPGPOptionsPanel.showAdminViewCheckButton = CreateFrame("CheckButton", "ShowAdminViewCheckButton", EPGPOptionsPanel, "ChatConfigCheckButtonTemplate");
EPGPOptionsPanel.showAdminViewCheckButton:SetPoint("TOP", EPGPOptionsPanel.adminsEditBox, "BOTTOMLEFT", 0, -20);
EPGPOptionsPanel.showAdminViewCheckButton:SetScript("OnClick", function()
WOTLKEPGPShowAdminView = EPGPOptionsPanel.showAdminViewCheckButton:GetChecked()
if WOTLKEPGPShowAdminView == true then
EPGPUserFrame:Hide()
EPGPAdminFrame:Show()
elseif WOTLKEPGPShowAdminView == false then
EPGPAdminFrame:Hide()
EPGPUserFrame:Show()
end
WOTLKEPGP:FilterPlayers()
end)
ShowAdminViewCheckButtonText:SetText("Show Admin View")
EPGPOptionsPanel.CalculationsText = EPGPOptionsPanel:CreateFontString(nil, "ARTWORK", "GameFontNormal")
EPGPOptionsPanel.CalculationsText:SetSize(200, 50)
EPGPOptionsPanel.CalculationsText:SetJustifyH("LEFT")
EPGPOptionsPanel.CalculationsText:SetPoint("TOPLEFT", EPGPOptionsPanel.showAdminViewCheckButton, "BOTTOMLEFT", 0, -20)
EPGPOptionsPanel.CalculationsText:SetText("OffSet for PR Calculations.\nUsually: PR = EP / GP.\n\nCurrent Calculations:")
EPGPOptionsPanel.CalculationsLabel = EPGPOptionsPanel:CreateFontString(nil, "ARTWORK", "GameFontNormal")
EPGPOptionsPanel.CalculationsLabel:SetSize(200, 25)
EPGPOptionsPanel.CalculationsLabel:SetJustifyH("LEFT")
EPGPOptionsPanel.CalculationsLabel:SetPoint("TOPLEFT", EPGPOptionsPanel.CalculationsText, "BOTTOMLEFT", 0, 5)
EPGPOptionsPanel.EPOffSetText = EPGPOptionsPanel:CreateFontString(nil, "ARTWORK", "GameFontNormal")
EPGPOptionsPanel.EPOffSetText:SetSize(75, 25)
EPGPOptionsPanel.EPOffSetText:SetJustifyH("LEFT")
EPGPOptionsPanel.EPOffSetText:SetPoint("TOPLEFT", EPGPOptionsPanel.CalculationsLabel, "BOTTOMLEFT", 0, -10)
EPGPOptionsPanel.EPOffSetText:SetText("EP OffSet:")
EPGPOptionsPanel.EPOffSet = CreateFrame("EditBox", nil, EPGPOptionsPanel, "InputBoxTemplate")
EPGPOptionsPanel.EPOffSet:SetSize(50, 25)
EPGPOptionsPanel.EPOffSet:SetPoint("LEFT", EPGPOptionsPanel.EPOffSetText, "RIGHT", 0, 0)
EPGPOptionsPanel.EPOffSet:SetAutoFocus(false)
EPGPOptionsPanel.EPOffSet:SetScript("OnEditFocusLost",
function()
WOTLKEPGP:ChangePRCalculations()
WOTLKEPGP:SavePRCalculations()
end)
EPGPOptionsPanel.GPOffSetText = EPGPOptionsPanel:CreateFontString(nil, "ARTWORK", "GameFontNormal")
EPGPOptionsPanel.GPOffSetText:SetSize(75, 25)
EPGPOptionsPanel.GPOffSetText:SetJustifyH("LEFT")
EPGPOptionsPanel.GPOffSetText:SetPoint("TOPLEFT", EPGPOptionsPanel.EPOffSetText, "BOTTOMLEFT", 0, -10)
EPGPOptionsPanel.GPOffSetText:SetText("GP OffSet:")
EPGPOptionsPanel.GPOffSet = CreateFrame("EditBox", nil, EPGPOptionsPanel, "InputBoxTemplate")
EPGPOptionsPanel.GPOffSet:SetSize(50, 25)
EPGPOptionsPanel.GPOffSet:SetPoint("LEFT", EPGPOptionsPanel.GPOffSetText, "RIGHT", 0, 0)
EPGPOptionsPanel.GPOffSet:SetAutoFocus(false)
EPGPOptionsPanel.GPOffSet:SetScript("OnEditFocusLost",
function()
WOTLKEPGP:ChangePRCalculations()
WOTLKEPGP:SavePRCalculations()
end)
WOTLKEPGP:ChangePRCalculations()
EPGPOptionsPanel.EPMinimumText = EPGPOptionsPanel:CreateFontString(nil, "ARTWORK", "GameFontNormal")
EPGPOptionsPanel.EPMinimumText:SetSize(90, 25)
EPGPOptionsPanel.EPMinimumText:SetJustifyH("LEFT")
EPGPOptionsPanel.EPMinimumText:SetPoint("LEFT", EPGPOptionsPanel.EPOffSet, "RIGHT", 75, 0)
EPGPOptionsPanel.EPMinimumText:SetText("EP Minimum:")
EPGPOptionsPanel.EPMinimum = CreateFrame("EditBox", nil, EPGPOptionsPanel, "InputBoxTemplate")
EPGPOptionsPanel.EPMinimum:SetSize(50, 25)
EPGPOptionsPanel.EPMinimum:SetPoint("LEFT", EPGPOptionsPanel.EPMinimumText, "RIGHT", 0, 0)
EPGPOptionsPanel.EPMinimum:SetAutoFocus(false)
EPGPOptionsPanel.EPMinimum:SetScript("OnEditFocusLost",
function()
WOTLKEPGPMinimums.EP = EPGPOptionsPanel.EPMinimum:GetText()
end)
EPGPOptionsPanel.GPMinimumText = EPGPOptionsPanel:CreateFontString(nil, "ARTWORK", "GameFontNormal")
EPGPOptionsPanel.GPMinimumText:SetSize(90, 25)
EPGPOptionsPanel.GPMinimumText:SetJustifyH("LEFT")
EPGPOptionsPanel.GPMinimumText:SetPoint("TOPLEFT", EPGPOptionsPanel.EPMinimumText, "BOTTOMLEFT", 0, -10)
EPGPOptionsPanel.GPMinimumText:SetText("GP Minimum:")
EPGPOptionsPanel.GPMinimum = CreateFrame("EditBox", nil, EPGPOptionsPanel, "InputBoxTemplate")
EPGPOptionsPanel.GPMinimum:SetSize(50, 25)
EPGPOptionsPanel.GPMinimum:SetPoint("LEFT", EPGPOptionsPanel.GPMinimumText, "RIGHT", 0, 0)
EPGPOptionsPanel.GPMinimum:SetAutoFocus(false)
EPGPOptionsPanel.GPMinimum:SetScript("OnEditFocusLost",
function()
WOTLKEPGPMinimums.GP = EPGPOptionsPanel.GPMinimum:GetText()
end)
EPGPOptionsPanel.EPDecayText = EPGPOptionsPanel:CreateFontString(nil, "ARTWORK", "GameFontNormal")
EPGPOptionsPanel.EPDecayText:SetSize(80, 25)
EPGPOptionsPanel.EPDecayText:SetJustifyH("LEFT")
EPGPOptionsPanel.EPDecayText:SetPoint("LEFT", EPGPOptionsPanel.EPMinimum, "RIGHT", 75, 0)
EPGPOptionsPanel.EPDecayText:SetText("EP Decay %:")
EPGPOptionsPanel.EPDecay = CreateFrame("EditBox", nil, EPGPOptionsPanel, "InputBoxTemplate")
EPGPOptionsPanel.EPDecay:SetSize(50, 25)
EPGPOptionsPanel.EPDecay:SetPoint("LEFT", EPGPOptionsPanel.EPDecayText, "RIGHT", 0, 0)
EPGPOptionsPanel.EPDecay:SetAutoFocus(false)
EPGPOptionsPanel.EPDecay:SetScript("OnEditFocusLost",
function()
WOTLKEPGPDecay.EP = EPGPOptionsPanel.EPDecay:GetText()
DecayConfirmWindow.WarningText2:SetText(string.format("|cFFFF0000EP Decay: %d%%\nGP Decay: %d%%|r", WOTLKEPGPDecay.EP, WOTLKEPGPDecay.GP))
end)
EPGPOptionsPanel.GPDecayText = EPGPOptionsPanel:CreateFontString(nil, "ARTWORK", "GameFontNormal")
EPGPOptionsPanel.GPDecayText:SetSize(80, 25)
EPGPOptionsPanel.GPDecayText:SetJustifyH("LEFT")
EPGPOptionsPanel.GPDecayText:SetPoint("TOPLEFT", EPGPOptionsPanel.EPDecayText, "BOTTOMLEFT", 0, -10)
EPGPOptionsPanel.GPDecayText:SetText("GP Decay %:")
EPGPOptionsPanel.GPDecay = CreateFrame("EditBox", nil, EPGPOptionsPanel, "InputBoxTemplate")
EPGPOptionsPanel.GPDecay:SetSize(50, 25)
EPGPOptionsPanel.GPDecay:SetPoint("LEFT", EPGPOptionsPanel.GPDecayText, "RIGHT", 0, 0)
EPGPOptionsPanel.GPDecay:SetAutoFocus(false)
EPGPOptionsPanel.GPDecay:SetScript("OnEditFocusLost",
function()
WOTLKEPGPDecay.GP = EPGPOptionsPanel.GPDecay:GetText()
DecayConfirmWindow.WarningText2:SetText(string.format("|cFFFF0000EP Decay: %d%%\nGP Decay: %d%%|r", WOTLKEPGPDecay.EP, WOTLKEPGPDecay.GP))
end)
ReceiveSyncFrame = CreateFrame("Frame", nil, UIParent, "BackdropTemplate")
ReceiveSyncFrame:SetPoint("CENTER", 0, 250)
ReceiveSyncFrame:SetSize(300, 80)
ReceiveSyncFrame:SetBackdrop({
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize = 12,
insets = { left = 1, right = 1, top = 1, bottom = 1 },
})
ReceiveSyncFrame:SetBackdropColor(0.25, 0.25, 0.25, 0.80)
ReceiveSyncFrame.Header = ReceiveSyncFrame:CreateFontString("ReceiveSyncFrame", "ARTWORK", "GameFontNormalHuge")
ReceiveSyncFrame.Header:SetPoint("TOP", 0, -10)
ReceiveSyncFrame.Header:SetText("|cFF00FFFF" .. AddOnName .. " receiving sync.|r")
ReceiveSyncFrame.SubHeader = ReceiveSyncFrame:CreateFontString("ReceiveSyncFrame", "ARTWORK", "GameFontNormalLarge")
ReceiveSyncFrame.SubHeader:SetPoint("TOP", ReceiveSyncFrame.Header, "BOTTOM", 0, -5)
ReceiveSyncFrame.SubHeader:SetText("|cFF00FFFFAdmin: %s|r")
ReceiveSyncFrame.Bar = CreateFrame("StatusBar", nil, ReceiveSyncFrame)
ReceiveSyncFrame.Bar:SetSize(ReceiveSyncFrame:GetWidth() - 20, 18)
ReceiveSyncFrame.Bar:SetStatusBarTexture("Interface\\TARGETINGFRAME\\UI-StatusBar")
ReceiveSyncFrame.Bar:SetPoint("TOP", ReceiveSyncFrame.SubHeader, "BOTTOM", 0, -5)
ReceiveSyncFrame.Bar:SetMinMaxValues(0, 100)
ReceiveSyncFrame.Bar:SetValue(0)
ReceiveSyncFrame.Bar.SyncProgress = ReceiveSyncFrame.Bar:CreateFontString(nil, "ARTWORK", "GameFontNormal")
ReceiveSyncFrame.Bar.SyncProgress:SetSize(50, 16)
ReceiveSyncFrame.Bar.SyncProgress:SetPoint("CENTER", 0, -1)
ReceiveSyncFrame.Bar.SyncProgress:SetText("0/100")
ReceiveSyncFrame.Bar.BG = ReceiveSyncFrame.Bar:CreateTexture(nil, "BACKGROUND")
ReceiveSyncFrame.Bar.BG:SetTexture("Interface\\TARGETINGFRAME\\UI-StatusBar")
ReceiveSyncFrame.Bar.BG:SetAllPoints(true)
ReceiveSyncFrame.Bar.BG:SetVertexColor(1, 0, 0)
ReceiveSyncFrame.Bar:SetStatusBarColor(0, 0.75, 1)
ReceiveSyncFrame.CloseButton = CreateFrame("Button", nil, ReceiveSyncFrame, "UIPanelCloseButton")
ReceiveSyncFrame.CloseButton:SetSize(24, 24)
ReceiveSyncFrame.CloseButton:SetPoint("TOPRIGHT", ReceiveSyncFrame, "TOPRIGHT", -3, -3)
ReceiveSyncFrame.CloseButton:SetScript("OnClick", function() ReceiveSyncFrame:Hide() end)
ReceiveSyncFrame:Hide()
WOTLKEPGP:AddTooltipScript()
WOTLKEPGP:CreateLootFrame()
WOTLKEPGP:CreateLogFrame()
EPGPOptionsPanel:SetScript("OnShow",
function()
WOTLKEPGP:ChangePRCalculations()
local adminsToSet = ""
if WOTLKEPGPAdminList ~= nil and #WOTLKEPGPAdminList > 0 then
for i = 1, #WOTLKEPGPAdminList do
adminsToSet = WOTLKEPGPAdminList[i] .. " "
end
EPGPOptionsPanel.adminsEditBox:SetText(adminsToSet)
end
end)
EPGPOptionsPanel:Hide()
end
function WOTLKEPGP:ChangePRCalculations()
local EPOffSet = EPGPOptionsPanel.EPOffSet:GetNumber()
local GPOffSet = EPGPOptionsPanel.GPOffSet:GetNumber()
if EPOffSet > 0 then EPOffSet = string.format("+%d", EPOffSet) elseif EPOffSet == 0 then EPOffSet = "" end
if GPOffSet > 0 then GPOffSet = string.format("+%d", GPOffSet) elseif GPOffSet == 0 then GPOffSet = "" end
local CalcString = string.format("|cFF00FFFFPR = (EP%s) / (GP%s)|r", tostring(EPOffSet), tostring(GPOffSet))
EPGPOptionsPanel.CalculationsLabel:SetText(CalcString)
end
function WOTLKEPGP:SavePRCalculations()
local EPOffSet = EPGPOptionsPanel.EPOffSet:GetNumber()
local GPOffSet = EPGPOptionsPanel.GPOffSet:GetNumber()
WOTLKEPGPPRCalc = {tostring(EPOffSet), tostring(GPOffSet)}
end
function WOTLKEPGP:CreateLogFrame()
EPGPChangeLogFrame = CreateFrame("Frame", nil, UIParent)
EPGPChangeLogFrame:SetPoint("CENTER", 0, 0)
EPGPChangeLogFrame:SetSize(670, 400)
EPGPChangeLogFrame:EnableMouse(true)
EPGPChangeLogFrame:SetMovable(true)
EPGPChangeLogFrame:RegisterForDrag("LeftButton")
EPGPChangeLogFrame:SetScript("OnDragStart", EPGPChangeLogFrame.StartMoving)
EPGPChangeLogFrame:SetScript("OnDragStop", EPGPChangeLogFrame.StopMovingOrSizing)
EPGPChangeLogFrame.TopLeftBG = CreateFrame("Frame", nil, EPGPChangeLogFrame, "BackdropTemplate")
EPGPChangeLogFrame.TopBG1 = CreateFrame("Frame", nil, EPGPChangeLogFrame, "BackdropTemplate")
EPGPChangeLogFrame.TopBG2 = CreateFrame("Frame", nil, EPGPChangeLogFrame, "BackdropTemplate")
EPGPChangeLogFrame.TopRightBG = CreateFrame("Frame", nil, EPGPChangeLogFrame, "BackdropTemplate")
EPGPChangeLogFrame.BotLeftBG = CreateFrame("Frame", nil, EPGPChangeLogFrame, "BackdropTemplate")
EPGPChangeLogFrame.BotBG1 = CreateFrame("Frame", nil, EPGPChangeLogFrame, "BackdropTemplate")
EPGPChangeLogFrame.BotBG2 = CreateFrame("Frame", nil, EPGPChangeLogFrame, "BackdropTemplate")
EPGPChangeLogFrame.BotRightBG = CreateFrame("Frame", nil, EPGPChangeLogFrame, "BackdropTemplate")
EPGPChangeLogFrame.TopLeftBG :SetSize(200, EPGPChangeLogFrame:GetHeight() / 2)
EPGPChangeLogFrame.TopBG1 :SetSize(200, EPGPChangeLogFrame:GetHeight() / 2)
EPGPChangeLogFrame.TopBG2 :SetSize(200, EPGPChangeLogFrame:GetHeight() / 2)
EPGPChangeLogFrame.TopRightBG:SetSize(100, EPGPChangeLogFrame:GetHeight() / 2)
EPGPChangeLogFrame.BotLeftBG :SetSize(200, EPGPChangeLogFrame:GetHeight() / 2)
EPGPChangeLogFrame.BotBG1 :SetSize(200, EPGPChangeLogFrame:GetHeight() / 2)
EPGPChangeLogFrame.BotBG2 :SetSize(200, EPGPChangeLogFrame:GetHeight() / 2)
EPGPChangeLogFrame.BotRightBG:SetSize(100, EPGPChangeLogFrame:GetHeight() / 2)
EPGPChangeLogFrame.TopLeftBG :SetPoint("TOPLEFT", 0, 0)
EPGPChangeLogFrame.TopBG1 :SetPoint("LEFT", EPGPChangeLogFrame.TopLeftBG, "RIGHT", 0, 0)
EPGPChangeLogFrame.TopBG2 :SetPoint("LEFT", EPGPChangeLogFrame.TopBG1, "RIGHT", 0, 0)
EPGPChangeLogFrame.TopRightBG:SetPoint("LEFT", EPGPChangeLogFrame.TopBG2, "RIGHT", 0, 0)
EPGPChangeLogFrame.BotLeftBG :SetPoint("TOP", EPGPChangeLogFrame.TopLeftBG, "BOTTOM", 0, 0)
EPGPChangeLogFrame.BotBG1 :SetPoint("TOP", EPGPChangeLogFrame.TopBG1, "BOTTOM", 0, 0)
EPGPChangeLogFrame.BotBG2 :SetPoint("TOP", EPGPChangeLogFrame.TopBG2, "BOTTOM", 0, 0)
EPGPChangeLogFrame.BotRightBG:SetPoint("TOP", EPGPChangeLogFrame.TopRightBG, "BOTTOM", 0, 0)
EPGPChangeLogFrame.TopLeftBG :SetBackdrop({bgFile = "Interface/HELPFRAME/HelpFrame-TOPLEFT"})
EPGPChangeLogFrame.TopBG1 :SetBackdrop({bgFile = "Interface/HELPFRAME/HelpFrame-TOP"})
EPGPChangeLogFrame.TopBG2 :SetBackdrop({bgFile = "Interface/HELPFRAME/HelpFrame-TOP"})
EPGPChangeLogFrame.TopRightBG:SetBackdrop({bgFile = "Interface/HELPFRAME/HelpFrame-TOPRIGHT"})
EPGPChangeLogFrame.BotLeftBG :SetBackdrop({bgFile = "Interface/HELPFRAME/HelpFrame-BOTLEFT"})
EPGPChangeLogFrame.BotBG1 :SetBackdrop({bgFile = "Interface/HELPFRAME/HelpFrame-BOTTOM"})
EPGPChangeLogFrame.BotBG2 :SetBackdrop({bgFile = "Interface/HELPFRAME/HelpFrame-BOTTOM"})
EPGPChangeLogFrame.BotRightBG:SetBackdrop({bgFile = "Interface/HELPFRAME/HelpFrame-BOTRIGHT"})
EPGPChangeLogFrame.Title = CreateFrame("FRAME", nil, EPGPChangeLogFrame)
EPGPChangeLogFrame.Title:SetSize(300, 65)
EPGPChangeLogFrame.Title:SetPoint("TOP", EPGPChangeLogFrame, "TOP", 0, EPGPChangeLogFrame.Title:GetHeight() * 0.35 - 4)
EPGPChangeLogFrame.Title:SetFrameStrata("HIGH")
EPGPChangeLogFrame.Title.Text = EPGPChangeLogFrame.Title:CreateFontString("EPGPChangeLogFrame", "ARTWORK", "GameFontNormalLarge")
EPGPChangeLogFrame.Title.Text:SetPoint("TOP", 0, -EPGPChangeLogFrame.Title:GetHeight() * 0.25 + 3)
EPGPChangeLogFrame.Title.Text:SetText(AddOnName .. " - v" .. WOTLKEPGP.Version)
EPGPChangeLogFrame.Title.Texture = EPGPChangeLogFrame.Title:CreateTexture(nil, "BACKGROUND")
EPGPChangeLogFrame.Title.Texture:SetAllPoints()
EPGPChangeLogFrame.Title.Texture:SetTexture("Interface/DialogFrame/UI-DialogBox-Header")
EPGPChangeLogFrame.ExtraBG = CreateFrame("FRAME", nil, EPGPChangeLogFrame, "BackdropTemplate")
EPGPChangeLogFrame.ExtraBG:SetSize(EPGPChangeLogFrame:GetWidth() - 25, EPGPChangeLogFrame:GetHeight() - 79)
EPGPChangeLogFrame.ExtraBG:SetPoint("TOP", 2, -41)
EPGPChangeLogFrame.ExtraBG:SetFrameStrata("HIGH")
EPGPChangeLogFrame.ExtraBG:SetBackdrop({
bgFile = "Interface/BankFrame/Bank-Background",
tile = true,
tileSize = 100;
})
EPGPChangeLogFrame.ExtraBG:SetBackdropColor(0.25, 0.25, 0.25, 1)
local scrollFrame = CreateFrame("ScrollFrame", nil, EPGPChangeLogFrame, "UIPanelScrollFrameTemplate BackdropTemplate");
scrollFrame:SetSize(EPGPChangeLogFrame:GetWidth() - 45, EPGPChangeLogFrame:GetHeight() - 77)
scrollFrame:SetPoint("TOP", -11, -40)
scrollFrame:SetFrameStrata("HIGH")
ChangeLogScrollPanel = CreateFrame("Frame")
ChangeLogScrollPanel:SetSize(scrollFrame:GetWidth(), 300)
ChangeLogScrollPanel:SetPoint("TOP")
EPGPChangeLogFrame.Header = CreateFrame("Frame", nil, EPGPChangeLogFrame, "BackdropTemplate")
EPGPChangeLogFrame.Header:SetPoint("TOP", -11, -20)
EPGPChangeLogFrame.Header:SetSize(ChangeLogScrollPanel:GetWidth(), 50)
EPGPChangeLogFrame.Header.Name = CreateFrame("Frame", nil, EPGPChangeLogFrame.Header, "BackdropTemplate")
EPGPChangeLogFrame.Header.Name:SetSize(100, 24)
EPGPChangeLogFrame.Header.Name:SetPoint("TOPLEFT", 2, 0)
EPGPChangeLogFrame.Header.Name:SetBackdrop({
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize = 10,
insets = {left = 2, right = 2, top = 2, bottom = 2},
})
EPGPChangeLogFrame.Header.Name:SetBackdropColor(1, 1, 1, 1)
EPGPChangeLogFrame.Header.Name.Text = EPGPChangeLogFrame.Header.Name:CreateFontString("EPGPChangeLogFrame.Header.Name.Text", "ARTWORK", "GameFontNormal")
EPGPChangeLogFrame.Header.Name.Text:SetSize(EPGPChangeLogFrame.Header.Name:GetWidth(), EPGPChangeLogFrame.Header.Name:GetHeight())
EPGPChangeLogFrame.Header.Name.Text:SetPoint("CENTER", 0, 0)
EPGPChangeLogFrame.Header.Name.Text:SetTextColor(1, 1, 1, 1)
EPGPChangeLogFrame.Header.Name.Text:SetText("Name")
EPGPChangeLogFrame.Header.Points = CreateFrame("Frame", nil, EPGPChangeLogFrame.Header, "BackdropTemplate")
EPGPChangeLogFrame.Header.Points:SetSize(50, 24)
EPGPChangeLogFrame.Header.Points:SetPoint("BOTTOMLEFT", EPGPChangeLogFrame.Header.Name, "BOTTOMRIGHT", -4, 0)
EPGPChangeLogFrame.Header.Points:SetBackdrop({
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize = 10,
insets = {left = 2, right = 2, top = 2, bottom = 2},
})
EPGPChangeLogFrame.Header.Points:SetBackdropColor(1, 1, 1, 1)
EPGPChangeLogFrame.Header.Points.Text = EPGPChangeLogFrame.Header.Points:CreateFontString("EPGPChangeLogFrame.Header.Points.Text", "ARTWORK", "GameFontNormal")
EPGPChangeLogFrame.Header.Points.Text:SetSize(EPGPChangeLogFrame.Header.Points:GetWidth(), EPGPChangeLogFrame.Header.Points:GetHeight())
EPGPChangeLogFrame.Header.Points.Text:SetPoint("CENTER", 0, 0)
EPGPChangeLogFrame.Header.Points.Text:SetTextColor(1, 1, 1, 1)
EPGPChangeLogFrame.Header.Points.Text:SetText("Points")
EPGPChangeLogFrame.Header.Amount = CreateFrame("Frame", nil, EPGPChangeLogFrame.Header, "BackdropTemplate")
EPGPChangeLogFrame.Header.Amount:SetSize(75, 24)
EPGPChangeLogFrame.Header.Amount:SetPoint("BOTTOMLEFT", EPGPChangeLogFrame.Header.Points, "BOTTOMRIGHT", -4, 0)
EPGPChangeLogFrame.Header.Amount:SetBackdrop({
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize = 10,
insets = {left = 2, right = 2, top = 2, bottom = 2},
})
EPGPChangeLogFrame.Header.Amount:SetBackdropColor(1, 1, 1, 1)
EPGPChangeLogFrame.Header.Amount.Text = EPGPChangeLogFrame.Header.Amount:CreateFontString("EPGPChangeLogFrame.Header.Amount.Text", "ARTWORK", "GameFontNormal")
EPGPChangeLogFrame.Header.Amount.Text:SetSize(EPGPChangeLogFrame.Header.Amount:GetWidth(), EPGPChangeLogFrame.Header.Amount:GetHeight())
EPGPChangeLogFrame.Header.Amount.Text:SetPoint("CENTER", 0, 0)
EPGPChangeLogFrame.Header.Amount.Text:SetTextColor(1, 1, 1, 1)
EPGPChangeLogFrame.Header.Amount.Text:SetText("Amount")
EPGPChangeLogFrame.Header.DateTime = CreateFrame("Frame", nil, EPGPChangeLogFrame.Header, "BackdropTemplate")
EPGPChangeLogFrame.Header.DateTime:SetSize(150, 24)
EPGPChangeLogFrame.Header.DateTime:SetPoint("BOTTOMLEFT", EPGPChangeLogFrame.Header.Amount, "BOTTOMRIGHT", -4, 0)
EPGPChangeLogFrame.Header.DateTime:SetBackdrop({
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize = 10,
insets = {left = 2, right = 2, top = 2, bottom = 2},
})
EPGPChangeLogFrame.Header.DateTime:SetBackdropColor(1, 1, 1, 1)
EPGPChangeLogFrame.Header.DateTime.Text = EPGPChangeLogFrame.Header.DateTime:CreateFontString("EPGPChangeLogFrame.Header.DateTime.Text", "ARTWORK", "GameFontNormal")
EPGPChangeLogFrame.Header.DateTime.Text:SetSize(EPGPChangeLogFrame.Header.DateTime:GetWidth(), EPGPChangeLogFrame.Header.DateTime:GetHeight())
EPGPChangeLogFrame.Header.DateTime.Text:SetPoint("CENTER", 0, 0)
EPGPChangeLogFrame.Header.DateTime.Text:SetTextColor(1, 1, 1, 1)
EPGPChangeLogFrame.Header.DateTime.Text:SetText("DateTime")
EPGPChangeLogFrame.Header.Admin = CreateFrame("Frame", nil, EPGPChangeLogFrame.Header, "BackdropTemplate")
EPGPChangeLogFrame.Header.Admin:SetSize(100, 24)
EPGPChangeLogFrame.Header.Admin:SetPoint("BOTTOMLEFT", EPGPChangeLogFrame.Header.DateTime, "BOTTOMRIGHT", -4, 0)
EPGPChangeLogFrame.Header.Admin:SetBackdrop({
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize = 10,
insets = {left = 2, right = 2, top = 2, bottom = 2},
})
EPGPChangeLogFrame.Header.Admin:SetBackdropColor(1, 1, 1, 1)
EPGPChangeLogFrame.Header.Admin.Text = EPGPChangeLogFrame.Header.Admin:CreateFontString("EPGPChangeLogFrame.Header.Admin.Text", "ARTWORK", "GameFontNormal")
EPGPChangeLogFrame.Header.Admin.Text:SetSize(EPGPChangeLogFrame.Header.Admin:GetWidth(), EPGPChangeLogFrame.Header.Admin:GetHeight())
EPGPChangeLogFrame.Header.Admin.Text:SetPoint("CENTER", 0, 0)
EPGPChangeLogFrame.Header.Admin.Text:SetTextColor(1, 1, 1, 1)
EPGPChangeLogFrame.Header.Admin.Text:SetText("Admin")
EPGPChangeLogFrame.Header.Reason = CreateFrame("Frame", nil, EPGPChangeLogFrame.Header, "BackdropTemplate")
EPGPChangeLogFrame.Header.Reason:SetSize(175, 24)
EPGPChangeLogFrame.Header.Reason:SetPoint("BOTTOMLEFT", EPGPChangeLogFrame.Header.Admin, "BOTTOMRIGHT", -4, 0)
EPGPChangeLogFrame.Header.Reason:SetBackdrop({
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize = 10,
insets = {left = 2, right = 2, top = 2, bottom = 2},
})
EPGPChangeLogFrame.Header.Reason:SetBackdropColor(1, 1, 1, 1)
EPGPChangeLogFrame.Header.Reason.Text = EPGPChangeLogFrame.Header.Reason:CreateFontString("EPGPChangeLogFrame.Header.Reason.Text", "ARTWORK", "GameFontNormal")
EPGPChangeLogFrame.Header.Reason.Text:SetSize(EPGPChangeLogFrame.Header.Reason:GetWidth(), EPGPChangeLogFrame.Header.Reason:GetHeight())
EPGPChangeLogFrame.Header.Reason.Text:SetPoint("CENTER", 0, 0)
EPGPChangeLogFrame.Header.Reason.Text:SetTextColor(1, 1, 1, 1)
EPGPChangeLogFrame.Header.Reason.Text:SetText("Reason")
local curFont, curSize, curFlags = EPGPChangeLogFrame.Header.Name.Text:GetFont()
EPGPChangeLogFrame.Header.Name .Text:SetFont(curFont, curSize - 2, curFlags)
EPGPChangeLogFrame.Header.Points.Text:SetFont(curFont, curSize - 2, curFlags)
EPGPChangeLogFrame.Header.Admin .Text:SetFont(curFont, curSize - 2, curFlags)
EPGPChangeLogFrame.Header.Reason.Text:SetFont(curFont, curSize - 2, curFlags)
local EPGPChangeLogFrameCloseButton = CreateFrame("Button", nil, EPGPChangeLogFrame, "UIPanelCloseButton, BackDropTemplate")
EPGPChangeLogFrameCloseButton:SetSize(24, 24)
EPGPChangeLogFrameCloseButton:SetPoint("TOPRIGHT", EPGPChangeLogFrame, "TOPRIGHT", -3, -3)
EPGPChangeLogFrameCloseButton:SetScript("OnClick", function() EPGPChangeLogFrame:Hide() end)
scrollFrame:SetScrollChild(ChangeLogScrollPanel)
EPGPChangeLogFrame:Hide()
end
function WOTLKEPGP:CreateLootFrame()
EPGPLootFrame = CreateFrame("Frame", nil, UIParent)
EPGPLootFrame:SetPoint("CENTER", 0, 0)
EPGPLootFrame:SetSize(670, 400)
EPGPLootFrame:EnableMouse(true)
EPGPLootFrame:SetMovable(true)
EPGPLootFrame:RegisterForDrag("LeftButton")
EPGPLootFrame:SetScript("OnDragStart", EPGPLootFrame.StartMoving)
EPGPLootFrame:SetScript("OnDragStop", EPGPLootFrame.StopMovingOrSizing)
EPGPLootFrame.TopLeftBG = CreateFrame("Frame", nil, EPGPLootFrame, "BackdropTemplate")
EPGPLootFrame.TopBG1 = CreateFrame("Frame", nil, EPGPLootFrame, "BackdropTemplate")
EPGPLootFrame.TopBG2 = CreateFrame("Frame", nil, EPGPLootFrame, "BackdropTemplate")
EPGPLootFrame.TopRightBG = CreateFrame("Frame", nil, EPGPLootFrame, "BackdropTemplate")
EPGPLootFrame.BotLeftBG = CreateFrame("Frame", nil, EPGPLootFrame, "BackdropTemplate")
EPGPLootFrame.BotBG1 = CreateFrame("Frame", nil, EPGPLootFrame, "BackdropTemplate")
EPGPLootFrame.BotBG2 = CreateFrame("Frame", nil, EPGPLootFrame, "BackdropTemplate")
EPGPLootFrame.BotRightBG = CreateFrame("Frame", nil, EPGPLootFrame, "BackdropTemplate")
EPGPLootFrame.TopLeftBG :SetSize(200, EPGPLootFrame:GetHeight() / 2)
EPGPLootFrame.TopBG1 :SetSize(200, EPGPLootFrame:GetHeight() / 2)
EPGPLootFrame.TopBG2 :SetSize(200, EPGPLootFrame:GetHeight() / 2)
EPGPLootFrame.TopRightBG:SetSize(100, EPGPLootFrame:GetHeight() / 2)
EPGPLootFrame.BotLeftBG :SetSize(200, EPGPLootFrame:GetHeight() / 2)
EPGPLootFrame.BotBG1 :SetSize(200, EPGPLootFrame:GetHeight() / 2)
EPGPLootFrame.BotBG2 :SetSize(200, EPGPLootFrame:GetHeight() / 2)
EPGPLootFrame.BotRightBG:SetSize(100, EPGPLootFrame:GetHeight() / 2)
EPGPLootFrame.TopLeftBG :SetPoint("TOPLEFT", 0, 0)
EPGPLootFrame.TopBG1 :SetPoint("LEFT", EPGPLootFrame.TopLeftBG, "RIGHT", 0, 0)
EPGPLootFrame.TopBG2 :SetPoint("LEFT", EPGPLootFrame.TopBG1, "RIGHT", 0, 0)
EPGPLootFrame.TopRightBG:SetPoint("LEFT", EPGPLootFrame.TopBG2, "RIGHT", 0, 0)
EPGPLootFrame.BotLeftBG :SetPoint("TOP", EPGPLootFrame.TopLeftBG, "BOTTOM", 0, 0)
EPGPLootFrame.BotBG1 :SetPoint("TOP", EPGPLootFrame.TopBG1, "BOTTOM", 0, 0)
EPGPLootFrame.BotBG2 :SetPoint("TOP", EPGPLootFrame.TopBG2, "BOTTOM", 0, 0)
EPGPLootFrame.BotRightBG:SetPoint("TOP", EPGPLootFrame.TopRightBG, "BOTTOM", 0, 0)
EPGPLootFrame.TopLeftBG :SetBackdrop({bgFile = "Interface/HELPFRAME/HelpFrame-TOPLEFT"})
EPGPLootFrame.TopBG1 :SetBackdrop({bgFile = "Interface/HELPFRAME/HelpFrame-TOP"})
EPGPLootFrame.TopBG2 :SetBackdrop({bgFile = "Interface/HELPFRAME/HelpFrame-TOP"})
EPGPLootFrame.TopRightBG:SetBackdrop({bgFile = "Interface/HELPFRAME/HelpFrame-TOPRIGHT"})
EPGPLootFrame.BotLeftBG :SetBackdrop({bgFile = "Interface/HELPFRAME/HelpFrame-BOTLEFT"})
EPGPLootFrame.BotBG1 :SetBackdrop({bgFile = "Interface/HELPFRAME/HelpFrame-BOTTOM"})
EPGPLootFrame.BotBG2 :SetBackdrop({bgFile = "Interface/HELPFRAME/HelpFrame-BOTTOM"})
EPGPLootFrame.BotRightBG:SetBackdrop({bgFile = "Interface/HELPFRAME/HelpFrame-BOTRIGHT"})
EPGPLootFrame.Title = CreateFrame("FRAME", nil, EPGPLootFrame)
EPGPLootFrame.Title:SetSize(300, 65)
EPGPLootFrame.Title:SetPoint("TOP", EPGPLootFrame, "TOP", 0, EPGPLootFrame.Title:GetHeight() * 0.35 - 4)
EPGPLootFrame.Title:SetFrameStrata("HIGH")
EPGPLootFrame.Title.Text = EPGPLootFrame.Title:CreateFontString("EPGPLootFrame", "ARTWORK", "GameFontNormalLarge")
EPGPLootFrame.Title.Text:SetPoint("TOP", 0, -EPGPLootFrame.Title:GetHeight() * 0.25 + 3)
EPGPLootFrame.Title.Text:SetText(AddOnName .. " - v" .. WOTLKEPGP.Version)
EPGPLootFrame.Title.Texture = EPGPLootFrame.Title:CreateTexture(nil, "BACKGROUND")
EPGPLootFrame.Title.Texture:SetAllPoints()
EPGPLootFrame.Title.Texture:SetTexture("Interface/DialogFrame/UI-DialogBox-Header")
EPGPLootFrame.ExtraBG = CreateFrame("FRAME", nil, EPGPLootFrame, "BackdropTemplate")
EPGPLootFrame.ExtraBG:SetSize(EPGPLootFrame:GetWidth() - 25, EPGPLootFrame:GetHeight() - 79)
EPGPLootFrame.ExtraBG:SetPoint("TOP", 2, -41)
EPGPLootFrame.ExtraBG:SetFrameStrata("HIGH")
EPGPLootFrame.ExtraBG:SetBackdrop({
bgFile = "Interface/BankFrame/Bank-Background",
tile = true,
tileSize = 100;
})
EPGPLootFrame.ExtraBG:SetBackdropColor(0.25, 0.25, 0.25, 1)
local scrollFrame = CreateFrame("ScrollFrame", nil, EPGPLootFrame, "UIPanelScrollFrameTemplate BackdropTemplate");
scrollFrame:SetSize(EPGPLootFrame:GetWidth() - 45, EPGPLootFrame:GetHeight() - 77)
scrollFrame:SetPoint("TOP", -11, -40)
scrollFrame:SetFrameStrata("HIGH")
LootScrollPanel = CreateFrame("Frame")
LootScrollPanel:SetSize(scrollFrame:GetWidth(), 300)
LootScrollPanel:SetPoint("TOP")
EPGPLootFrame.Header = CreateFrame("Frame", nil, EPGPLootFrame, "BackdropTemplate")
EPGPLootFrame.Header:SetPoint("TOP", -11, -20)
EPGPLootFrame.Header:SetSize(LootScrollPanel:GetWidth(), 50)
EPGPLootFrame.Header.Icon = CreateFrame("Frame", nil, EPGPLootFrame.Header, "BackdropTemplate")
EPGPLootFrame.Header.Icon:SetSize(34, 24)
EPGPLootFrame.Header.Icon:SetPoint("TOPLEFT", 5, 0)
EPGPLootFrame.Header.Icon:SetBackdrop({
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize = 10,
insets = {left = 2, right = 2, top = 2, bottom = 2},
})
EPGPLootFrame.Header.Icon:SetBackdropColor(1, 1, 1, 1)
EPGPLootFrame.Header.Icon.Text = EPGPLootFrame.Header.Icon:CreateFontString("EPGPLootFrame.Header.Icon.Text", "ARTWORK", "GameFontNormal")
EPGPLootFrame.Header.Icon.Text:SetSize(EPGPLootFrame.Header.Icon:GetWidth(), EPGPLootFrame.Header.Icon:GetHeight())
EPGPLootFrame.Header.Icon.Text:SetPoint("CENTER", 0, 0)
EPGPLootFrame.Header.Icon.Text:SetTextColor(1, 1, 1, 1)
EPGPLootFrame.Header.Icon.Text:SetText("Icon")
EPGPLootFrame.Header.Name = CreateFrame("Frame", nil, EPGPLootFrame.Header, "BackdropTemplate")
EPGPLootFrame.Header.Name:SetSize(200, 24)
EPGPLootFrame.Header.Name:SetPoint("BOTTOMLEFT", EPGPLootFrame.Header.Icon, "BOTTOMRIGHT", -4, 0)
EPGPLootFrame.Header.Name:SetBackdrop({
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize = 10,
insets = {left = 2, right = 2, top = 2, bottom = 2},
})
EPGPLootFrame.Header.Name:SetBackdropColor(1, 1, 1, 1)
EPGPLootFrame.Header.Name.Text = EPGPLootFrame.Header.Name:CreateFontString("EPGPLootFrame.Header.Name.Text", "ARTWORK", "GameFontNormal")
EPGPLootFrame.Header.Name.Text:SetSize(EPGPLootFrame.Header.Name:GetWidth(), EPGPLootFrame.Header.Name:GetHeight())
EPGPLootFrame.Header.Name.Text:SetPoint("CENTER", 0, 0)
EPGPLootFrame.Header.Name.Text:SetTextColor(1, 1, 1, 1)
EPGPLootFrame.Header.Name.Text:SetText("Name")
EPGPLootFrame.Header.curGP = CreateFrame("Frame", nil, EPGPLootFrame.Header, "BackdropTemplate")
EPGPLootFrame.Header.curGP:SetSize(50, 24)
EPGPLootFrame.Header.curGP:SetPoint("BOTTOMLEFT", EPGPLootFrame.Header.Name, "BOTTOMRIGHT", -4, 0)
EPGPLootFrame.Header.curGP:SetBackdrop({
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize = 10,
insets = {left = 2, right = 2, top = 2, bottom = 2},
})
EPGPLootFrame.Header.curGP:SetBackdropColor(1, 1, 1, 1)
EPGPLootFrame.Header.curGP.Text = EPGPLootFrame.Header.curGP:CreateFontString("EPGPLootFrame.Header.curGP.Text", "ARTWORK", "GameFontNormal")
EPGPLootFrame.Header.curGP.Text:SetSize(EPGPLootFrame.Header.curGP:GetWidth(), EPGPLootFrame.Header.curGP:GetHeight())
EPGPLootFrame.Header.curGP.Text:SetPoint("CENTER", 0, 0)
EPGPLootFrame.Header.curGP.Text:SetTextColor(1, 1, 1, 1)
EPGPLootFrame.Header.curGP.Text:SetText("GP Cost")
EPGPLootFrame.Header.playersNeed = CreateFrame("Frame", nil, EPGPLootFrame.Header, "BackdropTemplate")
EPGPLootFrame.Header.playersNeed:SetSize(100, 24)
EPGPLootFrame.Header.playersNeed:SetPoint("BOTTOMLEFT", EPGPLootFrame.Header.curGP, "BOTTOMRIGHT", -4, 0)
EPGPLootFrame.Header.playersNeed:SetBackdrop({
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize = 10,
insets = {left = 2, right = 2, top = 2, bottom = 2},
})
EPGPLootFrame.Header.playersNeed:SetBackdropColor(1, 1, 1, 1)
EPGPLootFrame.Header.playersNeed.Text = EPGPLootFrame.Header.playersNeed:CreateFontString("EPGPLootFrame.Header.playersNeed.Text", "ARTWORK", "GameFontNormal")
EPGPLootFrame.Header.playersNeed.Text:SetSize(EPGPLootFrame.Header.playersNeed:GetWidth(), EPGPLootFrame.Header.playersNeed:GetHeight())
EPGPLootFrame.Header.playersNeed.Text:SetPoint("CENTER", 0, 0)
EPGPLootFrame.Header.playersNeed.Text:SetTextColor(1, 1, 1, 1)
EPGPLootFrame.Header.playersNeed.Text:SetText("Need")
EPGPLootFrame.Header.playersGreed = CreateFrame("Frame", nil, EPGPLootFrame.Header, "BackdropTemplate")
EPGPLootFrame.Header.playersGreed:SetSize(100, 24)
EPGPLootFrame.Header.playersGreed:SetPoint("BOTTOMLEFT", EPGPLootFrame.Header.playersNeed, "BOTTOMRIGHT", -4, 0)
EPGPLootFrame.Header.playersGreed:SetBackdrop({
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize = 10,
insets = {left = 2, right = 2, top = 2, bottom = 2},
})
EPGPLootFrame.Header.playersGreed:SetBackdropColor(1, 1, 1, 1)
EPGPLootFrame.Header.playersGreed.Text = EPGPLootFrame.Header.playersGreed:CreateFontString("EPGPLootFrame.Header.playersGreed.Text", "ARTWORK", "GameFontNormal")
EPGPLootFrame.Header.playersGreed.Text:SetSize(EPGPLootFrame.Header.playersGreed:GetWidth(), EPGPLootFrame.Header.playersGreed:GetHeight())
EPGPLootFrame.Header.playersGreed.Text:SetPoint("CENTER", 0, 0)
EPGPLootFrame.Header.playersGreed.Text:SetTextColor(1, 1, 1, 1)
EPGPLootFrame.Header.playersGreed.Text:SetText("Greed")
EPGPLootFrame.Header.buttons = CreateFrame("Frame", nil, EPGPLootFrame.Header, "BackdropTemplate")
EPGPLootFrame.Header.buttons:SetSize(155, 24)
EPGPLootFrame.Header.buttons:SetPoint("BOTTOMLEFT", EPGPLootFrame.Header.playersGreed, "BOTTOMRIGHT", -4, 0)
EPGPLootFrame.Header.buttons:SetBackdrop({
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize = 10,
insets = {left = 2, right = 2, top = 2, bottom = 2},
})
EPGPLootFrame.Header.buttons:SetBackdropColor(1, 1, 1, 1)
EPGPLootFrame.Header.buttons.Text = EPGPLootFrame.Header.buttons:CreateFontString("EPGPLootFrame.Header.buttons.Text", "ARTWORK", "GameFontNormal")
EPGPLootFrame.Header.buttons.Text:SetSize(EPGPLootFrame.Header.buttons:GetWidth(), EPGPLootFrame.Header.buttons:GetHeight())
EPGPLootFrame.Header.buttons.Text:SetPoint("CENTER", 0, 0)
EPGPLootFrame.Header.buttons.Text:SetTextColor(1, 1, 1, 1)
EPGPLootFrame.Header.buttons.Text:SetText("Buttons")
local curFont, curSize, curFlags = EPGPLootFrame.Header.Name.Text:GetFont()
EPGPLootFrame.Header.Icon .Text:SetFont(curFont, curSize - 2, curFlags)
EPGPLootFrame.Header.Name .Text:SetFont(curFont, curSize - 2, curFlags)
EPGPLootFrame.Header.curGP.Text:SetFont(curFont, curSize - 2, curFlags)
local EPGPLootFrameCloseButton = CreateFrame("Button", nil, EPGPLootFrame, "UIPanelCloseButton, BackDropTemplate")
EPGPLootFrameCloseButton:SetSize(24, 24)
EPGPLootFrameCloseButton:SetPoint("TOPRIGHT", EPGPLootFrame, "TOPRIGHT", -3, -3)
EPGPLootFrameCloseButton:SetScript("OnClick", function() EPGPLootFrame:Hide() end)
scrollFrame:SetScrollChild(LootScrollPanel)
EPGPLootFrame:Hide()
end
function WOTLKEPGP:AddTooltipScript()
GameTooltip:HookScript("OnTooltipSetItem", function(...)
local _, itemLink = GameTooltip:GetItem()
if itemLink ~= nil then
--local itemName, _, itemQuality, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc = GetItemInfo(itemLink)
local itemStuff = WOTLKEPGP:CheckItemInfo(itemLink)
--if itemEquipLoc ~= nil and WOTLKEPGP.InfoTable.Slot[itemEquipLoc] ~= nil then
if itemStuff.itemEquipLoc ~= nil and WOTLKEPGP.InfoTable.Slot[itemStuff.itemEquipLoc] ~= nil then
--local price = WOTLKEPGP:CalculateTotalPrice(itemQuality, itemEquipLoc, itemLevel)
local price = WOTLKEPGP:CalculateTotalPrice(itemStuff.itemQuality, itemStuff.itemEquipLoc, itemStuff.itemLevel)
price = WOTLKEPGP:MathRound(price * 1000) / 1000
GameTooltip:AddLine("Wrath EPGP: " .. price .. "GP")
end
end
end)
end
function WOTLKEPGP:CheckItemInfo(itemInfoStuff)
local itemName, itemLink, itemQuality, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, sellPrice, classID, subclassID, bindType, expacID, setID, isCraftingReagent = GetItemInfo(itemInfoStuff)
local itemID = tonumber(string.match(itemLink, "[^:]*:([^:]*)"))
local value = WOTLKEPGP.InfoTable.PreCalculatedItems[itemID]
if value ~= nil then
itemLevel = value.itemLevel
itemQuality = value.itemQuality
itemEquipLoc = value.itemEquipLoc
end
local itemStuff = {itemName = itemName, itemLink = itemLink, itemID = itemID, itemLevel = itemLevel, itemQuality = itemQuality, itemEquipLoc = itemEquipLoc, itemTexture = itemTexture}
return itemStuff
end
function WOTLKEPGP:splitCharacterNames(input)
local names = {}
local inputLen = #input
local index = 1
while index < inputLen do
local _, matchEnd = string.find(input, "%s?([^%s]+)%s?", index)
local assistName = string.match(input, "%s?([^%s]+)%s?", index)
index = matchEnd + 1
table.insert(names, assistName)
end
return names
end
function WOTLKEPGP:RegisterEvents(event, func)
local handlers = WOTLKEPGP.RegisteredEvents[event]
if handlers == nil then
handlers = {}
WOTLKEPGP.RegisteredEvents[event] = handlers
EventFrame:RegisterEvent(event)
end
handlers[#handlers + 1] = func
end
function WOTLKEPGP:GetDateTime()
local DateTimeString = date()
local year, month, date, day, time = nil, nil, nil, nil, nil
if string.find(DateTimeString, " ") then
day, month, _, date, time, year = strsplit(" ", DateTimeString)
else
day, month, date, time, year = strsplit(" ", DateTimeString)
end
day = WOTLKEPGP:GetFullDayName(day)
month = WOTLKEPGP:GetNumericMonth(month)
date = tonumber(date)
year = tonumber(year)
return year, month, date
end
function WOTLKEPGP:GetFullDayName(day)
local dayF
if day == "Mon" or day == "mon" then dayF = "Monday" end
if day == "Tue" or day == "tue" then dayF = "Tuesday" end
if day == "Wed" or day == "wed" then dayF = "Wednesday" end
if day == "Thu" or day == "thu" then dayF = "Thursday" end
if day == "Fri" or day == "fri" then dayF = "Friday" end
if day == "Sat" or day == "sat" then dayF = "Saturday" end
if day == "Sun" or day == "sun" then dayF = "Sunday" end
return dayF
end
function WOTLKEPGP:GetNumericMonth(month)
local monthN
if month == "Jan" or month == "jan" then monthN = "01" end
if month == "Feb" or month == "feb" then monthN = "02" end
if month == "Mar" or month == "mar" then monthN = "03" end
if month == "Apr" or month == "apr" then monthN = "04" end
if month == "May" or month == "may" then monthN = "05" end
if month == "Jun" or month == "jun" then monthN = "06" end
if month == "Jul" or month == "jul" then monthN = "07" end
if month == "Aug" or month == "aug" then monthN = "08" end
if month == "Sep" or month == "sep" then monthN = "09" end
if month == "Oct" or month == "oct" then monthN = "10" end
if month == "Nov" or month == "nov" then monthN = "11" end
if month == "Dec" or month == "dec" then monthN = "12" end
return monthN
end
function WOTLKEPGP:GetQualityMultiplier(quality, iLevel)
if quality ~= 0 and quality ~= 1 then
local multiplier = WOTLKEPGP.InfoTable.Quality[quality](iLevel)
return multiplier
else
return 1
end
end
function WOTLKEPGP:GetSlotMultiplier(slot)
if WOTLKEPGP.InfoTable.Slot[slot] ~= nil then
local multiplier = WOTLKEPGP.InfoTable.Slot[slot]
return multiplier
else
return 1
end
end
function WOTLKEPGP:CalculateTotalPrice(quality, slot, iLevel)
local TotalPrice, CalcPrice, QMulty, SMulty = nil, nil, nil, nil
QMulty = WOTLKEPGP:GetQualityMultiplier(quality, iLevel)
SMulty = WOTLKEPGP:GetSlotMultiplier(slot)
CalcPrice = QMulty * QMulty * 0.04 * SMulty
return CalcPrice
end
function WOTLKEPGP:MathRound(value)
value = math.floor(value + 0.5)
return value
end
function WOTLKEPGP:RollItem(inputLink)
if inputLink == nil then print("No ItemLink provided!")
else
local itemStuff = WOTLKEPGP:CheckItemInfo(inputLink)
if itemStuff.itemEquipLoc == nil or itemStuff.itemEquipLoc == "" then itemStuff.itemEquipLoc = "Not Equipable!" end
local totalPrice = WOTLKEPGP:CalculateTotalPrice(itemStuff.itemQuality, itemStuff.itemEquipLoc, itemStuff.itemLevel)
local roundedPrice = WOTLKEPGP:MathRound(totalPrice)
print("EPGP Rolling Item:", itemStuff.itemLink)
print("iLevel:", itemStuff.itemLevel, " - Quality:", itemStuff.itemQuality, " - Slot:", itemStuff.itemEquipLoc)
print("Quality/iLevel Modifier:", WOTLKEPGP:GetQualityMultiplier(itemStuff.itemQuality, itemStuff.itemLevel))
print("Slot Modifier:", WOTLKEPGP:GetSlotMultiplier(itemStuff.itemEquipLoc))
print("Total Price:", totalPrice)
print("Rounded Price:", roundedPrice)
end
end
function WOTLKEPGP:AddPlayerToList(curGUID, curName, curClass)
if curGUID:find("Player-") ~= nil then
local numPlayers = WOTLKEPGP:CountPlayersInList()
local epoch = time()
local players = WOTLKEPGP.DataTable.Players
if players[curGUID] == nil then
players[curGUID] = {}
players[curGUID].Name = curName
players[curGUID].Update = epoch
players[curGUID].Class = curClass
players[curGUID].EP = WOTLKEPGPMinimums.EP
players[curGUID].GP = WOTLKEPGPMinimums.GP
players[curGUID].PR = players[curGUID].EP / players[curGUID].GP
local year, month, date = WOTLKEPGP:GetDateTime()
local dateString = year .. month .. date
print("Adding Target to DataTable:", curName, "-", curGUID)
players[curGUID][dateString] = {}
WOTLKEPGP:FilterPlayers()
else
print("Player already in list!")
end
else
print("NPC is not allowed.")
end
end
function WOTLKEPGP:CountPlayersInList()
local numPlayers = 0
local players = WOTLKEPGP.DataTable.Players
for key, value in pairs(players) do
numPlayers = numPlayers + 1
end
return numPlayers
end
function WOTLKEPGP:SyncRaidersAddOnMsg()
print("Trying to sync!")
local players = WOTLKEPGPDataTable.Players
for playerGUID, playerData in pairs(players) do
local message = "Player:"
if playerData.EP == nil then playerData.EP = 1 end
if playerData.GP == nil then playerData.GP = 1 end
message = message .. playerGUID .. ":" .. playerData.Name .. ":" .. playerData.Update .. ":" .. playerData.Class .. ":" .. playerData.EP .. ":" .. playerData.GP .. ":"
table.insert(SyncQueue, message)
end
WOTLKEPGP:SendRaidGuildAddonMsg(string.format("StartOfSync:%d", #SyncQueue))
if CurrentSyncTicker == nil then
CurrentSyncTicker = C_Timer.NewTicker(1, function() WOTLKEPGP:SendNextSyncBatch() end)
end
end
function WOTLKEPGP:SendNextSyncBatch()
if #SyncQueue > 0 then
local message = table.remove(SyncQueue, 1)
WOTLKEPGP:SendRaidGuildAddonMsg(message)
end
if #SyncQueue == 0 then
WOTLKEPGP:SendRaidGuildAddonMsg("EndOfSync")
CurrentSyncTicker:Cancel()
CurrentSyncTicker = nil
print("Sync AddOn Messages Send!")
end
end
function WOTLKEPGP:SendRaidGuildAddonMsg(message)
if IsInRaid() then
C_ChatInfo.SendAddonMessage("WOTLKEPGP", message ,"RAID", 1)
else
C_ChatInfo.SendAddonMessage("WOTLKEPGP", message ,"GUILD", 1)
end
end
function WOTLKEPGP:CreateFilterButtons()
EPGPAdminFrame:HookScript("OnShow", function()
FilterButtonFrame:SetParent(EPGPAdminFrame.FilterClassesButton)
FilterButtonFrame:SetPoint("BOTTOM", EPGPAdminFrame.FilterClassesButton, "TOP")
end)
EPGPUserFrame:HookScript("OnShow", function()
FilterButtonFrame:SetParent(EPGPUserFrame.FilterClassesButton)
FilterButtonFrame:SetPoint("BOTTOM", EPGPUserFrame.FilterClassesButton, "TOP")
end)
FilterButtonFrame = CreateFrame("FRAME", nil, UIParent, "BackdropTemplate")
FilterButtonFrame:SetSize(91, 115)
FilterButtonFrame:SetBackdrop({
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize = 12,
insets = { left = 1, right = 1, top = 1, bottom = 1 },
})
FilterButtonFrame:SetBackdropColor(1, 1, 1, 1)
FilterButtonFrame:Hide()
FilterButtonFrame.FilterRaidGroup = CreateFrame("Button", nil, FilterButtonFrame, "UIPanelButtonTemplate")
FilterButtonFrame.FilterRaidGroup:SetSize(81, 20)
FilterButtonFrame.FilterRaidGroup:SetPoint("TOP", 0, -5)
FilterButtonFrame.FilterRaidGroup:SetFrameStrata("HIGH")
FilterButtonFrame.FilterRaidGroup:SetScript("OnClick",
function()
FilterRaid = not FilterRaid
WOTLKEPGP:FilterPlayers()
end)
FilterButtonFrame.FilterRaidGroup.text = FilterButtonFrame.FilterRaidGroup:CreateFontString("FilterClassesButton", "ARTWORK", "GameFontNormalTiny")
FilterButtonFrame.FilterRaidGroup.text:SetPoint("CENTER", 0, 0)
FilterButtonFrame.FilterRaidGroup.text:SetText("Filter Raid")
FilterButtonFrame.FilterRaidGroup:SetFrameStrata("HIGH")
FilterButtonFrame.FilterRaidGroup:SetFrameLevel(4)
local FilterButtons = {}
for i = 1, 11 do
if i == 6 or i == 10 then -- Parsing out Monk(6) and DeathKnight(10) index numbers. (DH == 12)
else
FilterButtons[i] = CreateFrame("Button", nil, FilterButtonFrame, "BackdropTemplate")
FilterButtons[i]:SetSize(25, 25)
local xOff, yOff = nil, nil
if i == 1 or i == 4 or i == 8 then
xOff = 5
elseif i == 2 or i == 5 or i == 9 then
xOff = 33
elseif i == 3 or i == 7 or i == 11 then
xOff = 61
end
if i == 1 or i == 2 or i == 3 then
yOff = -30
elseif i == 4 or i == 5 or i == 7 then
yOff = -58
elseif i == 8 or i == 9 or i == 11 then
yOff = -86
end
FilterButtons[i]:SetPoint("TOPLEFT", xOff, yOff)
FilterButtons[i]:SetBackdrop({
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize = 10,
insets = {left = 3, right = 3, top = 3, bottom = 3},
})