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
264 if QuestHelper
:IsWrath32() then
265 QuestHelper_Zones
[4] = {[0]="Northrend",
267 [2]="Crystalsong Forest",
272 [7]="Hrothgar's Landing",
274 [9]="Sholazar Basin",
275 [10]="The Storm Peaks",
280 ["HrothgarsLanding"] = {153, 4, 7}, -- wooo consecutive numbering
281 ["IcecrownGlacier"] = {71, 4, 8},
282 ["SholazarBasin"] = {72, 4, 9},
283 ["TheStormPeaks"] = {73, 4, 10},
284 ["LakeWintergrasp"] = {74, 4, 11},
285 ["ZulDrak"] = {75, 4, 12},
287 for k
, v
in pairs(dt
) do
288 QuestHelper_IndexLookup
[k
] = v
291 QuestHelper_Zones
[4] = {[0]="Northrend",
293 [2]="Crystalsong Forest",
299 [8]="Sholazar Basin",
300 [9]="The Storm Peaks",
305 ["IcecrownGlacier"] = {71, 4, 7},
306 ["SholazarBasin"] = {72, 4, 8},
307 ["TheStormPeaks"] = {73, 4, 9},
308 ["LakeWintergrasp"] = {74, 4, 10},
309 ["ZulDrak"] = {75, 4, 11},
311 for k
, v
in pairs(dt
) do
312 QuestHelper_IndexLookup
[k
] = v
316 QuestHelper_RestrictedZones
= { -- Everything defaults to "nil"
321 for i
, j
in pairs(QuestHelper_IndexLookup
) do next_index
= math
.max(next_index
, j
[1]+1) end
323 -- Maps zone names and indexes to a two element array, containing zone index a continent/zone
324 QuestHelper_ZoneLookup
= {}
326 -- Maps indexes to zone names.
327 QuestHelper_NameLookup
= {}
329 -- Maps plane indexes to the ultimate continent parents
330 QuestHelper_ParentLookup
= {}
334 function QuestHelper_BuildZoneLookup()
335 if built
then return end
338 if GetMapContinents
and GetMapZones
then
339 -- Called from inside the WoW client.
341 local original_lookup
, original_zones
= QuestHelper_IndexLookup
, QuestHelper_Zones
342 QuestHelper_IndexLookup
= {}
343 QuestHelper_Zones
= {}
345 for c
, cname
in pairs(QuestHelper
.Astrolabe
:GetMapVirtualContinents()) do
346 QuestHelper_Zones
[c
] = {}
347 local tpx
= QuestHelper
.Astrolabe
:GetMapVirtualZones(c
)
349 for z
, zname
in pairs(tpx
) do
351 local base_name
= QuestHelper
.Astrolabe
:GetMapTexture(c
, z
)
353 local index
= original_lookup
[base_name
] and original_lookup
[base_name
][1]
355 local altered_index
= "!!! QuestHelper_IndexLookup entry needs update: [%q] = {%s, %s, %s}"
356 local altered_zone
= "!!! QuestHelper_Zones entry needs update: [%s][%s] = %q -- was %s"
359 QuestHelper
:TextOut(altered_index
:format(tostring(base_name
), tostring(next_index
), tostring(c
), tostring(z
)))
360 next_index
= next_index
+ 1
362 if QuestHelper_Locale
== "enUS" then
363 if original_lookup
[base_name
][2] ~= c
or original_lookup
[base_name
][3] ~= z
then
364 QuestHelper
:TextOut(altered_index
:format(base_name
, index
, c
, z
))
367 if not original_zones
[c
] or original_zones
[c
][z
] ~= zname
then
368 QuestHelper
:TextOut(altered_zone
:format(c
, z
, zname
, original_zones
[c
] and original_zones
[c
][z
] or "missing"))
373 if not QuestHelper_IndexLookup
[c
] then QuestHelper_IndexLookup
[c
] = {} end
374 QuestHelper_IndexLookup
[c
][z
] = index
375 QuestHelper_IndexLookup
[zname
] = index
377 QuestHelper_NameLookup
[index
] = zname
379 QuestHelper_ZoneLookup
[zname
] = pair
380 QuestHelper_ZoneLookup
[index
] = pair
382 QuestHelper_Zones
[c
][z
] = zname
387 for name
, index
in pairs(original_lookup
) do
388 if index
[2] == -1 then
389 assert(not QuestHelper_IndexLookup
[name
])
390 QuestHelper_IndexLookup
[name
] = index
[1]
394 for k
, v
in pairs(QuestHelper_ZoneLookup
) do
395 if type(k
) == "number" then
396 if v
[1] == 1 or v
[1] == 2 or v
[1] == 4 then -- weh
397 QuestHelper_ParentLookup
[k
] = 0
399 QuestHelper_ParentLookup
[k
] = v
[1]
404 -- Called from some lua script.
405 local original_lookup
= QuestHelper_IndexLookup
406 QuestHelper_IndexLookup
= {}
408 for base_name
, i
in pairs(original_lookup
) do
410 local pair
= {i
[2], i
[3]}
411 local name
= QuestHelper_Zones
[pair
[1]]
[pair
[2]]
413 assert(index
and name
)
415 if not QuestHelper_IndexLookup
[pair
[1]]
then QuestHelper_IndexLookup
[pair
[1]]
= {} end
416 QuestHelper_IndexLookup
[pair
[1]]
[pair
[2]]
= index
417 QuestHelper_IndexLookup
[name
] = index
419 QuestHelper_NameLookup
[index
] = name
421 QuestHelper_ZoneLookup
[name
] = pair
422 QuestHelper_ZoneLookup
[index
] = pair
427 local convert_lookup
=
428 {{2, 15, 3, 9, 16, 21, 4, 7, 10, 13, 17, 20, 22, 1, 5, 6, 8, 24, 11, 12, 14, 23, 18, 19},
429 {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},
430 {54, 56, 58, 59, 53, 60, 55, 57}}
432 function QuestHelper_ValidPosition(c
, z
, x
, y
)
433 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
436 function QuestHelper_PrunePositionList(list
)
437 if type(list
) ~= "table" then
444 if QuestHelper_ValidPosition(unpack(list
[i
])) and type(pos
[5]) == "number" and pos
[5] >= 1 then
447 local rem
= table.remove(list
, i
)
451 return #list
> 0 and list
or nil
454 local function QuestHelper_ConvertPosition(pos
)
455 pos
[2] = convert_lookup
[pos
[1]]
[pos
[2]]
459 local function QuestHelper_ConvertPositionList(list
)
461 for i
, pos
in pairs(list
) do
462 QuestHelper_ConvertPosition(pos
)
467 local function QuestHelper_ConvertFaction(faction
)
468 if faction
== 1 or faction
== "Alliance" or faction
== FACTION_ALLIANCE
then return 1
469 elseif faction
== 2 or faction
== "Horde" or faction
== FACTION_HORDE
then return 2
471 assert(false, "Unknown faction: "..faction
.."'")
475 function QuestHelper_UpgradeDatabase(data
)
476 if data
.QuestHelper_SaveVersion
== 1 then
478 -- Reputation objectives weren't parsed correctly before.
479 if data
.QuestHelper_Objectives
["reputation"] then
480 for faction
, objective
in pairs(data
.QuestHelper_Objectives
["reputation"]) do
481 local real_faction
= string.find(faction
, "%s*(.+)%s*:%s*") or faction
482 if faction
~= real_faction
then
483 data
.QuestHelper_Objectives
["reputation"][real_faction
] = data
.QuestHelper_Objectives
["reputation"][faction
]
484 data
.QuestHelper_Objectives
["reputation"][faction
] = nil
489 -- Items that wern't in the local cache when I read the quest log ended up with empty names.
490 if data
.QuestHelper_Objectives
["item"] then
491 data
.QuestHelper_Objectives
["item"][" "] = nil
494 data
.QuestHelper_SaveVersion
= 2
497 if data
.QuestHelper_SaveVersion
== 2 then
499 -- The hashes for the quests were wrong. Damnit!
500 for faction
, level_list
in pairs(data
.QuestHelper_Quests
) do
501 for level
, quest_list
in pairs(level_list
) do
502 for quest_name
, quest_data
in pairs(quest_list
) do
503 quest_data
.hash
= nil
509 -- None of the information I collected about quest items previously can be trusted.
510 -- I also didn't properly mark quest items as such, so I'll have to remove the information for non
513 if data
.QuestHelper_Objectives
["item"] then
514 for item
, item_data
in pairs(data
.QuestHelper_Objectives
["item"]) do
515 -- I'll remerge the bad data later if I find out its not used solely for quests.
516 item_data
.bad_pos
= item_data
.bad_pos
or item_data
.pos
517 item_data
.bad_drop
= item_data
.bad_drop
or item_data
.drop
521 -- In the future i'll delete the bad_x data.
522 -- When I do, either just delete it, or of all the monsters or positions match the monsters and positions of the
523 -- quest, merge them into that.
527 data
.QuestHelper_SaveVersion
= 3
530 if data
.QuestHelper_SaveVersion
== 3 then
531 -- We'll go through this and make sure all the position lists are correct.
532 for faction
, level_list
in pairs(data
.QuestHelper_Quests
) do
533 for level
, quest_list
in pairs(level_list
) do
534 for quest_name
, quest_data
in pairs(quest_list
) do
535 quest_data
.pos
= QuestHelper_PrunePositionList(quest_data
.pos
)
536 if quest_data
.item
then for name
, data
in pairs(quest_data
.item
) do
537 data
.pos
= QuestHelper_PrunePositionList(data
.pos
)
539 if quest_data
.alt
then for hash
, data
in pairs(quest_data
.alt
) do
540 data
.pos
= QuestHelper_PrunePositionList(data
.pos
)
541 if data
.item
then for name
, data
in pairs(data
.item
) do
542 data
.pos
= QuestHelper_PrunePositionList(data
.pos
)
549 for cat
, list
in pairs(data
.QuestHelper_Objectives
) do
550 for name
, data
in pairs(list
) do
551 data
.pos
= QuestHelper_PrunePositionList(data
.pos
)
555 if data
.QuestHelper_ZoneTransition
then
556 for c
, z1list
in pairs(data
.QuestHelper_ZoneTransition
) do
557 for z1
, z2list
in pairs(z1list
) do
558 for z2
, poslist
in pairs(z2list
) do
559 z2list
[z2
] = QuestHelper_PrunePositionList(poslist
)
565 data
.QuestHelper_SaveVersion
= 4
568 if data
.QuestHelper_SaveVersion
== 4 then
569 -- Zone transitions have been obsoleted by a bug.
570 data
.QuestHelper_ZoneTransition
= nil
571 data
.QuestHelper_SaveVersion
= 5
574 if data
.QuestHelper_SaveVersion
== 5 then
575 -- For version 6, I'm converting area positions from a continent/zone index pair to a single index.
577 if data
.QuestHelper_FlightRoutes
then
578 local old_routes
= data
.QuestHelper_FlightRoutes
579 data
.QuestHelper_FlightRoutes
= {}
580 for c
, value
in pairs(old_routes
) do
581 data
.QuestHelper_FlightRoutes
[QuestHelper_IndexLookup
[c
][0]]
= value
585 for faction
, level_list
in pairs(data
.QuestHelper_Quests
) do
586 for level
, quest_list
in pairs(level_list
) do
587 for quest_name
, quest_data
in pairs(quest_list
) do
588 QuestHelper_ConvertPositionList(quest_data
.pos
)
589 if quest_data
.item
then for name
, data
in pairs(quest_data
.item
) do
590 QuestHelper_ConvertPositionList(data
.pos
)
592 if quest_data
.alt
then for hash
, data
in pairs(quest_data
.alt
) do
593 QuestHelper_ConvertPositionList(data
.pos
)
594 if data
.item
then for name
, data
in pairs(data
.item
) do
595 QuestHelper_ConvertPositionList(data
.pos
)
602 for cat
, list
in pairs(data
.QuestHelper_Objectives
) do
603 for name
, data
in pairs(list
) do
604 QuestHelper_ConvertPositionList(data
.pos
)
608 data
.QuestHelper_SaveVersion
= 6
611 if data
.QuestHelper_SaveVersion
== 6 then
612 -- Redoing how flightpaths work, previously collected flightpath data is now obsolete.
613 data
.QuestHelper_FlightRoutes
= {}
615 -- FlightInstructors table should be fine, will leave it.
616 -- Upgrading per-character data is handled in main.lua.
618 -- Also converting factions to numbers, 1 for Alliance, 2 for Horde.
619 local replacement
= {}
620 for faction
, dat
in pairs(data
.QuestHelper_Quests
) do
621 replacement
[QuestHelper_ConvertFaction(faction
)] = dat
623 data
.QuestHelper_Quests
= replacement
626 if data
.QuestHelper_FlightInstructors
then for faction
, dat
in pairs(data
.QuestHelper_FlightInstructors
) do
627 replacement
[QuestHelper_ConvertFaction(faction
)] = dat
629 data
.QuestHelper_FlightInstructors
= replacement
631 for cat
, list
in pairs(data
.QuestHelper_Objectives
) do
632 for name
, obj
in pairs(list
) do
634 obj
.faction
= QuestHelper_ConvertFaction(obj
.faction
)
639 data
.QuestHelper_SaveVersion
= 7
642 if data
.QuestHelper_SaveVersion
== 7 then
643 -- It sure took me long enough to discover that I broke vendor objectives.
644 -- their factions were strings and didn't match the number value of QuestHelper.faction
646 for cat
, list
in pairs(data
.QuestHelper_Objectives
) do
647 for name
, obj
in pairs(list
) do
648 if type(obj
.faction
) == "string" then
649 obj
.faction
= (obj
.faction
== "Alliance" and 1) or (obj
.faction
== "Horde" and 2) or nil
654 data
.QuestHelper_SaveVersion
= 8
657 if data
.QuestHelper_SaveVersion
== 8 then
658 -- Two things we're doing here
659 -- First, wrath-ize Stormwind coordinates
662 for cat, list in pairs(QuestHelper_Objectives) do
663 for name, obj in pairs(list) do
665 for i, cpos in pairs(obj.pos) do
666 QuestHelper_ConvertCoordsToWrath(cpos, true)
670 end]] -- okay we're not actually doing this, coordinates are staying native
672 -- Second, split up the entire thing into versions
673 local function versionize(item
)
674 --if not item or type(item) ~= "table" then return end -- blue magician doesn't know what the fuck
677 local foundthings
= false
678 for k
, v
in pairs(item
) do
682 if not foundthings
then return end -- just to avoid extra keys hanging around in people's tables
684 for key
in pairs(item
) do
688 item
["unknown on unknown"] = temp
691 versionize(data
.QuestHelper_Quests
)
692 versionize(data
.QuestHelper_Objectives
)
693 versionize(data
.QuestHelper_FlightInstructors
)
694 versionize(data
.QuestHelper_FlightRoutes
)
696 data
.QuestHelper_SaveVersion
= 9
699 if data
.QuestHelper_SaveVersion
== 9 then
700 -- The only thing we're doing here is moving the QuestHelper_ErrorList into QuestHelper_Errors
701 data
.QuestHelper_Errors
= {}
702 data
.QuestHelper_Errors
.crashes
= {}
704 if data
.QuestHelper_ErrorList
then
705 for k
, v
in pairs(data
.QuestHelper_ErrorList
) do
706 data
.QuestHelper_Errors
.crashes
[k
] = v
710 data
.QuestHelper_ErrorList
= nil
712 data
.QuestHelper_SaveVersion
= 10
716 function QuestHelper_UpgradeComplete()
717 -- This function deletes everything related to upgrading, as it isn't going to be needed again.
721 QuestHelper_BuildZoneLookup
= nil
722 QuestHelper_ValidPosition
= nil
723 QuestHelper_PrunePositionList
= nil
724 QuestHelper_ConvertPosition
= nil
725 QuestHelper_ConvertPositionList
= nil
726 QuestHelper_ConvertFaction
= nil
727 QuestHelper_UpgradeDatabase
= nil
728 QuestHelper_UpgradeComplete
= nil
731 -- 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".
732 -- Both changes the data in-place and returns the data.
733 function QuestHelper_ConvertCoordsToWrath(data
, force
)
735 if data
[1] == 36 then -- Stormwind
736 data
[2] = data
[2] * 0.77324 + 0.197
737 data
[3] = data
[3] * 0.77324 + 0.245
738 elseif data
[1] == 34 then -- EPL
739 data
[2] = data
[2] * 0.960 - 0.0254
740 data
[3] = data
[3] * 0.960 - 0.03532
746 function QuestHelper_ConvertCoordsFromWrath(data
, force
)
748 if data
[1] == 36 then -- Stormwind
749 data
[2] = (data
[2] - 0.197) / 0.77324
750 data
[3] = (data
[3] - 0.245) / 0.77324
751 elseif data
[1] == 34 then -- EPL
752 data
[2] = (data
[2] + 0.0254) / 0.960
753 data
[3] = (data
[3] + 0.03532) / 0.960
759 local QuestHelper_PrivateServerBlacklist_Find
= {
766 local QuestHelper_PrivateServerBlacklist_Exact
= {
770 "Columbian Drug Dealer",
771 "PlayBoy Fun Vendor",
773 "Accessories Vendor",
774 "General Goods Vendor",
784 "Fooooood and Drinks!",
785 "I Sell Consumables",
788 "Bobby", -- I have no idea if this is an actual private server NPC
791 "Warrior Set Vendor",
793 "Warlock Set Vendor",
794 "Paladin Set Vendor",
796 "Mage Set Vendor", -- yeah yeah this isn't everyone whatever
799 local matchstring
= nil
801 function QuestHelper_IsPolluted(input
)
802 if not input
then input
= _G
end
804 for version
, data
in pairs(input
.QuestHelper_Objectives
) do
805 for cat
, name_list
in pairs(data
) do
806 for name
, obj
in pairs(name_list
) do
807 for k
, v
in pairs(QuestHelper_PrivateServerBlacklist_Find
) do
808 if string.find(name
, v
) then
809 for _
, __
in pairs(obj
) do
810 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.
814 for k
, v
in pairs(QuestHelper_PrivateServerBlacklist_Exact
) do
816 for _
, __
in pairs(obj
) do
817 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.