From 8d0b99fc25a06f03c2ea5e582ccf8ac3350a68b0 Mon Sep 17 00:00:00 2001 From: cralor Date: Wed, 30 May 2018 00:25:20 -0500 Subject: [PATCH] Fixed compatability issues with pfQuest 3.0 --- Mapping.lua | 46 ++++++++++++++++++++-------------------------- TourGuide.toc | 4 ++-- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/Mapping.lua b/Mapping.lua index b8d18c8..c599398 100644 --- a/Mapping.lua +++ b/Mapping.lua @@ -30,39 +30,33 @@ local function MapPoint(zone, x, y, desc) end end -function TourGuide:MapPfQuestNPC(quest, action) +function TourGuide:MapPfQuestNPC(qid, action) if not self.db.char.mapquestgivers then return end - local npcname, stype - local title = quest + local unitId + local qLookup = pfDB["quests"]["data"] + local loc, qid = GetLocale(), tonumber(qid) - local qLookup = pfDatabase["quests"] - if not qLookup[quest] then - for name, tab in pairs(qLookup) do - local _, _, questname, _ = strfind(name, "(.*),.*") - if questname == quest then - quest = name - end - end - end - - if qLookup[quest] then + if qLookup[qid] then if action == "ACCEPT" then - for name, type in pairs(qLookup[quest]["start"]) do - npcname, stype = name, type + if qLookup[qid]["start"]["U"] then + for _, uid in pairs(qLookup[qid]["start"]["U"]) do + unitId = uid + end end else - for name, type in pairs(qLookup[quest]["end"]) do - npcname, stype = name, type + if qLookup[qid]["end"]["U"] then + for _, uid in pairs(qLookup[qid]["end"]["U"]) do + unitId = uid + end end end - self:DebugF(1, "pfQuest lookup %s %s %s", action, stype, npcname) - if stype ~= "NPC" then return end + self:DebugF(1, "pfQuest lookup %s %s", action, unitId) - local sLookup = pfDatabase["spawns"] - if sLookup[npcname] and sLookup[npcname]["coords"] then - for id, data in pairs(sLookup[npcname]["coords"]) do - local _, _, x, y, zone = strfind(data, "(.*),(.*),(.*)") - MapPoint(pfDatabase["zones"][tonumber(zone)], tonumber(x), tonumber(y), title.." ("..npcname..")") + local unitLookup = pfDB["units"]["data"] + if unitLookup[unitId]["coords"] then + for _, data in pairs(unitLookup[unitId]["coords"]) do + local x, y, zone, _ = unpack(data) + MapPoint(pfDB.zones.loc[zone], x, y, pfDB.quests.loc[qid]["T"].." ("..pfDB.units.loc[unitId]..")") return true end end @@ -110,7 +104,7 @@ function TourGuide:ParseAndMapCoords(qid, action, note, desc, zone) for x,y in string.gfind(note, L.COORD_MATCH) do MapPoint(zone, tonumber(x), tonumber(y), desc) end elseif (action == "ACCEPT" or action == "TURNIN") then if pfQuest then - self:MapPfQuestNPC(desc, action) + self:MapPfQuestNPC(qid, action) elseif LightHeaded then self:MapLightHeadedNPC(qid, action) end diff --git a/TourGuide.toc b/TourGuide.toc index 0495f13..c576243 100644 --- a/TourGuide.toc +++ b/TourGuide.toc @@ -1,10 +1,10 @@ ## Interface: 11200 -## Title: Tour Guide +## Title: TourGuide ## Notes: Powerleveling guide framework ## Author: Tekkub Stoutwrithe ## Credits: Road-block, rsheep, cralor -## Version: 1.0-11200 +## Version: 1.0 ## X-Category: Quest ## SavedVariables: TourGuideAlphaDB