org.starhope.appius.game
Interface AbstractRoom

All Known Implementing Classes:
Room

public interface AbstractRoom

WRITEME: The documentation for this type (AbstractRoom) is incomplete. (brpocock@star-hope.org, Jan 11, 2010)

Author:
brpocock@star-hope.org

Method Summary
 void add(GameEvent game)
           
 void broadcast(String string, org.json.JSONObject results)
          Broadcast a “success reply” to all listeners in a room
 boolean canWalk(AbstractUser u, org.starhope.appius.geometry.Coord3D coord3d)
          WRITEME: Document this method brpocock@star-hope.org
 boolean contains(AbstractUser user)
          WRITEME: document this method (brpocock@star-hope.org, Oct 28, 2009)
 void deleteVariable(String string)
           
 void destroySelf()
          WRITEME
 void fromJSON(org.json.JSONObject jso)
          WRITEME: document this method (brpocock@star-hope.org, Oct 21, 2009)
 Set<RoomListener> getAllListeners()
           
 Collection<AbstractUser> getAllUsers()
           
 String getDebugName()
           Get the debugging version of the room's name.
 String getFilename()
           
 GameEvent getGameEvent(String string)
          WRITEME: document this method (brpocock@star-hope.org, Mar 9, 2010)
 Collection<GameEvent> getGameEvents()
          WRITEME: document this method (brpocock@star-hope.org, Mar 2, 2010)
 int getID()
           
 long getLag()
          WRITEME: Document this method brpocock@star-hope.org
 Collection<RoomListener> getListeners()
          WRITEME: document this method (brpocock@star-hope.org, Nov 24, 2009)
 int getMaxUsers()
           
 String getMoniker()
           
 String getMusic()
          WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009)
 String getName()
           
 String getOverlay()
           
 AbstractUser getOwner()
           
 String getPlaceZoneNumber()
          WRITEME: Document this method brpocock@star-hope.org
 int getRoomIndex()
           Get the index of this room within the set of rooms to which it belongs.
 String getSky()
           
 String getTitle()
          Get the room's string title
 int getUserCount()
           
 String getVariable(String string)
           
 HashMap<String,String> getVariables()
          Get the set of all variables which are attached to this room
 GeneralPath getWalkableSpace()
           
 AbstractZone getZone()
           
 void goTo(AbstractUser u, double destX, double destY, double destZ, String facing, String verb)
          Instruct a user to move to a new place in a room via walking or a similar transportation mechanism.
 int hashCode()
          This is an overriding method.
 boolean isIndoors()
          WRITEME: Document this method brpocock@star-hope.org
 boolean isLimbo()
           A “limbo” room is a room in which no public messaging is carried out.
 boolean isSkyVisible()
           
 void join(RoomListener thing)
          Notify this room (and anyone in it) that someone has joined
 void join(RoomListener thing, String from)
          WRITEME: Document this method brpocock@star-hope.org
 void notifyUserAction(AbstractUser thing)
          notify all room listeners of a user movement / placement action
 void part(RoomListener roomListener)
           
 void pushToAllZones()
          copy room variables from this instance of a room to its clones in any other zones
 void pushToZone(AbstractZone otherZone)
          copy room variables from this instance of a room to its clones in one other zone
 void putHere(AbstractUser who, org.starhope.appius.geometry.Coord3D where)
          Position an avatar at a given coördinates
 void resetVariables(Map<String,String> roomVariables)
          reset room variables to only those found in the map supplied
 void saveRoomVars()
          save room variables currently set to the database, to be the template for future instances of the room
 void sendGameAction(AbstractUser u, org.json.JSONObject data)
          Propagate a game event to every user in the room.
 void sendPublicMessage(AbstractUser from, String speech)
           
 void setFilename(String filename1)
           
 void setIndoors(boolean b)
          WRITEME: Document this method brpocock@star-hope.org
 void setLimbo(boolean b)
           
 void setMoniker(String moniker1)
           
 void setMusic(String music1)
           
 void setOverlay(String overlay1)
           
 void setOwner(AbstractUser newHomeOwner)
          WRITEME: document this method (brpocock@star-hope.org, Jan 13, 2010)
 void setRoomIndex(int roomIndex)
          WRITEME: Document this method brpocock@star-hope.org
 void setRoomVars()
          WRITEME
 void setSky(String sky1)
           
 void setSkyVisible(boolean skyVisible1)
           
 void setTitle(String newTitle)
          WRITEME: document this method (brpocock@star-hope.org, Oct 5, 2009)
 void setVariable(Map.Entry<String,String> var)
           
 void setVariable(String varName, String varValue)
          Set a room variable.
 void setVariables(Map<String,String> map)
           
 void speak_actually(AbstractUser u, String speech, FilterResult carlSays)
           
 org.json.JSONObject toJSON()
           
 AbstractUser userNearest(org.starhope.appius.geometry.Coord3D target)
          Find an user under a mouse click
 

