Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Player

Hierarchy

Implements

Index

Constructors

Properties

Methods

Object literals

Constructors

constructor

Properties

Optional IStatBase

IStatBase: any

Protected _fovMaxRadius

_fovMaxRadius: number = lineOfSightMaxRadius

Protected _fovRadius

_fovRadius: number = lineOfSightRadius

Protected _movementFinishTime

_movementFinishTime: number | undefined

absentLastUsedTime

absentLastUsedTime: number = 0

anim

anim: number

canSendMessage

canSendMessage: boolean = false

containerSortInfo

containerSortInfo: object

Type declaration

customization

customization: IPlayerCustomization

deathBy

deathBy: string = messages[Message.Mysteriously]

defense

defense: PlayerDefense = new PlayerDefense(0, 0, new Resistances(DamageType.Blunt, 0, DamageType.Piercing, 0, DamageType.Fire, 0, DamageType.Slashing, 0), new Vulnerabilities(DamageType.Blunt, 0, DamageType.Piercing, 0, DamageType.Fire, 0, DamageType.Slashing, 0))

defenses

defenses: number[] = []

dialogContainerInfo

dialogContainerInfo: IDialogInfo[] = []

dialogInfo

dialogInfo: object

Type declaration

entityType

entityType: Player = EntityType.Player

equipped

equipped: object

Type declaration

  • [index: number]: number

exploredMap

exploredMap: IExploreMap[] | undefined

exploredMapEncodedData

exploredMapEncodedData: number[][]

facingDirection

facingDirection: Direction

fromX

fromX: number

fromY

fromY: number

handToUse

handToUse: EquipType = EquipType.LeftHand

hintSeen

hintSeen: boolean[] = []

id

id: number

identifier

identifier: string

isConnecting

isConnecting: boolean = false

isMoving

isMoving: boolean = false

isMovingClientside

isMovingClientside: boolean = false

lightBonus

lightBonus: number = 0

messages

messages: MessageManager

moveType

moveType: MoveType | undefined

movementComplete

movementComplete: boolean = false

movementCompleteZ

movementCompleteZ: number | undefined = undefined

movementFinishTime

movementFinishTime: number = 0

movementProgress

movementProgress: number = 1

name

name: string

nextMoveDirection

nextMoveDirection: Direction | undefined

nextMoveTime

nextMoveTime: number = 0

nextProcessInput

nextProcessInput: number = 0

nextX

nextX: number = -1

nextY

nextY: number = -1

noInputReceived

noInputReceived: boolean = false

notes

options

options: IOptions = Objects.deepClone(SaveDataGlobal.defaultOptions)

properties

properties: IProperties | undefined

quickSlotInfo

quickSlotInfo: IQuickSlotInfo[] = []

raft

raft: number | undefined

realTimeTickActionDelay

realTimeTickActionDelay: number = 0

Optional renamed

renamed: string

restData

restData: IRestData | undefined

revealedItems

revealedItems: object

Type declaration

  • [index: number]: boolean

score

score: number = 0

skills

skills: ISkillSet = skillSet()

spawnPoint

spawnPoint: IVector3 = {} as IVector3

state

state: PlayerState = PlayerState.None

stats

stats: IStats

status

status: IStatus

stopNextMovement

stopNextMovement: boolean

swimming

swimming: boolean = false

tamedCreatures

tamedCreatures: number[] = []

travelData

travelData: IPlayerTravelData | undefined

turns

turns: number = 0

walkPath

walkPath: IVector2[] | undefined

walkSoundCounter

walkSoundCounter: number = 4

wasAbsentPlayer

wasAbsentPlayer: boolean = false

x

x: number

y

y: number

z

z: number

Methods

addDelay

  • addDelay(delay: Delay, replace?: boolean): void
  • Parameters

    • delay: Delay
    • Optional replace: boolean

    Returns void

addMilestone

burn

  • burn(skipMessage?: boolean, skipParry?: boolean, equipType?: EquipType, fromCombat?: boolean): number | undefined
  • Burn the player

    Parameters

    • Default value skipMessage: boolean = false
    • Optional skipParry: boolean
    • Optional equipType: EquipType
    • Optional fromCombat: boolean

    Returns number | undefined

calculateEquipmentStats

  • calculateEquipmentStats(): void

Protected calculateStats

  • calculateStats(): void

canJump

  • canJump(): boolean
  • Returns boolean

