Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Item

Hierarchy

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

  • Parameters

    • Optional itemType: ItemType | undefined
    • Default value quality: Quality = Quality.Random
    • Optional human: Human

    Returns Item

Properties

Optional [SYMBOL_CONTAINER_CACHED_REFERENCE]

[SYMBOL_CONTAINER_CACHED_REFERENCE]: ContainerReference

Optional book

book: BookType

Optional constructedFrom

constructedFrom: IConstructedInfo

containedItems

containedItems: Item[] | undefined

containedWithin

containedWithin: IContainer | undefined

Optional decay

decay: undefined | number

disassembly

disassembly: Item[]

Optional driverId

driverId: undefined | number

Optional equippedId

equippedId: undefined | number

Optional equippedType

equippedType: EntityType

Readonly event

event: IEventEmitter<this, IItemEvents> = new EventEmitter<this, E>(this)

Optional fireStage

fireStage: FireStage

Optional fromX

fromX: undefined | number

Optional fromY

fromY: undefined | number

id

id: number

Optional itemOrders

itemOrders: number[]

magic

magic: MagicalPropertyManager = new MagicalPropertyManager()

map

map: ItemMapManager = new ItemMapManager()

maxDur

maxDur: number

minDur

minDur: number

Readonly objectType

objectType: Item = CreationId.Item

Optional offsetX

offsetX: undefined | number

Optional offsetY

offsetY: undefined | number

order

order: number

Optional ownerIdentifier

ownerIdentifier: undefined | string

pid

pid: number | null | undefined

Optional protected

protected: undefined | false | true

quality

quality: Quality | undefined

quickSlot

quickSlot: number | undefined

Optional referenceId

referenceId: undefined | number

renamed

renamed: string | ISerializedTranslation | undefined

Optional startingDecay

startingDecay: undefined | number

Optional tradedFrom

tradedFrom: string[]

type

type: ItemType

Optional used

used: IItemUsed

weight

weight: number

weightFraction

weightFraction: number

Methods

acquireNotify

  • acquireNotify(player: Player): void
  • Parameters

    Returns void

addMagicalProperties

  • addMagicalProperties(count: number): boolean
  • Parameters

    • count: number

    Returns boolean

addMagicalProperty

canBeRefined

  • canBeRefined(): boolean
  • Returns boolean

canBurnPlayer

  • canBurnPlayer(): boolean
  • Returns boolean

canDecay

  • canDecay(): undefined | number
  • Returns the maximum decay of an item, or undefined if the item does not have the decayMax property.

    Returns undefined | number

    A number or undefined.

changeInto

  • changeInto(type: ItemType, disableNotify?: undefined | false | true, emitTransformation?: boolean): void
  • Parameters

    • type: ItemType
    • Optional disableNotify: undefined | false | true
    • Default value emitTransformation: boolean = true

    Returns void

clearQuickSlot

  • clearQuickSlot(): void
  • Returns void

createOnBreak

  • createOnBreak(x: number, y: number, z: number): void
  • Parameters

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

    Returns void

damage

  • damage(source: string, modifier?: undefined | number): void
  • Parameters

    • source: string
    • Optional modifier: undefined | number

    Returns void

description

dropInWater

  • dropInWater(human: Human, x?: undefined | number, y?: undefined | number, skipParticles?: undefined | false | true): void
  • Parameters

    • human: Human
    • Optional x: undefined | number
    • Optional y: undefined | number
    • Optional skipParticles: undefined | false | true

    Returns void

extinguish

  • extinguish(player: Player | NPC | undefined): void
  • Extinguishes to item if it is lit.

    Parameters

    • player: Player | NPC | undefined

      Player or NPC entity that is carrying the item to extinguish.

    Returns void

getBaseDefense

  • getBaseDefense(): number
  • Returns number

getBaseTemperature

  • getBaseTemperature(): undefined | number

getContainerInsulation

  • getContainerInsulation(type: TempType): number
  • Parameters

    Returns number

getContainerWeightReduction

  • getContainerWeightReduction(): number
  • Returns the container weight reduction

    Returns number

    1 if there is no reducton or [-50% + magical storing values]

