com.tootsville.npc
Class SoccerBall

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

public class SoccerBall
extends AbstractNonPlayerCharacter

WRITEME

Author:
ewinkelman
See Also:
Serialized Form

Field Summary
protected  int BALL_RADIUS
          ball radius
private static AtomicInteger nextInstanceID
          Static next instance ID for keeping track of instances of soccer balls
private static long serialVersionUID
          WRITEME: Document this brpocock@star-hope.org
 
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
  SoccerBall()
          Create an instance of a soccer ball
protected SoccerBall(String who)
          pass-through visibility of super constructor for volleyball
 
Method Summary
 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 acceptUserVariableUpdate(AbstractUser user, String varName, String varValue)
          Receive notification of the change of an user variable
 void ban(AbstractUser u, String banReason)
           
 org.starhope.appius.geometry.Coord2D getCenterOfMass()
          Gets the object's current center of mass in world coordinates
 org.starhope.appius.geometry.PolygonPrimitive<?> getCollisionBounds()
          Gets the collision boundaries for the object
 long getEndMovementTime(long currentTime)
          Ball is velocity based and doesn't have predetermined start/stop
protected  int getInstanceID()
           
 double getMass()
          Gets the mass of the collidable object
 long getStartMovementTime()
           
 org.starhope.appius.geometry.Vector2D getVelocity()
          Gets the object's current velocity
 void sendEarnings(Room room, String string)
           
 void sendWardrobe()
          WRITEME
 void setCenterOfMass(org.starhope.appius.geometry.Coord2D com)
          Sets the object's new center of mass in world space coordinates (i.e.
 void setTravelRate(double rate)
          This is an overriding method.
 void setVelocity(org.starhope.appius.geometry.Vector2D velocity)
          This method does nothing because we shouldn't be setting the speed and direction of users
 void tick(long currentTime, long deltaTime)
          This method is called periodically from the metronome thread.
 
Methods inherited from class org.starhope.appius.user.AbstractNonPlayerCharacter
acceptErrorReply, acceptGameAction, acceptGameStateChange, acceptMessage, acceptPrivateMessage, acceptPublicMessage, 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, hashCode, 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
acceptUserAction, assertLocationUnlocked, assertStaffLevel, attend, canApproveSelf, canBetaTest, canEnterChatZone, canEnterMenuZone, changeBaseDefenses, compareTo, deleteVariable, doffClothes, getAge, getAgeGroup, getApprovedDateString, getBaseDefenses, getBaseStat, getCurrentAction, getD, getDialect, getDisplayName, getEffectiveDefenses, getExtraColor, getFacing, getGameEquipItems_JSON, getGameEquipItems, getHeight, getHouse, getInventory, getItemsByType, getItemsByType, getItemsByTypeAsArray, getKickedByUserID, getKickedReasonCode, getKickedUntil, getLocationForUpdate, getMoney, getPathFinder, getPublicInfo, getRegisteredAt, getRegisteredDate, getRegisteredDateString, getRequestedName, getResponsibleMail, getRoom, getRoomNumber, getSizeScalar, getStaffLevel, getStartT, getStat, getTarget, getTravelRate, getTravelStart, getUserID, getUserListIterator, getUserName, getUserVariables, getVariable, getVariables, getVariablesJSON, getWallet, getZone, handleWalkFail, hasStaffLevel, hasVariable, ignore, isActive, isApproved, isBanned, isCanceled, isKicked, local_publicInfo, purchase, removeBuddy, resetVariables, sendBuddyList, sendEarnings, sendEarnings, setAgeGroupToSystem, setBackingRecord, setBaseColor, setCanTalk, setCurrentAction, setExtraColor, setFacing, setLocation, setRoom, setStartT, setTarget, setTravelStart, setVariable, setVariable, setVariables, 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
WRITEME: Document this brpocock@star-hope.org

See Also:
Constant Field Values

nextInstanceID

private static AtomicInteger nextInstanceID
Static next instance ID for keeping track of instances of soccer balls


BALL_RADIUS

protected final int BALL_RADIUS
ball radius

See Also:
Constant Field Values
Constructor Detail

SoccerBall

public SoccerBall()
           throws NotFoundException,
                  GameLogicException
Create an instance of a soccer ball

Throws:
GameLogicException - WRITEME
NotFoundException - WRITEME

SoccerBall

protected SoccerBall(String who)
              throws NotFoundException,
                     GameLogicException
pass-through visibility of super constructor for volleyball

Parameters:
who - WRITEME
Throws:
NotFoundException - WRITEME
GameLogicException - WRITEME
Method Detail

acceptObjectJoinRoom

public void acceptObjectJoinRoom(Room room,
                                 RoomListener object)
Description copied from interface: RoomListener
Notification that someone has entered the room.

Specified by:
acceptObjectJoinRoom in interface RoomListener
Overrides:
acceptObjectJoinRoom in class GeneralUser
Parameters:
room - The room
object - The thing (probably user) entering
See Also:
RoomListener.acceptObjectJoinRoom(org.starhope.appius.game.Room, org.starhope.appius.game.RoomListener)

acceptObjectPartRoom

public void acceptObjectPartRoom(Room room,
                                 RoomListener thing)
Description copied from interface: RoomListener
Notification that someone has left a room

