Marauroa Core API: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>Hendrik Brummermann
imported>Hendrik Brummermann
Line 284: Line 284:


=IRPRuleProcessor=
=IRPRuleProcessor=
This class *MUST* be implemented fully, but it is a childs toy compared to IRPZone :). This is where you code all your games rules.<br>
This class must be implemented fully, but it is a childs toy compared to IRPZone :). This is where you code all your games rules.<br>
The API is as follows:
The API is as follows:
<source lang="java">
<pre>
/** Set the context where the actions are executed.
/** Set the context where the actions are executed.
* @param zone The zone where actions happens. */
* @param zone The zone where actions happens. */
public void setContext(IRPZone zone);
public void setContext(IRPZone zone);

/** Pass the whole list of actions so that it can approve or deny the actions in it.
/** Pass the whole list of actions so that it can approve or deny the actions in it.
* @param id the id of the object owner of the actions.
* @param id the id of the object owner of the actions.
* @param actionList the list of actions that the player wants to execute. */
* @param actionList the list of actions that the player wants to execute. */
public void approvedActions(RPObject.ID id, RPActionList actionList);
public void approvedActions(RPObject.ID id, RPActionList actionList);

/** Execute an action in the name of a player.
/** Execute an action in the name of a player.
* @param id the id of the object owner of the actions.
* @param id the id of the object owner of the actions.
Line 300: Line 302:
* refer to Actions Explained for more info. */
* refer to Actions Explained for more info. */
public RPAction.Status execute(RPObject.ID id, RPAction action);
public RPAction.Status execute(RPObject.ID id, RPAction action);

/** Notify it when a new turn happens */
/** Notify it when a new turn happens */
public void nextTurn();
public void nextTurn();

/** Callback method called when a new player enters in the game
/** Callback method called when a new player enters in the game
* @param object the new player that enters in the game. */
* @param object the new player that enters in the game. */
public boolean onInit(RPObject object) throws RPObjectInvalidException;
public boolean onInit(RPObject object) throws RPObjectInvalidException;

/** Callback method called when a new player exits the game
/** Callback method called when a new player exits the game
* @param id the new player id that exits the game.
* @param id the new player id that exits the game.
* @return true to update the player on database. */
* @return true to update the player on database. */
public boolean onExit(RPObject.ID id) throws RPObjectNotFoundException;
public boolean onExit(RPObject.ID id) throws RPObjectNotFoundException;

/** Callback method called when a new player time out
/** Callback method called when a new player time out
* @param id the new player id that timeouts. */
* @param id the new player id that timeouts. */
public boolean onTimeout(RPObject.ID id) throws RPObjectNotFoundException;
public boolean onTimeout(RPObject.ID id) throws RPObjectNotFoundException;
</pre>
</source>


[[Category:Marauroa]]
[[Category:Marauroa]]