org.starhope.appius.game
Class Zone

java.lang.Object
  extended by org.starhope.appius.game.Zone
All Implemented Interfaces:
Serializable, Comparable<AbstractZone>, AbstractZone, ViaAppia<RemoteZone>

public class Zone
extends Object
implements AbstractZone, ViaAppia<RemoteZone>, Comparable<AbstractZone>

Author:
brpocock
See Also:
Serialized Form

Field Summary
private  Map<String,AbstractRoom> badges
          Badges are icons placed upon the map to indicate something special about a room
static AbstractCensor censor
          Censorship object (Hangman) censor (OsirisPure)
protected  Set<String> cullRooms
          Rooms to be culled
protected static Set<AbstractZone> emptyZones
          List of empty zones
(package private) static long lastCheckedZonesForSpawn
           
private  List<AbstractRoom> lobbies
          Lobby rooms into which users are dropped at login, if they don't specify an initial room to join on their own
protected  Set<String> myEmptyZones
          Names of empty zones
private  String myName
          The name of this zone
private  String myServer
          The hostname of the server on which this Zone is running
private  int myServerPort
          The port number of the server on which this Zone is running
private  int nextDynamicRoomNumber
          The room numbers for dynamic rooms begin here
private static int NPC_TICK_INTERVAL
          Time between updates for NPC's
private static Random randomSource
          keep the random source around for fun.
(package private) static Set<AbstractZone> retiredZones
          Set of retired zones
private  ConcurrentHashMap<Integer,Room> roomsByID
          All rooms in the Zone: sorted by ID.
private  ConcurrentHashMap<String,Room> roomsByMoniker
          All rooms in the Zone: sorted by moniker.
private static long serialVersionUID
          Java Serialization unique ID
protected  boolean serverReady
          A flag set once the server has indicated that it's ready to go, to avoid issues with events firing off too soon (e.g.
private static int USER_ROOM_MAX_USERS
          Max users allowed into one room of an user's house at a time
private  ConcurrentSkipListSet<Integer> usersInZone
          the set of user ID's of all users in the Zone.
private static double ZONE_FULL_RATIO
          Get the percentage of "full" at which we consider a zone to be full enough to warrant spawning new ones.
(package private) static double ZONE_LIGHT_RATIO
          Get the percentage of "full" at which we consider a zone to be light enough that it's almost empty
private static int ZONE_MAX_USERS
          The max.
private static int ZONE_SPAWN_SECONDS
          Time (in seconds) between spawning new zones
 
Constructor Summary
Zone(String zoneName)
           
 
Method Summary
 void activate()
          This is an overriding method.
 void add(AbstractRoom room)
          This is an overriding method.
 void add(AbstractUser user)
           
 void assertStaffLevel(User u, int staffLevelRequired)
          Assert that the given user must have a given level of staff privileges
private  void badgesChanged()
          Notify everyone in the zone that the badges have been changed
 void biff(com.tootsville.user.Toot user, AbstractRoom room)
          Deprecated. Use Toot.biff(AbstractZone, AbstractRoom) instead
(package private)  void checkZonesForSpawn()
          See if enough zones are full to warrant spawning a new one; or, if zones are empty and can be deallocated.
 void clearAllBadges()
           
 void clearAllBadges(AbstractRoom room)
          clear all badges on one room
 void clearBadge(String string)
          clear the given badge name off of any room to which it might be applied
 int compareTo(AbstractZone other)
           
static void configUpdated()
           
protected  void cullUserRooms()
          remove unused user rooms
 void destroy()
          This is an overriding method.
 void destroyRoom(AbstractRoom room)
          This is an overriding method.
private  void dropUser(User user)
          Drop the user's house from the Zone
 boolean equals(AbstractZone z)
          determine whether two Zone pointers are the same object
 boolean equals(Object obj)
          This is an overriding method.
private  String genZoneName()
          Generate the name for a new zone based upon this one's name
private  org.json.JSONObject getAllBadges_JSON()
          get all badges on the Zone in JSON form
 Map<String,String> getAllBadges()
          Get all badges in this Zone (and to which rooms they are applied)
 Set<Integer> getAllUsersIDsInZone()
          get the user ID's of all users active in the Zone
 Collection<AbstractUser> getAllUsersInZone()
          This is an overriding method.
private  String getApple(AppiusClaudiusCaecus serverThread, String pass)
          Deprecated. 
 Set<String> getBadgesForRoom(AbstractRoom room)
          Get any badges assigned to a room
static Zone getByName(String name)
          Deprecated. use AppiusClaudiusCaecus.getZone(String)
 int getDynamicRoomNumber()
           
 String getHost()
          Get the host on which this zone's server is running
 int getMaxUsers()
          This is an overriding method.
 String getMyServer()
           
 int getMyServerPort()
           
 String getName()
          This is an overriding method.
 AbstractRoom getNextLobby()
           Get the next room which will accept an inbound user as the next lobby.
