org.starhope.appius.user
Class GeneralUser

java.lang.Object
  extended by org.starhope.appius.user.GeneralUser
All Implemented Interfaces:
Serializable, Comparable<Object>, RoomListener, Collidable, HasVariables, AbstractUser, DataRecordBacked<UserRecord>
Direct Known Subclasses:
AbstractNonPlayerCharacter, Ejecta, User

public abstract class GeneralUser
extends Object
implements AbstractUser, Collidable

WRITEME: Document this type.

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

Field Summary
(package private)  DamageTypeRanks baseDefenses
          Inherent basic defenses
protected  Map<UserStat,Integer> baseStats
          The user's base stats
 PolygonPrimitive<?> collisionBounds
          Collision boundaries for an unknown thing or other
private  String currentAction
          The action or movement currently being performed by the NPC.
protected  Room currentRoom
          The current room in which the user is active.
protected  String facing
          The direction in which the user is facing.
protected  long lastUserMovement
          the last time that the user intentionally started moving.
(package private)  Coord3D location
          Current coördinates for the user (as of travelStartTime)
private  ReentrantLock locationLock
          Locking semaphore for location
protected  PathFinder pathFinder
          path controller
private static long serialVersionUID
          Java serialisation unique ID
(package private)  Coord3D target
          Destination coördinates towards which the user is currently moving; May be identical to location
(package private)  long travelStartTime
          The time at which the user started moving on their current movement vector.
protected  UserRecord userRecord
          The user record backing this user
(package private)  ConcurrentHashMap<String,String> userVariables
          Arbitrary user variables which can be set or retrieved by the front-end
 
Constructor Summary
GeneralUser()
          WRITEME: Document this constructor brpocock@star-hope.org
GeneralUser(UserRecord newRecord)
           
 
Method Summary
 void acceptObjectJoinRoom(Room room, RoomListener object)
          Notification that someone has entered the room.
 void acceptObjectPartRoom(Room room, RoomListener thing)
          Notification that someone has left a room
 void acceptOutOfBandMessage(AbstractUser sender, Room room, org.json.JSONObject body)
          Accept an out-of-band communications packet that was broadcast to a room in which this Listener is listening.
 void acceptUserAction(Room r, AbstractUser u)
          User actions (go/do actions) propagate through this channel.
 void acceptUserVariableUpdate(AbstractUser user, String varName, String varValue)
          Receive notification of the change of an user variable
 void addBuddy(AbstractUser buddy)
           
 void assertLocationUnlocked()
          WRITEME: Document this method brpocock@star-hope.org
 void assertStaffLevel(int staffLevelNeeded)
          Deprecated. use Security.hasCapability(AbstractUser, org.starhope.appius.sys.admin.SecurityCapability)
 void attend(AbstractUser interestingFellow)
          Attend to an user who may previously have been ignored
 boolean canApproveSelf()
          If the user is a teen (13+) or adult, they are allowed to approve their own account.
 boolean canBetaTest()
           
 boolean canEnterChatZone()
           
 boolean canEnterMenuZone()
           
 DamageTypeRanks changeBaseDefenses(DamageTypeRanks alteration)
           
 int compareTo(Object o)
           
 void deleteVariable(String key)
          This is an overriding method.
 void doffClothes()
          WRITEME
 boolean equals(Object obj)
           
 int getAge()
           
 AgeBracket getAgeGroup()
          Get the user's age bracket.
 String getApprovedDateString()
           
 DamageTypeRanks getBaseDefenses()
           
 int getBaseStat(UserStat stat)
          get a base stat (before any modifiers for items or transient effects are applied)
 Coord2D getCenterOfMass()
          Gets the object's current center of mass in world coordinates
 PolygonPrimitive<?> getCollisionBounds()
          Gets the collision boundaries for the object
 String getCurrentAction()
          Normally “Walk” but can be any action that the client recognises for the avatar type