cancel

  • cancel(events: string | number | Array<string | number>): this
  • cancel(events: string | number | Array<string | number>, cb: function): this
  • Removes all event handlers for the given event(s).

    Parameters

    • events: string | number | Array<string | number>

    Returns this

  • Removes the given event handler for the given event(s).

    Parameters

    • events: string | number | Array<string | number>
    • cb: function
        • (emitter: this, ...data: any[]): any
        • Parameters

          • emitter: this
          • Rest ...data: any[]

          Returns any

    Returns this

cancelAll

  • cancelAll(): this

cancelResting

checkAndRemoveBlood

  • checkAndRemoveBlood(): boolean

checkForGather

  • checkForGather(): IDoodad | undefined

checkForGatherFire

  • checkForGatherFire(): string | undefined

checkForStill

  • checkForStill(): boolean

checkForTargetInRange

  • checkForTargetInRange(range: number, includePlayers?: boolean): IMobCheck

checkReputationMilestones

  • checkReputationMilestones(): void

checkSkillMilestones

  • checkSkillMilestones(): void

checkUnder

  • checkUnder(inFacingDirection?: boolean, autoActions?: boolean, enterCave?: boolean, forcePickUp?: boolean, skipDoodadEvents?: boolean): void
  • Parameters

    • Optional inFacingDirection: boolean
    • Optional autoActions: boolean
    • Default value enterCave: boolean = true
    • Default value forcePickUp: boolean = false
    • Default value skipDoodadEvents: boolean = false

    Returns void

checkWeight

  • checkWeight(): void

createItemInInventory

damage

  • damage(damageInfoOrAmount: IDamageInfo | number, damageMessage?: string, soundDelay?: number, causesBlood?: boolean): number | undefined
  • Parameters

    • damageInfoOrAmount: IDamageInfo | number
    • Optional damageMessage: string
    • Default value soundDelay: number = 0
    • Default value causesBlood: boolean = true

    Returns number | undefined

damageRandomEquipment

  • damageRandomEquipment(): void

equip

  • equip(item: IItem, slot: EquipType, internal?: boolean, switchingHands?: boolean): void
  • Parameters

    • item: IItem
    • slot: EquipType
    • Default value internal: boolean = false
    • Default value switchingHands: boolean = false

    Returns void

faceDirection

  • faceDirection(direction: Direction, ignoreTurnDelay?: boolean): boolean
  • Parameters

    • direction: Direction
    • Optional ignoreTurnDelay: boolean

    Returns boolean

getConsumeBonus

  • getConsumeBonus(item: IItem | undefined, skillUse: SkillType | undefined): number

getDamageModifier

  • getDamageModifier(): number

getDefaultCarveTool

  • getDefaultCarveTool(): IItem | undefined

getDialogInfo

  • getDialogInfo(dialogIndex: string | number): IDialogInfo

getEquipSlotForItem

getEquippedItem

getEquippedItems

  • getEquippedItems(): IItem[]

getHandToUse

getInspectHealthMessage

getMaxHealth

  • getMaxHealth(): number
  • Gets the max health of the player.

    Returns the result of Hook.GetPlayerMaxHealth, or the max in Stat.Health, if the result of the hook is undefined.

    Returns number

getMovementFinishTime

  • getMovementFinishTime(): number

getMovementIntent

getMovementProgress

  • getMovementProgress(): number

getName

  • getName(): string

getReputation

  • getReputation(): number

getStat

  • getStat<StatType>(stat: Stat): StatType | void

getStrength

  • getStrength(): number
  • Gets the strength of the player.

    Returns the result of Hook.GetPlayerStrength, or the max in Stat.Health, if the result of the hook is undefined.

    Used internally for Stat.Weight.max

    Returns number

getWeightMovementPenalty

  • getWeightMovementPenalty(): number

getWeightStatus

hasDelay

  • hasDelay(): boolean
  • Returns boolean

hasHandToUse

  • hasHandToUse(): boolean

hasStat

  • hasStat(stat: Stat): boolean

hasTamedCreature

  • hasTamedCreature(creature: ICreature): boolean

hasWalkPath

  • hasWalkPath(): boolean

healthSyncCheck

  • healthSyncCheck(): void

hurtHands

initStat

inspect

  • inspect(x: number, y: number, z?: number): void
  • Parameters

    • x: number
    • y: number
    • Default value z: number = this.z

    Returns void

inspectTile

isFacingCarvableTile

  • isFacingCarvableTile(): boolean

isGhost

  • isGhost(): boolean

isLocalPlayer

  • isLocalPlayer(): boolean

isResting

  • isResting(): boolean

isRestingCancelled

  • isRestingCancelled(): boolean

isServer

  • isServer(): boolean
  • Returns boolean

kill

  • kill(): void
  • Returns void