static int getNPCTickInterval()
           
private static int getNumberOfZonesNeeded(LinkedList<AbstractZone> zones)
          This is a breakout from checkZonesForSpawn() to determine the number of zones that need to be spawned or removed
 int getPort()
          Get the port number on which this zone's server is running
static String getRev()
           
 Room getRoom(Integer room)
          This is an overriding method.
 Room getRoomByName(String string)
          This is an overriding method.
 Collection<AbstractRoom> getRoomList()
          This is an overriding method.
 String getRoomListSFSXML()
          This is an overriding method.
 int getRoomMaxUsers()
          This is an overriding method.
 User getSystemUser()
          Deprecated. unused?
 String getURL()
          TODO: document this method (brpocock, Jan 4, 2010)
 AbstractUser getUserByName(String buddy)
          This is an overriding method.
 Collection<AbstractUser> getUserList()
          Deprecated. 
 AbstractRoom getUserRoom(AbstractUser user)
          This is an overriding method.
static int getUserRoomMaxUsers()
           
 org.json.JSONObject getZoneData_JSON(AbstractUser user)
          Gets the Zone data.
private static double getZoneFullRatio()
           
private static double getZoneLightRatio()
           
 org.json.JSONObject getZoneList_JSON(AbstractUser user)
          Get the set of all zones active (and not hidden nor retired) in JSON form.
static int getZoneMaxUsers()
           
static int getZoneSpawnSeconds()
          Get the number of seconds between checking for zone spawning
 boolean handleLogin(String zoneName, String bigNick, String password, AppiusClaudiusCaecus serverThread)
          Deprecated. 
 void handleRequest(String cmd, org.json.JSONObject jso, User u, int fromRoom)
          This is an overriding method.
(package private)  void handleServerReady()
          Once the server indicates its readiness, begin spawning auto-spawning Zones
protected  void handleSpeak(AbstractRoom room, AbstractUser u, String toSpeak)
          Deprecated. use AbstractUser.speak(AbstractRoom, String)
 void handleSpeak(int roomNumber, AbstractUser user, String speech)
          Deprecated. use AbstractUser.speak(AbstractRoom, String)
 void handleSpeak(Integer roomNum, AbstractUser speaker, String toSpeak)
          Deprecated. use AbstractUser.speak(AbstractRoom, String)
 void handleUserLost(User user)
          WRITEME: document this method (brpocock, Jul 14, 2009)
 void handleUserPart(String zone, AbstractRoom room, String uid, User user, String oldPlayerIndex)
          WRITEME: document this method (brpocock, Jul 14, 2009)
 int hashCode()
          This is an overriding method.
 void init()
          This is an overriding method.
private  void isItGood()
          Check over Zone spawn
 void readExternal(ObjectInput in)
          This is an overriding method.
 void remove(AbstractUser thing)
          This is an overriding method.
 void retire()
          Stop accepting new users
 void sendAdminMessage(AbstractRoom room, User user, String message)
          Deprecated. 
private  void sendBadges(AbstractUser user)
          send badges to an given user in this zone
protected  void sendBadPassword(String nick, AppiusClaudiusCaecus channel, User user, String zoneName, String password)
          Send the user a notification that their password was incorrect
protected  void sendBuddyNotice(String buddyName, boolean isOnline, String roomMoniker, String roomTitle, User u, int room)
           Sends a buddy notice message to the client
 void sendEarnings(int r, User u, String msg)
          Deprecated. Use User.sendEarnings(AbstractRoom, String) instead
 void sendError_RAW(String xtnName, String message, AppiusClaudiusCaecus channel)
          Deprecated. Use AppiusClaudiusCaecus.sendError_RAW(String,String) instead
 void sendErrorReply(String source, String error, org.json.JSONObject result, User u, int room)
          WRITEME: document this method (brpocock, Aug 20, 2009)
protected  void sendLoginPacket(String zoneName, String nick, String password, AppiusClaudiusCaecus serverThread, User user, LinkedList<AppiusClaudiusCaecus> recipients)
          Deprecated. 
protected  void sendLogKO(AppiusClaudiusCaecus recipient)
          Deprecated. Use AppiusClaudiusCaecus.sendLogKO() instead
protected  void sendLogKO(AppiusClaudiusCaecus recipient, String messageText)
          Deprecated. Use AppiusClaudiusCaecus.sendLogKO(String) instead
 void sendModMessage(AbstractRoom room, User user, String message)
           Sends an (anonymous) moderator message to the user
protected  void sendNoSuchUser(LinkedList<AppiusClaudiusCaecus> recipients, String nick, String zoneName, String password)
          Tell the user to bugger off, because they don't exist
 void sendOops(User u)
          Sends the user the private message /00p$
 void sendOops(User u, AbstractRoom room)
          Deprecated. 
