cz.cuni.pogamut.MessageObjects
Class Item

java.lang.Object
  extended by cz.cuni.pogamut.MessageObjects.MessageObject
      extended by cz.cuni.pogamut.MessageObjects.Item
All Implemented Interfaces:
Visible, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
Ammo, Armor, Extra, Health, Special, Weapon

public class Item
extends MessageObject
implements java.io.Serializable, java.lang.Cloneable

An object on the ground that can be picked up. Can be delta message.

See Also:
Serialized Form

Field Summary
 int amount
          if not negative it specified amount of the item (e.g. in medkit it's how many health you will get)
 java.lang.String cls
           
 java.lang.String event
           
static java.lang.String EVENT_PICKUP
          This string is sent in attribute 'Event' when the bot picks up the item.
static java.lang.String EVENT_SEE
          This string is sent in attribute 'Event' when the bot sees the item.
 java.lang.String humanName
          Filled by ItemCathegories.processItem().
 Triple location
           
 NavPoint navPoint
          Warning, can be null if no navpoint of the same location exists!
 boolean reachable
           
 
Fields inherited from class cz.cuni.pogamut.MessageObjects.MessageObject
ID, type, types, UnrealID, visible
 
Constructor Summary
Item()
           
Item(int ID, java.lang.String UnrealID, java.lang.String cls, Triple location, boolean reachable, boolean visible)
           
Item(Item original)
           
Item(MessageType type)
           
Item(MessageType itemType, int ID, java.lang.String UnrealID, java.lang.String cls, Triple location, boolean reachable, boolean visible, NavPoint navPoint)
           
Item(MessageType itemType, int ID, java.lang.String UnrealID, java.lang.String cls, Triple location, boolean reachable, boolean visible, NavPoint navPoint, java.lang.String humanName)
           
Item(MessageType itemType, int ID, java.lang.String UnrealID, java.lang.String cls, Triple location, boolean reachable, boolean visible, NavPoint navPoint, java.lang.String humanName, java.lang.String event, int amount)
           
 
Method Summary
 java.lang.Object clone()
          clone object - for hard copying
 boolean diff(MessageObject old)
          change this object that all properties that are same as old will be set to null or 0 or similar.
 boolean hasID()
          Since not all messages has UnrealID from GameBot, this will tell us which messages does.
 boolean isEventPickup()
           
 boolean isEventSee()
           
 boolean isReachable()
           
 java.lang.String toString()
           
 void update(MessageObject newMsgObj)
          Writes non-null information from newMsgObj to current one.
 
Methods inherited from class cz.cuni.pogamut.MessageObjects.MessageObject
equals, getID, getType, getUnrealID, getVisibility, isVisible, setID, setType, setUnrealID, setVisible
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

location

public Triple location

reachable

public boolean reachable

cls

public java.lang.String cls

amount

public int amount
if not negative it specified amount of the item (e.g. in medkit it's how many health you will get)


EVENT_SEE

public static final java.lang.String EVENT_SEE
This string is sent in attribute 'Event' when the bot sees the item.

See Also:
Constant Field Values

EVENT_PICKUP

public static final java.lang.String EVENT_PICKUP
This string is sent in attribute 'Event' when the bot picks up the item.

See Also:
Constant Field Values

event

public java.lang.String event

humanName

public java.lang.String humanName
Filled by ItemCathegories.processItem(). Represents human readable string (sort of ;-)


navPoint

public NavPoint navPoint
Warning, can be null if no navpoint of the same location exists! E.g. when it falls to the ground.

Constructor Detail

Item

public Item(int ID,
            java.lang.String UnrealID,
            java.lang.String cls,
            Triple location,
            boolean reachable,
            boolean visible)

Item

public Item(MessageType itemType,
            int ID,
            java.lang.String UnrealID,
            java.lang.String cls,
            Triple location,
            boolean reachable,
            boolean visible,
            NavPoint navPoint)

Item

public Item(MessageType itemType,
            int ID,
            java.lang.String UnrealID,
            java.lang.String cls,
            Triple location,
            boolean reachable,
            boolean visible,
            NavPoint navPoint,
            java.lang.String humanName)

Item

public Item(MessageType itemType,
            int ID,
            java.lang.String UnrealID,
            java.lang.String cls,
            Triple location,
            boolean reachable,
            boolean visible,
            NavPoint navPoint,
            java.lang.String humanName,
            java.lang.String event,
            int amount)

Item

public Item(Item original)

Item

public Item(MessageType type)

Item

public Item()
Method Detail

isEventSee

public boolean isEventSee()

isEventPickup

public boolean isEventPickup()

clone

public java.lang.Object clone()
Description copied from class: MessageObject
clone object - for hard copying

Overrides:
clone in class MessageObject

toString

public java.lang.String toString()
Overrides:
toString in class MessageObject

hasID

public boolean hasID()
Since not all messages has UnrealID from GameBot, this will tell us which messages does.

Overrides:
hasID in class MessageObject
Returns:
true

isReachable

public boolean isReachable()

diff

public boolean diff(MessageObject old)
Description copied from class: MessageObject
change this object that all properties that are same as old will be set to null or 0 or similar. in case all properties are same as old, return false, else true.
If old differs from current, update old.

Overrides:
diff in class MessageObject
Parameters:
old - Object we use as reference for change.
Returns:
true if the objects are not different

update

public void update(MessageObject newMsgObj)
Description copied from class: MessageObject
Writes non-null information from newMsgObj to current one. Remember that you have to overide this method if you creates a new descendant, so the Parser and Client can work correctly.

Overrides:
update in class MessageObject