com.tootsville.npc
Class Smudge

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

public class Smudge
extends AbstractNonPlayerCharacter

Author:
brpocock@star-hope.org
See Also:
Serialized Form

Nested Class Summary
(package private)  class Smudge.DoSomethingRunner
          WRITEME: Document this type.
(package private)  class Smudge.MoveRandomlyRunner
          WRITEME: Document this type.
(package private)  class Smudge.RunBesmudgement
          WRITEME: Document this type.
(package private) static class Smudge.SmudgeGoHome
          WRITEME: Document this type.
(package private)  class Smudge.StainDropRunner
          WRITEME: Document this type.
(package private)  class Smudge.SurfaceOntoBeachRunner
          WRITEME: Document this type.
private  class Smudge.TravelToRoomRunner
          WRITEME: Document this type.
(package private)  class Smudge.WanderRunner
          WRITEME: Document this type.
 
Field Summary
private  boolean fleeing
          WRITEME
private static int GREETING_RATE
          WRITEME
private  Pattern hiPattern
          WRITEME
protected static AtomicInteger instanceCounter
          Counter for getting instance ID's
private  long lastObservedPlayers
          WRITEME
private static int MAX_SMUDGES_PER_ROOM
          stop staining the room when we hit this point
private static int OBSERVATION_RATE
          WRITEME
private  boolean returningToOcean
          WRITEME
private  long seenShade
          WRITEME
private  long seenZap
          WRITEME
private static long serialVersionUID
          Java serialisation unique ID
(package private)  List<Integer> smudgeItems
          Room items, the things that get left behind when Smudge smudges up a place.
 String startRoom
          WRITEME: Document this brpocock@star-hope.org
(package private)  long tLastActionCheck
          frequency to check for future actions
 
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
Smudge(Zone z)
          WRITEME brpocock@star-hope.org
 
Method Summary
 void acceptPublicMessage(AbstractUser from, String message)
          Accept a public chat message.
private  boolean allRoomsAreSmudgedUp()
           
 void ban(AbstractUser u, String banReason)
           
(package private)  void besmudge()
          WRITEME: Document this method brpocock@star-hope.org
 boolean canSeeUser(String name)
           
private  void checkForLazySmudge(long currentTime)
          See if this Smudge has become lazy, and lost his way; if so, start him rocking again
private  void checkObservedPlayers(long currentTime)
           
private  int countSmudges(Room r)
          count the number of smudges present in a given room
 void doSomething()
          WRITEME: Document this method brpocock@star-hope.org
protected  int getInstanceID()
           
private  int getMaxSmudges()
          WRITEME: Document this method brpocock@star-hope.org
private  void getSmudgeItems()
          WRITEME: Document this method brpocock@star-hope.org
 int hashCode()
           
 void moveRandomly()
          WRITEME: Document this method brpocock@star-hope.org
private  void moveTowardsExit()
          WRITEME: Document this method brpocock@star-hope.org
private  void moveTowardsExit(String roomToward)
          WRITEME: Document this method brpocock@star-hope.org
private  void pickASpotAndSmudgeIt()
          WRITEME: Document this method brpocock@star-hope.org
private  void returnToOcean()
          WRITEME: Document this method brpocock@star-hope.org
private  boolean roomIsSmudgedUp()
          WRITEME: Document this method brpocock@star-hope.org
(package private)  void scheduleNextPatrol()
          WRITEME: Document this method brpocock@star-hope.org
(package private)  void surfaceOntoBeach()
          WRITEME: Document this method brpocock@star-hope.org
 void tick(long currentTime, long deltaTime)
          This method is called periodically from the metronome thread.
 void wander()
          WRITEME: Document this method brpocock@star-hope.org
 
Methods inherited from class org.starhope.appius.user.AbstractNonPlayerCharacter
acceptErrorReply, acceptGameAction, acceptGameStateChange, acceptMessage, acceptPrivateMessage, acceptPublicMessage, acceptSuccessReply, 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, inviteBuddy, isBuddy, isNPC, isOnline, isPaidMember, kick, liftBan, needsParent, reportedToModeratorBy, reportedToModeratorBy, sendMigrate, sendOops, sendResponse, setLastActive, setMail, setParent, speak, speakCasually, toJSON, toSFSXML, toString, whenAtTarget
 
