com.tootsville.npc
Class DinerDiner

java.lang.Object
  extended by org.starhope.appius.user.GeneralUser
      extended by org.starhope.appius.user.AbstractNonPlayerCharacter
          extended by com.tootsville.npc.DinerDiner
All Implemented Interfaces:
Comparable<AbstractUser>, RoomListener, AbstractUser, DataRecordBacked<UserRecord>, AcceptsMetronomeTicks, HasName

public class DinerDiner
extends AbstractNonPlayerCharacter

A diner at the diner.

Author:
brpocock@star-hope.org
See Also:
ShortOrderCook

Nested Class Summary
protected static class DinerDiner.State
          The state of the diner's sequence of actions
 
Field Summary
private  double happiness
          How happy is the customer? Expressed as a tip rate.
private static AtomicInteger nextID
           Provide an unique ID counter for multiple instances of the same cook character in different Zones at the same time.
private  DinerDiner.State state
          State, see DinerDiner.State
private  String wantFood
          Food they want
 
Fields inherited from class org.starhope.appius.user.AbstractNonPlayerCharacter
instanceID, myRoom
 
Fields inherited from class org.starhope.appius.user.GeneralUser
userRecord
 
Constructor Summary
DinerDiner()
          WRITEME: Document this constructor brpocock@star-hope.org
 
Method Summary
 void acceptObjectJoinRoom(AbstractRoom room, RoomListener object)
          Notification that someone has entered the room.
 void acceptObjectPartRoom(AbstractRoom room, RoomListener thing)
          Notification that someone has left a room
 void acceptOutOfBandMessage(AbstractUser sender, AbstractRoom room, org.json.JSONObject body)
          Accept an out-of-band communications packet that was broadcast to a room in which this Listener is listening.
 void acceptPublicMessage(AbstractUser sender, AbstractRoom room, String message)
          Accept a public chat message or /emote.
 void acceptPublicMessage(AbstractUser from, String message)
          Accept a public chat message.
 void acceptUserVariableUpdate(AbstractUser user, String varName, String varValue)
          Receive notification of the change of an user variable
 void ban(AbstractUser u, String banReason)
           
 double getHappiness()
           
protected  int getInstanceID()
           
 DinerDiner.State getState()
           
 String getWantFood()
           
 void sendEarnings(AbstractRoom room, String string)
           
 void sendMigrate(AbstractZone refugeeZone)
          WRITEME: document this method (brpocock@star-hope.org, Jan 11, 2010)
 void sendUserLists()
          Sends the user an asynchronous notification of their user lists' status.
 void sendWardrobe()
          WRITEME
 void setHappiness(double newHappiness)
           
 void setState(DinerDiner.State newState)
           
 void setWantFood(String wantFoodNow)
           
 void tick(long currentTime, long deltaTime)
          This method is called periodically from the metronome thread.
 
Methods inherited from class org.starhope.appius.user.AbstractNonPlayerCharacter
acceptErrorReply, acceptGameAction, acceptGameStateChange, acceptMessage, acceptPrivateMessage, acceptSuccessReply, addBuddy, addGiftSubscription, addItem, assertLocationUnlocked, assertStaffLevel, attend, canTalk, compareTo, destroy, doffClothes, doTransport, getAge, getAgeGroup, getApprovedDateString, getAvatarClass, getAvatarLabel, getBaseColor, getBuddyListNames, getCurrentAction, getDebugName, getInventory, getIPAddress, getKickedMessage, getLag, getLanguage, getLocation, getLocationForUpdate, getMail, getMoney, getName, getNameApprovedAt, getNameRequestedAt, getPublicInfo, getRegisteredDateString, getResponsibleMail, getRoom, getRoomNumber, getServerThread, getStaffLevel, getStartT, getTarget, getTravelRate, getTravelStart, getUserID, getUserVariables, getVariable, getWallet, getZone, hasStaffLevel, hasVariable, ignore, isBanned, isCanceled, isKicked, isNPC, isOnline, isPaidMember, kick, liftBan, needsParent, removeBuddy, reportedToModeratorBy, reportedToModeratorBy, sendOops, sendResponse, setCurrentAction, setExtraColor, setFacing, setLastActive, setLocation, setMail, setParent, setRoom, setStartT, setTarget, setTravelRate, setTravelStart, setVariable, speak, toJSON, toSFSXML, unlockLocation
 
Methods inherited from class org.starhope.appius.user.GeneralUser
getDialect, getDisplayName, getExtraColor, getFacing, getKickedByUserID, getKickedReasonCode, getKickedUntil, setAgeGroupToSystem, setBaseColor, setCanTalk
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

happiness

private double happiness
How happy is the customer? Expressed as a tip rate. Begins at 18% and can vary from 5%, up. If it drops below 5%, they'll just walk out.


