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",
70 [-77]={[0]="ScarletEnclave_Continent", [1]="ScarletEnclave"},
72 [-80]={[0]="UtgardeKeep1_Continent", [1]="UtgardeKeep1"},
73 [-81]={[0]="UtgardeKeep2_Continent", [1]="UtgardeKeep2"},
74 [-82]={[0]="UtgardeKeep3_Continent", [1]="UtgardeKeep3"},
76 [-83]={[0]="TheNexus_Continent", [1]="TheNexus"},
78 [-84]={[0]="AzjolNerub1_Continent", [1]="AzjolNerub1"},
79 [-85]={[0]="AzjolNerub2_Continent", [1]="AzjolNerub2"},
80 [-86]={[0]="AzjolNerub3_Continent", [1]="AzjolNerub3"},
82 [-87]={[0]="Ahnkahet_Continent", [1]="Ahnkahet"},
84 [-88]={[0]="DrakTharonKeep1_Continent", [1]="DrakTharonKeep1"},
85 [-89]={[0]="DrakTharonKeep2_Continent", [1]="DrakTharonKeep2"},
87 [-90]={[0]="VioletHold_Continent", [1]="VioletHold"},
89 [-91]={[0]="Gundrak_Continent", [1]="Gundrak"},
91 [-92]={[0]="Ulduar77_Continent", [1]="Ulduar77"},
93 [-93]={[0]="HallsofLightning1_Continent", [1]="HallsofLightning1"},
94 [-94]={[0]="HallsofLightning2_Continent", [1]="HallsofLightning2"},
96 [-95]={[0]="Nexus801_Continent", [1]="Nexus801"},
97 [-96]={[0]="Nexus802_Continent", [1]="Nexus802"},
98 [-97]={[0]="Nexus803_Continent", [1]="Nexus803"},
99 [-98]={[0]="Nexus804_Continent", [1]="Nexus804"},
101 [-99]={[0]="CoTStratholme1_Continent", [1]="CoTStratholme1"},
102 [-100]={[0]="CoTStratholme2_Continent", [1]="CoTStratholme2"},
104 [-101]={[0]="UtgardePinnacle1_Continent", [1]="UtgardePinnacle1"},
105 [-102]={[0]="UtgardePinnacle2_Continent", [1]="UtgardePinnacle2"},
107 [-103]={[0]="VaultofArchavon_Continent", [1]="VaultofArchavon"},
109 [-104]={[0]="Naxxramas1_Continent", [1]="Naxxramas1"},
110 [-105]={[0]="Naxxramas2_Continent", [1]="Naxxramas2"},
111 [-106]={[0]="Naxxramas3_Continent", [1]="Naxxramas3"},
112 [-107]={[0]="Naxxramas4_Continent", [1]="Naxxramas4"},
113 [-108]={[0]="Naxxramas5_Continent", [1]="Naxxramas5"},
114 [-109]={[0]="Naxxramas6_Continent", [1]="Naxxramas6"},
116 [-110]={[0]="TheObsidianSanctum_Continent", [1]="TheObsidianSanctum"},
118 [-111]={[0]="TheEyeOfEternity_Continent", [1]="TheEyeOfEternity"},
120 [-112]={[0]="Ulduar_Continent", [1]="Ulduar"},
121 [-113]={[0]="Ulduar1_Continent", [1]="Ulduar1"},
122 [-114]={[0]="Ulduar2_Continent", [1]="Ulduar2"},
123 [-115]={[0]="Ulduar3_Continent", [1]="Ulduar3"},
124 [-116]={[0]="Ulduar4_Continent", [1]="Ulduar4"},
128 -- This will be translated to [LOCALE_NAME] = INDEX by QuestHelper_BuildZoneLookup.
129 -- Additionally, [CONT_INDEX][ZONE_INDEX] = INDEX will also be added.
130 QuestHelper_IndexLookup
=
131 {["Hinterlands"] = {42, 2, 24},
132 ["Moonglade"] = {20, 1, 12},
133 ["ThousandNeedles"] = {14, 1, 21},
134 ["Winterspring"] = {19, 1, 24},
135 ["BloodmystIsle"] = {9, 1, 4},
136 ["TerokkarForest"] = {55, 3, 7},
137 ["Arathi"] = {39, 2, 2},
138 ["EversongWoods"] = {41, 2, 11},
139 ["Dustwallow"] = {10, 1, 9},
140 ["Badlands"] = {27, 2, 3},
141 ["Darkshore"] = {16, 1, 5},
142 ["Ogrimmar"] = {1, 1, 14},
143 ["BladesEdgeMountains"] = {54, 3, 1},
144 ["Undercity"] = {45, 2, 26},
145 ["Desolace"] = {4, 1, 7},
146 ["Netherstorm"] = {59, 3, 4},
147 ["Barrens"] = {11, 1, 19},
148 ["Tanaris"] = {8, 1, 17},
149 ["Stormwind"] = {36, 2, 21},
150 ["Zangarmarsh"] = {57, 3, 8},
151 ["Durotar"] = {7, 1, 8},
152 ["Hellfire"] = {56, 3, 2},
153 ["Silithus"] = {5, 1, 15},
154 ["ShattrathCity"] = {60, 3, 6},
155 ["ShadowmoonValley"] = {53, 3, 5},
156 ["SwampOfSorrows"] = {46, 2, 23},
157 ["SilvermoonCity"] = {52, 2, 19},
158 ["Darnassis"] = {21, 1, 6},
159 ["AzuremystIsle"] = {3, 1, 3},
160 ["Elwynn"] = {37, 2, 10},
161 ["Stranglethorn"] = {38, 2, 22},
162 ["EasternPlaguelands"] = {34, 2, 9},
163 ["Duskwood"] = {31, 2, 8},
164 ["WesternPlaguelands"] = {50, 2, 27},
165 ["Westfall"] = {49, 2, 28},
166 ["Ashenvale"] = {2, 1, 1},
167 ["Teldrassil"] = {24, 1, 18},
168 ["Redridge"] = {30, 2, 17},
169 ["UngoroCrater"] = {18, 1, 23},
170 ["Mulgore"] = {22, 1, 13},
171 ["Ironforge"] = {25, 2, 14},
172 ["Felwood"] = {13, 1, 10},
173 ["Hilsbrad"] = {48, 2, 13},
174 ["DeadwindPass"] = {47, 2, 6},
175 ["BurningSteppes"] = {40, 2, 5},
176 ["Ghostlands"] = {44, 2, 12},
177 ["Tirisfal"] = {43, 2, 25},
178 ["TheExodar"] = {12, 1, 20},
179 ["Wetlands"] = {51, 2, 29},
180 ["SearingGorge"] = {32, 2, 18},
181 ["BlastedLands"] = {33, 2, 4},
182 ["Silverpine"] = {35, 2, 20},
183 ["LochModan"] = {29, 2, 16},
184 ["Feralas"] = {17, 1, 11},
185 ["DunMorogh"] = {28, 2, 7},
186 ["Alterac"] = {26, 2, 1},
187 ["ThunderBluff"] = {23, 1, 22},
188 ["Aszhara"] = {15, 1, 2},
189 ["StonetalonMountains"] = {6, 1, 16},
190 ["Nagrand"] = {58, 3, 3},
191 ["Kalimdor"] = {61, 1, 0},
192 ["Azeroth"] = {62, 2, 0},
193 ["Expansion01"] = {63, 3, 0},
194 ["Sunwell"] = {64, 2, 15},
196 ["Northrend"] = {76, 4, 0},
197 ["BoreanTundra"] = {65, 4, 1},
198 ["CrystalsongForest"] = {66, 4, 2},
199 ["Dalaran"] = {67, 4, 3},
200 ["Dragonblight"] = {68, 4, 4},
201 ["GrizzlyHills"] = {69, 4, 5},
202 ["HowlingFjord"] = {70, 4, 6},
204 ["ScarletEnclave_Continent"] = {77, -77, 0}, ["ScarletEnclave"] = {78, -77, 1},
206 ["UtgardeKeep1_Continent"] = {79, -80, 0}, ["UtgardeKeep1"] = {80, -80, 1},
207 ["UtgardeKeep2_Continent"] = {81, -81, 0}, ["UtgardeKeep2"] = {82, -81, 1},
208 ["UtgardeKeep3_Continent"] = {83, -82, 0}, ["UtgardeKeep3"] = {84, -82, 1},
210 ["TheNexus_Continent"] = {85, -83, 0}, ["TheNexus"] = {86, -83, 1},
212 ["AzjolNerub1_Continent"] = {87, -84, 0}, ["AzjolNerub1"] = {88, -84, 1},
213 ["AzjolNerub2_Continent"] = {89, -85, 0}, ["AzjolNerub2"] = {90, -85, 1},
214 ["AzjolNerub3_Continent"] = {91, -86, 0}, ["AzjolNerub3"] = {92, -86, 1},
216 ["Ahnkahet_Continent"] = {93, -87, 0}, ["Ahnkahet"] = {94, -87, 1},
218 ["DrakTharonKeep1_Continent"] = {95, -88, 0}, ["DrakTharonKeep1"] = {96, -88, 1},
219 ["DrakTharonKeep2_Continent"] = {97, -89, 0}, ["DrakTharonKeep2"] = {98, -89, 1},
221 ["VioletHold_Continent"] = {99, -90, 0}, ["VioletHold"] = {100, -90, 1},
223 ["Gundrak_Continent"] = {101, -91, 0}, ["Gundrak"] = {102, -91, 1},
225 ["Ulduar77_Continent"] = {103, -92, 0}, ["Ulduar77"] = {104, -92, 1}, -- HoS
227 ["HallsofLightning1_Continent"] = {105, -93, 0}, ["HallsofLightning1"] = {106, -93, 1},
228 ["HallsofLightning2_Continent"] = {107, -94, 0}, ["HallsofLightning2"] = {108, -94, 1},
230 ["Nexus801_Continent"] = {109, -95, 0}, ["Nexus801"] = {110 , -95, 1},
231 ["Nexus802_Continent"] = {111, -96, 0}, ["Nexus802"] = {112, -96, 1},
232 ["Nexus803_Continent"] = {113, -97, 0}, ["Nexus803"] = {114, -97, 1},
233 ["Nexus804_Continent"] = {115, -98, 0}, ["Nexus804"] = {116, -98, 1},
235 ["CoTStratholme1_Continent"] = {117, -99, 0}, ["CoTStratholme1"] = {118, -99, 1},
236 ["CoTStratholme2_Continent"] = {119, -100, 0}, ["CoTStratholme2"] = {120, -100, 1},
238 ["UtgardePinnacle1_Continent"] = {121, -101, 0}, ["UtgardePinnacle1"] = {122, -101, 1},
239 ["UtgardePinnacle2_Continent"] = {123, -102, 0}, ["UtgardePinnacle2"] = {124, -102, 1},
241 ["VaultofArchavon_Continent"] = {125, -103, 0}, ["VaultofArchavon"] = {126, -103, 1},
243 ["Naxxramas1_Continent"] = {127, -104, 0}, ["Naxxramas1"] = {128, -104, 1},
244 ["Naxxramas2_Continent"] = {129, -105, 0}, ["Naxxramas2"] = {130, -105, 1},
245 ["Naxxramas3_Continent"] = {131, -106, 0}, ["Naxxramas3"] = {132, -106, 1},
246 ["Naxxramas4_Continent"] = {133, -107, 0}, ["Naxxramas4"] = {134, -107, 1},
247 ["Naxxramas5_Continent"] = {135, -108, 0}, ["Naxxramas5"] = {136, -108, 1},
248 ["Naxxramas6_Continent"] = {137, -109, 0}, ["Naxxramas6"] = {138, -109, 1},
250 ["TheObsidianSanctum_Continent"] = {139, -110, 0}, ["TheObsidianSanctum"] = {140, -110, 1},
252 ["TheEyeOfEternity_Continent"] = {141, -111, 0}, ["TheEyeOfEternity"] = {142, -111, 1},
254 ["Ulduar_Continent"] = {143, -112, 0}, ["Ulduar"] = {144, -112, 1},
255 ["Ulduar1_Continent"] = {145, -113, 0}, ["Ulduar1"] = {146, -113, 1},
256 ["Ulduar2_Continent"] = {147, -114, 0}, ["Ulduar2"] = {148, -114, 1},
257 ["Ulduar3_Continent"] = {149, -115, 0}, ["Ulduar3"] = {150, -115, 1},
258 ["Ulduar4_Continent"] = {151, -116, 0}, ["Ulduar4"] = {152, -116, 1},
260 -- yes virginia 152 is currently the end
263 if not QuestHelper
then QuestHelper
= {IsWrath32
= function() return true end} end -- narsty hack for my embedding code
266 if QuestHelper
:IsWrath32() then
267 QuestHelper_Zones
[4] = {[0]="Northrend",
269 [2]="Crystalsong Forest",
274 [7]="Hrothgar's Landing",
276 [9]="Sholazar Basin",
277 [10]="The Storm Peaks",
282 ["HrothgarsLanding"] = {153, 4, 7}, -- wooo consecutive numbering
283 ["IcecrownGlacier"] = {71, 4, 8},
284 ["SholazarBasin"] = {72, 4, 9},
285 ["TheStormPeaks"] = {73, 4, 10},
286 ["LakeWintergrasp"] = {74, 4, 11},
287 ["ZulDrak"] = {75, 4, 12},
289 for k
, v
in pairs(dt
) do
290 QuestHelper_IndexLookup
[k
] = v
293 QuestHelper_Zones
[4] = {[0]="Northrend",
295 [2]="Crystalsong Forest",
301 [8]="Sholazar Basin",
302 [9]="The Storm Peaks",
307 ["IcecrownGlacier"] = {71, 4, 7},
308 ["SholazarBasin"] = {72, 4, 8},
309 ["TheStormPeaks"] = {73, 4, 9},
310 ["LakeWintergrasp"] = {74, 4, 10},
311 ["ZulDrak"] = {75, 4, 11},
313 for k
, v
in pairs(dt
) do
314 QuestHelper_IndexLookup
[k
] = v
318 QuestHelper_RestrictedZones
= { -- Everything defaults to "nil"
323 for i
, j
in pairs(QuestHelper_IndexLookup
) do next_index
= math
.max(next_index
, j
[1]+1) end
325 -- Maps zone names and indexes to a two element array, containing zone index a continent/zone
326 QuestHelper_ZoneLookup
= {}
328 -- Maps indexes to zone names.
329 QuestHelper_NameLookup
= {}
331 -- Maps plane indexes to the ultimate continent parents
332 QuestHelper_ParentLookup
= {}
336 function QuestHelper_BuildZoneLookup()
337 if built
then return end
340 if GetMapContinents
and GetMapZones
then
341 -- Called from inside the WoW client.
343 local original_lookup
, original_zones
= QuestHelper_IndexLookup
, QuestHelper_Zones
344 QuestHelper_IndexLookup
= {}
345 QuestHelper_Zones
= {}
347 for c
, cname
in pairs(QuestHelper
.Astrolabe
:GetMapVirtualContinents()) do
348 QuestHelper_Zones
[c
] = {}
349 local tpx
= QuestHelper
.Astrolabe
:GetMapVirtualZones(c
)
351 for z
, zname
in pairs(tpx
) do
353 local base_name
= QuestHelper
.Astrolabe
:GetMapTexture(c
, z
)
355 local index
= original_lookup
[base_name
] and original_lookup
[base_name
][1]
357 local altered_index
= "!!! QuestHelper_IndexLookup entry needs update: [%q] = {%s, %s, %s}"
358 local altered_zone
= "!!! QuestHelper_Zones entry needs update: [%s][%s] = %q -- was %s"
361 QuestHelper
:TextOut(altered_index
:format(tostring(base_name
), tostring(next_index
), tostring(c
), tostring(z
)))
362 next_index
= next_index
+ 1
364 if QuestHelper_Locale
== "enUS" then
365 if original_lookup
[base_name
][2] ~= c
or original_lookup
[base_name
][3] ~= z
then
366 QuestHelper
:TextOut(altered_index
:format(base_name
, index
, c
, z
))
369 if not original_zones
[c
] or original_zones
[c
][z
] ~= zname
then
370 QuestHelper
:TextOut(altered_zone
:format(c
, z
, zname
, original_zones
[c
] and original_zones
[c
][z
] or "missing"))
375 if not QuestHelper_IndexLookup
[c
] then QuestHelper_IndexLookup
[c
] = {} end
376 QuestHelper_IndexLookup
[c
][z
] = index
377 QuestHelper_IndexLookup
[zname
] = index
379 QuestHelper_NameLookup
[index
] = zname
381 QuestHelper_ZoneLookup
[zname
] = pair
382 QuestHelper_ZoneLookup
[index
] = pair
384 QuestHelper_Zones
[c
][z
] = zname
389 for name
, index
in pairs(original_lookup
) do
390 if index
[2] == -1 then
391 assert(not QuestHelper_IndexLookup
[name
])
392 QuestHelper_IndexLookup
[name
] = index
[1]
396 for k
, v
in pairs(QuestHelper_ZoneLookup
) do
397 if type(k
) == "number" then
398 if v
[1] == 1 or v
[1] == 2 or v
[1] == 4 then -- weh
399 QuestHelper_ParentLookup
[k
] = 0
401 QuestHelper_ParentLookup
[k
] = v
[1]
406 -- Called from some lua script.
407 local original_lookup
= QuestHelper_IndexLookup
408 QuestHelper_IndexLookup
= {}
410 for base_name
, i
in pairs(original_lookup
) do
412 local pair
= {i
[2], i
[3]}
413 local name
= QuestHelper_Zones
[pair
[1]]
[pair
[2]]
415 assert(index
and name
)
417 if not QuestHelper_IndexLookup
[pair
[1]]
then QuestHelper_IndexLookup
[pair
[1]]
= {} end
418 QuestHelper_IndexLookup
[pair
[1]]
[pair
[2]]
= index
419 QuestHelper_IndexLookup
[name
] = index
421 QuestHelper_NameLookup
[index
] = name
423 QuestHelper_ZoneLookup
[name
] = pair
424 QuestHelper_ZoneLookup
[index
] = pair
429 local convert_lookup
=
430 {{2, 15, 3, 9, 16, 21, 4, 7, 10, 13, 17, 20, 22, 1, 5, 6, 8, 24, 11, 12, 14, 23, 18, 19},
431 {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},
432 {54, 56, 58, 59, 53, 60, 55, 57}}
434 function QuestHelper_ValidPosition(c
, z
, x
, y
)
435 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
438 function QuestHelper_PrunePositionList(list
)
439 if type(list
) ~= "table" then
446 if QuestHelper_ValidPosition(unpack(list
[i
])) and type(pos
[5]) == "number" and pos
[5] >= 1 then
449 local rem
= table.remove(list
, i
)
453 return #list
> 0 and list
or nil
456 local function QuestHelper_ConvertPosition(pos
)
457 pos
[2] = convert_lookup
[pos
[1]]
[pos
[2]]
461 local function QuestHelper_ConvertPositionList(list
)
463 for i
, pos
in pairs(list
) do
464 QuestHelper_ConvertPosition(pos
)
469 local function QuestHelper_ConvertFaction(faction
)
470 if faction
== 1 or faction
== "Alliance" or faction
== FACTION_ALLIANCE
then return 1
471 elseif faction
== 2 or faction
== "Horde" or faction
== FACTION_HORDE
then return 2
473 assert(false, "Unknown faction: "..faction
.."'")
477 function QuestHelper_UpgradeDatabase(data
)
478 if data
.QuestHelper_SaveVersion
== 1 then
480 -- Reputation objectives weren't parsed correctly before.
481 if data
.QuestHelper_Objectives
["reputation"] then
482 for faction
, objective
in pairs(data
.QuestHelper_Objectives
["reputation"]) do
483 local real_faction
= string.find(faction
, "%s*(.+)%s*:%s*") or faction
484 if faction
~= real_faction
then
485 data
.QuestHelper_Objectives
["reputation"][real_faction
] = data
.QuestHelper_Objectives
["reputation"][faction
]
486 data
.QuestHelper_Objectives
["reputation"][faction
] = nil
491 -- Items that wern't in the local cache when I read the quest log ended up with empty names.
492 if data
.QuestHelper_Objectives
["item"] then
493 data
.QuestHelper_Objectives
["item"][" "] = nil
496 data
.QuestHelper_SaveVersion
= 2
499 if data
.QuestHelper_SaveVersion
== 2 then
501 -- The hashes for the quests were wrong. Damnit!
502 for faction
, level_list
in pairs(data
.QuestHelper_Quests
) do
503 for level
, quest_list
in pairs(level_list
) do
504 for quest_name
, quest_data
in pairs(quest_list
) do
505 quest_data
.hash
= nil
511 -- None of the information I collected about quest items previously can be trusted.
512 -- I also didn't properly mark quest items as such, so I'll have to remove the information for non
515 if data
.QuestHelper_Objectives
["item"] then
516 for item
, item_data
in pairs(data
.QuestHelper_Objectives
["item"]) do
517 -- I'll remerge the bad data later if I find out its not used solely for quests.
518 item_data
.bad_pos
= item_data
.bad_pos
or item_data
.pos
519 item_data
.bad_drop
= item_data
.bad_drop
or item_data
.drop
523 -- In the future i'll delete the bad_x data.
524 -- When I do, either just delete it, or of all the monsters or positions match the monsters and positions of the
525 -- quest, merge them into that.
529 data
.QuestHelper_SaveVersion
= 3
532 if data
.QuestHelper_SaveVersion
== 3 then
533 -- We'll go through this and make sure all the position lists are correct.
534 for faction
, level_list
in pairs(data
.QuestHelper_Quests
) do
535 for level
, quest_list
in pairs(level_list
) do
536 for quest_name
, quest_data
in pairs(quest_list
) do
537 quest_data
.pos
= QuestHelper_PrunePositionList(quest_data
.pos
)
538 if quest_data
.item
then for name
, data
in pairs(quest_data
.item
) do
539 data
.pos
= QuestHelper_PrunePositionList(data
.pos
)
541 if quest_data
.alt
then for hash
, data
in pairs(quest_data
.alt
) do
542 data
.pos
= QuestHelper_PrunePositionList(data
.pos
)
543 if data
.item
then for name
, data
in pairs(data
.item
) do
544 data
.pos
= QuestHelper_PrunePositionList(data
.pos
)
551 for cat
, list
in pairs(data
.QuestHelper_Objectives
) do
552 for name
, data
in pairs(list
) do
553 data
.pos
= QuestHelper_PrunePositionList(data
.pos
)
557 if data
.QuestHelper_ZoneTransition
then
558 for c
, z1list
in pairs(data
.QuestHelper_ZoneTransition
) do
559 for z1
, z2list
in pairs(z1list
) do
560 for z2
, poslist
in pairs(z2list
) do
561 z2list
[z2
] = QuestHelper_PrunePositionList(poslist
)
567 data
.QuestHelper_SaveVersion
= 4
570 if data
.QuestHelper_SaveVersion
== 4 then
571 -- Zone transitions have been obsoleted by a bug.
572 data
.QuestHelper_ZoneTransition
= nil
573 data
.QuestHelper_SaveVersion
= 5
576 if data
.QuestHelper_SaveVersion
== 5 then
577 -- For version 6, I'm converting area positions from a continent/zone index pair to a single index.
579 if data
.QuestHelper_FlightRoutes
then
580 local old_routes
= data
.QuestHelper_FlightRoutes
581 data
.QuestHelper_FlightRoutes
= {}
582 for c
, value
in pairs(old_routes
) do
583 data
.QuestHelper_FlightRoutes
[QuestHelper_IndexLookup
[c
][0]]
= value
587 for faction
, level_list
in pairs(data
.QuestHelper_Quests
) do
588 for level
, quest_list
in pairs(level_list
) do
589 for quest_name
, quest_data
in pairs(quest_list
) do
590 QuestHelper_ConvertPositionList(quest_data
.pos
)
591 if quest_data
.item
then for name
, data
in pairs(quest_data
.item
) do
592 QuestHelper_ConvertPositionList(data
.pos
)
594 if quest_data
.alt
then for hash
, data
in pairs(quest_data
.alt
) do
595 QuestHelper_ConvertPositionList(data
.pos
)
596 if data
.item
then for name
, data
in pairs(data
.item
) do
597 QuestHelper_ConvertPositionList(data
.pos
)
604 for cat
, list
in pairs(data
.QuestHelper_Objectives
) do
605 for name
, data
in pairs(list
) do
606 QuestHelper_ConvertPositionList(data
.pos
)
610 data
.QuestHelper_SaveVersion
= 6
613 if data
.QuestHelper_SaveVersion
== 6 then
614 -- Redoing how flightpaths work, previously collected flightpath data is now obsolete.
615 data
.QuestHelper_FlightRoutes
= {}
617 -- FlightInstructors table should be fine, will leave it.
618 -- Upgrading per-character data is handled in main.lua.
620 -- Also converting factions to numbers, 1 for Alliance, 2 for Horde.
621 local replacement
= {}
622 for faction
, dat
in pairs(data
.QuestHelper_Quests
) do
623 replacement
[QuestHelper_ConvertFaction(faction
)] = dat
625 data
.QuestHelper_Quests
= replacement
628 if data
.QuestHelper_FlightInstructors
then for faction
, dat
in pairs(data
.QuestHelper_FlightInstructors
) do
629 replacement
[QuestHelper_ConvertFaction(faction
)] = dat
631 data
.QuestHelper_FlightInstructors
= replacement
633 for cat
, list
in pairs(data
.QuestHelper_Objectives
) do
634 for name
, obj
in pairs(list
) do
636 obj
.faction
= QuestHelper_ConvertFaction(obj
.faction
)
641 data
.QuestHelper_SaveVersion
= 7
644 if data
.QuestHelper_SaveVersion
== 7 then
645 -- It sure took me long enough to discover that I broke vendor objectives.
646 -- their factions were strings and didn't match the number value of QuestHelper.faction
648 for cat
, list
in pairs(data
.QuestHelper_Objectives
) do
649 for name
, obj
in pairs(list
) do
650 if type(obj
.faction
) == "string" then
651 obj
.faction
= (obj
.faction
== "Alliance" and 1) or (obj
.faction
== "Horde" and 2) or nil
656 data
.QuestHelper_SaveVersion
= 8
659 if data
.QuestHelper_SaveVersion
== 8 then
660 -- Two things we're doing here
661 -- First, wrath-ize Stormwind coordinates
664 for cat, list in pairs(QuestHelper_Objectives) do
665 for name, obj in pairs(list) do
667 for i, cpos in pairs(obj.pos) do
668 QuestHelper_ConvertCoordsToWrath(cpos, true)
672 end]] -- okay we're not actually doing this, coordinates are staying native
674 -- Second, split up the entire thing into versions
675 local function versionize(item
)
676 --if not item or type(item) ~= "table" then return end -- blue magician doesn't know what the fuck
679 local foundthings
= false
680 for k
, v
in pairs(item
) do
684 if not foundthings
then return end -- just to avoid extra keys hanging around in people's tables
686 for key
in pairs(item
) do
690 item
["unknown on unknown"] = temp
693 versionize(data
.QuestHelper_Quests
)
694 versionize(data
.QuestHelper_Objectives
)
695 versionize(data
.QuestHelper_FlightInstructors
)
696 versionize(data
.QuestHelper_FlightRoutes
)
698 data
.QuestHelper_SaveVersion
= 9
701 if data
.QuestHelper_SaveVersion
== 9 then
702 -- The only thing we're doing here is moving the QuestHelper_ErrorList into QuestHelper_Errors
703 data
.QuestHelper_Errors
= {}
704 data
.QuestHelper_Errors
.crashes
= {}
706 if data
.QuestHelper_ErrorList
then
707 for k
, v
in pairs(data
.QuestHelper_ErrorList
) do
708 data
.QuestHelper_Errors
.crashes
[k
] = v
712 data
.QuestHelper_ErrorList
= nil
714 data
.QuestHelper_SaveVersion
= 10
718 function QuestHelper_UpgradeComplete()
719 -- This function deletes everything related to upgrading, as it isn't going to be needed again.
723 QuestHelper_BuildZoneLookup
= nil
724 QuestHelper_ValidPosition
= nil
725 QuestHelper_PrunePositionList
= nil
726 QuestHelper_ConvertPosition
= nil
727 QuestHelper_ConvertPositionList
= nil
728 QuestHelper_ConvertFaction
= nil
729 QuestHelper_UpgradeDatabase
= nil
730 QuestHelper_UpgradeComplete
= nil
733 -- 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".
734 -- Both changes the data in-place and returns the data.
735 function QuestHelper_ConvertCoordsToWrath(data
, force
)
737 if data
[1] == 36 then -- Stormwind
738 data
[2] = data
[2] * 0.77324 + 0.197
739 data
[3] = data
[3] * 0.77324 + 0.245
740 elseif data
[1] == 34 then -- EPL
741 data
[2] = data
[2] * 0.960 - 0.0254
742 data
[3] = data
[3] * 0.960 - 0.03532
748 function QuestHelper_ConvertCoordsFromWrath(data
, force
)
750 if data
[1] == 36 then -- Stormwind
751 data
[2] = (data
[2] - 0.197) / 0.77324
752 data
[3] = (data
[3] - 0.245) / 0.77324
753 elseif data
[1] == 34 then -- EPL
754 data
[2] = (data
[2] + 0.0254) / 0.960
755 data
[3] = (data
[3] + 0.03532) / 0.960
761 local QuestHelper_PrivateServerBlacklist_Find
= {
768 local QuestHelper_PrivateServerBlacklist_Exact
= {
772 "Columbian Drug Dealer",
773 "PlayBoy Fun Vendor",
775 "Accessories Vendor",
776 "General Goods Vendor",
786 "Fooooood and Drinks!",
787 "I Sell Consumables",
790 "Bobby", -- I have no idea if this is an actual private server NPC
793 "Warrior Set Vendor",
795 "Warlock Set Vendor",
796 "Paladin Set Vendor",
798 "Mage Set Vendor", -- yeah yeah this isn't everyone whatever
801 local matchstring
= nil
803 function QuestHelper_IsPolluted(input
)
804 if not input
then input
= _G
end
806 for version
, data
in pairs(input
.QuestHelper_Objectives
) do
807 for cat
, name_list
in pairs(data
) do
808 for name
, obj
in pairs(name_list
) do
809 for k
, v
in pairs(QuestHelper_PrivateServerBlacklist_Find
) do
810 if string.find(name
, v
) then
811 for _
, __
in pairs(obj
) do
812 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.
816 for k
, v
in pairs(QuestHelper_PrivateServerBlacklist_Exact
) do
818 for _
, __
in pairs(obj
) do
819 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.