(package private)  void sendResponse(org.json.JSONObject result, Integer room, AbstractUser u, AppiusClaudiusCaecus recipient)
          Deprecated. use AppiusClaudiusCaecus.sendResponse(JSONObject, Integer, AbstractUser) directly
(package private)  void sendResponse(org.json.JSONObject result, Integer room, AbstractUser u, Collection<AppiusClaudiusCaecus> recipients)
          Deprecated. use AppiusClaudiusCaecus.sendResponse(JSONObject, Integer, AbstractUser) directly
 void sendSuccessReply(String source, org.json.JSONObject resultIn, AbstractUser u, int room)
          Send a reply with a success indicator to a list of recipients.
 void sendSuccessReply(String source, org.json.JSONObject resultIn, AbstractUser u, int room, AppiusClaudiusCaecus recipient)
          Deprecated. Use AppiusClaudiusCaecus.sendSuccessReply(String,JSONObject,AbstractUser,int) instead
 void sendSuccessReply(String source, org.json.JSONObject resultIn, AbstractUser u, int room, LinkedList<AppiusClaudiusCaecus> recipients)
          Deprecated. This was just being abused to be compatible with SFS, you almost certainly just wanted sendSuccessReply(String, JSONObject, AbstractUser,int)
(package private)  void sendUserLists(AbstractUser user)
          Sends the user an asynchronous notification of their user lists' status.
(package private)  void sendWardrobe(AbstractUser user, Object ignored, int room)
          Send a "from:wardrobe" message to the user
 void setAutoJoinRoom(int id)
          This is an overriding method.
 void setBadge(String badge, AbstractRoom room)
          WRITEME
 void setMyServer(String server)
           
 void setMyServerPort(int serverPort)
           
 String spawnNewZone()
          This is an overriding method.
 void spawnZone(String zoneName)
          Create a new, empty zone, and attach the default properties to it.
 void spawnZone(String zoneName, String image)
          Create a new, empty zone, and attach the default properties to it.
 void tellEaves(AbstractUser user, AbstractRoom room, String verb, String note)
          TODO: document this method (brpocock, Oct 28, 2009)
 void trace(String string)
          This is an overriding method.
 void writeExternal(ObjectOutput out)
          This is an overriding method.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

censor

public static final AbstractCensor censor
Censorship object (Hangman) censor (OsirisPure)


emptyZones

protected static final Set<AbstractZone> emptyZones
List of empty zones


lastCheckedZonesForSpawn

static long lastCheckedZonesForSpawn

NPC_TICK_INTERVAL

private static int NPC_TICK_INTERVAL
Time between updates for NPC's


randomSource

private static Random randomSource
keep the random source around for fun.


retiredZones

static Set<AbstractZone> retiredZones
Set of retired zones


serialVersionUID

private static final long serialVersionUID
Java Serialization unique ID

See Also:
Constant Field Values

USER_ROOM_MAX_USERS

private static int USER_ROOM_MAX_USERS
Max users allowed into one room of an user's house at a time


ZONE_FULL_RATIO

private static double ZONE_FULL_RATIO
Get the percentage of "full" at which we consider a zone to be full enough to warrant spawning new ones.


ZONE_LIGHT_RATIO

static double ZONE_LIGHT_RATIO
Get the percentage of "full" at which we consider a zone to be light enough that it's almost empty


ZONE_MAX_USERS

private static int ZONE_MAX_USERS
The max. users per Zone (And per every room in every real zone)


ZONE_SPAWN_SECONDS

private static int ZONE_SPAWN_SECONDS
Time (in seconds) between spawning new zones


badges

private final transient Map<String,AbstractRoom> badges
Badges are icons placed upon the map to indicate something special about a room


cullRooms

protected final transient Set<String> cullRooms
Rooms to be culled


lobbies

private final transient List<AbstractRoom> lobbies
Lobby rooms into which users are dropped at login, if they don't specify an initial room to join on their own


myEmptyZones

protected final transient Set<String> myEmptyZones
Names of empty zones


myName

private final String myName
The name of this zone


myServer

private String myServer
The hostname of the server on which this Zone is running


myServerPort

private int myServerPort
The port number of the server on which this Zone is running


nextDynamicRoomNumber

private int nextDynamicRoomNumber
The room numbers for dynamic rooms begin here


roomsByID

private final ConcurrentHashMap<Integer,Room> roomsByID
All rooms in the Zone: sorted by ID.

See Also:
roomsByMoniker

roomsByMoniker

private final ConcurrentHashMap<String,Room> roomsByMoniker
All rooms in the Zone: sorted by moniker.

See Also:
roomsByID

serverReady

protected boolean serverReady
A flag set once the server has indicated that it's ready to go, to avoid issues with events firing off too soon (e.g. NPC's)


usersInZone

private final ConcurrentSkipListSet<Integer> usersInZone
the set of user ID's of all users in the Zone. We don't keep User objects here because we were once having instantiation failures; it would probably be more efficient to do so, but XXX

