com.tootsville
Class ExtensionCommands

java.lang.Object
  extended by com.tootsville.ExtensionCommands

public class ExtensionCommands
extends Object

Extension commands for JSON commands and operator commands specific to Tootsville™

Author:
brpocock@star-hope.org

Constructor Summary
ExtensionCommands()
           
 
Method Summary
static void do_addJournalEntry(org.json.JSONObject jso, AbstractUser u, Room room)
          Deprecated. 
static void do_createUserHouse(org.json.JSONObject jso, AbstractUser u, Room room)
           Response from the first run screen for the user's house
static void do_deleteMailMessage(org.json.JSONObject jso, AbstractUser u, Room room)
          Delete a message from the user's mailbox
static void do_doff(org.json.JSONObject jso, AbstractUser u, Room room)
           JSON object contains "type" = either "clothes" or "pivitz".
static void do_endEvent(org.json.JSONObject jso, AbstractUser u, Room room)
           This method terminates an event (probably a minigame, but possibly a fountain) which was initiated by startEvent.
static void do_getMailInBox(org.json.JSONObject jso, AbstractUser u, Room room)
           Get the contents of the user's inbox as mail envelopes.
static void do_getMailMessage(org.json.JSONObject jso, AbstractUser u, Room room)
           Get a message out of the user's mailbox
static void do_getMedalRankings(org.json.JSONObject jso, AbstractUser u, Room room)
          Deprecated. 
static void do_getPassport(org.json.JSONObject jso, AbstractUser u, Room room)
          Get the list of places that the user has already been to.
static void do_getShopItems(org.json.JSONObject jso, AbstractUser u, Room room)
          replies as per do_getStoreItems(JSONObject, AbstractUser, Room) , but gives also "order" with the order of the categories/shelves/stores in the shop
static void do_getStoreItems(org.json.JSONObject jso, AbstractUser u, Room room)
          Get the information about items found in a logical store (or store-category / shelf)
static void do_markMailMessageAsRead(org.json.JSONObject jso, AbstractUser u, Room room)
          WRITEME: document this method (brpocock@star-hope.org, Aug 28, 2009)
static void do_sendMailMessage(org.json.JSONObject jso, AbstractUser u, Room room)
          Send an in-game eMail message
static void do_stampPassport(org.json.JSONObject jso, AbstractUser u, Room room)
          Deprecated. 
static String getRev()
          Get the revision level of this file
static void op_addtokicklist(String[] words, AbstractUser u, Room room)
          Add a regular expression pattern to the list of patterns which will cause a user to be immediately kicked out of the game for a period of time.
static void op_addtowarnlist(String[] words, AbstractUser u, Room room)
          Add a regular expression pattern to the list of patterns which cannot be spoken in the game world.
static void op_addtowhitelist(String[] words, AbstractUser u, Room room)
          Add a regular expression pattern to the set of regular expressions which are whitelisted against being blocked in speech.
static void op_checklists(String[] words, AbstractUser u, Room room)
          Return an administrative message with the number of regular expression patterns found on the warnings list, kick list, and whitelist.
static void op_givenuts(String[] words, AbstractUser u, Room room)
          Give (or take) peanuts to (from) a named user
static void op_killegg(String[] words, AbstractUser u, Room room)
          Remove the KaTootel egg Super Toot Bot from the game
static void op_layegg(String[] words, AbstractUser u, Room room)
          Deprecated. 
static void op_scores(String[] words, AbstractUser u, Room room)
          get scores for a game for Ricky's High Score Contest.
static void op_setmovie(String[] words, AbstractUser u, Room room)
          Set the movie in the Theatre to the correct (latest) movie, immediately.
static void op_zagame(String[] words, AbstractUser u, Room room)
           Send a command into the operator command interpreter for a running game (if that game provides one)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtensionCommands

public ExtensionCommands()
Method Detail

do_addJournalEntry

@Deprecated
public static void do_addJournalEntry(org.json.JSONObject jso,
                                                 AbstractUser u,
                                                 Room room)
                               throws org.json.JSONException,
                                      PrivilegeRequiredException
Deprecated. 

This command has never been implemented and simply returns an error of "not-implemented"

Add a staff journal entry.

Staff members can create a journal entry which is stored for review in a customer service application such as Joshua. Creating a ModeratorJournal object will parse for certain values such as [@username].

