|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.starhope.appius.util.SimpleDataRecord<GenericItemReference>
org.starhope.appius.game.inventory.GenericItemReference
public class GenericItemReference
This represents an abstract/template item found in a store.
XXX Some day, the pricing information needs to be isolated in the shopping stores, and eliminate the Tootsville™-style default logic of all items having only one canonical price. The NPC storekeepers and such should set up the pricing and handle the trading, without having prices hard-coded universally for all instances of a given item.
Field Summary | |
---|---|
private boolean |
canTrade
Whether this item can be traded, dropped, or given away. |
private Currency |
currency
the currency units for the price |
private String |
description
user-visible description |
private int |
effectsTypeID
The ID of the ItemEffectsType to determine the ItemEffects for this item. |
private char |
equipSlot
The effects slot for this item. |
private EquipType |
equipType
Whether this item is an equippable item which traps a specific class of events is indicated by this field. |
private HealthType |
healthType
Health interpretation is determined by this enumeration type. |
private int |
itemID
unique database ID |
private InventoryItemType |
itemType
the general class or slot of items to which this belongs. |
private BigDecimal |
price
price in currency units |
private RarityRating |
rarity
how rare is this item when items are randomly given out |
private static long |
serialVersionUID
Java serialization UID |
private String |
title
user-visible title |
Fields inherited from class org.starhope.appius.util.SimpleDataRecord |
---|
myLoader, timeLastChanged, timeLastSaved |
Constructor Summary | |
---|---|
GenericItemReference(RecordLoader<GenericItemReference> loader)
WRITEME: Document this constructor brpocock@star-hope.org |
Method Summary | |
---|---|
boolean |
canTrade()
WRITEME: Document this method brpocock@star-hope.org |
static GenericItemReference |
getByID(int itemID)
Deprecated. user Nomenclator.getDataRecord(Class, int) |
int |
getCacheableID()
Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier (
DataRecord.getCacheableIdent() or both. |
String |
getCacheableIdent()
Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier (
DataRecord.getCacheableIdent() or both. |
Collection<ItemCollection> |
getCollections()
XXX contains SQL, TODO check SQL |
Currency |
getCurrency()
|
String |
getDescription()
Get the user-visible description of the item |
int |
getEffectsTypeID()
|
char |
getEquipSlot()
|
EquipType |
getEquipType()
Get the type of events which this item, when equipped, provides; e.g. |
HealthType |
getHealthType()
Get the measurement type for interpreting this type of item's health indicator |
int |
getItemID()
|
InventoryItemType |
getItemType()
|
private static int |
getMaxID()
XXX: contains SQL |
BigDecimal |
getPrice()
|
static GenericItemReference |
getRandomItem(RarityRating minRarity,
RarityRating maxRarity)
|
RarityRating |
getRarity()
|
String |
getSubversionRevision()
Return the Subversion revision level of this class's source code file, as supplied via the special "$Rev: " sequence. |
String |
getTitle()
|
void |
setCanTrade(boolean equals)
WRITEME: Document this method brpocock@star-hope.org |
void |
setDescription(String string)
WRITEME: Document this method brpocock@star-hope.org |
int |
setEffectsTypeID(int newEffectsType)
set the ItemEffects class type ID pointer (via ItemEffectsType table indirection) for this item type. |
char |
setEquipSlot(char slot)
Set the slot into which a piece of equipment is mounted. |
EquipType |
setEquipType(EquipType newEquipType)
Set the type of events which this item, when equipped, provides; e.g. |
HealthType |
setHealthType(HealthType newHealthType)
Set the measurement type for interpreting this type of item's health indicator. |
void |
setItemID(int newItemID)
|
void |
setItemType(InventoryItemType inventoryItemType)
WRITEME: Document this method brpocock@star-hope.org |
void |
setPrice(Currency newCurrency,
BigDecimal newPrice)
|
void |
setPrice(Currency units,
int int1)
WRITEME: Document this method brpocock@star-hope.org |
void |
setRarity(RarityRating newRarity)
|
void |
setTitle(String newTitle)
|
org.json.JSONObject |
toJSON()
WRITEME: document this method (brpocock@star-hope.org, Aug 27, 2009) |
String |
toString()
|
Methods inherited from class org.starhope.appius.util.SimpleDataRecord |
---|
changed, checkStale, compareTo, equals, finalize, getRecordLoader, getTimeLastChanged, getTimeLastSaved, hashCode, isBeingLoaded, markAsLoaded, markAsSaved, markForReload, onRemove, onRetrieve, onStore, save, setRecordLoader |
Methods inherited from class java.lang.Object |
---|
clone, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.starhope.appius.util.DataRecord |
---|
checkStale, getRecordLoader, isBeingLoaded, markAsLoaded, markAsSaved, setRecordLoader |
Methods inherited from interface org.starhope.appius.util.CTime |
---|
getTimeLastChanged, getTimeLastSaved |
Methods inherited from interface com.whirlycott.cache.Cacheable |
---|
onRemove, onRetrieve, onStore |
Field Detail |
---|
private static final long serialVersionUID
private boolean canTrade
private Currency currency
private String description
private int itemID
private InventoryItemType itemType
private BigDecimal price
private RarityRating rarity
private String title
private HealthType healthType
private EquipType equipType
Whether this item is an equippable item which traps a specific class of events is indicated by this field.
private int effectsTypeID
ItemEffectsType
to determine the ItemEffects
for this item.
private char equipSlot
setEquipSlot(char)
Constructor Detail |
---|
public GenericItemReference(RecordLoader<GenericItemReference> loader)
loader
- WRITEMEMethod Detail |
---|
@Deprecated public static GenericItemReference getByID(int itemID)
Nomenclator.getDataRecord(Class, int)
itemID
- WRITEME
private static int getMaxID()
public static GenericItemReference getRandomItem(RarityRating minRarity, RarityRating maxRarity)
minRarity
- the minimum rarity of an item to be chosenmaxRarity
- the maximum rarity of an item to be chosen
public boolean canTrade()
public int getCacheableID() throws NotFoundException
DataRecord
DataRecord.getCacheableID()
or a string identifier (
DataRecord.getCacheableIdent()
or both.
getCacheableID
in interface DataRecord
NotFoundException
- if the item doesn't have a distinct
numeric IDDataRecord.getCacheableID()
public String getCacheableIdent()
DataRecord
DataRecord.getCacheableID()
or a string identifier (
DataRecord.getCacheableIdent()
or both.
getCacheableIdent
in interface DataRecord
DataRecord.getCacheableIdent()
public Collection<ItemCollection> getCollections()
getCollections
in interface AbstractItem
AbstractItem.getCollections()
public Currency getCurrency()
getCurrency
in interface AbstractItem
AbstractItem.getCurrency()
public String getDescription()
AbstractItem
getDescription
in interface AbstractItem
AbstractItem.getDescription()
public int getEffectsTypeID()
ItemEffectsType
to determine the ItemEffects
for this item.public char getEquipSlot()
setEquipSlot(char)
public EquipType getEquipType()
public HealthType getHealthType()
public int getItemID()
getItemID
in interface AbstractItem
AbstractItem.getItemID()
public InventoryItemType getItemType()
public BigDecimal getPrice()
getPrice
in interface AbstractItem
AbstractItem.getPrice()
public RarityRating getRarity()
getRarity
in interface AbstractItem
AbstractItem.getRarity()
public String getSubversionRevision()
HasSubversionRevision
Return the Subversion revision level of this class's source code file, as supplied via the special "$Rev: " sequence.
As an example,the Subversion revision string for this file is "$Rev: 1968 $"
@Override public String getSubversionRevision () { return "$Rev: "; }
getSubversionRevision
in interface HasSubversionRevision
HasSubversionRevision.getSubversionRevision()
public String getTitle()
getTitle
in interface AbstractItem
AbstractItem.getTitle()
public void setCanTrade(boolean equals)
equals
- WRITEMEpublic void setDescription(String string)
string
- WRITEMEpublic int setEffectsTypeID(int newEffectsType)
ItemEffects
class type ID pointer (via ItemEffectsType
table indirection) for this item type. Note that if the item is currently set to return a getEquipType()
of EquipType
EquipType.SILENT
, setting a non-null handler will force it to EquipType.PASSIVE
. Likewise, setting this to a -1 (null) handler ID will revert to EquipType.SILENT
.
newEffectsType
- the ID of the new ItemEffectsType
to be applied
public char setEquipSlot(char slot)
Set the slot into which a piece of equipment is mounted. If an
equipment item has no effects (purely cosmetic), it mounts into
equipment slot ' ' (EquipType.SILENT
); if it has passive
effects but does not consume user actions, it goes in slot '.' (
EquipType.PASSIVE
); if it consumes a user input action
type of some kind, it goes into a slot which will typically be a
single letter or digit. Punctuation marks are reserved for future
globally reserved values, so please stick with 'A'..'Z' &
'0'..'9' for game-specific purposes in defining such slots.
Note that equipment slots are not the same as either
inventory slots (see InventoryItem.getSlotNumber()
, which
uniquely define a specific item instance throughout the game
universe, nor are they the same as clothing/furniture item types
(InventoryItemType
), which are used to define slots and
valences for clothing and equipment with regards to how and where
it is held or mounted, and not what interface actions it consumes
and/or alters.
The
Commands.do_click(JSONObject, org.starhope.appius.user.AbstractUser, org.starhope.appius.game.Room)
handler will redirect events of the type Shift + Click to slot
“1,” Control (Command) + Click to slot “2,“ and Alt (Option) +
Click to slot “3.”
slot
- the slot into which this type of item is placed
(equpment slot)
public EquipType setEquipType(EquipType newEquipType)
newEquipType
- the equipment slot type
public HealthType setHealthType(HealthType newHealthType)
newHealthType
- The measurement type to be used to interpret
this type of item's health indicator.
public void setItemID(int newItemID)
setItemID
in interface AbstractItem
newItemID
- the new item IDAbstractItem.setItemID(int)
public void setItemType(InventoryItemType inventoryItemType)
inventoryItemType
- WRITEMEpublic void setPrice(Currency newCurrency, BigDecimal newPrice)
setPrice
in interface AbstractItem
newPrice
- the new pricenewCurrency
- the currency unitsAbstractItem.setPrice(Currency,java.math.BigDecimal)
public void setPrice(Currency units, int int1)
units
- WRITEMEint1
- WRITEMEpublic void setRarity(RarityRating newRarity)
newRarity
- the rarity to setpublic void setTitle(String newTitle)
setTitle
in interface AbstractItem
newTitle
- the new titleAbstractItem.setTitle(java.lang.String)
public org.json.JSONObject toJSON()
AbstractItem
toJSON
in interface AbstractItem
AbstractItem.toJSON()
public String toString()
toString
in class SimpleDataRecord<GenericItemReference>
Object.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |