|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.starhope.appius.user.GeneralUser
org.starhope.appius.user.AbstractNonPlayerCharacter
org.starhope.appius.game.npc.ChatterBot
public class ChatterBot
A ChatterBot mostly just wanders about and talks to players. They're instanced into each zone, though.
For purposes of Tootsvilleâ„¢ backward-compatibility, ChatterBots can be programmed with a SuperTootBot record. They still need a backing user account, however, which SuperTootBots did not check against.
For future ChatterBots, using a ConversationTree is recommended.
| Field Summary | |
|---|---|
private Deque<Goal> |
alternateGoal
Alternate goals for the character |
String[] |
casualSpeechRingBuffer
A ring buffer for casual comments that can be used to fill time. |
int |
casualSpeechRingPointer
A pointer into the casual speech ring buffer. |
private double |
happiness
How happy is the customer? Expressed as a tip rate. |
private long |
lastCasualSpeech
The last time at which some casual chatter was emitted |
private long |
lastMovement
last time moved |
private long |
lastSpoken
The last time at which the NPC spoke (at all) |
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 Goal |
primaryGoal
State, see Goal |
private Deque<String> |
toBeSpoken
Things which need to be said (but we're pretending to be typing and giving people time to read, so they're not just being dumped down the pipeline) |
private ConversationTree |
tree
tree of actions to undertake |
private String |
wantFood
Food they want |
| Fields inherited from class org.starhope.appius.user.AbstractNonPlayerCharacter |
|---|
buddyList, casualSpeechQueue, casualSpeechRate, instanceID, kalendor, lastActive |
| Fields inherited from class org.starhope.appius.user.GeneralUser |
|---|
collisionBounds, currentRoom, facing, lastUserMovement, userRecord |
| Constructor Summary | |
|---|---|
ChatterBot(ConversationTree newTree)
WRITEME: Document this constructor brpocock@star-hope.org |
|
ChatterBot(Room newRoom,
org.json.JSONObject superTootBot)
WRITEME: Document this constructor brpocock@star-hope.org |
|
| Method Summary | |
|---|---|
void |
acceptMessage(String title,
String label,
String content)
Accept an administrative/moderator message with the full range of options. |
void |
acceptObjectJoinRoom(Room whichRoom,
RoomListener object)
Notification that someone has entered the room. |
void |
acceptObjectPartRoom(Room inRoom,
RoomListener thing)
Notification that someone has left a room |
void |
acceptOutOfBandMessage(AbstractUser sender,
Room inRoom,
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,
Room inRoom,
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()
|
Goal |
getState()
|
String |
getWantFood()
|
private void |
goalCompleted()
call this routine to pick a new goal |
void |
sendEarnings(Room roomEarnedIn,
String string)
|
void |
sendMigrate(AbstractZone refugeeZone)
WRITEME: document this method (brpocock@star-hope.org, Jan 11, 2010) |
void |
sendWardrobe()
WRITEME |
void |
setHappiness(double newHappiness)
|
void |
setState(Goal newState)
|
void |
setWantFood(String wantFoodNow)
|
void |
speakCasually(String phrase)
Say something, when there's time, if we get time. |
void |
tick(long currentTime,
long deltaTime)
This method is called periodically from the metronome thread. |
int |
timeToSpeak(String speech)
WRITEME: Document this method brpocock@star-hope.org |
| Methods inherited from class org.starhope.appius.user.AbstractNonPlayerCharacter |
|---|
acceptErrorReply, acceptGameAction, acceptGameStateChange, acceptPrivateMessage, acceptSuccessReply, acceptUserList, addBuddy, addGiftSubscription, addItem, canTalk, destroy, doTransport, equals, getAvatarClass, getAvatarLabel, getBaseColor, getBuddyListNames, getDebugName, getGreeting, getIPAddress, getKickedMessage, getLag, getLanguage, getLocation, getMail, getName, getNameApprovedAt, getNameRequestedAt, getNameStripped, getPublicInfo_new, getServerThread, hashCode, inviteBuddy, isBuddy, isNPC, isOnline, kick, liftBan, needsParent, reportedToModeratorBy, reportedToModeratorBy, sendOops, sendResponse, setLastActive, setMail, setParent, speak, toJSON, toSFSXML, toString, whenAtTarget |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
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 final Deque<Goal> alternateGoal
public final String[] casualSpeechRingBuffer
public int casualSpeechRingPointer
private double happiness
private long lastCasualSpeech
private long lastMovement
private long lastSpoken
private Goal primaryGoal
Goal
private final Deque<String> toBeSpoken
private final ConversationTree tree
private String wantFood
| Constructor Detail |
|---|
public ChatterBot(ConversationTree newTree)
throws GameLogicException
newTree - WRITEME
GameLogicException - WRITEME
public ChatterBot(Room newRoom,
org.json.JSONObject superTootBot)
throws NotFoundException,
GameLogicException,
org.json.JSONException
newRoom - WRITEMEsuperTootBot - WRITEME
NotFoundException - WRITEME
GameLogicException - WRITEME
org.json.JSONException - WRITEME| Method Detail |
|---|
public void acceptMessage(String title,
String label,
String content)
AbstractUser
acceptMessage in interface AbstractUseracceptMessage in class AbstractNonPlayerCharactertitle - The title of the messagelabel - A label which nominally identifies the source of the
messagecontent - The contents of the messageAbstractUser.acceptMessage(java.lang.String,
java.lang.String, java.lang.String)
public void acceptObjectJoinRoom(Room whichRoom,
RoomListener object)
RoomListener
acceptObjectJoinRoom in interface RoomListeneracceptObjectJoinRoom in class GeneralUserwhichRoom - The roomobject - The thing (probably user) enteringRoomListener.acceptObjectJoinRoom(org.starhope.appius.game.Room,
org.starhope.appius.game.RoomListener)
public void acceptObjectPartRoom(Room inRoom,
RoomListener thing)
RoomListener
acceptObjectPartRoom in interface RoomListeneracceptObjectPartRoom in class GeneralUserinRoom - The roomthing - The thing (probably user) departingRoomListener.acceptObjectPartRoom(org.starhope.appius.game.Room,
org.starhope.appius.game.RoomListener)
public void acceptOutOfBandMessage(AbstractUser sender,
Room inRoom,
org.json.JSONObject body)
RoomListener
acceptOutOfBandMessage in interface RoomListeneracceptOutOfBandMessage in class GeneralUsersender - The sender of the OOB messageinRoom - The room in which the OOB message is being broadcastbody - A JSON object containing the OOB message. The
contents of this message are not constrained.RoomListener.acceptOutOfBandMessage(org.starhope.appius.user.AbstractUser,
org.starhope.appius.game.Room, org.json.JSONObject)
public void acceptPublicMessage(AbstractUser sender,
Room inRoom,
String message)
RoomListener
acceptPublicMessage in interface RoomListeneracceptPublicMessage in class AbstractNonPlayerCharactersender - The speakerinRoom - The room in which the words were spokenmessage - The spoken text or /emoteRoomListener.acceptPublicMessage(org.starhope.appius.user.AbstractUser,
org.starhope.appius.game.Room, java.lang.String)
public void acceptPublicMessage(AbstractUser from,
String message)
RoomListener
acceptPublicMessage in interface RoomListeneracceptPublicMessage in class AbstractNonPlayerCharacterfrom - The speakermessage - The spoken text or /emoteRoomListener.acceptPublicMessage(org.starhope.appius.user.AbstractUser,
java.lang.String)
public void acceptUserVariableUpdate(AbstractUser user,
String varName,
String varValue)
RoomListener
acceptUserVariableUpdate in interface RoomListeneracceptUserVariableUpdate in class GeneralUseruser - The user updating their variablevarName - The name of the variable (key)varValue - The new value (null if unset)RoomListener.acceptUserVariableUpdate(org.starhope.appius.user.AbstractUser,
java.lang.String, java.lang.String)
public void ban(AbstractUser u,
String banReason)
throws PrivilegeRequiredException
u - WRITEMEbanReason - WRITEME
PrivilegeRequiredException - WRITEMEAbstractUser.ban(org.starhope.appius.user.AbstractUser,
java.lang.String)public double getHappiness()
protected int getInstanceID()
getInstanceID in class AbstractNonPlayerCharacterAbstractNonPlayerCharacter.getInstanceID()public Goal getState()
public String getWantFood()
private void goalCompleted()
public void sendEarnings(Room roomEarnedIn,
String string)
sendEarnings in interface AbstractUsersendEarnings in class GeneralUserroomEarnedIn - WRITEMEstring - WRITEMEAbstractUser.sendEarnings(org.starhope.appius.game.Room,
java.lang.String)
public void sendMigrate(AbstractZone refugeeZone)
throws UserDeadException
AbstractUser
sendMigrate in interface AbstractUsersendMigrate in class AbstractNonPlayerCharacterrefugeeZone - WRITEME
UserDeadException - WRITEMEAbstractUser.sendMigrate(org.starhope.appius.types.AbstractZone)public void sendWardrobe()
AbstractUser
sendWardrobe in interface AbstractUsersendWardrobe in class GeneralUserAbstractUser.sendWardrobe()public void setHappiness(double newHappiness)
newHappiness - the happiness to setpublic void setState(Goal newState)
newState - the state to setpublic void setWantFood(String wantFoodNow)
wantFoodNow - the wantFood to setpublic void speakCasually(String phrase)
speakCasually in class AbstractNonPlayerCharacterphrase - a phrase to be casually spoken at some
indeterminate time in the future
public void tick(long currentTime,
long deltaTime)
throws UserDeadException
AcceptsMetronomeTicks
tick in interface AcceptsMetronomeTickstick in class AbstractNonPlayerCharactercurrentTime - 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
UserDeadException - if a user has died during this tickAcceptsMetronomeTicks.tick(long,
long)public int timeToSpeak(String speech)
speech - WRITEME
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||