Files
pfQuest xpGuideandClaude Sonnet 5.5 ef2f4f34b3 pfQuest xpGuide 1.0.0
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
2026-11-16 14:47:43 +08:00

94 lines
5.7 KiB
Lua

-- [PFUI=1] texlua bethink.lua <addon> <race> <class> 1 casual
-- Bethink's guides (from Guidelime_Bethink): their own groups in the guide menu after the fast routes, a guide for your
-- race's start, steps in Bethink's words with quest names filled in, quests the addon does not know ticked by hand,
-- and playing through a guide into the next.
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
local function logIdx(title) for i, q in ipairs(W.log) do if q.title == title then return i end end end
W.Tick(3, 3)
check(type(pfQuest_xpGuide_Bethink) == "table" and table.getn(ER.MissingFiles()) == 0, "Data\\Bethink.lua loaded (" .. tostring(pfQuest_xpGuide_Bethink and pfQuest_xpGuide_Bethink.guides) .. " guides)")
-- the groups: casual, fast routes, then Bethink's by level
local groups = S.Groups()
local names = {}
for _, g in ipairs(groups) do table.insert(names, ER.GroupLabel(g.name) .. "(" .. table.getn(g.guides) .. ")") end
P("note groups: " .. table.concat(names, ", "))
local firstB, lastFast
for i, g in ipairs(groups) do
if g.guides[1].bethink then firstB = firstB or i elseif not g.guides[1].route and not g.guides[1].vanilla then lastFast = i end
end
check(firstB and lastFast and firstB > lastFast and groups[firstB].name == "Bethink's Guide 1-20", "Bethink's Guide groups come after the fast routes, from 1-20")
local _, _, faction = UnitFactionGroup and UnitFactionGroup("player")
for _, g in ipairs(groups) do for _, x in ipairs(g.guides) do
if x.bethink then check(x.faction == (UnitFactionGroup("player")), " ...only your faction's") break end
end end
-- the menu shows them all
ER.ShowGuideMenu()
local shown = 0
for i = 1, 16 do local r = F("GuideMenuGroup" .. i) if r and r:IsShown() and r.grp then shown = shown + 1 end end
check(shown == table.getn(groups), "the guide menu lists every group (" .. shown .. " of " .. table.getn(groups) .. ")")
F("Settings"):Hide()
-- the starting zone guide for your race
local _, race = UnitRace("player")
local start
for _, g in ipairs(S.Guides()) do if g.bethink and g.lo == 1 and S.Applies(g.defaultFor) then start = g end end
check(start ~= nil, "a Bethink guide for your race's start: " .. tostring(start and start.title))
if not start then P(fails .. " FAILED") REPORT() return end
check(ER.StartGuide(S.Key(start), true, true), " ...it starts")
ER.ShowTracker(); settle()
local function boxLines() local t = {} for j = 1, 12 do local b = F("GuideLine" .. j) if b and b:IsShown() then table.insert(t, strip(b.text._text)) end end return t end
-- a step in Bethink's words, quest names filled in, no {q...} left
local wordsSeen, tagsLeft = 0, 0
for _, it in ipairs(S.All()) do
for _, e in ipairs(it.step.elements) do
local l = S.Line(it.step, e)
if l and e.kind == "I" then
wordsSeen = wordsSeen + 1
if string.find(l.text, "{q", 1, true) then tagsLeft = tagsLeft + 1 end
end
end
end
check(wordsSeen > 20 and tagsLeft == 0, "steps keep Bethink's words (" .. wordsSeen .. " lines), quest tags turned into names")
local sample
for _, it in ipairs(S.All()) do for _, e in ipairs(it.step.elements) do if e.kind == "I" and e.text and string.find(e.text, "{q", 1, true) and not sample then sample = S.Line(it.step, e).text end end end
P("note e.g. \"" .. strip(sample or "") .. "\"")
-- play it through: pick up, do, hand in as the steps say; unknown quests are ticked by hand
local unknown, byHandTicks, g0 = 0, 0, 0
local infoName = S.Info().name
while g0 < 400 and S.Info() and S.Info().name == infoName and S.Current() do
local st = S.Current()
for _, e in ipairs(st.elements) do
local id = tonumber(e.id); local title = id and S.QuestTitle(id)
if id and not title and (e.kind == "A" or e.kind == "C" or e.kind == "T") then unknown = unknown + 1 end
if title and e.kind == "A" and not logIdx(title) and not S.TurnedIn(id) then table.insert(W.log, { id = id, title = title, level = S.QuestLevel(id) or W.level, objs = { { text = "x: 0/1", done = false } } }) end
if title and e.kind == "C" and logIdx(title) then local q = W.log[logIdx(title)] q.complete = true q.objs[1].done = true end
if title and e.kind == "T" and logIdx(title) then W_TITLE = title; GetQuestReward(0); table.remove(W.log, logIdx(title)) end
if e.kind == "X" and tonumber(e.level) and W.level < tonumber(e.level) then W.level = tonumber(e.level) end
if e.kind == "G" then W.zone = e.zone; W.x = e.x / 100; W.y = e.y / 100; W.Fire("ZONE_CHANGED_NEW_AREA") end
end
settle()
if S.Current() == st then
if S.ByHand(st) then byHandTicks = byHandTicks + 1 S.Tick(st.n) else S.Next() end
settle()
end
g0 = g0 + 1
end
P("note played " .. g0 .. " rounds of " .. infoName .. ": " .. byHandTicks .. " steps ticked by hand, " .. unknown .. " quest lines the addon has no name for")
check(g0 < 400, "played the whole guide through (" .. g0 .. " rounds)")
local nxt = S.Info() and S.Info().name
check(nxt and nxt ~= infoName and S.Info().bethink, " ...and went on to Bethink's next guide: " .. tostring(nxt))
-- the arrow has a place on most steps
local placed, total = 0, 0
for _, it in ipairs(S.All()) do
total = total + 1
for _, e in ipairs(it.step.elements) do if e.kind == "G" then placed = placed + 1 break end end
end
P("note " .. placed .. " of " .. total .. " steps of " .. tostring(nxt) .. " have their own place (others use the quest giver's)")
P(fails == 0 and "ALL PASSED" or (fails .. " FAILED"))
REPORT()