If I copied everything correctly, issuing a the "/qh find" command on something a second time will clear it, rather than add it again. Note: This is in preparation for adding in new functionality.
Cette révision appartient à :
Parent
968ea9be11
révision
4270499d7e
|
@ -56,27 +56,36 @@ local function getitall(name)
|
|||
return found
|
||||
end
|
||||
|
||||
local function generate_objective(dbi)
|
||||
local clooster = {}
|
||||
local custom_find = {}
|
||||
|
||||
local why = {desc = dbi.name, tracker_desc = dbi.name}
|
||||
for _, v in ipairs(dbi.loc) do
|
||||
QuestHelper: Assert(QuestHelper_ParentLookup)
|
||||
QuestHelper: Assert(QuestHelper_ParentLookup[v.p], v.p)
|
||||
local function generate_objective(dbi)
|
||||
if not custom_find[dbi.name] then
|
||||
local clooster = {}
|
||||
|
||||
local why = {desc = dbi.name, tracker_desc = dbi.name}
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
QH_Route_ClusterAdd(clooster)
|
||||
QH_Route_ClusterAdd(clooster)
|
||||
custom_find[dbi.name] = clooster
|
||||
else
|
||||
QH_Route_ClusterRemove(custom_find[dbi.name])
|
||||
custom_find[dbi.name] = nil
|
||||
end
|
||||
end
|
||||
|
||||
local msfires = {desc = QHText("FIND_CUSTOM_LOCATION"), tracker_desc = QHText("FIND_CUSTOM_LOCATION")}
|
||||
|
||||
local function QH_FindCoord(locx, locy, locz, label)
|
||||
if type(locz) ~= "number" then -- If it is a number, we are probably doing an elder right now.
|
||||
label = locz .. " (" .. locx .. ", " .. locy .. ")"
|
||||
for z, nam in pairs(QuestHelper_NameLookup) do
|
||||
if nam:lower():find(locz:lower()) then
|
||||
locz = z
|
||||
|
@ -86,16 +95,22 @@ local function QH_FindCoord(locx, locy, locz, label)
|
|||
end
|
||||
|
||||
if type(locz) == "number" then
|
||||
local ec, ez = unpack(QuestHelper_ZoneLookup[locz])
|
||||
local c, x, y = QuestHelper.Astrolabe:GetAbsoluteContinentPosition(ec, ez, locx / 100, locy / 100)
|
||||
local node = {loc = {x = x, y = y, p = locz, c = QuestHelper_ParentLookup[locz]}, why = {desc = label, tracker_desc = label}, map_desc = {label}, tracker_desc = label, tracker_hidden = true}
|
||||
local cluster = {node}
|
||||
node.cluster = cluster
|
||||
if not custom_find[label] then
|
||||
local ec, ez = unpack(QuestHelper_ZoneLookup[locz])
|
||||
local c, x, y = QuestHelper.Astrolabe:GetAbsoluteContinentPosition(ec, ez, locx / 100, locy / 100)
|
||||
local node = {loc = {x = x, y = y, p = locz, c = QuestHelper_ParentLookup[locz]}, why = {desc = label, tracker_desc = label}, map_desc = {label}, tracker_desc = label, tracker_hidden = true}
|
||||
local cluster = {node}
|
||||
node.cluster = cluster
|
||||
|
||||
custom_find[label] = cluster
|
||||
node.map_suppress_ignore = true
|
||||
node.map_custom_menu = function (menu) QuestHelper:CreateMenuItem(menu, QHText("FIND_REMOVE")):SetFunction(function () QH_Route_ClusterRemove(cluster) end) end
|
||||
|
||||
node.map_suppress_ignore = true
|
||||
node.map_custom_menu = function (menu) QuestHelper:CreateMenuItem(menu, QHText("FIND_REMOVE")):SetFunction(function () QH_Route_ClusterRemove(cluster) end) end
|
||||
|
||||
QH_Route_ClusterAdd(cluster)
|
||||
QH_Route_ClusterAdd(cluster)
|
||||
else
|
||||
QH_Route_ClusterRemove(custom_find[label])
|
||||
custom_find[label] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Référencer dans un nouveau ticket