Stop the guide from jumping ahead of the player #27
No files matched your search
+1
-1
@@ -1,7 +1,7 @@
|
||||
## Interface: 16001
|
||||
## Title: Coffey's Leveling Guide
|
||||
## Notes: Leveling guide for WoW Forever: route for every race/class, talents, spec guides, gear & pre-raid BiS, professions, gold and extras. /cguide
|
||||
## Version: 3.1.3
|
||||
## Version: 3.1.4
|
||||
## Author: Coffey Labs LLC
|
||||
## X-Website: https://coffeylabs.org
|
||||
## X-Copyright: Copyright (c) 2026 Coffey Labs LLC
|
||||
|
||||
@@ -92,10 +92,19 @@ local function QuestNameID(q)
|
||||
return q, nil
|
||||
end
|
||||
|
||||
local function FlaggedDone(id)
|
||||
if ns.completed and ns.completed[id] then return true end
|
||||
return (C_QuestLog and C_QuestLog.IsQuestFlaggedCompleted and C_QuestLog.IsQuestFlaggedCompleted(id)) and true or false
|
||||
end
|
||||
|
||||
function ns.IsQuestDone(q)
|
||||
local name, id = QuestNameID(q)
|
||||
-- Fill in IDs learned from the quest log for quests the data only knows by name.
|
||||
id = id or (name and ns.char.questIDs and ns.char.questIDs[name])
|
||||
-- A quest the data names by ID is judged by that ID alone. Hundreds of quests share a name
|
||||
-- (chains such as "A Dark Threat Looms" 161 > 199 > 250, faction copies), and finishing one
|
||||
-- must not tick off the others.
|
||||
if id then return FlaggedDone(id) end
|
||||
-- Quests the data only knows by name: use the ID learned from the quest log when there is one.
|
||||
id = name and ns.char.questIDs and ns.char.questIDs[name]
|
||||
if id then
|
||||
if ns.completed and ns.completed[id] then return true end
|
||||
if C_QuestLog and C_QuestLog.IsQuestFlaggedCompleted and C_QuestLog.IsQuestFlaggedCompleted(id) then return true end
|
||||
@@ -109,12 +118,73 @@ end
|
||||
|
||||
function ns.IsQuestActive(q)
|
||||
local name, id = QuestNameID(q)
|
||||
-- When the log reports quest IDs, a quest with an ID matches by ID alone: a later part of a
|
||||
-- same-name chain in the log is a different quest. Names are the fallback for clients
|
||||
-- that report no IDs.
|
||||
if id and next(ns.logIDs) then return ns.logIDs[id] or false end
|
||||
return (id and ns.logIDs[id]) or (name and ns.activeQuests[name]) or false
|
||||
end
|
||||
|
||||
local stateMemo, stateKey = {}, nil
|
||||
local ComputeState
|
||||
|
||||
-- How many route steps' plans turn in each quest (by ID, or name when there is no ID).
|
||||
local turninSteps, turninFor = {}, nil
|
||||
local function TurninSteps()
|
||||
if turninFor ~= ns.route then
|
||||
turninSteps, turninFor = {}, ns.route
|
||||
for _, st in ipairs(ns.route or {}) do
|
||||
local seen = {}
|
||||
for _, s in ipairs(ns.PlanFor and ns.PlanFor(st) or {}) do
|
||||
local key = s.act == "turnin" and s.quest and (s.quest[2] or s.quest[1])
|
||||
if key and not seen[key] then seen[key] = true; turninSteps[key] = (turninSteps[key] or 0) + 1 end
|
||||
end
|
||||
end
|
||||
end
|
||||
return turninSteps
|
||||
end
|
||||
|
||||
-- How many of a step's quests are in the log, done, and in all. With a quest plan, only quests
|
||||
-- the plan turns in count: a quest picked up at the end of a zone and handed in at the next
|
||||
-- belongs to the next zone, and must not hold the old one open. A quest that several steps
|
||||
-- turn in (one the route puts off to a second visit) holds none of them.
|
||||
local function StepQuestCounts(step)
|
||||
local inLog, done, total, seen = 0, 0, 0, {}
|
||||
local function count(q)
|
||||
local name, id = QuestNameID(q)
|
||||
local key = id or name
|
||||
if not key or seen[key] then return end
|
||||
seen[key] = true
|
||||
total = total + 1
|
||||
if ns.IsQuestActive(q) then inLog = inLog + 1 elseif ns.IsQuestDone(q) then done = done + 1 end
|
||||
end
|
||||
local plan = ns.PlanFor and ns.PlanFor(step)
|
||||
if plan and #plan > 0 then
|
||||
local owners = TurninSteps()
|
||||
for _, s in ipairs(plan) do
|
||||
if s.act == "turnin" and s.quest and owners[s.quest[2] or s.quest[1]] == 1 then count(s.quest) end
|
||||
end
|
||||
else
|
||||
for _, q in ipairs(step.quests or {}) do count(q) end
|
||||
end
|
||||
return inLog, done, total
|
||||
end
|
||||
|
||||
-- Levels alone never close a step you are still working on: Forever's extra XP (dungeons,
|
||||
-- rested, camping) often takes you past a zone's last level with its quests still open.
|
||||
-- Its quests in your log keep it open until you are HOLD_LOG levels past the step, and a step
|
||||
-- you've started (with quests still to do) until HOLD_STARTED levels past it. A step you never
|
||||
-- started, or whose quests are all done, closes on time. The limits stay small because grey,
|
||||
-- elite and abandoned quests often sit in the log for a long time.
|
||||
local HOLD_LOG, HOLD_STARTED = 4, 2
|
||||
local function StillWorking(step, level)
|
||||
local top = step.reach or step.max
|
||||
if not top then return false end
|
||||
local inLog, done, total = StepQuestCounts(step)
|
||||
if inLog > 0 and level <= top + HOLD_LOG then return true end
|
||||
return done > 0 and done < total and level <= top + HOLD_STARTED
|
||||
end
|
||||
|
||||
-- Returns nil (not done) or one of "done", "skipped", "outleveled", "behind".
|
||||
-- "behind" is a class quest or mount step left 8+ levels behind: it stops holding up the
|
||||
-- route (someone who installs the guide at 50 shouldn't be parked on a level-10 quest)
|
||||
@@ -141,7 +211,12 @@ ComputeState = function(step)
|
||||
if all then return "done" end
|
||||
end
|
||||
end
|
||||
if step.reach and level >= step.reach then return "done" end
|
||||
local working -- worked out only when a level rule would close the step
|
||||
local function Working()
|
||||
if working == nil then working = StillWorking(step, level) end
|
||||
return working
|
||||
end
|
||||
if step.reach and level >= step.reach and not Working() then return "done" end
|
||||
if ns.ZoneStats then
|
||||
local zd, zt = ns.ZoneStats(step)
|
||||
if zd and zt >= 5 and zd / zt >= 0.9 then return "done" end
|
||||
@@ -151,7 +226,7 @@ ComputeState = function(step)
|
||||
if plan and #plan > 0 and not first then return "done" end
|
||||
end
|
||||
local keep = step.kind == "class" or step.kind == "mount"
|
||||
if ns.db.autoSkip and step.max and level > step.max + 3 and not keep then
|
||||
if ns.db.autoSkip and step.max and level > step.max + 3 and not keep and not Working() then
|
||||
return "outleveled"
|
||||
end
|
||||
if ns.db.autoSkip and step.max and keep and level > step.max + 8 then return "behind" end
|
||||
|
||||
+8
-2
@@ -76,8 +76,14 @@ function D.Evidence(step, chain)
|
||||
e.done = e.done + 1
|
||||
end
|
||||
end
|
||||
for _, q in ipairs(step.quests or {}) do count(q) end
|
||||
for _, s in ipairs(ns.PlanFor(step) or {}) do if s.quest then count(s.quest) end end
|
||||
-- With a quest plan, only quests the plan turns in count: one picked up at the end of a zone
|
||||
-- and handed in at the next is evidence for the next zone, not this one.
|
||||
local plan = ns.PlanFor(step)
|
||||
if plan and #plan > 0 then
|
||||
for _, s in ipairs(plan) do if s.act == "turnin" and s.quest then count(s.quest) end end
|
||||
else
|
||||
for _, q in ipairs(step.quests or {}) do count(q) end
|
||||
end
|
||||
e.here = D.IsHere(step, chain)
|
||||
return e
|
||||
end
|
||||
|
||||
@@ -349,6 +349,81 @@ if target then
|
||||
else
|
||||
print("detect: no later zone step with a plan for this character; skipped")
|
||||
end
|
||||
-- Same-name quests: finishing one part of a chain must not tick off the others.
|
||||
SlashCmdList.COFFEYGUIDE("reset")
|
||||
completed = {}; ns.completed = {}; wipe(ns.completedNames); questLog = {}
|
||||
completed[70001] = true; QNAMES[70001] = "Shared Name Test"
|
||||
ns.LoadCompleted(); ns.ResolveCompletedNames(); fire("QUEST_LOG_UPDATE")
|
||||
assert(ns.IsQuestDone({ "Shared Name Test", 70001 }), "the finished part counts as done")
|
||||
assert(not ns.IsQuestDone({ "Shared Name Test", 70002 }), "another quest with the same name must not count as done")
|
||||
assert(ns.IsQuestDone({ "Shared Name Test" }), "a quest known only by name still matches by name")
|
||||
questLog = { { "Shared Name Test", 70003 } }; fire("QUEST_LOG_UPDATE")
|
||||
assert(not ns.IsQuestActive({ "Shared Name Test", 70002 }), "a later part in the log is not this part")
|
||||
assert(ns.IsQuestActive({ "Shared Name Test", 70003 }), "the part in the log is active")
|
||||
assert(ns.IsQuestActive({ "Shared Name Test" }), "a quest known only by name is active by name")
|
||||
questLog = {}; fire("QUEST_LOG_UPDATE")
|
||||
print("names: same-name chain parts stay separate")
|
||||
|
||||
-- Levels: reaching a zone's last level must not close it while you are working on it.
|
||||
completed = {}; ns.completed = {}; wipe(ns.completedNames); questLog = {}
|
||||
fire("QUEST_LOG_UPDATE")
|
||||
local hold
|
||||
for _, st in ipairs(ns.route) do
|
||||
local plan = ns.PlanFor(st)
|
||||
if st.kind == "zone" and not st.optional and st.reach and plan and #plan >= 6 then hold = st; break end
|
||||
end
|
||||
-- Quests each step turns in, and which quests more than one step turns in.
|
||||
local owners = {}
|
||||
for _, st in ipairs(ns.route) do
|
||||
local seen = {}
|
||||
for _, s in ipairs(ns.PlanFor(st) or {}) do
|
||||
if s.act == "turnin" and s.quest and s.quest[2] and not seen[s.quest[2]] then
|
||||
seen[s.quest[2]] = true; owners[s.quest[2]] = (owners[s.quest[2]] or 0) + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
if hold then
|
||||
local qs, seen = {}, {}
|
||||
for _, s in ipairs(ns.PlanFor(hold)) do
|
||||
local id = s.act == "turnin" and s.quest and s.quest[2]
|
||||
if id and owners[id] == 1 and not seen[id] then seen[id] = true; qs[#qs + 1] = s.quest end
|
||||
end
|
||||
local saved = P.level
|
||||
local function at(level) P.level = level; ns.player.level = level; ns.Invalidate(); return ns.StepState(hold) end
|
||||
assert(at(hold.reach) == "done", "a zone you never started closes at its reach level")
|
||||
completed[qs[1][2]] = true; QNAMES[qs[1][2]] = qs[1][1]; ns.LoadCompleted()
|
||||
questLog = { { qs[2][1], qs[2][2] }, { qs[3][1], qs[3][2] } }; fire("QUEST_LOG_UPDATE")
|
||||
assert(at(hold.reach) == nil, "quests in the log keep the zone open at its reach level")
|
||||
assert(at(hold.reach + 4) == nil, "quests in the log keep the zone open up to 4 levels past it")
|
||||
assert(at(hold.reach + 5) ~= nil, "a zone left 5+ levels behind closes even with quests in the log")
|
||||
questLog = {}; fire("QUEST_LOG_UPDATE")
|
||||
assert(at(hold.reach + 2) == nil, "a started zone with quests left stays open for 2 levels past it")
|
||||
assert(at(hold.reach + 3) ~= nil, "a started zone closes 3 levels past it")
|
||||
at(saved)
|
||||
print("levels: " .. hold.id .. " held while working, closes when left behind")
|
||||
end
|
||||
|
||||
-- A quest the route turns in at two steps (put off to a second visit) holds neither of them.
|
||||
completed = {}; ns.completed = {}; wipe(ns.completedNames); questLog = {}
|
||||
local shared, sharedStep
|
||||
for _, st in ipairs(ns.route) do
|
||||
if st.kind == "zone" and not st.optional and st.reach then
|
||||
for _, s in ipairs(ns.PlanFor(st) or {}) do
|
||||
local id = s.act == "turnin" and s.quest and s.quest[2]
|
||||
if id and (owners[id] or 0) > 1 then shared, sharedStep = s.quest, st; break end
|
||||
end
|
||||
end
|
||||
if shared then break end
|
||||
end
|
||||
if shared then
|
||||
local saved = P.level
|
||||
questLog = { { shared[1], shared[2] } }; fire("QUEST_LOG_UPDATE")
|
||||
P.level = sharedStep.reach; ns.player.level = sharedStep.reach; ns.Invalidate()
|
||||
assert(ns.StepState(sharedStep) == "done", "a quest turned in at two steps must not hold the first one open")
|
||||
P.level = saved; ns.player.level = saved; questLog = {}; fire("QUEST_LOG_UPDATE")
|
||||
print("levels: shared turn-in " .. shared[2] .. " does not hold " .. sharedStep.id)
|
||||
end
|
||||
|
||||
CoffeyGuide_Binding("check"); CoffeyGuide_Binding("compact"); CoffeyGuide_Binding("waypoint")
|
||||
ns.db.colorblind = true; ns.db.accentGold = true; ns.Fire("SettingsChanged")
|
||||
SlashCmdList.COFFEYGUIDE("settings"); g_search = _G.CoffeyGuideSearch
|
||||
|
||||
Reference in new issue
Block a user