Reference Source Test
public class | source

Player

Extends:

EntityCharacter → Player

A member's playable Character in the game

Constructor Summary

Public Constructor
public

Default constructor

Member Summary

Public Members
public

The player's armor

public

avatar: [type]

Player's avatar

public

The player's boots

public

Direction they are facing

public

Are their actions disabled

public

Player's email

public

How many experience the player has

public

Current health points

public

The player's ID number

public

The player's last login

public

Level of the player

public

Current magic points

public

Maximum health points

public

Maximum magic points

public

Keyboard moving down

public

Keyboard moving left

public

Keyboard moving right

public

Keyboard moving up

public

name: [type]

The player's name??? not sure

public

Player's password

public

The player's pendant

public

Previous grid X position

public

Previous grid Y position

public

Player that is currently attacking them

public

How many PVP death's they've had

public

How many PVP kills they've had

public

Player = 0, moderator = 1, or admin >= 2

public

The player's ring

public

Timeout for temporary blinking

public

The type of entity this is

public

Callback for armor updates

public

Player's username

public

Not sure what this is....

public

The player's weapon

Method Summary

Public Methods
public

Gets the name of the sprite depending on their equipped armor defaults to clotharmor if they don't have anything equipped

public

Get the player's grid X position

public

Get the player's grid Y position

public

Returns true if there was keyboard movememnt

public

Returns true if the player has a weapon

public

Returns true if the has a ranged weapon

public

Loads the player's default (empty) equipment

public

loadHandler(game: Game)

This is for other player characters

public

Load equipment for this player given the data response from the server

public

Set the callback for updating armour

public

setEquipment(type: Modules, info: Array)

Set the player's equipment from the server

public

setId(id: Number)

Sets the ID of the player

public

setMana(mana: Number)

Set the player's current mana

public

setMaxMana(maxMana: [type])

Set the player's maximum mana amount

public

setName(name: String)

Sets the name and username of the player

public

setPointsData(hitPointsData: Array, manaData: Array)

Set the player's health and mana from the server data

public

Temporary blink the entity

public

unequip(type: String)

Unequip an item

Inherited Summary

From class Entity
public

Angle of the entity

public

[angled description]

public

Animations for the sprite

public

Timeout function for blinking

public

Count down time

public

Current counter

public

Critical health

public

Current animation the sprite should be playing

public

Set if the entity is dirty

public

Callback for when the entity is dirty

public

Whether or not this is fading

public

Fading time

public

Grid X position

public

Grid Y position

public

Handler for the entity

public

Has a counter

public

Hurt sprite name

public

Entity id

public

Label for the entity

public

Name of the entity

public

Non pathable

public

Normal sprite name

public

Path

public

CAllback function when the entity is ready

public

Rendering data

public

Has a shadow

public

Offset for the shadow on the Y axis

public

Sprite

public

Whether or not to flip the sprite on the X axis

public

Whether or not to flip the sprite on the Y axis

public

Whether or not the sprite has been loaded

public

Stunned status

public

Terror status

public

Wehther or not this entity is visible

public

X coordinate

public

Y coordinate

public

blink(speed: Number)

Tell this entity to start blinking

public

fadeIn(time: Number)

Tell this to fade in given the duration

public

Look for an animtions list for this specific animation given it's name

public

Get the distance from this entity to the given x,y coordinates

public

Get the distance from this entity to another entity

public

Returns the name of the sprite

public

Check if this entity currently has a path

public

Check whether or not this entity has a shadow

public

Returns the instance of the weapon this entity has

public

Figure out if this entity is within the attack radius of the given entity

public

Figure out if this entity is within the extended attack radius of the given entity

public

isPositionAdjacent(x: Number, y: Number, ignoreDiagonals: Boolean): Boolean

Checks to see if the x,y coordinate is adjacent to the entity's current position

public

Check whether or not this entity is visible

public

This is important for when the client is on a mobile screen.

public

onDirty(callback: Function)

When this entity's is dirty (mobile) use this callback

public

onReady(callback: Function)

When this entity's sprite is loaded trigger this callback

public

setAnimation(name: String, speed: Number, count: Number, onEndCount: Number)

Set the animation on this entity

public

Set the count for the count down time

public

Set the x,y position of the entity on the tile grid

public

setName(name: String)

Set the entity's name

public

setPosition(x: Number, y: [type])

Set the x,y position for the entity

