-
Notifications
You must be signed in to change notification settings - Fork 10
/
Utilities.lua
218 lines (190 loc) · 5.52 KB
/
Utilities.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
---@class WQAchievements
local WQA = WQAchievements
local GetTitleForQuestID = C_QuestLog.GetTitleForQuestID
function WQA:GetExpansionByMissionID(missionID)
return WQA.missionList[missionID].expansion
end
local questZoneIDList = {
-- Outside Influences
[55463] = 1462,
[55658] = 1462,
[55688] = 1462,
[55718] = 1462,
[55765] = 1462,
[55885] = 1462,
[56053] = 1462,
[55813] = 1462,
[56301] = 1462,
[56142] = 1462,
[55528] = 1462,
[56365] = 1462,
[56572] = 1462,
[56501] = 1462,
[56493] = 1462,
[56552] = 1462,
[56558] = 1462,
[55575] = 1462,
[55672] = 1462,
[55717] = 1462,
[56049] = 1462,
[56469] = 1462,
[55816] = 1462,
[55905] = 1462,
[56184] = 1462,
[56306] = 1462,
[54090] = 1462,
[56355] = 1462,
[56523] = 1462,
[56410] = 1462,
[56508] = 1462,
[56471] = 1462,
[56405] = 1462,
-- Periodic Destruction
[55121] = 1355
}
function WQA:GetQuestZoneID(questID)
if WQA.questList[questID] and WQA.questList[questID].isEmissary then
return "Emissary"
end
--if not WQA.questList[questID].info then WQA.questList[questID].info = {} end
--if WQA.questList[questID].info.zoneID then
-- return WQA.questList[questID].info.zoneID
--else
-- WQA.questList[questID].info.zoneID = questZoneIDList[questID] or C_TaskQuest.GetQuestZoneID(questID)
-- return WQA.questList[questID].info.zoneID
--end
return questZoneIDList[questID] or C_TaskQuest.GetQuestZoneID(questID)
end
function WQA:GetMissionZoneID(missionID)
if WQA.missionList[missionID].shipyard == true then
return -self:GetExpansionByMissionID(missionID) - .5
else
return -self:GetExpansionByMissionID(missionID)
end
end
function WQA:GetTaskZoneID(task)
if task.type == "MISSION" then
return self:GetMissionZoneID(task.id)
elseif task.type == "WORLD_QUEST" then
return self:GetQuestZoneID(task.id)
elseif task.type == "AREA_POI" then
return task.mapId
end
end
function WQA:GetMapInfo(mapID)
if mapID then
return C_Map.GetMapInfo(mapID)
else
return { name = "Unknown" }
end
end
function WQA:GetQuestZoneName(questID)
if WQA.questList[questID].isEmissary then
return "Emissary"
end
if not WQA.questList[questID].info then
WQA.questList[questID].info = {}
end
WQA.questList[questID].info.zoneName = WQA.questList[questID].info.zoneName or
self:GetMapInfo(self:GetQuestZoneID(questID)).name
return WQA.questList[questID].info.zoneName
end
function WQA:GetMissionZoneName(missionID)
if WQA.missionList[missionID].shipyard == true then
return "Shipyard"
else
return "Mission Table"
end
end
function WQA:GetTaskZoneName(task)
if task.type == "MISSION" then
return self:GetMissionZoneName(task.id)
end
if task.type == "AREA_POI" then
return self:GetMapInfo(task.mapId).name
end
return self:GetQuestZoneName(task.id)
end
ExpansionByZoneID = {
-- BfA
[1169] = 8 -- Tol Dagor
}
function WQA:GetExpansionByMapId(mapId)
if ExpansionByZoneID[mapId] then
return ExpansionByZoneID[mapId]
end
for expansion, zones in pairs(WQA.ZoneIDList) do
for _, v in pairs(zones) do
if mapId == v then
return expansion
end
end
end
return -1
end
function WQA:GetExpansionByQuestID(questID)
--if not WQA.questList[questID].info then WQA.questList[questID].info = {} end
--if WQA.questList[questID].info.expansion then
-- return WQA.questList[questID].info.expansion
--else
local zoneID = self:GetQuestZoneID(questID)
local expansionId = self:GetExpansionByMapId(zoneID)
if (expansionId > 0) then
return expansionId
end
for expansion, v in pairs(WQA.EmissaryQuestIDList) do
for _, id in pairs(v) do
if type(id) == "table" then
id = id.id
end
if id == questID then
return expansion
end
end
end
return -1
end
function WQA:GetExpansion(task)
if task.type == "MISSION" then
return self:GetExpansionByMissionID(task.id)
end
if task.type == "AREA_POI" then
return self:GetExpansionByMapId(task.mapId)
end
return self:GetExpansionByQuestID(task.id)
end
function WQA:GetExpansionName(id)
return WQA.ExpansionList[id] or "Unknown"
end
function WQA:GetMissionTimeLeftMinutes(id)
if not WQA.missionList[id].offerEndTime then
return 0
else
return (WQA.missionList[id].offerEndTime - GetTime()) / 60
end
end
function WQA:GetTaskTime(task)
if task.type == "WORLD_QUEST" then
return C_TaskQuest.GetQuestTimeLeftMinutes(task.id)
elseif task.type == "MISSION" then
return self:GetMissionTimeLeftMinutes(task.id)
elseif task.type == "AREA_POI" then
local seconds = C_AreaPoiInfo.GetAreaPOISecondsLeft(task.id)
if seconds then
return seconds / 60
end
end
end
function WQA:GetTaskLink(task)
if task.type == "WORLD_QUEST" then
-- else
-- return GetQuestLink(task.id)
-- end
-- if WQA.questPinList[task.id] or WQA.questFlagList[task.id] then
return GetQuestLink(task.id) or GetTitleForQuestID(task.id)
elseif task.type == "MISSION" then
return C_Garrison.GetMissionLink(task.id)
elseif task.type == "AREA_POI" then
return C_AreaPoiInfo.GetAreaPOIInfo(task.mapId, task.id).name
end
end