|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.starhope.appius.game.GameEvent
com.tootsville.game.MagicBox
public class MagicBox
| Nested Class Summary | |
|---|---|
private class |
MagicBox.Box
Utility class for tracking unique boxes and handling setting and clearing room variables |
| Field Summary | |
|---|---|
private MagicBox.Box |
curBox
Current box |
private long |
lastPlaced
Time a box was last placed |
private Room |
mbRoom
Magic Box data room object |
private static AtomicInteger |
nextInstanceID
|
private Zone |
zone
This instance's zone |
| Fields inherited from class org.starhope.appius.game.GameEvent |
|---|
freezeTag, gameCode, gameState, players, rooms, scores, scoreWatchRooms |
| Constructor Summary | |
|---|---|
MagicBox(Zone z)
WRITEME edward.winkelman@gmail.com Sep 28, 2010 |
|
| Method Summary | |
|---|---|
void |
acceptGameAction(AbstractUser u,
org.json.JSONObject action)
Broadcast message of a game action taking place |
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 |
acceptPublicMessage(AbstractUser from,
String message)
Accept a public chat message. |
void |
acceptUserAction(Room r,
AbstractUser u)
User actions (go/do actions) propagate through this channel. |
private void |
clearBox()
WRITEME ewinkelman Oct 16, 2010 |
void |
destroySelf()
Destroy this event — during Zone shutdown usually |
private int |
getABox()
WRITEME ewinkelman Oct 16, 2010 |
private int |
getBoxID(String str)
WRITEME ewinkelman Oct 16, 2010 |
private Room |
getBoxRoom()
WRITEME ewinkelman Oct 16, 2010 |
private int |
getBoxWeight(String str)
WRITEME ewinkelman Oct 16, 2010 |
String |
getGameEventPrefix()
Get the prefix to be applied to event types for this game |
String |
getName()
Return a user-visible, unique name for this class. |
private org.starhope.appius.geometry.Coord2D |
getPointInRoom(Room room)
Gets a spawn point for the magic box in the room |
(package private) void |
giveReward(AbstractUser user,
int itemID)
WRITEME ewinkelman Oct 16, 2010 |
(package private) void |
putBox()
WRITEME ewinkelman Oct 16, 2010 |
private void |
rewardWithItem(AbstractUser user,
int value)
WRITEME ewinkelman Oct 16, 2010 |
private void |
rewardWithPeanuts(AbstractUser user,
int value)
WRITEME ewinkleman Oct 16, 2010 |
void |
tick(long currentTime,
long deltaTime)
This method is called periodically from the metronome thread. |
| Methods inherited from class org.starhope.appius.game.GameEvent |
|---|
acceptCommand, acceptCommand, acceptGameStateChange, acceptObjectJoinRoom, acceptObjectPartRoom, acceptPublicMessage, acceptUserVariableUpdate, changeGameState, compareTo, decrementScore, disconnect, equals, equals, getCountdownDuration, getEveryone, getGameCode, getGameDuration, getGameShortName, getLeaderBonus, getPlayers, getRoom, getRooms, getScoreWatchRooms, getSpectators, getTimer, getZone, hashCode, incrementScore, propagateGameStateChange, resetPlayers, sendEndEvents, sendStartEvents, toString, updateRoomVars, updateScore, updateScores |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final AtomicInteger nextInstanceID
private transient MagicBox.Box curBox
private transient long lastPlaced
private final transient Room mbRoom
private final transient Zone zone
| Constructor Detail |
|---|
public MagicBox(Zone z)
throws NotFoundException,
GameLogicException
z - Zone in which haunted organ is placed
NotFoundException - WRITEME
GameLogicException - WRITEME| Method Detail |
|---|
public void acceptGameAction(AbstractUser u,
org.json.JSONObject action)
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 acceptOutOfBandMessage(AbstractUser sender,
Room room,
org.json.JSONObject body)
RoomListener
sender - 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.RoomListener.acceptOutOfBandMessage(org.starhope.appius.user.AbstractUser,
org.starhope.appius.game.Room, org.json.JSONObject)
public void acceptPublicMessage(AbstractUser from,
String message)
RoomListener
from - The speakermessage - The spoken text or /emoteRoomListener.acceptPublicMessage(org.starhope.appius.user.AbstractUser,
java.lang.String)
public void acceptUserAction(Room r,
AbstractUser u)
RoomListener
r - the room in which the user is taking an actionu - the user taking an actionRoomListener.acceptUserAction(org.starhope.appius.game.Room,
org.starhope.appius.user.AbstractUser)private void clearBox()
public void destroySelf()
GameEvent
destroySelf in class GameEventGameEvent.destroySelf()
private int getABox()
throws NotFoundException
NotFoundException - WRITEMEprivate int getBoxID(String str)
str - WRITEME
private Room getBoxRoom()
throws NotFoundException
NotFoundException - WRITEMEprivate int getBoxWeight(String str)
str - WRITEME
public String getGameEventPrefix()
GameEvent
getGameEventPrefix in class GameEventGameEvent.getGameEventPrefix()public String getName()
HasName
HasName.getName()
private org.starhope.appius.geometry.Coord2D getPointInRoom(Room room)
throws NotFoundException
room - WRITEME
NotFoundException - WRITEME
void giveReward(AbstractUser user,
int itemID)
user - WRITEMEitemID - WRITEMEvoid putBox()
private void rewardWithItem(AbstractUser user,
int value)
user - WRITEMEvalue - WRITEME
private void rewardWithPeanuts(AbstractUser user,
int value)
user - WRITEMEvalue - WRITEME
public void tick(long currentTime,
long deltaTime)
throws UserDeadException
AcceptsMetronomeTicks
tick in interface AcceptsMetronomeTickstick in class GameEventcurrentTime - 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 tickGameEvent.tick(long, long)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||