Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MerchantNPC

Hierarchy

  • NPC
    • MerchantNPC

Implements

Index

Constructors

Properties

Accessors

Methods

Object literals

Constructors

constructor

  • new MerchantNPC(id?: undefined | number, x?: number, y?: number, z?: number): MerchantNPC
  • Parameters

    • Optional id: undefined | number
    • Default value x: number = 0
    • Default value y: number = 0
    • Default value z: number = 0

    Returns MerchantNPC

Properties

ai

ai: AiType

anim

anim: number

attackAnimationEndTime

attackAnimationEndTime: number | undefined

attackAnimationType

attackAnimationType: DamageType | undefined

crafted

crafted: Record<number, ICrafted>

customization

customization: ICustomizations

deathBy

deathBy: ISerializedTranslation = Translation.message(Message.Mysteriously).serialize()

defense

defense: PlayerDefense = new PlayerDefense(0, 0)

defenses

defenses: number[] = []

Readonly entityType

entityType: NPC = EntityType.NPC

Readonly equipEffects

equipEffects: Map<EquipEffect, [LightSource, number] | [Telescopy, number, number]> = new Map<EquipEffect, EquipEffects>()

equipped

equipped: Record<number, number>

Readonly event

facingDirection

facingDirection: Cardinal | None

fromX

fromX: number

Not guaranteed to be synced between the server and client for Player entities

fromY

fromY: number

Not guaranteed to be synced between the server and client for Player entities

handToUse

handToUse: EquipType | undefined = EquipType.LeftHand

id

id: number

identifier

identifier: string

moveType

moveType: MoveType | undefined

Readonly objectType

objectType: NPC = CreationId.NPC

options

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

properties

properties: IProperties | undefined

Optional referenceId

referenceId: undefined | number

Optional renamed

renamed: string | ISerializedTranslation

restData

restData: IRestData | undefined

score

score: number = 0

seen

seen: number

skill

skill: SkillManager = new SkillManager(this, {id: () => this.id,getSkillGainMultiplier: (...args) => this.getSkillGainMultiplier(...args),canSkillGain: (...args) => this.canSkillGain(...args),onSkillGain: (...args) => this.onSkillGain(...args),})

Readonly stat

stat: Stats<this> = new Stats(this)

state

state: PlayerState = PlayerState.None

stats

stats: IStats

status

status: IStatus

stopNextMovement

stopNextMovement: boolean

swimming

swimming: boolean = false

type

type: NPCType

vehicleItemId

vehicleItemId: number | undefined

weightCapacity

weightCapacity: number

x

x: number

y

y: number

z

z: number

Static Protected registrarId

registrarId: number

Accessors

asCreature

  • get asCreature(): undefined

asEntity

asHuman

asNPC

  • get asNPC(): NPC

asPlayer

  • get asPlayer(): undefined

constructorFunction

  • get constructorFunction(): NPC

Methods

addAiType

addDelay

  • addDelay(delay: number, replace?: undefined | false | true, addStaminaDelay?: undefined | false | true): void
  • Parameters

    • delay: number
    • Optional replace: undefined | false | true
    • Optional addStaminaDelay: undefined | false | true

    Returns void

addProperty

  • addProperty(property: Property, value: any): void

animateAttack

  • animateAttack(damageType: DamageType[] | undefined): void

animateBumpTowards

  • animateBumpTowards(x: number, y: number): void
  • Faces the target and animates a bump into effect

    Parameters

    • x: number
    • y: number

    Returns void

Protected attack

  • attack(): boolean

Protected autoScaleStats

  • autoScaleStats(): void

burn

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

    Parameters

    • fireType: FireType
    • Default value skipMessage: boolean = false
    • Optional skipParry: undefined | false | true
    • Optional equipType: EquipType
    • Optional fromCombat: undefined | false | true

    Returns number | undefined

calculateEquipmentStats

  • calculateEquipmentStats(): void

Protected calculateStats

  • calculateStats(): void