Method Detail

add

void add(GameEvent game)
Parameters:
game - WRITEME

broadcast

void broadcast(String string,
               org.json.JSONObject results)
Broadcast a “success reply” to all listeners in a room

Parameters:
string - the method returning a reply
results - the JSON data to be broadcast

canWalk

boolean canWalk(AbstractUser u,
                org.starhope.appius.geometry.Coord3D coord3d)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
u - WRITEME
coord3d - WRITEME
Returns:
WRITEME

contains

boolean contains(AbstractUser user)
WRITEME: document this method (brpocock@star-hope.org, Oct 28, 2009)

Parameters:
user - who
Returns:
true if they are in this room

deleteVariable

void deleteVariable(String string)
Parameters:
string - WRITEME

destroySelf

void destroySelf()
WRITEME


fromJSON

void fromJSON(org.json.JSONObject jso)
              throws org.json.JSONException
WRITEME: document this method (brpocock@star-hope.org, Oct 21, 2009)

Parameters:
jso - Serialized form
Throws:
org.json.JSONException - if the incoming data isn't in the right form

getAllListeners

Set<RoomListener> getAllListeners()
Returns:
WRITEME

getAllUsers

Collection<AbstractUser> getAllUsers()
Returns:
WRITEME

getDebugName

String getDebugName()

Get the debugging version of the room's name. This is based upon the moniker and zone, or identifies the room as an abstract room if it is not a part of a zone.

Returns:
A string uniquely identifying this room for debugging purposes.

getFilename

String getFilename()
Returns:
the filename

getGameEvent

GameEvent getGameEvent(String string)
WRITEME: document this method (brpocock@star-hope.org, Mar 9, 2010)

Parameters:
string - WRITEME
Returns:
WRITEME

getGameEvents

Collection<GameEvent> getGameEvents()
WRITEME: document this method (brpocock@star-hope.org, Mar 2, 2010)

Returns:
WRITEME

getID

int getID()
Returns:
the room's ID number

getLag

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

Returns:
WRITEME

getListeners

Collection<RoomListener> getListeners()
WRITEME: document this method (brpocock@star-hope.org, Nov 24, 2009)

Returns:
all RoomListeners, including all users and observers

getMaxUsers

int getMaxUsers()
Returns:
WRITEME

getMoniker

String getMoniker()
Returns:
the moniker

getMusic

String getMusic()
WRITEME: document this method (brpocock@star-hope.org, Oct 13, 2009)

Returns:
WRITEME

getName

String getName()
Returns:
WRITEME

getOverlay

String getOverlay()
Returns:
the overlay

getOwner

AbstractUser getOwner()
Returns:
the owner of this room, if this is a private (user-created) room; else, null.

getPlaceZoneNumber

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

Returns:
WRITEME

getRoomIndex

int getRoomIndex()

Get the index of this room within the set of rooms to which it belongs.

For user-created rooms, this is the index of the room number within the user's “house,” typically 0 for the first room, 1 for the yard, and 2 or more for additional rooms.

The meaning of this index varies depending upon context; presently, it is only meaningful for user houses.

Returns:
the index of this room

getSky

String getSky()
Returns:
the file to load for the sky of this room

getTitle

String getTitle()
Get the room's string title

Returns:
the user-visible title of the room

getUserCount

int getUserCount()
Returns:
the number of users in the room

getVariable

String getVariable(String string)
Parameters:
string - the variable name for which the value is requested
Returns:
the value of that variable, if any, or null, if no such variable is attached to this room

getVariables

HashMap<String,String> getVariables()
Get the set of all variables which are attached to this room

Returns:
room variables

getWalkableSpace

GeneralPath getWalkableSpace()
Returns:
the walkable area(s) of the screen

getZone

AbstractZone getZone()
Returns:
The zone in which this Room is found

goTo

void goTo(AbstractUser u,
          double destX,
          double destY,
          double destZ,
          String facing,
          String verb)
Instruct a user to move to a new place in a room via walking or a similar transportation mechanism.

