Crossfire JXClient, Trunk  R20561
com.realtime.crossfire.jxclient.items.ItemSet Class Reference

Model class maintaining the CfItems known to the player. More...

+ Collaboration diagram for com.realtime.crossfire.jxclient.items.ItemSet:

Public Member Functions

void addInventoryListener (final int tag, @NotNull final ItemListener listener)
 Adds an ItemListener to be notified about changes. More...
 
void addItem (@NotNull final CfItem item)
 Adds an item. More...
 
void addItemSetListener (@NotNull final ItemSetListener listener)
 Adds an ItemSetListener to be notified about changes. More...
 
void cleanInventory (final int tag)
 Clears the inventory of an item. More...
 
CfItem getInventoryItem (final int tag, final int index)
 Returns a CfItem from the inventory of an item. More...
 
CfItem getItemByTag (final int tag)
 Returns an item by tag. More...
 
List< CfItemgetItemsByLocation (final int location)
 Returns a list of items in a given location. More...
 
int getNumberOfItemsByLocation (final int location)
 Returns the number of items in a given location. More...
 
int getOpenContainer ()
 Returns the currently opened container. More...
 
CfItem getPlayer ()
 Returns the player object this client controls. More...
 
Iterable< CfItemgetPlayerInventory ()
 Returns the player's inventory. More...
 
void removeInventoryListener (final int tag, @NotNull final ItemListener listener)
 Removes an ItemListener to be notified about changes. More...
 
void removeItems (@NotNull final int[] tags)
 Deletes items by tag. More...
 
void removeItemSetListener (@NotNull final ItemSetListener listener)
 Removes an ItemSetListener to be notified about changes. More...
 
void reset ()
 Resets the manager's state. More...
 
void setPlayer (@Nullable final CfItem player)
 Sets the player object this client controls. More...
 
void updateItem (final int flags, final int tag, final int valLocation, final int valFlags, final int valWeight, final Face valFace, @NotNull final String valName, @NotNull final String valNamePl, final int valAnim, final int valAnimSpeed, final int valNrof)
 Processes an "upditem" command. More...
 

Private Member Functions

void addItem (@NotNull final CfItem item, final boolean notifyListeners)
 Adds a CfItem. More...
 
List< CfItemgetInventoryByTag (final int tag)
 Returns the inventory of an item. More...
 
CfItem getItemOrPlayer (final int tag)
 Returns an item by tag. More...
 
int removeItemByTag (final int tag, final boolean notifyListeners)
 Removes a CfItem. More...
 
void setOpenContainer (final int openContainerFloor)
 Sets the currently opened container. More...
 

Private Attributes

final Map< Integer, CfItemallItems = new HashMap<>()
 Maps item tags to items. More...
 
final HashedEventListenerList< ItemListeneritemListeners = new HashedEventListenerList<>()
 The registered ItemListeners to be notified about changes. More...
 
final Map< Integer, List< CfItem > > items = new HashMap<>()
 Maps location (=tag) to list of items in that location. More...
 
final EventListenerList2< ItemSetListeneritemSetListeners = new EventListenerList2<>()
 The list of ItemSetListeners to be notified about changes. More...
 
int openContainerFloor
 The currently opened container or. More...
 
CfItem player
 The current player object this client controls. More...
 
final Object sync = new Object()
 The synchronization object for player. More...
 

Detailed Description

Model class maintaining the CfItems known to the player.

Author
Andreas Kirschbaum

Definition at line 43 of file ItemSet.java.

Member Function Documentation

◆ addInventoryListener()

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

Adds an ItemListener to be notified about changes.

Parameters
tagthe item tag to watch
listenerthe listener to add

Definition at line 110 of file ItemSet.java.

References com.realtime.crossfire.jxclient.util.HashedEventListenerList< T extends EventListener >.add().

Referenced by com.realtime.crossfire.jxclient.items.FloorView.FloorView(), com.realtime.crossfire.jxclient.items.FloorView.setCurrentFloor(), and com.realtime.crossfire.jxclient.items.InventoryView.setCurrentPlayerTag().

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

◆ addItem() [1/2]

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

Adds an item.

Parameters
itemthe item to add

Definition at line 216 of file ItemSet.java.

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

+ Here is the caller graph for this function:

◆ addItem() [2/2]

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

Adds a CfItem.

Parameters
itemthe item to add
notifyListenerswhether listeners should be notified about the addition

Definition at line 226 of file ItemSet.java.

References com.realtime.crossfire.jxclient.util.HashedEventListenerList< T extends EventListener >.getListeners(), and com.realtime.crossfire.jxclient.items.ItemSet.removeItemByTag().

+ Here is the call graph for this function:

◆ addItemSetListener()

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

Adds an ItemSetListener to be notified about changes.

Parameters
listenerthe listener to add

Definition at line 93 of file ItemSet.java.

References com.realtime.crossfire.jxclient.util.EventListenerList2< T extends EventListener >.add().

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

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

◆ 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 338 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.ItemsManager.delinvReceived(), and 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 261 of file ItemSet.java.

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 447 of file ItemSet.java.

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

Referenced by com.realtime.crossfire.jxclient.items.FloorView.getItem(), and com.realtime.crossfire.jxclient.items.InventoryView.setCurrentPlayerTag().

+ 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 275 of file ItemSet.java.

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 324 of file ItemSet.java.

References 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 130 of file ItemSet.java.

Referenced by com.realtime.crossfire.jxclient.items.ItemSet.cleanInventory(), and com.realtime.crossfire.jxclient.scripts.DefaultScriptProcess.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 144 of file ItemSet.java.

Referenced by com.realtime.crossfire.jxclient.items.FloorView.getSize(), and com.realtime.crossfire.jxclient.items.InventoryView.setCurrentPlayerTag().

+ 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 436 of file ItemSet.java.

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

Referenced by 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 ( )

Returns the player's inventory.

Returns
the inventory items; the list cannot be modified

Definition at line 312 of file ItemSet.java.

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

Referenced by com.realtime.crossfire.jxclient.scripts.DefaultScriptProcess.cmdRequest().

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

◆ 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 119 of file ItemSet.java.

References com.realtime.crossfire.jxclient.util.HashedEventListenerList< T extends EventListener >.remove().

Referenced by com.realtime.crossfire.jxclient.items.FloorView.setCurrentFloor(), and com.realtime.crossfire.jxclient.items.InventoryView.setCurrentPlayerTag().

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

◆ removeItemByTag()

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

◆ removeItems()

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

Deletes items by tag.

Parameters
tagsthe tags to delete

Definition at line 204 of file ItemSet.java.

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

Referenced by com.realtime.crossfire.jxclient.items.ItemsManager.delitemReceived().

+ Here is the call graph for this function:
+ Here is the caller 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 101 of file ItemSet.java.

References com.realtime.crossfire.jxclient.util.EventListenerList2< T extends EventListener >.remove().

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

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

◆ reset()

◆ 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 421 of file ItemSet.java.

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

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 294 of file ItemSet.java.

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

Referenced by com.realtime.crossfire.jxclient.items.ItemsManager.playerReceived(), and 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,
final Face  valFace,
@NotNull final String  valName,
@NotNull final String  valNamePl,
final int  valAnim,
final int  valAnimSpeed,
final int  valNrof 
)

Member Data Documentation

◆ allItems

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

Maps item tags to items.

The map contains all items currently known to the client.

Definition at line 50 of file ItemSet.java.

◆ itemListeners

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

The registered ItemListeners to be notified about changes.

Definition at line 87 of file ItemSet.java.

◆ items

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

Maps location (=tag) to list of items in that location.

Definition at line 56 of file ItemSet.java.

◆ itemSetListeners

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

The list of ItemSetListeners to be notified about changes.

Definition at line 80 of file ItemSet.java.

◆ openContainerFloor

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

◆ player

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

◆ sync


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