81 lines
4.0 KiB
Lua
81 lines
4.0 KiB
Lua
-- OctoTextSize: addon-local factory; Blizzard CreateFrame is unchanged.
|
|
local CreateFrame = OctoTextSize and OctoTextSize.WrapFactory(CreateFrame) or CreateFrame
|
|
-- Read-only probe (Claude, 2026-11-22): records spellbook tabs, sample known-spell checks and skill lines a few
|
|
-- seconds after entering the world, and again when the spellbook opens. Writes only its own SavedVariable.
|
|
-- Native warrior spells Praxis knows, then Octo-custom spells that have hotfix book links but did not show.
|
|
local SAMPLE = {11567, 11585, 11574, 20569, 20230, 2457, 8690, 6603,
|
|
45584, 45961, 45595, 51602, 51, 33417, 37010, 62301, 46483, 31970, 46001, 46002, 50913, 23430, 23432, 25849}
|
|
local function safe(v)
|
|
if issecretvalue and issecretvalue(v) then return "<secret>" end
|
|
local t = type(v)
|
|
if t == "number" or t == "string" or t == "boolean" or t == "nil" then return v end
|
|
return t
|
|
end
|
|
local function call(fn, ...)
|
|
if type(fn) ~= "function" then return "<no api>" end
|
|
local ok, a, b, c, d, e, f = pcall(fn, ...)
|
|
if not ok then return "<error " .. tostring(a) .. ">" end
|
|
return a, b, c, d, e, f
|
|
end
|
|
local function snapshot(tag)
|
|
local s = {tag = tag, time = time()}
|
|
local sb = C_SpellBook or {}
|
|
local bank = Enum and Enum.SpellBookSpellBank and Enum.SpellBookSpellBank.Player
|
|
s.numLines = safe((call(sb.GetNumSpellBookSkillLines)))
|
|
s.lines = {}
|
|
if type(s.numLines) == "number" then
|
|
for i = 1, math.min(s.numLines, 40) do
|
|
local info = call(sb.GetSpellBookSkillLineInfo, i)
|
|
if type(info) == "table" then
|
|
s.lines[i] = {name = safe(info.name), items = safe(info.numSpellBookItems), offset = safe(info.itemIndexOffset),
|
|
hide = safe(info.shouldHide), skillLineID = safe(info.skillLineID), icon = safe(info.iconID)}
|
|
local entries = {}
|
|
if type(info.itemIndexOffset) == "number" and type(info.numSpellBookItems) == "number" then
|
|
for slot = info.itemIndexOffset + 1, info.itemIndexOffset + math.min(info.numSpellBookItems, 60) do
|
|
local e = call(sb.GetSpellBookItemInfo, slot, bank)
|
|
if type(e) == "table" then entries[#entries + 1] = {safe(e.spellID), safe(e.name), safe(e.itemType), safe(e.isPassive)} end
|
|
end
|
|
end
|
|
s.lines[i].entries = entries
|
|
else s.lines[i] = safe(info) end
|
|
end
|
|
end
|
|
s.spells = {}
|
|
for _, id in ipairs(SAMPLE) do
|
|
s.spells[#s.spells + 1] = {id = id, known = safe((call(sb.IsSpellKnown, id, bank))),
|
|
player = safe((call(IsPlayerSpell, id))), inBook = safe((call(sb.IsSpellInSpellBook, id, bank))),
|
|
name = safe((call(C_Spell and C_Spell.GetSpellName, id))),
|
|
texture = safe((call(C_Spell and C_Spell.GetSpellTexture, id))),
|
|
exists = safe((call(C_Spell and C_Spell.DoesSpellExist, id))),
|
|
usable = safe((call(C_Spell and C_Spell.IsSpellUsable, id)))}
|
|
end
|
|
s.skills = {}
|
|
local n = call(GetNumSkillLines)
|
|
s.numSkills = safe(n)
|
|
if type(n) == "number" then
|
|
for i = 1, math.min(n, 80) do
|
|
local name, header, _, rank, _, _, max = call(GetSkillLineInfo, i)
|
|
s.skills[i] = {safe(name), safe(header), safe(rank), safe(max)}
|
|
end
|
|
end
|
|
s.class = safe((select(2, call(UnitClass, "player"))))
|
|
s.level = safe((call(UnitLevel, "player")))
|
|
OctoSpellbookReadbackDB = OctoSpellbookReadbackDB or {}
|
|
local db = OctoSpellbookReadbackDB
|
|
db.snapshots = db.snapshots or {}
|
|
table.insert(db.snapshots, s)
|
|
while #db.snapshots > 12 do table.remove(db.snapshots, 1) end
|
|
end
|
|
local f = CreateFrame("Frame")
|
|
f:RegisterEvent("PLAYER_ENTERING_WORLD")
|
|
f:RegisterEvent("SPELLS_CHANGED")
|
|
local lastChanged = 0
|
|
f:SetScript("OnEvent", function(_, event)
|
|
if event == "PLAYER_ENTERING_WORLD" then
|
|
C_Timer.After(10, function() snapshot("login+10s") end)
|
|
elseif GetTime() - lastChanged > 20 then
|
|
lastChanged = GetTime()
|
|
C_Timer.After(2, function() snapshot("spells_changed") end)
|
|
end
|
|
end)
|