Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IPlayerEvents

Hierarchy

Index

Methods

calculateEquipmentStats

  • calculateEquipmentStats(): any

canAttack

  • canAttack(weapon: Item | undefined, attackType: AttackType): boolean | undefined
  • Called before an npc attacks

    Parameters

    • weapon: Item | undefined

      The weapon used to attack

    • attackType: AttackType

      The attack type

    Returns boolean | undefined

    False if the npc cannot attack, or undefined to use the default logic

canConsumeItem

  • Called before consuming an item

    Parameters

    Returns boolean | undefined

    True if the human can consume the item (default logic isn't called, should use your own code for consumption), false if the human cannot consume the item, or undefined to use the default logic

canDropItem

  • canDropItem(item: Item, tile: ITile, dropAll: boolean, dropAllQuality: Quality | undefined): boolean | undefined
  • Called when an item is being dropped

    Parameters

    • item: Item

      The item to be dropped

    • tile: ITile

      The tile the item will be dropped on

    • dropAll: boolean

      True if all items of this type will be dropped

    • dropAllQuality: Quality | undefined

      If not undefined, all items of this quality will be dropped

    Returns boolean | undefined

    True if the item can be dropped, false if the item can not be dropped, or undefined to use the default logic

changeZ

  • changeZ(z: number, oldZ: number): any
  • Parameters

    • z: number
    • oldZ: number

    Returns any

created

  • created(): void
  • Called when the entity is created in the game Also called for players that "rejoin" the game

    Returns void

damage

  • Called when the player is damaged

    Parameters

    Returns number | void

    The amount of damage the player should take (the player will take this damage)

deregister

  • deregister(): any
  • Returns any

die

  • die(): any
  • Called when the player is killed.

    Returns any

displayMessage

  • displayMessage(message: IMessage): any
  • Called when a message is being disaplyed for a player

    Parameters

    • message: IMessage

      The message that will be displayed

    Returns any

getMaxHealth

  • getMaxHealth(maxHealth: number): number
  • Called when getting the player's maximum health

    Parameters

    • maxHealth: number

      The current max health of the player (after any other previous mods)

    Returns number

getMaxWeight

  • getMaxWeight(maxWeight: number): number
  • Called when getting the player's maximum weight

    Parameters

    • maxWeight: number

      The current max weight of the player (after any other previous mods)

    Returns number

getMovementIntent

  • Called when getting the players movement intent

    Returns IMovementIntent | undefined

    The movement intent of the player or undefined to use the default logic

getWeightOrStaminaMovementPenalty

  • getWeightOrStaminaMovementPenalty(): number | undefined
  • Called when getting the players weight or stamina movement penalty

    Returns number | undefined

    The weight/stamina movement penalty for the player or undefined to use the default logic

getWeightStatus

  • Called when getting the players weight status

    Returns WeightStatus | undefined

    The weight status of the player or undefined to use the default logic

interruptResponse

  • Called when a player responds to certain interrupts

    Parameters

    Returns void

inventoryItemAdd

  • Called when an item is added to the player's inventory

    Parameters

    • item: Item

      The item object

    • container: IContainer

      The container object the item was added to. This container might be inventory or a container within the inventory.

    Returns any

inventoryItemRemove

  • Called when an item is removed from the players inventory

    Parameters

    • item: Item

      The item object

    • container: IContainer

      The container object the item was moved to.

    Returns any

inventoryItemUpdate

  • Called when an item is moved from one container to another, while still in the players inventory.

    Parameters

    • item: Item

      The item object

    • container: IContainer

      The container object the item was moved to. This container might be inventory or a container within the inventory.

    • Optional previousContainer: IContainer

      The container object the item was moved from. This container might be inventory or a container within the inventory.

    Returns any

isSwimming

  • isSwimming(isSwimming: boolean): boolean | undefined
  • Called when checking if a human is swimming

    Parameters

    • isSwimming: boolean

      True if the human is swimming

    Returns boolean | undefined

    True if the human should be swimming, false if they should not be swimming, or undefined to use the default logic

moveComplete

  • moveComplete(): any
  • Called when the player completes a movement

    Returns any

noInput

  • noInput(): any
  • Called when no input is received

    Returns any

postMove

  • postMove(fromX: number, fromY: number, fromZ: number, fromTile: ITile, toX: number, toY: number, toZ: number, toTile: ITile): void
  • Parameters

    • fromX: number
    • fromY: number
    • fromZ: number
    • fromTile: ITile
    • toX: number
    • toY: number
    • toZ: number
    • toTile: ITile

    Returns void

preMove

  • preMove(fromX: number, fromY: number, fromZ: number, fromTile: ITile, toX: number, toY: number, toZ: number, toTile: ITile): boolean | undefined | void
  • Parameters

    • fromX: number
    • fromY: number
    • fromZ: number
    • fromTile: ITile
    • toX: number
    • toY: number
    • toZ: number
    • toTile: ITile

    Returns boolean | undefined | void

processMovement

  • processMovement(x: number, y: number): void
  • Called when the players x / y position changes

    Parameters

    • x: number

      The players x position

    • y: number

      The players y position

    Returns void

readNote

  • readNote(id: number): void
  • Called when the player has read a note.

    Parameters

    • id: number

      The id of the note that was read.

    Returns void

removed

  • removed(): void
  • Called when the entity is removed from the game

    Returns void

reregister

  • reregister(): any
  • Returns any

respawn

  • respawn(): false | void
  • Called when the player is respawned.

    Returns false | void

restEnd

  • Called when the player stops resting

    Parameters

    • restData: IRestData

      The data related to the rest event

    Returns void

restStart

  • Called when the player starts resting

    Parameters

    • restData: IRestData

      The data related to the rest event

    Returns void

restored

  • restored(): void
  • Called when the player is restored from the absent state. This means the player previously stopped playing on the server but is now playing again.

    Returns void

shouldDie

  • shouldDie(): false | void
  • Called when the player will be killed. If any handlers return false to stop the player from dying, no further handlers will be called.

    Returns false | void

    false to stop the player from dying

shouldRespawn

  • shouldRespawn(): false | void
  • Called when the player will be respawned. If any handlers return false to stop the player from respawning, no further handlers will be called.

    Returns false | void

    false to stop the player from respawning

skillChange

  • skillChange(skill: SkillType, value: number, oldValue: number): any
  • Parameters

    • skill: SkillType

      The skill that is changing

    • value: number

      The new skill value (core + bonus)

    • oldValue: number

      The previous skill value (previous core + bonus)

    Returns any

spawn

  • spawn(): any
  • Called when the player is spawned. (At the end of Player.setup)

    Returns any

statBonusChanged

  • Called when a stat changes, for any reason

    Parameters

    • stat: IStat

      An IStat object, the stat that was affected

    • Optional oldValue: undefined | number

      The value that the stat changed from

    • Optional info: IStatChangeInfo

      An IStatChangeInfo object describing why the change occurred. It will always be passed with a reason

    Returns void

statChanged

  • Called when a stat changes, for any reason

    Parameters

    • stat: IStat

      An IStat object, the stat that was affected

    • oldValue: number

      The value that the stat changed from

    • info: IStatChangeInfo

      An IStatChangeInfo object describing why the change occurred. It will always be passed with a reason

    Returns void

statMaxChanged

  • Called when a stat's max value changes, for any reason

    Parameters

    • stat: IStatMax

      An IStat object, the stat that was affected

    • Optional oldValue: undefined | number

      The value that the stat changed from

    • Optional info: IStatChangeInfo

      An IStatChangeInfo object describing why the change occurred. It will always be passed with a reason

    Returns void

statTimerChanged

  • statTimerChanged(stat: IStat, oldValue?: undefined | number): void
  • Called when a stat timer changes

    Parameters

    • stat: IStat

      An IStat object, the stat that was affected

    • Optional oldValue: undefined | number

      The value that the stat changed from

    Returns void

statTimerRemoved

  • statTimerRemoved(stat: IStat): any
  • Called when a stat timer is removed

    Parameters

    • stat: IStat

      An IStat object, the stat that was affected

    Returns any

statTimerWillChange

  • Called when a stat timer will change

    Parameters

    • stat: IStat

      An IStat object, the stat that will be affected

    • changeFactory: StatChangeTimerFactory

      An object for manipulating how the new stat change timer will be set

    Returns false | undefined

    false to cancel the stat timer change, undefined otherwise.

statusChange

  • Called when this entity gets or loses a status effect

    Parameters

    • status: StatusType

      The type of status effect that was gained or lost

    • hasStatus: boolean

      Whether the entity now has the status effect

    • reason: StatusEffectChangeReason

      The reason for the change

    Returns void

tickEnd

  • tickEnd(): any
  • Called when the player tick ends

    Returns any

tickStart

  • tickStart(): any
  • Called when the player tick starts

    Returns any

updateOption

  • updateOption<O>(key: O, value: IOptions[O]): any
  • Type parameters

    Parameters

    • key: O

      The key of IOptions that was changed on this player

    • value: IOptions[O]

      The value this key was set to

    Returns any

walkPathChange

  • walkPathChange(walkPath: IVector2[] | undefined): any
  • Called when the walk path of the player changes.

    Parameters

    Returns any

writeNote

  • writeNote(note: INote): false | void
  • Called when the player will write a note.

    Parameters

    • note: INote

      The note that will be written.

    Returns false | void

    false if the note should be cancelled

writtenNote

  • writtenNote(id: number): void
  • Called when the player has written a note.

    Parameters

    • id: number

      The id of the note that was written.

    Returns void

Generated using TypeDoc