protected  String getD()
          Get the archaïc “d” variable
 String getDialect()
           
 String getDisplayName()
           
 DamageTypeRanks getEffectiveDefenses()
          Get the effective defenses of the user (including transient and item effects)
 long getEndMovementTime(long currentTime)
           
 Colour getExtraColor()
           
 String getFacing()
          Get the string identifying the direction which this object is facing.
 org.json.JSONObject getGameEquipItems_JSON()
           
 Collection<InventoryItem> getGameEquipItems()
          If the user has a game item equipped (e.g.
 double getHeight()
          Height in pixels.
 UserHouse getHouse()
          WRITEME: Document this method brpocock@star-hope.org
 Inventory getInventory()
          WRITEME: document this method (brpocock@star-hope.org, Feb 19, 2010)
 Collection<InventoryItem> getItemsByType(String typeString)
          Get all items that identify as the type string.
 Collection<InventoryItem> getItemsByType(String[] types)
          Get all inventory items which are (any of) the given type(s).
 InventoryItem[] getItemsByTypeAsArray(String typeString)
          Get all items that identify as the type string.
 int getKickedByUserID()
           
 String getKickedReasonCode()
           
 Timestamp getKickedUntil()
           
 Coord3D getLocationForUpdate()
          Gets the current coördinates.
 double getMass()
          Gets the mass of the collidable object
 BigDecimal getMoney(Currency currency)
          To be deprecated in favour of AbstractUser.getWallet() ASAP!
 PathFinder getPathFinder()
          WRITEME: Document this method brpocock@star-hope.org
 org.json.JSONObject getPublicInfo()
           Returned packet contains:
 Timestamp getRegisteredAt()
           
 Date getRegisteredDate()
           
 String getRegisteredDateString()
           
 String getRequestedName()
           
 String getResponsibleMail()
           Get the eMail address of a responsible person: either the player, or the parent.
 Room getRoom()
          WRITEME: document this method (brpocock@star-hope.org, Oct 31, 2009)
 int getRoomNumber()
          WRITEME: document this method (brpocock@star-hope.org, Jan 11, 2010)
 double getSizeScalar()
          WRITEME: Document this method brpocock@star-hope.org
 int getStaffLevel()
          WRITEME: document this method (brpocock@star-hope.org, Jan 11, 2010)
 long getStartMovementTime()
           
 long getStartT()
           
 int getStat(UserStat stat)
          Get the user's effective stat value (considering any transient effects in place as well as the base stat)
 Coord3D getTarget()
          Gets the current target
 double getTravelRate()
          This is an overriding method.
 long getTravelStart()
          This is an overriding method.
 int getUserID()
          Get the user ID number for this user
 UserListIterator getUserListIterator(String moniker)
          WRITEME: Document this method brpocock@star-hope.org
 String getUserName()
           
 Map<String,String> getUserVariables()
          WRITEME: document this method (brpocock@star-hope.org, Jan 11, 2010)
 String getVariable(String string)
          Get the value of a given variable by name.
 Map<String,String> getVariables()
          Get all user variables in a hash map
 org.json.JSONObject getVariablesJSON()
          Get all values in JSON form
 Vector2D getVelocity()
          Gets the object's current velocity
 Wallet getWallet()
           
 Zone getZone()
          WRITEME: document this method (brpocock@star-hope.org, Oct 31, 2009)
 Coord3D handleWalkFail(Room room, Coord3D to)
          Called from pathfinders and rooms when the user tries to go someplace and can't get there, to allow them to plot a course around obstacles.
 int hashCode()
           
 boolean hasStaffLevel(int staffLevelNeeded)
          Deprecated. 
 boolean hasVariable(String string)
          WRITEME: document this method (brpocock@star-hope.org, Nov 30, 2009)
 void ignore(AbstractUser boringFellow)
          Calling this method indicates that this user wants to ignore the other specified user.
 boolean isActive()
           
 boolean isApproved()
           
 boolean isBanned()
           
 boolean isCanceled()
           
 boolean isKicked()
           
 boolean isPaidMember()
           
protected  void local_publicInfo(org.json.JSONObject userInfo)
          Append information in the subclass to the already-prepared JSON data for the getPublicInfo call
 boolean needsParent()
          Kid accounts (under 13) require parental confirmation.
 void purchase(GenericItemReference itemToBuy)
          WRITEME: Document this method brpocock@star-hope.org
 void removeBuddy(AbstractUser byLogin)
           
 void resetVariables(Map<String,String> map)
          WRITEME: Document this method brpocock@star-hope.org
 void sendBuddyList(String whichList, List<UserListEntry> users)
          WRITEME: Document this method brpocock@star-hope.org
 void sendEarnings(Room room, String string)
           
 void sendWardrobe()
          WRITEME
 void setAgeGroupToSystem()
          WRITEME
 void setBackingRecord(UserRecord rec)
          Force the backing record for this object to be the given one.
 void setBaseColor(Colour colour)
          WRITEME
 void setCanTalk(boolean b)
          WRITEME
 void setCenterOfMass(Coord2D com)
          Sets the object's new center of mass in world space coordinates (i.e.
 void setCurrentAction(String newAction)
          Normally “Walk” but can be any action that the client recognizes for the avatar type
 void setExtraColor(Colour colour)
           
 void setFacing(String newFacing)
           
 void setLocation(Coord3D coord3d)
           
 int setRoom(Room room)
          Set the user's current room to the given room.
 void setStartT(long when)
          set the time at which the player started moving — not necessarily the same as AbstractUser.getTravelStart() because that value is updated over time, this value is when they actually started moving along the path altogether
 void setTarget(Coord3D newTarget)
          Sets the new target coördinates
 void setTravelRate(double rate)
          This is an overriding method.
 void setTravelStart(long l)
          WRITEME: Document this method brpocock@star-hope.org
 void setVariable(Map.Entry<String,String> var)
          This is an overriding method.
 void setVariable(String varName, String varValue)
          Set an user variable.
 void setVariables(Map<String,String> map)
          This is an overriding method.
 void setVelocity(Vector2D velocity)
          This method does nothing because we shouldn't be setting the speed and direction of users
 boolean takeAttack(DamageTypeRanks attack)
          WRITEME: Document this method brpocock@star-hope.org
 void unlockLocation()
          Unlock an user's location, locked by a call to AbstractUser.getLocationForUpdate() (q.v.)
 void updateWallet()
          review your current wallet currency amounts, they may have changed
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.starhope.appius.user.AbstractUser
acceptErrorReply, acceptMessage, acceptPrivateMessage, acceptSuccessReply, addGiftSubscription, addItem, ban, canTalk, doTransport, getAvatarClass, getAvatarLabel, getBaseColor, getBuddyListNames, getDebugName, getIPAddress, getKickedMessage, getLag, getLanguage, getLocation, getMail, getNameApprovedAt, getNameRequestedAt, getServerThread, isNPC, isOnline, kick, liftBan, reportedToModeratorBy, reportedToModeratorBy, sendMigrate, sendOops, sendResponse, setLastActive, setMail, setParent, speak, toJSON, toSFSXML
 
Methods inherited from interface org.starhope.appius.game.RoomListener
acceptGameAction, acceptGameStateChange, acceptPublicMessage, acceptPublicMessage
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Java serialisation unique ID

See Also:
Constant Field Values

collisionBounds

public PolygonPrimitive<?> collisionBounds
Collision boundaries for an unknown thing or other


currentAction

private String currentAction
The action or movement currently being performed by the NPC. Usually “Walk” or “idle” but can be any verb understood by the client/avatar combination, e.g. “mosey”


currentRoom

protected transient Room currentRoom
The current room in which the user is active. This can be null.


facing

protected String facing
The direction in which the user is facing. Must be one of: N S E W NE NW SW SE


lastUserMovement

protected long lastUserMovement
the last time that the user intentionally started moving.


location

Coord3D location
Current coördinates for the user (as of travelStartTime)


locationLock

private final ReentrantLock locationLock
Locking semaphore for location

See Also:
AbstractUser.getLocationForUpdate(), AbstractUser.unlockLocation()

target

Coord3D target
Destination coördinates towards which the user is currently moving; May be identical to location


travelStartTime

long travelStartTime
The time at which the user started moving on their current movement vector. Measured in milliseconds since epoch.


userRecord

protected UserRecord userRecord
The user record backing this user


userVariables

final ConcurrentHashMap<String,String> userVariables
Arbitrary user variables which can be set or retrieved by the front-end


pathFinder

protected final PathFinder pathFinder
path controller


baseStats

protected final Map<UserStat,Integer> baseStats
The user's base stats


baseDefenses

DamageTypeRanks baseDefenses
Inherent basic defenses

Constructor Detail

GeneralUser

public GeneralUser()
WRITEME: Document this constructor brpocock@star-hope.org


GeneralUser

public GeneralUser(UserRecord newRecord)
            throws GameLogicException
Parameters:
newRecord - the user data record backing this user
Throws:
GameLogicException - if the record is null
Method Detail

acceptObjectJoinRoom

public void acceptObjectJoinRoom(Room room,
                                 RoomListener object)
Description copied from interface: RoomListener
Notification that someone has entered the room.

Specified by:
acceptObjectJoinRoom in interface RoomListener
Parameters:
room - The room
object - The thing (probably user) entering
See Also:
RoomListener.acceptObjectJoinRoom(org.starhope.appius.game.Room, org.starhope.appius.game.RoomListener)

acceptObjectPartRoom

public void acceptObjectPartRoom(Room room,
                                 RoomListener thing)
Description copied from interface: RoomListener
Notification that someone has left a room

Specified by:
acceptObjectPartRoom in interface RoomListener
Parameters:
room - The room
thing - The thing (probably user) departing
See Also:
RoomListener.acceptObjectPartRoom(org.starhope.appius.game.Room, org.starhope.appius.game.RoomListener)

acceptOutOfBandMessage

public void acceptOutOfBandMessage(AbstractUser sender,
                                   Room room,
                                   org.json.JSONObject body)
Description copied from interface: RoomListener
Accept an out-of-band communications packet that was broadcast to a room in which this Listener is listening.

Specified by:
acceptOutOfBandMessage in interface RoomListener
Parameters:
sender - The sender of the OOB message
room - The room in which the OOB message is being broadcast
body - A JSON object containing the OOB message. The contents of this message are not constrained.
See Also:
RoomListener.acceptOutOfBandMessage(org.starhope.appius.user.AbstractUser, org.starhope.appius.game.Room, org.json.JSONObject)

acceptUserAction

public void acceptUserAction(Room r,
                             AbstractUser u)
Description copied from interface: RoomListener
User actions (go/do actions) propagate through this channel.

Specified by:
acceptUserAction in interface RoomListener
Parameters:
r - the room in which the user is taking an action
u - the user taking an action
See Also:
RoomListener.acceptUserAction(org.starhope.appius.game.Room, org.starhope.appius.user.AbstractUser)

acceptUserVariableUpdate

public void acceptUserVariableUpdate(AbstractUser user,
                                     String varName,
                                     String varValue)
Description copied from interface: RoomListener
Receive notification of the change of an user variable

Specified by:
acceptUserVariableUpdate in interface RoomListener
Parameters:
user - The user updating their variable
varName - The name of the variable (key)
varValue - The new value (null if unset)
See Also:
RoomListener.acceptUserVariableUpdate(org.starhope.appius.user.AbstractUser, java.lang.String, java.lang.String)

addBuddy

public void addBuddy(AbstractUser buddy)
Specified by:
addBuddy in interface AbstractUser
Parameters:
buddy - WRITEME
See Also:
AbstractUser.addBuddy(org.starhope.appius.user.AbstractUser)

assertLocationUnlocked

public void assertLocationUnlocked()
Description copied from interface: AbstractUser
WRITEME: Document this method brpocock@star-hope.org

Specified by:
assertLocationUnlocked in interface AbstractUser
See Also:
AbstractUser.assertLocationUnlocked()

assertStaffLevel

@Deprecated
public void assertStaffLevel(int staffLevelNeeded)
                      throws PrivilegeRequiredException
Deprecated. use Security.hasCapability(AbstractUser, org.starhope.appius.sys.admin.SecurityCapability)

Assert that this user must have the given staff level (or greater). Throws an exception if this is untrue.

Specified by:
assertStaffLevel in interface AbstractUser
Parameters:
staffLevelNeeded - The minimum staff level which is being asserted
Throws:
PrivilegeRequiredException - if the minimum staff level is not met.

attend

public void attend(AbstractUser interestingFellow)
Attend to an user who may previously have been ignored

Specified by:
attend in interface AbstractUser
Parameters:
interestingFellow - the user to whom to now attend

canApproveSelf

public boolean canApproveSelf()
If the user is a teen (13+) or adult, they are allowed to approve their own account. This is a boolean test for that fact.

Returns:
true, if the user is permitted to approve their own account (via their own eMail address). False, if they require parent approval.

canBetaTest

public boolean canBetaTest()
Returns:
true, if the user is permitted to log in to a beta test server

canEnterChatZone

public boolean canEnterChatZone()
Returns:
WRITEME

canEnterMenuZone

public boolean canEnterMenuZone()
Returns:
the canEnterMenuZone

changeBaseDefenses

public DamageTypeRanks changeBaseDefenses(DamageTypeRanks alteration)
Parameters:
alteration - amount(s) to alter base defenses
Returns:
copy of new base defenses

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable<Object>
See Also:
Comparable.compareTo(java.lang.Object)

deleteVariable

public void deleteVariable(String key)
This is an overriding method.

Specified by:
deleteVariable in interface HasVariables
Parameters:
key - WRITEME
See Also:
HasVariables.deleteVariable(java.lang.String)

doffClothes

public void doffClothes()
Description copied from interface: AbstractUser
WRITEME

Specified by:
doffClothes in interface AbstractUser
See Also:
AbstractUser.doffClothes()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

getAge

public int getAge()
Specified by:
getAge in interface AbstractUser
Returns:
WRITEME
See Also:
AbstractUser.getAge()

getAgeGroup

public AgeBracket getAgeGroup()
Description copied from interface: AbstractUser
Get the user's age bracket. Note that system (robot) users will have the special age bracket type AgeBracket.System.

Specified by:
getAgeGroup in interface AbstractUser
Returns:
the age bracket of the user
See Also:
AbstractUser.getAgeGroup()

getApprovedDateString

public String getApprovedDateString()
Specified by:
getApprovedDateString in interface AbstractUser
Returns:
WRITEME
See Also:
AbstractUser.getApprovedDateString()

getBaseDefenses

public DamageTypeRanks getBaseDefenses()
Returns:
base (innate) defense values

getBaseStat

public int getBaseStat(UserStat stat)
get a base stat (before any modifiers for items or transient effects are applied)

Parameters:
stat - stat
Returns:
the value of that stat

getCenterOfMass

public Coord2D getCenterOfMass()
Description copied from interface: Collidable
Gets the object's current center of mass in world coordinates

Specified by:
getCenterOfMass in interface Collidable
Returns:
A 2D point representing the center of mass
See Also:
Collidable.getCenterOfMass()

getCollisionBounds

public PolygonPrimitive<?> getCollisionBounds()
Description copied from interface: Collidable
Gets the collision boundaries for the object

Specified by:
getCollisionBounds in interface Collidable
Returns:
A polygon outlining the boundaries of the object
See Also:
Collidable.getCollisionBounds()

getCurrentAction

public String getCurrentAction()
Normally “Walk” but can be any action that the client recognises for the avatar type

Specified by:
getCurrentAction in interface AbstractUser
Returns:
the currentAction

getD

protected String getD()
Get the archaïc “d” variable

Returns:
x~y~tX~tY~facing~started

getDialect

public String getDialect()
Specified by:
getDialect in interface AbstractUser
Returns:
WRITEME
See Also:
AbstractUser.getDialect()

getDisplayName

public String getDisplayName()
Specified by:
getDisplayName in interface AbstractUser
Returns:
WRITEME
See Also:
AbstractUser.getDisplayName()

getEffectiveDefenses

public DamageTypeRanks getEffectiveDefenses()
Get the effective defenses of the user (including transient and item effects)

Returns:
the effective defenses

getEndMovementTime

public long getEndMovementTime(long currentTime)
Specified by:
getEndMovementTime in interface Collidable
Parameters:
currentTime - The current time
Returns:
the time the object will stop moving
See Also:
Collidable.getEndMovementTime(long)

getExtraColor

public Colour getExtraColor()
Specified by:
getExtraColor in interface AbstractUser
Returns:
extra colour
See Also:
AbstractUser.getExtraColor()

getFacing

public String getFacing()
Description copied from interface: AbstractUser
Get the string identifying the direction which this object is facing. One of: N,S,E,W,NE,NW,SW,SE.

Specified by:
getFacing in interface AbstractUser
Returns:
The facing direction of this object
See Also:
AbstractUser.getFacing()

getGameEquipItems

public Collection<InventoryItem> getGameEquipItems()
If the user has a game item equipped (e.g. a key), then get that item. Otherwise, returns null.

Returns:
the game item currently being carried / currently equipped, or null if no item is equipped.
See Also:
getGameEquipItems_JSON()

getGameEquipItems_JSON

public org.json.JSONObject getGameEquipItems_JSON()
                                           throws org.json.JSONException
Returns:
game equip items in JSON form
Throws:
org.json.JSONException - if something goes wrong
See Also:
getGameEquipItems()

getHeight

public double getHeight()
Description copied from interface: AbstractUser
Height in pixels. This is used as a scaling-factor for the avatar file; it's assumed that other dimensions of the avatar will be scaled proportionally

Specified by:
getHeight in interface AbstractUser
Returns:
the user's height in pixels
See Also:
AbstractUser.getHeight()

getHouse

public UserHouse getHouse()
WRITEME: Document this method brpocock@star-hope.org

Returns:
the user's house

getInventory

public Inventory getInventory()
Description copied from interface: AbstractUser
WRITEME: document this method (brpocock@star-hope.org, Feb 19, 2010)

Specified by:
getInventory in interface AbstractUser
Returns:
WRITEME
See Also:
AbstractUser.getInventory()

getItemsByType

public Collection<InventoryItem> getItemsByType(String typeString)
Get all items that identify as the type string.

Parameters:
typeString - A type string from the config file
Returns:
an array of inventory items that identify as the given type
See Also:
getItemsByType(String[])

getItemsByType

public Collection<InventoryItem> getItemsByType(String[] types)
Get all inventory items which are (any of) the given type(s). The type strings are specified by the config file

Parameters:
types - The set of types of inventory items which are wanted
Returns:
get items in the inventory

getItemsByTypeAsArray

public InventoryItem[] getItemsByTypeAsArray(String typeString)
Get all items that identify as the type string.

Parameters:
typeString - A type string specified in the config file
Returns:
an array of inventory items that identify as the given type

getKickedByUserID

public int getKickedByUserID()
Specified by:
getKickedByUserID in interface AbstractUser
Returns:
WRITEME
See Also:
AbstractUser.getKickedByUserID()

getKickedReasonCode

public String getKickedReasonCode()
Specified by:
getKickedReasonCode in interface AbstractUser
Returns:
WRITEME
See Also:
AbstractUser.getKickedReasonCode()

getKickedUntil

public Timestamp getKickedUntil()
Specified by:
getKickedUntil in interface AbstractUser
Returns:
WRITEME
See Also:
AbstractUser.getKickedUntil()

getLocationForUpdate

public Coord3D getLocationForUpdate()
Description copied from interface: AbstractUser
Gets the current coördinates. Performs an update to ensure that they are “current” as of “now.” Also blocks on this method if anyone else is trying to do the same thing. After calling this method, you must call AbstractUser.unlockLocation() to free up other threads' ability to position this AbstractUser.

Specified by:
getLocationForUpdate in interface AbstractUser
Returns:
the current coördinates of the user
See Also:
AbstractUser.getLocationForUpdate()

getMass

public double getMass()
Description copied from interface: Collidable
Gets the mass of the collidable object

Specified by:
getMass in interface Collidable
Returns:
Mass
See Also:
Collidable.getMass()

getMoney

public BigDecimal getMoney(Currency currency)
Description copied from interface: AbstractUser
To be deprecated in favour of AbstractUser.getWallet() ASAP!

Specified by:
getMoney in interface AbstractUser
Parameters:
currency - units
Returns:
amount
See Also:
AbstractUser.getMoney(org.starhope.appius.mb.Currency)

getPathFinder

public PathFinder getPathFinder()
Description copied from interface: AbstractUser
WRITEME: Document this method brpocock@star-hope.org

Specified by:
getPathFinder in interface AbstractUser
Returns:
the pathfinder object
See Also:
AbstractUser.getPathFinder()

getPublicInfo

public org.json.JSONObject getPublicInfo()
Description copied from interface: AbstractUser

Returned packet contains:

Specified by:
getPublicInfo in interface AbstractUser
Returns:
JSONObject 'self' including userName and avatarClass
See Also:
Returned packet contains:
  • "avatar": FILENAME,
  • "avatarClass": ID#,
  • chatFG: foreground colour (RGB int),
  • chatBG: background colour (RGB int),
  • "avatarClass_B": avatar class's default base colour,
  • "avatarClass_E": avatar class's default extra colour,
  • "avatarClass_P": avatar class's default pattern colour,
  • "inRoom": room moniker (if in a room),
  • "userName": avatar label (user visible name, including hidden names),
  • "colors": { ... array of colour filters to be applied to the avatar file itself ... },
  • "clothes": { ... array of clothing items ... },
  • "gameItem": game equipped item ID (carrying object),
  • "vars": { ... user variables, including "d" or "s" ... }
  • "id": USER-ID

getRegisteredAt

public Timestamp getRegisteredAt()
Returns:
the registeredAt

getRegisteredDate

public Date getRegisteredDate()
Returns:
the date on which this user first registered
See Also:
UserRecord.getRegisteredDate()

getRegisteredDateString

public String getRegisteredDateString()
Specified by:
getRegisteredDateString in interface AbstractUser
Returns:
Returns an user-visible string describing when the user was registered
See Also:
getRegisteredDate()

getRequestedName

public String getRequestedName()
Returns:
the name that the user requested

getResponsibleMail

public String getResponsibleMail()

Get the eMail address of a responsible person: either the player, or the parent.

Currently, kids 13-17 return their own mail.

Specified by:
getResponsibleMail in interface AbstractUser
Returns:
the eMail address

getRoom

public Room getRoom()
Description copied from interface: RoomListener
WRITEME: document this method (brpocock@star-hope.org, Oct 31, 2009)

Specified by:
getRoom in interface RoomListener
Returns:
The room in which the user currently exists. This might potentially be null.

getRoomNumber

public int getRoomNumber()
Description copied from interface: AbstractUser
WRITEME: document this method (brpocock@star-hope.org, Jan 11, 2010)

Specified by:
getRoomNumber in interface AbstractUser
Returns:
the number of the user's current room; or -1 if the user isn't in any room

getSizeScalar

public double getSizeScalar()
Description copied from interface: AbstractUser
WRITEME: Document this method brpocock@star-hope.org

Specified by:
getSizeScalar in interface AbstractUser
Returns:
the effective scalar for sizes and things

getStaffLevel

public int getStaffLevel()
Description copied from interface: AbstractUser
WRITEME: document this method (brpocock@star-hope.org, Jan 11, 2010)

Specified by:
getStaffLevel in interface AbstractUser
Returns:
the staffLevel

getStartMovementTime

public long getStartMovementTime()
Specified by:
getStartMovementTime in interface Collidable
Returns:
the time the object started moving
See Also:
Collidable.getStartMovementTime()

getStartT

public long getStartT()
Specified by:
getStartT in interface AbstractUser
Returns:
the time at which the user last actually started moving

getStat

public int getStat(UserStat stat)
Get the user's effective stat value (considering any transient effects in place as well as the base stat)

Parameters:
stat - the stat to query
Returns:
the effective stat value

getTarget

public Coord3D getTarget()
Description copied from interface: AbstractUser
Gets the current target

Specified by:
getTarget in interface AbstractUser
Returns:
the target toward which the user is moving
See Also:
AbstractUser.getTarget()

getTravelRate

public double getTravelRate()
This is an overriding method.

Specified by:
getTravelRate in interface AbstractUser
Returns:
WRITEME
See Also:
AbstractUser.getTravelRate()

getTravelStart

public long getTravelStart()
This is an overriding method.

Specified by:
getTravelStart in interface AbstractUser
Returns:
the time at which the object started moving (msec since epoch)
See Also:
AbstractUser.getTravelStart()

getUserID

public int getUserID()
Description copied from interface: AbstractUser
Get the user ID number for this user

Specified by:
getUserID in interface AbstractUser
Returns:
the userID

getUserListIterator

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

Specified by:
getUserListIterator in interface AbstractUser
Parameters:
moniker - usually either $buddy or $ignore
Returns:
an iterator to fetch the user list

getUserName

public String getUserName()
Returns:
the user's login

getUserVariables

public Map<String,String> getUserVariables()
Description copied from interface: AbstractUser
WRITEME: document this method (brpocock@star-hope.org, Jan 11, 2010)

Specified by:
getUserVariables in interface AbstractUser
Returns:
WRITEME
See Also:
AbstractUser.getUserVariables()

getVariable

public String getVariable(String string)
Get the value of a given variable by name. Contains special-case for “d”

Specified by:
getVariable in interface HasVariables
Specified by:
getVariable in interface AbstractUser
Parameters:
string - Variable key
Returns:
Value of the named variable

getVariables

public Map<String,String> getVariables()
Get all user variables in a hash map

Specified by:
getVariables in interface HasVariables
Returns:
A hashmap containing all user variables

getVariablesJSON

public org.json.JSONObject getVariablesJSON()
Get all values in JSON form

Returns:
the user variables in JSON form

getVelocity

public Vector2D getVelocity()
Description copied from interface: Collidable
Gets the object's current velocity

Specified by:
getVelocity in interface Collidable
Returns:
A 2D velocity vector
See Also:
Collidable.getVelocity()

getWallet

public Wallet getWallet()
Specified by:
getWallet in interface AbstractUser
Returns:
the user's wallet (currency inventory)

getZone

public Zone getZone()
Description copied from interface: RoomListener
WRITEME: document this method (brpocock@star-hope.org, Oct 31, 2009)

Specified by:
getZone in interface RoomListener
Returns:
the Zone in which this listener can be found
See Also:
RoomListener.getZone()

handleWalkFail

public Coord3D handleWalkFail(Room room,
                              Coord3D to)
Description copied from interface: AbstractUser
Called from pathfinders and rooms when the user tries to go someplace and can't get there, to allow them to plot a course around obstacles.

Specified by:
handleWalkFail in interface AbstractUser
Parameters:
room - the destination room
to - the destination coördinates
Returns:
the coördinates in the current room toward which the user should proceed
See Also:
AbstractUser.handleWalkFail(org.starhope.appius.game.Room, org.starhope.appius.geometry.Coord3D)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

hasStaffLevel

@Deprecated
public boolean hasStaffLevel(int staffLevelNeeded)
Deprecated. 

Returns true if the user has the asserted staff level, or a staff level which includes it. Returns false, otherwise.

Specified by:
hasStaffLevel in interface AbstractUser
Parameters:
staffLevelNeeded - The minimum staff level for which we are testing.
Returns:
True, if the user meets the minimum staff level stated; false, otherwise. * @deprecated use Security.hasCapability(AbstractUser, org.starhope.appius.sys.admin.SecurityCapability)

hasVariable

public boolean hasVariable(String string)
Description copied from interface: AbstractUser
WRITEME: document this method (brpocock@star-hope.org, Nov 30, 2009)

Specified by:
hasVariable in interface AbstractUser
Parameters:
string - WRITEME
Returns:
WRITEME
See Also:
AbstractUser.hasVariable(java.lang.String)

ignore

public void ignore(AbstractUser boringFellow)
Calling this method indicates that this user wants to ignore the other specified user.

Specified by:
ignore in interface AbstractUser
Parameters:
boringFellow - The user, whom this user wishes to ignore

isActive

public boolean isActive()
Returns:
true, if this is an active user account (able to sign in, potentially)

isApproved

public boolean isApproved()
Returns:
true, if this account has been approved, and is still active
See Also:
UserRecord.isApproved()

isBanned

public boolean isBanned()
Specified by:
isBanned in interface AbstractUser
Returns:
WRITEME
See Also:
AbstractUser.isBanned()

isCanceled

public boolean isCanceled()
Specified by:
isCanceled in interface AbstractUser
Returns:
WRITEME
See Also:
AbstractUser.isCanceled()

isKicked

public boolean isKicked()
Specified by:
isKicked in interface AbstractUser
Returns:
WRITEME
See Also:
AbstractUser.isKicked()

isPaidMember

public boolean isPaidMember()
Specified by:
isPaidMember in interface AbstractUser
Returns:
WRITEME
See Also:
AbstractUser.isPaidMember()

local_publicInfo

protected void local_publicInfo(org.json.JSONObject userInfo)
Append information in the subclass to the already-prepared JSON data for the getPublicInfo call

Parameters:
userInfo - the public info JSON object to which additional info. should be appended

needsParent

public boolean needsParent()
Kid accounts (under 13) require parental confirmation. In order to get that, we have to get a parental contact. If this field is false, then the user is either a teenager or adult, or they have a parent on file. It does not mean that they have had their account approved: only that they have given us the parental information (if we needed it). If we ever encounter a user for whom this flag is true, ask them “who's your daddy?”

Specified by:
needsParent in interface AbstractUser
Returns:
true, if this is a kid account without a known parent (yet)

purchase

public void purchase(GenericItemReference itemToBuy)
              throws NonSufficientFundsException,
                     NotFoundException,
                     AlreadyExistsException
Description copied from interface: AbstractUser
WRITEME: Document this method brpocock@star-hope.org

Specified by:
purchase in interface AbstractUser
Parameters:
itemToBuy - WRITEME
Throws:
NonSufficientFundsException - WRITEME
NotFoundException - WRITEME
AlreadyExistsException - WRITEME
See Also:
AbstractUser.purchase(org.starhope.appius.game.inventory.GenericItemReference)

removeBuddy

public void removeBuddy(AbstractUser byLogin)
Specified by:
removeBuddy in interface AbstractUser
Parameters:
byLogin - WRITEME
See Also:
AbstractUser.removeBuddy(org.starhope.appius.user.AbstractUser)

resetVariables

@Setter(getter="getVariables")
public void resetVariables(Map<String,String> map)
Description copied from interface: HasVariables
WRITEME: Document this method brpocock@star-hope.org

Specified by:
resetVariables in interface HasVariables
See Also:
HasVariables.resetVariables(java.util.Map)

sendBuddyList

public void sendBuddyList(String whichList,
                          List<UserListEntry> users)
WRITEME: Document this method brpocock@star-hope.org

Specified by:
sendBuddyList in interface AbstractUser
Parameters:
whichList - the list name
users - users on that list

sendEarnings

public void sendEarnings(Room room,
                         String string)
Specified by:
sendEarnings in interface AbstractUser
Parameters:
room - WRITEME
string - WRITEME
See Also:
AbstractUser.sendEarnings(org.starhope.appius.game.Room, java.lang.String)

sendWardrobe

public void sendWardrobe()
Description copied from interface: AbstractUser
WRITEME

Specified by:
sendWardrobe in interface AbstractUser
See Also:
AbstractUser.sendWardrobe()

setAgeGroupToSystem

public void setAgeGroupToSystem()
Description copied from interface: AbstractUser
WRITEME

Specified by:
setAgeGroupToSystem in interface AbstractUser
See Also:
AbstractUser.setAgeGroupToSystem()

setBackingRecord

public void setBackingRecord(UserRecord rec)
Description copied from interface: DataRecordBacked
Force the backing record for this object to be the given one. This is used to ensure that the backing record can't fall out of sync due to caché users.

Specified by:
setBackingRecord in interface DataRecordBacked<UserRecord>
Parameters:
rec - the backing record
See Also:
DataRecordBacked.setBackingRecord(org.starhope.appius.util.DataRecord)

setBaseColor

@Setter(getter="getBaseColor")
public void setBaseColor(Colour colour)
Description copied from interface: AbstractUser
WRITEME

Specified by:
setBaseColor in interface AbstractUser
Parameters:
colour - WRITEME
See Also:
AbstractUser.setBaseColor(org.starhope.appius.types.Colour)

setCanTalk

@Setter(getter="canTalk")
public void setCanTalk(boolean b)
Description copied from interface: AbstractUser
WRITEME

Specified by:
setCanTalk in interface AbstractUser
Parameters:
b - WRITEME
See Also:
AbstractUser.setCanTalk(boolean)

setCenterOfMass

public void setCenterOfMass(Coord2D com)
Description copied from interface: Collidable
Sets the object's new center of mass in world space coordinates (i.e. this moves the object and doesn't reposition the relative location of the center of mass with respect to its bounds)