Constructor Detail

Zone

public Zone(String zoneName)
Parameters:
zoneName - The name for the new Zone
Method Detail

configUpdated

public static void configUpdated()

getByName

@Deprecated
public static Zone getByName(String name)
Deprecated. use AppiusClaudiusCaecus.getZone(String)

Parameters:
name - the name of the Zone to find
Returns:
the Zone with that name (if any)

getNPCTickInterval

public static int getNPCTickInterval()
Returns:
Seconds between NPC updates

getNumberOfZonesNeeded

private static int getNumberOfZonesNeeded(LinkedList<AbstractZone> zones)
This is a breakout from checkZonesForSpawn() to determine the number of zones that need to be spawned or removed

Parameters:
zones - The set of all Zones in the multiverse
Returns:
the (signed) number of zones to be created (positive) or removed (negative)

getRev

public static String getRev()
Returns:
get the Subversion revision of this file

getUserRoomMaxUsers

public static int getUserRoomMaxUsers()
Returns:
get the max number of users allowed in an user's house/rooms

getZoneFullRatio

private static double getZoneFullRatio()
Returns:
the ratio of its capacity at which we declare that a zone is “full,” and do not allow it to accept more users. Each lightly-filled or empty zone counteracts a full zone when deciding whether to spawn additional zones.

getZoneLightRatio

private static double getZoneLightRatio()
Returns:
the ratio of its capacity at which we declare that a zone is “lightly used,” and assume that it can absorb more users. Each lightly-filled or empty zone counteracts a full zone when deciding whether to spawn additional zones.

getZoneMaxUsers

public static int getZoneMaxUsers()
Returns:
get the maximum number of users allowed in a zone

getZoneSpawnSeconds

public static int getZoneSpawnSeconds()
Get the number of seconds between checking for zone spawning

Returns:
The interval between checks for spawning zones

activate

public void activate()
This is an overriding method.

Specified by:
activate in interface AbstractZone
See Also:
AbstractZone.activate()

add

public void add(AbstractRoom room)
This is an overriding method.

Specified by:
add in interface AbstractZone
Parameters:
room - The room to be added.
See Also:
AbstractZone.add(AbstractRoom)

add

public void add(AbstractUser user)
Parameters:
user - the user entering the zone

assertStaffLevel

public void assertStaffLevel(User u,
                             int staffLevelRequired)
                      throws PrivilegeRequiredException
Assert that the given user must have a given level of staff privileges

Parameters:
u - The Smart Fox user object
staffLevelRequired - The staff level required to perform the action
Throws:
PrivilegeRequiredException - if the user

badgesChanged

private void badgesChanged()
Notify everyone in the zone that the badges have been changed


biff

@Deprecated
public void biff(com.tootsville.user.Toot user,
                            AbstractRoom room)
          throws org.json.JSONException
Deprecated. Use Toot.biff(AbstractZone, AbstractRoom) instead

Deprecated method. This method will be removed soon. Send a biff message to announce the number of message in a user's Inbox.

Parameters:
user - A Tootsville™ user
room - The room in which the user is standing
Throws:
org.json.JSONException - If the biff can't be sent

checkZonesForSpawn

void checkZonesForSpawn()
See if enough zones are full to warrant spawning a new one; or, if zones are empty and can be deallocated.


clearAllBadges

public void clearAllBadges()
Specified by:
clearAllBadges in interface AbstractZone
See Also:
AbstractZone.clearAllBadges()

clearAllBadges

public void clearAllBadges(AbstractRoom room)
clear all badges on one room

Specified by:
clearAllBadges in interface AbstractZone
Parameters:
room - the room upon which all badges are to be cleared

clearBadge

public void clearBadge(String string)
                throws GameLogicException
clear the given badge name off of any room to which it might be applied

Specified by:
clearBadge in interface AbstractZone
Parameters:
string - the badge name
Throws:
GameLogicException - if the given badge wasn't set on the room already

compareTo

public int compareTo(AbstractZone other)
Specified by:
compareTo in interface Comparable<AbstractZone>
Specified by:
compareTo in interface AbstractZone
Parameters:
other - the other zone
Returns:
the relative ordering of the zones, in Unicode order by name

cullUserRooms

protected void cullUserRooms()
remove unused user rooms


destroy

public void destroy()
This is an overriding method.

Specified by:
destroy in interface AbstractZone
See Also:
AbstractZone.destroy()

destroyRoom

public void destroyRoom(AbstractRoom room)
This is an overriding method.

Specified by:
destroyRoom in interface AbstractZone
Parameters:
room - WRITEME
See Also:
AbstractZone.destroyRoom(AbstractRoom)

dropUser

private void dropUser(User user)
Drop the user's house from the Zone

Parameters:
user - the user whose house is to be dropped

equals

public boolean equals(AbstractZone z)
determine whether two Zone pointers are the same object

Parameters:
z - another Zone
Returns:
true, if the two objects are the same Zone

