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
110 lines
6.7 KiB
Lua
110 lines
6.7 KiB
Lua
-- SA=<pfQuest-SmartArrow dir> texlua smartarrow.lua <addon> <race> <class> 1 casual
|
|
-- Easy Route with the real pfQuest SmartArrow on the lightblade pfQuest, plain 1.12 client ("maps" mode).
|
|
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 sa = pfQuestSmartArrow
|
|
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 short(s) s = strip(s) if string.len(s) > 60 then s = string.sub(s, 1, 57) .. "..." end return s end
|
|
local function settle(n) W.Tick(0.3, n or 8) end -- SmartArrow samples every 0.25 s and solves every 1.5 s
|
|
local function own() return _G.pfQuest_xpGuideArrow end
|
|
local function wp() return sa.waypoint end
|
|
local function matches(t) local w = wp() return w and t and w.zone == SA_ZID[t.zone] and w.title == short(t.text) end
|
|
|
|
check(sa and sa.ready and pfQuestSmartArrowCompat:Mode() == "maps", "the real SmartArrow is running, plain 1.12 mode")
|
|
PLAY(20); settle()
|
|
check(ER.ArrowMode() == "smart", "Easy Route steers through SmartArrow")
|
|
check(own() and not own():IsShown(), "Easy Route's own arrow is hidden: one arrow")
|
|
local t = S.Target()
|
|
check(matches(t), "SmartArrow's waypoint is the step's place and words: " .. tostring(wp() and wp().title))
|
|
check(wp() and not wp().manual and wp().node and wp().node.arrow == true, "it is a guide waypoint (no Arrived line, words shown as written)")
|
|
check(sa.view and sa.view.title == short(t.text), "SmartArrow shows the step's words as the arrow's title")
|
|
|
|
-- follow the guide: every step, SmartArrow's waypoint is the guide's place; a route is planned
|
|
local mism, routed, total, distinct, seen = 0, 0, 0, 0, {}
|
|
for i = 1, 120 do
|
|
PLAY(4); settle(6)
|
|
local t2 = S.Target()
|
|
if t2 and SA_ZID[t2.zone] then
|
|
total = total + 1
|
|
if not matches(t2) then mism = mism + 1 end
|
|
if sa.steps and sa.view and sa.view.point then routed = routed + 1 end
|
|
local k = t2.zone .. t2.x .. t2.y
|
|
if not seen[k] then seen[k] = true; distinct = distinct + 1 end
|
|
end
|
|
if own():IsShown() and SA_ZID[(t2 or {}).zone or ""] then check(false, "own arrow showed up at step " .. i) break end
|
|
end
|
|
check(total > 50 and mism == 0, "SmartArrow followed the guide: " .. total .. " checks over " .. distinct .. " places, " .. mism .. " mismatches")
|
|
check(routed == total, "SmartArrow planned a route every time (" .. routed .. "/" .. total .. ")")
|
|
local arrived = 0
|
|
for _, p in ipairs(W.prints) do if L53.match(p, "Arrived at") then arrived = arrived + 1 end end
|
|
check(arrived == 0, "no \"Arrived at\" chat line per step (" .. arrived .. ")")
|
|
|
|
-- another zone on the same continent: SmartArrow names the way
|
|
local t3 = S.Target()
|
|
W.zone = (t3.zone == "Westfall") and "Elwynn Forest" or "Westfall"; W.x, W.y = 0.5, 0.5
|
|
W.Fire("ZONE_CHANGED_NEW_AREA"); settle(10)
|
|
check(sa.view and sa.view.action and L53.match(strip(sa.view.action), "^Go to ") , "from " .. W.zone .. " it says how to get there: " .. strip(sa.view and sa.view.action or "nil"))
|
|
W.zone = t3.zone; W.x, W.y = t3.x / 100, t3.y / 100; W.Fire("ZONE_CHANGED_NEW_AREA"); settle()
|
|
|
|
-- your own SmartArrow waypoint wins, and ours comes back when you clear it
|
|
SlashCmdList.PFQUESTSMARTARROW("way Elwynn Forest, 42 65 My spot")
|
|
settle()
|
|
check(wp() and wp().title == "My spot", "/smartarrow way: your waypoint is shown")
|
|
PLAY(10); settle()
|
|
check(wp() and wp().title == "My spot", " ...and the guide does not replace it while you play")
|
|
check(not own():IsShown(), " ...still one arrow")
|
|
SlashCmdList.PFQUESTSMARTARROW("way")
|
|
settle(); PLAY(2); settle()
|
|
check(matches(S.Target()), "clearing it brings the guide's place back")
|
|
|
|
-- a pfQuest node you click wins too
|
|
local zid = SA_ZID[W.zone]
|
|
pfMap:AddNode({ addon = "PFQUEST", zone = zid, x = 30, y = 30, title = "Clicked node", spawn = "x", description = "" })
|
|
pfMap:UpdateNodes()
|
|
local clicked = pfMap:GetNodes("PFQUEST", "Clicked node")[1]
|
|
pfQuest.route.SetTarget(clicked); pfMap:UpdateNodes()
|
|
settle(); W.Tick(0.6, 2); settle()
|
|
check(wp() == nil, "clicking a pfQuest node: the guide's waypoint steps aside")
|
|
check(sa.target and L53.match(strip(sa.target.title), "Clicked node"), " ...SmartArrow routes to the clicked node: " .. tostring(sa.target and strip(sa.target.title)))
|
|
PLAY(6); settle()
|
|
check(wp() == nil, " ...and stays aside while you play")
|
|
pfQuest.route.SetTarget(nil); pfMap:DeleteNode("PFQUEST"); pfMap:UpdateNodes()
|
|
settle(); PLAY(2); settle()
|
|
check(matches(S.Target()), "clearing the click brings the guide's place back")
|
|
|
|
-- SmartArrow switched off: the default
|
|
SlashCmdList.PFQUESTSMARTARROW("off"); settle(); PLAY(2); settle()
|
|
check(ER.ArrowMode() == nil and own():IsShown() and wp() == nil, "/smartarrow off: Easy Route's own arrow (this pfQuest has no arrow Easy Route can steer), waypoint cleared")
|
|
SlashCmdList.PFQUESTSMARTARROW("on"); settle(); PLAY(2); settle()
|
|
check(ER.ArrowMode() == "smart" and not own():IsShown() and matches(S.Target()), "/smartarrow on: back to SmartArrow")
|
|
-- pfQuest's arrow off
|
|
pfQuest_config.arrow = "0"; ER.ArrowUpdate(); settle()
|
|
check(own():IsShown() and wp() == nil, "pfQuest's arrow off (/db arrow): Easy Route's own arrow")
|
|
pfQuest_config.arrow = "1"; ER.ArrowUpdate(); settle(); PLAY(2); settle()
|
|
check(not own():IsShown() and matches(S.Target()), "on again: SmartArrow")
|
|
-- /er pfarrow
|
|
SlashCmdList.PFQUEST_XPGUIDE("pfarrow"); settle()
|
|
check(own():IsShown() and wp() == nil, "/er pfarrow: Easy Route's own arrow, waypoint released")
|
|
SlashCmdList.PFQUEST_XPGUIDE("pfarrow"); settle(); PLAY(2); settle()
|
|
check(not own():IsShown() and matches(S.Target()), "/er pfarrow again: SmartArrow")
|
|
-- a zone pfQuest knows but SmartArrow has no map for (a Turtle WoW zone, say): SetWaypoint fails, so the default
|
|
local zid2 = SA_ZID[S.Target().zone]
|
|
local saved = pfQuestSmartArrowData.zones[zid2]
|
|
pfQuestSmartArrowData.zones[zid2] = nil
|
|
SlashCmdList.PFQUEST_XPGUIDE("pfarrow"); SlashCmdList.PFQUEST_XPGUIDE("pfarrow"); W.Tick(0.6, 2); settle()
|
|
check(own():IsShown() and wp() == nil, "a zone SmartArrow cannot place: Easy Route's own arrow shows")
|
|
pfQuestSmartArrowData.zones[zid2] = saved
|
|
SlashCmdList.PFQUEST_XPGUIDE("pfarrow"); SlashCmdList.PFQUEST_XPGUIDE("pfarrow"); W.Tick(0.6, 2); settle()
|
|
check(not own():IsShown() and matches(S.Target()), " ...and SmartArrow takes over again where it can")
|
|
-- /er arrow and /er stop
|
|
SlashCmdList.PFQUEST_XPGUIDE("arrow"); settle()
|
|
check(wp() == nil, "/er arrow: the guide's waypoint is cleared")
|
|
SlashCmdList.PFQUEST_XPGUIDE("arrow"); settle(); PLAY(1); settle()
|
|
SlashCmdList.PFQUEST_XPGUIDE("stop"); settle()
|
|
check(wp() == nil and pfMap.nodes.PFQUEST_XPGUIDE == nil, "/er stop: no waypoint, no map node left")
|
|
P(fails == 0 and "ALL PASSED" or (fails .. " FAILED"))
|
|
REPORT()
|