Parameters:
jso - { "entry": TEXT }
u - Operator making journal entry
room - unused
Throws:
org.json.JSONException - WRITEME twheys@gmail.com
PrivilegeRequiredException - if the user attempting to add a journal entry isn't a staff member

do_createUserHouse

public static void do_createUserHouse(org.json.JSONObject jso,
                                      AbstractUser u,
                                      Room room)
                               throws org.json.JSONException

Response from the first run screen for the user's house

Either create the user's house and lot, or add a room to their house.

Parameters:
jso - Data describing the user's lot { lot: lot-ID, house: house-ID }, or adding a room, { index: roomIndex }
u - The user buying the lot
room - The room in which the user is found — for communications purposes, at least.
Throws:
org.json.JSONException - Thrown if the data cannot be interpreted from the JSON objects passed in, or conversely, if we can't encode a response into a JSON form

do_deleteMailMessage

public static void do_deleteMailMessage(org.json.JSONObject jso,
                                        AbstractUser u,
                                        Room room)
                                 throws org.json.JSONException
Delete a message from the user's mailbox

Parameters:
jso - { "id": MESSAGE-ID }
u - user deleting the message
room - room in which the user is standing
Throws:
org.json.JSONException - Thrown if the data cannot be interpreted from the JSON objects passed in, or conversely, if we can't encode a response into a JSON form

do_doff

public static void do_doff(org.json.JSONObject jso,
                           AbstractUser u,
                           Room room)
                    throws org.json.JSONException

JSON object contains "type" = either "clothes" or "pivitz". Does not affect patterns.

Response with total avatar info from "wardrobe"

Parameters:
jso - { "type": "pivitz" } or { "type": "clothes" } or { "slot": SLOT-NUMBER }
u - The user calling this method
room - The room in which this user is standing
Throws:
org.json.JSONException - Thrown if the data cannot be interpreted from the JSON objects passed in, or conversely, if we can't encode a response into a JSON form

do_endEvent

public static void do_endEvent(org.json.JSONObject jso,
                               AbstractUser u,
                               Room room)
                        throws org.json.JSONException

This method terminates an event (probably a minigame, but possibly a fountain) which was initiated by startEvent.

For fountains, the score is ignored, and a random number from 1..100 is used as the effective score. Since fountains (should) have a 1:1 points:peanuts ratio, this will earn the player 1..100 peanuts randomly per fountain visit.

