-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZoneAchievementTracker.lua
More file actions
329 lines (301 loc) · 10.2 KB
/
ZoneAchievementTracker.lua
File metadata and controls
329 lines (301 loc) · 10.2 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
--[[--------------------------------------------------------------------
Zone Achievement Tracker
Automatically tracks the achievement for completing quests in your current zone.
Copyright 2012-2016 Phanx <addons@phanx.net>. All rights reserved.
https://github.com/Phanx/ZoneAchievementTracker
https://mods.curse.com/addons/wow/zoneachievementtracker
https://www.wowinterface.com/downloads/info20975-ZoneAchievementTracker.html
----------------------------------------------------------------------]]
local ENABLE_DEBUGGING = false
local AchievementForZone = {
[14] = 4896, -- Arathi Highlands
[15] = 4900, -- Badlands
[17] = 4909, -- Blasted Lands
[36] = 4901, -- Burning Steppes
[66] = 4930, -- Desolace
[23] = 4892, -- Eastern Plaguelands
[77] = 4931, -- Felwood
[50] = 4906, -- Northern Stranglethorn
[32] = 4910, -- Searing Gorge
[81] = 4934, -- Silithus
[51] = 4904, -- Swamp of Sorrows
[71] = 4935, -- Tanaris
[510] = 4905, -- The Cape of Stranglethorn
[26] = 4897, -- The Hinterlands
[61] = 4938, -- Thousand Needles
[78] = 4939, -- Un'Goro Crater
[22] = 4893, -- Western Plaguelands
[83] = 4940, -- Winterspring
-- The Burning Crusade
[105] = 1193, -- Blade's Edge Mountains
[109] = 1194, -- Netherstorm
[104] = 1195, -- Shadowmoon Valley
[102] = 1190, -- Zangarmarsh
-- Wrath of the Lich King
[118] = 40, -- Icecrown
[119] = 39, -- Sholazar Basin
[120] = 38, -- The Storm Peaks
[121] = 36, -- Zul'Drak
-- Cataclysm
[207] = 4871, -- Deepholm
[198] = 4870, -- Mount Hyjal
[249] = 4872, -- Uldum
-- Mists of Pandaria
[422] = 6540, -- Dread Wastes
[388] = 6539, -- Townlong Steppes
[390] = 7315, -- Vale of Eternal Blossoms
[376] = 6301, -- Valley of the Four Winds
-- Warlords of Draenor
-- All faction-specific, see below
-- Legion
[630] = 10763, -- Aszuna
[650] = 10059, -- Highmountain
[634] = 10790, -- Stormheim
[680] = 11124, -- Suramar
[641] = 10698, -- Val'sharah
}
local A = {
[63] = 4925, -- Ashenvale
[62] = 4928, -- Darkshore
[47] = 4903, -- Duskwood
[70] = 4929, -- Dustwallow Marsh
[69] = 4932, -- Feralas
[48] = 4899, -- Loch Modan
[49] = 4902, -- Redridge Mountains
[199] = 4937, -- Southern Barrens
[65] = 4936, -- Stonetalon Mountains
[52] = 4903, -- Westfall
[56] = 4899, -- Wetlands
-- The Burning Crusade
[106] = 4926, -- Bloodmyst Isle
[100] = 1189, -- Hellfire Peninsula
[107] = 1192, -- Nagrand
[108] = 1191, -- Terokkar Forest
-- Wrath of the Lich King
[114] = 33, -- Borean Tundra
[115] = 35, -- Dragonblight
[116] = 37, -- Grizzly Hills
[117] = 34, -- Howling Fjord
-- Cataclysm
[241] = 4873, -- Twilight Highlands
-- Mists of Pandaria
[418] = 6535, -- Krasarang Wilds
[379] = 6537, -- Kun-Lai Summit
[371] = 6300, -- The Jade Forest
[203] = 4869, -- Vashj'ir
-- Warlords of Draenor
[543] = 8923, -- Gorgrond
[550] = 8927, -- Nagrand
[539] = 8845, -- Shadowmoon Valley
[542] = 8925, -- Spires of Arak
[535] = 8920, -- Talador
-- Battle for Azeroth
[896] = 12497, -- Drustvar
[942] = 12496, -- Stormsong Valley
[895] = 12473, -- Tiragarde Sound
}
local H = {
[63] = 4976, -- Ashenvale
[76] = 4927, -- Azshara
[70] = 4978, -- Dustwallow Marsh
[69] = 4979, -- Feralas
[25] = 4895, -- Hillsbrad Foothills
[10] = 4933, -- Northern Barrens
[21] = 4894, -- Silverpine Forest
[199] = 4981, -- Southern Barrens
[65] = 4980, -- Stonetalon Mountains
-- The Burning Crusade
[95] = 4908, -- Ghostlands
[100] = 1271, -- Hellfire Peninsula
[107] = 1273, -- Nagrand
[108] = 1272, -- Terokkar Forest
-- Wrath of the Lich King
[114] = 1358, -- Borean Tundra
[115] = 1359, -- Dragonblight
[116] = 1357, -- Grizzly Hills
[117] = 1356, -- Howling Fjord
-- Cataclysm
[241] = 5501, -- Twilight Highlands
-- Mists of Pandaria
[418] = 6536, -- Krasarang Wilds
[379] = 6538, -- Kun-Lai Summit
[371] = 6534, -- The Jade Forest
[203] = 4982, -- Vashj'ir
-- Warlords of Draenor
[525] = 8671, -- Frostfire Ridge
[543] = 8924, -- Gorgrond
[550] = 8928, -- Nagrand
[542] = 8926, -- Spires of Arak
[535] = 8919, -- Talador
-- Battle for Azeroth
[863] = 11868, -- Nazmir
[864] = 12478, -- Vol'dun
[862] = 11861, -- Zuldazar
}
local M = {
-- Mists of Pandaria
[422] = true, -- Dread Wastes
[418] = true, -- Krasarang Wilds
[379] = true, -- Kun-Lai Summit
[371] = true, -- The Jade Forest
[388] = true, -- Townlong Steppes
[390] = true, -- Vale of Eternal Blossoms
[376] = true, -- Valley of the Four Winds
-- Warlords of Draenor
[525] = true, -- Frostfire Ridge
[543] = true, -- Gorgrond
[550] = true, -- Nagrand
[539] = true, -- Shadowmoon Valley
[542] = true, -- Spires of Arak
[535] = true, -- Talador
-- Legion
[630] = true, -- Aszuna
[650] = true, -- Highmountain
[634] = true, -- Stormheim
[680] = true, -- Suramar
[641] = true, -- Val'sharah
-- Battle for Azeroth
[896] = true, -- Drustvar
[863] = true, -- Nazmir
[942] = true, -- Stormsong Valley
[895] = true, -- Tiragarde Sound
[864] = true, -- Vol'dun
[862] = true, -- Zuldazar
}
local PLAYER_FACTION
local ZoneForAchievement
local function init()
ZATDB = ZATDB or {}
local factionGroup = UnitFactionGroup("player")
local temp
if factionGroup == "Alliance" then
temp = A
elseif factionGroup == "Horde" then
temp = H
end
if not temp then
if ENABLE_DEBUGGING then
print("|cffff6666ZAT:|r", "Unsupported faction:", factionGroup)
end
return
end
if ENABLE_DEBUGGING then
print("|cffff6666ZAT:|r", "Initalizing...")
end
PLAYER_FACTION = factionGroup
for mapID, achievementID in pairs(AchievementForZone) do
temp[mapID] = achievementID
end
wipe(AchievementForZone)
for mapID, achievementID in pairs(temp) do
local _, _, name = pcall(GetAchievementInfo, achievementID)
if not name then
if ENABLE_DEBUGGING then
print(achievementID, "is not a valid achievement.")
end
elseif select(2, GetCategoryInfo(GetAchievementCategory(achievementID))) ~= 96 then
if ENABLE_DEBUGGING then
print(achievementID, "is not a quest achievement.")
end
else
AchievementForZone[mapID] = achievementID
end
end
ZoneForAchievement = {}
for mapID, achievementID in pairs(AchievementForZone) do
ZoneForAchievement[achievementID] = mapID
end
A, H, temp = nil, nil, nil
if ENABLE_DEBUGGING then
print("|cffff6666ZAT:|r", "Done.")
end
end
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:RegisterEvent("PLAYER_LOGIN")
f:RegisterEvent("ZONE_CHANGED_NEW_AREA")
f:SetScript("OnEvent", function(self, event)
if ENABLE_DEBUGGING then
print("|cffff6666ZAT:|r", "OnEvent", event)
end
if not ZoneForAchievement then
init()
end
local mapID = C_Map.GetBestMapForUnit("player")
if not mapID then return end
local achievementID = AchievementForZone[mapID]
if not achievementID then
-- Check parents in case we're in a cave.
local mapInfo = C_Map.GetMapInfo(mapID)
while mapInfo and mapInfo.parentMapID and not achievementID do
mapID = mapInfo.parentMapID
mapInfo = C_Map.GetMapInfo(mapID)
achievementID = AchievementForZone[mapID]
end
end
local achievementName, completed, _
if type(achievementID) == "number" then
_, achievementName, _, _, _, _, _, _, _, _, _, _, completed = GetAchievementInfo(achievementID)
elseif achievementID then
print("|cffff6666[ERROR] Zone Achievement Tracker:|r")
print(string.format(">> %s achievement for %s zone %d %s.", achievementID, PLAYER_FACTION, mapID, GetRealZoneText()))
print("Please report this error so it can be fixed!")
achievementID = nil
end
if ENABLE_DEBUGGING then
print("|cffff6666ZAT:|r", mapID, GetRealZoneText(), achievementID, achievementName, completed)
end
if M[mapID] and ZATDB.noMoP then
achievementID = nil
if ENABLE_DEBUGGING then
print("|cffff6666ZAT:|r", "noMoP")
end
end
local tracked
for _, id in ipairs({ GetTrackedAchievements() }) do
if id == achievementID and not completed then
if ENABLE_DEBUGGING then
print("|cffff6666ZAT:|r", "Already tracking", achievementID, achievementName)
end
tracked = true
elseif ZoneForAchievement[id] then
if ENABLE_DEBUGGING then
local _, name = GetAchievementInfo(id)
print("|cffff6666ZAT:|r", "RemoveTrackedAchievement", id, name)
end
RemoveTrackedAchievement(id)
end
end
if achievementID and not completed and not tracked then
if ENABLE_DEBUGGING then
print("|cffff6666ZAT:|r", "AddTrackedAchievement", achievementID, achievementName)
end
AddTrackedAchievement(achievementID)
end
end)
if ENABLE_DEBUGGING then
f.Ach4Zone = AchievementForZone
f.Zone4Ach = ZoneForAchievement
ZAT = f
end
SLASH_ZONEACHIEVEMENTTRACKER1 = "/zat"
SlashCmdList.ZONEACHIEVEMENTTRACKER = function()
ZATDB.noMoP = not ZATDB.noMoP
local LOCALE = GetLocale()
if LOCALE == "deDE" then
DEFAULT_CHAT_FRAME:AddMessage(format("|cffffcc00Zone Achievement Tracker:|r Zonen mit mehreren Geschichtsstränge %s|r.", ZATDB.noMoP and "|cff7f7f7fdeaktiviert" or "|cff7fff7faktiviert"))
elseif LOCALE == "esES" or LOCALE == "esMX" then
DEFAULT_CHAT_FRAME:AddMessage(format("|cffffcc00Zone Achievement Tracker:|r Zonas con múltiples tramas %s|r.", ZATDB.noMoP and "|cff7f7f7fdesactivada" or "|cff7fff7factivada"))
elseif LOCALE == "frFR" then
DEFAULT_CHAT_FRAME:AddMessage(format("|cffffcc00Zone Achievement Tracker:|r Zones avec des suites de quêtes multiples %s|r.", ZATDB.noMoP and "|cff7f7f7fdésactivé" or "|cff7fff7factivé"))
elseif LOCALE == "itIT" then
DEFAULT_CHAT_FRAME:AddMessage(format("|cffffcc00Zone Achievement Tracker:|r Zone con gruppi di missioni multipli %s|r.", ZATDB.noMoP and "|cff7f7f7fdisattivata" or "|cff7fff7fattivata"))
elseif LOCALE == "ptBR" then
DEFAULT_CHAT_FRAME:AddMessage(format("|cffffcc00Zone Achievement Tracker:|r Zonas com múltiplos histórias %s|r.", ZATDB.noMoP and "|cff7f7f7fdesativada" or "|cff7fff7fativada"))
elseif LOCALE == "ruRU" then
DEFAULT_CHAT_FRAME:AddMessage(format("|cffffcc00Zone Achievement Tracker:|r Зоны с несколько этапов развития сюжета %s|r.", ZATDB.noMoP and "|cff7f7f7fотключена" or "|cff7fff7fвключена"))
else
DEFAULT_CHAT_FRAME:AddMessage(format("|cffffcc00Zone Achievement Tracker:|r Zones with multiple criteria %s|r.", ZATDB.noMoP and "|cff7f7f7fdisabled" or "|cff7fff7fenabled"))
end
f:GetScript("OnEvent")(f, "SlashCmdList")
end