cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages
Class Item

Package class diagram package Item
java.lang.Object
  extended by cz.cuni.amis.pogamut.base.communication.messages.InfoMessage
      extended by cz.cuni.amis.pogamut.udk.communication.messages.GBObjectUpdate
          extended by cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages.Item
All Implemented Interfaces:
IWorldChangeEvent, IWorldObjectUpdatedEvent, IWorldObject, ILocated, IViewable, ICompositeWorldObject, ItemTyped, IGBViewable, IGBWorldObjectEvent, cz.cuni.amis.utils.listener.Event

public class Item
extends GBObjectUpdate
implements IGBWorldObjectEvent, IWorldObject, ILocated, IGBViewable, ItemTyped

Synchronous/asynchronous message. An object on the ground that can be picked up. Corresponding GameBots message is INV.


Nested Class Summary
static class Item.ObjectDisappeared
          Used to drop Visible flag from the object.
 
Nested classes/interfaces inherited from interface cz.cuni.amis.pogamut.base.communication.translator.event.IWorldObjectUpdatedEvent
IWorldObjectUpdatedEvent.DestroyWorldObject
 
Field Summary
protected  int Amount
          If this item is some ammo or health pack, here we can find out how much of the attribute this item will add.
protected  ItemDescriptor Descriptor
          Descriptor of the item - according the ItemType you may cast this to various XYZDescriptor.
protected  boolean Dropped
          Whether it is regular item or one dropped by some bot (usually during dying).
protected  UnrealId Id
          Unique Id of the item.
protected  Location Location
          Location of the item.
protected  NavPoint NavPoint
          If the Item is not dropped then it's item that is laying at some navpoint and this is that NavPoint instance.
protected  UnrealId NavPointId
          Id of the navpoint where the item is laying.
static String PROTOTYPE
          Example how the message looks like - used during parser tests.
protected  boolean Reachable
          True if agent can reach the item.
protected  double Time
           
protected  ItemType Type
          Class of the item (e.g. xWeapons.FlakCannonPickup).
protected  boolean Visible
          If the item is in the field of view of the bot.
 
Constructor Summary
Item()
          Used by Yylex to create empty message then to fill it's protected fields (Yylex is in the same package).
Item(Item original)
          Cloning constructor.
Item(Item Original, boolean Visible)
          Used to create event that drops the Visible flag of the item.
Item(UnrealId Id, UnrealId NavPointId, NavPoint NavPoint, boolean Visible, Location Location, boolean Reachable, int Amount, ItemType Type, ItemDescriptor Descriptor, boolean Dropped)
          Creates new instance of command Item.
 
Method Summary
 IGBWorldObjectDisappeared createDisappearEvent()
          Creates an update event that has to update visibility to false.
 boolean equals(Object obj)
           
 int getAmount()
          If this item is some ammo or health pack, here we can find out how much of the attribute this item will add.
 ItemDescriptor getDescriptor()
          Descriptor of the item - according the ItemType you may cast this to various XYZDescriptor.
 UnrealId getId()
          Unique Id of the item.
 double getLastSeenTime()
           
 ILocalWorldObject getLocal()
           
 Location getLocation()
          Location of the item.
 NavPoint getNavPoint()
          If the Item is not dropped then it's item that is laying at some navpoint and this is that NavPoint instance.
 UnrealId getNavPointId()
          Id of the navpoint where the item is laying.
 IWorldObject getObject()
          Returns original object (if method update() has already been called, for bot-programmer that is always true as the original object is updated and then the event is propagated).
 ISharedWorldObject getShared()
           
 long getSimTime()
           
 IStaticWorldObject getStatic()
           
protected  double getTime()
           
 ItemType getType()
          Class of the item (e.g. xWeapons.FlakCannonPickup).
 int hashCode()
           
 boolean isDropped()
          Whether it is regular item or one dropped by some bot (usually during dying).
 boolean isReachable()
          True if agent can reach the item.
 boolean isVisible()
          If the item is in the field of view of the bot.
 void setNavPoint(NavPoint navPoint)
          DO NOT USE THIS METHOD!
protected  void setTime(double time)
           
 String toHtmlString()
           
 String toString()
           
 IWorldObjectUpdateResult update(IWorldObject obj)
           
 
Methods inherited from class cz.cuni.amis.pogamut.base.communication.messages.InfoMessage
toJsonLiteral
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PROTOTYPE

public static final String PROTOTYPE
Example how the message looks like - used during parser tests.

See Also:
Constant Field Values

Id

protected UnrealId Id
Unique Id of the item. This Id represents just item on the map, not in our inventory.


NavPointId

protected UnrealId NavPointId
Id of the navpoint where the item is laying. If null - the item was dropped by the bot or another player.


NavPoint

protected NavPoint NavPoint
If the Item is not dropped then it's item that is laying at some navpoint and this is that NavPoint instance.


Visible

protected boolean Visible
If the item is in the field of view of the bot.


Location

protected Location Location
Location of the item.


Reachable

