Crossfire JXClient, Trunk
Public Member Functions | Private Member Functions | Private Attributes | List of all members
com.realtime.crossfire.jxclient.items.ItemSet Class Reference
Collaboration diagram for com.realtime.crossfire.jxclient.items.ItemSet:
Collaboration graph

Public Member Functions

void addInventoryListener (final int tag, @NotNull final ItemListener listener)
 
void addItem (@NotNull final CfItem item)
 
void addItemSetListener (@NotNull final ItemSetListener listener)
 
void cleanInventory (final int tag)
 
CfItem getInventoryItem (final int tag, final int index)
 
CfItem getItemByTag (final int tag)
 
List< CfItemgetItemsByLocation (final int location)
 
int getNumberOfItemsByLocation (final int location)
 
int getOpenContainer ()
 
CfItem getPlayer ()
 
Iterable< CfItemgetPlayerInventory ()
 
void removeInventoryListener (final int tag, @NotNull final ItemListener listener)
 
void removeItems (final int @NotNull[] tags)
 
void removeItemSetListener (@NotNull final ItemSetListener listener)
 
void reset ()
 
void setMarkedItemTag (final int markedItemTag)
 
void setPlayer (@Nullable final CfItem player)
 
void updateItem (final int flags, final int tag, final int valLocation, final int valFlags, final int valWeight, @NotNull final Face valFace, @NotNull final String valName, @NotNull final String valNamePl, final int valAnim, final int valAnimSpeed, final int valNrof)
 

Private Member Functions

List< CfItemgetInventoryByTag (final int tag)
 
CfItem getItemOrPlayer (final int tag)
 
int removeItemByTag (final int tag)
 
void setOpenContainer (final int openContainerFloor)
 

Private Attributes

final Map< Integer, CfItemallItems = new HashMap<>()
 
final HashedEventListenerList< ItemListeneritemListeners = new HashedEventListenerList<>()
 
final Map< Integer, List< CfItem > > items = new HashMap<>()
 
final EventListenerList2< ItemSetListeneritemSetListeners = new EventListenerList2<>()
 
int openContainerFloor
 
CfItem player
 
final Object sync = new Object()
 

Detailed Description

Model class maintaining the CfItems known to the player.

Author
Andreas Kirschbaum

Definition at line 44 of file ItemSet.java.

Member Function Documentation

◆ addInventoryListener()

void com.realtime.crossfire.jxclient.items.ItemSet.addInventoryListener ( final int  tag,
@NotNull final ItemListener  listener 
)

◆ addItem()

void com.realtime.crossfire.jxclient.items.ItemSet.addItem ( @NotNull final CfItem  item)

◆ addItemSetListener()

void com.realtime.crossfire.jxclient.items.ItemSet.addItemSetListener ( @NotNull final ItemSetListener  listener)

◆ cleanInventory()

void com.realtime.crossfire.jxclient.items.ItemSet.cleanInventory ( final int  tag)

Clears the inventory of an item.

Parameters
tagthe item tag

Definition at line 327 of file ItemSet.java.

References com.realtime.crossfire.jxclient.items.ItemSet.getItemsByLocation(), com.realtime.crossfire.jxclient.items.CfItem.getTag(), and com.realtime.crossfire.jxclient.items.ItemSet.removeItemByTag().

Referenced by com.realtime.crossfire.jxclient.items.ItemSet.reset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInventoryByTag()

List<CfItem> com.realtime.crossfire.jxclient.items.ItemSet.getInventoryByTag ( final int  tag)
private

Returns the inventory of an item.

Parameters
tagthe item's tag
Returns
the inventory items; the list cannot be modified

Definition at line 245 of file ItemSet.java.

References com.realtime.crossfire.jxclient.items.ItemSet.items, and com.realtime.crossfire.jxclient.items.ItemSet.sync.

Referenced by com.realtime.crossfire.jxclient.items.ItemSet.getInventoryItem(), and com.realtime.crossfire.jxclient.items.ItemSet.getPlayerInventory().

Here is the caller graph for this function:

◆ getInventoryItem()

CfItem com.realtime.crossfire.jxclient.items.ItemSet.getInventoryItem ( final int  tag,
final int  index 
)

Returns a CfItem from the inventory of an item.

Parameters
tagthe item's tag
indexthe index of the inventory item to return
Returns
the inventory item or
null
if the index does not exist

Definition at line 441 of file ItemSet.java.

References com.realtime.crossfire.jxclient.items.ItemSet.getInventoryByTag().

Referenced by com.realtime.crossfire.jxclient.items.FloorView.getItem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getItemByTag()

CfItem com.realtime.crossfire.jxclient.items.ItemSet.getItemByTag ( final int  tag)

Returns an item by tag.

Parameters
tagthe tag
Returns
the item or
null
if no such items exists

Definition at line 261 of file ItemSet.java.

References com.realtime.crossfire.jxclient.items.ItemSet.allItems, and com.realtime.crossfire.jxclient.items.ItemSet.sync.

