api
`local Gear = require("gearStatsKit.api")`: the whole public surface of gearStatsKit. Rolling (`roll`, `rollDrop`, `describe`, `isGear`), comparing and cards (`compare`, `compareEquipped`, `equippedFor`, `card`, `cardStyles`, `setCardStyle`, `cardStyle`), sets (`setInfo`, `setBon…
gearStatsKit.api
local Gear = require("gearStatsKit.api"): the whole public surface of gearStatsKit. Rolling (roll, rollDrop, describe, isGear), comparing and cards (compare, compareEquipped, equippedFor, card, cardStyles, setCardStyle, cardStyle), sets (setInfo, setBonuses), applying (bind, autoBind, unbind, applyEquipment, refresh, totals, bonuses, bonusesOf, attackDamage, rollHit, hitEffects, mitigate, goldMultiplier, xpMultiplier, dropLuck), content (defineBase, defineAffix, defineUnique, defineSet, defineTable, defineStat, defineTheme, uniqueId, catalogue), looks (setLook, setTheme) and the HUD (setup, toggleStats). The package README lists every signature.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2strict
emit(event: string, ...: any) → void
| arg | type | description |
|---|---|---|
| event | string | |
| ... | any |
on(event: string, fn: (...any) → void
Listen on this engine: "applied" (entityId, bonuses, changed), "look" (name), "theme" (name), "stats" (open). Returns a function that stops listening.
| arg | type | description |
|---|---|---|
| event | string | |
| fn | (...any |
defineAkStats( ) → void
iconOf(itemId: string) → void
| arg | type | description |
|---|---|---|
| itemId | string |
describe(id: string) → any
Rebuild an item from its id: { id, base, name, rarity, level, slot, kind, stats, implicit, affixes = { { id, label, stat, value, mode } }, power, icon, ... }, or nil when the id is not gearStatsKit gear.
| arg | type | description |
|---|---|---|
| id | string |
isGear(id: string?) → boolean
Is this item id gearStatsKit gear?
| arg | type | description |
|---|---|---|
| id | string? |
resolver(id: string) → any
| arg | type | description |
|---|---|---|
| id | string |
roll(opts: any?) → string
Roll an item id: opts { base?, slot?, kind?, rarity?, level? (1..50), seed?, rarityWeights?, theme? }. Deterministic: the same opts and seed give the same id. Errors when nothing fits.
| arg | type | description |
|---|---|---|
| opts | any? |
rollDrop(opts: any?) → string
Roll a loot drop: opts { level, depth?, luck?, seed?, table?, theme? }. Returns an id, or nil for no drop.
| arg | type | description |
|---|---|---|
| opts | any? |
defineStat(name: string, raw: any) → any
Add or change a gear stat: { label, mode = "flat"|"percent", akStat?, akMode?, weight? }; an `akStat` abilitiesKit does not know is defined with `akDef`.
| arg | type | description |
|---|---|---|
| name | string | |
| raw | any |
compare(newId: string, oldId: string?) → any
Compare two items (old may be nil or not gear: an empty slot): { rows = { { stat, label, new, old, delta, better } }, powerDelta, verdict = "upgrade"|"downgrade"|"sidegrade" }.
| arg | type | description |
|---|---|---|
| newId | string | |
| oldId | string? |
equippedFor(slot: string, player: any?) → string
The item in an equipment slot of the local player (or `player`, a peer number or inventory entity), or nil.
| arg | type | description |
|---|---|---|
| slot | string | |
| player | any? |
compareEquipped(id: string, player: any?) → any
Compare an item against what the local player wears in that item's slot now.
| arg | type | description |
|---|---|---|
| id | string | |
| player | any? |
setLook(name: string) → boolean
Switch the card and stats panel look: fantasy, scifi, pixel, cartoon, minimal or horror.
| arg | type | description |
|---|---|---|
| name | string |
look( ) → string return S
setTheme(name: string) → boolean
Switch the affix naming theme new rolls use: fantasy ("of the Bear", "Serrated") or scifi ("Mk II", "Overclocked"), or one added with defineTheme.
| arg | type | description |
|---|---|---|
| name | string |
theme( ) → string return S
cardStyles( ) → void
Every tooltip and compare card layout, in one list: { { id, label, description } }. `Gear.setCardStyle(id)` (or the `cardStyle` field on the GearHost component, or `Gear.setup({ cardStyle })`) switches the one the HUD draws, live.
setCardStyle(id: string) → boolean
Switch the card layout the HUD and Gear.card draw (one of Gear.cardStyles()). Returns false for an unknown id.
| arg | type | description |
|---|---|---|
| id | string |
cardStyle( ) → string return S
styles( ) → void
Every look and every card style a game can pick, in ONE list: { { id, kind = "look" | "card", label, description, active } }. Ids never clash between the two kinds, so `Gear.useStyle(id)` switches either with one call.
useStyle(id: string) → string
Switch to any entry of `Gear.styles()` by its id: a look ("horror") re-skins every card and panel, a card style ("sideBySide") changes the layout. Returns the kind switched, or nil for an unknown id.
| arg | type | description |
|---|---|---|
| id | string |
setInfo(setId: string, equipment: { [string]: string }?, theme: string?) → any
A set as worn in an equipment map: { id, name, color, pieces = { { id, itemId, name, worn } }, worn, bonuses = { { count, stat, value, label, active } } }, or nil.
| arg | type | description |
|---|---|---|
| setId | string | |
| equipment | { [string]: string }? | |
| theme | string? |
setBonuses(equipment: { [string]: string }) → void
Every set with at least one piece in an equipment map: { [setId] = Gear.setInfo(...) }.
| arg | type | description |
|---|---|---|
| equipment | { [string]: string } |
localEquipment( ) → void
card(id: string, opts: any?) → any
The tooltip / comparison card for an item as a widget tree: opts { compareTo? (an id, or true for what is equipped in its slot), style? (a card style id, default Gear.cardStyle()), look?, width?, title?, hint?, id?, equipment? (the map set pieces count as worn, default the local player's) }.
| arg | type | description |
|---|---|---|
| id | string | |
| opts | any? |
catalogue( ) → any
Everything a game can choose from: { bases, affixes, rarities, stats, looks, themes, tables, version }.
bonusesOf(equipment: { [string]: string }) → void
The summed stats of every gearStatsKit item in an equipment map ({ [slot] = id }), with the bonuses of every set it wears enough pieces of.
| arg | type | description |
|---|---|---|
| equipment | { [string]: string } |
bonuses(player: any?) → void
The summed gear bonuses the local player (or `player`) wears now: { [gearStat] = value }.
| arg | type | description |
|---|---|---|
| player | any? |
idOf(e: any) → string
| arg | type | description |
|---|---|---|
| e | any |
owns(id: string) → boolean
| arg | type | description |
|---|---|---|
| id | string |
clearMods(id: string) → void
| arg | type | description |
|---|---|---|
| id | string |
applyEquipment(e: any, equipment: { [string]: string }) → void
Put the stats of an equipment map ({ [slot] = id }) on an abilitiesKit character, replacing what gearStatsKit put there before. Only the character's owner changes its stats. Returns (true, bonuses) or (false, why).
| arg | type | description |
|---|---|---|
| e | any | |
| equipment | { [string]: string } |
equipmentOf(b: any) → void
| arg | type | description |
|---|---|---|
| b | any |
signature(eq: { [string]: string }) → string
| arg | type | description |
|---|---|---|
| eq | { [string]: string } |
bind(e: any, opts: any?) → void
Bind an abilitiesKit character to the local player's equipment (attaching a Character, with no ability keys, if it has none). From then on, whenever the equipment changes, gearStatsKit swaps its modifiers. opts: { equipment = fn() -> { [slot] = id } } to read another source (tests, NPCs). Returns true, or false and why.
| arg | type | description |
|---|---|---|
| e | any | |
| opts | any? |
unbind(e: any) → void
Stop applying gear to a character and take gearStatsKit's modifiers off it.
| arg | type | description |
|---|---|---|
| e | any |
refresh(e: any?) → void
Re-apply the equipment of one bound character now (or every bound character).
| arg | type | description |
|---|---|---|
| e | any? |
bound( ) → void
The entity ids gearStatsKit applies gear to on this engine.
localCharacter( ) → any
The local player's character entity (the avatar inventoryKit dresses), or nil.
autoBind(on: boolean?) → void
Bind the local player's character automatically as soon as it exists (and again after a respawn).
| arg | type | description |
|---|---|---|
| on | boolean? |
defaultEntity(e: any?) → string
| arg | type | description |
|---|---|---|
| e | any? |
totals(e: any?) → void
The abilitiesKit stats of a character (default: the local player's), with gear applied: { [akStat] = value } for every stat the stats panel lists. Without a character, the base values plus gear bonuses.
| arg | type | description |
|---|---|---|
| e | any? |
baseTotals(e: any?) → void
The base values (without gearStatsKit's modifiers) of the stats panel's stats for a character.
| arg | type | description |
|---|---|---|
| e | any? |
attackDamage(e: any, base: number?) → number
Damage of one hit from a character: (base + weaponDamage + fire + frost + lightning damage) x abilitiesKit's damage multiplier.
| arg | type | description |
|---|---|---|
| e | any | |
| base | number? |
hitEffects(attacker: any, dealt: number, defender: any?) → any
What a landed hit does for the attacker and to it: Gear.hitEffects(attacker, dealt, defender?) -> { heal (life on hit + life steal), thorns (damage the defender's thorns deal back) }.
| arg | type | description |
|---|---|---|
| attacker | any | |
| dealt | number | |
| defender | any? |
mitigate(e: any, amount: number, element: string?) → number
Damage a character takes from a hit after its resistance to the element ("fire", "cold"/"frost", "lightning"; nil = physical, reduced by armour 100 / (100 + armour)).
| arg | type | description |
|---|---|---|
| e | any | |
| amount | number | |
| element | string? |
pctStat(e: any?, stat: string) → number
| arg | type | description |
|---|---|---|
| e | any? | |
| stat | string |
goldMultiplier(e: any?) → number return 1
Gold picked up is multiplied by this: 1 + gold find / 100 (default: the local player's character).
| arg | type | description |
|---|---|---|
| e | any? |
xpMultiplier(e: any?) → number return 1
Experience gained is multiplied by this: 1 + experience bonus / 100.
| arg | type | description |
|---|---|---|
| e | any? |
dropLuck(e: any?) → number return pctStat
The `luck` magic find gives Gear.rollDrop: magic find / 100.
| arg | type | description |
|---|---|---|
| e | any? |
rollHit(e: any, base: number?, rng: Random?) → void
Roll one hit: attackDamage, critical with critChance percent for critDamage percent. Returns (amount, crit).
| arg | type | description |
|---|---|---|
| e | any | |
| base | number? | |
| rng | Random? |
setup(opts: any?) → any
Configure gearStatsKit's HUD (and turn it on, in play): { compare (ground and inventory compare card), statsPanel, statsOpen, look, theme, hotkey ("C"), radius (metres to a ground item), autoBind, lookSwitcher, styleSwitcher (card style buttons), statsButton (a tap button for phones), hover (cards for hovered inventory slots), cardStyle (a Gear.cardStyles() id) }. Returns the settings.
| arg | type | description |
|---|---|---|
| opts | any? |
config( ) → any return table
setStatsOpen(open: boolean) → void
Open or close the character stats panel.
| arg | type | description |
|---|---|---|
| open | boolean |
isStatsOpen( ) → boolean return S
toggleStats( ) → void
inPlay( ) → boolean
_ensureHost( ) → void
Internal: start the HUD host on this engine (in play).
_step(_dt: number) → void
Internal: per-frame work (the host calls it): auto-binding and re-applying changed equipment.
| arg | type | description |
|---|---|---|
| _dt | number |
gearStatsKit front door: roll random-stat gear whose id encodes the roll, describe and compare items, register them with inventoryKit, apply equipped gear as abilitiesKit stat modifiers on the local player, five card looks and two naming themes, loot drops by tier, and the compare and stats HUD.Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.