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

64 lines
3.8 KiB
Lua

-- PFQ=brues texlua pfarrow.lua <addon> <race> <class> 1 casual
local here = arg[0]:match("^(.*)/") or "."
dofile(here .. "/lib.lua")
local W, ER, S, P, try = H.W, H.ER, H.S, H.P, H.try
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 ours() local f = _G.pfQuest_xpGuideArrow return f end
local function strip(s) return (L53.gsub(L53.gsub(s or "", "|c%x%x%x%x%x%x%x%x", ""), "|r", "")) end
ER.ArrowUpdate(); W.Tick(0.1, 3)
check(S.Running(), "a guide is running")
check(ours() and not ours():IsShown(), "Easy Route's own arrow is hidden")
check(PF_TARGET() ~= nil, "pfQuest's arrow has a target: " .. tostring(PF_TARGET()))
local t = S.Target()
check(t and PF_TARGET() and L53.match(strip(t.text), "^(.-)%.*$"):sub(1, 50) == PF_TARGET():sub(1, 50), "the target is the step's words")
check(pfQuest.route.worldcoords[1] and pfQuest.route.worldcoords[1][3].title == PF_TARGET(), "our node ranks first among the arrow's candidates")
check(pfQuest.route.arrow:IsShown(), "pfQuest's arrow is shown")
-- the target follows the guide: at every step pfQuest's target is Easy Route's place
local mism, distinct, seen = 0, 0, {}
for i = 1, 40 do
PLAY(4)
local t2 = S.Target()
if t2 and t2.text then
local want = strip(t2.text)
if string.len(want) > 60 then want = string.sub(want, 1, 57) .. "..." end
if PF_TARGET() ~= want then mism = mism + 1 end
if not seen[want] then seen[want] = true; distinct = distinct + 1 end
end
if ours():IsShown() then check(false, "own arrow showed up while playing") break end
end
check(mism == 0, "pfQuest's target matched the guide's place at all 40 rounds (" .. distinct .. " different places, " .. mism .. " mismatches)")
-- a node the player clicked in pfQuest is left alone when ours goes away
pfMap:AddNode({ addon = "PFQUEST", zone = "map:Elwynn Forest", x = 1, y = 1, title = "Clicked node", spawn = "x", description = "" })
local clicked = pfMap:GetNodes("PFQUEST", "Clicked node")[1]; clicked.layer = 1
pfQuest.route.SetTarget(clicked)
SlashCmdList.PFQUEST_XPGUIDE("arrow") -- hide Easy Route's arrow
W.Tick(0.1, 3)
check(PF_TARGET() == "Clicked node", "hiding the guide arrow keeps a node the player clicked")
check(pfMap.nodes.PFQUEST_XPGUIDE == nil, "our node is gone from the map after /er arrow")
SlashCmdList.PFQUEST_XPGUIDE("arrow") -- back on
W.Tick(0.1, 3)
check(PF_TARGET() ~= "Clicked node" and PF_TARGET() ~= nil, "showing it again retargets pfQuest's arrow to the guide")
check(not ours():IsShown(), "still only one arrow")
-- hiding ours releases our own target
SlashCmdList.PFQUEST_XPGUIDE("arrow"); W.Tick(0.1, 3)
check(PF_TARGET() == nil, "with the guide arrow hidden, pfQuest's arrow is given back (no Easy Route target)")
SlashCmdList.PFQUEST_XPGUIDE("arrow"); W.Tick(0.1, 3)
-- pfQuest's arrow switched off: ours takes over
pfQuest_config.arrow = "0"; ER.ArrowUpdate(); W.Tick(0.1, 3)
check(ours():IsShown(), "pfQuest arrow off (/db arrow): Easy Route's arrow shows")
pfQuest_config.arrow = "1"; ER.ArrowUpdate(); W.Tick(0.1, 3)
check(not ours():IsShown() and PF_TARGET() ~= nil, "pfQuest arrow on again: back to pfQuest's")
-- the setting
SlashCmdList.PFQUEST_XPGUIDE("pfarrow"); W.Tick(0.1, 3)
check(ours():IsShown() and PF_TARGET() == nil, "/er pfarrow: Easy Route's arrow, pfQuest's target released")
check(pfMap.nodes.PFQUEST_XPGUIDE ~= nil, " ...the place is still marked on pfQuest's map")
SlashCmdList.PFQUEST_XPGUIDE("pfarrow"); W.Tick(0.1, 3)
check(not ours():IsShown() and PF_TARGET() ~= nil, "/er pfarrow again: pfQuest's arrow")
-- stopping the guide clears everything
SlashCmdList.PFQUEST_XPGUIDE("stop"); W.Tick(0.1, 3)
check(PF_TARGET() == nil and pfMap.nodes.PFQUEST_XPGUIDE == nil, "/er stop: no Easy Route node or target left")
P(fails == 0 and "ALL PASSED" or (fails .. " FAILED"))
REPORT()