Reference Source Test
public class | source

Enchant

Manages the enchanting interface for applying abilities to items

Constructor Summary

Public Constructor
public

constructor(game: Game, intrface: Interface)

Default constructor

Member Summary

Public Members
public

body: jQuery

The enchant dialog body element

public

confirm: jQuery

The confirm enchant button element

public

container: jQuery

The enchant container element

public

enchantSlots: jQuery

The enchant inventory slots element

public

The game instance

public

The game interface instance

public

selectedItem: jQuery

The selected item slot display element

public

selectedShards: jQuery

The selected shards slot display element

public

shardsCount: jQuery

The shards count display element

Method Summary

Public Methods
public

add(type: String, index: Number)

Moves an item from the inventory slot into the selected item or shards display

public

Shows the enchant dialog and loads the current inventory into it

public

Sends an enchant action packet to the server

public

Returns the number of slots in the player's inventory

public

Returns the slot data for the given inventory index

public

getSlot(index: Number): jQuery

Returns the slot list item element at the given index

public

getSlots(): jQuery

Returns the unordered list element containing all enchant slots

public

hasImage(image: jQuery): Boolean

Returns whether the given image element has a background image set

public

hide()

Hides the enchant dialog and clears the selected item and shards

public

Returns whether the enchant dialog is currently visible

public

Loads the inventory slot list into the enchant interface from the bank inventory

public

moveBack(type: String, index: Number)

Moves an item back from the selected display into its original inventory slot

public

remove(type: String)

Sends a remove packet to the server for the given slot type

public

select(event: Event)

Sends a slot selection packet to the server

Public Constructors

public constructor(game: Game, intrface: Interface) source

Default constructor

Params:

NameTypeAttributeDescription
game Game

an instance of the game

intrface Interface

an instance of the game interface

Public Members

public body: jQuery source

The enchant dialog body element

public confirm: jQuery source

The confirm enchant button element

public container: jQuery source

The enchant container element

public enchantSlots: jQuery source

The enchant inventory slots element

public game: Game source

The game instance

public interface: Interface source

The game interface instance

public selectedItem: jQuery source

The selected item slot display element

public selectedShards: jQuery source

The selected shards slot display element

public shardsCount: jQuery source

The shards count display element

Public Methods

public add(type: String, index: Number) source

Moves an item from the inventory slot into the selected item or shards display

Params:

NameTypeAttributeDescription
type String

the slot type, either 'item' or 'shards'

index Number

the inventory slot index

public display() source

Shows the enchant dialog and loads the current inventory into it

public enchant() source

Sends an enchant action packet to the server

public getInventorySize(): Number source

Returns the number of slots in the player's inventory

Return:

Number

public getItemSlot(index: Number): Slot source

Returns the slot data for the given inventory index

Params:

NameTypeAttributeDescription
index Number

the inventory slot index

Return:

Slot

public getSlot(index: Number): jQuery source

Returns the slot list item element at the given index

Params:

NameTypeAttributeDescription
index Number

the slot index

Return:

jQuery

public getSlots(): jQuery source

Returns the unordered list element containing all enchant slots

Return:

jQuery

public hasImage(image: jQuery): Boolean source

Returns whether the given image element has a background image set

Params:

NameTypeAttributeDescription
image jQuery

the image element to check

Return:

Boolean

public hide() source

Hides the enchant dialog and clears the selected item and shards

public isVisible(): Boolean source

Returns whether the enchant dialog is currently visible

Return:

Boolean

public loadEnchant() source

Loads the inventory slot list into the enchant interface from the bank inventory

public moveBack(type: String, index: Number) source

Moves an item back from the selected display into its original inventory slot

Params:

NameTypeAttributeDescription
type String

the slot type, either 'item' or 'shards'

index Number

the inventory slot index to restore

public remove(type: String) source

Sends a remove packet to the server for the given slot type

Params:

NameTypeAttributeDescription
type String

the slot type to remove, either 'item' or 'shards'

public select(event: Event) source

Sends a slot selection packet to the server

Params:

NameTypeAttributeDescription
event Event

the click event from the inventory slot element