org.starhope.appius.game
Class Room

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

public class Room
extends SimpleDataRecord<Room>
implements HasVariables

A room located in the local zone

Room Variables

The room variables structure is defined to reserve all lower-case named variables for system purposes.

The following room variables are specially used:

Room Environment

These room variables define the general environment. They can contain single filenames or a series of colon-delimited filenames, which will be stacked from bottom to top. (The first name given is the lowest or farthest level of stacking.)

s
The Sky, or background artwork.
f
The Floor, or foreground artwork.
w
The Weather, or overlay artwork.

Room Objects

Places

Places are regions of the room defined by polygonal outlines. These are held in Room Variables with names of the form "zone" plus an arbitrary identifier. The contents of the room variable are a key followed by ":" and a series of coördinates.

Each coördinate pair is given as x,y in decimal, literally, like: "100,200". They are separated with "~". To stop one polygon and start on another, give "~~" with no coördinates between.

The key of a Place specifies its purpose. The keys understood by the server include:

WRITEME — there is support for denying vehicles in a room, but there's not database integration.

XXX — there is a concept of swimming in the item effects system, but the walkspace / swim space integration isn't handled at all. This is not enabled at all for anyone to consume at the moment.

TODO: This class needs some internal cleanups. Based upon the HasVariables interface, the internal data structures need to be cleaned up, rather than constantly relying upon strings.

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

Field Summary
private  Collection<ExistsInWorld> contents
          WRITEME: Document this brpocock@star-hope.org
static int DEFAULT_USER_LIMIT
          WRITEME: Document this brpocock@star-hope.org
private  Map<String,Pair<String,Collection<GeneralPath>>> eventPlaces
          All spaces that can fire off some kind of event, just not out places
private  Map<String,Pair<String,Polygon>> exitPlaces
          Places through which one can exit this room into another room
private static double FACING_MIN_EFFECT
          Semi-tunable: The minimum number of total x and y pixels of motion before the facing of the object/user will be affected
private static int FIRST_SAFE_ROOM_NUMBER
          The lowest room number for use with dynamically-created rooms.
private  HashSet<GameEvent> gameEvents
          GameEvents attached to this room
private  AbstractUser homeOwner
           The owner of a room; usually null for public rooms, or non-null for users' houses.
private  boolean iAmInLimbo
          Determine whether this room is a limbo room
private  int id
          WRITEME: Document this brpocock@star-hope.org
private  long lastLagComputed
          The time at which the local lag was last recomputed
private  List<RoomLayer> layers
          WRITEME: Document this brpocock@star-hope.org
private  Collection<RoomListener> listeners
          WRITEME: Document this brpocock@star-hope.org
private  long localLagMax
          The local average lag
