org.starhope.appius.user
Class AvatarClass

java.lang.Object
  extended by org.starhope.appius.util.SimpleDataRecord<AvatarClass>
      extended by org.starhope.appius.user.AvatarClass
All Implemented Interfaces:
com.whirlycott.cache.Cacheable, Serializable, Comparable<AvatarClass>, CastsToJSON, CTime, DataRecord, HasSubversionRevision

public class AvatarClass
extends SimpleDataRecord<AvatarClass>
implements CastsToJSON

The avatar class defines a type of avatar which can be used by a game player or NPC. Different avatar classes may use different physical models, accept different clothing, &c. For example, different alien races or mythical species might be represented by different avatar classes.

Author:
brpocock@star-hope.org
See Also:
Serialized Form

Field Summary
private  AvatarBodyFormat bodyFormat
           
private  boolean canColor
          whether the avatar class can be colorised
private  PolygonPrimitive<?> collisionBounds
          the bounding space for collision detection
private  String collisionBoundsString
          string describing the bounding space for collision detection
private  Colour defaultBaseColour
          the default base colour for the avatar class
private  Colour defaultExtraColour
          the default extra/highlight/feature colour for the avatar class
private  GenericItemReference defaultPattern
          the default pattern/hairstyle type for the avatar class
private  Colour defaultPatternColour
          the default pattern/hair/additional colour for the avatar class
private  String filename
          avatar class filename
private  boolean forFree
          A cache of whether each avatar class is available to free users
private  String format
          WRITEME: Document this brpocock@star-hope.org
private  boolean forPaid
          A cache of whether each avatar class is available to paid users
private  double height
           
private  int id
          unique ID
private  String ident
          string identifier
private static long serialVersionUID
          Java serialisation unique ID
 
Fields inherited from class org.starhope.appius.util.SimpleDataRecord
myLoader, timeLastChanged, timeLastSaved
 
Constructor Summary
AvatarClass()
          nil constructor