canJump

  • canJump(): boolean

canSeeObject

canSeePosition

  • canSeePosition(type: CanASeeBType, tileX: number, tileY: number, tileZ: number): boolean

Protected canSkillGain

cancelResting

causeStatus

checkForGatherFire

checkForTargetInRange

  • checkForTargetInRange(range: number, includePlayers?: undefined | false | true): IMobCheck

checkUnder

createItemInInventory

damage

  • damage(damageInfoOrAmount: IDamageInfo | number): number | undefined
  • damage(damageInfoOrAmount: IDamageInfo | number, damageMessage?: Message | Translation, soundDelay?: undefined | number, causesBlood?: undefined | false | true): number | undefined

damageByInteractingWith

damageRandomEquipment

  • damageRandomEquipment(): void

discoverRecipe

  • discoverRecipe(recipeType: ItemType, crafted?: ICrafted, discoveredClientSide?: undefined | false | true): void
  • Parameters

    • recipeType: ItemType
    • Default value crafted: ICrafted = { newUnlock: true, unlockTime: Date.now() }
    • Optional discoveredClientSide: undefined | false | true

    Returns void

equip

extinguishTorches

  • extinguishTorches(): void

generateWeightCapacity

  • generateWeightCapacity(): void
  • Sets the default weightCapacity of an NPC (based on their equipment and starting items).

    Returns void

getActions

getActiveStatuses

getAndSwitchHandToUse

  • getAndSwitchHandToUse(): EquipType | undefined

Protected getApplicableStatusEffects

getAsHuman

getBarteringBonus

  • getBarteringBonus(baseCredits: number): number
  • Returns the bartering bonus for a given credit value

    Parameters

    • baseCredits: number

    Returns number

Protected getBaseStatBonuses

getBurnDamage

  • getBurnDamage(fireType: FireType, skipParry?: undefined | false | true, equipType?: EquipType): number

getConsumeBonus

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

getCraftingDifficulty

getDamage

getDamageModifier

  • getDamageModifier(): number

Protected getDefaultAiType

Protected getDefaultCustomization

Protected getDefaultEquipment

Protected getDefaultInventory

Protected getDefaultName

getEquipEffect

getEquipSlotForItem

getEquippedItem

getEquippedItems

  • getEquippedItems(): Item[]

getFacingPoint

getFacingTile

getInspectionId

  • getInspectionId(): string

getInsulation

getMaxHealth

  • getMaxHealth(): number

getMoveType

getMovementFinishTime

  • getMovementFinishTime(_timeStamp: number): number | undefined

getMovementPoint

  • getMovementPoint(timeStamp: number): IVector2

getMovementProgress

  • getMovementProgress(timeStamp: number): number

getName

getPoint

getProducedTemperature

  • getProducedTemperature(): number | undefined

getProperty

  • getProperty<T>(property: Property): T | undefined

getQualityBonus

  • getQualityBonus(item: Item | undefined): number

getRegistrarId

  • getRegistrarId(): number

getReputation

  • getReputation(): number

Protected getReputationChangeOnDeath

  • getReputationChangeOnDeath(): number

getSkillBonus

  • getSkillBonus(skillUse?: SkillType): number

Protected getSkillGainMultiplier

  • getSkillGainMultiplier(skill: SkillType): number

getStaminaDelay

  • getStaminaDelay(staminaToStartAddingDelayAt?: number): number
  • Gets a stamina penalty delay to be used for slowed actions and movement.

    Parameters

    • Default value staminaToStartAddingDelayAt: number = STAMINA_LOW_PENALTY_START

      Stat value where delays start getting added from.

    Returns number

getStatus

  • Returns the handler for this status effect, whether or not this entity currently has the effect.

    Type parameters

    Parameters

    Returns undefined | S

getStatuses

getTile

getTileUpdateType

hasDelay

  • hasDelay(): boolean

hasHandToUse

  • hasHandToUse(): boolean