wantFood

private String wantFood
Food they want


state

private DinerDiner.State state
State, see DinerDiner.State


nextID

private static AtomicInteger nextID

Provide an unique ID counter for multiple instances of the same cook character in different Zones at the same time.

Constructor Detail

DinerDiner

public DinerDiner()
           throws NotFoundException,
                  GameLogicException
WRITEME: Document this constructor brpocock@star-hope.org

Throws:
GameLogicException - WRITEME
NotFoundException - WRITEME
Method Detail

acceptObjectJoinRoom

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

Parameters:
room - The room
object - The thing (probably user) entering
See Also:
RoomListener.acceptObjectJoinRoom(org.starhope.appius.game.AbstractRoom, org.starhope.appius.game.RoomListener)

acceptObjectPartRoom

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

Parameters:
room - The room
thing - The thing (probably user) departing
See Also:
RoomListener.acceptObjectPartRoom(org.starhope.appius.game.AbstractRoom, org.starhope.appius.game.RoomListener)

acceptOutOfBandMessage

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

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

acceptPublicMessage

public void acceptPublicMessage(AbstractUser sender,
                                AbstractRoom room,
                                String message)
Description copied from interface: RoomListener
Accept a public chat message or /emote.

Specified by:
acceptPublicMessage in interface RoomListener
Overrides:
acceptPublicMessage in class AbstractNonPlayerCharacter
Parameters:
sender - The speaker
room - The room in which the words were spoken
message - The spoken text or /emote
See Also:
RoomListener.acceptPublicMessage(org.starhope.appius.user.AbstractUser, org.starhope.appius.game.AbstractRoom, java.lang.String)

acceptPublicMessage

public void acceptPublicMessage(AbstractUser from,
                                String message)
Description copied from interface: RoomListener
Accept a public chat message. This prototype does not specify the room, on the (potentially invalid) assumption that the room listener doesn't care from which room the speech was made.

Specified by:
acceptPublicMessage in interface RoomListener
Overrides:
acceptPublicMessage in class AbstractNonPlayerCharacter
Parameters:
from - The speaker
message - The spoken text or /emote
See Also:
RoomListener.acceptPublicMessage(org.starhope.appius.user.AbstractUser, java.lang.String)

acceptUserVariableUpdate

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

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

ban

public void ban(AbstractUser u,
                String banReason)
         throws PrivilegeRequiredException
Parameters:
u - WRITEME
banReason - WRITEME
Throws:
PrivilegeRequiredException - WRITEME
See Also:
AbstractUser.ban(org.starhope.appius.user.AbstractUser, java.lang.String)

getHappiness

public double getHappiness()
Returns:
the happiness

getInstanceID

protected int getInstanceID()
Specified by:
getInstanceID in class AbstractNonPlayerCharacter
Returns:
An unique ID for this instance of
See Also:
AbstractNonPlayerCharacter.getInstanceID()

getState

public DinerDiner.State getState()
Returns:
the state

getWantFood

public String getWantFood()
Returns:
the wantFood

sendEarnings

public void sendEarnings(AbstractRoom room,
                         String string)
Parameters:
room - WRITEME
string - WRITEME
See Also:
AbstractUser.sendEarnings(org.starhope.appius.game.AbstractRoom, java.lang.String)

sendMigrate

public void sendMigrate(AbstractZone refugeeZone)
                 throws UserDeadException
Description copied from interface: AbstractUser
WRITEME: document this method (brpocock@star-hope.org, Jan 11, 2010)

Parameters:
refugeeZone - WRITEME
Throws:
UserDeadException - WRITEME
See Also:
AbstractUser.sendMigrate(org.starhope.appius.types.AbstractZone)

sendUserLists

public void sendUserLists()
Description copied from interface: AbstractUser
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.)

See Also:
AbstractUser.sendUserLists()

sendWardrobe

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

See Also:
AbstractUser.sendWardrobe()

setHappiness

public void setHappiness(double newHappiness)
Parameters:
newHappiness - the happiness to set

setState

public void setState(DinerDiner.State newState)
Parameters:
newState - the state to set

setWantFood

public void setWantFood(String wantFoodNow)
Parameters:
wantFoodNow - the wantFood to set

tick

public void tick(long currentTime,
                 long deltaTime)
          throws UserDeadException
Description copied from interface: AcceptsMetronomeTicks
This method is called periodically from the metronome thread. To save computation, it receives both the current time since epoch in milliseconds at the start of the global tick propagation, and the delta time since the previous metronome tick.

Parameters:
currentTime - Time since epoch at the start of the global metronome propagation, as per System.currentTimeMillis()
deltaTime - Delta-time in milliseconds since the prior global metronome tick
Throws:
UserDeadException - if a user has died during this tick
See Also:
AcceptsMetronomeTicks.tick(long, long)