on

  • on(events: string | number | Array<string | number>, cb: function): this
  • Binds an event handler on the given event or events. If the event handler is already bound to one of the given events, does nothing.

    Parameters

    • events: string | number | Array<string | number>
    • cb: function
        • (emitter: this, ...data: any[]): any
        • Parameters

          • emitter: this
          • Rest ...data: any[]

          Returns any

    Returns this

once

  • once(event: string | number, cb: function): this
  • Binds an event handler to the given event. The event handler will be removed after the first trigger.

    Parameters

    • event: string | number
    • cb: function
        • (emitter: this, ...data: any[]): any
        • Parameters

          • emitter: this
          • Rest ...data: any[]

          Returns any

    Returns this

passTurn

  • Parameters

    Returns void

preSerializeObject

  • preSerializeObject(): void

processInput

  • processInput(): void

removeStat

  • removeStat(stat: Stat): void

Protected resetDefense

  • resetDefense(): void

resetMovementStates

  • resetMovementStates(): void

resetStatTimers

  • resetStatTimers(): void

restoreExploredMap

  • restoreExploredMap(): void

revealItem

setId

  • setId(id: number): void
  • Parameters

    • id: number

    Returns void

setPosition

setRaft

  • setRaft(itemId: number | undefined): boolean

setTamedCreatureEnemy

setZ

  • setZ(z: number): void
  • Parameters

    • z: number

    Returns void

setup

  • setup(completedMilestones: number): void
  • Parameters

    • completedMilestones: number

    Returns void

showRestInterrupt

  • showRestInterrupt(restType: RestType): void

skillGain

  • skillGain(skillType: SkillType, mod?: number, bypass?: boolean): void

staminaCheck

  • staminaCheck(): boolean

staminaReduction

  • staminaReduction(skillType: SkillType): void

startResting

Protected statGain

  • statGain(stat: StatType, bypass: boolean): void
  • Improve one of the core player stats

    Parameters

    Returns void

Protected swimCheck

  • swimCheck(): void

tick

  • tick(isPassTurn?: boolean): void
  • Parameters

    • Optional isPassTurn: boolean

    Returns void

trigger

  • trigger(event: string | number, ...data: any[]): Promise<any[]>
  • Triggers the given event with any number of arguments.

    Parameters

    • event: string | number
    • Rest ...data: any[]

    Returns Promise<any[]>

triggerSync

  • triggerSync<T>(event: string | number, ...data: any[]): T[]
  • Type parameters

    • T

    Parameters

    • event: string | number
    • Rest ...data: any[]

    Returns T[]

unequip

  • unequip(item: IItem, internal?: boolean, skipMessage?: boolean, switchingHands?: boolean): void
  • Parameters

    • item: IItem
    • Default value internal: boolean = false
    • Default value skipMessage: boolean = false
    • Default value switchingHands: boolean = false

    Returns void

unequipAll

  • unequipAll(): void

until

  • Until the given event happens, allows you to bind an event to another emitter.

    Parameters

    • event: string | number

    Returns IEmitterUntil<this>

update

  • update(): void

updateCraftTable

  • updateCraftTable(): void

updateDialogInfo

  • updateDialogInfo(dialogIndex: string | number): void
  • Parameters

    • dialogIndex: string | number

    Returns void

updateDismantleTable

  • updateDismantleTable(): void

updateMilestones

  • updateMilestones(): void

updateMovementIntent

updateQuickSlotInfo

updateReputation

  • updateReputation(reputation: number): void

updateStatsAndAttributes

  • updateStatsAndAttributes(): void

updateStatuses

  • updateStatuses(): void
  • Updates caused by status effects such as bleeding, poison, and burns.

    Returns void

updateStrength

  • updateStrength(): void
  • This needs to be called whenever the player's strength requires an update.

    Example usage includes:

    1. When max health changes. Max health is used in calculating the strength.
    2. If a mod is using the GetPlayerStrength hook and the calculation needs to be refreshed.

    Returns void

updateTables

  • updateTables(): void

updateTablesAndWeight

  • updateTablesAndWeight(): void

waitUntil

  • waitUntil(event: string | number): Promise<any[]>
  • Returns a promise that will resolve when the event is triggered.

    Parameters

    • event: string | number

    Returns Promise<any[]>

walkAlongPath

  • walkAlongPath(path: IVector2[] | undefined): void

Object literals

attackFromEquip

attackFromEquip: object

leftHand

leftHand: number = 0

rightHand

rightHand: number = 0

direction

direction: object

x

x: number = 0

y

y: number = 0

inventory

inventory: object

containedItems

containedItems: IItem[] = (new Array()) as IItemArray

weightCapacity

weightCapacity: number = Infinity

Generated using TypeDoc