Response: JSON sent to user: { ended: event ID; peanuts: number of peanuts earned; highScores: array of scores, indexed by position on the high score list (1..24), each of which contains: { points: number of points scored by the high-scoring user; userName: the name of the user }, totalPeanuts: user's new total peanut balance }

Additionally, if this user earned a high score on this event, s/he will get the attribute in the top level of the response as "gotHighScore": with the value being the position number which was earned. For example, earning no high score omits the "gotHighScore" attribute altogether; earning the third highest score will return instead "gotHighScore" == 3.

Parameters:
jso - JSON parameters. { moniker = the event's moniker; id = the event ID to be ended; score = the earned score, in points (not peanuts); status = one of "cxl" to cancel an event (in which case, score should be 0), or "cmp" to complete an event (score may be zero or more). }
u - The calling user
room - The room in which the user is found (for replies)
Throws:
org.json.JSONException - if something nasty happens

do_getMailInBox

public static void do_getMailInBox(org.json.JSONObject jso,
                                   AbstractUser u,
                                   Room room)
                            throws org.json.JSONException

Get the contents of the user's inbox as mail envelopes. Message bodies are not returned.

Response: mail: { 0: { id: number, from: userName, to: userName, subject: "", sentTime: date & time string, readTime: date & time string, body: "" }, ... }

“limit” defaults to 100 messages

Parameters:
jso - { } for all messages; { from: X limit: Y } for a subset
u - the user requesting the inbox contents
room - the room in which the user is standing. Not particularly important.
Throws:
org.json.JSONException - Thrown if the data cannot be interpreted from the JSON objects passed in, or conversely, if we can't encode a response into a JSON form

do_getMailMessage

public static void do_getMailMessage(org.json.JSONObject jso,
                                     AbstractUser u,
                                     Room room)
                              throws NotFoundException,
                                     org.json.JSONException

Get a message out of the user's mailbox

Response: message: { id: number, from: userName , to: userName, subject: "", sentTime: date & time string , readTime: date & time string, body: "" }

Parameters:
jso - { id: mailboxID }
u - user invoking the command (whose mailbox to check)
room - room in which the user is standing at the time
Throws:
org.json.JSONException - Thrown if the data cannot be interpreted from the JSON objects passed in, or conversely, if we can't encode a response into a JSON form
NotFoundException - WRITEME

do_getMedalRankings

@Deprecated
public static void do_getMedalRankings(org.json.JSONObject jso,
                                                  AbstractUser u,
                                                  Room room)
                                throws org.json.JSONException,
                                       NotFoundException,
                                       SQLException
Deprecated. 

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

This is a deprecated method that used to be needed for Tootlympics. It should no longer be called and will be removed.

returns ranks {1: {name:"name", gold:int, silver:int, bronze:int} ...}

Parameters:
jso - { count=10, type=tootlympics }
u - the user requesting the results
room - the room in which the user is standing
Throws:
org.json.JSONException - Thrown if the data cannot be interpreted from the JSON objects passed in, or conversely, if we can't encode a response into a JSON form
NotFoundException - WRITEME
SQLException - WRITEME

do_getPassport

public static void do_getPassport(org.json.JSONObject jso,
                                  AbstractUser u,
                                  Room room)
                           throws org.json.JSONException,
                                  SQLException
Get the list of places that the user has already been to. Replies with { "passport": ... } from User.getPassport_JSON()

Parameters:
jso - unused
u - user asking for their passport
room - room in which the user is standing
Throws:
org.json.JSONException - Thrown if the data cannot be interpreted from the JSON objects passed in, or conversely, if we can't encode a response into a JSON form
SQLException - WRITEME

do_getShopItems

public static void do_getShopItems(org.json.JSONObject jso,
                                   AbstractUser u,
                                   Room room)
                            throws NumberFormatException,
                                   org.json.JSONException
replies as per do_getStoreItems(JSONObject, AbstractUser, Room) , but gives also "order" with the order of the categories/shelves/stores in the shop

Parameters:
jso - { shop: MONIKER }
u - the user asking
room - user's room
Throws:
org.json.JSONException - if bad things happen
NumberFormatException - if bad things happen

do_getStoreItems

public static void do_getStoreItems(org.json.JSONObject jso,
                                    AbstractUser u,
                                    Room room)
                             throws NumberFormatException,
                                    org.json.JSONException
Get the information about items found in a logical store (or store-category / shelf)

Results: totalPeanuts (XXX Tootsville®-specific), stores...

Parameters:
jso - An array of store ID's for which you want to get the items. The keys are ignored: typically, they'll be ascending numbers, but that can be any unique values, which will be discarded. The value of each key must be the integer store (category) ID number.
u - The user requesting the information. XXX Special case: if the user is a Toot, gives back the totalPeanuts of the user
room - The room in which the user is standing. Ignored.
Throws:
NumberFormatException - If a store ID is not a valid integer
org.json.JSONException - Thrown if the data cannot be interpreted from the JSON objects passed in, or conversely, if we can't encode a response into a JSON form

do_markMailMessageAsRead

public static void do_markMailMessageAsRead(org.json.JSONObject jso,
                                            AbstractUser u,
                                            Room room)
                                     throws NumberFormatException,
                                            org.json.JSONException,
                                            NotFoundException
WRITEME: document this method (brpocock@star-hope.org, Aug 28, 2009)

Parameters:
jso - { id: message ID # }
u - WRITEME
room - WRITEME
Throws:
org.json.JSONException - Thrown if the data cannot be interpreted from the JSON objects passed in, or conversely, if we can't encode a response into a JSON form
NumberFormatException - WRITEME
NotFoundException - WRITEME

do_sendMailMessage

public static void do_sendMailMessage(org.json.JSONObject jso,
                                      AbstractUser u,
                                      Room room)
                               throws org.json.JSONException
Send an in-game eMail message

Parameters:
jso - { to: USERNAME, subject: "...", body: "..." }
u - user sending mail message
room - room user is in
Throws:
org.json.JSONException - Thrown if the data cannot be interpreted from the JSON objects passed in, or conversely, if we can't encode a response into a JSON form

do_stampPassport

@Deprecated
public static void do_stampPassport(org.json.JSONObject jso,
                                               AbstractUser u,
                                               Room room)
                             throws org.json.JSONException,
                                    SQLException
Deprecated. 

stamp the user's passport ...

Parameters:
jso - { room: (MONIKER) }
u - user having passport stamped
room - room they're in now
Throws:
org.json.JSONException - Thrown if the data cannot be interpreted from the JSON objects passed in, or conversely, if we can't encode a response into a JSON form
SQLException - if it can't be saved

getRev

public static String getRev()
Get the revision level of this file

Returns:
the Subversion revision level of this file

op_addtokicklist

public static void op_addtokicklist(String[] words,
                                    AbstractUser u,
                                    Room room)
Add a regular expression pattern to the list of patterns which will cause a user to be immediately kicked out of the game for a period of time. This is known as the “red list.” Requires Designer level of staff privileges.

Parameters:
words - The command parameters (whitespace-delimited list) provided after the # command name
u - The user invoking the operator command
room - The room in which the user is standing (as a room number). This can be -1 under certain circumstances.

op_addtowarnlist

public static void op_addtowarnlist(String[] words,
                                    AbstractUser u,
                                    Room room)
Add a regular expression pattern to the list of patterns which cannot be spoken in the game world. These messages will send the “oops” emote to the user speaking them. This is known as the “blacklist.” Requires Designer level of staff privileges.

Parameters:
words - The command parameters (whitespace-delimited list) provided after the # command name
u - The user invoking the operator command
room - The room in which the user is standing (as a room number). This can be -1 under certain circumstances.

op_addtowhitelist

public static void op_addtowhitelist(String[] words,
                                     AbstractUser u,
                                     Room room)
Add a regular expression pattern to the set of regular expressions which are whitelisted against being blocked in speech. These patterns are explicitly permitted and are not affected by the warnings list (blacklist) or kick list (red list). Requires Designer level of staff privileges.

Parameters:
words - The command parameters (whitespace-delimited list) provided after the # command name
u - The user invoking the operator command
room - The room in which the user is standing (as a room number). This can be -1 under certain circumstances.

op_checklists

public static void op_checklists(String[] words,
                                 AbstractUser u,
                                 Room room)
Return an administrative message with the number of regular expression patterns found on the warnings list, kick list, and whitelist.

Parameters:
words - The command parameters (whitespace-delimited list) provided after the # command name
u - The user invoking the operator command
room - The room in which the user is standing (as a room number). This can be -1 under certain circumstances.

op_givenuts

public static void op_givenuts(String[] words,
                               AbstractUser u,
                               Room room)
Give (or take) peanuts to (from) a named user

Parameters:
words - The command parameters (whitespace-delimited list) provided after the # command name
u - The user invoking the operator command
room - The room in which the user is standing (as a room number). This can be -1 under certain circumstances.

op_killegg

public static void op_killegg(String[] words,
                              AbstractUser u,
                              Room room)
Remove the KaTootel egg Super Toot Bot from the game

Parameters:
words - The command parameters (whitespace-delimited list) provided after the # command name
u - The user invoking the operator command
room - The room in which the user is standing (as a room number). This can be -1 under certain circumstances.

op_layegg

@Deprecated
public static void op_layegg(String[] words,
                                        AbstractUser u,
                                        Room room)
Deprecated. 

temporarily set the Super Toot Bot “egg” at the player's current coördinates. This will be broken by virtual of Super Toot Bot removal in an upcoming release.

Parameters:
words - The command parameters (whitespace-delimited list) provided after the # command name
u - The user invoking the operator command
room - The room in which the user is standing (as a room number). This can be -1 under certain circumstances.

op_scores

public static void op_scores(String[] words,
                             AbstractUser u,
                             Room room)
get scores for a game for Ricky's High Score Contest.

Parameters:
words - The command parameters (whitespace-delimited list) provided after the # command name
u - The user invoking the operator command
room - The room in which the user is standing (as a room number). This can be -1 under certain circumstances.

op_setmovie

public static void op_setmovie(String[] words,
                               AbstractUser u,
                               Room room)
Set the movie in the Theatre to the correct (latest) movie, immediately.

Parameters:
words - ignored
u - operator account
room - any room in the zone in which the theatre should be updated

op_zagame

public static void op_zagame(String[] words,
                             AbstractUser u,
                             Room room)

Send a command into the operator command interpreter for a running game (if that game provides one)

Usage: #game gameIdentifier (strings...)

Special-cased for Zap Attack

See OpCommands.op_game(java.lang.String[], org.starhope.appius.user.AbstractUser, org.starhope.appius.game.Room)

Parameters:
words - The command parameters (whitespace-delimited list) provided after the # command name
u - The user invoking the operator command
room - The room in which the user is standing (as a room number). This can be -1 under certain circumstances.