Parameters:
u - The user to move
destX - destination X
destY - destination Y
destZ - destination Z
facing - the forced facing direction for the user; this can (and usually should) be “null”
verb - the means of transportation; the default is “Walk” but other verbs can be used (game- and/or character-specific)

hashCode

int hashCode()
This is an overriding method.

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

isIndoors

boolean isIndoors()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

isLimbo

boolean isLimbo()

A “limbo” room is a room in which no public messaging is carried out. Users are unaware of one another's presence, comings and goings, and there are no public messages. The default “limbo” room is named “nowhere”

Returns:
true, if this is a limbo room

isSkyVisible

boolean isSkyVisible()
Returns:
true, if the sky is visible in this room; else, false

join

void join(RoomListener thing)
Notify this room (and anyone in it) that someone has joined

Parameters:
thing - the thing that has joined the room

join

void join(RoomListener thing,
          String from)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
thing - who
from - from where

notifyUserAction

void notifyUserAction(AbstractUser thing)
notify all room listeners of a user movement / placement action

Parameters:
thing - the user moving/acting

part

void part(RoomListener roomListener)
Parameters:
roomListener - the thing which wants to stop listening to the room

pushToAllZones

void pushToAllZones()
copy room variables from this instance of a room to its clones in any other zones


pushToZone

void pushToZone(AbstractZone otherZone)
copy room variables from this instance of a room to its clones in one other zone

Parameters:
otherZone - the zone name

putHere

void putHere(AbstractUser who,
             org.starhope.appius.geometry.Coord3D where)
Position an avatar at a given coördinates

Parameters:
who - who is to be placed
where - where to place them

resetVariables

void resetVariables(Map<String,String> roomVariables)
reset room variables to only those found in the map supplied

Parameters:
roomVariables - new set of room variables

saveRoomVars

void saveRoomVars()
save room variables currently set to the database, to be the template for future instances of the room


sendGameAction

void sendGameAction(AbstractUser u,
                    org.json.JSONObject data)
                    throws org.json.JSONException
Propagate a game event to every user in the room.

Parameters:
u - WRITEME
data - WRITEME
Throws:
org.json.JSONException - if the action can't be represented in JSON

sendPublicMessage

void sendPublicMessage(AbstractUser from,
                       String speech)
Parameters:
from - WRITEME
speech - WRITEME

setFilename

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

setIndoors

void setIndoors(boolean b)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
b - WRITEME

setLimbo

void setLimbo(boolean b)
Parameters:
b - true, if this is a limbo room

setMoniker

void setMoniker(String moniker1)
Parameters:
moniker1 - the moniker to set

setMusic

void setMusic(String music1)
Parameters:
music1 - the new background music

setOverlay

void setOverlay(String overlay1)
Parameters:
overlay1 - the overlay to set

setOwner

void setOwner(AbstractUser newHomeOwner)
WRITEME: document this method (brpocock@star-hope.org, Jan 13, 2010)

Parameters:
newHomeOwner - new home owner

setRoomIndex

void setRoomIndex(int roomIndex)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
roomIndex - WRITEME

setRoomVars

void setRoomVars()
WRITEME


setSky

void setSky(String sky1)
Parameters:
sky1 - the sky to set

setSkyVisible

void setSkyVisible(boolean skyVisible1)
Parameters:
skyVisible1 - the skyVisible to set

setTitle

void setTitle(String newTitle)
WRITEME: document this method (brpocock@star-hope.org, Oct 5, 2009)

Parameters:
newTitle - WRITEME

setVariable

void setVariable(Map.Entry<String,String> var)
Parameters:
var - A Hash type Entry object containing a key-value pair to be used to set a variable.

setVariable

void setVariable(String varName,
                 String varValue)
Set a room variable. Room variables are transmitted to users upon joining a room (unless that room's “limbo” flag is set), and if they are changed, the changes propagate to everyone listening to that room (again, unless the room is in “limbo”)

Parameters:
varName - the name of the room variable to alter
varValue - the new value

setVariables

void setVariables(Map<String,String> map)
Parameters:
map - a map containing variables and

speak_actually

void speak_actually(AbstractUser u,
                    String speech,
                    FilterResult carlSays)
Parameters:
u - WRITEME
speech - WRITEME
carlSays - WRITEME

toJSON

org.json.JSONObject toJSON()
Returns:
the room's JSON representation

userNearest

AbstractUser userNearest(org.starhope.appius.geometry.Coord3D target)
Find an user under a mouse click

Parameters:
target - the coördinates
Returns:
the nearest user within a margin of a few pixels