protected boolean Reachable
True if agent can reach the item.


Amount

protected int Amount
If this item is some ammo or health pack, here we can find out how much of the attribute this item will add.


Type

protected ItemType Type
Class of the item (e.g. xWeapons.FlakCannonPickup).


Descriptor

protected ItemDescriptor Descriptor
Descriptor of the item - according the ItemType you may cast this to various XYZDescriptor.


Dropped

protected boolean Dropped
Whether it is regular item or one dropped by some bot (usually during dying). Items that are not dropped usually respawns itself (depends on the game settings) while those that are dropped may be taken only once.


Time

protected double Time
Constructor Detail

Item

public Item(UnrealId Id,
            UnrealId NavPointId,
            NavPoint NavPoint,
            boolean Visible,
            Location Location,
            boolean Reachable,
            int Amount,
            ItemType Type,
            ItemDescriptor Descriptor,
            boolean Dropped)
Creates new instance of command Item. Synchronous/asynchronous message. An object on the ground that can be picked up. Corresponding GameBots message for this command is .

Parameters:
Id - Unique Id of the item. This Id represents just item on the map, not in our inventory.
NavPointId - Id of the navpoint where the item is laying. If null - the item was dropped by the bot or another player.
NavPoint - If the Item is not dropped then it's item that is laying at some navpoint and this is that NavPoint instance.
Visible - If the item is in the field of view of the bot.
Location - Location of the item.
Reachable - True if agent can reach the item.
Amount - If this item is some ammo or health pack, here we can find out how much of the attribute this item will add.
Type - Class of the item (e.g. xWeapons.FlakCannonPickup).
Descriptor - Descriptor of the item - according the ItemType you may cast this to various XYZDescriptor.
Dropped - Whether it is regular item or one dropped by some bot (usually during dying). Items that are not dropped usually respawns itself (depends on the game settings) while those that are dropped may be taken only once.

Item

public Item(Item original)
Cloning constructor.


Item

public Item()
Used by Yylex to create empty message then to fill it's protected fields (Yylex is in the same package).


Item

public Item(Item Original,
            boolean Visible)
Used to create event that drops the Visible flag of the item.

Method Detail

getId

public UnrealId getId()
Unique Id of the item. This Id represents just item on the map, not in our inventory.

Specified by:
getId in interface IWorldObjectUpdatedEvent
Specified by:
getId in interface IWorldObject

getNavPointId

public UnrealId getNavPointId()
Id of the navpoint where the item is laying. If null - the item was dropped by the bot or another player.


getNavPoint

public NavPoint getNavPoint()
If the Item is not dropped then it's item that is laying at some navpoint and this is that NavPoint instance.


isVisible

public boolean isVisible()
If the item is in the field of view of the bot.

Specified by:
isVisible in interface IViewable

getLocation

public Location getLocation()
Location of the item.

Specified by:
getLocation in interface ILocated

isReachable

public boolean isReachable()
True if agent can reach the item.


getAmount

public int getAmount()
If this item is some ammo or health pack, here we can find out how much of the attribute this item will add.


getType

public ItemType getType()
Class of the item (e.g. xWeapons.FlakCannonPickup).

Specified by:
getType in interface ItemTyped
Returns:

getDescriptor

public ItemDescriptor getDescriptor()
Descriptor of the item - according the ItemType you may cast this to various XYZDescriptor.


isDropped

public boolean isDropped()
Whether it is regular item or one dropped by some bot (usually during dying). Items that are not dropped usually respawns itself (depends on the game settings) while those that are dropped may be taken only once.


getTime

protected double getTime()

setTime

protected void setTime(double time)

getLastSeenTime

public double getLastSeenTime()

getLocal

public ILocalWorldObject getLocal()
Specified by:
getLocal in interface ICompositeWorldObject

getShared

public ISharedWorldObject getShared()
Specified by:
getShared in interface ICompositeWorldObject

getStatic

public IStaticWorldObject getStatic()
Specified by:
getStatic in interface ICompositeWorldObject

getSimTime

public long getSimTime()
Specified by:
getSimTime in interface IWorldChangeEvent
Specified by:
getSimTime in interface IWorldObject

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

setNavPoint

public void setNavPoint(NavPoint navPoint)
DO NOT USE THIS METHOD! Reserved for GaviaLib (Pogamut core)! It's used to set correct navpoint instance into the item.


createDisappearEvent

public IGBWorldObjectDisappeared createDisappearEvent()
Description copied from interface: IGBViewable
Creates an update event that has to update visibility to false.

Specified by:
createDisappearEvent in interface IGBViewable
Returns:

update

public IWorldObjectUpdateResult update(IWorldObject obj)
Specified by:
update in interface IWorldObjectUpdatedEvent

getObject

public IWorldObject getObject()
Returns original object (if method update() has already been called, for bot-programmer that is always true as the original object is updated and then the event is propagated).


toString

public String toString()
Overrides:
toString in class InfoMessage

toHtmlString

public String toHtmlString()


Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.