-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzUtilities.lua
More file actions
1777 lines (1534 loc) · 61.1 KB
/
zUtilities.lua
File metadata and controls
1777 lines (1534 loc) · 61.1 KB
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
--------------------------------------------------------------------------------
-- Author: Dustin Z. zUtilities.lua
-- Name: zUtilities
-- Abstract:
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Global Variables
--------------------------------------------------------------------------------
zUtilities = {}
wipe(zUtilities)
zUtilities = LibStub("AceAddon-3.0"):NewAddon("zUtilities", "AceEvent-3.0", "AceHook-3.0", "AceConsole-3.0","AceTimer-3.0")
local L = LibStub("AceLocale-3.0"):GetLocale("zUtilities")
zUtilities.L = L
-- Defines the name of our mod
local addon, ns = ... -- Defines the name and table of our mod
local mod = zUtilities
local debug = false
--------------------------------------------------------------------------------
-- Name: deepcopy(object)
-- Abstract:
--------------------------------------------------------------------------------
local function deepcopy(object)
local lookup_table = {}
local function _copy(object)
if type(object) ~= "table" then
return object
elseif lookup_table[object] then
return lookup_table[object]
end
local new_table = {}
lookup_table[object] = new_table
for index, value in pairs(object) do
new_table[_copy(index)] = _copy(value)
end
return setmetatable(new_table, getmetatable(object))
end
return _copy(object)
end
local options2 = {
name = "zUtilities",
type = "group",
desc = "Options",
args = {
enabled = {
name = "Enable",
type = "toggle",
desc = "Enables / disables zUtilities",
get = function() return db.enabled end,
set = function(i, switch)
db.enabled = switch
end
},
debugging = {
name = "debugging",
type = "toggle",
desc = "enables / disables debugging mode",
get = function() return db.debugging end,
set = function(i, switch)
db.debugging = switch
debug = switch
end
},
},
}
local options = deepcopy(options2)
options.args.auto = {
name = "automations",
type = "group",
desc = "Automations",
args = {
autoAcceptFriendInvites = {
name = "friend invite",
type = "toggle",
desc = "auto accept invite requests from players on your friends list",
get = function() return db.autoAcceptFriendInvites end,
set = function(i, switch)
db.autoAcceptFriendInvites = switch
end
},
autoAcceptGuildInvites = {
name = "guild invite",
type = "toggle",
desc = "auto accept invite requests from guildmates",
get = function() return db.autoAcceptGuildInvites end,
set = function(i, switch)
db.autoAcceptGuildInvites = switch
end
},
autoRepair = {
name = "auto repair",
-- type = "select",
-- desc = "Repair all Equipment and Inventory automatically.",
-- values = {"Disabled", "Own Money", "Guild Money"},
type = "toggle",
desc = "automatically repair gear",
get = function() return db.autoRepair end,
set = function(i, switch)
if db.autoRepair then
-- if db.autoSellJunk or db.AutoRevive then
-- return
mod.Merchant_Show = true
db.autoRepair = 1
elseif not switch then
if db.autoSellJunk then return end --or db.AutoRevive then return end
mod.Merchant_Show = false
db.autoRepair = 0
end
end
},
ignoreDuels = {
name = "ignore duels",
type = "toggle",
desc = "ignore duels",
get = function() return db.ignoreDuels end,
set = function(i, switch)
db.ignoreDuels = switch
if switch then
else
end
end
},
betterAutoLoot = {
name = "better auto loot",
type = "toggle",
desc = "Automatically loot all Items and confirm BoP and Disenchant Notification. It does not roll on Items while in a group or raid. This overrides the standard UI Auto Loot setting.",
get = function() return db.betterAutoLoot end,
set = function(i, switch)
db.betterAutoLoot = switch
end
},
autoSellJunk = {
name = "sell grey items",
type = "toggle",
desc = "Sell Grey (junk) Items in your Bags automatically.",
get = function() return db.autoSellJunk end,
set = function(i, switch)
db.autoSellJunk = switch
if switch then
mod.Merchant_Show = true
else
if db.autoSellJunk or db.autoRepair then return end --or db.AutoRevive then return end
mod.Merchant_Show = false
end
end
},
},
}
options.args.chat = {
name = "chat",
type = "group",
desc = "Chat Options",
args = {
chatFade = {
name = "Disable Chat Fading",
type = "toggle",
desc = "Disable Chat Frames Fading Chat after Inactivity.",
get = function() return db.chatFade end,
set = function(i, switch)
db.chatFade = switch
mod:ChatFadeToggle()
end
},
partyFrames = {
name = "Default Party Frames",
type = "toggle",
desc = "Hide Blizzard Default Party Frames.",
get = function() return db.PartyFrames end,
set = function(i, switch)
db.PartyFrames = switch
-- mod:PartyFrames()
end
},
raidFrames = {
name = "Default Frames",
type = "toggle",
desc = "Hide Blizzard Default Raid Frames.",
get = function() return db.RaidFrames end,
set = function(i, switch)
db.RaidFrames = switch
-- mod:RaidFrames()
end
}
}
}
options.args.ui = {
name = "UI",
type = "group",
desc = "User Interface Options",
args = {
betterReputation = {
name = "Better Reputation",
type = "toggle",
desc = "Display Reputation Amounts numerically and detailed Information in the Chat Frame.",
get = function() return db.betterReputation end,
set = function(i, switch)
db.betterReputation = switch
if switch then
mod:zRepOn()
else
mod:zRepOff()
end
end
},
toggleGryphons = {
name = "Disable Gryphons",
type = "toggle",
desc = "Hide Gryphons on Main Toolbar.",
get = function() return db.toggleGryphons end,
set = function(i, switch)
db.toggleGryphons = switch
mod:toggleGryphons()
end
},
showQuestLevels = {
name = "Display Quest Levels",
type = "toggle",
desc = "Display numeric Quest Level in Quest Frame, Quest completion Frame, and NPC Quest Dialog.",
get = function() return db.showQuestLevels end,
set = function(i, switch)
db.showQuestLevels = switch
if switch then
mod:SecureHook("GossipFrameUpdate", "gossipQuestFormat")
mod:SecureHook(QUEST_TRACKER_MODULE, "Update", "updateWatchFrame")
mod:SecureHook("QuestLogQuests_Update", "updateQuestLog")
-- mod:SecureHook("ObjectiveTracker_Update", "updateWatchFrame")
-- mod:SecureHook(QuestScrollFrame, "Update", "updateQuestLog")
-- mod:SecureHookScript(QuestFrameGreetingPanel, "OnShow", "updateQuestFrame")
mod:SecureHook("QuestFrameGreetingPanel_OnShow", "updateQuestFrame")
mod:SecureHook("QuestInfo_Display", "updateQuestInfo")
mod:ceFilters()
if not mod.Gossip_Show then
mod.Gossip_Show = true
end
else
mod:Unhook("GossipFrameUpdate")
mod:Unhook(QUEST_TRACKER_MODULE, "Update")
mod:Unhook("QuestLogQuests_Update")
-- mod:Unhook("ObjectiveTracker_Update")
-- mod:Unhook(QuestScrollFrame, "Update")
-- mod:Unhook(QuestFrameGreetingPanel, "OnShow")
mod:Unhook("QuestFrameGreetingPanel_OnShow")
mod:Unhook("QuestInfo_Display")
if not db.SkipGossip and not db.showQuestLevels then -- and not db.AutoRevive then
mod.Gossip_Show = false
end
end
end
},
-- SkipGossip = {
-- name = "Skip useless Gossips",
-- type = "toggle",
-- desc = "Skip Battlemaster, Banker, and Flightmaster Gossip.",
-- get = function() return db.SkipGossip end,
-- set = function(i, switch)
-- db.SkipGossip = switch
-- if switch then
-- if not mod.Gossip_Show then
-- mod:RegisterEvent("GOSSIP_SHOW", "zOnEvent")
-- mod.Gossip_Show = true
-- end
-- else
-- if db.SkipGossip or db.showQuestLevels or db.AutoRevive then return end
-- mod:UnregisterEvent("GOSSIP_SHOW")
-- mod.Gossip_Show = false
-- end
-- end
-- end
-- },
}
}
options.args.minimap = {
name = "minimap",
type = "group",
desc = "Minimap Options",
args = {
toggleBorder = {
name = "Minimap Border",
type = "toggle",
desc = "Hide the Minimap border.",
get = function() return db.toggleBorder end,
set = function(i, switch)
db.toggleBorder = switch
if switch then
MinimapBorder:Hide()
else
MinimapBorder:Show()
end
end
},
toggleClock = {
name = "Hide Game Clock",
type = "toggle",
desc = "Hide Game Clock below the minimap.",
get = function() return db.toggleClock end,
set = function(i, switch)
db.toggleClock = switch
mod:toggleClock()
end
},
toggleClutter = {
name = "Toggle Clutter",
type = "toggle",
desc = "Toggle Minimap Clock, Scroll Buttons, and Location Frame.",
get = function() return db.toggleClutter end,
set = function(i, switch)
db.toggleClutter = switch
if switch then
mod:MinMapClutterHide()
else
mod:MinMapClutterShow()
end
end
},
miniMapCoordinates = {
name = "Map X,Y Coords",
type = "toggle",
desc = "Adds Numeric X,Y Coordinates below the Minimap.",
get = function() return db.miniMapCoordinates end,
set = function(i, switch)
db.miniMapCoordinates = switch
if switch then
mod:MapLocationOn()
else
mod:MapLocationOff()
end
end
},
mapScroll = {
name = "MouseWheel Zoom",
type = "toggle",
desc = "Enables MouseWheel zooming of the Minimap.",
get = function() return db.mapScroll end,
set = function(i, switch)
db.mapScroll = switch
if switch then
mod:mapScroll()
else
mod:mapScroll()
end
end
},
trackingButton = {
name = "Tracking Button",
type = "toggle",
desc = "Hide the Tracking button on the Minimap.",
get = function() return db.trackingButton end,
set = function(i, switch)
db.trackingButton = switch
if switch then
MiniMapTracking:Hide()
else
MiniMapTracking:Show()
end
end
},
worldMapButton = {
name = "World Map Button",
type = "toggle",
desc = "Hide the World Map button on the Minimap.",
get = function() return db.worldMapButton end,
set = function(i, switch)
db.worldMapButton = switch
if switch then
MiniMapWorldMapButton:Hide()
else
MiniMapWorldMapButton:Show()
end
end
}
}
}
--------------------------------------------------------------------------------
-- Name: defaults
-- Abstract: A table which holds our preference variables
--------------------------------------------------------------------------------
local defaults = {
profile = {
autoAcceptFriendInvites = true,
autoAcceptGuildInvites = true,
autoRepair = 1,
autoSellJunk = true,
betterAutoLoot = true,
betterReputation = true,
chatFade = true,
debugging = false,
ignoreDuels = true,
mapScroll = true,
miniMapCoordinates = true,
PartyFrames = false,
showQuestLevels = true,
RaidFrames = false,
SkipGossip = false,
toggleBorder = false,
toggleClock = true,
toggleClutter = true,
toggleGryphons = true,
trackingButton = true,
worldMapButton = true,
enabled = true,
}
}
local function ProfileSetup()
local profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(zUtilities.db)
return profiles
end
--------------------------------------------------------------------------------
-- Name: zUtilities:OnInitialize()
-- Abstract: Our would be constructor, isn't it cute?
--------------------------------------------------------------------------------
function zUtilities:OnInitialize()
self.Merchant_Show = false
self.Gossip_Show = false
self.abacus = LibStub("LibAbacus-3.0")
self.AC = LibStub("AceConfig-3.0"):RegisterOptionsTable("zUtilities", options, "zu")
self.ACR = LibStub("AceConfigRegistry-3.0")
self.ACD = LibStub("AceConfigDialog-3.0")
--# Initialize DB
self.db = LibStub("AceDB-3.0"):New("zUtilitiesDB", defaults)
db = self.db.profile
options.args.profile = ProfileSetup()
--# Register our options
self.ACR:RegisterOptionsTable("zUtilities Blizz", options2)
self.ACR:RegisterOptionsTable("zUtilities Automation", options.args.auto)
self.ACR:RegisterOptionsTable("zUtilities Chat", options.args.chat)
self.ACR:RegisterOptionsTable("zUtilities Interface", options.args.ui)
self.ACR:RegisterOptionsTable("zUtilities Minimap", options.args.minimap)
self.ACR:RegisterOptionsTable("zUtilities Profile", options.args.profile)
self.ACD:AddToBlizOptions("zUtilities Blizz", "zUtilities")
self.ACD:AddToBlizOptions("zUtilities Automation", "Automation", "zUtilities")
self.ACD:AddToBlizOptions("zUtilities Chat", "Chat", "zUtilities")
self.ACD:AddToBlizOptions("zUtilities Interface", "Interface", "zUtilities")
self.ACD:AddToBlizOptions("zUtilities Minimap", "Minimap", "zUtilities")
self.ACD:AddToBlizOptions("zUtilities Profile", "Profile", "zUtilities")
-- slash commands
SlashCmdList["zUtilities"] = function()
InterfaceOptionsFrame_OpenToCategory("zUtilities")
-- InterfaceOptionsFrame_OpenToCategory("zUtilities")
-- self.ACD:SelectGroup("zBattlePets")
end
SLASH_zUtilities1 = "/zUtilities"
SLASH_zUtilities2 = "/zuc"
--# /rl: Reload UI
SlashCmdList["zReloadUI"] = function() ReloadUI() end
SLASH_zReloadUI1 = "/rl"
--# /rg: Restart GFX Subsystem
SlashCmdList["zRestartGX"] = function() RestartGx() end
SLASH_zRestartGX1 = "/rgx"
-- # /rg: Is Quest Completed?
SlashCmdList["zIsQuestCompleted"] = function(input, editbox)
mod:IsQuestCompleted(input)
end
SLASH_zIsQuestCompleted1 = "/iqc"
--# /iqc: check if the quest has been completed and lets you know in your chat frame
--SlashCmdList["isQC"] = function() print(IsQuestFlaggedCompleted(3247)) end
--SLASH_isQC = "/iqc"
-- camera now shows up to 50yrd and not only 35yrd
ConsoleExec("CameraDistanceMax 50")
ConsoleExec("CameraDistanceMaxFactor 8")
-- fix the silly UpdateMicroButtons() issues that came about in 5.4.1, dumb whores
-- if IsAddOnLoaded("Blizzard_AchievementUI") then
-- setfenv(AchievementFrame_OnShow, setmetatable({ UpdateMicroButtons = function() end }, { __index = _G }))
-- setfenv(AchievementFrame_OnHide, setmetatable({ UpdateMicroButtons = function() end }, { __index = _G }))
-- else
-- local zVT = CreateFrame("Frame")
-- zVT:RegisterEvent("ADDON_LOADED", "zOnEvent")
-- zVT:SetScript("OnEvent",function(_,_,addonName)
-- if addonName == "Blizzard_AchievementUI" then
-- setfenv(AchievementFrame_OnShow, setmetatable({ UpdateMicroButtons = function() end }, { __index = _G }))
-- setfenv(AchievementFrame_OnHide, setmetatable({ UpdateMicroButtons = function() end }, { __index = _G }))
-- zVT:UnregisterEvent("ADDON_LOADED")
-- end
-- end)
-- end
-- if IsAddOnLoaded("Blizzard_TrainerUI") then
-- setfenv(ClassTrainerFrame_OnShow, setmetatable({ UpdateMicroButtons = function() end }, { __index = _G }))
-- setfenv(ClassTrainerFrame_OnHide, setmetatable({ UpdateMicroButtons = function() end }, { __index = _G }))
-- else
-- local zVT = CreateFrame("Frame")
-- zVT:RegisterEvent("ADDON_LOADED", "zOnEvent")
-- zVT:SetScript("OnEvent",function(_,_,addonName)
-- if addonName == "Blizzard_TrainerUI" then
-- setfenv(ClassTrainerFrame_OnShow, setmetatable({ UpdateMicroButtons = function() end }, { __index = _G }))
-- setfenv(ClassTrainerFrame_OnHide, setmetatable({ UpdateMicroButtons = function() end }, { __index = _G }))
-- zVT:UnregisterEvent("ADDON_LOADED")
-- end
-- end)
-- end
-- fix more taint
-- Remove the cancel button
-- InterfaceOptionsFrameCancel:Hide()
-- InterfaceOptionsFrameOkay:SetAllPoints(InterfaceOptionsFrameCancel)
-- Make clicking cancel the same as clicking okay
-- InterfaceOptionsFrameCancel:SetScript("OnClick", function() InterfaceOptionsFrameOkay:Click() end)
-- disable CUFP
-- CompactUnitFrameProfiles:UnregisterAllEvents() --This disables the creation of the blizzard raid frames
-- set max FPS to 70, and limit fps down to 30 when WoW is minimized (saves GPU/CPU)
SetCVar("maxFPSBk","30")
mod:zMSG("Loaded!")
end
--------------------------------------------------------------------------------
-- Name: zUtilities:OnEnable()
-- Abstract: Our would be constructor, isn't it cute?
--------------------------------------------------------------------------------
function zUtilities:OnEnable()
zMinimap = CreateFrame("Frame", "zMinimap", MinimapCluster)
-- self.Minimap:SetAllPoints(Minimap)
zMinimap:SetFrameStrata("LOW")
zMinimap.loc = zMinimap:CreateFontString(nil, 'OVERLAY')
zMinimap.loc:SetWidth(90)
zMinimap.loc:SetHeight(16)
zMinimap.loc:SetPoint('TOPLEFT', MinimapCluster, 'BOTTOMLEFT', 65, -16)
-- self.Minimap.loc:SetPoint('CENTER', Minimap, 'BOTTOM', 0, -16)
zMinimap.loc:SetJustifyV('MIDDLE')
zMinimap.loc:SetJustifyH('CENTER')
zMinimap.loc:SetFontObject(GameFontNormal)
for varname, val in pairs(options.args.auto.args) do
if db[varname] then options.args.auto.args[varname].set(false, db[varname]) end
end
for varname, val in pairs(options.args.chat.args) do
if db[varname] then options.args.chat.args[varname].set(false, db[varname]) end
end
for varname, val in pairs(options.args.ui.args) do
if db[varname] then options.args.ui.args[varname].set(false, db[varname]) end
end
for varname, val in pairs(options.args.minimap.args) do
if db[varname] then options.args.minimap.args[varname].set(false, db[varname]) end
end
for varname, val in pairs(options.args.profile.args) do
if db[varname] then options.args.profile.args[varname].set(false, db[varname]) end
end
-- load events
mod:UnregisterAllEvents()
mod:RegisterEvent("ADDON_LOADED", "zOnEvent")
mod:RegisterEvent("CONFIRM_DISENCHANT_ROLL", "zOnEvent")
mod:RegisterEvent("CONFIRM_LOOT_ROLL", "zOnEvent")
mod:RegisterEvent("FACTION_UPDATED", "zOnEvent")
mod:RegisterEvent("GOSSIP_SHOW", "zOnEvent")
mod:RegisterEvent("GROUP_ROSTER_UPDATE", "zOnEvent")
mod:RegisterEvent("LOOT_OPENED", "zOnEvent")
mod:RegisterEvent("MERCHANT_SHOW", "zOnEvent")
mod:RegisterEvent("PARTY_INVITE_REQUEST", "zOnEvent")
mod:RegisterEvent("PLAYER_ENTERING_WORLD", "zOnEvent")
mod:RegisterEvent("QUEST_GREETING", "zOnEvent")
mod:RegisterEvent("QUEST_LOG_UPDATE", "zOnEvent")
mod:RegisterEvent("RAID_ROSTER_UPDATE", "zOnEvent")
mod:RegisterEvent("UPDATE_FACTION", "zOnEvent")
-- /run SetCVar("taintLog",1)
-- /run print(GetCVar("taintLog"))
-- local i = setfenv(AchievementFrame_OnShow, setmetatable({UpdateMicroButtons = function() end}, {__index = _G}))
-- send msg on enable
mod:zMSG("Enabled!")
end
function wave()
local a,x,n,c=5865,{}
for i=1,
GetAchievementNumCriteria(a)
do n,_,c=GetAchievementCriteriaInfo(a,i)
if not c then
x[n]=1
end
end
if x[UnitName("target")] then
DoEmote("wave")
end
end
--------------------------------------------------------------------------------
-- Name: zUtilities:OnDisable()
-- Abstract: Our would be de-constructor, isn't it cute?
--------------------------------------------------------------------------------
function zUtilities:OnDisable()
-- -- Unhook, Unregister Events, Hide frames that you created.
-- -- You would probably only use an OnDisable if you want to
-- -- build a "standby" mode, or be able to toggle modules on/off.
-- send message on disable
mod:zMSG("Disabled!")
mod:UnhookAll()
end
--------------------------------------------------------------------------------
-- Name: zUtilities:zOnEvent()
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:zOnEvent(event, ...)
local arg1 = ...
if (debug) then
mod:zMSG("|cffff0000DEBUG|r event fired -> " .. event)
mod:zDebug("event fired -> " .. event)
end
if (event == "PLAYER_ENTERING_WORLD") then
mod:PLAYER_ENTERING_WORLD()
ChatFrame_AddMessageEventFilter("CHAT_MSG_COMBAT_FACTION_CHANGE", mod.chatFilter)
ChatFrame_AddMessageEventFilter("COMBAT_TEXT_UPDATE", mod.chatFilter)
elseif (event == "UPDATE_FACTION") then
mod:UPDATE_FACTION()
elseif (event == "ADDON_LOADED") and (arg1 == "zUtilities") then
elseif (event == "DUEL_REQUEST") then
mod:DUEL_REQUESTED()
elseif (event == "GROUP_ROSTER_UPDATE") then
StaticPopup_Hide("PARTY_INVITE")
StaticPopup_Hide("PARTY_INVITE_XREALM")
mod:UnregisterEvent("GROUP_ROSTER_UPDATE")
elseif (event == "GUILD_INVITE_REQUEST") then
mod:GUILD_INVITE_REQUEST()
elseif (event == "LOOT_OPENED") then
mod:LOOT_OPENED()
elseif (event == "CONFIRM_DISENCHANT_ROLL") or (event == "CONFIRM_LOOT_ROLL") then
local rollId = select(1, ...)
local rollType = select(2, ...)
mod:parseRoll(rollId, rollType)
mod:parseRoll(rollId, rollType)
elseif (event == "MERCHANT_SHOW") then
mod:MERCHANT_SHOW()
elseif (event == "GOSSIP_SHOW") or (event == "GOSSIP_CONFIRM") then
mod:gossipHandler()
elseif (event == "PARTY_INVITE_REQUEST") then
mod:inviteHandler(arg1)
mod:RegisterEvent("GROUP_ROSTER_UPDATE", "zOnEvent")
elseif (event == "QUEST_GREETING") or (event == "QUEST_LOG_UPDATE") then
-- mod:gossipHandler()
-- mod:updateQuestFrame()
elseif (event == "ZONE_CHANGED_NEW_AREA") then
mod:ZONE_CHANGED_NEW_AREA()
-- elseif (event == "") then
-- mod:
-- elseif (event == "") then
-- mod:
-- elseif (event == "") then
-- mod:
-- elseif (event == "") then
-- mod:
elseif (event == "PARTY_MEMBERS_CHANGED") then
-- mod:PartyFrames()
elseif (event == "RAID_ROSTER_CHANGED") then
-- mod:RaidFrames()
end
end
--------------------------------------------------------------------------------
-- Name: zUtilities:zMSGc(msg, r, g, b)
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:zMSGc(msg, r, g, b)
-- strMod = format("|cff0062ffz|r|cff0deb11Utilities|r")
strMod = format("|cff696969z|r|cff008B8BUtilities|r: ")
DEFAULT_CHAT_FRAME:AddMessage(strMod .. tostring(msg), r, g, b)
end
--------------------------------------------------------------------------------
-- Name: zUtilities:zMSG(msg)
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:zMSG(msg)
-- strMod = format("|cff0062ffz|r|cff0deb11Utilities|r")
strMod = format("|cff696969z|r|cff008B8BUtilities|r: ")
DEFAULT_CHAT_FRAME:AddMessage(strMod .. tostring(msg))
end
--------------------------------------------------------------------------------
-- Name: zUtilities:zDebug(msg)
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:zDebug(msg)
mod:zMSG("|cffff0000DEBUG|r " .. tostring(msg))
end
--------------------------------------------------------------------------------
-- Name: zUtilities:zPrint(msg)
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:zPrint(msg)
-- strMod = format("|cff0062ffz|r|cff0deb11Utilities|r")
strMod = format("|cff696969z|r|cff008B8BUtilities|r: ")
self:Print(strMod .. tostring(msg))
end
--------------------------------------------------------------------------------
-- Name: zUtilities:IsQuestCompleted
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:IsQuestCompleted(qid)
-- mod:zMSG("quest " .. qid .. "? " .. tostring(IsQuestFlaggedCompleted(qid)))
mod:zMSG(("The quest with ID: #%s is %scomplete!"):format(qid, IsQuestFlaggedCompleted(qid) and "" or "|cFFFF0000NOT|r "))
end
--------------------------------------------------------------------------------
-- Name: zUtilities:zRepPrint
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:zRepPrint(msg, default)
if not (msg) then return end
local zmsg = tostring(format("|cff696969z|r|cff008B8BUtilities|r: " .. tostring(msg)))
if (default) then
DEFAULT_CHAT_FRAME:AddMessage(zmsg)
else
for i = 1, NUM_CHAT_WINDOWS do
local chatTab = _G["ChatFrame"..i.."Tab"]
if chatTab:IsShown() then
local chatFrame = _G["ChatFrame"..i]
local messageTypes = chatFrame.messageTypeList
for j = 1, #messageTypes do
if messageTypes[j] == "COMBAT_FACTION_CHANGE" then
_G["ChatFrame"..i]:AddMessage(zmsg)
end
end
end
end
end
end
--------------------------------------------------------------------------------
-- Name: zUtilities:autoRepair
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:autoRepair()
local equipcost = GetRepairAllCost()
local funds = GetMoney()
if (funds < equipcost) and (db.autoRepair == 1) then
mod:zMSG("Insufficient Funds to Repair")
end
if (equipcost > 0) then
if (db.autoRepair == 2) then
RepairAllItems(1)
mod:zMSG("Total repair Costs (Guild Funds): " .. self.abacus:FormatMoneyCondensed(equipcost,1))
elseif (db.autoRepair == 1) then
RepairAllItems()
mod:zMSG("Total repair Costs (Personal Funds): " .. self.abacus:FormatMoneyCondensed(equipcost,1))
end
end
end
--------------------------------------------------------------------------------
-- Name: zUtilities:AutoSellJunk()
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:AutoSellJunk()
-- sell junk?
if db.autoSellJunk then
local bag, slot
for bag = 0, 4 do
if GetContainerNumSlots(bag) > 0 then
for slot = 1, GetContainerNumSlots(bag) do
local _, _, _, quality = GetContainerItemInfo(bag, slot)
if (quality == 0 or quality == -1) then
if (mod:ProcessLink(GetContainerItemLink(bag, slot))) then
UseContainerItem(bag, slot)
end
end
end
end
end
end
end
--------------------------------------------------------------------------------
-- Name: zUtilities:ChatFadeToggle()
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:ChatFadeToggle()
if db.chatFade then
for i = 1, NUM_CHAT_WINDOWS do
getglobal('ChatFrame'..i):SetFading(false)
--ChatFrame11:SetFading(false)
end
elseif not db.chatFade then
for i = 1, NUM_CHAT_WINDOWS do
getglobal('ChatFrame'..i):SetFading(true)
--ChatFrame11:SetFading(true)
end
end
end
--------------------------------------------------------------------------------
-- Name: zUtilities:skipGossip()
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:skipGossip()
local bwl = "The orb's markings match the brand on your hand."
local mc = "You see large cavernous tunnels"
local t = GetGossipText()
if (t == bwl or (strsub(t,1,31) == mc)) then
SelectGossipOption(1)
return
end
local list = {GetGossipOptions()}
for i = 2,getn(list),2 do
if(list[i]=="taxi" or list[i]=="battlemaster" or list[i]=="banker") then SelectGossipOption(i/2) return end
end
end
--------------------------------------------------------------------------------
-- Name: zUtilities:MapLocationOff()
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:MapLocationOff()
zMinimap.loc:SetText('')
self:CancelAllTimers()
self:UnregisterEvent("ZONE_CHANGED_NEW_AREA")
end
--------------------------------------------------------------------------------
-- Name: zUtilities:MapLocationOn()
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:MapLocationOn()
self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
self:ScheduleRepeatingTimer("UpdateMapLocation", 0.5)
end
--------------------------------------------------------------------------------
-- Name: zUtilities:toggleMapLocation()
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:toggleMapLocation()
-- minimap coordinates on/off
if db.miniMapCoordinates then
self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
self:ScheduleRepeatingTimer("UpdateMapLocation", 0.5)
elseif not db.miniMapCoordinates then
zMinimap.loc:SetText('')
self:CancelAllTimers()
self:UnregisterEvent("ZONE_CHANGED_NEW_AREA")
end
end
--------------------------------------------------------------------------------
-- Name: zUtilities:MinMapClutterHide()
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:toggleMinMapClutter()
-- hide/show clutter
if db.MinMapClutter then
MinimapZoomIn:Hide()
MinimapZoomOut:Hide()
GameTimeFrame:Hide()
MinimapZoneTextButton:Hide()
MinimapBorderTop:Hide()
elseif not db.MinMapClutter then
MinimapZoomIn:Show()
MinimapZoomOut:Show()
GameTimeFrame:Show()
MinimapZoneTextButton:Show()
MinimapBorderTop:Show()
end
end
function zUtilities:MinMapClutterHide()
MinimapZoomIn:Hide()
MinimapZoomOut:Hide()
GameTimeFrame:Hide()
MinimapZoneTextButton:Hide()
MinimapBorderTop:Hide()
end
function zUtilities:MinMapClutterShow()
MinimapZoomIn:Show()
MinimapZoomOut:Show()
GameTimeFrame:Show()
MinimapZoneTextButton:Show()
MinimapBorderTop:Show()
end
--------------------------------------------------------------------------------
-- Name: zUtilities:UpdateMapLocation()
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:UpdateMapLocation()
local x, y = GetPlayerMapPosition("player")
zMinimap.loc:SetText(string.format('%0.2f, %0.2f', x*100 or '', y*100 or ''))
end
--------------------------------------------------------------------------------
-- Name: zUtilities:toggleClock()
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:toggleClock()
-- hide/show clock
if db.toggleClock then
if not IsAddOnLoaded("Blizzard_TimeManager")
then LoadAddOn("Blizzard_TimeManager")
end
TimeManagerClockButton:Hide()
elseif db.toggleClock then
if not IsAddOnLoaded("Blizzard_TimeManager")
then LoadAddOn("Blizzard_TimeManager")
end
TimeManagerClockButton:Show()
end
end
--------------------------------------------------------------------------------
-- Name: zUtilities:toggleCoordinates()
-- Abstract:
--------------------------------------------------------------------------------
function zUtilities:toggleCoordinates()
-- hide/show minimap coordinates
if db.miniMapCoordinates then
mod:MapLocationOn()