static int MAX_X
          the right-hand-side of any room… hard-fixed room sized :-(
static int MAX_Y
          WRITEME: Document this brpocock@star-hope.org
private  String moniker
          The moniker / unique identifier for this room.
protected  int myID
          The unique ID number for this room (room number)
private  ConcurrentSkipListSet<RoomListener> observers
          Non-Users who are present to pay attention to things happening in the room
private  Map<String,Collection<GeneralPath>> obstacles
          Individual obstacle spaces
static double octant
          The width of one octant (demi-quadrant) of a circle, for facing computations
static String[] octantFacing
          the string values of facings in each of the eight octants of a circle (and a repeat of #1 for padding's sake)
private  Collection<AbstractUser> owners
          WRITEME: Document this brpocock@star-hope.org
private  Collection<RoomRegion> regions
          WRITEME: Document this brpocock@star-hope.org
private  int roomIndex
          When the room is a part of an user's house, which room index number is it?
private  ConcurrentHashMap<String,String> roomVariables
          The set of variables set upon the room
private static int safeRoomNum
          The next safe room number for use with dynamically-created rooms.
private static long serialVersionUID
          Java serialization unique ID
private  boolean skyVisible
          Whether the sky is visible in this room.
private  Collection<SoundPlayback> sounds
          WRITEME: Document this brpocock@star-hope.org
private static int STATIC_ROOM_FENCEPOST
          WRITEME: Document this brpocock@star-hope.org
private  boolean subjectToWeather
          Whether this room is subject to weather (e.g.
private  String title
          The user-visible title of this room
private static double USER_NEAREST_FUZZ
          the distance to an user
private  int userLimit
          WRITEME
private  ConcurrentSkipListSet<AbstractUser> userList
          The list of all users in this room.
protected  VehicleStyle vehicleStyle
          Type of vehicle permissions to apply
private  Volume3D volume
          WRITEME: Document this brpocock@star-hope.org
private  GeneralPath walkableSpace
          the area in which a player could walk
private  Map<String,Collection<GeneralPath>> walkSpaces
          Individual walkable spaces
private  String world
          WRITEME
private  Coord3D worldCoords
          WRITEME
private  Zone zone
          The zone in which this room exists
 
Fields inherited from class org.starhope.appius.util.SimpleDataRecord
myLoader, timeLastChanged, timeLastSaved
 
Constructor Summary
Room(RecordLoader<Room> loader)
          WRITEME: Document this constructor brpocock@star-hope.org
Room(RecordLoader<Room> loader, Object... nada)
          WRITEME: Document this constructor brpocock@star-hope.org
 
Method Summary
 boolean add(ExistsInWorld thing)
          WRITEME: Document this method brpocock@star-hope.org
 void add(GameEvent game)
          WRITEME.
 boolean add(RoomLayer newLayer)
          WRITEME: Document this method brpocock@star-hope.org
 boolean add(RoomListener newListener)
          WRITEME: Document this method brpocock@star-hope.org
 boolean add(RoomRegion newRegion)
          WRITEME: Document this method brpocock@star-hope.org
 boolean add(SoundPlayback newSound)
          WRITEME: Document this method brpocock@star-hope.org
 boolean addOwner(AbstractUser newOwner)
          WRITEME: Document this method brpocock@star-hope.org
(package private)  void areaEffects(AbstractUser user, Coord3D position)
           
 void broadcast(String command, org.json.JSONObject results)
           
 boolean canWalk(AbstractUser u, Coord3D target)
           
 boolean canWalk(Coord3D p)
           
 boolean canWalk(Coord3D from, Coord3D to)
          determine whether a line leaves the walkable space at any time
 boolean contains(AbstractUser thing)
          WRITEME.
 boolean contains(ExistsInWorld thing)
          WRITEME: Document this method brpocock@star-hope.org
static Room create(String newMoniker, Zone zone, boolean mustExist)
          Create a room from the database, or (if mustExist == false) create a new anonymous room.
static Room createPublicRoom(String roomName, Zone zone)
           Create a temporary/anonymous room without referring to the database.
 void deleteVariable(String string)
          WRITEME.
 void destroySelf()
          Destroy this room.
private  void detectSounds()
          WRITEME: Document this method brpocock@star-hope.org
private  void disableVehiclesIfNecessary(AbstractUser user)
          WRITEME: Document this method brpocock@star-hope.org
 boolean equals(Object other)
          WRITEME.
 boolean equals(Room other)
          WRITEME.
 Coord3D findPointWithin(GeneralPath space)
          WRITEME: Document this method brpocock@star-hope.org
private  Coord3D findSpawnPointFrom(String oldRoom)
           Find a spawn (entry) point in this room for an user joining from the given old room.
(package private)  Coord3D findSpawnPointWithin(Collection<GeneralPath> walkableSpaces2)
          WRITEME: Document this method brpocock@star-hope.org
(package private)  Coord3D findSpawnPointWithin(GeneralPath space)
          WRITEME: Document this method brpocock@star-hope.org
 void fromJSON(org.json.JSONObject jso)
          WRITEME.
(package private)  Collection<InventoryItem> getActiveDecorations_private()
          get the decorations active (placed) in a room, which is a room from an user's house (therefore drawn from the user's inventory)
(package private)  Collection<InventoryItem> getActiveDecorations_public()
          Get the decorations active (placed) in a room, which is a public room not owned by a particular user.
 Collection<InventoryItem> getActiveDecorations()
          get the decorations active (placed) in a room
 Set<RoomListener> getAllListeners()
          WRITEME.
static Room[] getAllRooms()
           
 Collection<AbstractUser> getAllUsers()
          WRITEME.
private  HashMap<String,String> getArbitraryVars()
          Load arbitrary room variable values from the database
static Room getByMoniker(String moniker, Zone zone)
           
 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<ExistsInWorld> getContents()
          WRITEME: Document this method brpocock@star-hope.org
 String getDebugName()
          WRITEME.
 Map<String,Collection<GeneralPath>> getEventSpaces()
           
private  Set<AbstractUser> getEverythingInRoom()
          Get all users in the room.
 Map<String,Pair<String,Polygon>> getExits()
           
 Polygon getExitTo(String roomToward)
          Find a place in the room which exits to a certain other room's moniker
 String getFilename()
          WRITEME.
 GameEvent getGameEvent(String string)
           
 Collection<GameEvent> getGameEvents()
          WRITEME.
 int getID()
          WRITEME: Document this method brpocock@star-hope.org
 long getLag()
          WRITEME: Document this method brpocock@star-hope.org
 List<RoomLayer> getLayers()
          WRITEME: Document this method brpocock@star-hope.org
 Collection<RoomListener> getListeners()
          WRITEME.
 int getMaxUsers()
          The maximum number of users permitted in a room is currently a per-Zone setting, see Zone.getRoomMaxUsers(), however it could be overridden for special-case rooms.
 int getMaxX()
           
 int getMaxY()
           
 int getMaxZ()
           
 int getMinX()
           
 int getMinY()
           
 int getMinZ()
           
 String getMoniker()
          WRITEME.
 String getMusic()
          WRITEME.
 String getName()
          WRITEME.
protected static int getNextID()
          Get a room number for a dynamically-generated room, that isn't in use yet
 String getOverlay()
          WRITEME.
 AbstractUser getOwner()
           
 Collection<AbstractUser> getOwners()
          WRITEME: Document this method brpocock@star-hope.org
 String getPlaceItemNumber()
           
 String getPlaceStringByName(String spaceName)
           
 Collection<String> getPlaceStrings()
          WRITEME: Document this method brpocock@star-hope.org
 String getPlaceZoneNumber()
           
 Collection<RoomRegion> getRegions()
          WRITEME: Document this method brpocock@star-hope.org
 Collection<RoomRegion> getRegionsIncluding(Coord3D point)
          WRITEME: Document this method brpocock@star-hope.org
 Collection<RoomRegion> getRegionsIncluding(Polygon space)
          WRITEME: Document this method brpocock@star-hope.org
 int getRoomIndex()
           
 org.json.JSONObject getRoomJoinJSON(AbstractUser user)
          get the JSON sequence to be passed to an user upon successfully joining a room (the “joinOK” message)
 String getRoomJoinSFSXML(GeneralUser user)
          get the Smart Fox Server XML sequence to be passed to an user upon successfully joining a room (the “joinOK” message)
private static Collection<Room> getRoomsInDB()
          WRITEME: Document this method brpocock@star-hope.org
 String getSky()
          WRITEME.
 Collection<SoundPlayback> getSounds()
          WRITEME: Document this method brpocock@star-hope.org
 String getSubversionRevision()
           Return the Subversion revision level of this class's source code file, as supplied via the special "$Rev: " sequence.
private  void getSuperTootBot(PreparedStatement getDetails, PreparedStatement getSpeech, org.json.JSONObject bots, ResultSet botGot)
          Deprecated. 
(package private)  void getSuperTootBotDetails(PreparedStatement getSpeech, org.json.JSONObject bots, ResultSet botGot, ResultSet rs)
          Deprecated. 
(package private)  org.json.JSONObject getSuperTootBots_JSON()
          Deprecated. Needs to be moved someplace more appropriate ... not yet determined ...
 org.json.JSONObject getSuperTootBots(int padding)
          Deprecated. Does not belong in Room ... but will be removed when NPC's work and Super Toot Bots can be removed from the codebase ... don't count on this being around forever, but it won't disappear as long as Super Toot Bots exist.
 String getTitle()
          WRITEME.
 org.json.JSONObject getUserAction_JSON(AbstractUser u)
          get a packet describing the user's action state.
 int getUserCount()
          WRITEME.
 int getUserLimit()
           
 String getVariable(String string)
          WRITEME.
 org.json.JSONObject getVariables_JSON()
          WRITEME: Document this method brpocock@star-hope.org
 HashMap<String,String> getVariables()
          WRITEME.
 VehicleStyle getVehicleRulesForRoom()
           
 Volume3D getVolume()
           
 GeneralPath getWalkableSpace()
           
 Coord3D getWalkLimit(Coord3D from, Coord3D to)
          Get the endpoint of a walk path from the source towards the target — clipped to the walkable space, if necessary.
 String getWorld()
           
 Coord3D getWorldCoords()
           
 Zone getZone()
          WRITEME.
private  Coord3D goTo_checkWalkSpace(AbstractUser u, Coord3D currentPos)
          WRITEME: Document this method brpocock@star-hope.org
 Coord3D goTo_clipToWalkSpace(AbstractUser u, Coord3D to)
          WRITEME: Document this method brpocock@star-hope.org
private  void goTo_core(AbstractUser u, String facing, String theVerb, Coord3D to)
          WRITEME: Document this method brpocock@star-hope.org
(package private)  boolean goTo_locked(AbstractUser u, Coord3D goal, String facing, String theVerb, Coord3D knownStartPos)
          WRITEME: Document this method brpocock@star-hope.org
 void goTo(AbstractUser u, Coord3D goal, String facing, String theVerb)
          have a user walk (or dance, or whatever) to another location through walkable spaces
 void goTo(AbstractUser u, double tX, double tY, double tZ, String facing, String verb)
          WRITEME: Document this method brpocock@star-hope.org
 void goTo(AbstractUser u, String placeName, String verb)
          have a user walk (or something) toward a named region; typically for NPC:s
 int hashCode()
          WRITEME.
static Room initUserRoom(AbstractUser user, int roomNumber)
          Instantiate a Room for a given user's house, for one of the rooms
 boolean isLimbo()
          WRITEME.
 boolean isOwner(AbstractUser guy)
          WRITEME: Document this method brpocock@star-hope.org
 boolean isSkyVisible()
          WRITEME.
 boolean isSubjectToWeather()
           
private  void join_doWardrobeNotifications(String from, AbstractUser user, Room oldRoom)
          WRITEME: Document this method brpocock@star-hope.org
private  Room join_sendPartFromOldRoom(AbstractUser user)
          WRITEME: Document this method brpocock@star-hope.org
 void join(RoomListener thing)
           
 void join(RoomListener thing, String from)
          WRITEME.
private static Room loadRoomFromDB(String newRoomMoniker)
           
static Room loadRoomFromDB(String newRoomMoniker, Zone newRoomZone)
           
static Room newPublicRoom(Zone homeZone)
           
 void notifyUserAction(AbstractUser u)
           
 void part(RoomListener thing)
          WRITEME.
 void pushToAllZones()
          push this room to all zones
 void pushToZone(Zone z)
           Copy the room's variable set to another room with an identical moniker in a different zone.
(package private)  void putHere_locked(AbstractUser user, Coord3D position)
          Version of putHere(AbstractUser, Coord3D) that does not acquire the location in a locking form (as AbstractUser.getLocationForUpdate()
 void putHere(AbstractUser user, Coord3D position)
           
(package private)  void recomputeLag()
          Recompute the average local lag by taking all samples within the population distribution of the mean of all lag times for users in the room, and taking the highest lag time of that range
 boolean remove(ExistsInWorld thing)
          WRITEME: Document this method brpocock@star-hope.org
 void remove(GameEvent thatEvent)
          Remove a GameEvent from receiving events in this room.
 boolean remove(RoomLayer oldLayer)
          WRITEME: Document this method brpocock@star-hope.org
 boolean remove(RoomListener oldListener)
          WRITEME: Document this method brpocock@star-hope.org
 boolean remove(RoomRegion oldRegion)
          WRITEME: Document this method brpocock@star-hope.org
 boolean remove(SoundPlayback oldSound)
          WRITEME: Document this method brpocock@star-hope.org
 void removeDoneSounds()
          WRITEME: Document this method brpocock@star-hope.org
 boolean removeOwner(AbstractUser exOwner)
          WRITEME: Document this method brpocock@star-hope.org
protected  void removeVariable(String varName)
          remove a variable
 void resetVariables(Map<String,String> vars)
          replace the current set of room variables with a different set
 void saveRoomVars()
           
 void sendGameAction(AbstractUser from, org.json.JSONObject data)
          WRITEME.
 void sendPublicMessage(AbstractUser from, String speech)
          WRITEME.
(package private)  void sendUserServerTime(AbstractUser user)
          WRITEME: Document this method brpocock@star-hope.org
(package private)  void setFacingFor(AbstractUser u)
          Set the appropriate facing string based upon the user's relative motion.
 void setFilename(String filename1)
          Set the filename for the floor/background of the room
 void setID(int newID)
          set the room's unique ID (integer) — unique within a Zone
 void setLimbo(boolean b)
          Set whether the room is a Limbo room.
 void setMoniker(String newMoniker)
          Set the room's unique (within a Zone) moniker.
 void setMusic(String music1)
          Set the background music to be played in the room
 void setOverlay(String overlay1)
          WRITEME.
 void setOwner(AbstractUser newHomeOwner)
           
 boolean setPlace(String placeCode, String descriptor)
          Set (create or change) a Place within the Room based upon a place code and a geometry string
 void setRoomIndex(int newRoomIndex)
           
 void setRoomVars()
          WRITEME.
 void setSky(String newSky)
          WRITEME.
 void setSkyVisible(boolean whetherSkyIsVisible)
          WRITEME.
 void setSubjectToWeather(boolean whetherSubjectToWeather)
           
 void setTitle(String newTitle)
          WRITEME.
 void setUserLimit(int roomUserLimit)
           
 void setVariable(Map.Entry<String,String> var)
          WRITEME.
 void setVariable(String varName, String varValue)
          WRITEME.
 void setVariables(Map<String,String> map)
          WRITEME.
 void setVehicleRulesForRoom(VehicleStyle newRules)
           
 void setVolume(Volume3D newVolume)
           
 void setWorld(String newWorld)
           
 void setWorldCoords(Coord3D newWorldCoords)
           
 void setZone(Zone newZone)
           
 void speak_actually(AbstractUser u, String speech, FilterResult carlSays)
          WRITEME: document this method (brpocock@star-hope.org, Mar 11, 2010)
(package private)  void superbot_fetchBasicInfo(ResultSet rs, ResultSet botGot, org.json.JSONObject bot, org.json.JSONObject speech, org.json.JSONObject avatar)
          Deprecated. 
(package private)  void superbot_fetchClothing(ResultSet rs, org.json.JSONObject clothes)
          Deprecated. 
(package private)  void superbot_fetchPattern(ResultSet rs, org.json.JSONObject clothes)
          Deprecated. 
(package private)  org.json.JSONObject superbot_fetchSpeech(PreparedStatement getSpeech, ResultSet rs)
          Deprecated. use Plebeian
private  void tellEveryoneAboutJoin(RoomListener joiner)
           
(package private)  void tellEveryoneAboutJoin(RoomListener joiner, AbstractUser joinerAsUser, Room oldRoom)
          Send a notification about the user joining a room to everyone in this room.
(package private)  void tellUserAboutRoom(AbstractUser u, ServerThread t)
          Update the user during a room join, giving them information about everyone in the room
 org.json.JSONObject toJSON()
          WRITEME.
 String toString()
           
protected  void trace(String text)
          trace to the server log an event
 AbstractUser userNearest(Coord3D target)
           
(package private)  void validateUserList()
          Ensure that everyone who we think is in the room, is actually still here ...
 
Methods inherited from class org.starhope.appius.util.SimpleDataRecord
changed, checkStale, compareTo, finalize, getRecordLoader, getTimeLastChanged, getTimeLastSaved, 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

DEFAULT_USER_LIMIT

public static final int DEFAULT_USER_LIMIT
WRITEME: Document this brpocock@star-hope.org

See Also:
Constant Field Values

FACING_MIN_EFFECT

private static final double FACING_MIN_EFFECT
Semi-tunable: The minimum number of total x and y pixels of motion before the facing of the object/user will be affected

See Also:
Constant Field Values

FIRST_SAFE_ROOM_NUMBER

private static final int FIRST_SAFE_ROOM_NUMBER
The lowest room number for use with dynamically-created rooms. Rooms with numbers less than this are created from the database

See Also:
Constant Field Values

MAX_X

public static final int MAX_X
the right-hand-side of any room… hard-fixed room sized :-(

See Also:
Constant Field Values

MAX_Y

public static final int MAX_Y
WRITEME: Document this brpocock@star-hope.org

See Also:
Constant Field Values

vehicleStyle

protected VehicleStyle vehicleStyle
Type of vehicle permissions to apply


octant

public static final double octant
The width of one octant (demi-quadrant) of a circle, for facing computations

See Also:
Constant Field Values

safeRoomNum

private static int safeRoomNum
The next safe room number for use with dynamically-created rooms.


serialVersionUID

private static final long serialVersionUID
Java serialization unique ID

See Also:
Constant Field Values

STATIC_ROOM_FENCEPOST

private static final int STATIC_ROOM_FENCEPOST
WRITEME: Document this brpocock@star-hope.org

See Also:
Constant Field Values

USER_NEAREST_FUZZ

private static final double USER_NEAREST_FUZZ
the distance to an user

See Also:
Constant Field Values

contents

private final transient Collection<ExistsInWorld> contents
WRITEME: Document this brpocock@star-hope.org


eventPlaces

private final transient Map<String,Pair<String,Collection<GeneralPath>>> eventPlaces
All spaces that can fire off some kind of event, just not out places


exitPlaces

private final transient Map<String,Pair<String,Polygon>> exitPlaces
Places through which one can exit this room into another room


gameEvents

private final HashSet<GameEvent> gameEvents
GameEvents attached to this room


homeOwner

private AbstractUser homeOwner

The owner of a room; usually null for public rooms, or non-null for users' houses.

The special room variable homeOwner reflects


iAmInLimbo

private boolean iAmInLimbo
Determine whether this room is a limbo room

See Also:
discussion of Limbo on Room.isLimbo ()

id

private int id
WRITEME: Document this brpocock@star-hope.org


lastLagComputed

private long lastLagComputed
The time at which the local lag was last recomputed


layers

private List<RoomLayer> layers
WRITEME: Document this brpocock@star-hope.org


listeners

private Collection<RoomListener> listeners
WRITEME: Document this brpocock@star-hope.org


localLagMax

private long localLagMax
The local average lag


moniker

private String moniker
The moniker / unique identifier for this room.


myID

protected int myID
The unique ID number for this room (room number)


observers

private final ConcurrentSkipListSet<RoomListener> observers
Non-Users who are present to pay attention to things happening in the room


obstacles

private final Map<String,Collection<GeneralPath>> obstacles
Individual obstacle spaces


octantFacing

public static final String[] octantFacing
the string values of facings in each of the eight octants of a circle (and a repeat of #1 for padding's sake)


owners

private final Collection<AbstractUser> owners
WRITEME: Document this brpocock@star-hope.org


regions

private final Collection<RoomRegion> regions
WRITEME: Document this brpocock@star-hope.org


roomIndex

private int roomIndex
When the room is a part of an user's house, which room index number is it?


roomVariables

private final ConcurrentHashMap<String,String> roomVariables
The set of variables set upon the room


skyVisible

private boolean skyVisible
Whether the sky is visible in this room.


sounds

private final Collection<SoundPlayback> sounds
WRITEME: Document this brpocock@star-hope.org


subjectToWeather

private boolean subjectToWeather
Whether this room is subject to weather (e.g. rain)

TODO: save to database


title

private String title
The user-visible title of this room


userLimit

private int userLimit
WRITEME


userList

private final ConcurrentSkipListSet<AbstractUser> userList
The list of all users in this room. These should maybe be weak references or something fancy, in future.


volume

private Volume3D volume
WRITEME: Document this brpocock@star-hope.org


walkableSpace

private GeneralPath walkableSpace
the area in which a player could walk


walkSpaces

private final Map<String,Collection<GeneralPath>> walkSpaces
Individual walkable spaces


world

private String world
WRITEME


worldCoords

private Coord3D worldCoords
WRITEME


zone

private Zone zone
The zone in which this room exists

Constructor Detail

Room

public Room(RecordLoader<Room> loader)
WRITEME: Document this constructor brpocock@star-hope.org

Parameters:
loader - loader

Room

public Room(RecordLoader<Room> loader,
            Object... nada)
WRITEME: Document this constructor brpocock@star-hope.org

Parameters:
loader - WRITEME
nada - WRITEME
Method Detail

create

public static Room create(String newMoniker,
                          Zone zone,
                          boolean mustExist)
                   throws NotFoundException
Create a room from the database, or (if mustExist == false) create a new anonymous room. Rooms created from the database are persistent rooms that can have game-events and such dynamically applied

Parameters:
newMoniker - The name of the room to create
zone - the zone in which the room is to be created
mustExist - If true, a named room from the database. If false, an anonymous/temporary room.
Returns:
the created room
Throws:
NotFoundException - Room moniker not found

createPublicRoom

public static Room createPublicRoom(String roomName,
                                    Zone zone)

Create a temporary/anonymous room without referring to the database.

Parameters:
roomName - the moniker of the room
zone - the zone in which the room is to be created
Returns:
the newly-created room

getAllRooms

public static Room[] getAllRooms()
Returns:
an array of all rooms in the game

getByMoniker

public static Room getByMoniker(String moniker,
                                Zone zone)
Parameters:
moniker - the moniker value for this room
zone - the zone containing this room
Returns:
the room object

getNextID

protected static int getNextID()
Get a room number for a dynamically-generated room, that isn't in use yet

Returns:
A new room number

getRoomsInDB

private static Collection<Room> getRoomsInDB()
WRITEME: Document this method brpocock@star-hope.org

Returns:
all static rooms defined in the database

initUserRoom

public static Room initUserRoom(AbstractUser user,
                                int roomNumber)
                         throws NotReadyException
Instantiate a Room for a given user's house, for one of the rooms

Parameters:
user - the owner of the house
roomNumber - the room number
Returns:
WRITEME
Throws:
NotReadyException - WRITEME

loadRoomFromDB

private static Room loadRoomFromDB(String newRoomMoniker)
                            throws NotFoundException
Parameters:
newRoomMoniker - The moniker of the room to be instantiated
Returns:
WRITEME
Throws:
NotFoundException - if there is no room in the database with the given moniker

loadRoomFromDB

public static Room loadRoomFromDB(String newRoomMoniker,
                                  Zone newRoomZone)
                           throws NotFoundException
Parameters:
newRoomMoniker - The moniker of the room to be instantiated
newRoomZone - The Zone into which the new room will be placed
Returns:
WRITEME
Throws:
NotFoundException - if there is no room in the database with the given moniker

newPublicRoom

public static Room newPublicRoom(Zone homeZone)
Parameters:
homeZone - the zone in which the room is created.
Returns:
WRITEME

add

public boolean add(ExistsInWorld thing)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
thing - WRITEME
Returns:
WRITEME

add

public void add(GameEvent game)
WRITEME.

Parameters:
game - WRITEME

add

public boolean add(RoomLayer newLayer)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
newLayer - WRITEME
Returns:
WRITEME

add

public boolean add(RoomListener newListener)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
newListener - WRITEME
Returns:
WRITEME

add

public boolean add(RoomRegion newRegion)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
newRegion - WRITEME
Returns:
WRITEME

add

public boolean add(SoundPlayback newSound)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
newSound - WRITEME
Returns:
WRITEME

addOwner

public boolean addOwner(AbstractUser newOwner)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
newOwner - WRITEME
Returns:
WRITEME

areaEffects

void areaEffects(AbstractUser user,
                 Coord3D position)
Parameters:
user - who is there
position - where they are

broadcast

public void broadcast(String command,
                      org.json.JSONObject results)
Parameters:
command - the command to be broadcast "from"
results - the JSON data attached

canWalk

public boolean canWalk(AbstractUser u,
                       Coord3D target)
Parameters:
u - WRITEME
target - WRITEME
Returns:
WRITEME

canWalk

public boolean canWalk(Coord3D p)
Parameters:
p - coördinates
Returns:
true, only if the point exists in a walkable space (and not an obstacle space)

canWalk

public boolean canWalk(Coord3D from,
                       Coord3D to)
determine whether a line leaves the walkable space at any time

Parameters:
from - start point
to - end point
Returns:
whether the path can be walked without truncation

contains

public boolean contains(AbstractUser thing)
WRITEME.

Parameters:
thing - WRITEME
Returns:
WRITEME

contains

public boolean contains(ExistsInWorld thing)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
thing - WRITEME
Returns:
WRITEME

deleteVariable

public void deleteVariable(String string)
WRITEME.

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

destroySelf

public void destroySelf()
Destroy this room.

See Also:
destroySelf()

detectSounds

private void detectSounds()
WRITEME: Document this method brpocock@star-hope.org


disableVehiclesIfNecessary

private void disableVehiclesIfNecessary(AbstractUser user)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
user - the user whose vehicles may need to be disabled

equals

public boolean equals(Object other)
WRITEME.

Overrides:
equals in class SimpleDataRecord<Room>
See Also:
equals(java.lang.Object)

equals

public boolean equals(Room other)
WRITEME.

Parameters:
other - the other room to which this one will be compared
Returns:
true, if the two objects represent the same room instance (in the same Zone, &c.)
See Also:
Object.equals(Object)

findPointWithin

public Coord3D findPointWithin(GeneralPath space)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
space - WRITEME
Returns:
WRITEME

findSpawnPointFrom

private Coord3D findSpawnPointFrom(String oldRoom)

Find a spawn (entry) point in this room for an user joining from the given old room. Will fall back to a default out Place or the entire walk space, if necessary.

Now, also ensures that the point is within walkable space.

XXX: handle edge-of-screen vertical/horizontal alignments better someday

Parameters:
oldRoom - The room from which someone is joining
Returns:
the coördinates at which the user should initially appear.

findSpawnPointWithin

Coord3D findSpawnPointWithin(Collection<GeneralPath> walkableSpaces2)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
walkableSpaces2 - WRITEME
Returns:
WRITMEE

findSpawnPointWithin

Coord3D findSpawnPointWithin(GeneralPath space)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
space - WRITEME
Returns:
WRITEME

fromJSON

public void fromJSON(org.json.JSONObject jso)
              throws org.json.JSONException
WRITEME.

Parameters:
jso - WRITEME
Throws:
org.json.JSONException - WRITEME

getActiveDecorations

public Collection<InventoryItem> getActiveDecorations()
get the decorations active (placed) in a room

Returns:
home décor items in this room

getActiveDecorations_private

Collection<InventoryItem> getActiveDecorations_private()
get the decorations active (placed) in a room, which is a room from an user's house (therefore drawn from the user's inventory)

Returns:
home décor items in this room

getActiveDecorations_public

Collection<InventoryItem> getActiveDecorations_public()
Get the decorations active (placed) in a room, which is a public room not owned by a particular user. Since this is not yet supported, returns an empty set.

Returns:
home décor items in this room

getAllListeners

public Set<RoomListener> getAllListeners()
WRITEME.

Returns:
all listeners (including users and GameEvents) in the room

getAllUsers

public Collection<AbstractUser> getAllUsers()
WRITEME.

Returns:
WRITEME

getArbitraryVars

private HashMap<String,String> getArbitraryVars()
Load arbitrary room variable values from the database

Returns:
the set of variables for this room

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()
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
See Also:
DataRecord.getCacheableIdent()

getContents

public Collection<ExistsInWorld> getContents()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

getDebugName

public String getDebugName()
WRITEME.

Returns:
a string giving the room moniker and zone name in human-readable form

getEventSpaces

public Map<String,Collection<GeneralPath>> getEventSpaces()
Returns:
all spaces that can cause an event to fire off

getEverythingInRoom

private Set<AbstractUser> getEverythingInRoom()
Get all users in the room.

Returns:
All users in the room

getExits

public Map<String,Pair<String,Polygon>> getExits()
Returns:
all exits

getExitTo

public Polygon getExitTo(String roomToward)
                  throws NotFoundException
Find a place in the room which exits to a certain other room's moniker

Parameters:
roomToward - the room name
Returns:
the exit place going there
Throws:
NotFoundException - if there's no exit to that destination

getFilename

public String getFilename()
WRITEME.

Returns:
the floor/filename base graphic

getGameEvent

public GameEvent getGameEvent(String string)
Parameters:
string - WRITEME
Returns:
WRITEME

getGameEvents

public Collection<GameEvent> getGameEvents()
WRITEME.

Returns:
WRITEME

getID

public int getID()
WRITEME: Document this method brpocock@star-hope.org

Returns:
id

getLag

public long getLag()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

getLayers

public List<RoomLayer> getLayers()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

getListeners

public Collection<RoomListener> getListeners()
WRITEME.

Returns:
WRITEME

getMaxUsers

public int getMaxUsers()
The maximum number of users permitted in a room is currently a per-Zone setting, see Zone.getRoomMaxUsers(), however it could be overridden for special-case rooms.

Returns:
the maximum number of users permitted in this room

getMaxX

public int getMaxX()
Returns:
the max X

getMaxY

public int getMaxY()
Returns:
the max Y

getMaxZ

public int getMaxZ()
Returns:
the max Z

getMinX

public int getMinX()
Returns:
the min X

getMinY

public int getMinY()
Returns:
the min Y

getMinZ

public int getMinZ()
Returns:
the min Z

getMoniker

public String getMoniker()
WRITEME.

Returns:
WRITEME

getMusic

public String getMusic()
WRITEME.

Returns:
WRITEME

getName

public String getName()
WRITEME.

Returns:
WRITEME

getOverlay

public String getOverlay()
WRITEME.

Returns:
the overlay / weather — contents of the “w” room variable

getOwner

public AbstractUser getOwner()
Returns:
the owner of the room (if any; can be null, indicating a public room)

getOwners

public Collection<AbstractUser> getOwners()
WRITEME: Document this method brpocock@star-hope.org

Returns:
owners

getPlaceItemNumber

public String getPlaceItemNumber()
Returns:
an available item tag

getPlaceStringByName

public String getPlaceStringByName(String spaceName)
Parameters:
spaceName - the name of a space, e.g. "evt_$field"
Returns:
the definition string of that space

getPlaceStrings

public Collection<String> getPlaceStrings()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

getPlaceZoneNumber

public String getPlaceZoneNumber()
Returns:
an available placement tag

getRegions

public Collection<RoomRegion> getRegions()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

getRegionsIncluding

public Collection<RoomRegion> getRegionsIncluding(Coord3D point)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
point - WRITEME
Returns:
WRITEME

getRegionsIncluding

public Collection<RoomRegion> getRegionsIncluding(Polygon space)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
space - WRITEME
Returns:
WRITEME

getRoomIndex

public int getRoomIndex()
Returns:
WRITEME
See Also:
getRoomIndex()

getRoomJoinJSON

public org.json.JSONObject getRoomJoinJSON(AbstractUser user)
get the JSON sequence to be passed to an user upon successfully joining a room (the “joinOK” message)

Parameters:
user - The user to whom the XML will be sent
Returns:
a string suitable for return to the user

getRoomJoinSFSXML

public String getRoomJoinSFSXML(GeneralUser user)
get the Smart Fox Server XML sequence to be passed to an user upon successfully joining a room (the “joinOK” message)

Parameters:
user - The user to whom the XML will be sent
Returns:
a string suitable for return to the user

getSky

public String getSky()
WRITEME.

Returns:
WRITEME.
See Also:
getSky()

getSounds

public Collection<SoundPlayback> getSounds()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

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()

getSuperTootBot

@Deprecated
private void getSuperTootBot(PreparedStatement getDetails,
                                        PreparedStatement getSpeech,
                                        org.json.JSONObject bots,
                                        ResultSet botGot)
                      throws SQLException,
                             org.json.JSONException
Deprecated. 

Fetch a SuperTootBot record from the database ...

XXX Tootsville-specific

Parameters:
getDetails - The query to fetch details
getSpeech - The query to fetch speech
bots - The bots JSON result object
botGot - The bot general record fetched
Throws:
SQLException - If the input record can't be interpreted
org.json.JSONException - If the output record can't be written

getSuperTootBotDetails

@Deprecated
void getSuperTootBotDetails(PreparedStatement getSpeech,
                                       org.json.JSONObject bots,
                                       ResultSet botGot,
                                       ResultSet rs)
                      throws org.json.JSONException,
                             SQLException
Deprecated. 

WRITEME: document this method (brpocock@star-hope.org, Mar 11, 2010)

Parameters:
getSpeech - WRITEME
bots - WRITEME
botGot - WRITEME
rs - WRITEME
Throws:
org.json.JSONException - WRITEME
SQLException - WRITEME

getSuperTootBots

@Deprecated
public org.json.JSONObject getSuperTootBots(int padding)
                                     throws SQLException,
                                            org.json.JSONException
Deprecated. Does not belong in Room ... but will be removed when NPC's work and Super Toot Bots can be removed from the codebase ... don't count on this being around forever, but it won't disappear as long as Super Toot Bots exist.

Obtain Super Toot Bots for a room. XXX: This doesn't belong here.

Parameters:
padding - how many extra robots we're requesting
Returns:
{ "from": "bots", "status": "true", "bots": { "botname": name, "avatar": { "avatar": "toot.swf", "clothes": { 0: { "color": patcol, "id": patitem }, 1: { "id": clothes }, ... }, "colors": { "0": base, "1": extra } }, "speech": { 0: "blah", ... }, "x": startx, "y": starty, "walkFreq": NN, "talkFreq": NN, "facing": S } }
Throws:
SQLException - database records can't be interpreted
org.json.JSONException - JSON reply can't be formulated

getSuperTootBots_JSON

@Deprecated
org.json.JSONObject getSuperTootBots_JSON()
Deprecated. Needs to be moved someplace more appropriate ... not yet determined ...

Returns:
the JSON structure describing any SuperTootBoys presently in the room

getTitle

public String getTitle()
WRITEME.

Returns:
WRITEME.
See Also:
getTitle()

getUserAction_JSON

public org.json.JSONObject getUserAction_JSON(AbstractUser u)
get a packet describing the user's action state.

Parameters:
u - the user
Returns:
JSON object describing user's action

getUserCount

public int getUserCount()
WRITEME.

Returns:
WRITEME.
See Also:
getUserCount()

getUserLimit

public int getUserLimit()
Returns:
the roomUserLimit

getVariable

public String getVariable(String string)
WRITEME.

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

getVariables

public HashMap<String,String> getVariables()
WRITEME.

Specified by:
getVariables in interface HasVariables
Returns:
WRITEME.
See Also:
getVariables()

getVariables_JSON

public org.json.JSONObject getVariables_JSON()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

getVehicleRulesForRoom

public VehicleStyle getVehicleRulesForRoom()
Returns:
the rules about allowing vehicles into the room

getVolume

public Volume3D getVolume()
Returns:
the volume

getWalkableSpace

public GeneralPath getWalkableSpace()
Returns:
all walkable space in the room

getWalkLimit

public Coord3D getWalkLimit(Coord3D from,
                            Coord3D to)
                     throws NotFoundException
Get the endpoint of a walk path from the source towards the target — clipped to the walkable space, if necessary.

Parameters:
from - source
to - target
Returns:
the last point to which one can walk along that line
Throws:
NotFoundException - if the source point isn't in a walkable space, or something.

getWorld

public String getWorld()
Returns:
the world

getWorldCoords

public Coord3D getWorldCoords()
Returns:
the worldCoords

getZone

public Zone getZone()
WRITEME.

Returns:
the zone in which this room is found

goTo

public void goTo(AbstractUser u,
                 Coord3D goal,
                 String facing,
                 String theVerb)
have a user walk (or dance, or whatever) to another location through walkable spaces

Parameters:
u - the user to move
goal - the target toward which to move
facing - force facing (or null to auto face)
theVerb - usually “Walk”

goTo

public void goTo(AbstractUser u,
                 double tX,
                 double tY,
                 double tZ,
                 String facing,
                 String verb)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
u - WRITEME
tX - WRITEME
tY - WRITEME
tZ - WRITEME
facing - WRITEME.
verb - WRITEME

goTo

public void goTo(AbstractUser u,
                 String placeName,
                 String verb)
have a user walk (or something) toward a named region; typically for NPC:s

Parameters:
u - who
placeName - target place name
verb - means of locomotion, usually “Walk”

goTo_checkWalkSpace

private Coord3D goTo_checkWalkSpace(AbstractUser u,
                                    Coord3D currentPos)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
u - WRITEME
currentPos - WRITEME
Returns:
WRITEME

goTo_clipToWalkSpace

public Coord3D goTo_clipToWalkSpace(AbstractUser u,
                                    Coord3D to)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
u - WRITEME
to - WRITEME
Returns:
WRITEME

goTo_core

private void goTo_core(AbstractUser u,
                       String facing,
                       String theVerb,
                       Coord3D to)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
u - WRITEME
facing - WRITEME
theVerb - WRITEME
to - WRITEME

goTo_locked

boolean goTo_locked(AbstractUser u,
                    Coord3D goal,
                    String facing,
                    String theVerb,
                    Coord3D knownStartPos)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
u - WRITEME
goal - WRITEME
facing - WRITEME
theVerb - WRITEME
knownStartPos - WRITEME
Returns:
true, on success; false, if the operation can't be completed.

hashCode

public int hashCode()
WRITEME.

Overrides:
hashCode in class SimpleDataRecord<Room>
See Also:
hashCode()

isLimbo

public boolean isLimbo()
WRITEME.

Returns:
WRITEME.
See Also:
isLimbo()

isOwner

public boolean isOwner(AbstractUser guy)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
guy - WRITEME
Returns:
WRITEME

isSkyVisible

public boolean isSkyVisible()
WRITEME.

Returns:
WRITEME
See Also:
isSkyVisible()

isSubjectToWeather

public boolean isSubjectToWeather()
Returns:
the subjectToWeather

join

public void join(RoomListener thing)
Parameters:
thing - WRITEME
See Also:
join(RoomListener)

join

public void join(RoomListener thing,
                 String from)
WRITEME.

Parameters:
thing - who is joining the room
from - the prior room's moniker

join_doWardrobeNotifications

private void join_doWardrobeNotifications(String from,
                                          AbstractUser user,
                                          Room oldRoom)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
from - WRITEME
user - WRITEME
oldRoom - WRITEME

join_sendPartFromOldRoom

private Room join_sendPartFromOldRoom(AbstractUser user)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
user - WRITEME
Returns:
WRITEME

notifyUserAction

public void notifyUserAction(AbstractUser u)
Parameters:
u - the user of whose action everyone needs to be notified

part

public void part(RoomListener thing)
WRITEME.

Parameters:
thing - WRITEME
See Also:
part(RoomListener)

pushToAllZones

public void pushToAllZones()
push this room to all zones


pushToZone

public void pushToZone(Zone z)

Copy the room's variable set to another room with an identical moniker in a different zone. If there is no existing room by the same moniker, then create one.

Parameters:
z - the zone targeted

putHere

public void putHere(AbstractUser user,
                    Coord3D position)
Parameters:
user - the user to be put down
position - the place to be put at

putHere_locked

void putHere_locked(AbstractUser user,
                    Coord3D position)
Version of putHere(AbstractUser, Coord3D) that does not acquire the location in a locking form (as AbstractUser.getLocationForUpdate()

Parameters:
user - the user to be put down
position - the place to be put at

recomputeLag

void recomputeLag()
Recompute the average local lag by taking all samples within the population distribution of the mean of all lag times for users in the room, and taking the highest lag time of that range


remove

public boolean remove(ExistsInWorld thing)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
thing - WRITEME
Returns:
WRITEME

remove

public void remove(GameEvent thatEvent)
Remove a GameEvent from receiving events in this room.

Parameters:
thatEvent - the event to be removed

remove

public boolean remove(RoomLayer oldLayer)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
oldLayer - WRITEME
Returns:
WRITEME

remove

public boolean remove(RoomListener oldListener)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
oldListener - WRITEME
Returns:
WRITEME

remove

public boolean remove(RoomRegion oldRegion)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
oldRegion - WRITEME
Returns:
WRITEME

remove

public boolean remove(SoundPlayback oldSound)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
oldSound - WRITEME
Returns:
WRITEME

removeDoneSounds

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


removeOwner

public boolean removeOwner(AbstractUser exOwner)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
exOwner - WRITEME
Returns:
WRITEME

removeVariable

protected void removeVariable(String varName)
remove a variable

Parameters:
varName - the variable's name

resetVariables

public void resetVariables(Map<String,String> vars)
replace the current set of room variables with a different set

Specified by:
resetVariables in interface HasVariables
Parameters:
vars - a new set of variables

saveRoomVars

public void saveRoomVars()
See Also:
saveRoomVars()

sendGameAction

public void sendGameAction(AbstractUser from,
                           org.json.JSONObject data)
                    throws org.json.JSONException
WRITEME.

Parameters:
from - WRITEME
data - WRITEME
Throws:
org.json.JSONException - WRITEME
See Also:
sendGameAction(AbstractUser, org.json.JSONObject)

sendPublicMessage

public void sendPublicMessage(AbstractUser from,
                              String speech)
WRITEME.

Parameters:
from - WRITEME
speech - WRITEME
See Also:
sendPublicMessage(org.starhope.appius.user.AbstractUser, java.lang.String)

sendUserServerTime

void sendUserServerTime(AbstractUser user)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
user - WRITEME

setFacingFor

void setFacingFor(AbstractUser u)
Set the appropriate facing string based upon the user's relative motion. If the user's motion is negligible, then do not change their current facing.

Parameters:
u - the user

setFilename

public void setFilename(String filename1)
Set the filename for the floor/background of the room

Parameters:
filename1 - the filename of the floor/background

setID

public void setID(int newID)
set the room's unique ID (integer) — unique within a Zone

Parameters:
newID - the new ID to be set

setLimbo

public void setLimbo(boolean b)
Set whether the room is a Limbo room. In Limbo, noöne can hear you scream — or talk, or move, or anything else. There are no broadcast messages.

Parameters:
b - Whether or not this room is a Limbo room — true, means to suppress all broadcast messages.

setMoniker

public void setMoniker(String newMoniker)
Set the room's unique (within a Zone) moniker. The moniker is the preferred way to refer to a room.

Parameters:
newMoniker - the moniker to set

setMusic

public void setMusic(String music1)
Set the background music to be played in the room

Parameters:
music1 - the background music to play in the room

setOverlay

public void setOverlay(String overlay1)
WRITEME.

Parameters:
overlay1 - WRITEME
See Also:
setOverlay(java.lang.String)

setOwner

public void setOwner(AbstractUser newHomeOwner)
Parameters:
newHomeOwner - the new owner of the home containing this room. May be null.

setPlace

public boolean setPlace(String placeCode,
                        String descriptor)
Set (create or change) a Place within the Room based upon a place code and a geometry string

Parameters:
placeCode - the room variable name, naming this place uniquely
descriptor - the description as to what it is, that this place does.
Returns:
true, if the code might be broadcasted as a room variable;

setRoomIndex

public void setRoomIndex(int newRoomIndex)
Parameters:
newRoomIndex - the new room index within the user's house

setRoomVars

public void setRoomVars()
WRITEME.

XXX has Tootsville-specific stuff that can be removed

See Also:
setRoomVars()

setSky

public void setSky(String newSky)
WRITEME.

Parameters:
newSky - WRITEME
See Also:
setSky(java.lang.String)

setSkyVisible

public void setSkyVisible(boolean whetherSkyIsVisible)
WRITEME.

Parameters:
whetherSkyIsVisible - WRITEME
See Also:
setSkyVisible(boolean)

setSubjectToWeather

public void setSubjectToWeather(boolean whetherSubjectToWeather)
Parameters:
whetherSubjectToWeather - the subjectToWeather to set

setTitle

public void setTitle(String newTitle)
WRITEME.

Parameters:
newTitle - WRITEME
See Also:
setTitle(java.lang.String)

setUserLimit

public void setUserLimit(int roomUserLimit)
Parameters:
roomUserLimit - the roomUserLimit to set

setVariable

public void setVariable(Map.Entry<String,String> var)
WRITEME.

Specified by:
setVariable in interface HasVariables
Parameters:
var - WRITEME
See Also:
setVariable(java.util.Map.Entry)

setVariable

public void setVariable(String varName,
                        String varValue)
WRITEME.

Specified by:
setVariable in interface HasVariables
Parameters:
varName - WRITEME
varValue - WRITEME
See Also:
setVariable(java.lang.String, java.lang.String)

setVariables

public void setVariables(Map<String,String> map)
WRITEME.

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

setVehicleRulesForRoom

public void setVehicleRulesForRoom(VehicleStyle newRules)
Parameters:
newRules - the new rules for vehicles in this room

setVolume

public void setVolume(Volume3D newVolume)
Parameters:
newVolume - the volume to set

setWorld

public void setWorld(String newWorld)
Parameters:
newWorld - the world to set

setWorldCoords

public void setWorldCoords(Coord3D newWorldCoords)
Parameters:
newWorldCoords - the worldCoords to set

setZone

public void setZone(Zone newZone)
Parameters:
newZone - the zone to set

speak_actually

public void speak_actually(AbstractUser u,
                           String speech,
                           FilterResult carlSays)
WRITEME: document this method (brpocock@star-hope.org, Mar 11, 2010)

Parameters:
u - WRITEME
speech - WRITEME
carlSays - WRITEME

superbot_fetchBasicInfo

@Deprecated
void superbot_fetchBasicInfo(ResultSet rs,
                                        ResultSet botGot,
                                        org.json.JSONObject bot,
                                        org.json.JSONObject speech,
                                        org.json.JSONObject avatar)
                       throws org.json.JSONException,
                              SQLException
Deprecated. 

get basic information about a SuperTootBot

XXX Tootsville specific

Parameters:
rs - WRITEME
botGot - WRITEME
bot - WRITEME
speech - WRITEME
avatar - WRITEME
Throws:
org.json.JSONException - WRITEME
SQLException - WRITEME

superbot_fetchClothing

@Deprecated
void superbot_fetchClothing(ResultSet rs,
                                       org.json.JSONObject clothes)
                      throws org.json.JSONException,
                             SQLException
Deprecated. 

Fetch clothing for Super Toot Bots. XXX Tootsville specific

Parameters:
rs - WRITEME
clothes - WRITEME
Throws:
org.json.JSONException - WRITEME
SQLException - WRITEME

superbot_fetchPattern

@Deprecated
void superbot_fetchPattern(ResultSet rs,
                                      org.json.JSONObject clothes)
                     throws org.json.JSONException,
                            SQLException
Deprecated. 

WRITEME: document this method (brpocock@star-hope.org, Dec 29, 2009)

Parameters:
rs - WRITEME
clothes - WRITEME
Throws:
org.json.JSONException - WRITEME
SQLException - WRITEME

superbot_fetchSpeech

@Deprecated
org.json.JSONObject superbot_fetchSpeech(PreparedStatement getSpeech,
                                                    ResultSet rs)
                                   throws SQLException,
                                          org.json.JSONException
Deprecated. use Plebeian

Fetch Super Toot Bot dictionaries. XXX Tootsville

Parameters:
getSpeech - WRITEME
rs - WRITEME
Returns:
WRITEME
Throws:
SQLException - WRITEME
org.json.JSONException - WRITEME

tellEveryoneAboutJoin

private void tellEveryoneAboutJoin(RoomListener joiner)
Parameters:
joiner - the thing joining the room

tellEveryoneAboutJoin

void tellEveryoneAboutJoin(RoomListener joiner,
                           AbstractUser joinerAsUser,
                           Room oldRoom)
Send a notification about the user joining a room to everyone in this room.

Parameters:
joiner - the thing joining the room
joinerAsUser - the same thing cast as a user
oldRoom - the room from which the user is coming

tellUserAboutRoom

void tellUserAboutRoom(AbstractUser u,
                       ServerThread t)
                 throws UserDeadException
Update the user during a room join, giving them information about everyone in the room

Parameters:
u - the user joining the room
t - the user's server thread
Throws:
UserDeadException - if the user goes away

toJSON

public org.json.JSONObject toJSON()
WRITEME.

Returns:
WRITEME
See Also:
{ "filename": room-filename, "moniker": room-moniker, "overlay": weather-overlay-filename, "sky": sky-background-filename, "skyVisible": ( "true" | "false" ) "vars": { … } }

toString

public String toString()
Overrides:
toString in class SimpleDataRecord<Room>
See Also:
Object.toString()

trace

protected void trace(String text)
trace to the server log an event

Parameters:
text - the message to output

userNearest

public AbstractUser userNearest(Coord3D target)
Parameters:
target - WRITEME
Returns:
WRITEME
See Also:
userNearest(org.starhope.appius.geometry.Coord3D)

validateUserList

void validateUserList()
Ensure that everyone who we think is in the room, is actually still here ... filter out dead users