public

setSprite(sprite: Sprite)

Set the sprite for this entity

public

setVisible(visible: Boolean)

Set the visibility on this entity

public

Tell the entity to stop blinking and force it to be visible

public

Toggle the current visibility of this entity

From class Character
public

Object of adjacent tiles while pathing

public

Attack animation speed

public

What is their attack range

public

An array of things trying to attack them

public

Are they attacking something

public

Before step callback

public

Did they get a critical hit

public

Global critical animation

public

Are they dead

public

destination: {gridX: Number, gridY: Number}

The X and Y locations of the destination

public

Did they explode

public

Global explosion animation

public

Are they following something

public

If this character's pathing is being forced

public

Are they frozen

public

Does their health reset after time is up

public

Is there health bar visible or not

public

How many hit points they have left

public

Hit points callback

public

Idle animation speed

public

Should their action be interrupted

public

How much magic they have left

public

How many hit points they have total

public

How much magic they have total

public

Move callback

public

Movement transitions

public

Movement animation speed

public

Location of a new destination during pathing

public

Next grid X position

public

Next grid Y position

public

orientation: Orientation

The direction they are pointing

public

path: Astar

What is their current path

public

Previous gridX position

public

Previous gridY position

public

Request path callback

public

Second step callback

public

Do they have a shadow

public

Flip the sprite along the X axis

public

Flip the sprite along the Y axis

public

Start pathing callback

public

Default step number

public

Step callback

public

Stop pathing callback

public

Global stun animation

public

Are they stunned

public

What is their current target

public

If this character is in terror

public

Global terror animation

public

Walk animation speed

public

Do they have a weapon

public

Add an attacker to a character

public

animate(animation: String, speed: Number, count: Number, onEndCount: Function): Null | Void

Animate the character depending on their current orientation

public

attack(attacker: Character, character: Character)

Attack a specific character

public

Stop following or attacking another character

public

changedPath(): [type]

Returns true if they've changed paths

public

Clear the health bar from the screen

public

follow(character: Character)

Follow a specific character

public

Taken from TTA - this is to ensure the player does not click on himself or somehow into another dimension

public

Apply a callback to each attacker

public

forget()

Removes all attakers

public

Return the active effect on the character

public

Get the correct effect animation

public

go(x: Number, y: Number, forced: Boolean): Boolean

Go to a specific x,y value

public

Check if they are already being attacked by this character

public

Returns true if they have a next path step

public

Returns true if they have a path

public

Returns true if they have a shadow

public

Returns true if they are targeting someone

public

Returns true if they have a weapon

public

idle(direction: Number)

Set the idle animation and optional orientation direction

public

Check if they are being attacked

public

Check if the character is currently moving

public

Load all global character animations

public

lookAt(character: Character)

Look at a specific character

public

move(x: Number, y: Number, forced: Boolean)

Move the character to a new location

public

moved()

The character has moved, trigger the move callback if there is one

public

We can have the movement remain client side because the server side will be responsible for determining whether or not the player should have reached the location and ban all hackers.

public

onBeforeStep(callback: Function)

Before a pathing step callback

public

onHitPoints(callback: Function)

On hit points callback

public

onMove(callback: Function)

On move callback

public

onRequestPath(callback: Function)

Callback for path requested

public

onSecondStep(callback: Function)

Second step callback

public

Start pathing callback

public

onStep(callback: Function)

Pathing step callback

public

onStopPathing(callback: Function)

Stop pathing callback

public

performAction(orientation: Number, action: Number)

Set a specific animation action

public

Set a new destination during movement somewhere

public

Removes an attacker from a character

public

Returns true if the target was removed

public

Request path finding from current position to this position

public

setHitPoints(hitPoints: Number)

Set the character's hit points then triggers hitPointsCallback

public

setMaxHitPoints(maxHitPoints: Number)

Set the character's maximum hit points

public

setOrientation(orientation: String)

Set the character's orientation

public

setTarget(target: Character)

Sets a target for this character

public

stop(force: Boolean)

Stop the character movement

public

The triggered health bar (currently fighting)

public

Update the character's position on the grid

public

Update movement on the path

Public Constructors

public constructor() source

Default constructor

Override:

Character#constructor

Public Members

public armour: Armour source

The player's armor

public avatar: [type] source

Player's avatar

public boots: Boots source

The player's boots

public direction: Number source

Direction they are facing