AvatarClass(RecordLoader<AvatarClass> loader)
           
 
Method Summary
 boolean canColor()
          /** Return whether this avatar class can be colorised (2 planes) or not.
 int compareTo(AvatarClass o)
           
 String getAvatarString(int avatarNum)
          Deprecated. this is really dumb
 AvatarBodyFormat getBodyFormat()
           
static AvatarClass getByID(int id)
          Deprecated. use 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.
 String getCollisionBounds_string()
           
 PolygonPrimitive<?> getCollisionBounds()
           
 Colour getDefaultBaseColor()
           
 Colour getDefaultBaseColour()
           
 Colour getDefaultExtraColor()
           
 Colour getDefaultExtraColour()
           
 GenericItemReference getDefaultPattern()
           
 Colour getDefaultPatternColor()
           
 Colour getDefaultPatternColour()
           
 String getFilename()
           
 String getFormat()
          WRITEME: Document this method brpocock@star-hope.org
 double getHeight()
          FIXME: Avatar heights should be some kind of database entry?
 int getID()
           
 ItemManager getItemManager(Inventory inventory)
          WRITEME: Document this method brpocock@star-hope.org
 String getName()
           
 String getSubversionRevision()
           Return the Subversion revision level of this class's source code file, as supplied via the special "$Rev: " sequence.
 boolean isForFree()
           
 boolean isForPaid()
           
 boolean isForVIT()
          Deprecated. use isForPaid() — VIT is Tootsville™-specific terminology
 void setBodyFormat(AvatarBodyFormat newBodyFormat)
          WRITEME: Document this method brpocock@star-hope.org
 void setCanColor(boolean really)
           
 void setCollisionBounds(String newString)
           
 void setDefaultBaseColour(Colour newColour)
           
 void setDefaultExtraColour(Colour newColour)
           
 void setDefaultPattern(GenericItemReference newPattern)
           
 void setDefaultPatternColour(Colour newColour)
           
 void setFilename(String newFile)
           
 void setForFree(boolean really)
           
 String setFormat(String newFormat)
          WRITEME: Document this method brpocock@star-hope.org
 void setForPaid(boolean really)
           
 void setHeight(double heightScalar)
          WRITEME: Document this method brpocock@star-hope.org
 void setID(int newID)
          Note: does not call SimpleDataRecord.changed()
 void setName(String newName)
           
 org.json.JSONObject toJSON()
          This returns a copy of the object's data cast into a JSON form.
 String toString()
          String representation is currently the JSON data
 
Methods inherited from class org.starhope.appius.util.SimpleDataRecord
changed, checkStale, 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
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Java serialisation unique ID

See Also:
Constant Field Values

bodyFormat

private AvatarBodyFormat bodyFormat

canColor

private boolean canColor
whether the avatar class can be colorised


collisionBounds

private PolygonPrimitive<?> collisionBounds
the bounding space for collision detection


collisionBoundsString

private String collisionBoundsString
string describing the bounding space for collision detection


defaultBaseColour

private Colour defaultBaseColour
the default base colour for the avatar class


defaultExtraColour

private Colour defaultExtraColour
the default extra/highlight/feature colour for the avatar class


defaultPattern

private GenericItemReference defaultPattern
the default pattern/hairstyle type for the avatar class


defaultPatternColour

private Colour defaultPatternColour
the default pattern/hair/additional colour for the avatar class


filename

private String filename
avatar class filename


forFree

private boolean forFree
A cache of whether each avatar class is available to free users


format

private String format
WRITEME: Document this brpocock@star-hope.org


forPaid

private boolean forPaid
A cache of whether each avatar class is available to paid users


height

private double height

id

private int id
unique ID


ident

private String ident
string identifier

Constructor Detail

AvatarClass

public AvatarClass()
nil constructor


AvatarClass

public AvatarClass(RecordLoader<AvatarClass> loader)
Parameters:
loader - record loader
Method Detail

getByID

@Deprecated
public static AvatarClass getByID(int id)
Deprecated. use Nomenclator.getDataRecord(Class, int)

Parameters:
id - ID
Returns:
the record in question

canColor

public boolean canColor()
/** Return whether this avatar class can be colorised (2 planes) or not.

Returns:
Whether this avatar class can be colorised

compareTo

public int compareTo(AvatarClass o)
Specified by:
compareTo in interface Comparable<AvatarClass>
Overrides:
compareTo in class SimpleDataRecord<AvatarClass>
See Also:
SimpleDataRecord.compareTo(org.starhope.appius.util.SimpleDataRecord)

getAvatarString

@Deprecated
public String getAvatarString(int avatarNum)
Deprecated. this is really dumb

XXX This is terribly Tootsville™ specific. And dumb.

Parameters:
avatarNum - ID number
Returns:
Tootsville™ specific avatar name for quadruped avatars

getBodyFormat

public AvatarBodyFormat getBodyFormat()
Returns:
the AvatarBodyFormat that best describes the layout of this AvatarClass with respect to InventoryItemType slots.

getCacheableID

public int getCacheableID()
                   throws NotFoundException
Description copied from interface: DataRecord
Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier ( DataRecord.getCacheableIdent() or both.

Specified by:
getCacheableID in interface DataRecord
Returns:
an unique ID number
Throws:
NotFoundException - if the item doesn't have a distinct numeric ID
See Also:
DataRecord.getCacheableID()

getCacheableIdent

public String getCacheableIdent()
                         throws NotFoundException
Description copied from interface: DataRecord
Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier ( DataRecord.getCacheableIdent() or both.

Specified by:
getCacheableIdent in interface DataRecord
Returns:
an unique identifier string
Throws:
NotFoundException - if the item doesn't have a distinct string identifier
See Also:
DataRecord.getCacheableIdent()

getCollisionBounds

public PolygonPrimitive<?> getCollisionBounds()
Returns:
a collision polyhedron/subspace/…

getCollisionBounds_string

public String getCollisionBounds_string()
Returns:
a string somehow describing a collision polyhedron/subspace/…

getDefaultBaseColor

public Colour getDefaultBaseColor()
Returns:
the default base colour associated with the avatar class

getDefaultBaseColour

public Colour getDefaultBaseColour()
Returns:
the default base colour associated with the avatar class

getDefaultExtraColor

public Colour getDefaultExtraColor()
Returns:
the default extra colour associated with the avatar class

getDefaultExtraColour

public Colour getDefaultExtraColour()
Returns:
the default extra colour associated with the avatar class

getDefaultPattern

public GenericItemReference getDefaultPattern()
Returns:
the default pattern associated with the avatar class

getDefaultPatternColor

public Colour getDefaultPatternColor()
Returns:
default pattern color associated with the avatar class

getDefaultPatternColour

public Colour getDefaultPatternColour()
Returns:
the defaultPatternColour

getFilename

public String getFilename()
Returns:
the filename/URI/identifier of the avatar class itself

getFormat

public String getFormat()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

getHeight

public double getHeight()
FIXME: Avatar heights should be some kind of database entry?

Returns:
height in pixels

getID

public int getID()
Returns:
the ID

getItemManager

public ItemManager getItemManager(Inventory inventory)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
inventory - the user's inventory (which user must be of this AvatarClass for the ItemManager returned to be meaningful)
Returns:
Get the ItemManager which encompasses this avatar class and the given Inventory

getName

public String getName()
Returns:
the name

getSubversionRevision

public String getSubversionRevision()
Description copied from interface: 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: ";
 }
 

Specified by:
getSubversionRevision in interface HasSubversionRevision
Returns:
The Subversion revision level for this class's source code file.
See Also:
HasSubversionRevision.getSubversionRevision()

isForFree

public boolean isForFree()
Returns:
true if this is available for free users

isForPaid

public boolean isForPaid()
Returns:
the forPaid

isForVIT

@Deprecated
public boolean isForVIT()
Deprecated. use isForPaid() — VIT is Tootsville™-specific terminology

Returns:
true, if paid members can use this avatar

setBodyFormat

public void setBodyFormat(AvatarBodyFormat newBodyFormat)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
newBodyFormat - WRITEME

setCanColor

public void setCanColor(boolean really)
Parameters:
really - whether the avatar class can be colorised

setCollisionBounds

public void setCollisionBounds(String newString)
Parameters:
newString - a string somehow describing a collision polyhedron/subspace/…

setDefaultBaseColour

public void setDefaultBaseColour(Colour newColour)
Parameters:
newColour - the defaultBaseColour to set

setDefaultExtraColour

public void setDefaultExtraColour(Colour newColour)
Parameters:
newColour - the defaultExtraColour to set

setDefaultPattern

public void setDefaultPattern(GenericItemReference newPattern)
Parameters:
newPattern - the defaultPattern to set

setDefaultPatternColour

public void setDefaultPatternColour(Colour newColour)
Parameters:
newColour - the defaultPatternColour to set

setFilename

public void setFilename(String newFile)
Parameters:
newFile - the filename to set

setForFree

public void setForFree(boolean really)
Parameters:
really - the forFree to set

setFormat

public String setFormat(String newFormat)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
newFormat - WRITEME
Returns:
WRITEME

setForPaid

public void setForPaid(boolean really)
Parameters:
really - the forPaid to set

setHeight

public void setHeight(double heightScalar)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
heightScalar - WRITEME

setID

public void setID(int newID)
Note: does not call SimpleDataRecord.changed()

Parameters:
newID - new ID

setName

public void setName(String newName)
Parameters:
newName - new name

toJSON

public org.json.JSONObject toJSON()
Description copied from interface: CastsToJSON
This returns a copy of the object's data cast into a JSON form.

Specified by:
toJSON in interface CastsToJSON
Returns:
this object cast as an ActionScript Object for the client.
See Also:
CastsToJSON.toJSON()

toString

public String toString()
String representation is currently the JSON data

Overrides:
toString in class SimpleDataRecord<AvatarClass>
See Also:
Object.toString()