Referenced by com.realtime.crossfire.jxclient.items.FloorView.getItem().

Here is the caller graph for this function:

◆ getItemOrPlayer()

CfItem com.realtime.crossfire.jxclient.items.ItemSet.getItemOrPlayer ( final int  tag)
private

Returns an item by tag. This function may return the player object.

Parameters
tagthe tag
Returns
the item or
null
if no such item exists

Definition at line 313 of file ItemSet.java.

References com.realtime.crossfire.jxclient.items.ItemSet.allItems, com.realtime.crossfire.jxclient.items.CfItem.getTag(), com.realtime.crossfire.jxclient.items.ItemSet.player, and com.realtime.crossfire.jxclient.items.ItemSet.sync.

Referenced by com.realtime.crossfire.jxclient.items.ItemSet.updateItem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getItemsByLocation()

List<CfItem> com.realtime.crossfire.jxclient.items.ItemSet.getItemsByLocation ( final int  location)

Returns a list of items in a given location. The returned list may not be modified by the caller.

Parameters
locationthe location
Returns
the list of items

Definition at line 132 of file ItemSet.java.

References com.realtime.crossfire.jxclient.items.ItemSet.items, and com.realtime.crossfire.jxclient.items.ItemSet.sync.

Referenced by com.realtime.crossfire.jxclient.items.ItemSet.cleanInventory(), and com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess.cmdRequest().

Here is the caller graph for this function:

◆ getNumberOfItemsByLocation()

int com.realtime.crossfire.jxclient.items.ItemSet.getNumberOfItemsByLocation ( final int  location)

Returns the number of items in a given location. Undefined locations return

0

.

Parameters
locationthe location to check
Returns
the number of items

Definition at line 148 of file ItemSet.java.

References com.realtime.crossfire.jxclient.items.ItemSet.items, and com.realtime.crossfire.jxclient.items.ItemSet.sync.

Referenced by com.realtime.crossfire.jxclient.items.FloorView.getSize().

Here is the caller graph for this function:

◆ getOpenContainer()

int com.realtime.crossfire.jxclient.items.ItemSet.getOpenContainer ( )

Returns the currently opened container.

Returns
the opened container's tag

Definition at line 428 of file ItemSet.java.

References com.realtime.crossfire.jxclient.items.ItemSet.openContainerFloor, and com.realtime.crossfire.jxclient.items.ItemSet.sync.

Referenced by com.realtime.crossfire.jxclient.items.FloorView.FloorView(), and com.realtime.crossfire.jxclient.gui.item.GUIItemFloor.getFace().

Here is the caller graph for this function:

◆ getPlayer()

CfItem com.realtime.crossfire.jxclient.items.ItemSet.getPlayer ( )

◆ getPlayerInventory()

Iterable<CfItem> com.realtime.crossfire.jxclient.items.ItemSet.getPlayerInventory ( )

◆ removeInventoryListener()

void com.realtime.crossfire.jxclient.items.ItemSet.removeInventoryListener ( final int  tag,
@NotNull final ItemListener  listener 
)

Removes an ItemListener to be notified about changes.

Parameters
tagthe item tag to watch
listenerthe listener to add

Definition at line 121 of file ItemSet.java.

References com.realtime.crossfire.jxclient.items.ItemSet.itemListeners.

Referenced by com.realtime.crossfire.jxclient.items.FloorView.setCurrentFloorTag(), com.realtime.crossfire.jxclient.items.InventoryView.setCurrentPlayerTag(), and com.realtime.crossfire.jxclient.stats.MarkedItemWatcher.setCurrentPlayerTag().

Here is the caller graph for this function:

◆ removeItemByTag()

int com.realtime.crossfire.jxclient.items.ItemSet.removeItemByTag ( final int  tag)
private

◆ removeItems()

void com.realtime.crossfire.jxclient.items.ItemSet.removeItems ( final int @NotNull[]  tags)

Deletes items by tag.

Parameters
tagsthe tags to delete

Definition at line 200 of file ItemSet.java.

References com.realtime.crossfire.jxclient.items.ItemSet.removeItemByTag().

Here is the call graph for this function:

◆ removeItemSetListener()

void com.realtime.crossfire.jxclient.items.ItemSet.removeItemSetListener ( @NotNull final ItemSetListener  listener)

Removes an ItemSetListener to be notified about changes.

Parameters
listenerthe listener to remove

Definition at line 103 of file ItemSet.java.

References com.realtime.crossfire.jxclient.items.ItemSet.itemSetListeners.

Referenced by com.realtime.crossfire.jxclient.skin.events.PlayerLoginSkinEvent.dispose(), and com.realtime.crossfire.jxclient.gui.gauge.StatGaugeUpdater.dispose().

Here is the caller graph for this function:

◆ reset()

void com.realtime.crossfire.jxclient.items.ItemSet.reset ( )

◆ setMarkedItemTag()

void com.realtime.crossfire.jxclient.items.ItemSet.setMarkedItemTag ( final int  markedItemTag)

