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

121 lines
8.0 KiB
Lua

-- [PFUI=1] texlua plates.lua <addon> <race> <class> 1 casual
-- Nameplate markers: gold skull without pfUI, flat accent pin with pfUI; brighter for the current step's mobs.
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
PLAY(5); W.Tick(0.3, 2)
local now = {}
for n in pairs(S.TargetNames()) do table.insert(now, n) end
if not now[1] then S.TargetNames = function() return { [S.Singular("Step Wolf")] = true } end now[1] = "Step Wolf" end
local function plate(name)
local p = CreateFrame("Button", nil, WorldFrame)
CreateFrame("StatusBar", nil, p)
local fs = p:CreateFontString(nil, "ARTWORK"); fs:SetText(name)
local lv = p:CreateFontString(nil, "ARTWORK"); lv:SetText("7"); p.lv = lv
p:Show(); return p
end
-- a mob from the quest log (not the step) and, when the step has one, a mob from the step
table.insert(W.log, { id = 9999, title = "Test Quest", level = 1, objs = { { text = "Test Boar slain: 0/5", done = false, kind = "monster" } } })
local orig = GetQuestLogLeaderBoard
GetQuestLogLeaderBoard = function(j, i) local q = W.log[i] if q and q.id == 9999 then return "Test Boar slain: 0/5", "monster", false end return orig(j, i) end
local pl = plate("Test Boar")
local ps = now[1] and plate(now[1])
local pn = plate("Nobody Wanted")
W.Tick(0.3, 6)
local PF = os.getenv("PFUI") ~= nil
local m = pl.xpGuideSkull
check(m and m.kind == (PF and "pfui" or "skull"), "a quest-log mob is marked with the " .. (PF and "pfUI pin" or "gold skull") .. " (" .. tostring(m and m.kind) .. ")")
check(not pn.xpGuideSkull, "a mob nobody needs gets no marker")
if ps then
check(ps.xpGuideSkull and ps.xpGuideSkull.kind == m.kind, "the current step's mob (" .. now[1] .. ") is marked")
if PF then
local mk = ps.xpGuideSkull
check(mk.skull and L53.match(mk.skull._path or "", "IconSkull$") and mk.edge and L53.match(mk.edge._path or "", "IconSkullEdge$")
and table.getn(mk.frame._regions) == 3, " ...the pfUI marker is the smooth skull picture on its outline (plus the chain shape behind it)")
check(ps.xpGuideSkull.skull._vc[4] == 1 and pl.xpGuideSkull.skull._vc[4] < 1, " ...bright for the current step's mob, softer for the quest log's")
local function alpha(mk) for _, r in ipairs(mk.frame._regions) do if r._layer == "ARTWORK" then return r._vc and r._vc[4] end end end
P("note pin alpha: step mob " .. tostring(alpha(ps.xpGuideSkull)) .. ", quest-log mob " .. tostring(alpha(m)))
end
else P("note this step names no mob") end
ER.db.skullsOff = true; W.Tick(0.3, 2)
local hidden = PF and not pl.xpGuideSkull.frame:IsShown() or not PF
check(hidden, "skulls off hides them")
-- the marker takes the colour of its quest's chain mark in the step list
ER.db.skullsOff = nil
local q = W.log[table.getn(W.log)]
local col = { 0.1, 0.2, 0.3 }
local saved = ER.ChainColourForTitle
ER.ChainColourForTitle = function(t) if t == "Test Quest" then return col end return nil end
W.Tick(1.2, 2)
local mk = pl.xpGuideSkull
local vc = PF and mk.skull._vc or mk.tex._vc
check(vc and math.abs(vc[1] - 0.1) < 0.001 and math.abs(vc[3] - 0.3) < 0.001, "the marker takes its quest's chain colour from the step list (" .. (vc and string.format("%.2f,%.2f,%.2f", vc[1], vc[2], vc[3]) or "?") .. ")")
ER.ChainColourForTitle = function() return nil end
W.Tick(1.2, 2)
vc = PF and mk.skull._vc or mk.tex._vc
check(vc and (PF and math.abs(vc[2] - 1) < 0.001 or (not PF and math.abs(vc[2] - 0.82) < 0.001)), " ...and its usual colour when its quest is in no chain")
-- next to the level, not over the name; the level enclosed in its chain's shape
local pt = mk.ring._points and mk.ring._points[1]
local fp = mk.frame._points and mk.frame._points[1]
check(pt and pt[2] == pl.lv and pt[1] == "RIGHT" and pt[3] == "LEFT" and fp and fp[2] == mk.ring and fp[1] == "CENTER",
"the marker sits left of the mob's level (" .. tostring(pt and pt[1]) .. ")")
check(not mk.ring:IsShown(), " ...no shape round the marker when its quest is in no chain")
ER.ChainColourForTitle = function(t) if t == "Test Quest" then return col end return nil end
local savedShape = ER.ChainShapeForTitle
ER.ChainShapeForTitle = function(t) if t == "Test Quest" then return "Diamond" end return nil end
W.Tick(1.2, 2)
check(mk.ring:IsShown() and L53.match(mk.ring._path or "", "ChainDiamond$")
and mk.ring._layer == "BACKGROUND" and mk.ring:GetWidth() - mk.frame:GetWidth() <= 8 and mk.ring:GetWidth() > mk.frame:GetWidth(),
" ...its chain's shape sits behind the marker, about its size (" .. tostring(mk.ring._path) .. ", " .. mk.ring:GetWidth() .. " vs " .. mk.frame:GetWidth() .. ")")
check(mk.ring._vc and math.abs(mk.ring._vc[1] - 0.075) < 0.001, " ...in a darker shade of its chain's colour")
check(mk.edge and mk.edge._vc and mk.edge._vc[1] == 0, " ...and the marker has a thin dark border")
local gap = -pt[4]
check(gap >= 2, " ...the shape ends " .. gap .. " px before the level, not over it")
ER.ChainShapeForTitle = savedShape
ER.ChainColourForTitle = saved
-- the other markers: a sack on a mob that drops a quest item, "!" on the step's quest giver, "?" on who takes it back
local giverId, takerId = 9001, 9002
local saveQR, saveQF, saveCur, saveSide, saveDone, saveInLog = ER.QuestRow, ER.QuestFacts, S.Current, S.Side, S.ElementDone, S.InLog
local saveKnown = ER.Recorder and ER.Recorder.Known
ER.QuestRow = function(id) if id == giverId then return { g = "Giver Gus" } end return saveQR and saveQR(id) end
ER.QuestFacts = function(id)
if id == takerId then return { taker = { name = "Taker Tom" }, objectives = {} } end
if id == 9999 then return { objectives = { ["boar tusk"] = { kind = "item", sources = { { db = "units", name = "Tusk Boar" } } } } } end
return saveQF and saveQF(id)
end
if ER.Recorder then ER.Recorder.Known = function() local t = saveKnown and saveKnown() or {} t["Test Quest"] = { pfid = 9999 } return t end end
local saveTitle = S.QuestTitle
S.QuestTitle = function(id) if id == giverId then return "Giver Quest" elseif id == takerId then return "Taker Quest" end return saveTitle(id) end
local step = { n = 1, flags = {}, text = "", elements = { { kind = "A", id = giverId }, { kind = "T", id = takerId } } }
S.Current = function() return step end
S.Side = function() return {} end
S.ElementDone = function() return nil end
S.InLog = function(id) if id == takerId then return { complete = true } end return saveInLog(id) end
GetQuestLogLeaderBoard = function(j, i) local q = W.log[i] if q and q.id == 9999 then return "Boar Tusk: 0/5", "item", false end return orig(j, i) end
local pc, pg, pt2 = plate("Tusk Boar"), plate("Giver Gus"), plate("Taker Tom")
W.Tick(1.2, 2)
local function pic(pp) local m = pp.xpGuideSkull return m and m.tex._path or "none" end
check(L53.match(pic(pc), "IconBag$"), "a mob that drops a quest item gets the sack (" .. pic(pc) .. ")")
check(L53.match(pic(pg), "IconBang$"), "the step's quest giver gets \"!\" (" .. pic(pg) .. ")")
check(L53.match(pic(pt2), "IconQuery$"), "who takes the quest back gets \"?\" (" .. pic(pt2) .. ")")
local ok3 = true
for _, pp in ipairs({ pc, pg, pt2 }) do
local m = pp.xpGuideSkull
local rp, fp = m and m.ring._points[1], m and m.frame._points[1]
if not (m and L53.match(m.edge._path or "", "Edge$") and rp and rp[2] == pp.lv and fp and fp[2] == m.ring) then ok3 = false end
end
check(ok3, " ...each left of the level, with a dark outline, the shape's place the same as the skull's")
ER.ChainShapeForTitle = function(t) return "Circle" end
ER.ChainColourForTitle = function(t) return col end
W.Tick(1.2, 2)
local m3 = pg.xpGuideSkull
check(m3.ring:IsShown() and L53.match(m3.ring._path or "", "ChainCircle$"), " ...and their chain's shape behind them")
S.QuestTitle = saveTitle
ER.QuestRow, ER.QuestFacts, S.Current, S.Side, S.ElementDone, S.InLog = saveQR, saveQF, saveCur, saveSide, saveDone, saveInLog
if ER.Recorder then ER.Recorder.Known = saveKnown end
ER.ChainShapeForTitle, ER.ChainColourForTitle = savedShape, saved
P(fails == 0 and "ALL PASSED" or (fails .. " FAILED"))
REPORT()