SerenityJS
    Preparing search index...

    Class PlayerLevelingTrait

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    entity: Entity

    The entity that this trait is attached to.

    identifier: string = ...

    The identifier of the trait.

    player: Player = ...

    The player that this trait is attached to.

    components: string[] = []

    The entity component identifiers that this trait is compatible with by default. If empty, the trait will not be initialized by any component.

    identifier: "leveling"

    The identifier of the trait.

    types: EntityIdentifier[] = []

    The entity type identifiers that this trait is compatible with by default.

    Accessors

    Methods

    • Sets the total experience points of the player. This will automatically calculate and set the player's level and experience progress.

      Parameters

      • amount: number

        The total amount of experience points to set.

      Returns void

    • Set the current experience progress of the player.

      Parameters

      • value: number

        The new experience progress to set for the player.

      Returns void

      Experience progress value must be between 0-1.

    • Set the current xp level of the player.

      Parameters

      • value: number

        The new level to set for the player.

      Returns void

      Will throw an error if the level is not a non-negative integer.

    • Sets the probability of this trait being randomly ticked each tick.

      Parameters

      • numerator: number

        The numerator of the probability fraction.

      • denominator: number

        The denominator of the probability fraction.

      Returns void

    • Wether this trait should be randomly ticked this tick.

      Parameters

      • factor: number = 1

        A factor to multiply the chance by. Default is 1.

      Returns boolean

      True if the trait should be randomly ticked, false otherwise.