Skip to content

Latest commit

 

History

History
176 lines (118 loc) · 3.75 KB

StatManagerComponent.md

File metadata and controls

176 lines (118 loc) · 3.75 KB

Class: StatManagerComponent

Types

<ComponentProps>

See <ComponentProps>


<StatManagerComponentProps>

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;

Since v2

  • stats (optional, default []) <Array<Stat>>
  • modifiers (optional, default []) <Array<TimedModifier>>
  • indirectStatModifiers (optional, default []) <Array<IndirectStatModifier>>

Constructors

new StatManagerComponent(props)

Creates a versioned StatManager component.

import { StatManagerComponent } from 'att-string-transcoder';

const componentVersion = 2;
const component = new StatManagerComponent({ version: componentVersion });

StatManagerComponent.fromBinary(reader, version)

See Component.fromBinary(reader, version)

Properties

Note that the following properties are sorted in order of appearance when decoding component binary data.

hash

See Component.hash


name

See Component.name


version

See Component.version


stats

  • 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 `[]`

modifiers

  • 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 `[]`

indirectStatModifiers

  • 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 `[]`

Methods

toBinary(version?)

See Component.toBinary(version?)


write(writer, version?)

See Component.write(writer, version?)