Skip to content

Commit

Permalink
Fixed priority of manual coord notes vs external database lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
cralor committed Feb 22, 2018
1 parent f6cd483 commit 252ec84
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
20 changes: 10 additions & 10 deletions Dongle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ local g = getfenv(0)

if not g.DongleStub or g.DongleStub:IsNewerVersion(major, minor) then
local lib = setmetatable({}, {
__call = function(t,k)
if type(t.versions) == "table" and t.versions[k] then
__call = function(t,k)
if type(t.versions) == "table" and t.versions[k] then
return t.versions[k].instance
else
error("Cannot find a library with name '"..tostring(k).."'", 2)
Expand Down Expand Up @@ -68,7 +68,7 @@ if not g.DongleStub or g.DongleStub:IsNewerVersion(major, minor) then
local oldmajor,oldminor = versionData.instance:GetVersion()
return minor > oldminor
end

local function NilCopyTable(src, dest)
for k,v in pairs(dest) do dest[k] = nil end
for k,v in pairs(src) do dest[k] = v end
Expand Down Expand Up @@ -98,20 +98,20 @@ if not g.DongleStub or g.DongleStub:IsNewerVersion(major, minor) then
["instance"] = newInstance,
["deactivate"] = deactivate,
}

self.versions[major] = versionData
if type(activate) == "function" then
table.insert(self.log, string.format("Activate: %s, %s", major, minor))
activate(newInstance)
end
return newInstance
end

local oldDeactivate = versionData.deactivate
local oldInstance = versionData.instance

versionData.deactivate = deactivate

local skipCopy
if type(activate) == "function" then
table.insert(self.log, string.format("Activate: %s, %s", major, minor))
Expand All @@ -136,7 +136,7 @@ if not g.DongleStub or g.DongleStub:IsNewerVersion(major, minor) then

local function Activate(new, old)
-- This code ensures that we'll move the versions table even
-- if the major version names are different, in the case of
-- if the major version names are different, in the case of
-- DongleStub
if not old then old = g.DongleStub end

Expand All @@ -146,7 +146,7 @@ if not g.DongleStub or g.DongleStub:IsNewerVersion(major, minor) then
end
g.DongleStub = new
end

-- Actually trigger libary activation here
local stub = g.DongleStub or lib
lib = stub:Register(lib, Activate)
Expand Down Expand Up @@ -515,7 +515,7 @@ local function printHelp(obj, method, header, frame, msg, a1,a2,a3,a4,a5,a6,a7,a
end

if select("#", a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20) > 0 then
msg = string.join(", ", msg, argsToStrings(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20))
msg = string.join(", ", {msg, argsToStrings(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)})
end

frame:AddMessage(msg)
Expand Down
7 changes: 3 additions & 4 deletions Mapping.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,13 @@ function TourGuide:ParseAndMapCoords(qid, action, note, desc, zone)
end
end

if (action == "ACCEPT" or action == "TURNIN") then
if note and string.find(note, L.COORD_MATCH) then
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)
elseif LightHeaded then
self:MapLightHeadedNPC(qid, action)
end
else
if not note then return end
for x,y in string.gfind(note, L.COORD_MATCH) do MapPoint(zone, tonumber(x), tonumber(y), desc) end
end
end
13 changes: 13 additions & 0 deletions lua52to50compat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ if not _G.select then
end
_G.select = select
end
if not string.join then
string.join = function(delimiter, list)
local len = getn(list)
if len == 0 then
return ""
end
local string = list[1]
for i = 2, len do
string = string .. delimiter .. list[i]
end
return string
end
end
if not string.trim then
string.trim = function(s)
return (string.gsub(s,"^%s*(.-)%s*$", "%1"))
Expand Down

0 comments on commit 252ec84

Please sign in to comment.