Specified by:
setCenterOfMass in interface Collidable
Parameters:
com - New center of mass in world coordinates
See Also:
Collidable.setCenterOfMass(Coord2D)

setCurrentAction

@Setter(getter="getCurrentAction")
public void setCurrentAction(String newAction)
Normally “Walk” but can be any action that the client recognizes for the avatar type

Specified by:
setCurrentAction in interface AbstractUser
Parameters:
newAction - the currentAction to set

setExtraColor

@Setter(getter="getExtraColor")
public void setExtraColor(Colour colour)
Specified by:
setExtraColor in interface AbstractUser
Parameters:
colour - WRITEME
See Also:
AbstractUser.setExtraColor(org.starhope.appius.types.Colour)

setFacing

@Setter(getter="getFacing")
public void setFacing(String newFacing)
Specified by:
setFacing in interface AbstractUser
Parameters:
newFacing - the new facing direction
See Also:
AbstractUser.setFacing(java.lang.String)

setLocation

@Setter(getter="getLocation")
public void setLocation(Coord3D coord3d)
Specified by:
setLocation in interface AbstractUser
Parameters:
coord3d - new 3D coordinates
See Also:
AbstractUser.setLocation(org.starhope.appius.geometry.Coord3D)

setRoom

@Setter(getter="getRoom")
public int setRoom(Room room)
Set the user's current room to the given room. This will part from the prior room, if the user was in a room already. It also sets the user variable “d” to (-100,-100) coördinates.

Specified by:
setRoom in interface AbstractUser
Parameters:
room - the room in which the user must exist
Returns:
the room number set

setStartT

@Setter(getter="getStartT")
public void setStartT(long when)
Description copied from interface: AbstractUser
set the time at which the player started moving — not necessarily the same as AbstractUser.getTravelStart() because that value is updated over time, this value is when they actually started moving along the path altogether

Specified by:
setStartT in interface AbstractUser
Parameters:
when - the time at which the user last made a conscious change in their movement
See Also:
AbstractUser.setStartT(long)

setTarget

@Setter(getter="getTarget")
public void setTarget(Coord3D newTarget)
Sets the new target coördinates

Specified by:
setTarget in interface AbstractUser
Parameters:
newTarget - target coördinates

setTravelRate

@Setter(getter="getTravelRate")
public void setTravelRate(double rate)
This is an overriding method.

Specified by:
setTravelRate in interface AbstractUser
Parameters:
rate - WRITEME
See Also:
AbstractUser.setTravelRate(double)

setTravelStart

@Setter(getter="getTravelStart")
public void setTravelStart(long l)
Description copied from interface: AbstractUser
WRITEME: Document this method brpocock@star-hope.org

Specified by:
setTravelStart in interface AbstractUser
Parameters:
l - WRITEME
See Also:
AbstractUser.setTravelStart(long)