getDamageModifier

  • getDamageModifier(): number
  • Gets the item's damage modifier which certain special items have so they can have high durability for use, but normal damage ranges.

    Returns number

getDamageTypesForSkill

  • Returns the damage types associated with a skill with a fallback for whatever damage types the item normally provides

    Parameters

    • skillType: SkillType

      The skill to get default damage types from

    Returns DamageType[] | undefined

getDecayAtStart

  • getDecayAtStart(): number
  • Returns number

getDecayRate

  • getDecayRate(isClientSide: boolean): number
  • Parameters

    • isClientSide: boolean

    Returns number

getDisassemblyItems

getDisassemblyWeight

  • getDisassemblyWeight(): number
  • Returns number

getDurabilityCharge

  • getDurabilityCharge(): number
  • Returns number

getEquipSlot

  • Returns EquipType | undefined

getEquipmentInsulation

  • getEquipmentInsulation(type: TempType): number
  • Parameters

    Returns number

getEquippedPlayer

  • getEquippedPlayer(): Human | undefined
  • Returns Human | undefined

getInheritItemRecipeSkill

  • Gets the inherit item type.

    Returns SkillType

getItemUseBonus

  • Gets the item's quality and action level (how good it is at doing the action).

    Parameters

    • action: ActionType

      The ActionType you are trying to get the level for.

    Returns number

    A number (possibly 0 if no quality or action level).

getMagicalPropertyInfo

getMaxDecay

  • getMaxDecay(overrideDefault?: undefined | number, withRandomization?: undefined | false | true): number
  • Gets the item's max decay value based on quality. The max number can be modified slightly due to overrideDefault (crafting) and adding fuel which goes over this max.

    Parameters

    • Optional overrideDefault: undefined | number

      Override the item's decayMax definition with something else.

    • Optional withRandomization: undefined | false | true

      True if you want to return a randomized value (useful when setting the value on an item).

    Returns number

    A number equal to the maximum item decay or 0 if the item should not have decay at all.

getMovementProgress

  • getMovementProgress(timeStamp: number): number
  • Parameters

    • timeStamp: number

    Returns number

getName

  • getName(article?: undefined | false | true, count?: undefined | number, showCount?: boolean, showQuality?: boolean, showRenamedQuotes?: boolean, showMagicalType?: boolean): Translation
  • Parameters

    • Optional article: undefined | false | true

      Whether to include an article for the name of the item. Uses the article rules on the language. Defaults to true.

    • Optional count: undefined | number

      The number of this item that you're getting the name of. Defaults to 1.

    • Default value showCount: boolean = false

      If true, adds the passed count to the translation, using MiscTranslation.CountThing.

    • Default value showQuality: boolean = true

      If true, shows the quality of the item.

    • Default value showRenamedQuotes: boolean = true

      If true, show the (by default) "" quotes surrounding renamed items.

    • Default value showMagicalType: boolean = true

      If true, show the magical type suffix.

      Examples:

      • item.getName() // "a stone axe"
      • item.getName(false) // "stone axe"
      • item.getName(undefined, 3) // "stone axes"

    Returns Translation

getOnUseBonus

  • getOnUseBonus(): number
  • Returns number

getPoint

  • getPoint(): any
  • Returns any

getPreservationDecayMultiplier

  • getPreservationDecayMultiplier(): number
  • Returns number

getProducedTemperature

  • getProducedTemperature(): number | undefined
  • Returns number | undefined

getRangedWeapon

  • Parameters

    Returns Item | boolean

getStokeFireBonusValue

  • getStokeFireBonusValue(): number
  • Returns number

getStokeFireValue

  • getStokeFireValue(): number | undefined
  • Returns number | undefined

getTemperatureDecayMultiplier

  • getTemperatureDecayMultiplier(isClientSide: boolean): number
  • Parameters

    • isClientSide: boolean

    Returns number

getTotalWeight

  • getTotalWeight(bypassContainer?: undefined | false | true): number
  • Parameters

    • Optional bypassContainer: undefined | false | true

    Returns number

