forked from superstyro/AzerothAdmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AzerothAdmin.lua
2621 lines (2524 loc) · 113 KB
/
AzerothAdmin.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
-------------------------------------------------------------------------------------------------------------
--
-- AzerothAdmin Version 3.x
-- AzerothAdmin is a derivative of TrinityAdmin/MangAdmin.
--
-- Copyright (C) 2022 Free Software Foundation, Inc.
-- License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
-- This is free software: you are free to change and redistribute it.
-- There is NO WARRANTY, to the extent permitted by law.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--
-- Repository: https://github.com/superstyro/AzerothAdmin
--
-------------------------------------------------------------------------------------------------------------
local genv = getfenv(0)
local Mang = genv.Mang
GPS = '.gps'
cWorking = 0
cMap = 0
cX = 0
cY = 0
cZ = 0
incX = 0
incY = 0
incZ = 0
fID = 0
gettingGOBinfo=0
gettingGOBinfoinfo=0
MAJOR_VERSION = "AzerothAdmin-3.3.5"
MINOR_VERSION = "$Revision: 003 $"
ROOT_PATH = "Interface\\AddOns\\AzerothAdmin\\"
local cont = ""
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
MangAdmin = AceLibrary("AceAddon-2.0"):new("AceConsole-2.0", "AceDB-2.0", "AceHook-2.1", "FuBarPlugin-2.0", "AceDebug-2.0", "AceEvent-2.0")
Locale = AceLibrary("AceLocale-2.2"):new("MangAdmin")
Strings = AceLibrary("AceLocale-2.2"):new("TEST")
FrameLib = AceLibrary("FrameLib-1.0")
Graph = AceLibrary("Graph-1.0")
local Tablet = AceLibrary("Tablet-2.0")
MangAdmin:RegisterDB("MangAdminDb", "MangAdminDbPerChar")
MangAdmin:RegisterDefaults("char",
{
functionQueue = {},
requests = {
tpinfo = false,
ticket = false,
ticketbody = 0,
item = false,
favitem = false,
itemset = false,
spell = false,
skill = false,
quest = false,
creature = false,
object = false,
tele = false,
toggle = false
},
nextGridWay = "ahead",
selectedZone = nil,
newTicketQueue = {},
instantKillMode = false,
msgDeltaTime = time(),
}
)
MangAdmin:RegisterDefaults("account",
{
language = nil,
localesearchstring = true,
favorites = {
items = {},
itemsets = {},
spells = {},
skills = {},
quests = {},
creatures = {},
objects = {},
teles = {}
},
buffer = {
tickets = {},
items = {},
itemsets = {},
spells = {},
skills = {},
quests = {},
creatures = {},
objects = {},
teles = {},
counter = 0
},
tickets = {
selected = 0,
count = 0,
requested = 0,
playerinfo = {},
loading = false
},
style = {
updatedelay = "20000", -- Set to approx. 10 Minutes
showtooltips = true,
showchat = false,
showminimenu = true,
transparency = {
buttons = 1.0,
frames = 0.7,
backgrounds = 0.5
},
color = {
buffer = {},
buttons = {
r = 33,
g = 164,
b = 210
},
frames = {
r = 102,
g = 102,
b = 102
},
backgrounds = {
r = 0,
g = 0,
b = 0
},
linkifier = {
r = 0.8705882352941177,
g = 0.3725490196078432,
b = 0.1411764705882353
}
}
}
}
)
-- Register Translations
Locale:EnableDynamicLocales(true)
--Locale:EnableDebugging()
Locale:RegisterTranslations("enUS", function() return Return_enUS() end)
--Locale:RegisterTranslations("frFR", function() return Return_frFR() end)
--Locale:RegisterTranslations("svSV", function() return Return_svSV() end)
--Locale:RegisterTranslations("deDE", function() return Return_deDE() end)
--Locale:RegisterTranslations("ptBR", function() return Return_ptBR() end)
--Locale:RegisterTranslations("itIT", function() return Return_itIT() end)
--Locale:RegisterTranslations("fiFI", function() return Return_fiFI() end)
--Locale:RegisterTranslations("plPL", function() return Return_plPL() end)
--Locale:RegisterTranslations("liLI", function() return Return_liLI() end)
--Locale:RegisterTranslations("roRO", function() return Return_roRO() end)
--Locale:RegisterTranslations("csCZ", function() return Return_csCZ() end)
--Locale:RegisterTranslations("huHU", function() return Return_huHU() end)
--Locale:RegisterTranslations("esES", function() return Return_esES() end)
--Locale:RegisterTranslations("zhCN", function() return Return_zhCN() end)
--Locale:RegisterTranslations("ptPT", function() return Return_ptPT() end)
--Locale:RegisterTranslations("ruRU", function() return Return_ruRU() end)
--Locale:RegisterTranslations("nlNL", function() return Return_nlNL() end)
--Locale:RegisterTranslations("buBU", function() return Return_buBU() end)
-- Register String Traslations
Strings:EnableDynamicLocales(true)
Strings:RegisterTranslations("enUS", function() return ReturnStrings_enUS() end)
--Strings:RegisterTranslations("frFR", function() return ReturnStrings_frFR() end)
--Strings:RegisterTranslations("svSV", function() return ReturnStrings_svSV() end)
--Strings:RegisterTranslations("deDE", function() return ReturnStrings_deDE() end)
--Strings:RegisterTranslations("ptBR", function() return ReturnStrings_ptBR() end)
--Strings:RegisterTranslations("itIT", function() return ReturnStrings_itIT() end)
--Strings:RegisterTranslations("fiFI", function() return ReturnStrings_fiFI() end)
--Strings:RegisterTranslations("plPL", function() return ReturnStrings_plPL() end)
--Strings:RegisterTranslations("liLI", function() return ReturnStrings_liLI() end)
--Strings:RegisterTranslations("roRO", function() return ReturnStrings_roRO() end)
--Strings:RegisterTranslations("csCZ", function() return ReturnStrings_csCZ() end)
--Strings:RegisterTranslations("huHU", function() return ReturnStrings_huHU() end)
--Strings:RegisterTranslations("esES", function() return ReturnStrings_esES() end)
--Strings:RegisterTranslations("zhCN", function() return ReturnStrings_zhCN() end)
--Strings:RegisterTranslations("ptPT", function() return ReturnStrings_ptPT() end)
--Strings:RegisterTranslations("ruRU", function() return ReturnStrings_ruRU() end)
--Strings:RegisterTranslations("nlNL", function() return ReturnStrings_nlNL() end)
--Strings:RegisterTranslations("buBU", function() return ReturnStrings_buBU() end)
--Locale:Debug()
--Locale:SetLocale("enUS")
MangAdmin.consoleOpts = {
type = 'group',
args = {
toggle = {
name = "toggle",
desc = Locale["cmd_toggle"],
type = 'execute',
func = function() MangAdmin:OnClick() end
},
transparency = {
name = "transparency",
desc = Locale["cmd_transparency"],
type = 'execute',
func = function() MangAdmin:ToggleTransparency() end
},
tooltips = {
name = "tooltips",
desc = Locale["cmd_tooltip"],
type = 'execute',
func = function() MangAdmin:ToggleTooltips() end
},
minimenu = {
name = "tooltips",
desc = "Toogle the toolbar/minimenu",
type = 'execute',
func = function() MangAdmin:ToggleMinimenu() end
}
}
}
function MangAdmin:OnInitialize()
-- initializing MangAdmin
self:SetLanguage()
self:CreateFrames()
self:RegisterChatCommand(Locale["slashcmds"], self.consoleOpts) -- this registers the chat commands
self:InitButtons() -- this prepares the actions and tooltips of nearly all MangAdmin buttons
InitControls()
self:SearchReset()
MangAdmin.db.account.buffer.who = {}
-- FuBar plugin config
MangAdmin.hasNoColor = true
MangAdmin.hasNoText = false
MangAdmin.clickableTooltip = true
MangAdmin.hasIcon = true
MangAdmin.hideWithoutStandby = true
MangAdmin:SetIcon(ROOT_PATH.."Textures\\icon.tga")
-- make MangAdmin frames closable with escape key
tinsert(UISpecialFrames,"ma_bgframe")
tinsert(UISpecialFrames,"ma_popupframe")
-- those all hook the AddMessage method of the chat frames.
-- They will be redirected to MangAdmin:AddMessage(...)
for i=1,NUM_CHAT_WINDOWS do
local cf = getglobal("ChatFrame"..i)
self:Hook(cf, "AddMessage", true)
end
-- initializing Frames, like DropDowns, Sliders, aso
self:InitDropDowns()
self:InitSliders()
self:InitScrollFrames()
self:InitCheckButtons()
ma_gobmovedistforwardback:SetText("1")
ma_gobmovedistleftright:SetText("1")
ma_gobmovedistupdown:SetText("1")
MangAdmin.db.account.buffer.who = {}
--clear color buffer
self.db.account.style.color.buffer = {}
--altering the function setitemref, to make it possible to click links
MangLinkifier_SetItemRef_Original = SetItemRef
SetItemRef = MangLinkifier_SetItemRef
self.db.char.msgDeltaTime = time()
-- hide minimenu if not enabled
if not self.db.account.style.showminimenu then
FrameLib:HandleGroup("minimenu", function(frame) frame:Hide() end)
end
end
function MangAdmin:OnEnable()
self:SetDebugging(true) -- to have debugging through the whole app
ma_toptext:SetText(Locale["char"].." "..Locale["guid"]..tonumber(UnitGUID("player"),16))
ma_top2text:SetText(Locale["realm"])
self:SearchReset()
-- refresh server information
self:ChatMsg(".server info")
self:ChatMsg(".account onlinelist")
-- register events
--self:RegisterEvent("ZONE_CHANGED") -- for teleport list update
self:RegisterEvent("PLAYER_TARGET_CHANGED")
self:RegisterEvent("UNIT_MODEL_CHANGED")
self:RegisterEvent("PLAYER_DEAD")
self:RegisterEvent("PLAYER_ALIVE")
self:PLAYER_TARGET_CHANGED() --init
--ma_mm_revivebutton:Show()
end
--events
function MangAdmin:PLAYER_DEAD()
ma_mm_revivebutton:Show()
end
function MangAdmin:PLAYER_ALIVE()
ma_mm_revivebutton:Hide()
end
function MangAdmin:ZONE_CHANGED()
--[[if hastranslationlocale then
if not MangAdmin.db.char.selectedZone or MangAdmin.db.char.selectedZone ~= translate(GetZoneText()) then
if translationfor(GetZoneText()) then
MangAdmin.db.char.selectedZone = translate(GetZoneText())
InlineScrollUpdate()
end
end
end]]
end
function MangAdmin:UNIT_MODEL_CHANGED()
ModelChanged()
end
function MangAdmin:PLAYER_TARGET_CHANGED()
ModelChanged()
NpcModelChanged()
if UnitIsPlayer("target") then
ma_savebutton:Enable()
if UnitIsDead("target") then
ma_revivebutton:Enable()
ma_killbutton:Disable()
else
--ma_revivebutton:Disable()
ma_killbutton:Enable()
end
if not UnitIsUnit("target", "player") then
ma_kickbutton:Enable()
else
ma_kickbutton:Disable()
end
--ma_respawnbutton:Disable()
elseif not UnitName("target") then
ma_savebutton:Enable()
--ma_revivebutton:Disable()
ma_killbutton:Disable()
ma_kickbutton:Disable()
--ma_respawnbutton:Disable()
else
ma_savebutton:Disable()
--ma_revivebutton:Disable()
ma_kickbutton:Disable()
if UnitIsDead("target") then
--ma_respawnbutton:Enable()
ma_killbutton:Disable()
else
if self.db.char.instantKillMode then
if not UnitIsFriend("player", "target") then
KillSomething()
end
end
--ma_respawnbutton:Disable()
ma_killbutton:Enable()
end
end
end
function MangAdmin:OnDisable()
-- called when the addon is disabled
self:SearchReset()
end
function MangAdmin:OnClick()
-- this toggles the MangAdmin frame when clicking on the mini icon
if IsShiftKeyDown() then
ReloadUI()
elseif IsAltKeyDown() then
self.db.char.newTicketQueue = 0
MangAdmin:UpdateTooltip()
elseif ma_bgframe:IsVisible() and not ma_popupframe:IsVisible() then
FrameLib:HandleGroup("bg", function(frame) frame:Hide() end)
elseif ma_bgframe:IsVisible() and ma_popupframe:IsVisible() then
FrameLib:HandleGroup("bg", function(frame) frame:Hide() end)
FrameLib:HandleGroup("popup", function(frame) frame:Hide() end)
elseif not ma_bgframe:IsVisible() and ma_popupframe:IsVisible() then
FrameLib:HandleGroup("bg", function(frame) frame:Show() end)
else
FrameLib:HandleGroup("bg", function(frame) frame:Show() end)
end
end
function MangAdmin:OnTooltipUpdate()
local tickets = self.db.char.newTicketQueue
local ticketCount = 0
table.foreachi(tickets, function() ticketCount = ticketCount + 1 end)
if ticketCount == 0 then
local cat = Tablet:AddCategory("columns", 1)
cat:AddLine("text", Locale["ma_TicketsNoNew"])
MangAdmin:SetIcon(ROOT_PATH.."Textures\\icon.tga")
else
local cat = Tablet:AddCategory(
"columns", 1,
"justify", "LEFT",
"hideBlankLine", true,
"showWithoutChildren", false,
"child_textR", 1,
"child_textG", 1,
"child_textB", 1
)
cat:AddLine(
"text", string.format(Locale["ma_TicketsNewNumber"], ticketCount),
"func", function() MangAdmin:ShowTicketTab() end)
local counter = 0
local name
for i, name in pairs(tickets) do
counter = counter + 1
if counter == ticketCount then
cat:AddLine(
"text", string.format(Locale["ma_TicketsGoLast"], name),
"func", function(name) MangAdmin:TelePlayer("gochar", name) end,
"arg1", name
)
cat:AddLine(
"text", string.format(Locale["ma_TicketsGetLast"], name),
"func", function(name) MangAdmin:TelePlayer("getchar", name) end,
"arg1", name
)
end
end
MangAdmin:SetIcon(ROOT_PATH.."Textures\\icon2.tga")
end
Tablet:SetHint(Locale["ma_IconHint"])
end
function MangAdmin:ToggleTabButton(group)
--this modifies the look of tab buttons when clicked on them
FrameLib:HandleGroup("tabbuttons",
function(button)
if button:GetName() == "ma_tabbutton_"..group then
getglobal(button:GetName().."_texture"):SetGradientAlpha("vertical", 102, 102, 102, 1, 102, 102, 102, 0.7)
else
getglobal(button:GetName().."_texture"):SetGradientAlpha("vertical", 102, 102, 102, 0, 102, 102, 102, 0.7)
end
end)
end
function MangAdmin:ToggleContentGroup(group)
--MangAdmin:LogAction("Toggled navigation point '"..group.."'.")
self:HideAllGroups()
FrameLib:HandleGroup(group, function(frame) frame:Show() end)
end
function MangAdmin:InstantGroupToggle(group)
if group == "ticket" then
self.db.char.requests.ticket = false
end
if group== "who" then
MangAdmin:ChatMsg(".account onlinelist")
ResetWho()
end
FrameLib:HandleGroup("bg", function(frame) frame:Show() end)
MangAdmin:ToggleTabButton(group)
MangAdmin:ToggleContentGroup(group)
end
function MangAdmin:TogglePopup(value, param)
-- this toggles the MangAdmin Search Popup frame, toggling deactivated, popup will be overwritten
--[[if ma_popupframe:IsVisible() then
FrameLib:HandleGroup("popup", function(frame) frame:Hide() end)
else]]
if value == "search" then
FrameLib:HandleGroup("popup", function(frame) frame:Show() end)
getglobal("ma_ptabbutton_1_texture"):SetGradientAlpha("vertical", 102, 102, 102, 1, 102, 102, 102, 0.7)
getglobal("ma_ptabbutton_2_texture"):SetGradientAlpha("vertical", 102, 102, 102, 0, 102, 102, 102, 0.7)
ma_mailscrollframe:Hide()
ma_maileditbox:Hide()
ma_var1editbox:Hide()
ma_var2editbox:Hide()
ma_var1text:Hide()
ma_var2text:Hide()
ma_searchbutton:SetScript("OnClick", function() self:SearchStart(param.type, ma_searcheditbox:GetText()) end)
ma_searchbutton:SetText(Locale["ma_SearchButton"])
ma_resetsearchbutton:SetScript("OnClick", function() MangAdmin:SearchReset() end)
ma_resetsearchbutton:SetText(Locale["ma_ResetButton"])
ma_resetsearchbutton:Enable()
ma_ptabbutton_1:SetScript("OnClick", function() MangAdmin:TogglePopup("search", {type = param.type}) end)
ma_ptabbutton_2:SetScript("OnClick", function() MangAdmin:TogglePopup("favorites", {type = param.type}) end)
ma_ptabbutton_2:Show()
ma_selectallbutton:SetScript("OnClick", function() self:Favorites("select", param.type) end)
ma_deselectallbutton:SetScript("OnClick", function() self:Favorites("deselect", param.type) end)
ma_modfavsbutton:SetScript("OnClick", function() self:Favorites("add", param.type) end)
ma_modfavsbutton:SetText(Locale["ma_FavAdd"])
ma_modfavsbutton:Enable()
self:SearchReset()
self.db.char.requests.toggle = true
if param.type == "item" then
ma_ptabbutton_1:SetText(Locale["ma_ItemButton"])
ma_var1editbox:Show()
ma_var1text:Show()
ma_var1text:SetText(Locale["ma_ItemVar1Button"])
elseif param.type == "itemset" then
ma_ptabbutton_1:SetText(Locale["ma_ItemSetButton"])
elseif param.type == "spell" then
ma_ptabbutton_1:SetText(Locale["ma_SpellButton"])
elseif param.type == "skill" then
ma_ptabbutton_1:SetText(Locale["ma_SkillButton"])
ma_var1editbox:Show()
ma_var2editbox:Show()
ma_var1text:Show()
ma_var2text:Show()
ma_var1text:SetText(Locale["ma_SkillVar1Button"])
ma_var2text:SetText(Locale["ma_SkillVar2Button"])
elseif param.type == "quest" then
ma_ptabbutton_1:SetText(Locale["ma_QuestButton"])
elseif param.type == "creature" then
ma_ptabbutton_1:SetText(Locale["ma_CreatureButton"])
elseif param.type == "object" then
ma_ptabbutton_1:SetText(Locale["ma_ObjectButton"])
ma_var1editbox:Show()
ma_var2editbox:Show()
ma_var1text:Show()
ma_var2text:Show()
ma_var1text:SetText(Locale["ma_ObjectVar1Button"])
ma_var2text:SetText(Locale["ma_ObjectVar2Button"])
elseif param.type == "tele" then
ma_ptabbutton_1:SetText(Locale["ma_TeleSearchButton"])
elseif param.type == "ticket" then
--[[ma_modfavsbutton:Hide()
ma_selectallbutton:Hide()
ma_deselectallbutton:Hide()
ma_ptabbutton_2:Hide()
ma_lookupresulttext:SetText(Locale["ma_TicketCount"].."0")
ma_ptabbutton_1:SetText(Locale["ma_LoadTicketsButton"])
ma_searchbutton:SetText(Locale["ma_Reload"])
ma_searchbutton:SetScript("OnClick", function() self:LoadTickets() end)
ma_resetsearchbutton:SetText(Locale["ma_LoadMore"])
ma_resetsearchbutton:SetScript("OnClick", function() MangAdmin.db.account.tickets.loading = true; self:LoadTickets(MangAdmin.db.account.tickets.count) end)]]--
end
elseif value == "favorites" then
self:SearchReset()
getglobal("ma_ptabbutton_2_texture"):SetGradientAlpha("vertical", 102, 102, 102, 1, 102, 102, 102, 0.7)
getglobal("ma_ptabbutton_1_texture"):SetGradientAlpha("vertical", 102, 102, 102, 0, 102, 102, 102, 0.7)
ma_modfavsbutton:SetScript("OnClick", function() self:Favorites("remove", param.type) end)
ma_modfavsbutton:SetText(Locale["ma_FavRemove"])
ma_modfavsbutton:Enable()
self:Favorites("show", param.type)
elseif value == "mail" then
getglobal("ma_ptabbutton_1_texture"):SetGradientAlpha("vertical", 102, 102, 102, 1, 102, 102, 102, 0.7)
getglobal("ma_ptabbutton_2_texture"):SetGradientAlpha("vertical", 102, 102, 102, 0, 102, 102, 102, 0.7)
FrameLib:HandleGroup("popup", function(frame) frame:Show() end)
for n = 1,7 do
getglobal("ma_PopupScrollBarEntry"..n):Hide()
end
ma_lookupresulttext:SetText(Locale["ma_MailBytesLeft"].."246")
ma_lookupresulttext:Show()
ma_resetsearchbutton:Hide()
ma_PopupScrollBar:Hide()
ma_searcheditbox:SetScript("OnTextChanged", function() MangAdmin:UpdateMailBytesLeft() end)
ma_var1editbox:SetScript("OnTextChanged", function() MangAdmin:UpdateMailBytesLeft() end)
ma_modfavsbutton:Hide()
ma_selectallbutton:Hide()
ma_deselectallbutton:Hide()
if param.recipient then
ma_searcheditbox:SetText(param.recipient)
else
ma_searcheditbox:SetText(Locale["ma_MailRecipient"])
end
if param.body then
ma_maileditbox:SetText(param.body)
else
ma_maileditbox:SetText(Locale["ma_MailRecipient"])
end
ma_ptabbutton_1:SetText(Locale["ma_Mail"])
ma_ptabbutton_2:Hide()
ma_searchbutton:SetText(Locale["ma_Send"])
ma_searchbutton:SetScript("OnClick", function() self:SendMail(ma_searcheditbox:GetText(), ma_var1editbox:GetText(), ma_maileditbox:GetText()); ma_popupframe:Hide() end)
ma_var2editbox:Hide()
ma_var2text:Hide()
if param.subject then
ma_var1editbox:SetText(param.subject)
else
ma_var1editbox:SetText(Locale["ma_MailSubject"])
end
ma_var1editbox:Show()
ma_var1text:SetText(Locale["ma_MailSubject"])
ma_var1text:Show()
ma_maileditbox:SetText(Locale["ma_MailYourMsg"])
end
end
function MangAdmin:HideAllGroups()
FrameLib:HandleGroup("main", function(frame) frame:Hide() end)
FrameLib:HandleGroup("char", function(frame) frame:Hide() end)
FrameLib:HandleGroup("npc", function(frame) frame:Hide() end)
FrameLib:HandleGroup("go", function(frame) frame:Hide() end)
FrameLib:HandleGroup("tele", function(frame) frame:Hide() end)
FrameLib:HandleGroup("ticket", function(frame) frame:Hide() end)
FrameLib:HandleGroup("server", function(frame) frame:Hide() end)
FrameLib:HandleGroup("misc", function(frame) frame:Hide() end)
FrameLib:HandleGroup("log", function(frame) frame:Hide() end)
FrameLib:HandleGroup("who", function(frame) frame:Hide() end)
end
--[[function WaitLoop(seconds)
local stime = time() + seconds
local deltatime = time()
while deltatime < stime do
deltatime = time()
end
end
function MangAdmin:TicketHackTimer()
if self.db.char.requests.ticket then
if (time() - self.db.char.msgDeltaTime) > 0 then
self.db.char.requests.ticketbody = 0
self:RequestTickets()
else
self.db.char.msgDeltaTime = time()
self:LogAction("TicketHackTimer: Please be patient...")
WaitLoop(1)
self:TicketHackTimer()
end
end
end]]
function MangAdmin:AddMessage(frame, text, r, g, b, id)
-- frame is the object that was hooked (one of the ChatFrames)
local catchedSth = false
local output = MangAdmin.db.account.style.showchat
if id == 1 then --make sure that the message comes from the server, message id = 1
--Catches if Toggle is still on for some reason, but search frame is not up, and disables it so messages arent caught
if self.db.char.requests.toggle and not ma_popupframe:IsVisible() then
self.db.char.requests.toggle = false
end
if gettingGOBinfoinfo > 0 then
if gettingGOBinfoinfo == 1 then
ma_gobinfoinfo:SetText('')
ma_gobinfoinfo:SetText(ma_gobinfoinfo:GetText()..text)
else
ma_gobinfoinfo:SetText(ma_gobinfoinfo:GetText().."\n"..text)
end
gettingGOBinfoinfo=gettingGOBinfoinfo+1
if gettingGOBinfoinfo>=5 then
gettingGOBinfoinfo=0
end
end
if gettingGOBinfo > 0 then
if gettingGOBinfo==1 then
ma_gobtargetinfo:SetText("")
ma_gobtargetinfo:SetText(ma_gobtargetinfo:GetText().."|cffffffff"..string.gsub(text, ']', ']\n|cffffffff'))
else
ma_gobtargetinfo:SetText(ma_gobtargetinfo:GetText().."\n|cffffffff"..string.gsub(text, ']', ']\n|cffffffff'))
end
gettingGOBinfo=gettingGOBinfo+1
if gettingGOBinfo>=7 then
gettingGOBinfo=0
gettingGOBinfoinfo=1
end
end
if cWorking == 1 then
WorkString = string.gsub(text, '(|.........)', '') -- This removes any color formating
--SendChatMessage("Workstring:"..WorkString)
for cMap in string.gmatch(WorkString,'Map: %d')do
--SendChatMessage("Mapo: "..cMap)
end
t = {}
cnt = 1
for cX, cY, cZ, cO in string.gmatch(WorkString, 'X: (.*) Y: (.*) Z: (.*) .*Orientation: (.*)') do
--[[ for w in string.gmatch(WorkString,'%s.%d*%p%d%d') do
t[cnt] = string.gsub(w," ","")
cnt = cnt + 1
end
cX = t[1]
cY = t[2]
cZ = t[3]
cO = t[4] ]]
--Calulate the new x y bassed on incX
--SendChatMessage(cX)
--SendChatMessage(cY)
--SendChatMessage(cZ)
--SendChatMessage(cO)
nX = cX + (math.cos(cO) * incX)
nY = cY + (math.sin(cO) * incX)
--rotate the O so we can do some math
tD = math.deg(cO) + 90
if tD > 360 then tD = tD - 360 end
nO = math.rad(tD)
--Calulate the new x y bassed on incX
nX = nX + (math.cos(nO) * incY)
nY = nY + (math.sin(nO) * incY)
--Send the port
SendChatMessage('.go xyz '..' '..nX..' '..nY..' '..(cZ+incZ))
--console reloadui
incX = 0
incY = 0
incZ = 0
isChecked = ma_spawnonmovecheck:GetChecked()
isChecked2 = ma_moveonmovecheck:GetChecked()
if isChecked == 1 then --AddonMove
ObjectN = ma_Obj_idbutton:GetText()
SendChatMessage('.gob add '..ObjectN)
elseif isChecked2 == 1 then --MoveonMove
SendChatMessage('.gob del '..ma_Obj_guidbutton:GetText())
ObjectN = ma_Obj_idbutton:GetText()
SendChatMessage('.gob add '..ObjectN)
else -- Just move player
end
cWorking = 0
end
OBJTarget()
end
-- hook .gps for gridnavigation
for x, y in string.gmatch(text, Strings["ma_GmatchGPS"]) do
for k,v in pairs(self.db.char.functionQueue) do
if v == "GridNavigate" then
GridNavigate(string.format("%.1f", x), string.format("%.1f", y), nil)
table.remove(self.db.char.functionQueue, k)
break
end
end
end
if MangAdmin:ID_Setting_Start_Read() then
local b1,e1,pattern = string.find(text, "GUID: (%d+)%.")
--local b1,e1,pattern = string.find(text, "GUID:")
if b1 then
b1,e1,pattern = string.find(text, "([0-9]+)")
if b1 then
MangAdmin:ID_Setting_Start_Write(0)
MangAdmin:ID_Setting_Write(0,pattern)
ma_NPC_guidbutton:SetText(pattern)
self:LogAction("NPC_GUID_Get id "..pattern..".")
end
else
end
b1,e1,pattern = string.find(text, "Entry: (%d+)%.")
if b1 then
b1,e1,pattern = string.find(text, "([0-9]+)")
if b1 then
MangAdmin:ID_Setting_Write(1,pattern)
ma_NPC_idbutton:SetText(pattern)
self:LogAction("NPC_EntryID_Get id "..pattern..".")
end
else
end
b1,e1,pattern = string.find(text, "DisplayID: (%d+).*")
if b1 then
b1,e1,pattern = string.find(text, "([0-9]+)")
if b1 then
--MangAdmin:ID_Setting_Write(1,pattern)
ma_npcdisplayid:SetText(pattern)
self:LogAction("NPC_DisplayID_Get id "..pattern..".")
end
else
end
end
if MangAdmin:OID_Setting_Start_Read() then
local b1,e1,pattern = string.find(text, "GUID: (%d+) ")
--local b1,e1,pattern = string.find(text, "GUID:")
if b1 then
b1,e1,pattern = string.find(text, "([0-9]+)")
if b1 then
MangAdmin:OID_Setting_Start_Write(0)
MangAdmin:OID_Setting_Write(0,pattern)
ma_Obj_guidbutton:SetText(pattern)
self:LogAction("OBJECT_GUID_Get id "..pattern..".")
end
else
end
--b1,e1,pattern = string.find(text, "ID: (%d+)% ")
--b1,e1,pattern = string.find(text, "GUID: (%d+) ID: (%d+)")
b1,e1,xpattern = string.find(text, " ID: (%d+)")
if b1 then
--b1,e1,pattern = string.find(text, "([0-9]+)")
b1,e1,pattern = string.find(xpattern, "([0-9]+)")
if b1 then
-- MangAdmin:OID_Setting_Write(1,pattern)
ma_Obj_idbutton:SetText(pattern)
self:LogAction("OBJECT_EntryID_Get id "..pattern..".")
end
else
end
b1,e1,xpattern = string.find(text, "DisplayID: (%d+)")
if b1 then
--b1,e1,pattern = string.find(text, "([0-9]+)")
b1,e1,pattern = string.find(xpattern, "([0-9]+)")
if b1 then
-- MangAdmin:OID_Setting_Write(1,pattern)
-- ma_Obj_idbutton:SetText(pattern)
ma_gobdisplayid:SetText(pattern)
self:LogAction("OBJECT DisplayID"..pattern..".")
end
else
end
end
if MangAdmin:Way_Point_Add_Start_Read() then
b1,e1,pattern = string.find(text, "Waypoint (%d+)")
if b1 then
MangAdmin:Way_Point_Add_Start_Write(0)
local wnpc = ma_NPC_guidbutton:GetText()
self:ChatMsg(".wp show on "..wnpc)
self:LogAction("Waypoint set OK")
else
end
end
if self.db.char.requests.toggle then
if self.db.char.requests.item then
-- hook all item lookups
for id, name in string.gmatch(text, Strings["ma_GmatchItem"]) do
table.insert(self.db.account.buffer.items, {itId = id, itName = name, checked = false})
-- for item info in cache
local itemName, itemLink, itemQuality, _, _, _, _, _, _ = GetItemInfo(id);
if not itemName then
GameTooltip:SetOwner(ma_popupframe, "ANCHOR_RIGHT")
GameTooltip:SetHyperlink("item:"..id..":0:0:0:0:0:0:0")
GameTooltip:Hide()
end
PopupScrollUpdate()
catchedSth = true
output = MangAdmin.db.account.style.showchat
end
elseif self.db.char.requests.itemset then
-- hook all itemset lookups
for id, name in string.gmatch(text, Strings["ma_GmatchItemSet"]) do
table.insert(self.db.account.buffer.itemsets, {isId = id, isName = name, checked = false})
PopupScrollUpdate()
catchedSth = true
output = MangAdmin.db.account.style.showchat
end
elseif self.db.char.requests.spell then
-- hook all spell lookups
for id, name in string.gmatch(text, Strings["ma_GmatchSpell"]) do
table.insert(self.db.account.buffer.spells, {spId = id, spName = name, checked = false})
PopupScrollUpdate()
catchedSth = true
output = MangAdmin.db.account.style.showchat
end
elseif self.db.char.requests.skill then
-- hook all skill lookups
for id, name in string.gmatch(text, Strings["ma_GmatchSkill"]) do
table.insert(self.db.account.buffer.skills, {skId = id, skName = name, checked = false})
PopupScrollUpdate()
catchedSth = true
output = MangAdmin.db.account.style.showchat
end
elseif self.db.char.requests.creature then
-- hook all creature lookups
for id, name in string.gmatch(text, Strings["ma_GmatchCreature"]) do
table.insert(self.db.account.buffer.creatures, {crId = id, crName = name, checked = false})
PopupScrollUpdate()
catchedSth = true
output = MangAdmin.db.account.style.showchat
end
elseif self.db.char.requests.object then
-- hook all object lookups
for id, name in string.gmatch(text, Strings["ma_GmatchGameObject"]) do
table.insert(self.db.account.buffer.objects, {objId = id, objName = name, checked = false})
PopupScrollUpdate()
catchedSth = true
output = MangAdmin.db.account.style.showchat
end
elseif self.db.char.requests.quest then
-- hook all quest lookups
for id, name in string.gmatch(text, Strings["ma_GmatchQuest"]) do
table.insert(self.db.account.buffer.quests, {qsId = id, qsName = name, checked = false})
PopupScrollUpdate()
catchedSth = true
output = MangAdmin.db.account.style.showchat
end
elseif self.db.char.requests.tele then
-- hook all tele lookups
for id, name in string.gmatch(text, Strings["ma_GmatchTele"]) do
table.insert(self.db.account.buffer.teles, {tName = name, checked = false})
PopupScrollUpdate()
catchedSth = true
output = MangAdmin.db.account.style.showchat
end
--this is to hide the message shown before the teles
if string.gmatch(text, Strings["ma_GmatchTeleFound"]) then
catchedSth = true
output = MangAdmin.db.account.style.showchat
end
end
end
-- for diff in string.gmatch(text, Strings["ma_GmatchUpdateDiff"]) do
-- ma_difftext:SetText(diff)
-- catchedSth = true
-- -- output = MangAdmin.db.account.style.showchat
-- output = MangAdmin.db.account.style.showchat
-- end
for difftime in string.gmatch(text, Strings["ma_GmatchUpdateDiffTime"]) do --We just want the Diff time number value
ma_difftext:SetText(difftime)
catchedSth = true
output = MangAdmin.db.account.style.showchat
end
-- hook all new tickets
for name in string.gmatch(text, Strings["ma_GmatchNewTicket"]) do
self:SetIcon(ROOT_PATH.."Textures\\icon2.tga")
PlaySoundFile(ROOT_PATH.."Sound\\mail.wav")
self:LogAction("Got new ticket from: "..name)
end
-- hook player account info
for status, char, guid, account, id, level, ip, login, latency in string.gmatch(text, Strings["ma_GmatchAccountInfo"]) do
if self.db.char.requests.tpinfo then
if status == "" then
status = Locale["ma_Online"]
else
status = Locale["ma_Offline"]
end
--table.insert(self.db.account.buffer.tpinfo, {char = {pStatus = status, pGuid = guid, pAcc = account, pId = id, pLevel = level, pIp = ip}})
ma_tpinfo_text:SetText(ma_tpinfo_text:GetText()..Locale["ma_TicketsInfoPlayer"]..char.." ("..guid..")\n"..Locale["ma_TicketsInfoStatus"]..status.."\n"..Locale["ma_TicketsInfoAccount"]..account.." ("..id..")\n"..Locale["ma_TicketsInfoAccLevel"]..level.."\n"..Locale["ma_TicketsInfoLastIP"]..ip.."\n"..Locale["ma_TicketsInfoLatency"]..latency)
catchedSth = true
output = MangAdmin.db.account.style.showchat
end
end
-- hook player account info
for played, level, money in string.gmatch(text, Strings["ma_GmatchAccountInfo2"]) do
if self.db.char.requests.tpinfo then
ma_tpinfo_text:SetText(ma_tpinfo_text:GetText().."\n"..Locale["ma_TicketsInfoPlayedTime"]..played.."\n"..Locale["ma_TicketsInfoLevel"]..level.."\n"..Locale["ma_TicketsInfoMoney"]..money)
catchedSth = true
output = MangAdmin.db.account.style.showchat
self.db.char.requests.tpinfo = false
end
end
--checking for .server info command to pull information for bottom right frame
for revision in string.gmatch(text, Strings["ma_GmatchRevision"]) do
ma_inforevisiontext:SetText(Locale["info_revision"]..revision)
--ma_infoplatformtext:SetText(Locale["info_platform"]..platform)
catchedSth = true
-- output = MangAdmin.db.account.style.showchat
output = MangAdmin.db.account.style.showchat
end
for users in string.gmatch(text, Strings["ma_GmatchOnlinePlayers"]) do
ma_infoonlinetext:SetText(Locale["info_online"]..users)
catchedSth = true
-- output = MangAdmin.db.account.style.showchat
output = MangAdmin.db.account.style.showchat
end
for maxConnections in string.gmatch(text, Strings ["ma_GmatchMaxConnections"]) do
ma_infomaxonlinetext:SetText(Locale["info_maxonline"]..maxConnections)
catchedSth = true
output = MangAdmin.db.account.style.showchat
end
for uptime in string.gmatch(text, Strings["ma_GmatchUptime"]) do
ma_infouptimetext:SetText(Locale["info_uptime"]..uptime)
catchedSth = true
-- output = MangAdmin.db.account.style.showchat
output = MangAdmin.db.account.style.showchat
end
for match in string.gmatch(text, Strings["ma_GmatchActiveConnections"]) do
catchedSth = true
-- output = MangAdmin.db.account.style.showchat
output = MangAdmin.db.account.style.showchat
end
-- get results of ticket list. In Trinity, everything will be constructed off the list
for id, char, create, update in string.gmatch(text, Strings["ma_GmatchTickets"]) do
table.insert(MangAdmin.db.account.buffer.tickets, {tNumber = id, tChar = char, tLCreate = create, tLUpdate = update, tMsg = ""})
local ticketCount = 0
table.foreachi(MangAdmin.db.account.buffer.tickets, function() ticketCount = ticketCount + 1 end)
ticketCount = 0
catchedSth = true
output = MangAdmin.db.account.style.showchat
self.db.char.requests.ticketbody = id
self.db.char.msgDeltaTime = time()
end
for msg in string.gmatch(text, Strings["ma_GmatchTicketMessage"]) do
MangAdmin.db.account.buffer.ticketsfull = {}
table.remove(MangAdmin.db.account.buffer.ticketsfull, 1)
table.insert(MangAdmin.db.account.buffer.ticketsfull, {tMsg = ""})
ma_ticketdetail:SetText("|cffffff00"..msg) -- Change to yellow to match formatting
catchedSth = true
output = MangAdmin.db.account.style.showchat
end
for eraseme in string.gmatch(text, "Showing list of open tickets") do
catchedSth = true
output = MangAdmin.db.account.style.showchat
end
for acc, char, ip, map, zone, exp, gmlevel in string.gmatch(text, Strings["ma_GmatchWho"]) do
acc= string.gsub(acc, " ", "")
char= string.gsub(char, " ", "")
ip= string.gsub(ip, " ", "")
map=string.gsub(map, " ", "")
zone=string.gsub(zone, " ", "")
exp= string.gsub(exp, " ", "")
gmlevel= string.gsub(gmlevel, " ", "")
gmlevel=strtrim(gmlevel, "]-")
--self:ChatMsg("Matched Who")
if acc == "Account" then
else
table.insert(MangAdmin.db.account.buffer.who, {tAcc = acc, tChar = char, tIP = ip, tMap = map, tZone = zone, tExp = exp, tGMLevel = gmlevel})
end
catchedSth = true
output = MangAdmin.db.account.style.showchat
WhoUpdate()
end
-- ["ma_GmatchAccountInfo"] = "Player(.*) %(guid: (%d+)%) Account: (.*) %(id: (%d+)%) Email: (.*) GMLevel: (%d+) Last IP: (.*) Last login: (.*) Latency: (%d+)ms",
-- ["ma_GmatchAccountInfo2"] = "Race: (.*) Class: (.*) Played time: (.*) Level: (%d+) Money: (.*)",
for charname, charguid, account, accountid, email, gmlvl, lastip, lastlogin, latency in string.gmatch(text, Strings["ma_GmatchAccountInfo"]) do
ma_whodetail:SetText("|c00ff00ffCharacter:|r"..charname.." |cffffffff("..charguid..")|r\n".."|c00ff0000Acct:|r|cffffffff"..account.." ("..accountid..")|r\n".."|c00ff0000IP:|r|cffffffff"..lastip.."|r\n".."|c00ff0000Login:|r|cffffffff"..lastlogin.."|r\n".."|c00ff0000Latency:|r|cffffffff"..latency.."ms|r\n")
catchedSth = true
output = MangAdmin.db.account.style.showchat
end
for race, class, playedtime, level, money in string.gmatch(text, Strings["ma_GmatchAccountInfo2"]) do
--self:ChatMsg("Matched Who")
ma_whodetail2:SetText("|c00ff0000Race:|r|cffffffff"..race.."|r\n".."|c00ff0000Class|r|cffffffff"..class.."|r\n".."|c00ff0000Level:|r|cffffffff"..level.."|r\n".."|c00ff0000Money:|r|cffffffff"..money.."|r\n".."|c00ff0000Played Time:|r|cffffffff"..playedtime.."|r\n")
catchedSth = true
output = MangAdmin.db.account.style.showchat
end
for mymatch in string.gmatch(text, "=====") do
catchedSth = true
output = MangAdmin.db.account.style.showchat
end
for mymatch in string.gmatch(text, "Characters Online:") do
catchedSth = true
output = MangAdmin.db.account.style.showchat