|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.huguesjohnson.tiamat.NamedObject
com.huguesjohnson.tiamat.Item
public class Item
Item - representation of an item
Field Summary | |
---|---|
static boolean |
DEFAULT_DISAPPEAR_ON_USE
default value for disappearOnUse property |
static boolean |
DEFAULT_EQUIPABLE
default value for equipable property |
static boolean |
DEFAULT_EQUIPPED
default value for equipped property |
Constructor Summary | |
---|---|
Item(java.lang.String name,
java.lang.String description)
Creates a new instance of Item. |
|
Item(java.lang.String name,
java.lang.String description,
java.lang.String absoluteDir,
java.lang.String fullImagePath,
java.lang.String thumbnailImagePath)
Creates a new instance of Item. |
|
Item(java.lang.String name,
java.lang.String description,
java.lang.String absoluteDir,
java.lang.String fullImagePath,
java.lang.String thumbnailImagePath,
boolean equipable,
boolean disappearOnUse,
boolean equipped)
Creates a new instance of Item. |
|
Item(java.lang.String name,
java.lang.String description,
java.lang.String absoluteDir,
java.lang.String fullImagePath,
java.lang.String thumbnailImagePath,
Target[] targets)
Creates a new instance of Item. |
|
Item(java.lang.String name,
java.lang.String description,
java.lang.String absoluteDir,
java.lang.String fullImagePath,
java.lang.String thumbnailImagePath,
Target[] targets,
boolean equipable)
Creates a new instance of Item. |
|
Item(java.lang.String name,
java.lang.String description,
java.lang.String absoluteDir,
java.lang.String fullImagePath,
java.lang.String thumbnailImagePath,
Target[] targets,
boolean equipable,
boolean disappearOnUse)
Creates a new instance of Item. |
|
Item(java.lang.String name,
java.lang.String description,
java.lang.String absoluteDir,
java.lang.String fullImagePath,
java.lang.String thumbnailImagePath,
Target[] targets,
boolean equipable,
boolean disappearOnUse,
boolean equipped)
Creates a new instance of Item. |
|
Item(java.lang.String name,
java.lang.String description,
Target[] targets)
Creates a new instance of Item. |
|
Item(java.lang.String name,
java.lang.String description,
Target[] targets,
boolean equipable)
Creates a new instance of Item. |
|
Item(java.lang.String name,
java.lang.String description,
Target[] targets,
boolean equipable,
boolean disappearOnUse)
Creates a new instance of Item. |
|
Item(java.lang.String name,
java.lang.String description,
Target[] targets,
boolean equipable,
boolean disappearOnUse,
boolean equipped)
Creates a new instance of Item. |
Method Summary | |
---|---|
void |
addTarget(Target target)
Adds a Target to the collection of Targets |
boolean |
getDisappearOnUse()
Returns whether this Item should disappear after being used. |
boolean |
getEquipable()
Returns whether this Item can be equipped. |
boolean |
getEquipped()
Returns whether this Item is currently equipped. |
java.awt.image.BufferedImage |
getFullImage()
Returns the full-size image for this item, change by setting fullImagePath. |
java.lang.String |
getFullImagePath()
Returns the relative path to full-size image for this Item. |
java.lang.String |
getFullImagePathAbsolute()
Returns the absolute path to full-size image for this Item. |
Target |
getTarget(int index)
Returns the Target at the specified index. |
int |
getTargetCount()
Returns the number of targets for this item. |
Target[] |
getTargets()
Returns the Targets for this Item. |
java.awt.image.BufferedImage |
getThumbnailImage()
Returns the thumbnail image for this Item, what would appear in a menu or dialog, change by setting thumbnailImagePath. |
java.lang.String |
getThumbnailImagePath()
Returns the relative path to thumbnail image for this Item. |
java.lang.String |
getThumbnailImagePathAbsolute()
Returns the absolute path to thumbnail image for this Item. |
void |
onDeserialize(Formatter formatter,
java.lang.String absoluteDir)
The onDeserialize event should be fired after an object is de-serialized. |
void |
setAbsoluteDir(java.lang.String absoluteDir)
Sets the absolute working directory for files. |
void |
setDisappearOnUse(boolean disappearOnUse)
Sets whether this Item should disappear after being used. |
void |
setEquipable(boolean equipable)
Sets whether this Item can be equipped. |
void |
setEquipped(boolean equipped)
Sets whether this Item is currently equipped. |
void |
setFullImagePath(java.lang.String fullImagePath)
Sets the relative path to full-size image for this Item, setting this reloads the actual image. |
void |
setTarget(int index,
Target target)
Sets the Target at the specified index. |
void |
setTargets(Target[] targets)
Set the Targets for this Item. |
void |
setThumbnailImagePath(java.lang.String thumbnailImagePath)
Sets the relative path to thumbnail image for this Item, what would appear in a menu or dialog, setting this reloads the actual image. |
java.lang.String |
toString()
Returns a string representation of the object. |
Methods inherited from class com.huguesjohnson.tiamat.NamedObject |
---|
getDescription, getName, setDescription, setName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final boolean DEFAULT_EQUIPPED
public static final boolean DEFAULT_EQUIPABLE
public static final boolean DEFAULT_DISAPPEAR_ON_USE
Constructor Detail |
---|
public Item(java.lang.String name, java.lang.String description)
name
- The name of this Item.description
- The description of this Item.public Item(java.lang.String name, java.lang.String description, Target[] targets)
name
- The name of this Item.description
- The description of this Item.targets
- The Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.public Item(java.lang.String name, java.lang.String description, Target[] targets, boolean equipable)
name
- The name of this Item.description
- The description of this Item.targets
- The Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.equipable
- Whether this Item can be equipped.public Item(java.lang.String name, java.lang.String description, Target[] targets, boolean equipable, boolean disappearOnUse)
name
- The name of this Item.description
- The description of this Item.targets
- The Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.equipable
- Whether this Item can be equipped.disappearOnUse
- Whether this Item should disappear after being used.public Item(java.lang.String name, java.lang.String description, Target[] targets, boolean equipable, boolean disappearOnUse, boolean equipped)
name
- The name of this Item.description
- The description of this Item.targets
- The Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.equipable
- Whether this Item can be equipped.disappearOnUse
- Whether this Item should disappear after being used.equipped
- Whether this Item is equipped.public Item(java.lang.String name, java.lang.String description, java.lang.String absoluteDir, java.lang.String fullImagePath, java.lang.String thumbnailImagePath, Target[] targets, boolean equipable, boolean disappearOnUse, boolean equipped)
name
- The name of this Item.description
- The description of this Item.absoluteDir
- The full path to the working directory.targets
- The Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.equipable
- Whether this Item can be equipped.disappearOnUse
- Whether this Item should disappear after being used.equipped
- Whether this Item is equipped.public Item(java.lang.String name, java.lang.String description, java.lang.String absoluteDir, java.lang.String fullImagePath, java.lang.String thumbnailImagePath)
name
- The name of this Item.description
- The description of this Item.absoluteDir
- The full path to the working directory.fullImagePath
- The relative path to full-size image for this Item.thumbnailImagePath
- The relative path to thumbnail image for this Item.public Item(java.lang.String name, java.lang.String description, java.lang.String absoluteDir, java.lang.String fullImagePath, java.lang.String thumbnailImagePath, Target[] targets)
name
- The name of this Item.description
- The description of this Item.absoluteDir
- The full path to the working directory.fullImagePath
- The relative path to full-size image for this Item.thumbnailImagePath
- The relative path to thumbnail image for this Item.targets
- The Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.public Item(java.lang.String name, java.lang.String description, java.lang.String absoluteDir, java.lang.String fullImagePath, java.lang.String thumbnailImagePath, Target[] targets, boolean equipable)
name
- The name of this Item.description
- The description of this Item.absoluteDir
- The full path to the working directory.fullImagePath
- The relative path to full-size image for this Item.thumbnailImagePath
- The relative path to thumbnail image for this Item.targets
- The Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.equipable
- Whether this Item can be equipped.public Item(java.lang.String name, java.lang.String description, java.lang.String absoluteDir, java.lang.String fullImagePath, java.lang.String thumbnailImagePath, Target[] targets, boolean equipable, boolean disappearOnUse)
name
- The name of this Item.description
- The description of this Item.absoluteDir
- The full path to the working directory.fullImagePath
- The relative path to full-size image for this Item.thumbnailImagePath
- The relative path to thumbnail image for this Item.targets
- The Targets for this Item. For an Item, a Target is an Attribute that the Item modifies.equipable
- Whether this Item can be equipped.disappearOnUse
- Whether this Item should disappear after being used.public Item(java.lang.String name, java.lang.String description, java.lang.String absoluteDir, java.lang.String fullImagePath, java.lang.String thumbnailImagePath, boolean equipable, boolean disappearOnUse, boolean equipped)
name
- The name of this Item.description
- The description of this Item.absoluteDir
- The full path to the working directory.fullImagePath
- The relative path to full-size image for this Item.thumbnailImagePath
- The relative path to thumbnail image for this Item.equipable
- Whether this Item can be equipped.disappearOnUse
- Whether this Item should disappear after being used.equipped
- Whether this Item is equipped.Method Detail |
---|
public void setFullImagePath(java.lang.String fullImagePath)
fullImagePath
- The relative path to full-size image for this Item.public java.lang.String getFullImagePath()
public java.lang.String getFullImagePathAbsolute()
public java.awt.image.BufferedImage getFullImage()
public java.awt.image.BufferedImage getThumbnailImage()
public void setThumbnailImagePath(java.lang.String thumbnailImagePath)
thumbnailImagePath
- The relative path to thumbnail image for this Item, setting this reloads the actual imagepublic java.lang.String getThumbnailImagePath()
public java.lang.String getThumbnailImagePathAbsolute()
public void setTargets(Target[] targets)
targets
- The Targets for this Item.public Target[] getTargets()
public void setTarget(int index, Target target)
index
- The index to set at.target
- The Target to set.public Target getTarget(int index)
index
- The index to retrieve.
public void setEquipped(boolean equipped)
equipped
- Whether this Item is currently equipped.public boolean getEquipped()
public void setEquipable(boolean equipable)
equipable
- Whether this Item can be equipped.public boolean getEquipable()
public void setDisappearOnUse(boolean disappearOnUse)
disappearOnUse
- Whether this Item should disappear after being used.public boolean getDisappearOnUse()
public void setAbsoluteDir(java.lang.String absoluteDir)
absoluteDir
- The full path to the working directory.public java.lang.String toString()
toString
in class NamedObject
public int getTargetCount()
public void addTarget(Target target)
target
- The Target to add.public void onDeserialize(Formatter formatter, java.lang.String absoluteDir)
onDeserialize
in interface Storable
onDeserialize
in class NamedObject
formatter
- the formatter to use to load any storable membersabsoluteDir
- the working directory since all paths stored in the object should be relative
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |