Crossfire JXClient, Trunk
R20561
|
Model class maintaining the CfItems known to the player. More...
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< CfItem > | getItemsByLocation (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< CfItem > | getPlayerInventory () |
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< CfItem > | getInventoryByTag (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, CfItem > | allItems = new HashMap<>() |
Maps item tags to items. More... | |
final HashedEventListenerList< ItemListener > | itemListeners = 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< ItemSetListener > | itemSetListeners = 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... | |
Model class maintaining the CfItems known to the player.
Definition at line 43 of file ItemSet.java.
void com.realtime.crossfire.jxclient.items.ItemSet.addInventoryListener | ( | final int | tag, |
@NotNull final ItemListener | listener | ||
) |
Adds an ItemListener to be notified about changes.
tag | the item tag to watch |
listener | the 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().
void com.realtime.crossfire.jxclient.items.ItemSet.addItem | ( | @NotNull final CfItem | item | ) |
Adds an item.
item | the 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().
|
private |
Adds a CfItem.
item | the item to add |
notifyListeners | whether 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().
void com.realtime.crossfire.jxclient.items.ItemSet.addItemSetListener | ( | @NotNull final ItemSetListener | listener | ) |
Adds an ItemSetListener to be notified about changes.
listener | the 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().
void com.realtime.crossfire.jxclient.items.ItemSet.cleanInventory | ( | final int | tag | ) |
Clears the inventory of an item.
tag | the 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().
|
private |
Returns the inventory of an item.
tag | the item's tag |
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().
CfItem com.realtime.crossfire.jxclient.items.ItemSet.getInventoryItem | ( | final int | tag, |
final int | index | ||
) |
Returns a CfItem from the inventory of an item.
tag | the item's tag |
index | the index of the inventory item to return |
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().
CfItem com.realtime.crossfire.jxclient.items.ItemSet.getItemByTag | ( | final int | tag | ) |
Returns an item by tag.
tag | the tag |
Definition at line 275 of file ItemSet.java.
Referenced by com.realtime.crossfire.jxclient.items.FloorView.getItem().
|
private |
Returns an item by tag.
This function may return the player object.
tag | the tag |
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().
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.
location | the location |
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().
int com.realtime.crossfire.jxclient.items.ItemSet.getNumberOfItemsByLocation | ( | final int | location | ) |
Returns the number of items in a given location.
Undefined locations return
.
location | the location to check |
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().
int com.realtime.crossfire.jxclient.items.ItemSet.getOpenContainer | ( | ) |
Returns the currently opened container.
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().
CfItem com.realtime.crossfire.jxclient.items.ItemSet.getPlayer | ( | ) |
Returns the player object this client controls.
Definition at line 284 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.gui.item.GUIItemFloor.button3Clicked(), com.realtime.crossfire.jxclient.scripts.DefaultScriptProcess.cmdRequest(), and com.realtime.crossfire.jxclient.items.ItemsManager.upditemReceived().
Iterable<CfItem> com.realtime.crossfire.jxclient.items.ItemSet.getPlayerInventory | ( | ) |
Returns the player's inventory.
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().
void com.realtime.crossfire.jxclient.items.ItemSet.removeInventoryListener | ( | final int | tag, |
@NotNull final ItemListener | listener | ||
) |
Removes an ItemListener to be notified about changes.
tag | the item tag to watch |
listener | the 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().
|
private |
Removes a CfItem.
tag | the item's tag to remove |
notifyListeners | whether listeners should be notified about the removal |
Definition at line 156 of file ItemSet.java.
References com.realtime.crossfire.jxclient.util.HashedEventListenerList< T extends EventListener >.getListeners(), com.realtime.crossfire.jxclient.items.CfItem.getLocation(), com.realtime.crossfire.jxclient.items.CfItem.getTag(), and com.realtime.crossfire.jxclient.items.ItemSet.sync.
Referenced by com.realtime.crossfire.jxclient.items.ItemSet.addItem(), com.realtime.crossfire.jxclient.items.ItemSet.cleanInventory(), com.realtime.crossfire.jxclient.items.ItemSet.removeItems(), com.realtime.crossfire.jxclient.items.ItemSet.reset(), and com.realtime.crossfire.jxclient.items.ItemSet.updateItem().
void com.realtime.crossfire.jxclient.items.ItemSet.removeItems | ( | @NotNull final int [] | tags | ) |
Deletes items by tag.
tags | the 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().
void com.realtime.crossfire.jxclient.items.ItemSet.removeItemSetListener | ( | @NotNull final ItemSetListener | listener | ) |
Removes an ItemSetListener to be notified about changes.
listener | the 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().
void com.realtime.crossfire.jxclient.items.ItemSet.reset | ( | ) |
Resets the manager's state.
Definition at line 403 of file ItemSet.java.
References com.realtime.crossfire.jxclient.items.ItemSet.cleanInventory(), com.realtime.crossfire.jxclient.items.CfItem.getTag(), com.realtime.crossfire.jxclient.items.ItemSet.removeItemByTag(), com.realtime.crossfire.jxclient.items.ItemSet.setOpenContainer(), com.realtime.crossfire.jxclient.items.ItemSet.setPlayer(), and com.realtime.crossfire.jxclient.items.ItemSet.sync.
|
private |
Sets the currently opened container.
openContainerFloor | the 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().
void com.realtime.crossfire.jxclient.items.ItemSet.setPlayer | ( | @Nullable final CfItem | player | ) |
Sets the player object this client controls.
player | the 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().
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 | ||
) |
Processes an "upditem" command.
flags | the changed values |
tag | the item's tag |
valLocation | the item's location |
valFlags | the item's flags |
valWeight | the item's weight |
valFace | the item's face |
valName | the item's singular name |
valNamePl | the item's plural name |
valAnim | the item's animation ID |
valAnimSpeed | the item's animation speed |
valNrof | the number of items |
Definition at line 361 of file ItemSet.java.
References com.realtime.crossfire.jxclient.items.ItemSet.addItem(), com.realtime.crossfire.jxclient.items.ItemSet.getItemOrPlayer(), com.realtime.crossfire.jxclient.util.HashedEventListenerList< T extends EventListener >.getListeners(), 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.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_FACE, 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.items.ItemsManager.upditemReceived().
|
private |
Maps item tags to items.
The map contains all items currently known to the client.
Definition at line 50 of file ItemSet.java.
|
private |
The registered ItemListeners to be notified about changes.
Definition at line 87 of file ItemSet.java.
|
private |
Maps location (=tag) to list of items in that location.
Definition at line 56 of file ItemSet.java.
|
private |
The list of ItemSetListeners to be notified about changes.
Definition at line 80 of file ItemSet.java.
|
private |
The currently opened container or.
.
Definition at line 73 of file ItemSet.java.
Referenced by com.realtime.crossfire.jxclient.items.ItemSet.getOpenContainer(), and com.realtime.crossfire.jxclient.items.ItemSet.setOpenContainer().
|
private |
The current player object this client controls.
Definition at line 68 of file ItemSet.java.
Referenced by com.realtime.crossfire.jxclient.items.ItemSet.getItemOrPlayer(), com.realtime.crossfire.jxclient.items.ItemSet.getPlayer(), and com.realtime.crossfire.jxclient.items.ItemSet.setPlayer().
|
private |
The synchronization object for player.
Definition at line 62 of file ItemSet.java.
Referenced by com.realtime.crossfire.jxclient.items.ItemSet.getItemOrPlayer(), com.realtime.crossfire.jxclient.items.ItemSet.getPlayer(), com.realtime.crossfire.jxclient.items.ItemSet.getPlayerInventory(), com.realtime.crossfire.jxclient.items.ItemSet.removeItemByTag(), com.realtime.crossfire.jxclient.items.ItemSet.reset(), com.realtime.crossfire.jxclient.items.ItemSet.setPlayer(), and com.realtime.crossfire.jxclient.items.ItemSet.updateItem().