setVariable

public void setVariable(Map.Entry<String,String> var)
This is an overriding method.

Specified by:
setVariable in interface HasVariables
Parameters:
var - A Hash type Entry object containing a key-value pair to be used to set a variable.
See Also:
HasVariables.setVariable(java.util.Map.Entry)

setVariable

public void setVariable(String varName,
                        String varValue)
Set an user variable. These are echoed to everyone in the room, and provide various sorts of semi-persisten information about the user. For a discussion see the top of the AbstractUser manual page.

Specified by:
setVariable in interface HasVariables
Specified by:
setVariable in interface AbstractUser
Parameters:
varName - The name of the variable
varValue - The value

setVariables

public void setVariables(Map<String,String> map)
This is an overriding method.

Specified by:
setVariables in interface HasVariables
Parameters:
map - WRITEME
See Also:
HasVariables.setVariables(java.util.Map)

setVelocity

public void setVelocity(Vector2D velocity)
This method does nothing because we shouldn't be setting the speed and direction of users

WRITEME: explain why? We do manipulate these values, regardless…

Specified by:
setVelocity in interface Collidable
Parameters:
velocity - WRITEME
See Also:
Collidable.setVelocity(Vector2D velocity)

takeAttack

public boolean takeAttack(DamageTypeRanks attack)
WRITEME: Document this method brpocock@star-hope.org

Specified by:
takeAttack in interface AbstractUser
Parameters:
attack - WRITEME
Returns:
WRITEME

unlockLocation

public void unlockLocation()
Description copied from interface: AbstractUser
Unlock an user's location, locked by a call to AbstractUser.getLocationForUpdate() (q.v.)

Specified by:
unlockLocation in interface AbstractUser
See Also:
AbstractUser.unlockLocation()

updateWallet

public void updateWallet()
Description copied from interface: AbstractUser
review your current wallet currency amounts, they may have changed

Specified by:
updateWallet in interface AbstractUser
See Also:
AbstractUser.updateWallet()