public final class TAMELogic extends java.lang.Object implements TAMEConstants
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 |
---|
TAMELogic() |
Modifier and Type | Method and Description |
---|---|
static void |
callBlock(TAMERequest request,
TAMEResponse response,
TElementContext<?> context,
Block block)
Performs the necessary tasks for calling an object block.
|
static void |
callBlock(TAMERequest request,
TAMEResponse response,
TElementContext<?> context,
Block block,
boolean functionBlock,
ValueSet blockLocal)
Performs the necessary tasks for calling an object block.
|
static boolean |
callElementBlock(TAMERequest request,
TAMEResponse response,
TElementContext<?> context,
BlockEntry blockEntry)
Attempts to resolve and call an element block.
|
static boolean |
callElementBlock(TAMERequest request,
TAMEResponse response,
TElementContext<?> context,
BlockEntry blockEntry,
java.lang.String openTarget,
java.lang.Iterable<java.lang.String> locals)
Attempts to resolve and call an element block.
|
static Value |
callElementFunction(TAMERequest request,
TAMEResponse response,
java.lang.String functionName,
TElementContext<?> originContext)
Calls a function from an arbitrary context, using the bound element as a lineage search point.
|
static boolean |
checkObjectAccessibility(TAMERequest request,
TAMEResponse response,
TPlayer player,
TObject object)
Checks if an object is accessible to a player.
|
static void |
doArithmeticStackFunction(TAMERequest request,
TAMEResponse response,
int functionType)
Performs an arithmetic function on the stack.
|
static void |
doBrowse(TAMERequest request,
TAMEResponse response,
ObjectContainer element)
Attempts to perform an element browse.
|
static void |
doBrowse(TAMERequest request,
TAMEResponse response,
ObjectContainer element,
java.lang.String tag)
Attempts to perform an element browse.
|
static void |
doPlayerSwitch(TAMERequest request,
TAMEResponse response,
TPlayer nextPlayer)
Attempts to perform a player switch.
|
static void |
doRoomPop(TAMERequest request,
TAMEResponse response,
TPlayer player)
Attempts to perform a room stack pop for a player.
|
static void |
doRoomPush(TAMERequest request,
TAMEResponse response,
TPlayer player,
TRoom nextRoom)
Attempts to perform a room stack push for a player.
|
static void |
doRoomSwitch(TAMERequest request,
TAMEResponse response,
TPlayer player,
TRoom nextRoom)
Attempts to perform a room switch.
|
static boolean |
enqueueInterpretedAction(TAMERequest request,
TAMEResponse response,
com.tameif.tame.TAMELogic.InterpreterContext interpreterContext)
Enqueues an action based on how it is interpreted.
|
static java.lang.String |
getVersion()
Gets the embedded version string.
|
static TAMEResponse |
handleCommand(TAMEModuleContext moduleContext,
TAMECommand command,
boolean tracing)
Handles a single action.
|
static TAMEResponse |
handleInit(TAMEModuleContext moduleContext,
boolean tracing)
Handles context initialization, returning the response from it.
|
static TAMEResponse |
handleInit(TAMEModuleContext moduleContext,
TraceType... traceTypes)
Handles context initialization, returning the response from it.
|
static TAMEResponse |
handleRequest(TAMEModuleContext moduleContext,
java.lang.String input,
boolean tracing)
Handles a full request.
|
static TAMEResponse |
handleRequest(TAMEModuleContext moduleContext,
java.lang.String input,
TraceType... traceTypes)
Handles a full request.
|
static void |
processCommand(TAMERequest request,
TAMEResponse response,
TAMECommand command)
Processes a single action.
|
static java.lang.String[] |
tokenizeInput(TAMEModuleContext moduleContext,
java.lang.String inputMessage)
Tokenizes the input string into tokens based on module settings.
|
public static java.lang.String getVersion()
public static TAMEResponse handleInit(TAMEModuleContext moduleContext, boolean tracing)
moduleContext
- the module context.tracing
- if true, this does full tracing.public static TAMEResponse handleInit(TAMEModuleContext moduleContext, TraceType... traceTypes)
moduleContext
- the module context.traceTypes
- output trace cues for each request.public static TAMEResponse handleRequest(TAMEModuleContext moduleContext, java.lang.String input, boolean tracing)
moduleContext
- the module context.input
- the client input query.tracing
- if true, this does full tracing.public static TAMEResponse handleRequest(TAMEModuleContext moduleContext, java.lang.String input, TraceType... traceTypes)
moduleContext
- the module context.input
- the client input query.traceTypes
- output trace cues for each request.public static TAMEResponse handleCommand(TAMEModuleContext moduleContext, TAMECommand command, boolean tracing)
moduleContext
- the module context.command
- the command to enqueue.tracing
- if true, this does tracing.public static void processCommand(TAMERequest request, TAMEResponse response, TAMECommand command) throws TAMEInterrupt
request
- the request object.response
- the response object.command
- the action to process.TAMEInterrupt
- if an uncaught interrupt occurs.TAMEFatalException
- if something goes wrong during execution.public static java.lang.String[] tokenizeInput(TAMEModuleContext moduleContext, java.lang.String inputMessage)
moduleContext
- the module context to use (for object availability).inputMessage
- the input message to tokenize.public static boolean enqueueInterpretedAction(TAMERequest request, TAMEResponse response, com.tameif.tame.TAMELogic.InterpreterContext interpreterContext) throws TAMEInterrupt
request
- the request object.response
- the response object.interpreterContext
- the interpreter context (left after interpretation).TAMEInterrupt
- if an uncaught interrupt occurs.TAMEFatalException
- if something goes wrong during execution.public static void callBlock(TAMERequest request, TAMEResponse response, TElementContext<?> context, Block block) throws TAMEInterrupt
request
- the request object.response
- the response object.context
- the context that the block is executed through.block
- the block to execute.TAMEInterrupt
- if an interrupt occurs.public static void callBlock(TAMERequest request, TAMEResponse response, TElementContext<?> context, Block block, boolean functionBlock, ValueSet blockLocal) throws TAMEInterrupt
request
- the request object.response
- the response object.context
- the context that the block is executed through.block
- the block to execute.functionBlock
- if true, this is a function call (which is slightly different).blockLocal
- the local value hash to use on invoke.TAMEInterrupt
- if an interrupt occurs.public static boolean callElementBlock(TAMERequest request, TAMEResponse response, TElementContext<?> context, BlockEntry blockEntry) throws TAMEInterrupt
request
- the request.response
- the response.context
- the element context.blockEntry
- the block entry to resolve.TAMEInterrupt
- if an interrupt occurs.public static boolean callElementBlock(TAMERequest request, TAMEResponse response, TElementContext<?> context, BlockEntry blockEntry, java.lang.String openTarget, java.lang.Iterable<java.lang.String> locals) throws TAMEInterrupt
request
- the request.response
- the response.context
- the element context.blockEntry
- the block entry to resolve.openTarget
- the value of the open action.locals
- the extra strings for the open action (only the first one is used).TAMEInterrupt
- if an interrupt occurs.public static Value callElementFunction(TAMERequest request, TAMEResponse response, java.lang.String functionName, TElementContext<?> originContext) throws TAMEInterrupt
request
- the request object.response
- the response object.functionName
- the function to execute.originContext
- the origin context (and then element).ModuleException
- if the function does not exist in the lineage of the target element.TAMEInterrupt
- if an interrupt occurs.public static boolean checkObjectAccessibility(TAMERequest request, TAMEResponse response, TPlayer player, TObject object)
request
- the request object.response
- the response object.player
- the player viewpoint.object
- the object to check.public static void doArithmeticStackFunction(TAMERequest request, TAMEResponse response, int functionType)
request
- the request context.response
- the response object.functionType
- the function type.ModuleExecutionException
- if functionType is less than 0 or greater than or equal to ArithmeticOperator.VALUES.length
.public static void doPlayerSwitch(TAMERequest request, TAMEResponse response, TPlayer nextPlayer) throws TAMEInterrupt
request
- the request object.response
- the response object.nextPlayer
- the next player.TAMEInterrupt
- if an interrupt occurs.public static void doRoomPop(TAMERequest request, TAMEResponse response, TPlayer player) throws TAMEInterrupt
request
- the request object.response
- the response object.player
- the player to pop a room context from.TAMEInterrupt
- if an interrupt occurs.public static void doRoomPush(TAMERequest request, TAMEResponse response, TPlayer player, TRoom nextRoom) throws TAMEInterrupt
request
- the request object.response
- the response object.player
- the player to push a room context onto.nextRoom
- the room to push.TAMEInterrupt
- if an interrupt occurs.public static void doRoomSwitch(TAMERequest request, TAMEResponse response, TPlayer player, TRoom nextRoom) throws TAMEInterrupt
request
- the request object.response
- the response object.player
- the player that is switching rooms.nextRoom
- the target room.TAMEInterrupt
- if an interrupt occurs.public static void doBrowse(TAMERequest request, TAMEResponse response, ObjectContainer element) throws TAMEInterrupt
request
- the request object.response
- the response object.element
- the element to browse.TAMEInterrupt
- if an interrupt occurs.public static void doBrowse(TAMERequest request, TAMEResponse response, ObjectContainer element, java.lang.String tag) throws TAMEInterrupt
request
- the request object.response
- the response object.element
- the element to browse.tag
- the tag name to search for, if any (null for no tag filter).TAMEInterrupt
- if an interrupt occurs.