hasProperty

  • hasProperty(property: Property): boolean

hasStatus

  • Returns whether the entity has the given StatusType

    Parameters

    Returns boolean

Protected initializeStats

  • initializeStats(): void
  • Returns void

isGhost

  • isGhost(): boolean

isHostile

  • isHostile(): boolean

isInFov

  • isInFov(): boolean

isLocalPlayer

  • isLocalPlayer(): boolean

isNearby

  • isNearby(entity: Entity): boolean

isOnFire

isResting

  • isResting(): boolean

isRestingCancelled

  • isRestingCancelled(): boolean

isSwimming

  • isSwimming(): boolean
  • Gets if the human is swimming (and not on a boat)

    Returns boolean

isWaiting

  • isWaiting(): boolean

kill

  • kill(): boolean
  • Returns boolean

makeHostile

  • makeHostile(): void

Protected move

  • move(): boolean
  • Returns boolean

moveTo

  • moveTo(x: number, y: number, z: number): boolean
  • Parameters

    • x: number
    • y: number
    • z: number

    Returns boolean

notifyItem

notifyStat

Protected onSkillGain

  • onSkillGain(skill: SkillType, mod: number): void

onUnserialized

  • onUnserialized(): void

Protected postMove

  • postMove(): void

Protected preMove

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

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

    Returns boolean | void | undefined

queueSoundEffect

  • queueSoundEffect(type: SfxType, delay?: number, speed?: number, noPosition?: boolean): void
  • Parameters

    • type: SfxType
    • Default value delay: number = 0
    • Default value speed: number = 1
    • Default value noPosition: boolean = false

    Returns void

queueSoundEffectInFront

  • queueSoundEffectInFront(type: SfxType, delay?: number, speed?: number, noPosition?: boolean): void
  • Parameters

    • type: SfxType
    • Default value delay: number = 0
    • Default value speed: number = 1
    • Default value noPosition: boolean = false

    Returns void

rangeAction

removeProperty

  • removeProperty(property: Property): boolean

Protected resetDefense

  • resetDefense(skipStatChangedEvent?: undefined | false | true): void
  • Parameters

    • Optional skipStatChangedEvent: undefined | false | true

    Returns void

Protected resetStatTimers

  • resetStatTimers(): void

setInFov

  • setInFov(inFov: boolean): void
  • Parameters

    • inFov: boolean

    Returns void

setMoveType

setOptions

setPaddling

  • setPaddling(paddling: boolean, itemId: number, extinguishTorches?: undefined | false | true): void
  • Parameters

    • paddling: boolean
    • itemId: number
    • Optional extinguishTorches: undefined | false | true

    Returns void

setPosition

setStatus

  • Sets whether the entity has the given StatusType. Emits EntityEvent.StatusChange.

    Parameters

    Returns void

setZ

  • setZ(z: number, updateFlowField?: boolean): void
  • Parameters

    • z: number
    • Default value updateFlowField: boolean = true

    Returns void

spawn

  • spawn(): void
  • Creates inventory, equips items, and scales stats

    Returns void

staminaReduction

  • staminaReduction(skill?: SkillType, level?: undefined | number): void

startResting

Protected statGain

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

    Parameters

    • stat: Stat
    • bypass: boolean

    Returns void

Protected swimAndSootheCheck

toString

  • toString(): string

unequip

  • unequip(item: Item): void

unequipAll

  • unequipAll(): void

update

  • update(): void

updateDirection

  • updateDirection(x: number, y: number): void

updatePaddling

  • updatePaddling(): void

updateReputation

  • updateReputation(reputation: number): void

updateStatsAndAttributes

  • updateStatsAndAttributes(): void

updateSwimming

  • updateSwimming(): void

Static getNameTranslation

Static getRegistrarId

  • getRegistrarId(): number

Static setRegistrarId

  • setRegistrarId(id: number): 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: Item[] = ([]) as Item[]

Generated using TypeDoc