A leveling guide for WoW 1.12 players of pfQuest, based on Easy Route by stealthzi (MIT). See README.md and CHANGES.md. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XfR1apt9f3R7SxBKB2FF2D
128 lines
6.6 KiB
Lua
128 lines
6.6 KiB
Lua
-- [PFUI=1] texlua chainmarks.lua <addon> NightElf <CLASS> 1 casual
|
|
-- Each quest chain gets a colour mark in the step list, so its steps can be told apart from another chain's where the
|
|
-- guide goes back and forth between them; the guide's order is kept.
|
|
local here = arg[0]:match("^(.*)/") or "."
|
|
dofile(here .. "/lib.lua")
|
|
local W, ER, S, P = H.W, H.ER, H.S, H.P
|
|
local fails = 0
|
|
local function check(ok, what) if not ok then fails = fails + 1; P("FAIL " .. what) else P("ok " .. what) end end
|
|
local function strip(s) return (L53.gsub(L53.gsub(s or "", "|c%x%x%x%x%x%x%x%x", ""), "|r", "")) end
|
|
local function F(n) return _G["pfQuest_xpGuide" .. n] end
|
|
local function settle() W.Fire("QUEST_LOG_UPDATE"); W.Tick(0.4, 4); W.Tick(3, 1); ER.StepsChanged() end
|
|
W.Tick(3, 3)
|
|
local key
|
|
for _, g in ipairs(S.Guides()) do if g.vanilla and g.title == "1-6 Teldrassil" then key = S.Key(g) end end
|
|
ER.StartGuide(key, true, true)
|
|
ER.ShowTracker()
|
|
local f = F("Guide"); f:SetHeight(600); this = F("GuideGrip"); F("GuideGrip")._scripts.OnMouseUp()
|
|
settle()
|
|
local all = S.All()
|
|
local marks = F("Guide") and _G.pfQuest_xpGuide and nil
|
|
-- the marks, from the rows
|
|
local rows = {}
|
|
local list = F("GuideList")
|
|
for k = 1, 40 do this = list; arg1 = 1; list._scripts.OnMouseWheel() end
|
|
local seenN = {}
|
|
for pass = 1, 20 do
|
|
for i = 1, 60 do
|
|
local r = F("GuideRow" .. i)
|
|
if r and r:IsShown() and r.step and not seenN[r.step.n] then
|
|
seenN[r.step.n] = true
|
|
local cols = {}
|
|
for k = 1, 3 do local t = r.chainMark[k] if t:IsShown() then table.insert(cols, string.format("%.2f,%.2f,%.2f", t._vc[1], t._vc[2], t._vc[3]) .. "|" .. (L53.match(t._path or "", "Chain(%a+)$") or "?")) end end
|
|
table.insert(rows, { n = r.step.n, quests = S.StepQuests(r.step), cols = cols, chains = r.chains })
|
|
end
|
|
end
|
|
this = list; arg1 = -1; list._scripts.OnMouseWheel()
|
|
end
|
|
table.sort(rows, function(a, b) return a.n < b.n end)
|
|
local function colourFor(qid)
|
|
for _, row in ipairs(rows) do
|
|
for k, id in ipairs(row.quests) do
|
|
if id == qid and row.chains then
|
|
for _, m in ipairs(row.chains) do
|
|
for _, c in ipairs(ER.QuestsAfter(m.root)) do if c == qid then return string.format("%.2f,%.2f,%.2f", m.colour[1], m.colour[2], m.colour[3]) .. "|" .. m.shape end end
|
|
if m.root == qid then return string.format("%.2f,%.2f,%.2f", m.colour[1], m.colour[2], m.colour[3]) .. "|" .. m.shape end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
-- two chains: The Woodland Protector (458 > 459) and A Good Friend (4495 > 3519 > 3521 > 3522)
|
|
local cA, cB = colourFor(458), colourFor(4495)
|
|
local shapeA, shapeB = cA and L53.match(cA, "|(%a+)$"), cB and L53.match(cB, "|(%a+)$")
|
|
check(cA and cB and cA ~= cB and shapeA ~= shapeB, "the two chains have their own colour and their own shape (" .. tostring(cA) .. " / " .. tostring(cB) .. ")")
|
|
-- every step of a chain carries its colour
|
|
local wrong = {}
|
|
for _, row in ipairs(rows) do
|
|
for _, id in ipairs(row.quests) do
|
|
local want = (id == 458 or id == 459) and cA or ((id == 4495 or id == 3519 or id == 3521 or id == 3522) and cB) or nil
|
|
if want then
|
|
local has = false
|
|
for _, c in ipairs(row.cols) do if c == want then has = true end end
|
|
if not has then table.insert(wrong, row.n .. ":" .. id) end
|
|
end
|
|
end
|
|
end
|
|
check(table.getn(wrong) == 0, "every step of each chain shows its chain's mark" .. (table.getn(wrong) > 0 and (" (missing: " .. table.concat(wrong, " ") .. ")") or ""))
|
|
-- the chains interleave in the guide, and the list keeps the guide's order
|
|
local seq = {}
|
|
for _, row in ipairs(rows) do
|
|
for _, c in ipairs(row.cols) do
|
|
if c == cA and seq[table.getn(seq)] ~= "A" then table.insert(seq, "A") elseif c == cB and seq[table.getn(seq)] ~= "B" then table.insert(seq, "B") end
|
|
end
|
|
end
|
|
local inOrder = true
|
|
for i = 2, table.getn(all) do if all[i].step.n <= all[i - 1].step.n then inOrder = false end end
|
|
check(table.getn(seq) >= 3 and inOrder, "the chains go back and forth in the guide (" .. table.concat(seq, " ") .. "), and the list keeps its order")
|
|
-- a step that picks up quests of both chains shows both marks
|
|
local both
|
|
for _, row in ipairs(rows) do if table.getn(row.cols) >= 2 then both = row end end
|
|
check(both ~= nil, "a step with quests of two chains shows both marks (step " .. tostring(both and both.n) .. ")")
|
|
-- a quest that is in no chain here gets no mark
|
|
local lone
|
|
for _, row in ipairs(rows) do if table.getn(row.quests) > 0 and table.getn(row.cols) == 0 then lone = row end end
|
|
P("note a step with no chain mark: " .. tostring(lone and lone.n))
|
|
-- the mouse over a step of a chain lights the other steps of that chain in view, and only those
|
|
do
|
|
local over, others
|
|
for i = 1, 60 do local q = F("GuideRow" .. i) if q and q:IsShown() and q.chains and table.getn(q.chains) == 1 then over = over or q end end
|
|
if over then
|
|
local root = over.chains[1].root
|
|
this = over; over._scripts.OnEnter()
|
|
local lit, wrong, should = 0, 0, 0
|
|
for i = 1, 60 do
|
|
local q = F("GuideRow" .. i)
|
|
if q and q:IsShown() and q ~= over then
|
|
local same = false
|
|
for _, m in ipairs(q.chains or {}) do if m.root == root then same = true end end
|
|
if same then should = should + 1 end
|
|
if q.related:IsShown() then if same then lit = lit + 1 else wrong = wrong + 1 end end
|
|
end
|
|
end
|
|
check(should > 0 and lit == should and wrong == 0, "the mouse over a step lights the other steps of its chain (" .. lit .. " of " .. should .. ", " .. wrong .. " others)")
|
|
this = over; over._scripts.OnLeave()
|
|
local still = 0
|
|
for i = 1, 60 do local q = F("GuideRow" .. i) if q and q.related and q.related:IsShown() then still = still + 1 end end
|
|
check(still == 0, " ...and they go back when it leaves")
|
|
-- from the tick box too
|
|
this = over.check; over.check._scripts.OnEnter()
|
|
local fromBox = 0
|
|
for i = 1, 60 do local q = F("GuideRow" .. i) if q and q.related and q.related:IsShown() then fromBox = fromBox + 1 end end
|
|
check(fromBox == should, " ...also when the mouse is over its tick box")
|
|
this = over.check; over.check._scripts.OnLeave()
|
|
end
|
|
end
|
|
-- the tooltip names the chain and the part
|
|
local r
|
|
for i = 1, 60 do local q = F("GuideRow" .. i) if q and q:IsShown() and q.chains then r = q end end
|
|
if r then
|
|
local text = ""
|
|
GameTooltip.AddLine = function(self, t) text = text .. (t or "") .. "\n" end
|
|
GameTooltip.SetText = function(self, t) text = text .. (t or "") .. "\n" end
|
|
this = r; r._scripts.OnEnter()
|
|
check(L53.match(strip(text), "chain %(%a[%a ]*%), part %d+ of %d+"), "hovering a step names its chain, its shape and the part: " .. (L53.match(strip(text), "[^\n]*chain %([^)]*%), part %d+ of %d+") or "none"))
|
|
end
|
|
P(fails == 0 and "ALL PASSED" or (fails .. " FAILED"))
|
|
REPORT()
|