equals

public boolean equals(Object obj)
This is an overriding method.

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

genZoneName

private String genZoneName()
Generate the name for a new zone based upon this one's name

Returns:
a new zone name

getAllBadges

public Map<String,String> getAllBadges()
Get all badges in this Zone (and to which rooms they are applied)

Returns:
a map of badges and room monikers

getAllBadges_JSON

private org.json.JSONObject getAllBadges_JSON()
get all badges on the Zone in JSON form

Returns:
the JSON set describing all active badges

getAllUsersIDsInZone

public Set<Integer> getAllUsersIDsInZone()
get the user ID's of all users active in the Zone

Specified by:
getAllUsersIDsInZone in interface AbstractZone
Returns:
the set of all users in the Zone

getAllUsersInZone

public Collection<AbstractUser> getAllUsersInZone()
This is an overriding method.

Specified by:
getAllUsersInZone in interface AbstractZone
Returns:
A Collection of all users currently in the Zone
See Also:
AbstractZone.getAllUsersInZone()

getApple

@Deprecated
private String getApple(AppiusClaudiusCaecus serverThread,
                                   String pass)
Deprecated. 

Get the “apple” (CHAP authentication string SHA1 digest encoded in hex) for the login system

Parameters:
serverThread - The AppiusClaudiusCaecus to the relevant user
pass - The plaintext password to be used
Returns:
the “apple” string
See Also:
AppiusClaudiusCaecus.getApple(String)

getBadgesForRoom

public Set<String> getBadgesForRoom(AbstractRoom room)
Get any badges assigned to a room

Parameters:
room - the room in question
Returns:
the set of badge strings

getDynamicRoomNumber

public int getDynamicRoomNumber()
Returns:
get the next room number to be used for a dynamic room

getHost

public String getHost()
Get the host on which this zone's server is running

Specified by:
getHost in interface AbstractZone
Returns:
the host on which this Zone's server is running

getMaxUsers

public int getMaxUsers()
This is an overriding method.

Specified by:
getMaxUsers in interface AbstractZone
Returns:
WRITEME
See Also:
AbstractZone.getMaxUsers()

getMyServer

public String getMyServer()
Returns:
myServer

getMyServerPort

public int getMyServerPort()
Returns:
myServerPort

getName

public String getName()
This is an overriding method.

Specified by:
getName in interface AbstractZone
Returns:
WRITEME
See Also:
AbstractZone.getName()

getNextLobby

public AbstractRoom getNextLobby()

Get the next room which will accept an inbound user as the next lobby.

FIXME: This contains Tootsville-specific code. There should instead be a room variable to indicate that a room is a lobby.

FIXME: This code isn't used in Tootsville any more, anyways. Tootsville users get the map screen after logging in.

Specified by:
getNextLobby in interface AbstractZone
Returns:
The name of the room into which the user should join

getPort

public int getPort()
Get the port number on which this zone's server is running

Specified by:
getPort in interface AbstractZone
Returns:
the port number on which this Zone's server is running

getRoom

public Room getRoom(Integer room)
This is an overriding method.

Specified by:
getRoom in interface AbstractZone
Parameters:
room - WRITEME
Returns:
WRITEME
See Also:
AbstractZone.getRoom(java.lang.Integer)

getRoomByName

public Room getRoomByName(String string)
This is an overriding method.

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

getRoomList

public Collection<AbstractRoom> getRoomList()
This is an overriding method.

Specified by:
getRoomList in interface AbstractZone
Returns:
WRITEME
See Also:
AbstractZone.getRoomList()

getRoomListSFSXML

public String getRoomListSFSXML()
This is an overriding method.

Specified by:
getRoomListSFSXML in interface AbstractZone
Returns:
a string of the SFS - XML format
See Also:
AbstractZone.getRoomListSFSXML()

getRoomMaxUsers

public int getRoomMaxUsers()
This is an overriding method.

Specified by:
getRoomMaxUsers in interface AbstractZone
Returns:
WRITEME
See Also:
AbstractZone.getRoomMaxUsers()

getSystemUser

@Deprecated
public User getSystemUser()
Deprecated. unused?

Returns:
the system's own user account

getURL

public String getURL()
TODO: document this method (brpocock, Jan 4, 2010)

Specified by:
getURL in interface AbstractZone
Returns:
an URL for this Zone

getUserByName

public AbstractUser getUserByName(String buddy)
This is an overriding method.

Specified by:
getUserByName in interface AbstractZone
Parameters:
buddy - WRITEME
Returns:
WRITEME
See Also:
AbstractZone.getUserByName(java.lang.String)

getUserList

@Deprecated
public Collection<AbstractUser> getUserList()
Deprecated. 

Returns:
getAllUsersInZone()

getUserRoom

public AbstractRoom getUserRoom(AbstractUser user)
This is an overriding method.

