-- texlua hints.lua NightElf DRUID 1 casual -- A "Finish X" or "Hand in X" step with no instructions of its own shows the quest's short hint (its quest log text); -- a step with instructions gets none. 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 W.Tick(3, 3); ER.ShowTracker() 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 local function stepFor(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 HINT = "Fill the Crystal Phial at the Moonwell north of Aldrassil and bring it back to Tenaron Stormgrip." local t921 = S.QuestTitle(921) W.level = 5 table.insert(W.log, { id = 921, title = t921, level = S.QuestLevel(921), ask = HINT, objs = { { text = "Filled Crystal Phial: 0/1", done = false } } }) settle() local c, t = stepFor("C", 921), stepFor("T", 921) S.Jump(c); settle() local lines = boxLines() check(table.getn(lines) >= 2 and lines[2] == HINT, "\"Finish Crown of the Earth\" shows the quest's hint: " .. table.concat(lines, " / ")) S.Jump(t); settle() lines = boxLines() check(lines[1]:find("Hand in", 1, true) and lines[2] == HINT, "\"Hand in Crown of the Earth\" shows it too: " .. table.concat(lines, " / ")) -- a step with its own instructions ("Talk to ...") gets no hint local a = stepFor("A", 928) or stepFor("A", 921) S.Jump(a); settle() lines = boxLines() local hinted = false for _, l in ipairs(lines) do if l == HINT then hinted = true end end check(not hinted and lines[1]:find("Talk to", 1, true), "a step with its own instructions gets no hint: " .. table.concat(lines, " / ")) -- the whole route: how many Finish / hand-in steps have no instructions (they all get the quest's hint in the game) local bare, total = 0, 0 for _, it in ipairs(S.All()) do local hasQ, hasText = false, false for _, e in ipairs(it.step.elements) do if e.kind == "C" or e.kind == "T" then hasQ = true end if (e.kind == "I" or e.kind == "M" or e.kind == "U") and e.text and e.text ~= "" then hasText = true end end if hasQ then total = total + 1 if not hasText then bare = bare + 1 end end end P("note " .. S.Info().name .. ": " .. bare .. " of " .. total .. " Finish / hand-in steps have no instructions of their own") P(fails == 0 and "ALL PASSED" or (fails .. " FAILED")) REPORT()