org.starhope.appius.user
Class AvatarClass

java.lang.Object
  extended by org.starhope.appius.sql.SQLPeerDatum
      extended by org.starhope.appius.sql.SQLPeerEnum
          extended by org.starhope.appius.user.AvatarClass
All Implemented Interfaces:
Serializable

public class AvatarClass
extends SQLPeerEnum

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
See Also:
Serialized Form

Field Summary
private static HashMap<Integer,Boolean> canColor
          A cache of whether the avatar class can be colorised
private static HashMap<Integer,Long> defaultBaseColor
          A cache of the default base colour for the avatar class
private static HashMap<Integer,Long> defaultExtraColor
          A cache of the default extra/highlight/feature colour for the avatar class
private static HashMap<Integer,Long> defaultPatternColor
          A cache of the default pattern/hair/additional colour for the avatar class
private static HashMap<Integer,Integer> defaultPatternID
          A cache of the default pattern/hairstyle type for the avatar class
private static HashMap<Integer,String> filenames
          A cache of avatar class filenames
private static HashMap<Integer,Boolean> forFree
          A cache of whether each avatar class is available to free users
private static HashMap<Integer,Boolean> forVIT
          A cache of whether each avatar class is available to paid users
private static long serialVersionUID
          Java serialisation unique ID
 
Fields inherited from class org.starhope.appius.sql.SQLPeerEnum
enumeration, instance
 
Constructor Summary
AvatarClass(int id)
           
AvatarClass(String avatarTitle)
           
 
Method Summary
protected  void cache(ResultSet set)
          This is an overriding method.
 boolean canColor()
          Return whether this avatar class can be colorised (2 planes) or not.
 void flush()
          This is an overriding method.
 String getAvatarString(int avatarNum)
          TODO: document this method (brpocock, Oct 13, 2009)
static AvatarClass getByID(int newID)
          WRITEME: document this method (brpocock, Aug 27, 2009)
 Colour getDefaultBaseColor()
           
 Colour getDefaultExtraColor()
           
 org.starhope.appius.game.inventory.ClothingItem getDefaultPattern()
           
 Colour getDefaultPatternColor()
           
 String getFilename()
           
private static int getIDForAvatarTitle(String avatarTitle)
          TODO: document this method (brpocock, Dec 11, 2009)
protected  PreparedStatement getStatement(Connection connection)
          This is an overriding method.
static void invalidateCache()
          Demolish caches
 boolean isForFree()
           
 boolean isForVIT()
           
protected  void set(ResultSet rs)
          This is an overriding method.
 org.json.JSONObject toJSON()
          This is an overriding method.
 String toString()
          String representation is currently the JSON data
 
Methods inherited from class org.starhope.appius.sql.SQLPeerEnum
doRealCacheResetStatic, equals, equals, get, get, getCacheUniqueID, getEnumeration, getID, getID, getString, getString, hashCode, invalidateCaches, prepCache, resetCache, set, set
 
Methods inherited from class org.starhope.appius.sql.SQLPeerDatum
changed, findInCache, get, saveInCache, set
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

canColor

private static final HashMap<Integer,Boolean> canColor
A cache of whether the avatar class can be colorised


defaultBaseColor

private static final HashMap<Integer,Long> defaultBaseColor
A cache of the default base colour for the avatar class


defaultExtraColor

private static final HashMap<Integer,Long> defaultExtraColor
A cache of the default extra/highlight/feature colour for the avatar class


defaultPatternColor

private static final HashMap<Integer,Long> defaultPatternColor
A cache of the default pattern/hair/additional colour for the avatar class


defaultPatternID

private static final HashMap<Integer,Integer> defaultPatternID
A cache of the default pattern/hairstyle type for the avatar class


filenames

private static final HashMap<Integer,String> filenames
A cache of avatar class filenames


forFree

private static final HashMap<Integer,Boolean> forFree
A cache of whether each avatar class is available to free users


forVIT

private static final HashMap<Integer,Boolean> forVIT
A cache of whether each avatar class is available to paid users


serialVersionUID

private static final long serialVersionUID
Java serialisation unique ID

See Also:
Constant Field Values
Constructor Detail

AvatarClass

public AvatarClass(int id)
Parameters:
id - Instantiate the AvatarClass represented by this ID number.

AvatarClass

public AvatarClass(String avatarTitle)
Parameters:
avatarTitle - WRITEME
Method Detail

getByID

public static AvatarClass getByID(int newID)
WRITEME: document this method (brpocock, Aug 27, 2009)

Parameters:
newID - WRITEME
Returns:
WRITEME

getIDForAvatarTitle

private static int getIDForAvatarTitle(String avatarTitle)
TODO: document this method (brpocock, Dec 11, 2009)

Parameters:
avatarTitle - WRITEME
Returns:
WRITEME

invalidateCache

public static void invalidateCache()
Demolish caches


cache

protected void cache(ResultSet set)
              throws SQLException
This is an overriding method.

Overrides:
cache in class SQLPeerEnum
Parameters:
set - The ResultSet containing this AvatarClass object's values
Throws:
SQLException - if the database has sadness upon us
See Also:
SQLPeerEnum.cache(java.sql.ResultSet)

canColor

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

Returns:
Whether this avatar class can be colorised

flush

public void flush()
This is an overriding method.

Specified by:
flush in class SQLPeerDatum
See Also:
SQLPeerDatum.flush()

getAvatarString

public String getAvatarString(int avatarNum)
TODO: document this method (brpocock, Oct 13, 2009)

Parameters:
avatarNum - WRITEME
Returns:
WRITEME

getDefaultBaseColor

public Colour getDefaultBaseColor()
Returns:
WRITEME

getDefaultExtraColor

public Colour getDefaultExtraColor()
Returns:
WRITEME

getDefaultPattern

public org.starhope.appius.game.inventory.ClothingItem getDefaultPattern()
Returns:
WRITEME

getDefaultPatternColor

public Colour getDefaultPatternColor()
Returns:
default pattern color

getFilename

public String getFilename()
Returns:
SWF filename/URL

getStatement

protected PreparedStatement getStatement(Connection connection)
This is an overriding method.

Specified by:
getStatement in class SQLPeerEnum
Parameters:
connection - WRITEME
Returns:
WRITEME
See Also:
SQLPeerEnum.getStatement(java.sql.Connection)

isForFree

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

isForVIT

public boolean isForVIT()
Returns:
true if this is available for paid users

set

protected void set(ResultSet rs)
            throws SQLException
This is an overriding method.

Specified by:
set in class SQLPeerDatum
Parameters:
rs - The result of an SQL query, with the cursor already pointed at the row describing this specific instance of the object.
Throws:
SQLException - if the database fails somehow
See Also:
SQLPeerDatum.set(java.sql.ResultSet)

toJSON

public org.json.JSONObject toJSON()
Description copied from class: SQLPeerEnum
This is an overriding method.

Overrides:
toJSON in class SQLPeerEnum
Returns:
this object cast as an ActionScript Object for the client.
See Also:
SQLPeerDatum.toJSON()

toString

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

Overrides:
toString in class SQLPeerEnum
See Also:
Object.toString()