public disableAction: Boolean source

Are their actions disabled

public email: String source

Player's email

public experience: Number source

How many experience the player has

public hitPoints: Number source

Current health points

Override:

Character#hitPoints

public id: Number source

The player's ID number

Override:

Entity#id

public lastLogin: String source

The player's last login

public level: Number source

Level of the player

public mana: Number source

Current magic points

Override:

Character#mana

public maxHitPoints: Number source

Maximum health points

Override:

Character#maxHitPoints

public maxMana: Number source

Maximum magic points

Override:

Character#maxMana

public moveDown: Boolean source

Keyboard moving down

public moveLeft: Boolean source

Keyboard moving left

public moveRight: Boolean source

Keyboard moving right

public moveUp: Boolean source

Keyboard moving up

public name: [type] source

The player's name??? not sure

Override:

Entity#name

public password: String source

Player's password

public pendant: Pendant source

The player's pendant

public prevX: Number source

Previous grid X position

public prevY: Number source

Previous grid Y position

public pvp: Boolean | Entity source

Player that is currently attacking them

public pvpDeaths: Number source

How many PVP death's they've had

public pvpKills: Number source

How many PVP kills they've had

public rights: Number source

Player = 0, moderator = 1, or admin >= 2

public ring: Ring source

The player's ring

public tempBlinkTimeout: Function source

Timeout for temporary blinking

public type: String source

The type of entity this is

public updateArmourCallback: Function source

Callback for armor updates

public username: String source

Player's username

public wanted: Boolean source

Not sure what this is.... changes player name label text to red

public weapon: Weapon source

The player's weapon

Override:

Character#weapon

Public Methods

public getSpriteName(): String source

Gets the name of the sprite depending on their equipped armor defaults to clotharmor if they don't have anything equipped

Return:

String

sprite name for the character's armor

public getX(): Number source

Get the player's grid X position

Return:

Number

grid X position

public getY(): Number source

Get the player's grid Y position

Return:

Number

grid Y position

public hasKeyboardMovement(): Boolean source

Returns true if there was keyboard movememnt

Return:

Boolean

public hasWeapon(): Boolean source

Returns true if the player has a weapon

Override:

Character#hasWeapon

Return:

Boolean

public isRanged(): Boolean source

Returns true if the has a ranged weapon

Return:

Boolean

public loadEquipment() source

Loads the player's default (empty) equipment

public loadHandler(game: Game) source

This is for other player characters

Params:

NameTypeAttributeDescription
game Game

an instance of the game

public loadPlayer(data: Object) source

Load equipment for this player given the data response from the server

Params:

NameTypeAttributeDescription
data Object

player equipment and info from the server

data.instance Number

ID of the player

data.x Number

grid X position

data.y Number

grid Y position

data.hitPoints Number

current hit points

data.mana Number

current mana points

data.username String

the name of the player

data.experience Number

the player experience points

data.level Number

the player's level

data.lastLogin String

the last login date

data.pvpKills Number

the total pvp kills

data.pvpDeaths Number

the total pvp deaths

public onUpdateArmour(callback: Function) source

Set the callback for updating armour

Params:

NameTypeAttributeDescription
callback Function

function to reset armor

public setEquipment(type: Modules, info: Array) source

Set the player's equipment from the server

Params:

NameTypeAttributeDescription
type Modules

values from Modules.Equipment

info Array

in the format of [ id, name, string, count, ability, abilityLevel ]

public setId(id: Number) source

Sets the ID of the player

Params:

NameTypeAttributeDescription
id Number

player ID

public setMana(mana: Number) source

Set the player's current mana

Params:

NameTypeAttributeDescription
mana Number

amount

public setMaxMana(maxMana: [type]) source

Set the player's maximum mana amount

Params:

NameTypeAttributeDescription
maxMana [type]

amount

public setName(name: String) source

Sets the name and username of the player

Override:

Entity#setName

Params:

NameTypeAttributeDescription
name String

username of the player

public setPointsData(hitPointsData: Array, manaData: Array) source

Set the player's health and mana from the server data

Params:

NameTypeAttributeDescription
hitPointsData Array

in the format of [ id, hitPoints, maxHitPoints ]

manaData Array

in the format of [ id, mana, maxMana ]

Temporary blink the entity

public unequip(type: String) source

Unequip an item

Params:

NameTypeAttributeDescription
type String

type of equipment to remove