2b97a68317
Folds three previously-separate Lua addons into one for guild-member use:
- ascension-char-exporter (per-character JSON/Wiki.js Markdown via /ascx)
- CoA_SkillExporter (skills/dispels/passives catalog via /skilldump)
- CoA_TalentExporter (talent-tree catalog via /talentdumpall)
The two CoA catalog dumpers were ~90% identical entry-walkers. Pulled the
shared C_CharacterAdvancement.GetAllEntries() loop into Catalogs/Common.lua
and have Skills.lua / Talents.lua register collectors that share a single
scan pass (so /coae catalog all walks the entry list once, not twice).
Per-character collectors (Talents, Gear, Enchants, MysticScrolls,
MysticScrollProbe) and the AtlasLootAscension-derived ScrollCatalog data
are kept verbatim, just rebranded.
Slash interface:
/coae export {all|talents|gear|enchants|mdgear|mdenchants|md}
/coae catalog {all|skills|talents|dispels [class]|passives [class]|status}
/coae scrolls {scan|export|reset|status}
/coae sv on|off | debug | help
Aliases: /coaexp, /ascx, /asxc, plus legacy /skilldump /talentdumpall
/dispels /passives that map to the catalog subcommands.
SavedVariables: CoaExporterSaved, CoaExporterConfig, CoaExporterScrollCache,
CoaExporterCatalog (skills/dispels/levelPassives/talents/_meta).
59 lines
1.4 KiB
Lua
59 lines
1.4 KiB
Lua
-- Minimal JSON encoder for CoaExporter
|
|
|
|
local function escape_str(s)
|
|
s = tostring(s)
|
|
s = s:gsub('\\', '\\\\')
|
|
s = s:gsub('"', '\\"')
|
|
s = s:gsub('\n', '\\n')
|
|
s = s:gsub('\r', '\\r')
|
|
s = s:gsub('\t', '\\t')
|
|
return '"' .. s .. '"'
|
|
end
|
|
|
|
local function is_array(t)
|
|
if type(t) ~= 'table' then return false end
|
|
local n = 0
|
|
for k, _ in pairs(t) do
|
|
if type(k) ~= 'number' then return false end
|
|
n = n + 1
|
|
end
|
|
for i = 1, n do
|
|
if t[i] == nil then return false end
|
|
end
|
|
return true
|
|
end
|
|
|
|
local function encode_value(v)
|
|
local tv = type(v)
|
|
if tv == 'nil' then
|
|
return 'null'
|
|
elseif tv == 'boolean' then
|
|
return v and 'true' or 'false'
|
|
elseif tv == 'number' then
|
|
return tostring(v)
|
|
elseif tv == 'string' then
|
|
return escape_str(v)
|
|
elseif tv == 'table' then
|
|
if is_array(v) then
|
|
local parts = {}
|
|
for i = 1, #v do
|
|
parts[#parts+1] = encode_value(v[i])
|
|
end
|
|
return '[' .. table.concat(parts, ',') .. ']'
|
|
else
|
|
local parts = {}
|
|
for k, val in pairs(v) do
|
|
local key = escape_str(k)
|
|
parts[#parts+1] = key .. ':' .. encode_value(val)
|
|
end
|
|
return '{' .. table.concat(parts, ',') .. '}'
|
|
end
|
|
else
|
|
return 'null'
|
|
end
|
|
end
|
|
|
|
function CoaExporter_Json_Encode(obj)
|
|
return encode_value(obj)
|
|
end
|