Sets the marked item. Ignores the request if the item is not in the inventory.

Parameters
markedItemTagthe tag of the marked item or
-1
to unset the marked item

Definition at line 456 of file ItemSet.java.

References com.realtime.crossfire.jxclient.items.CfItem.getTag(), com.realtime.crossfire.jxclient.items.ItemSet.items, com.realtime.crossfire.jxclient.items.ItemSet.player, and com.realtime.crossfire.jxclient.items.ItemSet.sync.

Referenced by com.realtime.crossfire.jxclient.stats.MarkedItemWatcher.check().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setOpenContainer()

void com.realtime.crossfire.jxclient.items.ItemSet.setOpenContainer ( final int  openContainerFloor)
private

Sets the currently opened container.

Parameters
openContainerFloorthe opened container's tag or
0

Definition at line 410 of file ItemSet.java.

References com.realtime.crossfire.jxclient.items.ItemSet.itemSetListeners, com.realtime.crossfire.jxclient.items.ItemSet.openContainerFloor, and com.realtime.crossfire.jxclient.items.ItemSet.sync.

Referenced by com.realtime.crossfire.jxclient.items.ItemSet.reset(), and com.realtime.crossfire.jxclient.items.ItemSet.updateItem().

Here is the caller graph for this function:

◆ setPlayer()

void com.realtime.crossfire.jxclient.items.ItemSet.setPlayer ( @Nullable final CfItem  player)

Sets the player object this client controls.

Parameters
playerthe new player object

Definition at line 282 of file ItemSet.java.

References com.realtime.crossfire.jxclient.items.ItemSet.itemSetListeners, com.realtime.crossfire.jxclient.items.ItemSet.player, and com.realtime.crossfire.jxclient.items.ItemSet.sync.

Referenced by com.realtime.crossfire.jxclient.items.ItemSet.reset().

Here is the caller graph for this function:

◆ updateItem()

void com.realtime.crossfire.jxclient.items.ItemSet.updateItem ( final int  flags,
final int  tag,
final int  valLocation,
final int  valFlags,
final int  valWeight,
@NotNull final Face  valFace,
@NotNull final String  valName,
@NotNull final String  valNamePl,
final int  valAnim,
final int  valAnimSpeed,
final int  valNrof 
)

Processes an "upditem" command.

Parameters
flagsthe changed values
tagthe item's tag
valLocationthe item's location
valFlagsthe item's flags
valWeightthe item's weight
valFacethe item's face
valNamethe item's singular name
valNamePlthe item's plural name
valAnimthe item's animation ID
valAnimSpeedthe item's animation speed
valNrofthe number of items

Definition at line 350 of file ItemSet.java.

References com.realtime.crossfire.jxclient.items.ItemSet.addItem(), com.realtime.crossfire.jxclient.items.ItemSet.getItemOrPlayer(), com.realtime.crossfire.jxclient.items.CfItem.getLocation(), com.realtime.crossfire.jxclient.items.CfItem.getTag(), com.realtime.crossfire.jxclient.items.CfItem.isOpen(), com.realtime.crossfire.jxclient.items.ItemSet.itemListeners, com.realtime.crossfire.jxclient.items.ItemSet.openContainerFloor, com.realtime.crossfire.jxclient.items.ItemSet.player, com.realtime.crossfire.jxclient.items.ItemSet.removeItemByTag(), com.realtime.crossfire.jxclient.items.CfItem.setLocation(), com.realtime.crossfire.jxclient.items.ItemSet.setOpenContainer(), com.realtime.crossfire.jxclient.items.ItemSet.sync, com.realtime.crossfire.jxclient.protocol.UpdItem.UPD_FLAGS, com.realtime.crossfire.jxclient.protocol.UpdItem.UPD_LOCATION, and com.realtime.crossfire.jxclient.items.CfItem.update().

Referenced by com.realtime.crossfire.jxclient.map.AnimationState.allocate(), and com.realtime.crossfire.jxclient.map.AnimationState.updateFace().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ allItems

final Map<Integer, CfItem> com.realtime.crossfire.jxclient.items.ItemSet.allItems = new HashMap<>()
private

◆ itemListeners

final HashedEventListenerList<ItemListener> com.realtime.crossfire.jxclient.items.ItemSet.itemListeners = new HashedEventListenerList<>()
private

◆ items

final Map<Integer, List<CfItem> > com.realtime.crossfire.jxclient.items.ItemSet.items = new HashMap<>()
private

◆ itemSetListeners

final EventListenerList2<ItemSetListener> com.realtime.crossfire.jxclient.items.ItemSet.itemSetListeners = new EventListenerList2<>()
private

◆ openContainerFloor

int com.realtime.crossfire.jxclient.items.ItemSet.openContainerFloor
private

◆ player

CfItem com.realtime.crossfire.jxclient.items.ItemSet.player
private

◆ sync

final Object com.realtime.crossfire.jxclient.items.ItemSet.sync = new Object()
private

The documentation for this class was generated from the following file: