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
= {}
295 function QuestHelper_BuildZoneLookup()
296 if built
then return end
299 if GetMapContinents
and GetMapZones
then
300 -- Called from inside the WoW client.
302 local original_lookup
, original_zones
= QuestHelper_IndexLookup
, QuestHelper_Zones
303 QuestHelper_IndexLookup
= {}
304 QuestHelper_Zones
= {}
306 for c
, cname
in pairs(QuestHelper
.Astrolabe
:GetMapVirtualContinents()) do
307 QuestHelper_Zones
[c
] = {}
308 local tpx
= QuestHelper
.Astrolabe
:GetMapVirtualZones(c
)
310 for z
, zname
in pairs(tpx
) do
312 local base_name
= QuestHelper
.Astrolabe
:GetMapTexture(c
, z
)
314 local index
= original_lookup
[base_name
] and original_lookup
[base_name
][1]
316 local altered_index
= "!!! QuestHelper_IndexLookup entry needs update: [%q] = {%s, %s, %s}"
317 local altered_zone
= "!!! QuestHelper_Zones entry needs update: [%s][%s] = %q -- was %s"
320 QuestHelper
:TextOut(altered_index
:format(tostring(base_name
), tostring(next_index
), tostring(c
), tostring(z
)))
321 next_index
= next_index
+ 1
323 if QuestHelper_Locale
== "enUS" then
324 if original_lookup
[base_name
][2] ~= c
or original_lookup
[base_name
][3] ~= z
then
325 QuestHelper
:TextOut(altered_index
:format(base_name
, index
, c
, z
))
328 if not original_zones
[c
] or original_zones
[c
][z
] ~= zname
then
329 QuestHelper
:TextOut(altered_zone
:format(c
, z
, zname
, original_zones
[c
] and original_zones
[c
][z
] or "missing"))
334 if not QuestHelper_IndexLookup
[c
] then QuestHelper_IndexLookup
[c
] = {} end
335 QuestHelper_IndexLookup
[c
][z
] = index
336 QuestHelper_IndexLookup
[zname
] = index
338 QuestHelper_NameLookup
[index
] = zname
340 QuestHelper_ZoneLookup
[zname
] = pair
341 QuestHelper_ZoneLookup
[index
] = pair
343 QuestHelper_Zones
[c
][z
] = zname
348 for name
, index
in pairs(original_lookup
) do
349 if index
[2] == -1 then
350 assert(not QuestHelper_IndexLookup
[name
])
351 QuestHelper_IndexLookup
[name
] = index
[1]
355 -- Called from some lua script.
356 local original_lookup
= QuestHelper_IndexLookup
357 QuestHelper_IndexLookup
= {}
359 for base_name
, i
in pairs(original_lookup
) do
361 local pair
= {i
[2], i
[3]}
362 local name
= QuestHelper_Zones
[pair
[1]]
[pair
[2]]
364 assert(index
and name
)
366 if not QuestHelper_IndexLookup
[pair
[1]]
then QuestHelper_IndexLookup
[pair
[1]]
= {} end
367 QuestHelper_IndexLookup
[pair
[1]]
[pair
[2]]
= index
368 QuestHelper_IndexLookup
[name
] = index
370 QuestHelper_NameLookup
[index
] = name
372 QuestHelper_ZoneLookup
[name
] = pair
373 QuestHelper_ZoneLookup
[index
] = pair
378 local convert_lookup
=
379 {{2, 15, 3, 9, 16, 21, 4, 7, 10, 13, 17, 20, 22, 1, 5, 6, 8, 24, 11, 12, 14, 23, 18, 19},
380 {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},
381 {54, 56, 58, 59, 53, 60, 55, 57}}
383 function QuestHelper_ValidPosition(c
, z
, x
, y
)
384 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
387 function QuestHelper_PrunePositionList(list
)
388 if type(list
) ~= "table" then
395 if QuestHelper_ValidPosition(unpack(list
[i
])) and type(pos
[5]) == "number" and pos
[5] >= 1 then
398 local rem
= table.remove(list
, i
)
402 return #list
> 0 and list
or nil
405 local function QuestHelper_ConvertPosition(pos
)
406 pos
[2] = convert_lookup
[pos
[1]]
[pos
[2]]
410 local function QuestHelper_ConvertPositionList(list
)
412 for i
, pos
in pairs(list
) do
413 QuestHelper_ConvertPosition(pos
)
418 local function QuestHelper_ConvertFaction(faction
)
419 if faction
== 1 or faction
== "Alliance" or faction
== FACTION_ALLIANCE
then return 1
420 elseif faction
== 2 or faction
== "Horde" or faction
== FACTION_HORDE
then return 2
422 assert(false, "Unknown faction: "..faction
.."'")
426 function QuestHelper_UpgradeDatabase(data
)
427 if data
.QuestHelper_SaveVersion
== 1 then
429 -- Reputation objectives weren't parsed correctly before.
430 if data
.QuestHelper_Objectives
["reputation"] then
431 for faction
, objective
in pairs(data
.QuestHelper_Objectives
["reputation"]) do
432 local real_faction
= string.find(faction
, "%s*(.+)%s*:%s*") or faction
433 if faction
~= real_faction
then
434 data
.QuestHelper_Objectives
["reputation"][real_faction
] = data
.QuestHelper_Objectives
["reputation"][faction
]
435 data
.QuestHelper_Objectives
["reputation"][faction
] = nil
440 -- Items that wern't in the local cache when I read the quest log ended up with empty names.
441 if data
.QuestHelper_Objectives
["item"] then
442 data
.QuestHelper_Objectives
["item"][" "] = nil
445 data
.QuestHelper_SaveVersion
= 2
448 if data
.QuestHelper_SaveVersion
== 2 then
450 -- The hashes for the quests were wrong. Damnit!
451 for faction
, level_list
in pairs(data
.QuestHelper_Quests
) do
452 for level
, quest_list
in pairs(level_list
) do
453 for quest_name
, quest_data
in pairs(quest_list
) do
454 quest_data
.hash
= nil
460 -- None of the information I collected about quest items previously can be trusted.
461 -- I also didn't properly mark quest items as such, so I'll have to remove the information for non
464 if data
.QuestHelper_Objectives
["item"] then
465 for item
, item_data
in pairs(data
.QuestHelper_Objectives
["item"]) do
466 -- I'll remerge the bad data later if I find out its not used solely for quests.
467 item_data
.bad_pos
= item_data
.bad_pos
or item_data
.pos
468 item_data
.bad_drop
= item_data
.bad_drop
or item_data
.drop
472 -- In the future i'll delete the bad_x data.
473 -- When I do, either just delete it, or of all the monsters or positions match the monsters and positions of the
474 -- quest, merge them into that.
478 data
.QuestHelper_SaveVersion
= 3
481 if data
.QuestHelper_SaveVersion
== 3 then
482 -- We'll go through this and make sure all the position lists are correct.
483 for faction
, level_list
in pairs(data
.QuestHelper_Quests
) do
484 for level
, quest_list
in pairs(level_list
) do
485 for quest_name
, quest_data
in pairs(quest_list
) do
486 quest_data
.pos
= QuestHelper_PrunePositionList(quest_data
.pos
)
487 if quest_data
.item
then for name
, data
in pairs(quest_data
.item
) do
488 data
.pos
= QuestHelper_PrunePositionList(data
.pos
)
490 if quest_data
.alt
then for hash
, data
in pairs(quest_data
.alt
) do
491 data
.pos
= QuestHelper_PrunePositionList(data
.pos
)
492 if data
.item
then for name
, data
in pairs(data
.item
) do
493 data
.pos
= QuestHelper_PrunePositionList(data
.pos
)
500 for cat
, list
in pairs(data
.QuestHelper_Objectives
) do
501 for name
, data
in pairs(list
) do
502 data
.pos
= QuestHelper_PrunePositionList(data
.pos
)
506 if data
.QuestHelper_ZoneTransition
then
507 for c
, z1list
in pairs(data
.QuestHelper_ZoneTransition
) do
508 for z1
, z2list
in pairs(z1list
) do
509 for z2
, poslist
in pairs(z2list
) do
510 z2list
[z2
] = QuestHelper_PrunePositionList(poslist
)
516 data
.QuestHelper_SaveVersion
= 4
519 if data
.QuestHelper_SaveVersion
== 4 then
520 -- Zone transitions have been obsoleted by a bug.
521 data
.QuestHelper_ZoneTransition
= nil
522 data
.QuestHelper_SaveVersion
= 5
525 if data
.QuestHelper_SaveVersion
== 5 then
526 -- For version 6, I'm converting area positions from a continent/zone index pair to a single index.
528 if data
.QuestHelper_FlightRoutes
then
529 local old_routes
= data
.QuestHelper_FlightRoutes
530 data
.QuestHelper_FlightRoutes
= {}
531 for c
, value
in pairs(old_routes
) do
532 data
.QuestHelper_FlightRoutes
[QuestHelper_IndexLookup
[c
][0]]
= value
536 for faction
, level_list
in pairs(data
.QuestHelper_Quests
) do
537 for level
, quest_list
in pairs(level_list
) do
538 for quest_name
, quest_data
in pairs(quest_list
) do
539 QuestHelper_ConvertPositionList(quest_data
.pos
)
540 if quest_data
.item
then for name
, data
in pairs(quest_data
.item
) do
541 QuestHelper_ConvertPositionList(data
.pos
)
543 if quest_data
.alt
then for hash
, data
in pairs(quest_data
.alt
) do
544 QuestHelper_ConvertPositionList(data
.pos
)
545 if data
.item
then for name
, data
in pairs(data
.item
) do
546 QuestHelper_ConvertPositionList(data
.pos
)
553 for cat
, list
in pairs(data
.QuestHelper_Objectives
) do
554 for name
, data
in pairs(list
) do
555 QuestHelper_ConvertPositionList(data
.pos
)
559 data
.QuestHelper_SaveVersion
= 6
562 if data
.QuestHelper_SaveVersion
== 6 then
563 -- Redoing how flightpaths work, previously collected flightpath data is now obsolete.
564 data
.QuestHelper_FlightRoutes
= {}
566 -- FlightInstructors table should be fine, will leave it.
567 -- Upgrading per-character data is handled in main.lua.
569 -- Also converting factions to numbers, 1 for Alliance, 2 for Horde.
570 local replacement
= {}
571 for faction
, dat
in pairs(data
.QuestHelper_Quests
) do
572 replacement
[QuestHelper_ConvertFaction(faction
)] = dat
574 data
.QuestHelper_Quests
= replacement
577 if data
.QuestHelper_FlightInstructors
then for faction
, dat
in pairs(data
.QuestHelper_FlightInstructors
) do
578 replacement
[QuestHelper_ConvertFaction(faction
)] = dat
580 data
.QuestHelper_FlightInstructors
= replacement
582 for cat
, list
in pairs(data
.QuestHelper_Objectives
) do
583 for name
, obj
in pairs(list
) do
585 obj
.faction
= QuestHelper_ConvertFaction(obj
.faction
)
590 data
.QuestHelper_SaveVersion
= 7
593 if data
.QuestHelper_SaveVersion
== 7 then
594 -- It sure took me long enough to discover that I broke vendor objectives.
595 -- their factions were strings and didn't match the number value of QuestHelper.faction
597 for cat
, list
in pairs(data
.QuestHelper_Objectives
) do
598 for name
, obj
in pairs(list
) do
599 if type(obj
.faction
) == "string" then
600 obj
.faction
= (obj
.faction
== "Alliance" and 1) or (obj
.faction
== "Horde" and 2) or nil
605 data
.QuestHelper_SaveVersion
= 8
608 if data
.QuestHelper_SaveVersion
== 8 then
609 -- Two things we're doing here
610 -- First, wrath-ize Stormwind coordinates
613 for cat, list in pairs(QuestHelper_Objectives) do
614 for name, obj in pairs(list) do
616 for i, cpos in pairs(obj.pos) do
617 QuestHelper_ConvertCoordsToWrath(cpos, true)
621 end]] -- okay we're not actually doing this, coordinates are staying native
623 -- Second, split up the entire thing into versions
624 local function versionize(item
)
625 --if not item or type(item) ~= "table" then return end -- blue magician doesn't know what the fuck
628 local foundthings
= false
629 for k
, v
in pairs(item
) do
633 if not foundthings
then return end -- just to avoid extra keys hanging around in people's tables
635 for key
in pairs(item
) do
639 item
["unknown on unknown"] = temp
642 versionize(data
.QuestHelper_Quests
)
643 versionize(data
.QuestHelper_Objectives
)
644 versionize(data
.QuestHelper_FlightInstructors
)
645 versionize(data
.QuestHelper_FlightRoutes
)
647 data
.QuestHelper_SaveVersion
= 9
650 if data
.QuestHelper_SaveVersion
== 9 then
651 -- The only thing we're doing here is moving the QuestHelper_ErrorList into QuestHelper_Errors
652 data
.QuestHelper_Errors
= {}
653 data
.QuestHelper_Errors
.crashes
= {}
655 if data
.QuestHelper_ErrorList
then
656 for k
, v
in pairs(data
.QuestHelper_ErrorList
) do
657 data
.QuestHelper_Errors
.crashes
[k
] = v
661 data
.QuestHelper_ErrorList
= nil
663 data
.QuestHelper_SaveVersion
= 10
667 function QuestHelper_UpgradeComplete()
668 -- This function deletes everything related to upgrading, as it isn't going to be needed again.
672 QuestHelper_BuildZoneLookup
= nil
673 QuestHelper_ValidPosition
= nil
674 QuestHelper_PrunePositionList
= nil
675 QuestHelper_ConvertPosition
= nil
676 QuestHelper_ConvertPositionList
= nil
677 QuestHelper_ConvertFaction
= nil
678 QuestHelper_UpgradeDatabase
= nil
679 QuestHelper_UpgradeComplete
= nil
682 -- 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".
683 -- Both changes the data in-place and returns the data.
684 function QuestHelper_ConvertCoordsToWrath(data
, force
)
685 if (force
or not QuestHelper
:IsWrath()) then
686 if data
[1] == 36 then -- Stormwind
687 data
[2] = data
[2] * 0.77324 + 0.197
688 data
[3] = data
[3] * 0.77324 + 0.245
689 elseif data
[1] == 34 then -- EPL
690 data
[2] = data
[2] * 0.960 - 0.0254
691 data
[3] = data
[3] * 0.960 - 0.03532
697 function QuestHelper_ConvertCoordsFromWrath(data
, force
)
698 if (force
or not QuestHelper
:IsWrath()) then
699 if data
[1] == 36 then -- Stormwind
700 data
[2] = (data
[2] - 0.197) / 0.77324
701 data
[3] = (data
[3] - 0.245) / 0.77324
702 elseif data
[1] == 34 then -- EPL
703 data
[2] = (data
[2] + 0.0254) / 0.960
704 data
[3] = (data
[3] + 0.03532) / 0.960
710 local QuestHelper_PrivateServerBlacklist_Find
= {
717 local QuestHelper_PrivateServerBlacklist_Exact
= {
721 "Columbian Drug Dealer",
722 "PlayBoy Fun Vendor",
724 "Accessories Vendor",
725 "General Goods Vendor",
735 "Fooooood and Drinks!",
736 "I Sell Consumables",
739 "Bobby", -- I have no idea if this is an actual private server NPC
742 "Warrior Set Vendor",
744 "Warlock Set Vendor",
745 "Paladin Set Vendor",
747 "Mage Set Vendor", -- yeah yeah this isn't everyone whatever
750 local matchstring
= nil
752 function QuestHelper_IsPolluted(input
)
753 if not input
then input
= _G
end
755 for version
, data
in pairs(input
.QuestHelper_Objectives
) do
756 for cat
, name_list
in pairs(data
) do
757 for name
, obj
in pairs(name_list
) do
758 for k
, v
in pairs(QuestHelper_PrivateServerBlacklist_Find
) do
759 if string.find(name
, v
) then
760 for _
, __
in pairs(obj
) do
761 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.
765 for k
, v
in pairs(QuestHelper_PrivateServerBlacklist_Exact
) do
767 for _
, __
in pairs(obj
) do
768 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.