-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzQuestMacroButtons.lua
466 lines (400 loc) · 14.3 KB
/
zQuestMacroButtons.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
--------------------------------------------------------------------------------
-- Author: Dustin Z. zQuestMacroButtons.lua
-- Name: zQuestMacroButtons
-- Abstract:
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
--------------------------------------------------------------------------------
local zQuestMacroButtons = LibStub("AceAddon-3.0"):NewAddon("zQuestMacroButtons", "AceEvent-3.0", "AceConsole-3.0","AceTimer-3.0")
-- Localization
local L = LibStub("AceLocale-3.0"):GetLocale("zQuestMacroButtons")
-- Defines the name of our mod
local mod = zQuestMacroButtons
local auto_options = {
type = "group",
desc = "Automations",
args = {
AutoRepair = {
name = "Auto-repair",
type = "select",
desc = "Repair all Equipment and Inventory automatically.",
values = {"Disabled", "Own Money", "Guild Money"},
get = function() return db.AutoRepair end,
set = function(i, value)
db.AutoRepair = value
if db.AutoRepair < 2 then
if db.AutoSellJunk then
return
else
mod:UnregisterEvent("MERCHANT_SHOW")
mod.Merchant_Show = false
end
else
mod:RegisterEvent("MERCHANT_SHOW")
mod.Merchant_Show = true
end
end
},
AutoSellJunk = {
name = "Auto-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:RegisterEvent("MERCHANT_SHOW")
mod.Merchant_Show = true
else
if db.AutoSellJunk or db.AutoRepair then return end
mod:UnregisterEvent("MERCHANT_SHOW")
mod.Merchant_Show = false
end
end
}
}
}
local chat_options = {
type = "group",
desc = "Chat",
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 = "Disable Blizzard Party Frames",
type = "toggle",
desc = "Disable Blizzard Party Frames.",
get = function() return db.PartyFrames end,
set = function(i, switch)
db.PartyFrames = switch
mod:PartyFrames()
end
},
RaidFrames = {
name = "Disable Blizzard Raid Frames",
type = "toggle",
desc = "Disable Blizzard Raid Frames.",
get = function() return db.RaidFrames end,
set = function(i, switch)
db.RaidFrames = switch
mod:RaidFrames()
end
}
}
}
local ui_options = {
type = "group",
desc = "Interface",
args = {
Gryphons = {
name = "Disable Gryphons",
type = "toggle",
desc = "Toggle Display of Gryphons on Main Toolbar.",
get = function() return db.Gryphons end,
set = function(i, switch)
db.Gryphons = switch
mod:GryphonsToggle()
end
}
}
}
local minimap_options = {
type = "group",
desc = "Minimap",
args = {
Clock = {
name = "Toggle Game Clock",
type = "toggle",
desc = "Toggle Game Clock below the minimap.",
get = function() return db.Clock end,
set = function(i, switch)
db.Clock = switch
mod:ClockToggle()
end
},
Coordinates = {
name = "Map X,Y Coords",
type = "toggle",
desc = "Adds Numeric X,Y Coordinates below the Minimap.",
get = function() return db.Coordinates end,
set = function(i, switch)
db.Coordinates = switch
if switch then
mod:MapLocOn()
else
mod:MapLocOff()
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
}
}
}
-- Crawfish Creole questid = 26226
-- Muddy Crawfish npcid = 42548
-- Muddy Crawfish itemid = 57765
-- Even Thieves Get Hungry questid = 26235
-- Orgrimmar Thief npcid = 42594
-- Horde Infantry Rations itemid = 57879
-- The Fate Of The Fallen questid = 14107
-- Fallen Hero's Spirit npcid = 32149
-- Light-Blessed Relic itemid = 47033
-- Get Kraken questid = 14108
-- Kvaldir Deepcaller npcid = 35092
-- North Sea Kraken npcid = 34925
-- Flaming Spears itemid = 46954
-- Gormok Wants His Snobolds questid = 14090
-- Snowblind Follower npcid = 29618
-- Weighted Net itemid = 46885
-- Maintaining Discipline questid = 13422
-- Exhausted Vrykul npcid = 30146
-- Disciplining Rod itemid = 42837
--------------------------------------------------------------------------------
-- Name: Macros
-- Abstract: A table which holds our macros
--------------------------------------------------------------------------------
local Macros = {
["CrawfishCreole"] = {
["Name"] = "Crawfish Creole",
["QuestID"] = 26626,
["Icon"] = GetItemIcon(57765),
["Text"] = {
[index] = "/target [nodead] Muddy Crawfish",
[index + 1] = "\n",
[index + 2] = "/script if UnitName("target") and not UnitIsDead("target") and not GetRaidTargetIndex("target") then SetRaidTargetIcon("target",3); end",
[index + 3] = "\n"
[index + 4] = "/cleartarget [dead]"
},
["Body"] = table.concat(Text),
},
["OrgHungryThief"] = {
["Name"] = "Even Thieves Get Hungry",
["QuestID"] = 26235,
["Icon"] = GetItemIcon(57879),
["Text"] = {
[index] = "/target [nodead] Orgrimmar Thief",
[index + 1] = "\n",
[index + 2] = "/script if UnitName("target") and not UnitIsDead("target") and not GetRaidTargetIndex("target") then SetRaidTargetIcon("target",1); end",
[index + 3] = "\n"
[index + 4] = "/cleartarget [dead]"
},
["Body"] = table.concat(Text),
},
["FateOfTheFallen"] = {
["Name"] = "The Fate Of The Fallen",
["QuestID"] = 14107,
["Icon"] = GetItemIcon(47033),
["Text"] = {
[index] = "/target Fallen Hero's Spirit",
[index + 1] = "\n",
[index + 2] = "/use Light-Blessed Relic",
},
["Body"] = table.concat(Text),
},
["GetKraken"] = {
["Name"] = "Get Kraken",
["QuestID"] = 14108,
["Icon"] = GetItemIcon(46954),
["Text"] = {
[index] = "/target [nodead] Kvaldir Deepcaller",
[index + 1] = "\n",
[index + 2] = "/use [harm] Flaming Spears",
[index + 3] = "\n",
[index + 4] = "/target [nodead] North Sea Kraken",
[index + 5] = "\n",
[index + 6] = "/use [harm] Flaming Spears",
},
["Body"] = table.concat(Text),
},
["GormokSnobolds"] = {
["Name"] = "Gormok Wants His Snobolds",
["QuestID"] = 14090,
["Icon"] = GetItemIcon(46885),
["Text"] = {
[index] = "/target Snowblind Follower",
[index + 1] = "\n",
[index + 2] = "/use [exists,nodead] Weighted Net",
},
["Body"] = table.concat(Text),
},
["MaintainDisc"] = {
["Name"] = "Maintaining Discipline",
["QuestID"] = 13422,
["Icon"] = GetItemIcon(42837),
["Text"] = {
[index] = "/target [nodead] Exhausted Vrykul",
[index + 1] = "\n",
[index + 2] = "/use [harm,nodead] Disciplining Rod",
},
["Body"] = table.concat(Text),
},
}
--------------------------------------------------------------------------------
-- Name: defaults
-- Abstract: A table which holds our preference variables
--------------------------------------------------------------------------------
local defaults = {
profile = {
AutoRepair = 3,
AutoSellJunk = true,
ChatFade = true,
Clock = true,
Coordinates = true,
Gryphons = true,
Mapscroll = true,
PartyFrames = true,
RaidFrames = true,
}
}
local function ProfileSetup()
local profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(zQuestMacroButtons.db)
return profiles
end
--------------------------------------------------------------------------------
-- Name: zQuestMacroButtons:OnInitialize()
-- Abstract: Our would be constructor, isn't it cute?
--------------------------------------------------------------------------------
function zQuestMacroButtons:OnInitialize()
self.Merchant_Show = true
self.abacus = LibStub("LibAbacus-3.0")
self.ACR = LibStub("AceConfigRegistry-3.0")
self.ACD = LibStub("AceConfigDialog-3.0")
--# Initialize DB
self.db = LibStub("AceDB-3.0"):New("zQuestMacroButtonsDB", defaults)
db = self.db.profile
--# Register our options
self.ACR:RegisterOptionsTable("zQuestMacroButtons", ProfileSetup)
self.ACR:RegisterOptionsTable("zQuestMacroButtons Automation",auto_options)
self.ACR:RegisterOptionsTable("zQuestMacroButtons Chat",chat_options)
self.ACR:RegisterOptionsTable("zQuestMacroButtons Interface",ui_options)
self.ACR:RegisterOptionsTable("zQuestMacroButtons Minimap",minimap_options)
self.ACD:AddToBlizOptions("zQuestMacroButtons")
self.ACD:AddToBlizOptions("zQuestMacroButtons Automation", "Automation", "zQuestMacroButtons")
self.ACD:AddToBlizOptions("zQuestMacroButtons Chat", "Chat", "zQuestMacroButtons")
self.ACD:AddToBlizOptions("zQuestMacroButtons Interface", "Interface", "zQuestMacroButtons")
self.ACD:AddToBlizOptions("zQuestMacroButtons Minimap", "Minimap", "zQuestMacroButtons")
SlashCmdList["zQuestMacroButtons"] = function() end
SLASH_zQuestMacroButtons1 = "/zQuestMacroButtons"
SLASH_zQuestMacroButtons2 = "/zqmb"
SLASH_zQuestMacroButtons3 = "/zq"
-- camera now shows up to 50yrd and not only 35yrd
ConsoleExec("CameraDistanceMax 50")
ConsoleExec("CameraDistanceMaxFactor 8")
-- set max FPS to 70, and limit fps down to 30 when WoW is minimized (saves GPU/CPU)
SetCVar("maxFPSBk","30")
mod:zAddMessage("Loaded!")
end
--------------------------------------------------------------------------------
-- Name: zQuestMacroButtons:OnEnable()
-- Abstract: Our would be constructor, isn't it cute?
--------------------------------------------------------------------------------
function zQuestMacroButtons:OnEnable()
dzMinimap = CreateFrame("Frame", nil, Minimap)
dzMinimap:SetAllPoints(Minimap)
dzMinimap.loc = dzMinimap:CreateFontString(nil, 'OVERLAY')
dzMinimap.loc:SetWidth(90)
dzMinimap.loc:SetHeight(16)
dzMinimap.loc:SetPoint('CENTER', Minimap, 'BOTTOM', 0, -16)
dzMinimap.loc:SetJustifyV('MIDDLE')
dzMinimap.loc:SetJustifyH('CENTER')
dzMinimap.loc:SetFontObject(GameFontNormal)
for varname, val in pairs(auto_options.args) do
if db[varname] then auto_options.args[varname].set(true, db[varname]) end
end
for varname, val in pairs(chat_options.args) do
if db[varname] then chat_options.args[varname].set(true, db[varname]) end
end
for varname, val in pairs(ui_options.args) do
if db[varname] then ui_options.args[varname].set(true, db[varname]) end
end
for varname, val in pairs(minimap_options.args) do
if db[varname] then minimap_options.args[varname].set(true, db[varname]) end
end
-- load events
mod:UnregisterAllEvents();
mod:RegisterEvent("ADDON_LOADED", "dzOnEvent")
mod:RegisterEvent("MERCHANT_SHOW")
mod:RegisterEvent("PLAYER_ENTERING_WORLD", "dzOnEvent")
mod:RegisterEvent("PARTY_MEMBERS_CHANGED", "dzOnEvent")
mod:RegisterEvent("RAID_ROSTER_UPDATE", "dzOnEvent")
-- send msg on enable
mod:zAddMessage("Enabled!")
end
--------------------------------------------------------------------------------
-- Name: zQuestMacroButtons:OnDisable()
-- Abstract: Our would be de-constructor, isn't it cute?
--------------------------------------------------------------------------------
function zQuestMacroButtons: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 messag eon disable
mod:zAddMessage("Disabled!")
end
--------------------------------------------------------------------------------
-- Name: zQuestMacroButtons:dzOnEvent()
-- Abstract:
--------------------------------------------------------------------------------
function zQuestMacroButtons:dzOnEvent(event, ...)
local arg1 = ...
if (event == "PARTY_MEMBERS_CHANGED") then
mod:PartyFrames()
elseif (event == "RAID_ROSTER_CHANGED") then
mod:RaidFrames()
end
end
--------------------------------------------------------------------------------
-- Name: zQuestMacroButtons:zAddMessage(msg, r, g, b)
-- Abstract:
--------------------------------------------------------------------------------
function zQuestMacroButtons:zmsg(msg, r, g, b)
-- strMod = format("|cff0062ffdz|r|cff0deb11Utilities|r")
strMod = format("|cff696969z|r|cff008B8BQuestMacroButtons|r")
DEFAULT_CHAT_FRAME:AddMessage("" .. strMod .. ": " .. tostring(msg), r, g, b)
end
--------------------------------------------------------------------------------
-- Event Handlers
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Name: zQuestMacroButtons:ZONE_CHANGED_NEW_AREA()
-- Abstract:
--------------------------------------------------------------------------------
function zQuestMacroButtons:ZONE_CHANGED_NEW_AREA()
SetMapToCurrentZone()
end
--------------------------------------------------------------------------------
-- Name: zQuestMacroButtons:GenerateMacros()
-- Abstract:
--------------------------------------------------------------------------------
function zQuestMacroButtons:GenerateMacros()
-- Fallen Hero's Spirit npcid = 32149
-- Light-Blessed Relic itemid = 47033
local index = 1
local tMacroText[ index ] = "/target Fallen Hero's Spirit"
local tMacroText[ index + 1 ] = "\n"
local tMacroText[ index + 2 ] = "/use Light-Blessed Relic"
local iMacroTexture = GetItemIcon(47033)
local mMacroText = table.concat(tMacroText)
local mFateoftheFallen = mod:CreateMacro("FateoftheFallen", iMacroTexture, mMacroText, nil, nil)
end