public class TAMEModuleContext extends java.lang.Object implements TAMEConstants, Saveable
The "get" methods are lenient, as they will not throw errors on a bad state. The "resolve" methods are less so, since they are used for when good return is expected, and throw errors otherwise.
CUE_ERROR, CUE_FATAL, CUE_PAUSE, CUE_QUIT, CUE_TEXT, CUE_TEXTF, CUE_TRACE, CUE_WAIT, DEFAULT_FUNCTION_DEPTH, DEFAULT_RUNAWAY_THRESHOLD, HEADER_AUTHOR, HEADER_COUNTRY, HEADER_EMAIL, HEADER_LANGUAGE, HEADER_TAME_FUNCDEPTH_MAX, HEADER_TAME_RUNAWAY_MAX, HEADER_TITLE, HEADER_TWITTER, HEADER_VERSION, HEADER_WEBSITE, IDENTITY_ARCHETYPE_CONTAINER, IDENTITY_CURRENT_PLAYER, IDENTITY_CURRENT_ROOM, IDENTITY_CURRENT_WORLD, RETURN_VARIABLE
Constructor and Description |
---|
TAMEModuleContext(TAMEModule module)
Creates a new module context.
|
Modifier and Type | Method and Description |
---|---|
int |
getAccessibleObjectsByName(java.lang.String name,
TObject[] outputArray,
int arrayOffset)
Returns all objects in the accessible area by an object name read from the interpreter.
|
java.lang.String[] |
getAvailableActionNames()
Reflection method - get available action names according to current context
and filtered by a prefix.
|
TContainerContext |
getContainerContext(TContainer container)
Gets an container context by container.
|
TContainerContext |
getContainerContextByIdentity(java.lang.String identity)
Gets a container context by object name.
|
java.util.Collection<TContainerContext> |
getContainerContexts()
Get the container contexts.
|
TElementContext<?> |
getContextByIdentity(java.lang.String identity)
Gets an element context by element name.
|
TPlayer |
getCurrentPlayer()
Gets the current player.
|
TPlayerContext |
getCurrentPlayerContext()
Gets the current player context.
|
TRoom |
getCurrentRoom()
Gets the current room.
|
TRoomContext |
getCurrentRoomContext()
Gets the current room context.
|
long |
getFunctionDepthMax() |
TAMEModule |
getModule()
Gets the encapsulated module.
|
TObjectContext |
getObjectContext(TObject object)
Gets an object context by object.
|
TObjectContext |
getObjectContextByIdentity(java.lang.String identity)
Gets an object context by object name.
|
java.util.Collection<TObjectContext> |
getObjectContexts()
Get the object contexts.
|
long |
getOperationRunawayMax() |
TOwnershipMap |
getOwnershipMap() |
TPlayerContext |
getPlayerContext(TPlayer player)
Gets a player context by player.
|
TPlayerContext |
getPlayerContextByIdentity(java.lang.String identity)
Gets a player context by player name.
|
java.util.Collection<TPlayerContext> |
getPlayerContexts()
Get the player contexts.
|
java.util.Random |
getRandom()
Gets the context random number generator.
|
TRoomContext |
getRoomContext(TRoom room)
Gets a room context by room.
|
TRoomContext |
getRoomContextByIdentity(java.lang.String identity)
Gets a room context by room name.
|
java.util.Collection<TRoomContext> |
getRoomContexts()
Get the room contexts.
|
TWorldContext |
getWorldContext()
Gets this module's world context.
|
void |
readBytes(java.io.InputStream in)
Imports this object from bytes.
|
TAction |
resolveAction(java.lang.String actionIdentity)
Resolves an action by its identity.
|
TContainer |
resolveContainer(java.lang.String containerIdentity)
Resolves a container.
|
TContainerContext |
resolveContainerContext(java.lang.String containerIdentity)
Resolves a container context.
|
TElement |
resolveElement(Value varElement)
Resolves an element by a value.
|
TElementContext<?> |
resolveElementContext(Value varElement)
Resolves an element context by a value.
|
TObject |
resolveObject(java.lang.String objectIdentity)
Resolves an object.
|
TObjectContext |
resolveObjectContext(java.lang.String objectIdentity)
Resolves an object context.
|
java.lang.Iterable<TObject> |
resolveObjectList(Value varObjectContainer)
Resolves a list of all objects contained by an object container.
|
TPlayer |
resolvePlayer(java.lang.String playerIdentity)
Resolves a player.
|
TPlayerContext |
resolvePlayerContext(java.lang.String playerIdentity)
Resolves a player context.
|
TRoom |
resolveRoom(java.lang.String roomIdentity)
Resolves a room.
|
TRoomContext |
resolveRoomContext(java.lang.String roomIdentity)
Resolves a room context.
|
TWorld |
resolveWorld()
Resolves a world (or THE world).
|
TWorldContext |
resolveWorldContext()
Resolves a world context.
|
void |
writeBytes(java.io.OutputStream out)
Exports this object to bytes.
|
public TAMEModuleContext(TAMEModule module)
module
- the module to create the context for.public TAMEModule getModule()
public java.util.Random getRandom()
public long getOperationRunawayMax()
public long getFunctionDepthMax()
public java.util.Collection<TPlayerContext> getPlayerContexts()
public java.util.Collection<TRoomContext> getRoomContexts()
public java.util.Collection<TObjectContext> getObjectContexts()
public java.util.Collection<TContainerContext> getContainerContexts()
public java.lang.String[] getAvailableActionNames()
public TWorldContext getWorldContext()
public TPlayerContext getPlayerContext(TPlayer player)
player
- the player to use for the lookup.public TRoomContext getRoomContext(TRoom room)
room
- the room to use for the lookup.public TObjectContext getObjectContext(TObject object)
object
- the object to use for the lookup.public TContainerContext getContainerContext(TContainer container)
container
- the container to use for the lookup.public TElementContext<?> getContextByIdentity(java.lang.String identity)
identity
- the identity to use for the lookup.public TPlayerContext getPlayerContextByIdentity(java.lang.String identity)
identity
- the identity to use for the lookup.public TRoomContext getRoomContextByIdentity(java.lang.String identity)
identity
- the identity to use for the lookup.public TObjectContext getObjectContextByIdentity(java.lang.String identity)
identity
- the identity to use for the lookup.public TContainerContext getContainerContextByIdentity(java.lang.String identity)
identity
- the identity to use for the lookup.public TPlayer getCurrentPlayer()
public TPlayerContext getCurrentPlayerContext()
public TRoom getCurrentRoom()
public TRoomContext getCurrentRoomContext()
public TOwnershipMap getOwnershipMap()
public int getAccessibleObjectsByName(java.lang.String name, TObject[] outputArray, int arrayOffset)
name
- the name from the interpreter.outputArray
- the output vector of found objects.arrayOffset
- the starting offset into the array to put them.public TAction resolveAction(java.lang.String actionIdentity)
actionIdentity
- the action identity.public TElement resolveElement(Value varElement) throws ErrorInterrupt
varElement
- the value to resolve via module context.ErrorInterrupt
- if a major error occurs.public TElementContext<?> resolveElementContext(Value varElement) throws ErrorInterrupt
varElement
- the value to resolve via module context.ErrorInterrupt
- if a major error occurs.public java.lang.Iterable<TObject> resolveObjectList(Value varObjectContainer) throws ErrorInterrupt
varObjectContainer
- the value to resolve via module context.ErrorInterrupt
- if a major error occurs.public TWorldContext resolveWorldContext()
public TWorld resolveWorld()
public TPlayerContext resolvePlayerContext(java.lang.String playerIdentity)
playerIdentity
- the player identity.ModuleExecutionException
- if the non-current player identity cannot be found, or if no current player when requested.public TPlayer resolvePlayer(java.lang.String playerIdentity)
playerIdentity
- the player identity.ModuleExecutionException
- if the non-current player identity cannot be found, or if no current player if requesed.public TRoomContext resolveRoomContext(java.lang.String roomIdentity)
roomIdentity
- the roomIdentity.ModuleExecutionException
- if the non-current room identity cannot be found, or if no current room if requested.public TRoom resolveRoom(java.lang.String roomIdentity)
roomIdentity
- the roomIdentity.ModuleExecutionException
- if the non-current room identity cannot be found, or if not current room if requested.public TObjectContext resolveObjectContext(java.lang.String objectIdentity)
objectIdentity
- the object identity.ModuleExecutionException
- if object not found.public TObject resolveObject(java.lang.String objectIdentity)
objectIdentity
- the object identity.ModuleExecutionException
- if object not found.public TContainerContext resolveContainerContext(java.lang.String containerIdentity)
containerIdentity
- the container identity.ModuleExecutionException
- if container not found.public TContainer resolveContainer(java.lang.String containerIdentity)
containerIdentity
- the object identity.ModuleExecutionException
- if object not found.public void writeBytes(java.io.OutputStream out) throws java.io.IOException
Saveable
writeBytes
in interface Saveable
out
- the output stream to write to.java.io.IOException
- if a write problem occurs.public void readBytes(java.io.InputStream in) throws java.io.IOException
Saveable