-
Notifications
You must be signed in to change notification settings - Fork 1
/
EventAlert_CreateFrames.lua
1410 lines (1267 loc) · 56.8 KB
/
EventAlert_CreateFrames.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
-- Prevent tainting global _.
local _
local _G = _G
local CreateFrame = CreateFrame
--常用函數設為區域變數以提昇效能
local print = print
local pairs = pairs
local ipairs = ipairs
local tonumber = tonumber
local tostring = tostring
local type = type
local select = select
local format = format
local CreateFrame = CreateFrame
local UnitBuff = UnitBuff
local UnitDebuf = UnitDebuff
local UnitAura = UnitAura
local UnitPower = UnitPower
local UnitPowerMax = UnitPowerMax
local UnitPowerType = UnitPowerType
local UnitAffectingCombat = UnitAffectingCombat
local UnitLevel = UnitLevel
local UnitClass = UnitClass
local UnitID = UnitID
local UnitSpellHaste = UnitSpellHaste
local UnitName = UnitName
local UnitIsCorpse = UnitIsCorpse
local UnitIsDeadOrGhost = UnitIsDeadOrGhost
local UnitIsEnemy = UnitIsEnemy
local UnitExists = UnitExists
local GetTime = GetTime
local GetActiveSpecGroup = GetActiveSpecGroup
local GetActiveTalentGroup = GetActiveTalentGroup
local GetShapeshiftForm = GetShapeshiftForm
local GetShapeshiftFormID = GetShapeshiftFormID
local GetSpecialization = GetSpecialization
local GetSpecializationInfo = GetSpecializationInfo
local GetSpellCharges = GetSpellCharges
local GetSpellCooldown = GetSpellCooldown
local GetSpellInfo = GetSpellInfo
local GetSpellLink = GetSpellLink
local GetSpellTexture = GetSpellTexture
local GetNumSubgroupMembers = GetNumSubgroupMembers
local hooksecurefunc = hooksecurefunc
local IsUsableSpell = IsUsableSpell
local UIFrameFadeIn = UIFrameFadeIn
local UIFrameFadeOut = UIFrameFadeOut
local GameTooltip = GameTooltip
--------------------------------------------------------------------------------
-- Create Basic Spell Frames, Anchor Frames, Speciall Frames
--------------------------------------------------------------------------------
function EventAlert_CreateFrames()
-- Create anchor frames used for mod customization.
if (EA_Config.AllowESC == true) then
tinsert(UISpecialFrames,"EA_Anchor_Frame1");
end
local iLocOffset_X = 100 + EA_Position.xOffset;
local iLocOffset_Y = 0 + EA_Position.yOffset
CreateFrames_CreateAnchorFrame("EA_Anchor_Frame1", 1); -- (1) self buff
CreateFrames_CreateAnchorFrame("EA_Anchor_Frame2", 1); -- (1) self buff
CreateFrames_CreateAnchorFrame("EA_Anchor_Frame3", 1); -- (1) self buff
CreateFrames_CreateAnchorFrame("EA_Anchor_Frame4", 1); -- (1) self buff
CreateFrames_CreateAnchorFrame("EA_Anchor_Frame5", 2); -- (2) target buff
CreateFrames_CreateAnchorFrame("EA_Anchor_Frame6", 2); -- (2) target buff
CreateFrames_CreateAnchorFrame("EA_Anchor_Frame7", 2); -- (2) target buff
CreateFrames_CreateAnchorFrame("EA_Anchor_Frame8", 2); -- (2) target buff
CreateFrames_CreateAnchorFrame("EA_Anchor_Frame9", 3); -- (3) Skill Cool-Down
CreateFrames_CreateAnchorFrame("EA_Anchor_Frame10", 3); -- (3) Skill Cool-Down
-- Self Buff/Debuff
EA_Anchor_Frame1:SetPoint(EA_Position.Anchor, UIParent, EA_Position.xLoc, EA_Position.yLoc);
EA_Anchor_Frame2:SetPoint("CENTER", EA_Anchor_Frame1, iLocOffset_X, iLocOffset_Y);
EA_Anchor_Frame3:SetPoint("CENTER", EA_Anchor_Frame1, -1 * iLocOffset_X, iLocOffset_Y);
EA_Anchor_Frame4:SetPoint("CENTER", EA_Anchor_Frame3, -1 * iLocOffset_X, iLocOffset_Y);
-- Target Buff/Debuff
EA_Anchor_Frame5:SetPoint("CENTER", EA_Anchor_Frame1, -1 * iLocOffset_X, -1 * iLocOffset_Y);
EA_Anchor_Frame6:SetPoint("CENTER", EA_Anchor_Frame5, -1 * iLocOffset_X, -1 * iLocOffset_Y);
EA_Anchor_Frame7:SetPoint("CENTER", EA_Anchor_Frame5, -1 * iLocOffset_X, -1 * iLocOffset_Y);
EA_Anchor_Frame8:SetPoint("CENTER", EA_Anchor_Frame7, -1 * iLocOffset_X, -1 * iLocOffset_Y);
-- Spell Cooldowns
EA_Anchor_Frame9:SetPoint("CENTER", EA_Anchor_Frame1, 0, 80 + iLocOffset_Y);
EA_Anchor_Frame10:SetPoint("CENTER", EA_Anchor_Frame9, iLocOffset_X, iLocOffset_Y);
local EA_OptHeight = EA_Options_Frame:GetHeight();
EA_Icon_Options_Frame:SetHeight(EA_OptHeight);
-- Create primary alert frames
CreateFrames_EventsFrame_CreateSpellList(1);
CreateFrames_EventsFrame_RefreshSpellList(1);
EA_Class_Events_Frame:SetHeight(EA_OptHeight);
-- Create alternate alert frames
CreateFrames_EventsFrame_CreateSpellList(2);
CreateFrames_EventsFrame_RefreshSpellList(2);
EA_ClassAlt_Events_Frame:SetHeight(EA_OptHeight);
-- Create other alert frames. (Mostly trinket procs)
CreateFrames_EventsFrame_CreateSpellList(3);
CreateFrames_EventsFrame_RefreshSpellList(3);
EA_Other_Events_Frame:SetHeight(EA_OptHeight);
-- Create Target's Debuffs alert frames. (Target's Debuffs only now)
CreateFrames_EventsFrame_CreateSpellList(4);
CreateFrames_EventsFrame_RefreshSpellList(4);
EA_Target_Events_Frame:SetHeight(EA_OptHeight);
-- Create Spells' Cooldown alert frames.
CreateFrames_EventsFrame_CreateSpellList(5);
CreateFrames_EventsFrame_RefreshSpellList(5);
EA_SCD_Events_Frame:SetHeight(EA_OptHeight);
-- Create GroupEventChecks alert frames.
CreateFrames_EventsFrame_CreateSpellList(6);
CreateFrames_EventsFrame_RefreshSpellList(6);
EA_Group_Events_Frame:SetHeight(EA_OptHeight);
-- Create Execution alert frames.
local eaexf = CreateFrame("FRAME", "EventAlert_ExecutionFrame", UIParent);
eaexf:ClearAllPoints();
eaexf:SetFrameStrata("BACKGROUND");
eaexf:SetPoint("TOP", UIParent, "TOP", 0, -50);
eaexf:SetHeight(256);
eaexf:SetWidth(256);
eaexf:Hide();
EA_Class_Events_Frame_SpellScrollFrame:SetHeight(EA_OptHeight - 175);
EA_ClassAlt_Events_Frame_SpellScrollFrame:SetHeight(EA_OptHeight - 175);
EA_Other_Events_Frame_SpellScrollFrame:SetHeight(EA_OptHeight - 100);
EA_Target_Events_Frame_SpellScrollFrame:SetHeight(EA_OptHeight - 100);
EA_SCD_Events_Frame_SpellScrollFrame:SetHeight(EA_OptHeight - 100);
EA_Group_Events_Frame_SpellScrollFrame:SetHeight(EA_OptHeight - 100);
CreateFrames_CreateMinimapOptionFrame()
end
function CreateFrames_CreateAnchorFrame(AnchorFrameName, typeIndex)
local eaaf = CreateFrame("FRAME", AnchorFrameName, UIParent);
eaaf:ClearAllPoints();
eaaf:SetFrameStrata("DIALOG");
-- eaaf:SetFrameStrata("LOW");
eaaf:SetBackdrop({bgFile = "Interface/Icons/Spell_Nature_Polymorph_Cow"});
eaaf.spellName = eaaf:CreateFontString(AnchorFrameName.."_Name","OVERLAY");
eaaf.spellName:SetFontObject(ChatFontNormal);
eaaf.spellName:SetPoint("BOTTOM", 0, -15);
eaaf.spellTimer = eaaf:CreateFontString(AnchorFrameName.."_Timer","OVERLAY");
eaaf.spellTimer:SetFontObject(ChatFontNormal);
eaaf.spellTimer:SetPoint("TOP", 0, 15);
eaaf:SetMovable(true);
eaaf:EnableMouse(true);
if (typeIndex == 1) then
eaaf:SetScript("OnMouseDown", EventAlert_Icon_Options_Frame_Anchor_OnMouseDown);
eaaf:SetScript("OnMouseUp", EventAlert_Icon_Options_Frame_Anchor_OnMouseUp);
elseif (typeIndex == 2) then
eaaf:SetScript("OnMouseDown", EventAlert_Icon_Options_Frame_Anchor_OnMouseDown2);
eaaf:SetScript("OnMouseUp", EventAlert_Icon_Options_Frame_Anchor_OnMouseUp2);
elseif (typeIndex == 3) then
eaaf:SetScript("OnMouseDown", EventAlert_Icon_Options_Frame_Anchor_OnMouseDown3);
eaaf:SetScript("OnMouseUp", EventAlert_Icon_Options_Frame_Anchor_OnMouseUp3);
end
eaaf:Hide();
end
function CreateFrames_CreateSpellFrame(index, typeIndex)
local sFramePrefix = "EAFrame_";
if typeIndex == 2 then sFramePrefix = "EATarFrame_" end;
if typeIndex == 3 then sFramePrefix = "EAScdFrame_" end;
local eaf = _G[sFramePrefix..index];
if (eaf == nil) then
eaf = CreateFrame("FRAME", sFramePrefix..index, EA_Main_Frame);
CooldownFramePrefix = "Cooldown_"
eaf.cooldown = CreateFrame("Cooldown", sFramePrefix..CooldownFramePrefix..index, eaf, "CooldownFrameTemplate");
if ((typeIndex == 3) and EA_Position.SCD_UseCooldown) then
eaf.useCooldown = true
else
eaf.useCooldown = false
end
--[[
if ((typeIndex == 3) and EA_Position.SCD_UseCooldown) then
eaf = CreateFrame("Cooldown", sFramePrefix..index, EA_Main_Frame, "CooldownFrameTemplate");
eaf.useCooldown = true;
else
eaf = CreateFrame("FRAME", sFramePrefix..index, EA_Main_Frame);
eaf.useCooldown = false;
end
]]--
eaf.spellName = eaf:CreateFontString(sFramePrefix..index.."_Name","OVERLAY");
eaf.spellTimer = eaf:CreateFontString(sFramePrefix..index.."_Timer","OVERLAY");
eaf.spellStack = eaf:CreateFontString(sFramePrefix..index.."_Stack","OVERLAY");
end
eaf.noCooldownCount = true;
if (EA_Config.AllowESC == true) then
tinsert(UISpecialFrames,sFramePrefix..index);
end
eaf:ClearAllPoints();
eaf:SetFrameStrata("HIGH");
eaf.redsectext = false;
eaf.whitesectext = false;
eaf.overgrow = false;
eaf.spellName:SetFontObject(ChatFontNormal);
eaf.spellName:SetPoint("TOP", eaf, "BOTTOM", 0, -0.1 * EA_Config.IconSize);
--eaf.spellName:SetPoint("BOTTOM", 0, -15);
eaf.spellTimer:SetFontObject(ChatFontNormal);
eaf.spellTimer:SetPoint("TOP", 0, EA_Config.TimerFontSize*1.1);
eaf.spellStack:SetFontObject(ChatFontNormal);
eaf.spellStack:SetPoint("BOTTOMRIGHT", 0, 15);
local spellId = tonumber(index)
local name, _, icon = GetSpellInfo(spellId);
if typeIndex == 1 then
if EA_SPELLINFO_SELF[spellId] == nil then EA_SPELLINFO_SELF[spellId] = {name, icon, count, duration, expirationTime, unitCaster, isDebuff} end;
EA_SPELLINFO_SELF[spellId].name = name;
if (spellId == 48517) then -- Druid / Eclipse (Solar): replace the Icon as Wrath (Rank 1)
_, _, icon, _, _, _, _, _, _ = GetSpellInfo(5176);
elseif (spellId == 48518) then -- Druid / Eclipse (Lunar): replace the Icon as Starfire (Rank 1)
_, _, icon, _, _, _, _, _, _ = GetSpellInfo(2912);
elseif (spellId == 8921) then -- Druid / Moonfire: always use the starfall picture
icon = "Interface/Icons/Spell_Nature_Starfall";
end
EA_SPELLINFO_SELF[spellId].icon = icon;
elseif typeIndex == 2 then
if EA_SPELLINFO_TARGET[spellId] == nil then EA_SPELLINFO_TARGET[spellId] = {name, icon, count, duration, expirationTime, unitCaster, isDebuff} end;
EA_SPELLINFO_TARGET[spellId].name = name;
EA_SPELLINFO_TARGET[spellId].icon = icon;
elseif typeIndex == 3 then
if EA_SPELLINFO_SCD[spellId] == nil then EA_SPELLINFO_SCD[spellId] = {name, icon} end;
EA_SPELLINFO_SCD[spellId].name = name;
EA_SPELLINFO_SCD[spellId].icon = icon;
for k,v in pairs(EA_ScdItems[EA_playerClass][spellId]) do
if EA_SPELLINFO_SCD[spellId] then
EA_SPELLINFO_SCD[spellId][k] = v
end
end
end
end
-- function CreateFrames_CreateSpecialFrame(index)
function CreateFrames_SpecialFrames_Show(index)
local sFramePrefix = "EAFrameSpec_";
local eaf = _G[sFramePrefix..index];
if (eaf ~= nil) then
-- 已建立特殊能力框架,直接更新
local iPowerType = floor((index - 1000000) / 10)
if (index == EA_SpecPower.LifeBloom.frameindex[1]) then
EventAlert_UpdateLifeBloom("player");
elseif (index == EA_SpecPower.ComboPoint.frameindex[1]) then
EventAlert_UpdateComboPoint()
elseif (iPowerType == EA_SpecPower.Runes.powerId) then
EventAlert_UpdateRunes()
else
EventAlert_UpdateSinglePower(iPowerType)
end
return
end
-- 尚未建立特殊能力框架,以下是第一次執行
eaf = CreateFrame("FRAME", sFramePrefix..index, EA_Main_Frame);
eaf.spellName = eaf:CreateFontString(sFramePrefix..index.."_Name","OVERLAY");
eaf.spellTimer = eaf:CreateFontString(sFramePrefix..index.."_Timer","OVERLAY");
eaf.spellStack = eaf:CreateFontString(sFramePrefix..index.."_Stack","OVERLAY");
if not(eaf.texture) then
eaf.texture = eaf:CreateTexture()
eaf.texture:SetAllPoints(eaf)
end
if (EA_Config.AllowESC == true) then
tinsert(UISpecialFrames,sFramePrefix..index);
end
eaf:ClearAllPoints();
eaf:SetFrameStrata("HIGH");
eaf.spellName:SetFontObject(ChatFontNormal);
eaf.spellName:SetPoint("TOP", eaf, "BOTTOM", 0, -EA_Config.IconSize * 0.1);
eaf.spellTimer:SetFontObject(ChatFontNormal);
eaf.spellTimer:SetPoint("CENTER", eaf, "CENTER", 0, EA_Config.TimerFontSize * 0.8);
eaf.spellStack:SetFontObject(ChatFontNormal);
eaf.spellStack:SetPoint("BOTTOMRIGHT", eaf, "BOTTOMRIGHT", 0, EA_Config.IconSize * 0.1);
eaf:SetWidth(EA_Config.IconSize);
eaf:SetHeight(EA_Config.IconSize);
if index == EA_SpecPower.Rage.frameindex[1] then
-- 戰士/熊D怒氣的圖案
eaf:SetBackdrop({bgFile = "Interface/Icons/Ability_Warrior_Rampage"});
elseif index == EA_SpecPower.Focus.frameindex[1] then
-- 獵人集中值的圖案
eaf:SetBackdrop({bgFile = "Interface/Icons/Ability_Marksmanship"});
elseif index == EA_SpecPower.Focus.frameindex[2] then
-- 寵物集中值的圖案
--eaf:SetBackdrop({bgFile = "Interface/Icons/Ability_Marksmanship"});
local specIcon = select(3,GetSpellInfo(982))
eaf.texture:SetTexture(specIcon)
elseif index == EA_SpecPower.Energy.frameindex[1] then
-- 盜賊/貓D/武僧能量的圖案
--eaf:SetBackdrop({bgFile = "Interface/Icons/Spell_Nature_Healingway"});
eaf:SetBackdrop({bgFile = "Interface/Icons/Trade_Engineering"});
elseif index == EA_SpecPower.RunicPower.frameindex[1] then
-- 死亡騎士符文能量的圖案
eaf:SetBackdrop({bgFile = "Interface/Icons/Spell_Arcane_Rune"});
elseif index == EA_SpecPower.SoulShards.frameindex[1] then
-- 術士靈魂碎片的圖案
eaf:SetBackdrop({bgFile = "Interface/Icons/Inv_Misc_Gem_Amethyst_02"});
elseif index == EA_SpecPower.LunarPower.frameindex[1] then
-- 鳥D星能的圖案
--eaf:SetBackdrop({bgFile = "Interface/Icons/Ability_Druid_Eclipse"});
--local specIcon = select(3,GetSpellInfo(77492))
local specIcon = select(3,GetSpellInfo(197524))
eaf.texture:SetTexture(specIcon)
elseif index == EA_SpecPower.HolyPower.frameindex[1] then
-- 聖騎士的聖能圖案
eaf:SetBackdrop({bgFile = "Interface/Icons/Spell_Holy_PowerwordBarrier"});
elseif index == EA_SpecPower.LightForce.frameindex[1] then
-- 武僧真氣的圖案
eaf:SetBackdrop({bgFile = "Interface/Icons/Ability_Monk_HealthSphere"});
elseif index == EA_SpecPower.Insanity.frameindex[1] then
-- 暗牧瘋狂值的圖案
--eaf:SetBackdrop({bgFile = "Interface/Icons/Spell_Priest_Insanity"});
--local specIcon = select(3,GetSpellInfo(77486))
local specIcon = 1386550
eaf.texture:SetTexture(specIcon)
elseif index == EA_SpecPower.BurningEmbers.frameindex[1] then
-- 術士燃火餘燼的圖案
eaf:SetBackdrop({bgFile = "Interface/Icons/Inv_Misc_Embers"});
elseif index == EA_SpecPower.DemonicFury.frameindex[1] then
-- 術士惡魔之怒的圖案
eaf:SetBackdrop({bgFile = "Interface/Icons/Spell_Fire_FelFlameRing"});
elseif index == EA_SpecPower.LifeBloom.frameindex[1] then
-- 補D生命之花的圖案
eaf:SetBackdrop({bgFile = "Interface/Icons/INV_Misc_Herb_FelBlossom"});
elseif index == EA_SpecPower.ComboPoint.frameindex[1] then
-- 盜賊/貓D連擊點的圖案
eaf:SetBackdrop({bgFile = "Interface/Icons/Ability_WhirlWind"});
elseif index == EA_SpecPower.ArcaneCharges.frameindex[1] then
-- 秘法充能圖案
--eaf:SetBackdrop({bgFile = "Interface/Icons/Arcane_Charges"});
local specIcon = select(3,GetSpellInfo(30451))
eaf.texture:SetTexture(specIcon)
elseif index == EA_SpecPower.Maelstrom.frameindex[1] then
-- 薩滿元能圖案
local specIcon = select(3,GetSpellInfo(556))
specIcon = 136010
eaf.texture:SetTexture(specIcon)
elseif index == EA_SpecPower.Fury.frameindex[1] then
-- 惡魔獵人魔怒圖案
local specIcon
specIcon = 1305156
eaf.texture:SetTexture(specIcon)
elseif index == EA_SpecPower.Pain.frameindex[1] then
-- 惡魔獵人魔痛圖案
local specIcon
local specIcon = select(3,GetSpellInfo(203747))
eaf.texture:SetTexture(specIcon)
end
end
function CreateFrames_SpecialFrames_Hide(index)
local sFramePrefix = "EAFrameSpec_";
local eaf = _G[sFramePrefix..index];
if (eaf ~= nil) then
eaf:Hide();
end
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Create ScrollListFrame And Items(Icon, CheckButton, EditBox, ConfigButton, FontString)
--------------------------------------------------------------------------------
function CreateFrames_EventsFrame_CreateScrollFrame(ParentFrameObj, ScrollFrameHeight, xOffset, yOffset)
local framewidth = ParentFrameObj:GetWidth();
local framename = ParentFrameObj:GetName();
local panel3 = CreateFrame("ScrollFrame", framename.."_SpellListFrameScroll", ParentFrameObj, "UIPanelScrollFrameTemplate");
local scc = CreateFrame("Frame", framename.."_SpellListFrame", panel3);
panel3:SetScrollChild(scc);
panel3:SetPoint("TOPLEFT", ParentFrameObj, "TOPLEFT", xOffset, yOffset);
scc:SetPoint("TOPLEFT", panel3, "TOPLEFT", 0, 0);
panel3:SetWidth(framewidth-45);
panel3:SetHeight(ScrollFrameHeight);
scc:SetWidth(framewidth-45);
scc:SetHeight(ScrollFrameHeight);
-- panel3:SetHorizontalScroll(-50);
-- panel3:SetVerticalScroll(50);
panel3:SetBackdrop({bgFile="Interface\\DialogFrame\\UI-DialogBox-Background", edgeFile="", tile = false, tileSize = 0, edgeSize = 0, insets = { left = 0, right = 0, top = 0, bottom = 0 }});
panel3:SetScript("OnVerticalScroll", function() end);
panel3:EnableMouse(true);
panel3:SetVerticalScroll(0);
panel3:SetHorizontalScroll(0);
end
function CreateFrames_CreateSpellListIcon(SpellID, FrameNamePrefix, ParentFrameObj, LocOffsetX, LocOffsetY, IconPath)
SpellID = tonumber(SpellID);
local SpellIcon = _G[FrameNamePrefix..SpellID];
if (SpellIcon == nil) then
SpellIcon = CreateFrame("Frame", FrameNamePrefix..SpellID, ParentFrameObj);
end
SpellIcon:SetWidth(25);
SpellIcon:SetHeight(25);
SpellIcon:SetPoint("TOPLEFT", LocOffsetX, LocOffsetY);
--SpellIcon:SetBackdrop({bgFile = IconPath});
--for 7.0
if not SpellIcon.texture then SpellIcon.texture = SpellIcon:CreateTexture() end
SpellIcon.texture:SetAllPoints(SpellIcon)
SpellIcon.texture:SetTexture(IconPath)
SpellIcon:Show();
end
local function ChkboxGetChecked(self)
local iSpellID = self.SpellID;
local iFrameIndex = self.FrameIndex;
local EditboxObj = self.EditboxObj;
local fValue = false;
if (IsShiftKeyDown()) then
DEFAULT_CHAT_FRAME:AddMessage(EA_XCMD_DEBUG_P2.."="..tostring(iSpellID).." / "..GetSpellLink(iSpellID));
end
EditboxObj:SetText(tostring(iSpellID));
if (self:GetChecked()) then
fValue = true;
else
fValue = false;
end
if (iFrameIndex == 1) then
EA_Items[EA_playerClass][iSpellID].enable = fValue;
elseif (iFrameIndex == 2) then
EA_AltItems[EA_playerClass][iSpellID].enable = fValue;
elseif (iFrameIndex == 3) then
EA_Items[EA_CLASS_OTHER][iSpellID].enable = fValue;
elseif (iFrameIndex == 4) then
EA_TarItems[EA_playerClass][iSpellID].enable = fValue;
elseif (iFrameIndex == 5) then
EA_ScdItems[EA_playerClass][iSpellID].enable = fValue;
elseif (iFrameIndex == 6) then
EA_GrpItems[EA_playerClass][iSpellID].enable = fValue;
end
end
local function ChkboxGameToolTip(self)
local iTooltipSpellID = self.TooltipSpellID;
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetSpellByID(iTooltipSpellID);
end
function CreateFrames_CreateSpellListChkbox(SpellID, FrameNamePrefix, ParentFrameObj, LocOffsetX, LocOffsetY, SpellName, FrameIndex, EditboxObj)
SpellID = tonumber(SpellID);
local iTooltipSpellID = SpellID;
local fValue = true;
if FrameIndex == 1 then
fValue = EA_Items[EA_playerClass][SpellID].enable;
elseif FrameIndex == 2 then
fValue = EA_AltItems[EA_playerClass][SpellID].enable;
elseif FrameIndex == 3 then
fValue = EA_Items[EA_CLASS_OTHER][SpellID].enable;
elseif FrameIndex == 4 then
fValue = EA_TarItems[EA_playerClass][SpellID].enable;
elseif FrameIndex == 5 then
fValue = EA_ScdItems[EA_playerClass][SpellID].enable;
elseif FrameIndex == 6 then
fValue = EA_GrpItems[EA_playerClass][SpellID].enable;
iTooltipSpellID = EA_GrpItems[EA_playerClass][SpellID].Spells[1].SpellIconID;
end
local SpellChkbox = _G[FrameNamePrefix..SpellID];
if (SpellChkbox == nil) then
SpellChkbox = CreateFrame("CheckButton", FrameNamePrefix..SpellID, ParentFrameObj, "InterfaceOptionsCheckButtonTemplate");
end
SpellChkbox:SetPoint("TOPLEFT", LocOffsetX + 25, LocOffsetY);
SpellChkbox:SetChecked(fValue);
_G[SpellChkbox:GetName().."Text"]:SetText(SpellName.." ["..SpellID.."]");
SpellChkbox.SpellID = SpellID;
SpellChkbox.TooltipSpellID = iTooltipSpellID;
SpellChkbox.EditboxObj = EditboxObj;
SpellChkbox.FrameIndex = FrameIndex;
SpellChkbox:UnregisterAllEvents();
SpellChkbox:RegisterForClicks("AnyUp");
SpellChkbox:SetScript("OnClick", ChkboxGetChecked);
SpellChkbox:SetScript("OnEnter", ChkboxGameToolTip);
SpellChkbox:Show();
end
-- function CreateFrames_CreateSpellListEditbox(SpellID, FrameNamePrefix, ParentFrameObj, LocOffsetX, LocOffsetY, EditWidth, SpellText)
-- SpellID = tonumber(SpellID);
--
-- local SpellEditBox = _G[FrameNamePrefix..SpellID];
-- if (SpellEditBox == nil) then
-- SpellEditBox = CreateFrame("EditBox", FrameNamePrefix..SpellID, ParentFrameObj);
-- SpellEditBox:SetPoint("TOPLEFT", LocOffsetX, LocOffsetY);
-- SpellEditBox:SetFontObject(ChatFontNormal);
-- SpellEditBox:SetWidth(EditWidth);
-- SpellEditBox:SetHeight(25);
-- SpellEditBox:SetMaxLetters(0);
-- SpellEditBox:SetAutoFocus(false);
-- SpellEditBox:SetText(SpellText);
--
-- local function ShowEditBoxGameToolTip()
-- SpellEditBox:SetTextColor(0, 1, 1);
-- GameTooltip:SetOwner(SpellEditBox, "ANCHOR_RIGHT");
-- GameTooltip:SetSpellByID(SpellID);
-- end
-- local function HideEditBoxGameToolTip()
-- SpellEditBox:SetTextColor(1, 1, 1);
-- SpellEditBox:HighlightText(0,0);
-- SpellEditBox:ClearFocus();
-- GameTooltip:Hide();
-- end
-- SpellEditBox:SetScript("OnEnter", ShowEditBoxGameToolTip);
-- SpellEditBox:SetScript("OnLeave", HideEditBoxGameToolTip);
-- else
-- if (not SpellEditBox:IsShown()) then
-- SpellEditBox:SetPoint("TOPLEFT", LocOffsetX, LocOffsetY);
-- SpellEditBox:Show();
-- end
-- end
-- end
-- function CreateFrames_CfgBtn_SaveSpellCondition(FrameIndex, SpellID)
function CreateFrames_CfgBtn_SaveSpellCondition(self)
-- Get saved condition of spell
local FrameIndex = self.FrameIndex;
local SpellID = self.SpellID;
local SC_Stack, SC_Self, SC_OverGrow, SC_RedSecText, SC_OrderWtd = nil, nil, nil, nil, nil;
local Chk_Stack, Chk_OverGrow, Chk_RedSecText, Chk_OrderWtd = false, false, false, false;
-- // Get Checkbox and TextEdit Value From SpellConditionFrame and Recheck if valid.
local function CreateFrames_CfgBtnFun_GetChkText(ChkBox, TextEdit)
local ChkValue, NumValue = nil, nil;
ChkValue = ChkBox:GetChecked();
NumValue = TextEdit:GetText();
NumValue = tonumber(NumValue);
return ChkValue, NumValue;
end
Chk_Stack, SC_Stack = CreateFrames_CfgBtnFun_GetChkText(EA_SpellCondition_Frame_Stack, EA_SpellCondition_Frame_StackEditBox);
if ((not Chk_Stack) or (SC_Stack == nil) or (SC_Stack <= 1)) then
Chk_Stack = false;
SC_Stack = nil;
end
SC_Self = EA_SpellCondition_Frame_Self:GetChecked()
--CHKBOX 的勾選資訊回傳函數 GetChecked() : true表示打勾, false(nil)表示無打勾
--if (SC_Self == 1) then
-- SC_Self = true;
--else
-- SC_Self = false;
--end
Chk_OverGrow, SC_OverGrow = CreateFrames_CfgBtnFun_GetChkText(EA_SpellCondition_Frame_OverGrow, EA_SpellCondition_Frame_OverGrowEditBox);
if ((not Chk_OverGrow) or (SC_OverGrow == nil) or (SC_OverGrow <= 0) or (SC_OverGrow >= 100)) then
Chk_OverGrow = false;
SC_OverGrow = nil;
end
Chk_RedSecText, SC_RedSecText = CreateFrames_CfgBtnFun_GetChkText(EA_SpellCondition_Frame_RedSecText, EA_SpellCondition_Frame_RedSecTextEditBox);
if ((not Chk_RedSecText) or (SC_RedSecText == nil) or (SC_RedSecText <= 0) or (SC_RedSecText >= 100)) then
Chk_RedSecText = false;
SC_RedSecText = nil;
end
Chk_OrderWtd, SC_OrderWtd = CreateFrames_CfgBtnFun_GetChkText(EA_SpellCondition_Frame_OrderWtd, EA_SpellCondition_Frame_OrderWtdEditBox);
if ((not Chk_OrderWtd) or (SC_OrderWtd == nil) or (SC_OrderWtd <= 0) or (SC_OrderWtd >= 21)) then
Chk_OrderWtd = false;
SC_OrderWtd = nil;
end
-- // Save Checkbox and TextEdit Value To SaveVariables
local function CreateFrames_CfgBtnFun_SaveToItem(EAItem)
EAItem.stack = SC_Stack;
EAItem.self = SC_Self;
EAItem.overgrow = SC_OverGrow;
EAItem.redsectext = SC_RedSecText;
EAItem.orderwtd = SC_OrderWtd;
end
if (FrameIndex == 1) then
CreateFrames_CfgBtnFun_SaveToItem(EA_Items[EA_playerClass][SpellID])
-- elseif (FrameIndex == 2) then
-- CreateFrames_CfgBtnFun_SaveToItem(EA_AltItems[EA_playerClass][SpellID])
elseif (FrameIndex == 3) then
CreateFrames_CfgBtnFun_SaveToItem(EA_Items[EA_CLASS_OTHER][SpellID])
elseif (FrameIndex == 4) then
CreateFrames_CfgBtnFun_SaveToItem(EA_TarItems[EA_playerClass][SpellID])
elseif (FrameIndex == 5) then
CreateFrames_CfgBtnFun_SaveToItem(EA_ScdItems[EA_playerClass][SpellID])
end
EA_SpellCondition_Frame:Hide();
end
local function EACFFun_EventsFrame_CheckSpellID(spellID, ReCheckSpell)
local EA_name,_, EA_icon = GetSpellInfo(spellID);
if EA_name == nil then EA_name = "" end;
if (ReCheckSpell) then
if (spellID == 33151) then
elseif (spellID == 48517) then -- Druid / Eclipse (Solar): replace the Icon as Wrath (Rank 1)
_, _, EA_icon = GetSpellInfo(5176);
elseif (spellID == 48518) then -- Druid / Eclipse (Lunar): replace the Icon as Starfire (Rank 1)
_, _,EA_icon = GetSpellInfo(2912);
elseif (spellID == 8921) then -- Druid / Moonfire: always use the starfall picture
EA_icon = "Interface/Icons/Spell_Nature_Starfall";
end
end
return EA_name, EA_icon;
end
-- function CreateFrames_CfgBtn_LoadSpellCondition(FrameIndex, SpellID)
function CreateFrames_CfgBtn_LoadSpellCondition(self)
-- Get saved condition of spell
local FrameIndex = self.FrameIndex;
local SpellID = self.SpellID;
local ReCheckSpell = false;
if (FrameIndex == 1) then ReCheckSpell = true end;
local SpellName, SpellIconPath = EACFFun_EventsFrame_CheckSpellID(SpellID, ReCheckSpell);
--EA_SpellCondition_Frame_SpellIcon:SetBackdrop({bgFile = SpellIconPath});
--for 7.0
if not EA_SpellCondition_Frame_SpellIcon.texture then
EA_SpellCondition_Frame_SpellIcon.texture = EA_SpellCondition_Frame_SpellIcon:CreateTexture()
end
EA_SpellCondition_Frame_SpellIcon.texture:SetAllPoints(EA_SpellCondition_Frame_SpellIcon)
EA_SpellCondition_Frame_SpellIcon.texture:SetTexture(SpellIconPath)
-----------------------------------------------------------------------
EA_SpellCondition_Frame_SpellNameText:SetText(SpellName);
local iTextWidth = EA_SpellCondition_Frame_SpellNameText:GetTextWidth();
EA_SpellCondition_Frame_SpellNameText:SetWidth(iTextWidth);
local function SNTGameToolTip()
GameTooltip:SetOwner(EA_SpellCondition_Frame_SpellNameText, "ANCHOR_RIGHT");
GameTooltip:SetSpellByID(SpellID);
end
EA_SpellCondition_Frame_SpellNameText:SetScript("OnEnter", SNTGameToolTip);
-- // Get Checkbox and TextEdit Value From SaveVariables
local SC_Stack, SC_Self, SC_OverGrow, SC_RedSecText, SC_OrderWtd = nil, nil, nil, nil, nil;
local Chk_Stack, Chk_OverGrow, Chk_RedSecText, Chk_OrderWtd = false, false, false, false;
local function CreateFrames_CfgBtnFun_GetFromSave(EAItem)
SC_Stack = EAItem.stack;
SC_Self = EAItem.self;
SC_OverGrow = EAItem.overgrow;
SC_RedSecText = EAItem.redsectext;
SC_OrderWtd = EAItem.orderwtd;
end
if (FrameIndex == 1) then
CreateFrames_CfgBtnFun_GetFromSave(EA_Items[EA_playerClass][SpellID]);
-- elseif (FrameIndex == 2) then
-- CreateFrames_CfgBtnFun_GetFromSave(EA_AltItems[EA_playerClass][SpellID]);
elseif (FrameIndex == 3) then
CreateFrames_CfgBtnFun_GetFromSave(EA_Items[EA_CLASS_OTHER][SpellID]);
elseif (FrameIndex == 4) then
CreateFrames_CfgBtnFun_GetFromSave(EA_TarItems[EA_playerClass][SpellID]);
elseif (FrameIndex == 5) then
CreateFrames_CfgBtnFun_GetFromSave(EA_ScdItems[EA_playerClass][SpellID]);
end
if (SC_Stack == nil or SC_Stack <=1) then
Chk_Stack = false;
SC_Stack = 1;
else
Chk_Stack = true;
end
if (SC_OverGrow == nil or SC_OverGrow <=0) then
Chk_OverGrow = false;
SC_OverGrow = 100;
else
Chk_OverGrow = true;
end
if (SC_RedSecText == nil or SC_RedSecText <=0) then
Chk_RedSecText = false;
SC_RedSecText = -1;
else
Chk_RedSecText = true;
end
if (SC_OrderWtd == nil or SC_OrderWtd <=0 or SC_OrderWtd >=21) then
Chk_OrderWtd = false;
SC_OrderWtd = 1;
else
Chk_OrderWtd = true;
end
-- Set SpellCondition Stack Checkbox & Editbox
local function CreateFrames_CfgBtnFun_SetChkText(ChkBox, TextEdit, ChkValue, NumValue)
ChkBox:SetChecked(ChkValue);
if (ChkValue) then
TextEdit:SetText(NumValue);
else
TextEdit:SetText("");
end
end
CreateFrames_CfgBtnFun_SetChkText(EA_SpellCondition_Frame_Stack, EA_SpellCondition_Frame_StackEditBox, Chk_Stack, SC_Stack);
EA_SpellCondition_Frame_Self:SetChecked(SC_Self);
CreateFrames_CfgBtnFun_SetChkText(EA_SpellCondition_Frame_OverGrow, EA_SpellCondition_Frame_OverGrowEditBox, Chk_OverGrow, SC_OverGrow);
CreateFrames_CfgBtnFun_SetChkText(EA_SpellCondition_Frame_RedSecText, EA_SpellCondition_Frame_RedSecTextEditBox, Chk_RedSecText, SC_RedSecText);
CreateFrames_CfgBtnFun_SetChkText(EA_SpellCondition_Frame_OrderWtd, EA_SpellCondition_Frame_OrderWtdEditBox, Chk_OrderWtd, SC_OrderWtd);
EA_SpellCondition_Frame:ClearAllPoints();
EA_SpellCondition_Frame:SetPoint("LEFT", EA_Options_Frame, "RIGHT", 0, 0);
EA_SpellCondition_Frame:Show();
EA_SpellCondition_Frame_Save.FrameIndex = FrameIndex;
EA_SpellCondition_Frame_Save.SpellID = SpellID;
EA_SpellCondition_Frame_Save:SetScript("OnClick", CreateFrames_CfgBtn_SaveSpellCondition);
-- EA_SpellCondition_Frame_Save:SetScript("OnClick", function()
-- CreateFrames_CfgBtn_SaveSpellCondition(FrameIndex, SpellID);
-- end);
end
function CreateFrames_CreateSpellListCfgBtn(SpellID, FrameNamePrefix, ParentFrameObj, LocOffsetX, LocOffsetY, FrameIndex)
SpellID = tonumber(SpellID);
local SpellCfgBtn = _G[FrameNamePrefix..SpellID];
if (SpellCfgBtn == nil) then
SpellCfgBtn = CreateFrame("Button", FrameNamePrefix..SpellID, ParentFrameObj);
end
SpellCfgBtn:SetPoint("TOPRIGHT", LocOffsetX, LocOffsetY);
SpellCfgBtn:SetWidth(25);
SpellCfgBtn:SetHeight(25);
SpellCfgBtn:SetNormalTexture("Interface\\AddOns\\EventAlertMod\\Images\\UI-Panel-CfgButton-Down");
SpellCfgBtn:SetHighlightTexture("Interface\\AddOns\\EventAlertMod\\Images\\UI-Panel-CfgButton-Highlight", "BLEND");
if (FrameIndex <= 4) then
SpellCfgBtn.FrameIndex = FrameIndex;
SpellCfgBtn.SpellID = SpellID;
SpellCfgBtn:SetScript("OnClick", CreateFrames_CfgBtn_LoadSpellCondition);
-- SpellCfgBtn:SetScript("OnClick", function()
-- CreateFrames_CfgBtn_LoadSpellCondition(FrameIndex, SpellID);
-- end);
elseif (FrameIndex == 5) then
SpellCfgBtn.FrameIndex = FrameIndex;
SpellCfgBtn.SpellID = SpellID;
SpellCfgBtn:SetScript("OnClick", CreateFrames_CfgBtn_LoadSpellCondition);
elseif (FrameIndex == 6) then
SpellCfgBtn.GroupID = SpellID;
SpellCfgBtn:SetScript("OnClick", CreateFrames_CfgBtn_LoadGroupEvent);
-- SpellCfgBtn:SetScript("OnClick", function()
-- CreateFrames_CfgBtn_LoadGroupEvent(SpellID);
-- end);
end
SpellCfgBtn:Show();
end
local function CreateFrames_CfgBtn_GroupFrame_OnMouseDown(self)
self:StartMoving();
end
local function CreateFrames_CfgBtn_GroupFrame_OnMouseUp(self)
local iGroupID = self.GroupID;
self:StopMovingOrSizing();
local EA_point, _, EA_relativePoint, EA_xOfs, EA_yOfs = self:GetPoint();
-- EA_GrpItems[EA_playerClass][iGroupID].IconPoint = EA_point;
-- EA_GrpItems[EA_playerClass][iGroupID].IconRelatePoint = EA_relativePoint;
-- EA_GrpItems[EA_playerClass][iGroupID].LocX = EA_xOfs;
-- EA_GrpItems[EA_playerClass][iGroupID].LocY = EA_yOfs;
self.GC.IconPoint = EA_point;
self.GC.IconRelatePoint = EA_relativePoint;
self.GC.LocX = EA_xOfs;
self.GC.LocY = EA_yOfs;
end
local function CreateFrames_CfgBtn_ShowGroupFramePos(self)
local iGroupID = self.GroupID;
local FrameNamePrefix = "EAGrpAnchorFrame_";
local aGroupChecks = EA_GrpItems[EA_playerClass][iGroupID];
local eaf = _G[FrameNamePrefix..iGroupID];
if (eaf == nil) then
eaf = CreateFrame("Frame", FrameNamePrefix..iGroupID, UIParent);
eaf:SetMovable(true);
eaf:EnableMouse(true);
eaf.spellName = eaf:CreateFontString(FrameNamePrefix..iGroupID.."_Name","OVERLAY");
eaf.spellTimer = eaf:CreateFontString(FrameNamePrefix..iGroupID.."_Timer","OVERLAY");
eaf.spellStack = eaf:CreateFontString(FrameNamePrefix..iGroupID.."_Stack","OVERLAY");
eaf:SetScript("OnMouseDown", CreateFrames_CfgBtn_GroupFrame_OnMouseDown);
eaf:SetScript("OnMouseUp", CreateFrames_CfgBtn_GroupFrame_OnMouseUp);
eaf:ClearAllPoints();
eaf:SetFrameStrata("DIALOG");
-- eaf:SetFrameStrata("LOW");
eaf.spellName:SetFontObject(ChatFontNormal);
eaf.spellName:SetPoint("BOTTOM", 0, -15);
eaf.spellTimer:SetFontObject(ChatFontNormal);
eaf.spellTimer:SetPoint("TOP", 0, EA_Config.TimerFontSize*1.1);
eaf.spellStack:SetFontObject(ChatFontNormal);
eaf.spellStack:SetPoint("BOTTOMRIGHT", 0, 15);
eaf.texture = eaf:CreateTexture()
eaf.texture:SetAllPoints(eaf)
eaf:Hide();
end
if (eaf:IsShown()) then
eaf:Hide();
else
if eaf.GC == nil then eaf.GC = { } end;
eaf.GC = aGroupChecks;
--eaf:SetBackdrop({bgFile = eaf.GC.Spells[1].SpellIconPath});
--for 7.0
--if not(eaf.texture) then eaf.texture = eaf:CreateTexture() end
--eaf.texture:SetAllPoints(eaf)
eaf.texture:SetTexture(eaf.GC.Spells[1].SpellIconPath)
----------------------------------------------------------
if (eaf.GC.IconAlpha ~= nil) then eaf:SetAlpha(eaf.GC.IconAlpha) end;
eaf:SetPoint(eaf.GC.IconPoint, UIParent, eaf.GC.IconRelatePoint, eaf.GC.LocX, eaf.GC.LocY);
eaf:SetWidth(eaf.GC.IconSize);
eaf:SetHeight(eaf.GC.IconSize);
if (EA_Config.ShowName == true) then
eaf.spellName:SetText(eaf.GC.Spells[1].SpellName);
SfontName, SfontSize = eaf.spellName:GetFont();
eaf.spellName:SetFont(SfontName, EA_Config.SNameFontSize);
else
eaf.spellName:SetText("");
end
eaf:Show();
end
end
function CreateFrames_CreateSpellListCfgBtn2(SpellID, FrameNamePrefix, ParentFrameObj, LocOffsetX, LocOffsetY, FrameIndex)
SpellID = tonumber(SpellID);
local SpellCfgBtn = _G[FrameNamePrefix..SpellID];
if (SpellCfgBtn == nil) then
SpellCfgBtn = CreateFrame("Button", FrameNamePrefix..SpellID, ParentFrameObj);
end
SpellCfgBtn:SetPoint("TOPRIGHT", LocOffsetX, LocOffsetY);
SpellCfgBtn:SetWidth(25);
SpellCfgBtn:SetHeight(25);
SpellCfgBtn:SetNormalTexture("Interface\\AddOns\\EventAlertMod\\Images\\UI-Panel-CfgButton2-Down");
SpellCfgBtn:SetHighlightTexture("Interface\\AddOns\\EventAlertMod\\Images\\UI-Panel-CfgButton2-Highlight", "BLEND");
SpellCfgBtn.GroupID = SpellID;
SpellCfgBtn:SetScript("OnClick", CreateFrames_CfgBtn_ShowGroupFramePos);
SpellCfgBtn:Show();
end
-- function CreateFrames_CreateSpellListFontStr(SpellID, FrameNamePrefix, ParentFrameObj, LocOffsetX, LocOffsetY)
-- SpellID = tonumber(SpellID);
--
-- local SpellFontStr = _G[FrameNamePrefix..SpellID];
-- if (SpellFontStr == nil) then
-- SpellFontStr = ParentFrameObj:CreateFontString(FrameNamePrefix..SpellID, "ARTWORK", "GameFontNormal");
-- SpellFontStr:SetPoint("TOPRIGHT", LocOffsetX, LocOffsetY);
-- SpellFontStr:SetWidth(60);
-- SpellFontStr:SetHeight(25);
-- SpellFontStr:SetText("["..tostring(SpellID).."]");
-- else
-- if (not SpellFontStr:IsShown()) then
-- SpellFontStr:SetPoint("TOPRIGHT", LocOffsetX, LocOffsetY);
-- SpellFontStr:Show();
-- end
-- end
-- end
-- function CreateFrames_CfgBtn_LoadGroupEvent(GroupID)
function CreateFrames_CfgBtn_LoadGroupEvent(self)
local GroupID = self.GroupID;
EA_GroupEventSetting_Frame:ClearAllPoints();
EA_GroupEventSetting_Frame:SetPoint("TOPLEFT", EA_Options_Frame, "TOPLEFT", -50, -20);
EA_GroupEventSetting_Frame:Show();
local iGroupID = self.GroupID;
local eaf = _G["EAGrpAnchorFrame_"..GroupID];
if (eaf ~= nil) then eaf:Hide() end;
EAFun_GroupEvent_LoadGroupEventToFrame(GroupID);
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- CreateSpellList, ClearSpellList, RefreshSpellList
--------------------------------------------------------------------------------
local function EACFFun_EventsFrame_CreateSpellList(EAItems, typeIndex)
for index,value in pairsByKeys(EAItems) do
CreateFrames_CreateSpellFrame(index, typeIndex);
end
end
function CreateFrames_EventsFrame_CreateSpellList(FrameIndex)
if (FrameIndex == 1) then
EACFFun_EventsFrame_CreateSpellList(EA_Items[EA_playerClass], 1);
elseif (FrameIndex == 2) then
EACFFun_EventsFrame_CreateSpellList(EA_AltItems[EA_playerClass], 1);
elseif (FrameIndex == 3) then
EACFFun_EventsFrame_CreateSpellList(EA_Items[EA_CLASS_OTHER], 1);
EACFFun_EventsFrame_CreateSpellList(EA_Items[EA_CLASS_OTHER], 2);
elseif (FrameIndex == 4) then
EACFFun_EventsFrame_CreateSpellList(EA_TarItems[EA_playerClass], 2);
elseif (FrameIndex == 5) then
EACFFun_EventsFrame_CreateSpellList(EA_ScdItems[EA_playerClass], 3);
elseif (FrameIndex == 6) then
for iGrpIndex, aGrpChecks in ipairs (EA_GrpItems[EA_playerClass]) do
CreateFrames_CreateGroupCheckFrame(iGrpIndex);
end
end
end
--------------------------------------------------------------------------------
local function EACFFun_EventsFrame_ClearSpellList(EAItems, FrameNamePrefix)
local f1, f2, f3, f4;
for index,value in pairsByKeys(EAItems) do
f1 = _G[FrameNamePrefix.."_Icon_"..index];
f2 = _G[FrameNamePrefix.."_ChkBtn_"..index];
f3 = _G[FrameNamePrefix.."_CfgBtn_"..index];
f4 = _G[FrameNamePrefix.."_CfgBtn2_"..index];
if f1 ~= nil then
f1:Hide();
end
if f2 ~= nil then
f2:SetScript("OnClick", nil);
f2:UnregisterAllEvents();
f2:Hide();
end
if f3 ~= nil then
f3:SetScript("OnClick", nil);
f3:UnregisterAllEvents();
f3:Hide();
end
if f4 ~= nil then
f4:SetScript("OnClick", nil);
f4:UnregisterAllEvents();
f4:Hide();
end
f1 = nil;
f2 = nil;
f3 = nil;
f4 = nil;
end
collectgarbage();
end
local function EACFFun_EventsFrame_ClearSpellFrame(EAItems, FrameNamePrefix)
local eaf = nil;
for iGrpIndex, aGrpChecks in ipairs (EAItems) do
eaf = _G[FrameNamePrefix..iGrpIndex];
if (eaf ~= nil) then
eaf:UnregisterAllEvents();
eaf:Hide();
eaf = nil;
end
end
collectgarbage();
end
function CreateFrames_EventsFrame_ClearSpellList(FrameIndex)
if (FrameIndex == 1) then
EACFFun_EventsFrame_ClearSpellList(EA_Items[EA_playerClass], "EA_ClassFrame");
elseif (FrameIndex == 2) then
EACFFun_EventsFrame_ClearSpellList(EA_AltItems[EA_playerClass], "EA_ClassAltFrame");
elseif (FrameIndex == 3) then
EACFFun_EventsFrame_ClearSpellList(EA_Items[EA_CLASS_OTHER], "EA_OtherFrame");
elseif (FrameIndex == 4) then
EACFFun_EventsFrame_ClearSpellList(EA_TarItems[EA_playerClass], "EA_TargetFrame");
elseif (FrameIndex == 5) then
EACFFun_EventsFrame_ClearSpellList(EA_ScdItems[EA_playerClass], "EA_SCDFrame");
elseif (FrameIndex == 6) then
EACFFun_EventsFrame_ClearSpellList(EA_GrpItems[EA_playerClass], "EA_GroupFrame");
EACFFun_EventsFrame_ClearSpellFrame(EA_GrpItems[EA_playerClass], "EAGrpFrame_");
end
end
--------------------------------------------------------------------------------