See <ComponentProps>
A portion of the configuration object to pass to the StatManagerComponent
constructor.
type Stat = null | {
hash: number;
baseFlat: number;
};
type TimedModifier = null | {
hash: number;
value: number;
isMultiplier: boolean;
time: number;
};
type IndirectModifierSaveData = {
valueOverDurationHash: number;
baseValue: number;
duration: number;
tick: number;
};
type IndirectStatModifier = null | {
hash: number;
time: number;
modifiers: IndirectModifierSaveData[];
};
type StatManagerComponentPropsV2 = {
stats?: Stat[] | undefined;
modifiers?: TimedModifier[] | undefined;
indirectStatModifiers?: IndirectStatModifier[] | undefined;
};
type StatManagerComponentProps = StatManagerComponentPropsV2;
stats
(optional, default[]
)<Array<Stat>>
modifiers
(optional, default[]
)<Array<TimedModifier>>
indirectStatModifiers
(optional, default[]
)<Array<IndirectStatModifier>>
Creates a versioned StatManager
component.
props
<ComponentProps & StatManagerComponentProps>
Configuration of the component to create.- Returns:
<StatManagerComponent>
import { StatManagerComponent } from 'att-string-transcoder';
const componentVersion = 2;
const component = new StatManagerComponent({ version: componentVersion });
See Component.fromBinary(reader, version)
Note that the following properties are sorted in order of appearance when decoding component binary data.
See Component.hash
See Component.name
- Since:
v2
<Array<Stat>>
import { StatManagerComponent } from 'att-string-transcoder';
const componentVersion = 2;
const component = new StatManagerComponent({ version: componentVersion });
const stats = component.stats;
// `stats` is `[]`
- Since:
v2
<Array<TimedModifier>>
import { StatManagerComponent } from 'att-string-transcoder';
const componentVersion = 2;
const component = new StatManagerComponent({ version: componentVersion });
const modifiers = component.modifiers;
// `modifiers` is `[]`
- Since:
v2
<Array<IndirectStatModifier>>
import { StatManagerComponent } from 'att-string-transcoder';
const componentVersion = 2;
const component = new StatManagerComponent({ version: componentVersion });
const indirectStatModifiers = component.indirectStatModifiers;
// `indirectStatModifiers` is `[]`
See Component.toBinary(version?)