|
||||||||||
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 NPCprotected AbstractNonPlayerCharacter(UserRecord dataRecord) throws GameLogicException
dataRecord
- WRITEME
GameLogicException
- for hateMethod 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 AbstractUser
command
- 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 RoomListener
u
- 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 RoomListener
gameCode
- 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 AbstractUser
title
- 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 AbstractUser
speaker
- 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 RoomListener
sender
- 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 RoomListener
from
- 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 AbstractUser
command
- 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 AbstractUser
addBuddy
in class GeneralUser
buddy
- WRITEMEGeneralUser.addBuddy(org.starhope.appius.user.AbstractUser)
public void addGiftSubscription(int i, int days)
addGiftSubscription
in interface AbstractUser
i
- WRITEMEdays
- WRITEMEAbstractUser.addGiftSubscription(int,
int)
public void addItem(int itemID)
addItem
in interface AbstractUser
itemID
- the item ID to be instantiated and addedAbstractUser.addItem(int)
public boolean canTalk()
canTalk
in interface AbstractUser
AbstractUser.canTalk()
public void destroy()
public void doTransport()
AbstractUser
doTransport
in interface AbstractUser
AbstractUser.doTransport()
public boolean equals(Object obj)
equals
in class GeneralUser
Object.equals(java.lang.Object)
protected Set<String> getAccessibleRooms()
public AvatarClass getAvatarClass()
getAvatarClass
in interface AbstractUser
AbstractUser.getAvatarClass()
public String getAvatarLabel()
AbstractUser
getAvatarLabel
in interface AbstractUser
AbstractUser.getAvatarLabel()
public Colour getBaseColor()
getBaseColor
in interface AbstractUser
AbstractUser.getBaseColor()
public Collection<String> getBuddyListNames()
AbstractUser
getBuddyListNames
in interface AbstractUser
AbstractUser.getBuddyListNames()
public String getDebugName()
AbstractUser
getDebugName
in interface AbstractUser
AbstractUser.getDebugName()
protected abstract int getInstanceID()
public String getIPAddress()
getIPAddress
in interface AbstractUser
AbstractUser.getIPAddress()
public String getKickedMessage()
getKickedMessage
in interface AbstractUser
AbstractUser.getKickedMessage()
public long getLag()
getLag
in interface AbstractUser
AbstractUser.getLag()
public String getLanguage()
getLanguage
in interface AbstractUser
AbstractUser.getLanguage()
public Coord3D getLocation()
AbstractUser
getLocation
in interface AbstractUser
AbstractUser.getTravelStart()
AbstractUser.getLocation()
public String getMail()
getMail
in interface AbstractUser
AbstractUser.getMail()
public String getName()
HasName
getName
in interface HasName
HasName.getName()
public Date getNameApprovedAt()
getNameApprovedAt
in interface AbstractUser
AbstractUser.getNameApprovedAt()
public Date getNameRequestedAt()
getNameRequestedAt
in interface AbstractUser
AbstractUser.getNameRequestedAt()
public org.json.JSONObject getPublicInfo_new()
AbstractUser.getPublicInfo()
public ServerThread getServerThread()
getServerThread
in interface AbstractUser
AbstractUser.getServerThread()
public int hashCode()
hashCode
in class GeneralUser
Object.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 AbstractUser
AbstractUser.isNPC()
public boolean isOnline()
AbstractUser
isOnline
in interface AbstractUser
AbstractUser.isOnline()
public void kick(AbstractUser u, String kickReason, int duration) throws PrivilegeRequiredException
kick
in interface AbstractUser
u
- 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 AbstractUser
authority
- WRITEME
PrivilegeRequiredException
- WRITEMEAbstractUser.liftBan(org.starhope.appius.user.AbstractUser)
public boolean needsParent()
GeneralUser
needsParent
in interface AbstractUser
needsParent
in class GeneralUser
AbstractUser.needsParent()
public void reportedToModeratorBy(AbstractUser u)
reportedToModeratorBy
in interface AbstractUser
u
- WRITEMEAbstractUser.reportedToModeratorBy(org.starhope.appius.user.AbstractUser)
public void reportedToModeratorBy(AbstractUser u, String reason)
reportedToModeratorBy
in interface AbstractUser
u
- WRITEMEreason
- WRITEMEAbstractUser.reportedToModeratorBy(org.starhope.appius.user.AbstractUser,
java.lang.String)
public void sendMigrate(AbstractZone refugeeZone) throws UserDeadException
AbstractUser
sendMigrate
in interface AbstractUser
refugeeZone
- WRITEME
UserDeadException
- WRITEMEAbstractUser.sendMigrate(org.starhope.appius.types.AbstractZone)
public void sendOops()
AbstractUser
sendOops
in interface AbstractUser
AbstractUser.sendOops()
public void sendResponse(org.json.JSONObject result)
sendResponse
in interface AbstractUser
result
- WRITEMEAbstractUser.sendResponse(org.json.JSONObject)
public void setLastActive()
AbstractUser
setLastActive
in interface AbstractUser
AbstractUser.setLastActive()
public void setMail(String email) throws GameLogicException
AbstractUser
setMail
in interface AbstractUser
email
- WRITEME
GameLogicException
- WRITEMEAbstractUser.setMail(java.lang.String)
public void setParent(Parent newParent) throws GameLogicException, ForbiddenUserException, AlreadyExistsException
AbstractUser
AbstractUser.needsParent()
setParent
in interface AbstractUser
newParent
- 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 AbstractUser
room
- 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
- WRITEMEpublic void tick(long currentTime, long deltaTime) throws UserDeadException
AcceptsMetronomeTicks
tick
in interface AcceptsMetronomeTicks
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
UserDeadException
- if a user has died during this tickAcceptsMetronomeTicks.tick(long,
long)
public org.json.JSONObject toJSON()
toJSON
in interface AbstractUser
AbstractUser.toJSON()
@Deprecated public String toSFSXML()
toSFSXML
in interface AbstractUser
AbstractUser.toSFSXML()
public String toString()
toString
in class Object
Object.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 |