Specified by:
getUserRoom in interface AbstractZone
Parameters:
user - WRITEME
Returns:
where the user is according to me
See Also:
AbstractZone.getUserRoom(AbstractUser)

getZoneData_JSON

public org.json.JSONObject getZoneData_JSON(AbstractUser user)
                                     throws org.json.JSONException
Gets the Zone data. The user passed in will be used to compute the “buddies” counter for the zone

Specified by:
getZoneData_JSON in interface AbstractZone
Parameters:
user - the user from whose perspective we're collecting the zone information
Returns:
JSON data
{ name: zone name,
  host: server hostname or IP address,
  usersOn: total number of active users,
  maxUsers: maximum number of users allowed,
  bg: zone icon background image,
  assetPath: path to resolve assets; default is "",
  buddies: number of online buddies for the selected user
Throws:
org.json.JSONException - if something can't be encoded in JSON

getZoneList_JSON

public org.json.JSONObject getZoneList_JSON(AbstractUser user)
Get the set of all zones active (and not hidden nor retired) in JSON form. Hidden zones begin with a “$”

Specified by:
getZoneList_JSON in interface AbstractZone
Parameters:
user - the user whose buddy list will be used to get the buddy counts on each zone
Returns:
a zoneList object to be passed to the client

handleLogin

@Deprecated
public boolean handleLogin(String zoneName,
                                      String bigNick,
                                      String password,
                                      AppiusClaudiusCaecus serverThread)
Deprecated. 

Process a login request from the user

Parameters:
zoneName - Unused. Should be this zone's name, but the parameter is ignored.
bigNick - The user's requested nickname (attempted user name)
password - This is a bit of a misnomer. We actually are checking for the secret key (CHAP cookie) for the current channel, to which has been appended the user's actual password, as presented as a hex-coded SHA1 digest. (In brief: pseudocode of sha1( cookie + password ).toHex )
serverThread - This is the thread over which we are communicating with the prospective user
Returns:
boolean? WRITEME

handleRequest

public void handleRequest(String cmd,
                          org.json.JSONObject jso,
                          User u,
                          int fromRoom)
This is an overriding method.

Parameters:
cmd - WRITEME
jso - WRITEME
u - WRITEME
fromRoom - WRITEME

handleServerReady

void handleServerReady()
Once the server indicates its readiness, begin spawning auto-spawning Zones


handleSpeak

@Deprecated
protected void handleSpeak(AbstractRoom room,
                                      AbstractUser u,
                                      String toSpeak)
Deprecated. use AbstractUser.speak(AbstractRoom, String)

Parameters:
room - the room in which the speech is occurring
u - the speaker
toSpeak - WRITEME
See Also:
AbstractUser.speak(AbstractRoom,String)

handleSpeak

@Deprecated
public void handleSpeak(int roomNumber,
                                   AbstractUser user,
                                   String speech)
Deprecated. use AbstractUser.speak(AbstractRoom, String)

Description copied from interface: AbstractZone
Handle (and propagate) an user's speech

Specified by:
handleSpeak in interface AbstractZone
Parameters:
roomNumber - the room in which the user is speaking
user - the user speaking
speech - the speech to be spoken
See Also:
AbstractZone.handleSpeak(int,AbstractUser,String)

handleSpeak

@Deprecated
public void handleSpeak(Integer roomNum,
                                   AbstractUser speaker,
                                   String toSpeak)
Deprecated. use AbstractUser.speak(AbstractRoom, String)

Handle a user speaking. This redirects through to AbstractUser.speak(AbstractRoom, String)

Parameters:
roomNum - The room ID number
speaker - The user speaking
toSpeak - The text to be spoken

handleUserLost

public void handleUserLost(User user)
WRITEME: document this method (brpocock, Jul 14, 2009)

Parameters:
user - WRITEME

handleUserPart

public void handleUserPart(String zone,
                           AbstractRoom room,
                           String uid,
                           User user,
                           String oldPlayerIndex)
WRITEME: document this method (brpocock, Jul 14, 2009)

Parameters:
zone - WRITEME
room - WRITEME
uid - WRITEME
user - WRITEME
oldPlayerIndex - WRITEME

hashCode

public int hashCode()
This is an overriding method.

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

init

public void init()
This is an overriding method.

Specified by:
init in interface AbstractZone
See Also:
AbstractZone.init()

isItGood

private void isItGood()
Check over Zone spawn


readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
This is an overriding method.

Parameters:
in - WRITEME
Throws:
IOException - WRITEME
ClassNotFoundException - WRITEME

remove

public void remove(AbstractUser thing)
This is an overriding method.

Specified by:
remove in interface AbstractZone
Parameters:
thing - WRITEME
See Also:
AbstractZone.remove(AbstractUser)

retire

public void retire()
Stop accepting new users

Specified by:
retire in interface AbstractZone

sendAdminMessage

@Deprecated
public void sendAdminMessage(AbstractRoom room,
                                        User user,
                                        String message)
Deprecated. 

Send an admin message to \a user in room \a room.

Parameters:
room - Room the user is in.
user - User to send the message to.
message - Contents of the message being sent.
See Also:
AppiusClaudiusCaecus.sendAdminMessage(String, boolean)

sendBadges

private void sendBadges(AbstractUser user)
send badges to an given user in this zone

Parameters:
user - the user to whom to send badges

sendBadPassword

protected void sendBadPassword(String nick,
                               AppiusClaudiusCaecus channel,
                               User user,
                               String zoneName,
                               String password)
Send the user a notification that their password was incorrect

Parameters:
nick - WRITEME
channel - WRITEME
user - WRITEME
zoneName - WRITEME
password - WRITEME

sendBuddyNotice

protected void sendBuddyNotice(String buddyName,
                               boolean isOnline,
                               String roomMoniker,
                               String roomTitle,
                               User u,
                               int room)
                        throws org.json.JSONException

Sends a buddy notice message to the client

{ from: buddyNotice, status: true, notice: { buddy: name, online: boolean, room: moniker, roomName: title } }

Parameters:
buddyName - WRITEME
isOnline - WRITEME
roomMoniker - WRITEME
roomTitle - WRITEME
u - WRITEME
room - WRITEME
Throws:
org.json.JSONException - WRITEME

sendEarnings

@Deprecated
public void sendEarnings(int r,
                                    User u,
                                    String msg)
                  throws org.json.JSONException
Deprecated. Use User.sendEarnings(AbstractRoom, String) instead

Send an earnings notice to the client.

Parameters:
r - room
u - user
msg - WRITEME
Throws:
org.json.JSONException - WRITEME

sendError_RAW

@Deprecated
public void sendError_RAW(String xtnName,
                                     String message,
                                     AppiusClaudiusCaecus channel)
Deprecated. Use AppiusClaudiusCaecus.sendError_RAW(String,String) instead

Parameters:
xtnName - the command reporting an error
message - the error message
channel - the server thread to receive the error
See Also:
AppiusClaudiusCaecus.sendError_RAW(java.lang.String, java.lang.String)

sendErrorReply

public void sendErrorReply(String source,
                           String error,
                           org.json.JSONObject result,
                           User u,
                           int room)
                    throws org.json.JSONException
WRITEME: document this method (brpocock, Aug 20, 2009)

Parameters:
source - The method returning the error message
error - The error message
result - The payload, if any. May be altered.
u - The user to whom to send the success reply
room - The room in which the user is standing
Throws:
org.json.JSONException - WRITEME

sendLoginPacket

@Deprecated
protected void sendLoginPacket(String zoneName,
                                          String nick,
                                          String password,
                                          AppiusClaudiusCaecus serverThread,
                                          User user,
                                          LinkedList<AppiusClaudiusCaecus> recipients)
Deprecated. 

Send the bucketfuls of information that we force-feed the client at login...

Parameters:
zoneName - WRITEME
nick - WRITEME
password - WRITEME
serverThread - WRITEME
user - WRITEME
recipients - WRITEME

sendLogKO

@Deprecated
protected void sendLogKO(AppiusClaudiusCaecus recipient)
Deprecated. Use AppiusClaudiusCaecus.sendLogKO() instead

TODO: document this method (brpocock, Dec 15, 2009)

Parameters:
recipient - WRITEME

sendLogKO

@Deprecated
protected void sendLogKO(AppiusClaudiusCaecus recipient,
                                    String messageText)
Deprecated. Use AppiusClaudiusCaecus.sendLogKO(String) instead

WRITEME

Parameters:
recipient - WRITEME
messageText - WRITEME

sendModMessage

public void sendModMessage(AbstractRoom room,
                           User user,
                           String message)

Sends an (anonymous) moderator message to the user

Parameters:
room - The room the user is in
user - The user to whom to send the message
message - The moderator message to be sent

sendNoSuchUser

protected void sendNoSuchUser(LinkedList<AppiusClaudiusCaecus> recipients,
                              String nick,
                              String zoneName,
                              String password)
Tell the user to bugger off, because they don't exist

Parameters:
recipients - WRITEME
nick - WRITEME
zoneName - WRITEME
password - WRITEME

sendOops

public void sendOops(User u)
Sends the user the private message /00p$

Parameters:
u - the user to whom we want to send the Oops message

sendOops

@Deprecated
public void sendOops(User u,
                                AbstractRoom room)
Deprecated. 

Replaced with just sendOops(User)

Parameters:
u - WRITEME
room - WRITEME

sendResponse

@Deprecated
void sendResponse(org.json.JSONObject result,
                             Integer room,
                             AbstractUser u,
                             AppiusClaudiusCaecus recipient)
Deprecated. use AppiusClaudiusCaecus.sendResponse(JSONObject, Integer, AbstractUser) directly

TODO: document this method (brpocock, Dec 29, 2009)

Parameters:
result - WRITEME
room - WRITEME
u - WRITEME
recipient - WRITEME

sendResponse

@Deprecated
void sendResponse(org.json.JSONObject result,
                             Integer room,
                             AbstractUser u,
                             Collection<AppiusClaudiusCaecus> recipients)
Deprecated. use AppiusClaudiusCaecus.sendResponse(JSONObject, Integer, AbstractUser) directly

Send a JSON “extension response” to a list of recipients.

Parameters:
result - the JSON result object (ready to send)
room - the room in which the event happened, if any.
u - the sender of the message
recipients - the set of recipients

sendSuccessReply

public void sendSuccessReply(String source,
                             org.json.JSONObject resultIn,
                             AbstractUser u,
                             int room)
                      throws org.json.JSONException
Send a reply with a success indicator to a list of recipients.

Parameters:
source - The method returning the success message
resultIn - The payload, if any. May be altered.
u - The user to whom to send the success reply
room - The room in which the user is standing
Throws:
org.json.JSONException - WRITEME

sendSuccessReply

@Deprecated
public void sendSuccessReply(String source,
                                        org.json.JSONObject resultIn,
                                        AbstractUser u,
                                        int room,
                                        AppiusClaudiusCaecus recipient)
                      throws org.json.JSONException
Deprecated. Use AppiusClaudiusCaecus.sendSuccessReply(String,JSONObject,AbstractUser,int) instead

TODO: document this method (brpocock, Dec 29, 2009)

Parameters:
source - WRITEME
resultIn - WRITEME
u - WRITEME
room - WRITEME
recipient - WRITEME
Throws:
org.json.JSONException - WRITEME

sendSuccessReply

@Deprecated
public void sendSuccessReply(String source,
                                        org.json.JSONObject resultIn,
                                        AbstractUser u,
                                        int room,
                                        LinkedList<AppiusClaudiusCaecus> recipients)
                      throws org.json.JSONException
Deprecated. This was just being abused to be compatible with SFS, you almost certainly just wanted sendSuccessReply(String, JSONObject, AbstractUser,int)

WRITEME: document this method (brpocock, Sep 9, 2009)

Parameters:
source - WRITEME
resultIn - WRITEME
u - WRITEME
room - WRITEME
recipients - WRITEME
Throws:
org.json.JSONException - WRITEME

sendUserLists

void sendUserLists(AbstractUser user)
             throws org.json.JSONException
Sends the user an asynchronous notification of their user lists' status. This is normally triggered by a change in the status of one of the users on these lists. (Note, User Lists are the buddy list and ignore list.)

Parameters:
user - The user who will receive an update of their user lists
Throws:
org.json.JSONException - If the data fails to serialize properly

sendWardrobe

void sendWardrobe(AbstractUser user,
                  Object ignored,
                  int room)
            throws org.json.JSONException
Send a "from:wardrobe" message to the user

Parameters:
user - WRITEME
ignored - Ignored parameter. Null is a good answer.
room - WRITEME
Throws:
org.json.JSONException - WRITEME

setAutoJoinRoom

public void setAutoJoinRoom(int id)
This is an overriding method.

Specified by:
setAutoJoinRoom in interface AbstractZone
Parameters:
id - WRITEME
See Also:
AbstractZone.setAutoJoinRoom(int)

setBadge

public void setBadge(String badge,
                     AbstractRoom room)
WRITEME

Specified by:
setBadge in interface AbstractZone
Parameters:
badge - WRITEME
room - WRITEME

setMyServer

public void setMyServer(String server)
Parameters:
server - myServer

setMyServerPort

public void setMyServerPort(int serverPort)
Parameters:
serverPort - myServerPort

spawnNewZone

public String spawnNewZone()
This is an overriding method.

Specified by:
spawnNewZone in interface AbstractZone
Returns:
WRITEME
See Also:
AbstractZone.spawnNewZone()

spawnZone

public void spawnZone(String zoneName)
Create a new, empty zone, and attach the default properties to it. The zone's image will default to the one for the current Zone.

Specified by:
spawnZone in interface AbstractZone
Parameters:
zoneName - the name of the new zone

spawnZone

public void spawnZone(String zoneName,
                      String image)
Create a new, empty zone, and attach the default properties to it.

Parameters:
zoneName - the name of the new zone
image - the background nugget icon

tellEaves

public void tellEaves(AbstractUser user,
                      AbstractRoom room,
                      String verb,
                      String note)
TODO: document this method (brpocock, Oct 28, 2009)

Specified by:
tellEaves in interface AbstractZone
Parameters:
user - The user who has acted
room - The room in which s/he has acted
verb - The action s/he has taken
note - Note(s) about the action

trace

public void trace(String string)
This is an overriding method.

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

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
This is an overriding method.

Throws:
IOException
See Also:
org.starhope.appius.via.ViaAppia#writeExternal(java.io.ObjectOutput)