Specified by:
acceptObjectPartRoom in interface RoomListener
Overrides:
acceptObjectPartRoom in class GeneralUser
Parameters:
room - The room
thing - The thing (probably user) departing
See Also:
RoomListener.acceptObjectPartRoom(org.starhope.appius.game.Room, org.starhope.appius.game.RoomListener)

acceptOutOfBandMessage

public void acceptOutOfBandMessage(AbstractUser sender,
                                   Room room,
                                   org.json.JSONObject body)
Description copied from interface: RoomListener
Accept an out-of-band communications packet that was broadcast to a room in which this Listener is listening.

Specified by:
acceptOutOfBandMessage in interface RoomListener
Overrides:
acceptOutOfBandMessage in class GeneralUser
Parameters:
sender - The sender of the OOB message
room - The room in which the OOB message is being broadcast
body - A JSON object containing the OOB message. The contents of this message are not constrained.
See Also:
RoomListener.acceptOutOfBandMessage(org.starhope.appius.user.AbstractUser, org.starhope.appius.game.Room, org.json.JSONObject)

acceptUserVariableUpdate

public void acceptUserVariableUpdate(AbstractUser user,
                                     String varName,
                                     String varValue)
Description copied from interface: RoomListener
Receive notification of the change of an user variable

Specified by:
acceptUserVariableUpdate in interface RoomListener
Overrides:
acceptUserVariableUpdate in class GeneralUser
Parameters:
user - The user updating their variable
varName - The name of the variable (key)
varValue - The new value (null if unset)
See Also:
RoomListener.acceptUserVariableUpdate(org.starhope.appius.user.AbstractUser, java.lang.String, java.lang.String)

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)

getCenterOfMass

public org.starhope.appius.geometry.Coord2D getCenterOfMass()
Description copied from interface: Collidable
Gets the object's current center of mass in world coordinates

Specified by:
getCenterOfMass in interface Collidable
Overrides:
getCenterOfMass in class GeneralUser
Returns:
A 2D point representing the center of mass
See Also:
Collidable.getCenterOfMass()

getCollisionBounds

public org.starhope.appius.geometry.PolygonPrimitive<?> getCollisionBounds()
Description copied from interface: Collidable
Gets the collision boundaries for the object

Specified by:
getCollisionBounds in interface Collidable
Overrides:
getCollisionBounds in class GeneralUser
Returns:
A polygon outlining the boundaries of the object
See Also:
Collidable.getCollisionBounds()

getEndMovementTime

public long getEndMovementTime(long currentTime)
Ball is velocity based and doesn't have predetermined start/stop

Specified by:
getEndMovementTime in interface Collidable
Overrides:
getEndMovementTime in class GeneralUser
Parameters:
currentTime - The current time
Returns:
the time the object will stop moving
See Also:
Collidable.getEndMovementTime(long)

getInstanceID

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

getMass

public double getMass()
Description copied from interface: Collidable
Gets the mass of the collidable object

Specified by:
getMass in interface Collidable
Overrides:
getMass in class GeneralUser
Returns:
Mass
See Also:
Collidable.getMass()

getStartMovementTime

public long getStartMovementTime()
Specified by:
getStartMovementTime in interface Collidable
Overrides:
getStartMovementTime in class GeneralUser
Returns:
the time the object started moving
See Also:
Collidable.getStartMovementTime()

getVelocity

public org.starhope.appius.geometry.Vector2D getVelocity()
Description copied from interface: Collidable
Gets the object's current velocity

Specified by:
getVelocity in interface Collidable
Overrides:
getVelocity in class GeneralUser
Returns:
WRITEME
See Also:
Collidable.getVelocity()

sendEarnings

public void sendEarnings(Room room,
                         String string)
Specified by:
sendEarnings in interface AbstractUser
Overrides:
sendEarnings in class GeneralUser
Parameters:
room - WRITEME
string - WRITEME
See Also:
AbstractUser.sendEarnings(org.starhope.appius.game.Room, java.lang.String)

sendWardrobe

public void sendWardrobe()
Description copied from interface: AbstractUser
WRITEME

Specified by:
sendWardrobe in interface AbstractUser
Overrides:
sendWardrobe in class GeneralUser
See Also:
AbstractUser.sendWardrobe()

setCenterOfMass

public void setCenterOfMass(org.starhope.appius.geometry.Coord2D com)
Description copied from interface: Collidable
Sets the object's new center of mass in world space coordinates (i.e. this moves the object and doesn't reposition the relative location of the center of mass with respect to its bounds)

Specified by:
setCenterOfMass in interface Collidable
Overrides:
setCenterOfMass in class GeneralUser
Parameters:
com - WRITEME
See Also:
Collidable.setCenterOfMass(Coord2D)

setTravelRate

public void setTravelRate(double rate)
Description copied from class: GeneralUser
This is an overriding method.

Specified by:
setTravelRate in interface AbstractUser
Overrides:
setTravelRate in class GeneralUser
Parameters:
rate - WRITEME
See Also:
GeneralUser.setTravelRate(double)

setVelocity

public void setVelocity(org.starhope.appius.geometry.Vector2D velocity)
Description copied from class: GeneralUser
This method does nothing because we shouldn't be setting the speed and direction of users

WRITEME: explain why? We do manipulate these values, regardless…

Specified by:
setVelocity in interface Collidable
Overrides:
setVelocity in class GeneralUser
Parameters:
velocity - WRITEME
See Also:
Collidable.setVelocity(Vector2D)

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)