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
121 lines
7.5 KiB
Lua
121 lines
7.5 KiB
Lua
-- texlua chainmix.lua <addon> NightElf <CLASS> 1 casual
|
|
-- Skip, unskip and abandon on a step that picks up quests of two different chains before doing either:
|
|
-- VanillaGuide 1-6 Teldrassil, "Get The Woodland Protector pt.1 ... and A Good Friend" (458 > 459, 4495 > 3519 > ...).
|
|
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 click(f) if f and f._scripts.OnClick and not f._off then this = f; arg1 = "LeftButton"; f._scripts.OnClick() end end
|
|
local function settle() W.Fire("QUEST_LOG_UPDATE"); W.Tick(0.4, 4); W.Tick(3, 1); ER.StepsChanged() end
|
|
local function logIdx(title) for i, q in ipairs(W.log) do if q.title == title then return i end end end
|
|
local function add(id) if not logIdx(S.QuestTitle(id)) then table.insert(W.log, { id = id, title = S.QuestTitle(id), level = S.QuestLevel(id) or 1, objs = { { text = "x: 0/1", done = false } } }) end end
|
|
local function fresh(key)
|
|
if ER.db.done then ER.db.done[ER.Char()] = {} end
|
|
for i = table.getn(W.log), 1, -1 do table.remove(W.log, i) end
|
|
ER.db.adapt = nil
|
|
settle()
|
|
S.Load(key, true); settle()
|
|
end
|
|
W.Tick(3, 3)
|
|
W.level = 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
|
|
check(key and ER.StartGuide(key, true, true), "VanillaGuide 1-6 Teldrassil runs")
|
|
ER.ShowTracker(); settle()
|
|
local function stepWith(kind, id) for _, it in ipairs(S.All()) do for _, e in ipairs(it.step.elements) do if e.kind == kind and tonumber(e.id) == id then return it.step.n end end end end
|
|
local mixed = stepWith("A", 4495)
|
|
local qs = mixed and S.StepQuests(S.All and (function() for _, it in ipairs(S.All()) do if it.step.n == mixed then return it.step end end end)())
|
|
check(mixed and stepWith("A", 458) == mixed and table.getn(qs) == 2, "the step picks up quests of two chains: " .. (qs and table.concat(qs, " and ") or "?"))
|
|
local chainA, chainB = ER.QuestsAfter(458), ER.QuestsAfter(4495)
|
|
P("note chains: 458 > " .. table.concat(chainA, " > ") .. "; 4495 > " .. table.concat(chainB, " > "))
|
|
local laterB = stepWith("A", chainB[1])
|
|
local laterA = stepWith("A", chainA[1])
|
|
|
|
-- 1. skip the mixed step: one button, for both quests; a later skipped step of either chain is no button of its own
|
|
fresh(key)
|
|
S.Jump(mixed); settle()
|
|
click(F("GuideSkip")); settle()
|
|
check(S.Passed(mixed) == "skip" and ER.LearnedHard(458) and ER.LearnedHard(4495), "skipping it marks both quests left out")
|
|
if laterB then S.SkipLater(laterB, true) end
|
|
for g = 1, 30 do if S.Position() > math.max(laterB or 0, laterA or 0) then break end S.Next(); settle() end
|
|
local regs = S.RegainSteps()
|
|
local btn = regs[mixed]
|
|
check(btn and btn.kind == "skipped" and table.getn(btn.ids) == 2, " ...one button on it, for both quests (" .. (btn and table.concat(btn.ids, ", ") or "none") .. ")")
|
|
check(not laterB or not regs[laterB], " ...a later skipped step of the second chain (A Friend in Need) is not a button of its own")
|
|
-- the first quest can no longer be done (here: handed in), the second still can: the button stays, for the second
|
|
ER.db.done[ER.Char()][458] = true
|
|
ER.db.done[ER.Char()][S.QuestTitle(458)] = true
|
|
settle()
|
|
regs = S.RegainSteps()
|
|
check(regs[mixed] and S.CanUnskip(mixed) and regs[mixed].ids[1] == 4495, " ...when the first quest can no longer be done, the button stays for the second (" .. (regs[mixed] and table.concat(regs[mixed].ids, ", ") or "none") .. ")")
|
|
ER.db.done[ER.Char()][458], ER.db.done[ER.Char()][S.QuestTitle(458)] = nil, nil
|
|
settle()
|
|
-- grey for both: skipped for good
|
|
local lvl = W.level
|
|
W.level = 30
|
|
settle()
|
|
check(not S.RegainSteps()[mixed] and not S.CanUnskip(mixed), " ...when neither can be done (both grey), skipped for good")
|
|
W.level = lvl
|
|
settle()
|
|
-- unskip: back to the step, both quests no longer left out, both chains' later steps back
|
|
local passedBefore = {}
|
|
for _, id in ipairs({ chainA[1], chainB[1] }) do local n = stepWith("A", id) if n then passedBefore[n] = S.Passed(n) end end
|
|
S.Jump(mixed); settle()
|
|
check(S.Position() == mixed and not ER.LearnedHard(458) and not ER.LearnedHard(4495), "going back to it: both quests are no longer left out")
|
|
local stillPassed = {}
|
|
for _, id in ipairs({ chainA[1], chainB[1] }) do
|
|
local n = stepWith("A", id)
|
|
if n and passedBefore[n] and S.Passed(n) and not (laterB == n) then table.insert(stillPassed, n) end
|
|
end
|
|
check(table.getn(stillPassed) == 0, " ...and the later steps of both chains the skip left out are back" .. (table.getn(stillPassed) > 0 and (" (still passed: " .. table.concat(stillPassed, ", ") .. ")") or ""))
|
|
|
|
-- 2. accept both, abandon only the second: only its chain is held back and comes back; the first chain carries on
|
|
fresh(key)
|
|
S.Jump(mixed); settle()
|
|
add(458); add(4495); settle()
|
|
check(S.Position() > mixed, "both accepted: the guide moves on (" .. S.Position() .. ")")
|
|
local tB = S.QuestTitle(4495)
|
|
GetAbandonQuestName = function() return tB end
|
|
SetAbandonQuest()
|
|
table.remove(W.log, logIdx(tB)); settle()
|
|
local laterAN = laterA
|
|
for g = 1, 40 do if S.Position() > math.max(laterB or 0, laterAN or 0) then break end
|
|
local st = S.Current()
|
|
for _, e in ipairs(st.elements) do
|
|
local id = tonumber(e.id)
|
|
if id and (id == 458 or id == chainA[1]) then
|
|
if e.kind == "A" then add(id) end
|
|
if e.kind == "C" and logIdx(S.QuestTitle(id)) then local q = W.log[logIdx(S.QuestTitle(id))] q.complete = true q.objs[1].done = true end
|
|
if e.kind == "T" and logIdx(S.QuestTitle(id)) then W_TITLE = S.QuestTitle(id); GetQuestReward(0); table.remove(W.log, logIdx(S.QuestTitle(id))) end
|
|
end
|
|
end
|
|
settle()
|
|
if S.Current() == st then S.Next(); settle() end
|
|
end
|
|
local regs2 = S.RegainSteps()
|
|
check(regs2[mixed] and regs2[mixed].kind == "abandoned" and regs2[mixed].id == 4495, "abandoned the second: the mixed step is a button for it (" .. tostring(regs2[mixed] and regs2[mixed].id) .. ")")
|
|
check(S.TurnedIn(458) or S.InLog(458) or S.Passed(stepWith("T", 458) or 0) == "done", " ...the first chain carried on (The Woodland Protector handed in or under way)")
|
|
local howB
|
|
for _, it in ipairs(S.All()) do if it.step.n == laterB then howB = it.how end end
|
|
check(not laterB or howB == "abandoned", " ...the second chain's later step shows as held back by the abandon (" .. tostring(howB) .. ")")
|
|
-- pick the second up again: its chain comes back, the first chain's done steps stay done
|
|
local doneA = {}
|
|
for _, it in ipairs(S.All()) do
|
|
for _, e in ipairs(it.step.elements) do if (tonumber(e.id) == 458 or tonumber(e.id) == chainA[1]) and S.Passed(it.step.n) == "done" then doneA[it.step.n] = true end end
|
|
end
|
|
local where = S.Position()
|
|
add(4495); settle()
|
|
check(S.Position() < where and (not laterB or not S.Passed(laterB)), "picked the second up again: the guide goes back to it, its chain's later step is back (now at " .. S.Position() .. ")")
|
|
local undone = {}
|
|
for n in pairs(doneA) do
|
|
local mixedA = false
|
|
for _, it in ipairs(S.All()) do if it.step.n == n then for _, e in ipairs(it.step.elements) do if tonumber(e.id) == 4495 or (chainB[1] and tonumber(e.id) == chainB[1]) then mixedA = true end end end end
|
|
if not mixedA and S.Passed(n) ~= "done" then table.insert(undone, n) end
|
|
end
|
|
check(table.getn(undone) == 0, " ...the first chain's done steps stay done" .. (table.getn(undone) > 0 and (" (undone: " .. table.concat(undone, ", ") .. ")") or ""))
|
|
P(fails == 0 and "ALL PASSED" or (fails .. " FAILED"))
|
|
REPORT()
|