Player()

new Player()

Properties:
Name Type Description
account Account
experience number

current experience this level

password string
prompt string

default prompt string

socket net.Socket
questTracker QuestTracker
extraPrompts Map.<string, function()>

Extra prompts to render after the default prompt

questData Object

Extends

Members

isNpc

Inherited From:

Methods

addAttribute()

Inherited From:
See:

addCombatant(target)

Parameters:
Name Type Description
target Character
Fires:
Inherited From:

addEffect(effect) → {boolean}

Parameters:
Name Type Description
effect Effect
Returns:
boolean
Inherited From:

addFollower(follower)

Parameters:
Name Type Description
follower Character
Fires:
Inherited From:

addItem(item)

Move an item to the character's inventory

Parameters:
Name Type Description
item Item
Inherited From:

addPrompt(id, renderer, removeOnRendernullable)

Add a line of text to be displayed immediately after the prompt when the prompt is displayed

Parameters:
Name Type Attributes Default Description
id string

Unique prompt id

renderer function

Function to call to render the prompt string

removeOnRender boolean <nullable>
false

When true prompt will remove itself once rendered otherwise prompt will continue to be rendered until removed.

emit(event, …args)

Proxy all events on the player to the quest tracker

Parameters:
Name Type Attributes Description
event string
args * <repeatable>
Overrides:

equip(item, slot)

Parameters:
Name Type Description
item Item
slot string

Slot to equip the item in

Fires:
Throws:
  • EquipSlotTakenError

  • EquipAlreadyEquippedError

Inherited From:

evaluateIncomingDamage(damage) → {number}

Parameters:
Name Type Description
damage Damage
Returns:
number
Inherited From:
See:
  • EffectList.evaluateIncomingDamage

evaluateOutgoingDamage(damage, currentAmount) → {number}

Parameters:
Name Type Description
damage Damage
currentAmount number
Returns:
number
Inherited From:
See:
  • EffectList.evaluateOutgoingDamage

follow(target)

Begin following another character. If the character follows itself they stop following.

Parameters:
Name Type Description
target Character
Inherited From:

getAttribute(attr) → {number}

Get the current value of an attribute (base modified by delta)

Parameters:
Name Type Description
attr string
Returns:
number
Inherited From:

getBaseAttribute(attr) → {number}

Get the base value for a given attribute

Parameters:
Name Type Description
attr string

Attribute name

Returns:
number
Inherited From:

getBroadcastTargets()

Inherited From:
See:

getMaxAttribute(attr) → {number}

Get current maximum value of attribute (as modified by effects.)

Parameters:
Name Type Description
attr string
Returns:
number
Inherited From:

hasAttribute(attr) → {boolean}

Parameters:
Name Type Description
attr string

Attribute name

Returns:
boolean
Inherited From:

hasEffectType(type) → {boolean}

Parameters:
Name Type Description
type string
Returns:
boolean
Inherited From:
See:

hasFollower(target) → {boolean}

Parameters:
Name Type Description
target Character
Returns:
boolean
Inherited From:

hasItem(itemReference) → {Item|boolean}

Check to see if this character has a particular item by EntityReference

Parameters:
Name Type Description
itemReference EntityReference
Returns:
Item | boolean
Inherited From:

hasPrompt(id) → {boolean}

Parameters:
Name Type Description
id string
Returns:
boolean

hydrate(state)

Initialize the character from storage

Parameters:
Name Type Description
state GameState
Overrides:

initiateCombat(target, lagnullable)

Start combat with a given target.

Parameters:
Name Type Attributes Default Description
target Character
lag number <nullable>
0

Optional milliseconds of lag to apply before the first attack

Fires:
Inherited From:

interpolatePrompt(promptStr, extraData)

Convert prompt tokens into actual data

Parameters:
Name Type Description
promptStr string
extraData object

Any extra data to give the prompt access to

isFollowing(target) → {boolean}

Parameters:
Name Type Description
target Character
Returns:
boolean
Inherited From:

isInCombat(targetnullable)

Check to see if this character is currently in combat or if they are currently in combat with a specific character

Parameters:
Name Type Attributes Description
target Character <nullable>
Returns:
-

boolean

Inherited From:

isInventoryFull() → {boolean}

Returns:
boolean
Inherited From:

lowerAttribute(attr, amount)

Lower an attribute by name

Parameters:
Name Type Description
attr string
amount number
Fires:
Inherited From:
See:
  • Attributes#lower

moveTo(nextRoom, onMoved)

Move the player to the given room, emitting events appropriately

Parameters:
Name Type Description
nextRoom Room
onMoved function

Function to run after the player is moved to the next room but before enter events are fired

Fires:

queueCommand()

See:
  • CommandQueue::enqueue

raiseAttribute(attr, amount)

Raise an attribute by name

Parameters:
Name Type Description
attr string
amount number
Fires:
Inherited From:
See:
  • Attributes#raise

removeCombatant(target)

Parameters:
Name Type Description
target Character
Fires:
Inherited From:

removeEffect(effect)

Parameters:
Name Type Description
effect Effect
Inherited From:
See:

removeFollower(follower)

Parameters:
Name Type Description
follower Character
Fires:
Inherited From:

removeFromCombat()

Fully remove this character from combat

Inherited From:

removeItem(item)

Remove an item from the character's inventory. Warning: This does not automatically place the item in any particular place. You will need to manually add it to the room or another character's inventory

Parameters:
Name Type Description
item Item
Inherited From:

removePrompt(id)

Parameters:
Name Type Description
id string

serialize() → {Object}

Gather data to be persisted

Returns:
Object
Overrides:

setAttributeBase(attr, newBase)

Update an attribute's base value.

NOTE: You probably don't want to use this the way you think you do. You should not use this for any temporary modifications to an attribute, instead you should use an Effect modifier.

This will permanently update the base value for an attribute to be used for things like a player purchasing a permanent upgrade or increasing a stat on level up

Parameters:
Name Type Description
attr string

Attribute name

newBase number

New base value

Fires:
Inherited From:

setAttributeToMax(attr)

Clears any changes to the attribute, setting it to its base value.

Parameters:
Name Type Description
attr string
Fires:
Inherited From:

unequip(slot)

Remove equipment in a given slot and move it to the character's inventory

Parameters:
Name Type Description
slot string
Fires:
Throws:

InventoryFullError

Inherited From:

unfollow()

Stop following whoever the character was following

Fires:
Inherited From:

Events

attributeUpdate

Fired when a Character's attribute is set, raised, or lowered

Parameters:
Name Type Description
attributeName string
attribute Attribute
Inherited From:

combatantAdded

Parameters:
Name Type Description
target Character
Inherited From:

combatantRemoved

Parameters:
Name Type Description
target Character
Inherited From:

combatEnd

Inherited From:

combatStart

Fired when Character#initiateCombat is called

Inherited From:

damaged

Parameters:
Name Type Description
damage Damage
finalAmount Number
Inherited From:

effectAdded

Inherited From:

effectRemoved

Inherited From:

enterRoom

Parameters:
Name Type Description
room Room

equip

Parameters:
Name Type Description
slot string
item Item
Inherited From:

followed

Parameters:
Name Type Description
target Character
Inherited From:

gainedFollower

Parameters:
Name Type Description
follower Character
Inherited From:

heal

Parameters:
Name Type Description
heal Heal
target Character
finalAmount number
Inherited From:

healed

Parameters:
Name Type Description
heal Heal
finalAmount number
Inherited From:

hit

Parameters:
Name Type Description
damage Damage
target Character
finalAmount Number
Inherited From:

lostFollower

Parameters:
Name Type Description
follower Character
Inherited From:

saved

unequip

Parameters:
Name Type Description
slot string
item Item
Inherited From:

unfollowed

Parameters:
Name Type Description
following Character
Inherited From:

updateTick