getTraderSellPrice

  • getTraderSellPrice(player: Player | undefined, magicalWorth?: undefined | false | true): number
  • The full price the item will go for when traded to a merchant NPC. Considers modifiers and a player's bartering skill.

    Parameters

    • player: Player | undefined

      The player that is trading the item.

    • Optional magicalWorth: undefined | false | true

      Include the value of MagicalPropertyType.Worth, defaults to true

    Returns number

getValidMagicalProperties

getWeight

  • getWeight(): any
  • deprecated

    This method currently shouldn't be used in production code, as it's to do with the new crafting system. Stay tuned.

    Returns any

getWorth

  • getWorth(player: Player | undefined, magicalWorth?: boolean): number
  • Gets the worth of an item used for merchant trading. Does not consider batering or modifiers bonuses; use Item.getTraderSellPrice for that.

    Parameters

    • player: Player | undefined

      The player that is trading the item for its worth (used for durability calculations).

    • Default value magicalWorth: boolean = true

      Include the value of MagicalPropertyType.Worth, defaults to true

    Returns number

isDamaged

  • isDamaged(): boolean
  • Returns boolean

isDecayed

  • isDecayed(): boolean
  • Returns boolean

isEquipped

  • isEquipped(): boolean
  • Returns boolean

isInTradeContainer

  • isInTradeContainer(): boolean
  • Returns boolean

isMoving

  • isMoving(): boolean
  • Returns boolean

isNearby

  • isNearby(executor: Entity, allowNearby?: boolean): any
  • Parameters

    • executor: Entity
    • Default value allowNearby: boolean = true

    Returns any

isProtected

  • isProtected(): boolean
  • Returns boolean

isTransient

  • isTransient(): boolean
  • Returns boolean

isValid

  • isValid(): boolean
  • Returns boolean

moveToTile

  • Parameters

    Returns void

onUnserialized

  • onUnserialized(): void

placeOnTile

  • Parameters

    Returns boolean

postProcessDecay

  • postProcessDecay(): void
  • Returns void

rerollMagicalProperty

rerollMagicalPropertyValues

  • rerollMagicalPropertyValues(): void
  • Returns void

returns

  • returns(disableNotify?: undefined | false | true, craft?: undefined | false | true): boolean
  • Returns and item based on returnOnUseAndDecay.

    Parameters

    • Optional disableNotify: undefined | false | true

      Set to true if no notification should be shown for the new item above the player.

    • Optional craft: undefined | false | true

      Set to true when returning consumed items to check for whenCrafted property in returnOnUseAndDecay.

    Returns boolean

revertFromDoodad

  • revertFromDoodad(doodad: Doodad): void
  • Parameters

    Returns void

setDecay

  • setDecay(overrideDefault?: undefined | number): void
  • Sets the item's decay with some added randomization.

    Parameters

    • Optional overrideDefault: undefined | number

    Returns void

setMagicalChanceFromQuality

  • setMagicalChanceFromQuality(bonus?: number, propertiesBypass?: undefined | number): boolean
  • Sets the item as magical with a chance based on quality (and clears any existing magical properties)

    Parameters

    • Default value bonus: number = 1

      The number that chances get multiplied by, for example, 2 or 3

    • Optional propertiesBypass: undefined | number

      The number of magical properties to force on to the item

    Returns boolean

    True if the item has become magical

setQuality

  • setQuality(human: Human | undefined, quality?: Quality): void
  • Parameters

    Returns void

setQuickSlot

  • setQuickSlot(player: Player, quickSlot: number | undefined): void
  • Parameters

    • player: Player
    • quickSlot: number | undefined

    Returns void

setUsed

  • Parameters

    Returns void

spawnCreatureOnItem

  • spawnCreatureOnItem(creatureType: CreatureType | undefined, forceAberrant?: undefined | false | true, bypass?: undefined | false | true, preferFacingDirection?: Player): Creature | undefined
  • Parameters

    • creatureType: CreatureType | undefined
    • Optional forceAberrant: undefined | false | true
    • Optional bypass: undefined | false | true
    • Optional preferFacingDirection: Player

    Returns Creature | undefined

spawnOnDecay

  • Returns Creature | undefined

toString

  • toString(): string
  • Returns string

verifyAndFixItem

  • verifyAndFixItem(): void
  • Returns void

Generated using TypeDoc