From c77bc5fc31535f35e7fdadc8f67074aa7f0a1664 Mon Sep 17 00:00:00 2001 From: "Nathanial.C.Jones" Date: Wed, 8 Feb 2012 03:41:53 +0000 Subject: [PATCH] Some more changes for using the WoW quest tracking API. Removed the ugly database hacks, they are not necessary with the planes set to be the map ID's and no calls going out to the built in database. Fixed the elders in Stranglethorn. --- QuestHelper/custom.lua | 4 +-- QuestHelper/db_get.lua | 37 ++++++++++++++++------------ QuestHelper/director_achievement.lua | 8 ------ QuestHelper/director_find.lua | 12 ++------- QuestHelper/director_quest.lua | 17 ++----------- QuestHelper/graph_core.lua | 9 ------- QuestHelper/routing_core.lua | 4 --- 7 files changed, 27 insertions(+), 64 deletions(-) diff --git a/QuestHelper/custom.lua b/QuestHelper/custom.lua index 0424610..06296a2 100644 --- a/QuestHelper/custom.lua +++ b/QuestHelper/custom.lua @@ -308,8 +308,8 @@ local elders = { ["Silvervein"] = "Loch Modan 33 46", ["Ironband"] = "Searing Gorge 21 79", ["Obsidian"] = "Silverpine Forest 45 41", - ["Starglade"] = "Stranglethorn Vale 63 22", -- Jungle 71 34 - ["Winterhoof"] = "Stranglethorn Vale 37 79", -- Cape 39 72 + ["Starglade"] = "Northern Stranglethorn 71 34", + ["Winterhoof"] = "The Cape of Stranglethorn 39 72", -- Cape 39 72 ["Graveborn"] = "Tirisfal Glades 61 53", ["Moonstrike"] = "Western Plaguelands 69 73", ["Meadowrun"] = "Western Plaguelands 63 36", diff --git a/QuestHelper/db_get.lua b/QuestHelper/db_get.lua index a7a48c1..cc9b3b9 100644 --- a/QuestHelper/db_get.lua +++ b/QuestHelper/db_get.lua @@ -165,16 +165,24 @@ local function GetZonePOIs(c, z) isComplete = true end local poi = {} - poi.questLogIndex = questLogIndex - poi.questId = questId - poi.title = questTitle - poi.c = c - poi.z = z - poi.x = x - poi.y = y - poi.p = mapID - poi.completed = isComplete - pois[count] = poi + if pois[questId] then poi = pois[questId] + else pois[questId] = poi end + + if not poi.questLogIndex then + poi.questLogIndex = questLogIndex + poi.questId = questId + poi.name = questTitle + poi.criteria = {} + poi.criteria.loc = {} + end + + local loc = {} + loc.c = c + loc.x = x + loc.y = y + loc.p = mapID + loc.completed = isComplete + poi.criteria.loc:insert(loc) count = count+1 hasQuests = true end @@ -194,6 +202,7 @@ function DB_GetItem(group, id, silent, register) -- Loop over zones AND floors -- see QuestRouterLite.lua for specific calls. -- In the end, the item returned MUST be "formatted" the same as a true QHDB item. + ite = {} local origC = GetCurrentMapContinent() local origZ = GetCurrentMapZone() @@ -202,12 +211,8 @@ function DB_GetItem(group, id, silent, register) for c, cname in ipairs({GetMapContinents()}) do for z, zname in ipairs({GetMapZones(c)}) do local pois, zoneHasQuests = GetZonePOIs(c, z) - if zoneHasQuests then - for _, ipoi in ipairs(pois) do - if ipoi.questId == id then - myPois[count] = ipoi - end - end + if zoneHasQuests and pois[id] then + ite:insert(pois[id]) end end end diff --git a/QuestHelper/director_achievement.lua b/QuestHelper/director_achievement.lua index 3603938..6bb579d 100644 --- a/QuestHelper/director_achievement.lua +++ b/QuestHelper/director_achievement.lua @@ -289,20 +289,12 @@ function GetAchievementMetaObjective(achievement) if data.chunk then ttx.solid = horribledupe(data.chunk.solid) if data.chunk.loc then for _, v in ipairs(data.chunk.loc) do --- Ugly database hack - if v.p == 26 then v.p = 48 end - if v.p == 38 then v.p = 168 end --- end hack table.insert(ttx, {loc = {x = v.x, y = v.y, c = QuestHelper_ParentLookup[v.p], p = v.p}}) end end end if data.loc then ttx.solid = data.solid --- Ugly database hack - if data.loc.p == 26 then data.loc.p = 48 end - if data.loc.p == 38 then data.loc.p = 168 end --- end hack table.insert(ttx, {loc = {x = data.loc.x, y = data.loc.y, c = QuestHelper_ParentLookup[data.loc.p], p = data.loc.p}}) end diff --git a/QuestHelper/director_find.lua b/QuestHelper/director_find.lua index 6c10493..ccdf97f 100644 --- a/QuestHelper/director_find.lua +++ b/QuestHelper/director_find.lua @@ -71,10 +71,6 @@ local function generate_objective(dbi) for _, v in ipairs(dbi.loc) do QuestHelper: Assert(QuestHelper_ParentLookup) QuestHelper: Assert(QuestHelper_ParentLookup[v.p], v.p) --- Ugly database hack - if v.p == 26 then v.p = 48 end - if v.p == 38 then v.p = 168 end --- end hack table.insert(clooster, {loc = {x = v.x, y = v.y, c = QuestHelper_ParentLookup[v.p], p = v.p}, cluster = clooster, tracker_hidden = true, why = why, map_desc = {QuestHelper:HighlightText(dbi.name)}, tracker_desc = dbi.name, map_suppress_ignore = true, map_custom_menu = function (menu) QuestHelper:CreateMenuItem(menu, QHText("FIND_REMOVE")):SetFunction(function () QH_Route_ClusterRemove(clooster) end) end}) end @@ -185,8 +181,8 @@ local elders = { ["Silvervein"] = {35, 33, 46}, --"Loch Modan 33 46", ["Ironband"] = {28, 21, 79}, --"Searing Gorge 21 79", ["Obsidian"] = {21, 45, 41}, --"Silverpine Forest 45 41", - ["Starglade"] = {689, 63, 22}, --"Stranglethorn Vale 63 22", -- Jungle 71 34 - ["Winterhoof"] = {689, 37, 39}, --"Stranglethorn Vale 37 79", -- Cape 39 72 + ["Starglade"] = {37, 71, 34}, --"Northern Stranglethorn 71 34" + ["Winterhoof"] = {673, 39, 72}, --"The Cape of Stranglethorn 39 72" ["Graveborn"] = {20, 61, 53}, --"Tirisfal Glades 61 53", ["Moonstrike"] = {22, 69, 73}, --"Western Plaguelands 69 73", ["Meadowrun"] = {22, 63.5, 36.2}, --"Western Plaguelands 63 36", @@ -297,10 +293,6 @@ function QH_FindName(name) --[[ assert(dbi) ]] if dbi.loc then --- Ugly database hack - if dbi.loc.p == 26 then dbi.loc.p = 48 end - if dbi.loc.p == 38 then dbi.loc.p = 168 end --- end hack table.insert(found_db, dbi) if has_name[dbi.name] then needs_postfix[dbi.name] = true end diff --git a/QuestHelper/director_quest.lua b/QuestHelper/director_quest.lua index 600091a..d348327 100644 --- a/QuestHelper/director_quest.lua +++ b/QuestHelper/director_quest.lua @@ -48,10 +48,6 @@ local function AppendObjlinks(target, source, tooltips, icon, last_name, map_lin for m, v in ipairs(source.loc) do QuestHelper: Assert(target) QuestHelper: Assert(QuestHelper_ParentLookup) --- Ugly database hack - if v.p == 26 then v.p = 48 end -- Alterac Mountains merged to Hillsbrad Foothills - if v.p == 38 then v.p = 168 end -- Ditto Stranglethorn --- end hack QuestHelper: Assert(QuestHelper_ParentLookup[v.p], v.p) table.insert(target, {loc = {x = v.x, y = v.y, c = QuestHelper_ParentLookup[v.p], p = v.p}, path_desc = copy(map_lines), icon_id = icon or 6}) end @@ -121,6 +117,7 @@ local function GetQuestMetaobjective(questid, lbcount, qindex) if not quest_list[questid] then local q = DB_GetItem("quest", questid, true, true) + --[==[ if not lbcount then QuestHelper: TextOut("Missing lbcount, guessing wildly") if q and q.criteria then @@ -132,6 +129,7 @@ local function GetQuestMetaobjective(questid, lbcount, qindex) lbcount = 0 -- heh end end + --]==] -- just doublechecking here if not QuestCriteriaWarningBroadcast and q and q.criteria then for k, v in pairs(q.criteria) do @@ -159,13 +157,6 @@ local function GetQuestMetaobjective(questid, lbcount, qindex) if qindex < 0 or (desc and typ ~= "log") then -- Ignore if no description. --QuestHelper:TextOut(string.format("critty %d %d", k, c.loc and #c.loc or -1)) ---[[ - if done then - print(string.format("Quest %s, Objective %s('%s') is done.", qindex, i, desc)) - else - print(string.format("Quest %s, Objective %s('%s') is not done.", qindex, i, desc)) - end -]] ttx.tooltip_canned = {} if q and q.criteria and q.criteria[i] then @@ -209,10 +200,6 @@ local function GetQuestMetaobjective(questid, lbcount, qindex) --print(v.rc, v.rz) --print(QuestHelper_IndexLookup[v.rc]) --print(QuestHelper_IndexLookup[v.rc][v.rz]) --- Ugly database hack - if v.p == 26 then v.p = 48 end - if v.p == 38 then v.p = 168 end --- end hack table.insert(ttx, {desc = "Turn in quest", why = ite, loc = {x = v.x, y = v.y, c = QuestHelper_ParentLookup[v.p], p = v.p}, tracker_hidden = true, cluster = ttx, icon_id = 7, type_quest = ite.type_quest}) end end diff --git a/QuestHelper/graph_core.lua b/QuestHelper/graph_core.lua index 9400c74..7958496 100644 --- a/QuestHelper/graph_core.lua +++ b/QuestHelper/graph_core.lua @@ -151,17 +151,8 @@ function QH_Graph_Pathmultifind(st, nda, reverse, make_path) --stats.dests_complex = 0 --stats.dests_total = 0 --- Ugly database hack - if st.p == 26 then st.p = 48 end -- Alterac Mountains merged to Hillsbrad Foothills - if st.p == 38 then st.p = 168 end -- Ditto Stranglethorn --- end hack - for k, v in ipairs(nda) do QuestHelper: Assert(v.x and v.y and v.p) --- Ugly database hack pt. 2 - if v.p == 26 then v.p = 48 end -- Alterac Mountains merged to Hillsbrad Foothills - if v.p == 38 then v.p = 168 end -- Ditto Stranglethorn --- end hack local cpvp = canoplane(v.p) if plane[cpvp] then --print("Destination plane insertion") diff --git a/QuestHelper/routing_core.lua b/QuestHelper/routing_core.lua index f3778b5..a7e4c5a 100644 --- a/QuestHelper/routing_core.lua +++ b/QuestHelper/routing_core.lua @@ -1257,10 +1257,6 @@ function QH_Route_Core_ClusterAdd(clust, clustid_used) -- if we're doing hackery, clust will just be an empty table and we'll retrofit stuff later for _, v in ipairs(clust) do --- Ugly database hack - if v.loc.p == 26 then v.loc.p = 48 end -- Somehow I doubt this is the problem location, but it IS a nice place to make a translation. - if v.loc.p == 38 then v.loc.p = 168 end -- Just following your lead. --- end hack local idx = QH_Route_Core_NodeAdd_Internal(v) Storage_NodeAdded(idx) ClusterLookup[idx] = clustid