649 lines
34 KiB
Lua
649 lines
34 KiB
Lua
-- OctoTextSize: addon-local factory; Blizzard CreateFrame is unchanged.
|
|
local CreateFrame = OctoTextSize and OctoTextSize.WrapFactory(CreateFrame) or CreateFrame
|
|
-- Local Forever70334 diagnostics. Does not execute catalog commands or send packets.
|
|
local addon = ...
|
|
local frame = CreateFrame("Frame")
|
|
local realmEventRegistered = pcall(frame.RegisterEvent, frame, "REALM_LIST_UPDATED")
|
|
local function plain(value)
|
|
if type(issecretvalue) == "function" and issecretvalue(value) then return nil end
|
|
local kind = type(value)
|
|
if kind == "number" or kind == "boolean" then return value end
|
|
if kind == "string" and #value <= 4096 then return value end
|
|
end
|
|
local function auraTest(command)
|
|
local text, run, phase = command:match("^aura%-test%s+([0-9]+)%s+([0-9a-f]+)%s+([a-z]+)$")
|
|
local spell = text and tonumber(text)
|
|
if not spell or spell < 1 or spell > 2147483647 or spell ~= math.floor(spell) or
|
|
not run or #run ~= 8 or (phase ~= "before" and phase ~= "active" and phase ~= "expired") then
|
|
print("GW aura-test invalid arguments"); return
|
|
end
|
|
if GatewayDiagnosticsSaved ~= nil and type(GatewayDiagnosticsSaved) ~= "table" then
|
|
print("GW aura-test invalid saved context"); return
|
|
end
|
|
local saved = GatewayDiagnosticsSaved or {}
|
|
local context = saved.nativeAuraAcceptance
|
|
if phase == "before" and (type(context) ~= "table" or context.run ~= run or context.spell ~= spell) then
|
|
context = {run = run, spell = spell, samples = {}}
|
|
elseif type(context) ~= "table" or context.run ~= run or context.spell ~= spell or type(context.samples) ~= "table" then
|
|
print("GW aura-test context mismatch"); return
|
|
end
|
|
local count = 0
|
|
for key in pairs(context.samples) do
|
|
count = count + 1
|
|
if count > 12 or type(key) ~= "number" or key < 1 or key > 12 or key ~= math.floor(key) then
|
|
print("GW aura-test invalid saved context"); return
|
|
end
|
|
end
|
|
if count ~= #context.samples then print("GW aura-test invalid saved context"); return end
|
|
if count >= 12 then print("GW aura-test sample limit"); return end
|
|
local function number(value, maximum, integral)
|
|
value = plain(value)
|
|
if type(value) ~= "number" or value ~= value or value < 0 or value > maximum or
|
|
(integral and value ~= math.floor(value)) then return nil end
|
|
return value
|
|
end
|
|
local function boolean(value)
|
|
value = plain(value)
|
|
if type(value) == "boolean" then return value end
|
|
end
|
|
local function query(owner, method, argument, sanitize)
|
|
if type(owner) ~= "table" then return nil, "unsupported" end
|
|
local ok, result, status = pcall(function()
|
|
if type(issecretvalue) == "function" and issecretvalue(owner) then return nil, "not-public" end
|
|
local callback = owner[method]
|
|
if type(callback) ~= "function" then return nil, "unsupported" end
|
|
local value
|
|
if argument == nil then value = callback() else value = callback(argument) end
|
|
if type(issecretvalue) == "function" and issecretvalue(value) then return nil, "not-public" end
|
|
if value == nil then return nil, "nil" end
|
|
return sanitize(value)
|
|
end)
|
|
if not ok then return nil, "failed" end
|
|
return result, status
|
|
end
|
|
local function crit(value)
|
|
local result = number(value, 1000)
|
|
return result, result and "ok" or "not-public"
|
|
end
|
|
-- Actual70334 Camelot PaperDollFrameStats FID7368472:559-561 calls
|
|
-- both globals without arguments. SpellDocumentation FID4637244:309
|
|
-- permits this cooldown query; UnitAuraDocumentation FID4637290:395
|
|
-- permits only non-secret player auras. Nil never proves source absence.
|
|
local sample = {phase = phase}
|
|
sample.meleeCrit, sample.meleeCritStatus = query(_G, "GetCritChance", nil, crit)
|
|
sample.spellCrit, sample.spellCritStatus = query(_G, "GetSpellCritChance", nil, crit)
|
|
sample.cooldown, sample.cooldownStatus = query(C_Spell, "GetSpellCooldown", spell, function(value)
|
|
if type(value) ~= "table" then return nil, "invalid" end
|
|
local startTime, duration, enabled = number(value.startTime, 2147483647), number(value.duration, 86400), boolean(value.isEnabled)
|
|
if not startTime or not duration or enabled == nil then return nil, "not-public" end
|
|
return {startTime = startTime, duration = duration, isEnabled = enabled}, "ok"
|
|
end)
|
|
sample.aura, sample.auraStatus = query(C_UnitAuras, "GetPlayerAuraBySpellID", spell, function(value)
|
|
if type(value) ~= "table" then return nil, "invalid" end
|
|
local id = number(value.spellId, 2147483647, true)
|
|
local duration, expiration = number(value.duration, 86400), number(value.expirationTime, 2147483647)
|
|
local applications = number(value.applications, 255, true)
|
|
if not id or not duration or not expiration or not applications then return nil, "not-public" end
|
|
if id ~= spell then return nil, "identity-mismatch" end
|
|
return {spellID = id, duration = duration, expirationTime = expiration, applications = applications}, "ok"
|
|
end)
|
|
context.samples[count + 1] = sample
|
|
saved.nativeAuraAcceptance = context; GatewayDiagnosticsSaved = saved
|
|
print("GW aura-test", phase, sample.meleeCritStatus, sample.spellCritStatus, sample.cooldownStatus, sample.auraStatus)
|
|
end
|
|
local function skillTest(command)
|
|
local skillText, run, phase = command:match("^skill%-test%s+([0-9]+)%s+([0-9a-f]+)%s+([a-z]+)$")
|
|
local skill = skillText and tonumber(skillText)
|
|
if not skill or skill < 1 or skill > 65535 or not run or #run ~= 8 or
|
|
(phase ~= "before" and phase ~= "changed" and phase ~= "restored") then
|
|
print("GW skill-test invalid arguments"); return
|
|
end
|
|
local saved = GatewayDiagnosticsSaved
|
|
local context = saved and saved.nativeSkillAcceptance
|
|
if phase == "before" then
|
|
GatewayDiagnosticsSaved = saved or {}; saved = GatewayDiagnosticsSaved
|
|
context = {run = run, skill = skill, samples = {}}
|
|
saved.nativeSkillAcceptance = context
|
|
elseif type(context) ~= "table" or context.run ~= run or context.skill ~= skill or type(context.samples) ~= "table" then
|
|
print("GW skill-test context mismatch"); return
|
|
end
|
|
if #context.samples >= 12 then print("GW skill-test sample limit"); return end
|
|
local sample = {phase = phase, status = "error"}
|
|
local api = C_SkillInfo
|
|
if type(api) ~= "table" or type(api.GetSkillLineInfoByID) ~= "function" then
|
|
sample.error = "unsupported-skill-api"
|
|
else
|
|
local ok, info = pcall(api.GetSkillLineInfoByID, skill)
|
|
if not ok then sample.error = "skill-api-call-failed"
|
|
elseif type(info) ~= "table" or (type(issecretvalue) == "function" and issecretvalue(info)) then
|
|
sample.error = "skill-api-result-unavailable"
|
|
else
|
|
local fieldsOK, rank, maxRank, modifier = pcall(function()
|
|
return plain(info.rank), plain(info.maxRank), plain(info.modifier)
|
|
end)
|
|
local function integer(value, low, high)
|
|
return type(value) == "number" and value == value and value >= low and value <= high and value == math.floor(value)
|
|
end
|
|
if fieldsOK and integer(rank, 0, 2147483647) and integer(maxRank, 0, 2147483647) and integer(modifier, -2147483648, 2147483647) then
|
|
sample.status = "ok"; sample.rank = rank; sample.maxRank = maxRank; sample.modifier = modifier
|
|
else sample.error = "skill-api-fields-not-public-integers" end
|
|
end
|
|
end
|
|
context.samples[#context.samples + 1] = sample
|
|
print("GW skill-test", phase, sample.status)
|
|
end
|
|
-- FileData requests are diagnostics, not evidence of decoded/rendered pixels.
|
|
local texturePanel
|
|
local function textureTest(command)
|
|
if command == "texture-hide" then
|
|
if texturePanel then texturePanel:Hide(); texturePanel = nil end
|
|
return
|
|
end
|
|
local looseRun, loosePath = command:match("^texture%-loose%-test ([0-9a-f]+) (interface/icons/[a-z0-9_]+%.blp)$")
|
|
local run, tail = command:match("^texture%-test ([0-9a-f]+) ([0-9 ]+)$")
|
|
local ids, seen, runtimeID = {}, {}, nil
|
|
if looseRun then
|
|
if #looseRun ~= 8 or #loosePath > 96 or type(GetFileIDFromPath) ~= "function" then
|
|
print("GW texture-test invalid loose reference"); return
|
|
end
|
|
local ok, value = pcall(GetFileIDFromPath, loosePath)
|
|
value = ok and plain(value) or nil
|
|
if type(value) ~= "number" or value ~= value or value < -2147483648 or value >= 0 or value ~= math.floor(value) then
|
|
print("GW texture-test no public negative runtime handle"); return
|
|
end
|
|
run, runtimeID, ids = looseRun, value, {loosePath, value}
|
|
else
|
|
if not run or #run ~= 8 then print("GW texture-test invalid arguments"); return end
|
|
for text in tail:gmatch("%S+") do
|
|
local id = tonumber(text)
|
|
if not id or id < 1 or id > 2147483647 or id ~= math.floor(id) or seen[id] or #ids >= 4 then
|
|
print("GW texture-test invalid arguments"); return
|
|
end
|
|
seen[id] = true; ids[#ids + 1] = id
|
|
end
|
|
end
|
|
if #ids == 0 or (GatewayDiagnosticsSaved ~= nil and type(GatewayDiagnosticsSaved) ~= "table") then
|
|
print("GW texture-test invalid context"); return
|
|
end
|
|
GatewayDiagnosticsSaved = GatewayDiagnosticsSaved or {}
|
|
local result = {run = run, samples = {}, payloadLoadedVerified = false}
|
|
if runtimeID then
|
|
result.loosePath, result.runtimeID = loosePath, runtimeID
|
|
result.runtimeHandleOnly, result.portableFileDataID = true, false
|
|
end
|
|
GatewayDiagnosticsSaved.textureProbe = result
|
|
local function query(callback, owner, wanted)
|
|
local ok, value = pcall(function()
|
|
if type(callback) ~= "function" then return nil end
|
|
local v
|
|
if owner then v = callback(owner) else v = callback() end
|
|
v = plain(v)
|
|
if wanted == "boolean" and type(v) == "boolean" then return v end
|
|
if wanted == "number" and type(v) == "number" and v == v and v >= (runtimeID and -2147483648 or 0) and v <= (runtimeID and 4294967295 or 2147483647) and v == math.floor(v) then return v end
|
|
if wanted == "string" and type(v) == "string" and #v <= 128 then return v end
|
|
end)
|
|
if ok then return value end
|
|
end
|
|
local cv = query(function() return GetCVar("overrideArchive") end, nil, "string")
|
|
if cv == "0" or cv == "1" then result.overrideArchive = cv end
|
|
if texturePanel then texturePanel:Hide() end
|
|
texturePanel = CreateFrame("Frame", nil, UIParent)
|
|
texturePanel:SetSize(260 * #ids, 280); texturePanel:SetPoint("CENTER")
|
|
texturePanel:SetFrameStrata("DIALOG")
|
|
local background = texturePanel:CreateTexture(nil, "BACKGROUND")
|
|
background:SetAllPoints(); background:SetColorTexture(0, 0, 0, 1)
|
|
for index, id in ipairs(ids) do
|
|
local texture = texturePanel:CreateTexture(nil, "OVERLAY")
|
|
texture:SetSize(240, 240); texture:SetPoint("TOPLEFT", 10 + (index - 1) * 260, -30)
|
|
local row = {id = id}
|
|
result.samples[index] = row
|
|
row.accepted = query(function() return texture:SetTexture(id) end, nil, "boolean")
|
|
row.returnedID = query(texture.GetTextureFileID, texture, "number")
|
|
row.path = query(texture.GetTextureFilePath, texture, "string")
|
|
local label = texturePanel:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
|
label:SetPoint("TOPLEFT", 10 + (index - 1) * 260, -8)
|
|
label:SetText(runtimeID and (index == 1 and "Source loose path" or "Runtime handle " .. tostring(id)) or tostring(id))
|
|
end
|
|
texturePanel:Show()
|
|
print("GW texture-test", run, #ids, "requests only; pixel loading unverified")
|
|
end
|
|
local function spellInfo(command)
|
|
local text = command:match("^spell%-info%s+([0-9]+)$")
|
|
local id = text and tonumber(text)
|
|
if not id or id < 1 or id > 2147483647 or id ~= math.floor(id) then
|
|
print("GW spell-info invalid arguments"); return
|
|
end
|
|
GatewayDiagnosticsSaved = GatewayDiagnosticsSaved or {}
|
|
local saved = GatewayDiagnosticsSaved
|
|
if type(saved.spellDefinitions) ~= "table" and saved.spellDefinitions ~= nil then
|
|
print("GW spell-info invalid saved context"); return
|
|
end
|
|
local definitions = saved.spellDefinitions or {}
|
|
local count = 0
|
|
for key in pairs(definitions) do
|
|
if type(key) ~= "number" or key < 1 or key > 2147483647 or key ~= math.floor(key) then
|
|
print("GW spell-info invalid saved context"); return
|
|
end
|
|
count = count + 1
|
|
end
|
|
if count > 16 or (definitions[id] == nil and count >= 16) then
|
|
print("GW spell-info entry limit"); return
|
|
end
|
|
local function query(method)
|
|
local api = C_Spell
|
|
if type(api) ~= "table" then return nil, "unsupported" end
|
|
local found, callback = pcall(function() return api[method] end)
|
|
if not found then return nil, "failed" end
|
|
if type(callback) ~= "function" then return nil, "unsupported" end
|
|
local ok, value = pcall(callback, id)
|
|
if not ok then return nil, "failed" end
|
|
local checked, secret = pcall(function()
|
|
return type(issecretvalue) == "function" and issecretvalue(value)
|
|
end)
|
|
if not checked or secret then return nil, "not-public" end
|
|
if value == nil then return nil, "nil" end
|
|
return value, "ok"
|
|
end
|
|
local function publicString(value, limit)
|
|
value = plain(value)
|
|
if type(value) ~= "string" or #value > limit then return nil end
|
|
return value
|
|
end
|
|
local function number(value, integral)
|
|
value = plain(value)
|
|
if type(value) ~= "number" or value ~= value or value < 0 or value > 2147483647 or
|
|
(integral and value ~= math.floor(value)) then return nil end
|
|
return value
|
|
end
|
|
local row = {}
|
|
local name, status = query("GetSpellName")
|
|
row.nameStatus = status
|
|
if status == "ok" then
|
|
local ok, result = pcall(publicString, name, 256)
|
|
if ok and result and result ~= "" then row.name = result
|
|
else row.nameStatus = "not-public" end
|
|
end
|
|
local info
|
|
info, status = query("GetSpellInfo")
|
|
row.infoStatus = status
|
|
if status == "ok" then
|
|
if type(info) ~= "table" then row.infoStatus = "invalid"
|
|
else
|
|
-- Never traverse arbitrary fields or retain the returned object.
|
|
-- Secret fields are rejected before comparison/stringification.
|
|
local ok, infoName, spellID, iconID, castTime, minRange, maxRange = pcall(function()
|
|
return publicString(info.name, 256), number(info.spellID, true),
|
|
number(info.iconID, true), number(info.castTime),
|
|
number(info.minRange), number(info.maxRange)
|
|
end)
|
|
if not ok or not infoName or infoName == "" or not spellID or not iconID or
|
|
not castTime or not minRange or not maxRange or maxRange < minRange then
|
|
row.infoStatus = "not-public"
|
|
elseif spellID ~= id or (row.name and row.name ~= infoName) then
|
|
row.infoStatus = "identity-mismatch"
|
|
else
|
|
row.name, row.spellID, row.iconID = infoName, spellID, iconID
|
|
row.castTime, row.minRange, row.maxRange = castTime, minRange, maxRange
|
|
end
|
|
end
|
|
end
|
|
local description
|
|
description, status = query("GetSpellDescription")
|
|
row.descriptionStatus = status
|
|
if status == "ok" then
|
|
local ok, result = pcall(publicString, description, 4096)
|
|
if ok and result then row.description = result
|
|
else row.descriptionStatus = "not-public" end
|
|
end
|
|
saved.spellDefinitions = definitions
|
|
definitions[id] = row
|
|
print("GW spell-info", id, row.nameStatus, row.infoStatus, row.descriptionStatus)
|
|
end
|
|
local function itemInfo(command)
|
|
local text = command:match("^item%-info%s+([0-9]+)$")
|
|
local id = text and tonumber(text)
|
|
if not id or id < 1 or id > 2147483647 or id ~= math.floor(id) then
|
|
print("GW item-info invalid arguments"); return
|
|
end
|
|
GatewayDiagnosticsSaved = GatewayDiagnosticsSaved or {}
|
|
local saved = GatewayDiagnosticsSaved
|
|
if saved.itemDefinitions ~= nil and type(saved.itemDefinitions) ~= "table" then
|
|
print("GW item-info invalid saved context"); return
|
|
end
|
|
local definitions, count = saved.itemDefinitions or {}, 0
|
|
for key in pairs(definitions) do
|
|
if type(key) ~= "number" or key < 1 or key > 2147483647 or key ~= math.floor(key) then
|
|
print("GW item-info invalid saved context"); return
|
|
end
|
|
count = count + 1
|
|
end
|
|
if count > 16 or (definitions[id] == nil and count >= 16) then
|
|
print("GW item-info entry limit"); return
|
|
end
|
|
local function number(value)
|
|
value = plain(value)
|
|
if type(value) ~= "number" or value ~= value or value < 0 or value > 4294967295 or
|
|
value ~= math.floor(value) then return nil end
|
|
return value
|
|
end
|
|
local function name(value)
|
|
value = plain(value)
|
|
if type(value) ~= "string" or value == "" or #value > 256 then return nil end
|
|
return value
|
|
end
|
|
local function first(value)
|
|
if type(issecretvalue) == "function" and issecretvalue(value) then return nil, "not-public" end
|
|
if value == nil then return nil, "nil" end
|
|
return value, "ok"
|
|
end
|
|
local function query(method, sanitize)
|
|
local api = C_Item
|
|
if type(api) ~= "table" then return nil, "unsupported" end
|
|
local found, callback = pcall(function() return api[method] end)
|
|
if not found then return nil, "failed" end
|
|
if type(callback) ~= "function" then return nil, "unsupported" end
|
|
local ok, result, status = pcall(function() return sanitize(callback(id)) end)
|
|
if not ok then return nil, "failed" end
|
|
return result, status
|
|
end
|
|
-- Original 70334 ItemDocumentation FID4637136 (lines626/659/726),
|
|
-- SHA59c5dd2f70757cdb9bc4511cb0fafe6287bbfb51d58a7389097dcbb485785af0.
|
|
-- GetItemInfo is an eighteen-value tuple, not a table. Link, descriptions,
|
|
-- bind/expansion/set/reagent values are intentionally not exported.
|
|
local info, infoStatus = query("GetItemInfo", function(itemName, _, quality, itemLevel, reqLevel,
|
|
itemType, itemSubType, maxStack, equipLoc, icon, sellPrice, classID, subclassID)
|
|
local publicName, status = first(itemName)
|
|
if status ~= "ok" then return nil, status end
|
|
local result = {name = name(publicName), quality = number(quality), itemLevel = number(itemLevel),
|
|
reqLevel = number(reqLevel), maxStack = number(maxStack), icon = number(icon),
|
|
sellPrice = number(sellPrice), classID = number(classID), subclassID = number(subclassID)}
|
|
for _, key in ipairs({"name", "quality", "itemLevel", "reqLevel", "maxStack", "icon", "sellPrice", "classID", "subclassID"}) do
|
|
if result[key] == nil then return nil, "not-public" end
|
|
end
|
|
return result, "ok"
|
|
end)
|
|
local instant, instantStatus = query("GetItemInfoInstant", function(itemID, _, itemSubType, equipLoc, icon, classID, subclassID)
|
|
local publicID, status = first(itemID)
|
|
if status ~= "ok" then return nil, status end
|
|
local result = {itemID = number(publicID), icon = number(icon), classID = number(classID), subclassID = number(subclassID)}
|
|
for _, key in ipairs({"itemID", "icon", "classID", "subclassID"}) do
|
|
if result[key] == nil then return nil, "not-public" end
|
|
end
|
|
if result.itemID ~= id then return nil, "identity-mismatch" end
|
|
return result, "ok"
|
|
end)
|
|
local inventoryType, inventoryStatus = query("GetItemInventoryTypeByID", function(value)
|
|
local result, status = first(value)
|
|
if status ~= "ok" then return nil, status end
|
|
result = number(result)
|
|
if result == nil then return nil, "not-public" end
|
|
return result, "ok"
|
|
end)
|
|
local row = {infoStatus = infoStatus, instantStatus = instantStatus, inventoryStatus = inventoryStatus}
|
|
if info then
|
|
for key, value in pairs(info) do row[key] = value end
|
|
end
|
|
if instant then
|
|
if info and (info.icon ~= instant.icon or info.classID ~= instant.classID or info.subclassID ~= instant.subclassID) then
|
|
row.instantStatus = "identity-mismatch"
|
|
else
|
|
for key, value in pairs(instant) do row[key] = value end
|
|
end
|
|
end
|
|
if inventoryStatus == "ok" then row.inventoryType = inventoryType end
|
|
-- Display the original tooltip for this one public requested ID. No line
|
|
-- traversal, item use/equip, grants or custom tooltip text. A successful
|
|
-- request does not establish that item data has finished loading.
|
|
local shown, tooltipStatus = pcall(function()
|
|
local tooltip = GameTooltip
|
|
if type(issecretvalue) == "function" and issecretvalue(tooltip) then return "not-public" end
|
|
if tooltip == nil or UIParent == nil then return "unsupported" end
|
|
for _, method in ipairs({"SetOwner", "ClearAllPoints", "SetPoint", "SetItemByID", "Show"}) do
|
|
if type(tooltip[method]) ~= "function" then return "unsupported" end
|
|
end
|
|
tooltip:SetOwner(UIParent, "ANCHOR_NONE")
|
|
tooltip:ClearAllPoints()
|
|
tooltip:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
|
|
tooltip:SetItemByID(id)
|
|
tooltip:Show()
|
|
return "requested"
|
|
end)
|
|
row.tooltipStatus = shown and tooltipStatus or "failed"
|
|
saved.itemDefinitions = definitions
|
|
definitions[id] = row
|
|
print("GW item-info", id, row.infoStatus, row.instantStatus, row.inventoryStatus, row.tooltipStatus)
|
|
end
|
|
local function bagTest(command)
|
|
local bank = command:match("^bank%-test%s+") ~= nil
|
|
local run = command:match(bank and "^bank%-test%s+([0-9a-f]+)$" or "^bag%-test%s+([0-9a-f]+)$")
|
|
if not run or #run ~= 8 then print("GW bag-test invalid arguments"); return end
|
|
if GatewayDiagnosticsSaved ~= nil and type(GatewayDiagnosticsSaved) ~= "table" then
|
|
print("GW bag-test invalid saved context"); return
|
|
end
|
|
local function number(value, maximum)
|
|
value = plain(value)
|
|
if type(value) ~= "number" or value ~= value or value < 0 or value > maximum or
|
|
value ~= math.floor(value) then return nil end
|
|
return value
|
|
end
|
|
local result = {run = run, bags = {}}
|
|
local ids = bank and {6, 7, 8, 9, 10, 11, 12} or {0, 1, 2, 3, 4}
|
|
for _, bag in ipairs(ids) do
|
|
local row = {bag = bag, slots = {}}
|
|
local ok, slots = pcall(function() return number(C_Container.GetContainerNumSlots(bag), 36) end)
|
|
if not ok or slots == nil then
|
|
row.status = ok and "not-public" or "failed"
|
|
else
|
|
row.numSlots, row.status = slots, "ok"
|
|
for slot = 1, slots do
|
|
local good, item = pcall(C_Container.GetContainerItemInfo, bag, slot)
|
|
local entry = {slot = slot}
|
|
if not good then entry.status = "failed"
|
|
elseif type(issecretvalue) == "function" and issecretvalue(item) then entry.status = "not-public"
|
|
elseif item == nil then entry.status = "empty"
|
|
elseif type(item) ~= "table" then entry.status = "invalid"
|
|
else
|
|
local public, id, count, locked, icon = pcall(function()
|
|
return number(item.itemID, 2147483647), number(item.stackCount, 2147483647),
|
|
plain(item.isLocked), number(item.iconFileID, 2147483647)
|
|
end)
|
|
if not public or not id or not count or type(locked) ~= "boolean" or not icon then
|
|
entry.status = "not-public"
|
|
else
|
|
entry.status, entry.itemID, entry.count, entry.locked, entry.icon = "ok", id, count, locked, icon
|
|
end
|
|
end
|
|
row.slots[#row.slots + 1] = entry
|
|
end
|
|
end
|
|
result.bags[#result.bags + 1] = row
|
|
end
|
|
GatewayDiagnosticsSaved = GatewayDiagnosticsSaved or {}
|
|
if bank then GatewayDiagnosticsSaved.nativeBankAcceptance = result
|
|
else GatewayDiagnosticsSaved.nativeBagAcceptance = result end
|
|
print("GW bag-test", run, "captured", #result.bags)
|
|
end
|
|
local function reputationTest(command)
|
|
local run, ids = command:match("^reputation%-test%s+([0-9a-f]+)%s+([0-9,]+)$")
|
|
if not run or #run ~= 8 then print("GW reputation-test invalid arguments"); return end
|
|
local wanted, seen = {}, {}
|
|
for token in ids:gmatch("[^,]+") do
|
|
local id = tonumber(token)
|
|
if not id or id < 1 or id > 2147483647 or seen[id] or #wanted >= 16 then print("GW reputation-test invalid IDs"); return end
|
|
seen[id] = true; wanted[#wanted + 1] = id
|
|
end
|
|
local canonical = {}
|
|
for i,id in ipairs(wanted) do canonical[i] = tostring(id) end
|
|
if table.concat(canonical, ",") ~= ids or #wanted == 0 then print("GW reputation-test invalid IDs"); return end
|
|
if GatewayDiagnosticsSaved ~= nil and type(GatewayDiagnosticsSaved) ~= "table" then return end
|
|
local saved = GatewayDiagnosticsSaved or {}
|
|
local result = saved.nativeFactionAcceptance
|
|
if type(result) ~= "table" or result.run ~= run then result = {run = run, factions = {}} end
|
|
if type(result.factions) ~= "table" then return end
|
|
local total = 0
|
|
for _ in pairs(result.factions) do total = total + 1; if total > 256 then return end end
|
|
for _,id in ipairs(wanted) do if result.factions[id] == nil then total = total + 1 end end
|
|
if total > 256 then print("GW reputation-test capture full"); return end
|
|
local countOK, count = pcall(function() return plain(C_Reputation.GetNumFactions()) end)
|
|
result.visibleCount = countOK and type(count) == "number" and count or nil
|
|
for _,id in ipairs(wanted) do
|
|
local ok, data = pcall(function() return C_Reputation.GetFactionDataByID(id) end)
|
|
local row = {requestedID = id}
|
|
if not ok then row.status = "failed"
|
|
elseif type(issecretvalue) == "function" and issecretvalue(data) then row.status = "not-public"
|
|
elseif data == nil then row.status = "missing"
|
|
elseif type(data) ~= "table" then row.status = "invalid"
|
|
else
|
|
local public = pcall(function()
|
|
for _,key in ipairs({"factionID", "name", "reaction", "currentStanding", "currentReactionThreshold", "nextReactionThreshold", "atWarWith", "isHeader", "isChild", "isCollapsed", "canToggleAtWar", "isWatched"}) do
|
|
local value = plain(data[key])
|
|
if type(value) == "number" and value == value and value >= -2147483648 and value <= 2147483647 then row[key] = value
|
|
elseif type(value) == "string" and #value <= 256 then row[key] = value
|
|
elseif type(value) == "boolean" then row[key] = value end
|
|
end
|
|
end)
|
|
row.status = public and row.factionID == id and type(row.name) == "string" and type(row.currentStanding) == "number" and "ok" or "not-public"
|
|
end
|
|
result.factions[id] = row
|
|
end
|
|
GatewayDiagnosticsSaved = saved; saved.nativeFactionAcceptance = result
|
|
print("GW reputation-test", run, "captured", #wanted)
|
|
end
|
|
local function capture()
|
|
local version, build, date, interface = GetBuildInfo()
|
|
GatewayDiagnosticsSaved = GatewayDiagnosticsSaved or {}
|
|
local saved = GatewayDiagnosticsSaved
|
|
saved.version, saved.build, saved.date, saved.interface = version, build, date, interface
|
|
saved.time = GetTime()
|
|
saved.commands = {}
|
|
if type(ConsoleGetAllCommands) == "function" then
|
|
for i, command in ipairs(ConsoleGetAllCommands()) do
|
|
if i > 4096 then break end
|
|
local row = {}
|
|
-- Metadata only: never export current CVar values, script contents or credentials.
|
|
for _, key in ipairs({"command", "help", "category", "commandType"}) do
|
|
row[key] = plain(command[key])
|
|
end
|
|
saved.commands[#saved.commands + 1] = row
|
|
end
|
|
end
|
|
saved.cvars = {}
|
|
for _, name in ipairs({"developerLog", "developerLogWriteToFile", "consoleShowDebugMessages", "consoleShowSpamMessages", "scriptErrors"}) do
|
|
if type(GetCVar) == "function" then saved.cvars[name] = plain(GetCVar(name)) end
|
|
end
|
|
saved.apis = {}
|
|
for _, name in ipairs({"ConsoleExec", "ConsoleEcho", "ConsoleGetAllCommands", "ConsoleIsActive", "GetMerchantNumItems", "GetNumTalentTabs", "GetTalentInfo", "GetNumFactions", "GetFactionInfo"}) do
|
|
saved.apis[name] = type(_G[name])
|
|
end
|
|
saved.namespaces = {}
|
|
for _, name in ipairs({"C_ClassTalents", "C_SpecializationInfo", "C_SpellBook", "C_Traits", "C_Reputation", "C_RealmList", "DeveloperConsoleMixin"}) do
|
|
local methods = {}
|
|
if type(_G[name]) == "table" then
|
|
for key, member in pairs(_G[name]) do
|
|
if type(key) == "string" and type(member) == "function" then methods[#methods + 1] = key end
|
|
end
|
|
table.sort(methods)
|
|
end
|
|
saved.namespaces[name] = methods
|
|
end
|
|
-- The stock Blizzard_GlueXML RealmList uses these exact C_RealmList calls.
|
|
-- Capture only bounded public realm metadata; never inspect account/session APIs.
|
|
saved.realms = {available = false, categories = {}}
|
|
saved.realmListEventRegistered = realmEventRegistered
|
|
local realmAPI = C_RealmList
|
|
if type(realmAPI) == "table" and type(realmAPI.GetAvailableCategories) == "function" and
|
|
type(realmAPI.GetCategoryInfo) == "function" and type(realmAPI.GetRealmsInCategory) == "function" and
|
|
type(realmAPI.GetRealmInfo) == "function" then
|
|
local ok, categories = pcall(realmAPI.GetAvailableCategories)
|
|
if ok and type(categories) == "table" and #categories <= 64 then
|
|
saved.realms.available = true
|
|
for index, categoryID in ipairs(categories) do
|
|
if index > 64 then break end
|
|
local name, tournament, invalidLocale = realmAPI.GetCategoryInfo(categoryID)
|
|
local entry = {id = plain(categoryID), name = plain(name), tournament = plain(tournament), invalidLocale = plain(invalidLocale), realms = {}}
|
|
local rows = realmAPI.GetRealmsInCategory(categoryID)
|
|
if type(rows) == "table" and #rows <= 256 then
|
|
for realmIndex, address in ipairs(rows) do
|
|
if realmIndex > 256 then break end
|
|
local info = realmAPI.GetRealmInfo(address)
|
|
if type(info) == "table" then
|
|
entry.realms[#entry.realms + 1] = {
|
|
address = plain(address), name = plain(info.name), isPvP = plain(info.isPvP),
|
|
isRP = plain(info.isRP), versionMismatch = plain(info.versionMismatch),
|
|
numCharacters = plain(info.numCharacters), populationState = plain(info.populationState),
|
|
versionMajor = plain(info.version and info.version.major),
|
|
versionMinor = plain(info.version and info.version.minor),
|
|
versionRevision = plain(info.version and info.version.revision),
|
|
}
|
|
end
|
|
end
|
|
end
|
|
saved.realms.categories[#saved.realms.categories + 1] = entry
|
|
end
|
|
end
|
|
end
|
|
-- Protected gameplay values are deliberately not serialized or stringified.
|
|
saved.consoleMessages = saved.consoleMessages or {}
|
|
saved.eventCount = saved.eventCount or 0
|
|
print("GW diagnostics catalog", #saved.commands, "build", build)
|
|
local realmCount = 0
|
|
for _, category in ipairs(saved.realms.categories) do realmCount = realmCount + #category.realms end
|
|
if type(C_Log) == "table" and type(C_Log.LogMessage) == "function" then
|
|
C_Log.LogMessage("GW_NATIVE_REALM_LIST available=" .. tostring(saved.realms.available) .. " categories=" .. #saved.realms.categories .. " realms=" .. realmCount)
|
|
for _, category in ipairs(saved.realms.categories) do
|
|
C_Log.LogMessage("GW_NATIVE_REALM_CATEGORY id=" .. tostring(category.id) .. " name=" .. tostring(category.name) .. " count=" .. #category.realms)
|
|
for _, realm in ipairs(category.realms) do
|
|
C_Log.LogMessage("GW_NATIVE_REALM address=" .. tostring(realm.address) .. " name=" .. tostring(realm.name) ..
|
|
" pvp=" .. tostring(realm.isPvP) .. " rp=" .. tostring(realm.isRP) ..
|
|
" population=" .. tostring(realm.populationState) .. " characters=" .. tostring(realm.numCharacters))
|
|
end
|
|
end
|
|
end
|
|
end
|
|
frame:RegisterEvent("ADDON_LOADED")
|
|
local ok = pcall(frame.RegisterEvent, frame, "CONSOLE_MESSAGE")
|
|
frame:SetScript("OnEvent", function(_, event, message)
|
|
if event == "ADDON_LOADED" then
|
|
if message == addon then capture(); GatewayDiagnosticsSaved.consoleEventRegistered = ok end
|
|
return
|
|
end
|
|
if event == "REALM_LIST_UPDATED" then capture(); return end
|
|
local saved = GatewayDiagnosticsSaved
|
|
if not saved then return end
|
|
saved.eventCount = saved.eventCount + 1
|
|
-- Capture only these public discovery headers. Never subscribe to raw auth/log content.
|
|
message = plain(message)
|
|
if type(message) == "string" and (message:match("^Console help categories:") or message:match("^Commands registered for the category")) then
|
|
local messages = saved.consoleMessages
|
|
if #messages < 128 then messages[#messages + 1] = {time = GetTime(), message = message} end
|
|
end
|
|
end)
|
|
SLASH_GATEWAYDIAGNOSTICS1 = "/gwdiag"
|
|
SlashCmdList.GATEWAYDIAGNOSTICS = function(command)
|
|
command = plain(command)
|
|
if type(command) ~= "string" or #command > 128 then print("GW diagnostics invalid arguments"); return end
|
|
if command:match("^texture%-test") or command:match("^texture%-loose%-test") or command == "texture-hide" then
|
|
textureTest(command)
|
|
elseif command:match("^reputation%-test") then
|
|
reputationTest(command)
|
|
elseif command:match("^aura%-test") then
|
|
auraTest(command)
|
|
elseif command:match("^skill%-test") then
|
|
skillTest(command)
|
|
elseif command:match("^spell%-info") then
|
|
spellInfo(command)
|
|
elseif command:match("^item%-info") then
|
|
itemInfo(command)
|
|
elseif command:match("^bag%-test") or command:match("^bank%-test") then
|
|
bagTest(command)
|
|
elseif command == "console" then
|
|
capture()
|
|
-- Execute only a confirmed read-only command, never arbitrary slash input.
|
|
if type(ConsoleExec) == "function" then ConsoleExec("help console") end
|
|
elseif command == "health" then
|
|
print("GW health", UnitHealth("player"), UnitHealthMax("player"), UnitHealth("target"))
|
|
else
|
|
capture()
|
|
end
|
|
end
|