Methods inherited from class org.starhope.appius.user.GeneralUser
acceptObjectJoinRoom, acceptObjectPartRoom, acceptOutOfBandMessage, acceptUserAction, acceptUserVariableUpdate, assertLocationUnlocked, assertStaffLevel, attend, canApproveSelf, canBetaTest, canEnterChatZone, canEnterMenuZone, changeBaseDefenses, compareTo, deleteVariable, doffClothes, getAge, getAgeGroup, getApprovedDateString, getBaseDefenses, getBaseStat, getCenterOfMass, getCollisionBounds, getCurrentAction, getD, getDialect, getDisplayName, getEffectiveDefenses, getEndMovementTime, getExtraColor, getFacing, getGameEquipItems_JSON, getGameEquipItems, getHeight, getHouse, getInventory, getItemsByType, getItemsByType, getItemsByTypeAsArray, getKickedByUserID, getKickedReasonCode, getKickedUntil, getLocationForUpdate, getMass, getMoney, getPathFinder, getPublicInfo, getRegisteredAt, getRegisteredDate, getRegisteredDateString, getRequestedName, getResponsibleMail, getRoom, getRoomNumber, getSizeScalar, getStaffLevel, getStartMovementTime, getStartT, getStat, getTarget, getTravelRate, getTravelStart, getUserID, getUserListIterator, getUserName, getUserVariables, getVariable, getVariables, getVariablesJSON, getVelocity, getWallet, getZone, handleWalkFail, hasStaffLevel, hasVariable, ignore, isActive, isApproved, isBanned, isCanceled, isKicked, local_publicInfo, purchase, removeBuddy, resetVariables, sendBuddyList, sendEarnings, sendEarnings, sendEarnings, sendWardrobe, setAgeGroupToSystem, setBackingRecord, setBaseColor, setCanTalk, setCenterOfMass, setCurrentAction, setExtraColor, setFacing, setLocation, setRoom, setStartT, setTarget, setTravelRate, setTravelStart, setVariable, setVariable, setVariables, setVelocity, takeAttack, unlockLocation, updateWallet
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Java serialisation unique ID

See Also:
Constant Field Values

smudgeItems

final List<Integer> smudgeItems
Room items, the things that get left behind when Smudge smudges up a place.


instanceCounter

protected static final AtomicInteger instanceCounter
Counter for getting instance ID's


returningToOcean

private boolean returningToOcean
WRITEME


fleeing

private boolean fleeing
WRITEME


MAX_SMUDGES_PER_ROOM

private static final int MAX_SMUDGES_PER_ROOM
stop staining the room when we hit this point

See Also:
Constant Field Values

seenZap

private long seenZap
WRITEME


seenShade

private long seenShade
WRITEME


GREETING_RATE

private static final int GREETING_RATE
WRITEME

See Also:
Constant Field Values

OBSERVATION_RATE

private static final int OBSERVATION_RATE
WRITEME

See Also:
Constant Field Values

lastObservedPlayers

private long lastObservedPlayers
WRITEME


hiPattern

private final Pattern hiPattern
WRITEME


tLastActionCheck

long tLastActionCheck
frequency to check for future actions


startRoom

public String startRoom
WRITEME: Document this brpocock@star-hope.org

Constructor Detail

Smudge

public Smudge(Zone z)
       throws NotFoundException,
              GameLogicException
WRITEME brpocock@star-hope.org

Parameters:
z - zone in which to spawn
Throws:
GameLogicException - WRITEME
NotFoundException - WRITEME
Method Detail

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:
AbstractNonPlayerCharacter.acceptPublicMessage(org.starhope.appius.user.AbstractUser, java.lang.String)

allRoomsAreSmudgedUp

private boolean allRoomsAreSmudgedUp()
Returns:
true, if all rooms have max smudges

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)

besmudge

void besmudge()
WRITEME: Document this method brpocock@star-hope.org


canSeeUser

public boolean canSeeUser(String name)
Parameters:
name - writeme
Returns:
WRITEME

checkForLazySmudge

private void checkForLazySmudge(long currentTime)
See if this Smudge has become lazy, and lost his way; if so, start him rocking again

Parameters:
currentTime - the current time

checkObservedPlayers

private void checkObservedPlayers(long currentTime)
Parameters:
currentTime - the time it's called

countSmudges

private int countSmudges(Room r)
count the number of smudges present in a given room

Parameters:
r - the room
Returns:
the number of smudges

doSomething

public void doSomething()
WRITEME: Document this method brpocock@star-hope.org


getInstanceID

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

getMaxSmudges

private int getMaxSmudges()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

getSmudgeItems

private void getSmudgeItems()
WRITEME: Document this method brpocock@star-hope.org


hashCode

public int hashCode()
Overrides:
hashCode in class AbstractNonPlayerCharacter
See Also:
AbstractNonPlayerCharacter.hashCode()

moveRandomly

public void moveRandomly()
WRITEME: Document this method brpocock@star-hope.org


moveTowardsExit

private void moveTowardsExit()
WRITEME: Document this method brpocock@star-hope.org


moveTowardsExit

private void moveTowardsExit(String roomToward)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
roomToward - WRITEME

pickASpotAndSmudgeIt

private void pickASpotAndSmudgeIt()
WRITEME: Document this method brpocock@star-hope.org


returnToOcean

private void returnToOcean()
WRITEME: Document this method brpocock@star-hope.org


roomIsSmudgedUp

private boolean roomIsSmudgedUp()
WRITEME: Document this method brpocock@star-hope.org

Returns:
true, if the room is all smudged up already

scheduleNextPatrol

void scheduleNextPatrol()
WRITEME: Document this method brpocock@star-hope.org


surfaceOntoBeach

void surfaceOntoBeach()
WRITEME: Document this method brpocock@star-hope.org


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.

Specified by:
tick in interface AcceptsMetronomeTicks
Overrides:
tick in class AbstractNonPlayerCharacter
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)

wander

public void wander()
WRITEME: Document this method brpocock@star-hope.org