|
||||||||||
| 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.plebeian.Plebeian
public class Plebeian
The Plebeian class is a base class for simply scripted NPC:s using the Plebeian structure, which is meant to be a fairly understandable scripting language for basic state machine representation.
TODO: document secret Plebeian script language!
Note that there are probably significant problems with the implementation of simultaneous steps in a plebian script. For now, all scripts should use only the sequential keywords (e.g. "then" or "&" between steps). I haven't had time to resolve the issues involved in correctly handling simultaneous steps just yet — they might potentially “blow up” the script interpreter system.
| Field Summary | |
|---|---|
private static AtomicInteger |
instanceCounter
unique instance ID generator |
(package private) PlebeianScriptRunner |
scriptRunner
script runner object |
private static long |
serialVersionUID
Java serialisation unique ID |
| Fields inherited from class org.starhope.appius.user.AbstractNonPlayerCharacter |
|---|
buddyList, casualSpeechQueue, casualSpeechRate, instanceID, kalendor, lastActive, lastSpoken |
| Fields inherited from class org.starhope.appius.user.GeneralUser |
|---|
baseStats, collisionBounds, currentRoom, facing, lastUserMovement, pathFinder, userRecord |
| Constructor Summary | |
|---|---|
Plebeian(Zone z,
String login)
WRITEME: Document this constructor brpocock@star-hope.org |
|
| Method Summary | |
|---|---|
void |
acceptErrorReply(String command,
String error,
org.json.JSONObject result,
Room userCurrentRoomInZone)
|
void |
acceptGameAction(AbstractUser u,
org.json.JSONObject action)
Broadcast message of a game action taking place |
void |
acceptGameStateChange(GameEvent gameCode,
GameStateFlag gameState)
Notification of a GameEvent changing state for the room |
void |
acceptMessage(String title,
String label,
String content)
Accept an administrative/moderator message with the full range of options. |
void |
acceptObjectJoinRoom(Room room,
RoomListener object)
Notification that someone has entered the room. |
void |
acceptObjectPartRoom(Room room,
RoomListener thing)
Notification that someone has left a room |
void |
acceptOutOfBandMessage(AbstractUser sender,
Room 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 |
acceptPrivateMessage(AbstractUser speaker,
String speech)
Accept a private message from another user (a whisper) |
void |
acceptPublicMessage(AbstractUser sender,
Room room,
String message)
Accept a public chat message or /emote. |
void |
acceptPublicMessage(AbstractUser sender,
String message)
Accept a public chat message. |
void |
acceptSuccessReply(String command,
org.json.JSONObject jsonData,
Room room)
|
void |
acceptUserVariableUpdate(AbstractUser user,
String varName,
String varValue)
Receive notification of the change of an user variable |
void |
ban(AbstractUser u,
String banReason)
|
protected int |
getInstanceID()
|
PlebeianScriptRunner |
getScriptRunner()
WRITEME: Document this method brpocock@star-hope.org |
String |
getShortLabel()
WRITEME: Document this method brpocock@star-hope.org |
void |
seekRoom(Room r)
WRITEME: Document this method brpocock@star-hope.org |
void |
tick(long currentTime,
long deltaTime)
This method is called periodically from the metronome thread. |
| Methods inherited from class org.starhope.appius.user.AbstractNonPlayerCharacter |
|---|
acceptUserList, addBuddy, addGiftSubscription, addItem, canTalk, destroy, doTransport, equals, getAccessibleRooms, 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, sendMigrate, sendOops, sendResponse, setLastActive, setMail, setParent, speak, speakCasually, toJSON, toSFSXML, toString, whenAtTarget |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.starhope.appius.game.npc.plebeian.ScriptPuppet |
|---|
isBuddy, speakCasually, whenAtTarget |
| Methods inherited from interface org.starhope.appius.game.RoomListener |
|---|
acceptUserAction, getRoom, getZone |
| Methods inherited from interface java.lang.Comparable |
|---|
compareTo |
| Methods inherited from interface org.starhope.appius.types.HasVariables |
|---|
deleteVariable, getVariables, resetVariables, setVariable, setVariables |
| Methods inherited from interface org.starhope.appius.user.DataRecordBacked |
|---|
setBackingRecord |
| Field Detail |
|---|
private static final AtomicInteger instanceCounter
private static final long serialVersionUID
PlebeianScriptRunner scriptRunner
| Constructor Detail |
|---|
public Plebeian(Zone z,
String login)
throws NotFoundException,
GameLogicException
z - the zone in which to spawnlogin - WRITEME
NotFoundException - WRITEME
GameLogicException - if the character is not an NPC or the
.pleb script is not found| Method Detail |
|---|
public void acceptErrorReply(String command,
String error,
org.json.JSONObject result,
Room userCurrentRoomInZone)
acceptErrorReply in interface AbstractUseracceptErrorReply in class AbstractNonPlayerCharactercommand - The command which produced the errorerror - The error coderesult - The additional JSON data describing the erroruserCurrentRoomInZone - The room in which the user was
standing when the error occurred.AbstractNonPlayerCharacter.acceptErrorReply(java.lang.String,
java.lang.String, org.json.JSONObject,
org.starhope.appius.game.Room)
public void acceptGameAction(AbstractUser u,
org.json.JSONObject action)
RoomListener
acceptGameAction in interface RoomListeneracceptGameAction in class AbstractNonPlayerCharacteru - the senderaction - The game action. The verb is in
action.getString("action").AbstractNonPlayerCharacter.acceptGameAction(org.starhope.appius.user.AbstractUser,
org.json.JSONObject)
public void acceptGameStateChange(GameEvent gameCode,
GameStateFlag gameState)
RoomListener
acceptGameStateChange in interface RoomListeneracceptGameStateChange in class AbstractNonPlayerCharactergameCode - The GameEvent whose state is changinggameState - The new stateAbstractNonPlayerCharacter.acceptGameStateChange(org.starhope.appius.game.GameEvent,
org.starhope.appius.game.GameStateFlag)
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 messageAbstractNonPlayerCharacter.acceptMessage(java.lang.String,
java.lang.String, java.lang.String)
public void acceptObjectJoinRoom(Room room,
RoomListener object)
RoomListener
acceptObjectJoinRoom in interface RoomListeneracceptObjectJoinRoom in class GeneralUserroom - The roomobject - The thing (probably user) enteringGeneralUser.acceptObjectJoinRoom(org.starhope.appius.game.Room,
org.starhope.appius.game.RoomListener)
public void acceptObjectPartRoom(Room room,
RoomListener thing)
RoomListener
acceptObjectPartRoom in interface RoomListeneracceptObjectPartRoom in class GeneralUserroom - The roomthing - The thing (probably user) departingGeneralUser.acceptObjectPartRoom(org.starhope.appius.game.Room,
org.starhope.appius.game.RoomListener)
public void acceptOutOfBandMessage(AbstractUser sender,
Room room,
org.json.JSONObject body)
RoomListener
acceptOutOfBandMessage in interface RoomListeneracceptOutOfBandMessage in class GeneralUsersender - The sender of the OOB messageroom - 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.GeneralUser.acceptOutOfBandMessage(org.starhope.appius.user.AbstractUser,
org.starhope.appius.game.Room, org.json.JSONObject)
public void acceptPrivateMessage(AbstractUser speaker,
String speech)
AbstractUser
acceptPrivateMessage in interface AbstractUseracceptPrivateMessage in class AbstractNonPlayerCharacterspeaker - the person whisperingspeech - what was whisperedAbstractNonPlayerCharacter.acceptPrivateMessage(org.starhope.appius.user.AbstractUser,
java.lang.String)
public void acceptPublicMessage(AbstractUser sender,
Room room,
String message)
RoomListener
acceptPublicMessage in interface RoomListeneracceptPublicMessage in class AbstractNonPlayerCharactersender - The speakerroom - The room in which the words were spokenmessage - The spoken text or /emoteAbstractNonPlayerCharacter.acceptPublicMessage(org.starhope.appius.user.AbstractUser,
org.starhope.appius.game.Room, java.lang.String)
public void acceptPublicMessage(AbstractUser sender,
String message)
RoomListener
acceptPublicMessage in interface RoomListeneracceptPublicMessage in class AbstractNonPlayerCharactersender - The speakermessage - The spoken text or /emoteAbstractNonPlayerCharacter.acceptPublicMessage(org.starhope.appius.user.AbstractUser,
java.lang.String)
public void acceptSuccessReply(String command,
org.json.JSONObject jsonData,
Room room)
acceptSuccessReply in interface AbstractUseracceptSuccessReply in class AbstractNonPlayerCharactercommand - WRITEMEjsonData - WRITEMEroom - WRITEMEAbstractNonPlayerCharacter.acceptSuccessReply(java.lang.String,
org.json.JSONObject, org.starhope.appius.game.Room)
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)GeneralUser.acceptUserVariableUpdate(org.starhope.appius.user.AbstractUser,
java.lang.String, java.lang.String)
public void ban(AbstractUser u,
String banReason)
throws PrivilegeRequiredException
ban in interface AbstractUseru - WRITEMEbanReason - WRITEME
PrivilegeRequiredException - WRITEMEAbstractUser.ban(org.starhope.appius.user.AbstractUser,
java.lang.String)protected int getInstanceID()
getInstanceID in class AbstractNonPlayerCharacterAbstractNonPlayerCharacter.getInstanceID()public PlebeianScriptRunner getScriptRunner()
getScriptRunner in interface ScriptPuppetpublic String getShortLabel()
ScriptPuppet
getShortLabel in interface ScriptPuppetScriptPuppet.getShortLabel()public void seekRoom(Room r)
ScriptPuppet
seekRoom in interface ScriptPuppetScriptPuppet.seekRoom(org.starhope.appius.game.Room)
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 tickAbstractNonPlayerCharacter.tick(long,
long)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||