1 QuestHelper_File
["upgrade.lua"] = "Development Version"
2 QuestHelper_Loadtime
["upgrade.lua"] = GetTime()
14 [9]="Dustwallow Marsh",
21 [16]="Stonetalon Mountains",
26 [21]="Thousand Needles",
28 [23]="Un'Goro Crater",
30 {[0]="Eastern Kingdoms",
31 [1]="Alterac Mountains",
32 [2]="Arathi Highlands",
35 [5]="Burning Steppes",
39 [9]="Eastern Plaguelands",
41 [11]="Eversong Woods",
43 [13]="Hillsbrad Foothills",
45 [15]="Isle of Quel'Danas",
47 [17]="Redridge Mountains",
49 [19]="Silvermoon City",
50 [20]="Silverpine Forest",
51 [21]="Stormwind City",
52 [22]="Stranglethorn Vale",
53 [23]="Swamp of Sorrows",
54 [24]="The Hinterlands",
55 [25]="Tirisfal Glades",
57 [27]="Western Plaguelands",
61 [1]="Blade's Edge Mountains",
62 [2]="Hellfire Peninsula",
65 [5]="Shadowmoon Valley",
67 [7]="Terokkar Forest",
71 [2]="Crystalsong Forest",
78 [9]="The Storm Peaks",
82 [-77]={[0]="ScarletEnclave_Continent", [1]="ScarletEnclave"},
84 [-80]={[0]="UtgardeKeep1_Continent", [1]="UtgardeKeep1"},
85 [-81]={[0]="UtgardeKeep2_Continent", [1]="UtgardeKeep2"},
86 [-82]={[0]="UtgardeKeep3_Continent", [1]="UtgardeKeep3"},
88 [-83]={[0]="TheNexus_Continent", [1]="TheNexus"},
90 [-84]={[0]="AzjolNerub1_Continent", [1]="AzjolNerub1"},
91 [-85]={[0]="AzjolNerub2_Continent", [1]="AzjolNerub2"},
92 [-86]={[0]="AzjolNerub3_Continent", [1]="AzjolNerub3"},
94 [-87]={[0]="Ahnkahet_Continent", [1]="Ahnkahet"},
96 [-88]={[0]="DrakTharonKeep1_Continent", [1]="DrakTharonKeep1"},
97 [-89]={[0]="DrakTharonKeep2_Continent", [1]="DrakTharonKeep2"},
99 [-90]={[0]="VioletHold_Continent", [1]="VioletHold"},
101 [-91]={[0]="Gundrak_Continent", [1]="Gundrak"},
103 [-92]={[0]="Ulduar77_Continent", [1]="Ulduar77"},
105 [-93]={[0]="HallsofLightning1_Continent", [1]="HallsofLightning1"},
106 [-94]={[0]="HallsofLightning2_Continent", [1]="HallsofLightning2"},
108 [-95]={[0]="Nexus801_Continent", [1]="Nexus801"},
109 [-96]={[0]="Nexus802_Continent", [1]="Nexus802"},
110 [-97]={[0]="Nexus803_Continent", [1]="Nexus803"},
111 [-98]={[0]="Nexus804_Continent", [1]="Nexus804"},
113 [-99]={[0]="CoTStratholme1_Continent", [1]="CoTStratholme1"},
114 [-100]={[0]="CoTStratholme2_Continent", [1]="CoTStratholme2"},
116 [-101]={[0]="UtgardePinnacle1_Continent", [1]="UtgardePinnacle1"},
117 [-102]={[0]="UtgardePinnacle2_Continent", [1]="UtgardePinnacle2"},
119 [-103]={[0]="VaultofArchavon_Continent", [1]="VaultofArchavon"},
121 [-104]={[0]="Naxxramas1_Continent", [1]="Naxxramas1"},
122 [-105]={[0]="Naxxramas2_Continent", [1]="Naxxramas2"},
123 [-106]={[0]="Naxxramas3_Continent", [1]="Naxxramas3"},
124 [-107]={[0]="Naxxramas4_Continent", [1]="Naxxramas4"},
125 [-108]={[0]="Naxxramas5_Continent", [1]="Naxxramas5"},
126 [-109]={[0]="Naxxramas6_Continent", [1]="Naxxramas6"},
128 [-110]={[0]="TheObsidianSanctum_Continent", [1]="TheObsidianSanctum"},
130 [-111]={[0]="TheEyeOfEternity_Continent", [1]="TheEyeOfEternity"},
132 [-112]={[0]="Ulduar_Continent", [1]="Ulduar"},
133 [-113]={[0]="Ulduar1_Continent", [1]="Ulduar1"},
134 [-114]={[0]="Ulduar2_Continent", [1]="Ulduar2"},
135 [-115]={[0]="Ulduar3_Continent", [1]="Ulduar3"},
136 [-116]={[0]="Ulduar4_Continent", [1]="Ulduar4"},
140 -- This will be translated to [LOCALE_NAME] = INDEX by QuestHelper_BuildZoneLookup.
141 -- Additionally, [CONT_INDEX][ZONE_INDEX] = INDEX will also be added.
142 QuestHelper_IndexLookup
=
143 {["Hinterlands"] = {42, 2, 24},
144 ["Moonglade"] = {20, 1, 12},
145 ["ThousandNeedles"] = {14, 1, 21},
146 ["Winterspring"] = {19, 1, 24},
147 ["BloodmystIsle"] = {9, 1, 4},
148 ["TerokkarForest"] = {55, 3, 7},
149 ["Arathi"] = {39, 2, 2},
150 ["EversongWoods"] = {41, 2, 11},
151 ["Dustwallow"] = {10, 1, 9},
152 ["Badlands"] = {27, 2, 3},
153 ["Darkshore"] = {16, 1, 5},
154 ["Ogrimmar"] = {1, 1, 14},
155 ["BladesEdgeMountains"] = {54, 3, 1},
156 ["Undercity"] = {45, 2, 26},
157 ["Desolace"] = {4, 1, 7},
158 ["Netherstorm"] = {59, 3, 4},
159 ["Barrens"] = {11, 1, 19},
160 ["Tanaris"] = {8, 1, 17},
161 ["Stormwind"] = {36, 2, 21},
162 ["Zangarmarsh"] = {57, 3, 8},
163 ["Durotar"] = {7, 1, 8},
164 ["Hellfire"] = {56, 3, 2},
165 ["Silithus"] = {5, 1, 15},
166 ["ShattrathCity"] = {60, 3, 6},
167 ["ShadowmoonValley"] = {53, 3, 5},
168 ["SwampOfSorrows"] = {46, 2, 23},
169 ["SilvermoonCity"] = {52, 2, 19},
170 ["Darnassis"] = {21, 1, 6},
171 ["AzuremystIsle"] = {3, 1, 3},
172 ["Elwynn"] = {37, 2, 10},
173 ["Stranglethorn"] = {38, 2, 22},
174 ["EasternPlaguelands"] = {34, 2, 9},
175 ["Duskwood"] = {31, 2, 8},
176 ["WesternPlaguelands"] = {50, 2, 27},
177 ["Westfall"] = {49, 2, 28},
178 ["Ashenvale"] = {2, 1, 1},
179 ["Teldrassil"] = {24, 1, 18},
180 ["Redridge"] = {30, 2, 17},
181 ["UngoroCrater"] = {18, 1, 23},
182 ["Mulgore"] = {22, 1, 13},
183 ["Ironforge"] = {25, 2, 14},
184 ["Felwood"] = {13, 1, 10},
185 ["Hilsbrad"] = {48, 2, 13},
186 ["DeadwindPass"] = {47, 2, 6},
187 ["BurningSteppes"] = {40, 2, 5},
188 ["Ghostlands"] = {44, 2, 12},
189 ["Tirisfal"] = {43, 2, 25},
190 ["TheExodar"] = {12, 1, 20},
191 ["Wetlands"] = {51, 2, 29},
192 ["SearingGorge"] = {32, 2, 18},
193 ["BlastedLands"] = {33, 2, 4},
194 ["Silverpine"] = {35, 2, 20},
195 ["LochModan"] = {29, 2, 16},
196 ["Feralas"] = {17, 1, 11},
197 ["DunMorogh"] = {28, 2, 7},
198 ["Alterac"] = {26, 2, 1},
199 ["ThunderBluff"] = {23, 1, 22},
200 ["Aszhara"] = {15, 1, 2},
201 ["StonetalonMountains"] = {6, 1, 16},
202 ["Nagrand"] = {58, 3, 3},
203 ["Kalimdor"] = {61, 1, 0},
204 ["Azeroth"] = {62, 2, 0},
205 ["Expansion01"] = {63, 3, 0},
206 ["Sunwell"] = {64, 2, 15},
208 ["Northrend"] = {76, 4, 0},
209 ["BoreanTundra"] = {65, 4, 1},
210 ["CrystalsongForest"] = {66, 4, 2},
211 ["Dalaran"] = {67, 4, 3},
212 ["Dragonblight"] = {68, 4, 4},
213 ["GrizzlyHills"] = {69, 4, 5},
214 ["HowlingFjord"] = {70, 4, 6},
215 ["IcecrownGlacier"] = {71, 4, 7},
216 ["SholazarBasin"] = {72, 4, 8},
217 ["TheStormPeaks"] = {73, 4, 9},
218 ["LakeWintergrasp"] = {74, 4, 10},
219 ["ZulDrak"] = {75, 4, 11},
221 ["ScarletEnclave_Continent"] = {77, -77, 0}, ["ScarletEnclave"] = {78, -77, 1},
223 ["UtgardeKeep1_Continent"] = {79, -80, 0}, ["UtgardeKeep1"] = {80, -80, 1},
224 ["UtgardeKeep2_Continent"] = {81, -81, 0}, ["UtgardeKeep2"] = {82, -81, 1},
225 ["UtgardeKeep3_Continent"] = {83, -82, 0}, ["UtgardeKeep3"] = {84, -82, 1},
227 ["TheNexus_Continent"] = {85, -83, 0}, ["TheNexus"] = {86, -83, 1},
229 ["AzjolNerub1_Continent"] = {87, -84, 0}, ["AzjolNerub1"] = {88, -84, 1},
230 ["AzjolNerub2_Continent"] = {89, -85, 0}, ["AzjolNerub2"] = {90, -85, 1},
231 ["AzjolNerub3_Continent"] = {91, -86, 0}, ["AzjolNerub3"] = {92, -86, 1},
233 ["Ahnkahet_Continent"] = {93, -87, 0}, ["Ahnkahet"] = {94, -87, 1},
235 ["DrakTharonKeep1_Continent"] = {95, -88, 0}, ["DrakTharonKeep1"] = {96, -88, 1},
236 ["DrakTharonKeep2_Continent"] = {97, -89, 0}, ["DrakTharonKeep2"] = {98, -89, 1},
238 ["VioletHold_Continent"] = {99, -90, 0}, ["VioletHold"] = {100, -90, 1},
240 ["Gundrak_Continent"] = {101, -91, 0}, ["Gundrak"] = {102, -91, 1},
242 ["Ulduar77_Continent"] = {103, -92, 0}, ["Ulduar77"] = {104, -92, 1}, -- HoS
244 ["HallsofLightning1_Continent"] = {105, -93, 0}, ["HallsofLightning1"] = {106, -93, 1},
245 ["HallsofLightning2_Continent"] = {107, -94, 0}, ["HallsofLightning2"] = {108, -94, 1},
247 ["Nexus801_Continent"] = {109, -95, 0}, ["Nexus801"] = {110 , -95, 1},
248 ["Nexus802_Continent"] = {111, -96, 0}, ["Nexus802"] = {112, -96, 1},
249 ["Nexus803_Continent"] = {113, -97, 0}, ["Nexus803"] = {114, -97, 1},
250 ["Nexus804_Continent"] = {115, -98, 0}, ["Nexus804"] = {116, -98, 1},
252 ["CoTStratholme1_Continent"] = {117, -99, 0}, ["CoTStratholme1"] = {118, -99, 1},
253 ["CoTStratholme2_Continent"] = {119, -100, 0}, ["CoTStratholme2"] = {120, -100, 1},
255 ["UtgardePinnacle1_Continent"] = {121, -101, 0}, ["UtgardePinnacle1"] = {122, -101, 1},
256 ["UtgardePinnacle2_Continent"] = {123, -102, 0}, ["UtgardePinnacle2"] = {124, -102, 1},
258 ["VaultofArchavon_Continent"] = {125, -103, 0}, ["VaultofArchavon"] = {126, -103, 1},
260 ["Naxxramas1_Continent"] = {127, -104, 0}, ["Naxxramas1"] = {128, -104, 1},
261 ["Naxxramas2_Continent"] = {129, -105, 0}, ["Naxxramas2"] = {130, -105, 1},
262 ["Naxxramas3_Continent"] = {131, -106, 0}, ["Naxxramas3"] = {132, -106, 1},
263 ["Naxxramas4_Continent"] = {133, -107, 0}, ["Naxxramas4"] = {134, -107, 1},
264 ["Naxxramas5_Continent"] = {135, -108, 0}, ["Naxxramas5"] = {136, -108, 1},
265 ["Naxxramas6_Continent"] = {137, -109, 0}, ["Naxxramas6"] = {138, -109, 1},
267 ["TheObsidianSanctum_Continent"] = {139, -110, 0}, ["TheObsidianSanctum"] = {140, -110, 1},
269 ["TheEyeOfEternity_Continent"] = {141, -111, 0}, ["TheEyeOfEternity"] = {142, -111, 1},
271 ["Ulduar_Continent"] = {143, -112, 0}, ["Ulduar"] = {144, -112, 1},
272 ["Ulduar1_Continent"] = {145, -113, 0}, ["Ulduar1"] = {146, -113, 1},
273 ["Ulduar2_Continent"] = {147, -114, 0}, ["Ulduar2"] = {148, -114, 1},
274 ["Ulduar3_Continent"] = {149, -115, 0}, ["Ulduar3"] = {150, -115, 1},
275 ["Ulduar4_Continent"] = {151, -116, 0}, ["Ulduar4"] = {152, -116, 1},
277 -- yes virginia 152 is currently the end
280 QuestHelper_RestrictedZones
= { -- Everything defaults to "nil"
285 for i
, j
in pairs(QuestHelper_IndexLookup
) do next_index
= math
.max(next_index
, j
[1]+1) end
287 -- Maps zone names and indexes to a two element array, containing zone index a continent/zone
288 QuestHelper_ZoneLookup
= {}
290 -- Maps indexes to zone names.
291 QuestHelper_NameLookup
= {}
293 -- Maps plane indexes to the ultimate continent parents
294 QuestHelper_ParentLookup
= {}
298 function QuestHelper_BuildZoneLookup()
299 if built
then return end
302 if GetMapContinents
and GetMapZones
then
303 -- Called from inside the WoW client.
305 local original_lookup
, original_zones
= QuestHelper_IndexLookup
, QuestHelper_Zones
306 QuestHelper_IndexLookup
= {}
307 QuestHelper_Zones
= {}
309 for c
, cname
in pairs(QuestHelper
.Astrolabe
:GetMapVirtualContinents()) do
310 QuestHelper_Zones
[c
] = {}
311 local tpx
= QuestHelper
.Astrolabe
:GetMapVirtualZones(c
)
313 for z
, zname
in pairs(tpx
) do
315 local base_name
= QuestHelper
.Astrolabe
:GetMapTexture(c
, z
)
317 local index
= original_lookup
[base_name
] and original_lookup
[base_name
][1]
319 local altered_index
= "!!! QuestHelper_IndexLookup entry needs update: [%q] = {%s, %s, %s}"
320 local altered_zone
= "!!! QuestHelper_Zones entry needs update: [%s][%s] = %q -- was %s"
323 QuestHelper
:TextOut(altered_index
:format(tostring(base_name
), tostring(next_index
), tostring(c
), tostring(z
)))
324 next_index
= next_index
+ 1
326 if QuestHelper_Locale
== "enUS" then
327 if original_lookup
[base_name
][2] ~= c
or original_lookup
[base_name
][3] ~= z
then
328 QuestHelper
:TextOut(altered_index
:format(base_name
, index
, c
, z
))
331 if not original_zones
[c
] or original_zones
[c
][z
] ~= zname
then
332 QuestHelper
:TextOut(altered_zone
:format(c
, z
, zname
, original_zones
[c
] and original_zones
[c
][z
] or "missing"))
337 if not QuestHelper_IndexLookup
[c
] then QuestHelper_IndexLookup
[c
] = {} end
338 QuestHelper_IndexLookup
[c
][z
] = index
339 QuestHelper_IndexLookup
[zname
] = index
341 QuestHelper_NameLookup
[index
] = zname
343 QuestHelper_ZoneLookup
[zname
] = pair
344 QuestHelper_ZoneLookup
[index
] = pair
346 QuestHelper_Zones
[c
][z
] = zname
351 for name
, index
in pairs(original_lookup
) do
352 if index
[2] == -1 then
353 assert(not QuestHelper_IndexLookup
[name
])
354 QuestHelper_IndexLookup
[name
] = index
[1]
358 for k
, v
in pairs(QuestHelper_ZoneLookup
) do
359 if type(k
) == "number" then
360 if v
[1] == 1 or v
[1] == 2 or v
[1] == 4 then -- weh
361 QuestHelper_ParentLookup
[k
] = 0
363 QuestHelper_ParentLookup
[k
] = v
[1]
368 -- Called from some lua script.
369 local original_lookup
= QuestHelper_IndexLookup
370 QuestHelper_IndexLookup
= {}
372 for base_name
, i
in pairs(original_lookup
) do
374 local pair
= {i
[2], i
[3]}
375 local name
= QuestHelper_Zones
[pair
[1]]
[pair
[2]]
377 assert(index
and name
)
379 if not QuestHelper_IndexLookup
[pair
[1]]
then QuestHelper_IndexLookup
[pair
[1]]
= {} end
380 QuestHelper_IndexLookup
[pair
[1]]
[pair
[2]]
= index
381 QuestHelper_IndexLookup
[name
] = index
383 QuestHelper_NameLookup
[index
] = name
385 QuestHelper_ZoneLookup
[name
] = pair
386 QuestHelper_ZoneLookup
[index
] = pair
391 local convert_lookup
=
392 {{2, 15, 3, 9, 16, 21, 4, 7, 10, 13, 17, 20, 22, 1, 5, 6, 8, 24, 11, 12, 14, 23, 18, 19},
393 {26, 39, 27, 33, 40, 47, 28, 31, 34, 37, 41, 44, 48, 25, 29, 30, 32, 52, 35, 36, 38, 46, 42, 43, 45, 50, 49, 51},
394 {54, 56, 58, 59, 53, 60, 55, 57}}
396 function QuestHelper_ValidPosition(c
, z
, x
, y
)
397 return type(x
) == "number" and type(y
) == "number" and x
> -0.1 and y
> -0.1 and x
< 1.1 and y
< 1.1 and c
and convert_lookup
[c
] and z
and convert_lookup
[c
][z
] and true
400 function QuestHelper_PrunePositionList(list
)
401 if type(list
) ~= "table" then
408 if QuestHelper_ValidPosition(unpack(list
[i
])) and type(pos
[5]) == "number" and pos
[5] >= 1 then
411 local rem
= table.remove(list
, i
)
415 return #list
> 0 and list
or nil
418 local function QuestHelper_ConvertPosition(pos
)
419 pos
[2] = convert_lookup
[pos
[1]]
[pos
[2]]
423 local function QuestHelper_ConvertPositionList(list
)
425 for i
, pos
in pairs(list
) do
426 QuestHelper_ConvertPosition(pos
)
431 local function QuestHelper_ConvertFaction(faction
)
432 if faction
== 1 or faction
== "Alliance" or faction
== FACTION_ALLIANCE
then return 1
433 elseif faction
== 2 or faction
== "Horde" or faction
== FACTION_HORDE
then return 2
435 assert(false, "Unknown faction: "..faction
.."'")
439 function QuestHelper_UpgradeDatabase(data
)
440 if data
.QuestHelper_SaveVersion
== 1 then
442 -- Reputation objectives weren't parsed correctly before.
443 if data
.QuestHelper_Objectives
["reputation"] then
444 for faction
, objective
in pairs(data
.QuestHelper_Objectives
["reputation"]) do
445 local real_faction
= string.find(faction
, "%s*(.+)%s*:%s*") or faction
446 if faction
~= real_faction
then
447 data
.QuestHelper_Objectives
["reputation"][real_faction
] = data
.QuestHelper_Objectives
["reputation"][faction
]
448 data
.QuestHelper_Objectives
["reputation"][faction
] = nil
453 -- Items that wern't in the local cache when I read the quest log ended up with empty names.
454 if data
.QuestHelper_Objectives
["item"] then
455 data
.QuestHelper_Objectives
["item"][" "] = nil
458 data
.QuestHelper_SaveVersion
= 2
461 if data
.QuestHelper_SaveVersion
== 2 then
463 -- The hashes for the quests were wrong. Damnit!
464 for faction
, level_list
in pairs(data
.QuestHelper_Quests
) do
465 for level
, quest_list
in pairs(level_list
) do
466 for quest_name
, quest_data
in pairs(quest_list
) do
467 quest_data
.hash
= nil
473 -- None of the information I collected about quest items previously can be trusted.
474 -- I also didn't properly mark quest items as such, so I'll have to remove the information for non
477 if data
.QuestHelper_Objectives
["item"] then
478 for item
, item_data
in pairs(data
.QuestHelper_Objectives
["item"]) do
479 -- I'll remerge the bad data later if I find out its not used solely for quests.
480 item_data
.bad_pos
= item_data
.bad_pos
or item_data
.pos
481 item_data
.bad_drop
= item_data
.bad_drop
or item_data
.drop
485 -- In the future i'll delete the bad_x data.
486 -- When I do, either just delete it, or of all the monsters or positions match the monsters and positions of the
487 -- quest, merge them into that.
491 data
.QuestHelper_SaveVersion
= 3
494 if data
.QuestHelper_SaveVersion
== 3 then
495 -- We'll go through this and make sure all the position lists are correct.
496 for faction
, level_list
in pairs(data
.QuestHelper_Quests
) do
497 for level
, quest_list
in pairs(level_list
) do
498 for quest_name
, quest_data
in pairs(quest_list
) do
499 quest_data
.pos
= QuestHelper_PrunePositionList(quest_data
.pos
)
500 if quest_data
.item
then for name
, data
in pairs(quest_data
.item
) do
501 data
.pos
= QuestHelper_PrunePositionList(data
.pos
)
503 if quest_data
.alt
then for hash
, data
in pairs(quest_data
.alt
) do
504 data
.pos
= QuestHelper_PrunePositionList(data
.pos
)
505 if data
.item
then for name
, data
in pairs(data
.item
) do
506 data
.pos
= QuestHelper_PrunePositionList(data
.pos
)
513 for cat
, list
in pairs(data
.QuestHelper_Objectives
) do
514 for name
, data
in pairs(list
) do
515 data
.pos
= QuestHelper_PrunePositionList(data
.pos
)
519 if data
.QuestHelper_ZoneTransition
then
520 for c
, z1list
in pairs(data
.QuestHelper_ZoneTransition
) do
521 for z1
, z2list
in pairs(z1list
) do
522 for z2
, poslist
in pairs(z2list
) do
523 z2list
[z2
] = QuestHelper_PrunePositionList(poslist
)
529 data
.QuestHelper_SaveVersion
= 4
532 if data
.QuestHelper_SaveVersion
== 4 then
533 -- Zone transitions have been obsoleted by a bug.
534 data
.QuestHelper_ZoneTransition
= nil
535 data
.QuestHelper_SaveVersion
= 5
538 if data
.QuestHelper_SaveVersion
== 5 then
539 -- For version 6, I'm converting area positions from a continent/zone index pair to a single index.
541 if data
.QuestHelper_FlightRoutes
then
542 local old_routes
= data
.QuestHelper_FlightRoutes
543 data
.QuestHelper_FlightRoutes
= {}
544 for c
, value
in pairs(old_routes
) do
545 data
.QuestHelper_FlightRoutes
[QuestHelper_IndexLookup
[c
][0]]
= value
549 for faction
, level_list
in pairs(data
.QuestHelper_Quests
) do
550 for level
, quest_list
in pairs(level_list
) do
551 for quest_name
, quest_data
in pairs(quest_list
) do
552 QuestHelper_ConvertPositionList(quest_data
.pos
)
553 if quest_data
.item
then for name
, data
in pairs(quest_data
.item
) do
554 QuestHelper_ConvertPositionList(data
.pos
)
556 if quest_data
.alt
then for hash
, data
in pairs(quest_data
.alt
) do
557 QuestHelper_ConvertPositionList(data
.pos
)
558 if data
.item
then for name
, data
in pairs(data
.item
) do
559 QuestHelper_ConvertPositionList(data
.pos
)
566 for cat
, list
in pairs(data
.QuestHelper_Objectives
) do
567 for name
, data
in pairs(list
) do
568 QuestHelper_ConvertPositionList(data
.pos
)
572 data
.QuestHelper_SaveVersion
= 6
575 if data
.QuestHelper_SaveVersion
== 6 then
576 -- Redoing how flightpaths work, previously collected flightpath data is now obsolete.
577 data
.QuestHelper_FlightRoutes
= {}
579 -- FlightInstructors table should be fine, will leave it.
580 -- Upgrading per-character data is handled in main.lua.
582 -- Also converting factions to numbers, 1 for Alliance, 2 for Horde.
583 local replacement
= {}
584 for faction
, dat
in pairs(data
.QuestHelper_Quests
) do
585 replacement
[QuestHelper_ConvertFaction(faction
)] = dat
587 data
.QuestHelper_Quests
= replacement
590 if data
.QuestHelper_FlightInstructors
then for faction
, dat
in pairs(data
.QuestHelper_FlightInstructors
) do
591 replacement
[QuestHelper_ConvertFaction(faction
)] = dat
593 data
.QuestHelper_FlightInstructors
= replacement
595 for cat
, list
in pairs(data
.QuestHelper_Objectives
) do
596 for name
, obj
in pairs(list
) do
598 obj
.faction
= QuestHelper_ConvertFaction(obj
.faction
)
603 data
.QuestHelper_SaveVersion
= 7
606 if data
.QuestHelper_SaveVersion
== 7 then
607 -- It sure took me long enough to discover that I broke vendor objectives.
608 -- their factions were strings and didn't match the number value of QuestHelper.faction
610 for cat
, list
in pairs(data
.QuestHelper_Objectives
) do
611 for name
, obj
in pairs(list
) do
612 if type(obj
.faction
) == "string" then
613 obj
.faction
= (obj
.faction
== "Alliance" and 1) or (obj
.faction
== "Horde" and 2) or nil
618 data
.QuestHelper_SaveVersion
= 8
621 if data
.QuestHelper_SaveVersion
== 8 then
622 -- Two things we're doing here
623 -- First, wrath-ize Stormwind coordinates
626 for cat, list in pairs(QuestHelper_Objectives) do
627 for name, obj in pairs(list) do
629 for i, cpos in pairs(obj.pos) do
630 QuestHelper_ConvertCoordsToWrath(cpos, true)
634 end]] -- okay we're not actually doing this, coordinates are staying native
636 -- Second, split up the entire thing into versions
637 local function versionize(item
)
638 --if not item or type(item) ~= "table" then return end -- blue magician doesn't know what the fuck
641 local foundthings
= false
642 for k
, v
in pairs(item
) do
646 if not foundthings
then return end -- just to avoid extra keys hanging around in people's tables
648 for key
in pairs(item
) do
652 item
["unknown on unknown"] = temp
655 versionize(data
.QuestHelper_Quests
)
656 versionize(data
.QuestHelper_Objectives
)
657 versionize(data
.QuestHelper_FlightInstructors
)
658 versionize(data
.QuestHelper_FlightRoutes
)
660 data
.QuestHelper_SaveVersion
= 9
663 if data
.QuestHelper_SaveVersion
== 9 then
664 -- The only thing we're doing here is moving the QuestHelper_ErrorList into QuestHelper_Errors
665 data
.QuestHelper_Errors
= {}
666 data
.QuestHelper_Errors
.crashes
= {}
668 if data
.QuestHelper_ErrorList
then
669 for k
, v
in pairs(data
.QuestHelper_ErrorList
) do
670 data
.QuestHelper_Errors
.crashes
[k
] = v
674 data
.QuestHelper_ErrorList
= nil
676 data
.QuestHelper_SaveVersion
= 10
680 function QuestHelper_UpgradeComplete()
681 -- This function deletes everything related to upgrading, as it isn't going to be needed again.
685 QuestHelper_BuildZoneLookup
= nil
686 QuestHelper_ValidPosition
= nil
687 QuestHelper_PrunePositionList
= nil
688 QuestHelper_ConvertPosition
= nil
689 QuestHelper_ConvertPositionList
= nil
690 QuestHelper_ConvertFaction
= nil
691 QuestHelper_UpgradeDatabase
= nil
692 QuestHelper_UpgradeComplete
= nil
695 -- These are used to convert coordinates back and forth from "Wrath" to "Native". "Force" is used to convert back and forth from "Wrath" to "BC".
696 -- Both changes the data in-place and returns the data.
697 function QuestHelper_ConvertCoordsToWrath(data
, force
)
698 if (force
or not QuestHelper
:IsWrath()) then
699 if data
[1] == 36 then -- Stormwind
700 data
[2] = data
[2] * 0.77324 + 0.197
701 data
[3] = data
[3] * 0.77324 + 0.245
702 elseif data
[1] == 34 then -- EPL
703 data
[2] = data
[2] * 0.960 - 0.0254
704 data
[3] = data
[3] * 0.960 - 0.03532
710 function QuestHelper_ConvertCoordsFromWrath(data
, force
)
711 if (force
or not QuestHelper
:IsWrath()) then
712 if data
[1] == 36 then -- Stormwind
713 data
[2] = (data
[2] - 0.197) / 0.77324
714 data
[3] = (data
[3] - 0.245) / 0.77324
715 elseif data
[1] == 34 then -- EPL
716 data
[2] = (data
[2] + 0.0254) / 0.960
717 data
[3] = (data
[3] + 0.03532) / 0.960
723 local QuestHelper_PrivateServerBlacklist_Find
= {
730 local QuestHelper_PrivateServerBlacklist_Exact
= {
734 "Columbian Drug Dealer",
735 "PlayBoy Fun Vendor",
737 "Accessories Vendor",
738 "General Goods Vendor",
748 "Fooooood and Drinks!",
749 "I Sell Consumables",
752 "Bobby", -- I have no idea if this is an actual private server NPC
755 "Warrior Set Vendor",
757 "Warlock Set Vendor",
758 "Paladin Set Vendor",
760 "Mage Set Vendor", -- yeah yeah this isn't everyone whatever
763 local matchstring
= nil
765 function QuestHelper_IsPolluted(input
)
766 if not input
then input
= _G
end
768 for version
, data
in pairs(input
.QuestHelper_Objectives
) do
769 for cat
, name_list
in pairs(data
) do
770 for name
, obj
in pairs(name_list
) do
771 for k
, v
in pairs(QuestHelper_PrivateServerBlacklist_Find
) do
772 if string.find(name
, v
) then
773 for _
, __
in pairs(obj
) do
774 return true -- if there's nothing actually in the object, the player may not have contributed data, he may have just gotten smacked by old corrupted data.
778 for k
, v
in pairs(QuestHelper_PrivateServerBlacklist_Exact
) do
780 for _
, __
in pairs(obj
) do
781 return true -- if there's nothing actually in the object, the player may not have contributed data, he may have just gotten smacked by old corrupted data.