|
||||||||||
| 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
public abstract class AbstractNonPlayerCharacter
This is the base class from which NPCs are derived.
| Nested Class Summary | |
|---|---|
private class |
AbstractNonPlayerCharacter.RealSpeakRunner
WRITEME: Document this type. |
| Field Summary | |
|---|---|
protected List<String> |
buddyList
WRITEME |
protected Queue<String> |
casualSpeechQueue
a queue of arbitrary things that Harmony might say, if she gets bored. |
protected long |
casualSpeechRate
the rate at which speech is emitted |
private List<String> |
ignoreList
WRITEME |
protected int |
instanceID
WRITEME |
protected Kalendor |
kalendor
Just fetch the Kalendor once, and keep working with it, rather than fucking around with fetching it every time. |
protected long |
lastActive
WRITEME: Document this brpocock@star-hope.org |
protected long |
lastSpoken
Time at which we last spoke |
private static long |
serialVersionUID
Java serialisation unique ID |
| Fields inherited from class org.starhope.appius.user.GeneralUser |
|---|
baseDefenses, baseStats, collisionBounds, currentRoom, facing, lastUserMovement, location, pathFinder, target, travelStartTime, userRecord, userVariables |
| Constructor Summary | |
|---|---|
|
AbstractNonPlayerCharacter(String login)
|
protected |
AbstractNonPlayerCharacter(UserRecord dataRecord)
WRITEME |
| 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 |
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 from,
String message)
Accept a public chat message. |
void |
acceptSuccessReply(String command,
org.json.JSONObject jsonData,
Room room)
|
void |
acceptUserList(String whichList,
List<UserListEntry> users)
WRITEME: Document this method brpocock@star-hope.org |
void |
addBuddy(AbstractUser buddy)
|
void |
addGiftSubscription(int i,
int days)
|
void |
addItem(int itemID)
|
boolean |
canTalk()
|
void |
destroy()
WRITEME |
void |
doTransport()
WRITEME |
boolean |
equals(Object obj)
|
protected Set<String> |
getAccessibleRooms()
Get all rooms currently accessible from the present room, via normal doors. |
AvatarClass |
getAvatarClass()
|
String |
getAvatarLabel()
The avatar label is the text block that is displayed with the avatar for this object. |
Colour |
getBaseColor()
|
Collection<String> |
getBuddyListNames()
WRITEME: document this method (brpocock@star-hope.org, Jan 11, 2010) |
String |
getDebugName()
Get a version of the user's ID and name suitable for use in debugging dumps. |
static String |
getGreeting(String name)
WRITEME brpocock@star-hope.org Jul 21, 2010 |
protected abstract int |
getInstanceID()
|
String |
getIPAddress()
|
String |
getKickedMessage()
|
long |
getLag()
|
String |
getLanguage()
|
Coord3D |
getLocation()
Gets the current start coördinates |
String |
getMail()
|
String |
getName()
Return a user-visible, unique name for this class. |
Date |
getNameApprovedAt()
|
Date |
getNameRequestedAt()
|
static String |
getNameStripped(String name)
|
org.json.JSONObject |
getPublicInfo_new()
|
ServerThread |
getServerThread()
|
int |
hashCode()
|
void |
inviteBuddy(AbstractUser newBuddy)
Ask someone to be my friend |
boolean |
isBuddy(AbstractUser who)
|
boolean |
isNPC()
This is an overriding method. |
boolean |
isOnline()
WRITEME: document this method (brpocock@star-hope.org, Oct 31, 2009) |
void |
kick(AbstractUser u,
String kickReason,
int duration)
|
void |
liftBan(AbstractUser authority)
remove a ban placed upon this user |
boolean |
needsParent()
Kid accounts (under 13) require parental confirmation. |
void |
reportedToModeratorBy(AbstractUser u)
|
void |
reportedToModeratorBy(AbstractUser u,
String reason)
|
void |
sendMigrate(AbstractZone refugeeZone)
WRITEME: document this method (brpocock@star-hope.org, Jan 11, 2010) |
void |
sendOops()
WRITEME |
void |
sendResponse(org.json.JSONObject result)
|
void |
setLastActive()
WRITEME |
void |
setMail(String email)
WRITEME |
void |
setParent(Parent newParent)
If this is a child account (per COPPA), then associate a parent record with it. |
void |
speak(Room room,
String string)
|
void |
speakCasually(String text)
|
void |
tick(long currentTime,
long deltaTime)
This method is called periodically from the metronome thread. |
org.json.JSONObject |
toJSON()
|
String |
toSFSXML()
Deprecated. |
String |
toString()
|
long |
whenAtTarget(Runnable runnable)
Perform some action when the current movement-target position has been reached |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.starhope.appius.user.AbstractUser |
|---|
ban |
| Field Detail |
|---|
private static final long serialVersionUID
protected final Kalendor kalendor
protected final int instanceID
protected long lastActive
protected final List<String> buddyList
private final List<String> ignoreList
protected Queue<String> casualSpeechQueue
protected long lastSpoken
protected long casualSpeechRate
| Constructor Detail |
|---|
public AbstractNonPlayerCharacter(String login)
throws NotFoundException,
GameLogicException
login - the user login of the account for which this NPC
should be instantiated.
NotFoundException - if the user login given doesn't yield a
valid data record
GameLogicException - if the user record isn't an NPC
protected AbstractNonPlayerCharacter(UserRecord dataRecord)
throws GameLogicException
dataRecord - WRITEME
GameLogicException - for hate| Method Detail |
|---|
public static String getGreeting(String name)
name - whom to greet
public static String getNameStripped(String name)
name - any user's name
public void acceptErrorReply(String command,
String error,
org.json.JSONObject result,
Room userCurrentRoomInZone)
acceptErrorReply in interface AbstractUsercommand - 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.AbstractUser.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 RoomListeneru - the senderaction - The game action. The verb is in
action.getString("action").RoomListener.acceptGameAction(org.starhope.appius.user.AbstractUser,
org.json.JSONObject)
public void acceptGameStateChange(GameEvent gameCode,
GameStateFlag gameState)
RoomListener
acceptGameStateChange in interface RoomListenergameCode - The GameEvent whose state is changinggameState - The new stateRoomListener.acceptGameStateChange(org.starhope.appius.game.GameEvent,
org.starhope.appius.game.GameStateFlag)
public void acceptMessage(String title,
String label,
String content)
AbstractUser
acceptMessage in interface AbstractUsertitle - 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 acceptPrivateMessage(AbstractUser speaker,
String speech)
AbstractUser
acceptPrivateMessage in interface AbstractUserspeaker - the person whisperingspeech - what was whisperedAbstractUser.acceptPrivateMessage(org.starhope.appius.user.AbstractUser,
java.lang.String)
public void acceptPublicMessage(AbstractUser sender,
Room room,
String message)
RoomListener
acceptPublicMessage in interface RoomListenersender - The speakerroom - 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 RoomListenerfrom - The speakermessage - The spoken text or /emoteRoomListener.acceptPublicMessage(org.starhope.appius.user.AbstractUser,
java.lang.String)
public void acceptSuccessReply(String command,
org.json.JSONObject jsonData,
Room room)
acceptSuccessReply in interface AbstractUsercommand - WRITEMEjsonData - WRITEMEroom - WRITEMEAbstractUser.acceptSuccessReply(java.lang.String,
org.json.JSONObject, org.starhope.appius.game.Room)
public void acceptUserList(String whichList,
List<UserListEntry> users)
whichList - WRITEMEusers - WRITEMEpublic void addBuddy(AbstractUser buddy)
addBuddy in interface AbstractUseraddBuddy in class GeneralUserbuddy - WRITEMEGeneralUser.addBuddy(org.starhope.appius.user.AbstractUser)
public void addGiftSubscription(int i,
int days)
addGiftSubscription in interface AbstractUseri - WRITEMEdays - WRITEMEAbstractUser.addGiftSubscription(int,
int)public void addItem(int itemID)
addItem in interface AbstractUseritemID - the item ID to be instantiated and addedAbstractUser.addItem(int)public boolean canTalk()
canTalk in interface AbstractUserAbstractUser.canTalk()public void destroy()
public void doTransport()
AbstractUser
doTransport in interface AbstractUserAbstractUser.doTransport()public boolean equals(Object obj)
equals in class GeneralUserObject.equals(java.lang.Object)protected Set<String> getAccessibleRooms()
public AvatarClass getAvatarClass()
getAvatarClass in interface AbstractUserAbstractUser.getAvatarClass()public String getAvatarLabel()
AbstractUser
getAvatarLabel in interface AbstractUserAbstractUser.getAvatarLabel()public Colour getBaseColor()
getBaseColor in interface AbstractUserAbstractUser.getBaseColor()public Collection<String> getBuddyListNames()
AbstractUser
getBuddyListNames in interface AbstractUserAbstractUser.getBuddyListNames()public String getDebugName()
AbstractUser
getDebugName in interface AbstractUserAbstractUser.getDebugName()protected abstract int getInstanceID()
public String getIPAddress()
getIPAddress in interface AbstractUserAbstractUser.getIPAddress()public String getKickedMessage()
getKickedMessage in interface AbstractUserAbstractUser.getKickedMessage()public long getLag()
getLag in interface AbstractUserAbstractUser.getLag()public String getLanguage()
getLanguage in interface AbstractUserAbstractUser.getLanguage()public Coord3D getLocation()
AbstractUser
getLocation in interface AbstractUserAbstractUser.getTravelStart()AbstractUser.getLocation()public String getMail()
getMail in interface AbstractUserAbstractUser.getMail()public String getName()
HasName
getName in interface HasNameHasName.getName()public Date getNameApprovedAt()
getNameApprovedAt in interface AbstractUserAbstractUser.getNameApprovedAt()public Date getNameRequestedAt()
getNameRequestedAt in interface AbstractUserAbstractUser.getNameRequestedAt()public org.json.JSONObject getPublicInfo_new()
AbstractUser.getPublicInfo()public ServerThread getServerThread()
getServerThread in interface AbstractUserAbstractUser.getServerThread()public int hashCode()
hashCode in class GeneralUserObject.hashCode()public void inviteBuddy(AbstractUser newBuddy)
newBuddy - that special someonepublic boolean isBuddy(AbstractUser who)
who - someone who might be my friend
public boolean isNPC()
isNPC in interface AbstractUserAbstractUser.isNPC()public boolean isOnline()
AbstractUser
isOnline in interface AbstractUserAbstractUser.isOnline()
public void kick(AbstractUser u,
String kickReason,
int duration)
throws PrivilegeRequiredException
kick in interface AbstractUseru - WRITEMEkickReason - WRITEMEduration - WRITEME
PrivilegeRequiredException - WRITEMEAbstractUser.kick(org.starhope.appius.user.AbstractUser,
java.lang.String, int)
public void liftBan(AbstractUser authority)
throws PrivilegeRequiredException
AbstractUser
liftBan in interface AbstractUserauthority - WRITEME
PrivilegeRequiredException - WRITEMEAbstractUser.liftBan(org.starhope.appius.user.AbstractUser)public boolean needsParent()
GeneralUser
needsParent in interface AbstractUserneedsParent in class GeneralUserAbstractUser.needsParent()public void reportedToModeratorBy(AbstractUser u)
reportedToModeratorBy in interface AbstractUseru - WRITEMEAbstractUser.reportedToModeratorBy(org.starhope.appius.user.AbstractUser)
public void reportedToModeratorBy(AbstractUser u,
String reason)
reportedToModeratorBy in interface AbstractUseru - WRITEMEreason - WRITEMEAbstractUser.reportedToModeratorBy(org.starhope.appius.user.AbstractUser,
java.lang.String)
public void sendMigrate(AbstractZone refugeeZone)
throws UserDeadException
AbstractUser
sendMigrate in interface AbstractUserrefugeeZone - WRITEME
UserDeadException - WRITEMEAbstractUser.sendMigrate(org.starhope.appius.types.AbstractZone)public void sendOops()
AbstractUser
sendOops in interface AbstractUserAbstractUser.sendOops()public void sendResponse(org.json.JSONObject result)
sendResponse in interface AbstractUserresult - WRITEMEAbstractUser.sendResponse(org.json.JSONObject)public void setLastActive()
AbstractUser
setLastActive in interface AbstractUserAbstractUser.setLastActive()
public void setMail(String email)
throws GameLogicException
AbstractUser
setMail in interface AbstractUseremail - WRITEME
GameLogicException - WRITEMEAbstractUser.setMail(java.lang.String)
public void setParent(Parent newParent)
throws GameLogicException,
ForbiddenUserException,
AlreadyExistsException
AbstractUserAbstractUser.needsParent()
setParent in interface AbstractUsernewParent - the new parent record to associate with this
user
GameLogicException - if this user account does not need a
parent record (adult account or system/robot account)
ForbiddenUserException - if the parent is not allowed to
register/associate new child accounts (usually due to
having other child accounts which are banned)
AlreadyExistsException - if the parent account has the
maximum allowed children.AbstractUser.setParent(org.starhope.appius.user.Parent)
public void speak(Room room,
String string)
speak in interface AbstractUserroom - the room in which to speak. Typically, the user must
be present in that room.string - the speech (or emote)AbstractUser.speak(org.starhope.appius.game.Room,
java.lang.String)public void speakCasually(String text)
text - WRITEME
public void tick(long currentTime,
long deltaTime)
throws UserDeadException
AcceptsMetronomeTicks
tick in interface AcceptsMetronomeTickscurrentTime - 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 org.json.JSONObject toJSON()
toJSON in interface AbstractUserAbstractUser.toJSON()@Deprecated public String toSFSXML()
toSFSXML in interface AbstractUserAbstractUser.toSFSXML()public String toString()
toString in class ObjectObject.toString()public long whenAtTarget(Runnable runnable)
runnable - what to do when the target position is (or at
least, should have been) reached
Kalendor.schedule(long, Runnable),
Kalendor.cancel(long),
Geometry.getTimeToTarget(AbstractUser, long)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||