character_build
Read owned Arcanas, equipped gear stats and the Daevanion board for build exporters and planners.
character_build combines the character's current Arcanas, equipped gear and
Daevanion board with shipped game definitions. It adds stat names, Arcana and
grade names, each open node's board position and bonus, and the full layout of
every board. Import it with require("character_build"). The definitions are
loaded from build_data the first time you call a function.
Each function accepts an optional table that replaces game, which lets you
test a script with recorded rows. Results are new tables; changing them does
not affect later reads.
Functions
character_build.arcanas()
Returns: An array of every owned Arcana, or nil, error. Each row has the
fields of game._arcana_snapshot()
plus grade_name, arcana_name and a name on every stat line. equipped is
a Lua boolean in these rows.
character_build.equipment()
Returns: Every equipped item in the same row shape, or nil, error.
character_build.daevanion()
Returns: A table, or nil, error when the open nodes cannot be read.
| Field | Meaning |
|---|---|
points | Rows with type, name, base, bonus, used, available and capacity. nil when the installed client cannot report points. |
points_error | Why points is missing, otherwise nil. |
boards | Boards with an open node, in board order: id, class, order, title_key, need_level, cost_point_type, open_nodes, spent. |
nodes | Open nodes, each a node table. |
stat_totals | Stat name to the sum of that stat over all open nodes. |
skill_levels | Skill ID to the total skill levels granted by open nodes. |
unknown_nodes | Open node IDs missing from the shipped definitions. |
character_build.node(id)
Returns: One node definition, or nil for an unknown ID: id, board,
row, col, grade, grade_name, type, type_name (Start, Stat or
SkillLevel), cost, need_level, stats (array of {name, value}), and
skill ({skill_id, level}) for skill nodes.
character_build.board_layout(board_id, open_nodes)
Parameters: A board ID and an optional set whose keys are open node IDs.
Returns: Every node of that board ordered by row and column, each with an
open flag, or nil, error for an unknown board.
character_build.export()
Returns: {catalog, arcanas, equipment, daevanion, errors}. A section that
cannot be read is nil and its message is in errors; the other sections are
still filled. catalog records the date of the shipped definitions.
character_build.stat_name(stat) and character_build.catalog()
stat_name returns the name of a stat code. catalog returns the build_data
table: stats, arcana_types, item_grades, node_types, point_types,
classes, point_capacity, boards, nodes and metadata.
Example
local build = require("character_build")
local board, err = build.daevanion()
if board == nil then
log.warn(err)
return
end
for _, entry in ipairs(board.boards) do
log.info(string.format("Board %d: %d open nodes, %d points spent",
entry.id, entry.open_nodes, entry.spent))
end
for name, total in pairs(board.stat_totals) do
log.info(name .. " +" .. total)
end
local arcanas = build.arcanas()
for _, arcana in ipairs(arcanas or {}) do
log.info(string.format("%s +%d (%s)", arcana.arcana_name, arcana.enhancement,
arcana.equipped and "equipped" or "stored"))
end