lama-0.8a/
lama-0.8a/data/character/
lama-0.8a/data/class/
lama-0.8a/data/map/
lama-0.8a/data/race/
lama-0.8a/doc/
lama-0.8a/log/
lama-0.8a/src/
lama-0.8a/src/ext/
lama-0.8a/txt/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
    <title>Reference</title>
    <link rel="stylesheet" href="../luadoc.css" type="text/css" />
	<!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
</head>

<body>
<div id="container">

<div id="product">
	<div id="product_logo"></div>
	<div id="product_name"><big><b></b></big></div>
	<div id="product_description"></div>
</div> <!-- id="product" -->

<div id="main">

<div id="navigation">


<h1>LuaDoc</h1>
<ul>
	
	<li><a href="../index.html">Index</a></li>
	
</ul>


<!-- Module list -->

<h1>Modules</h1>
<ul>

	<li>
		<a href="../modules/CharacterManager.html">CharacterManager</a>
	</li>

	<li>
		<a href="../modules/Direction.html">Direction</a>
	</li>

	<li><strong>Game</strong></li>
	
	<li>
		<a href="../modules/GameState.html">GameState</a>
	</li>

	<li>
		<a href="../modules/MessageMode.html">MessageMode</a>
	</li>

	<li>
		<a href="../modules/Nanny.html">Nanny</a>
	</li>

	<li>
		<a href="../modules/PlayerState.html">PlayerState</a>
	</li>

	<li>
		<a href="../modules/Telnet.html">Telnet</a>
	</li>

	<li>
		<a href="../modules/config.html">config</a>
	</li>

	<li>
		<a href="../modules/ext.string.html">ext.string</a>
	</li>

	<li>
		<a href="../modules/ext.table.html">ext.table</a>
	</li>

	<li>
		<a href="../modules/main.html">main</a>
	</li>

	<li>
		<a href="../modules/obj.Client.html">obj.Client</a>
	</li>

	<li>
		<a href="../modules/obj.Cloneable.html">obj.Cloneable</a>
	</li>

	<li>
		<a href="../modules/obj.Command.html">obj.Command</a>
	</li>

	<li>
		<a href="../modules/obj.CommandParser.html">obj.CommandParser</a>
	</li>

	<li>
		<a href="../modules/obj.Event.html">obj.Event</a>
	</li>

	<li>
		<a href="../modules/obj.Map.html">obj.Map</a>
	</li>

	<li>
		<a href="../modules/obj.MapObject.html">obj.MapObject</a>
	</li>

	<li>
		<a href="../modules/obj.MapTile.html">obj.MapTile</a>
	</li>

	<li>
		<a href="../modules/obj.Mob.html">obj.Mob</a>
	</li>

	<li>
		<a href="../modules/obj.Player.html">obj.Player</a>
	</li>

	<li>
		<a href="../modules/obj.Scheduler.html">obj.Scheduler</a>
	</li>

	<li>
		<a href="../modules/obj.Server.html">obj.Server</a>
	</li>

</ul>



<!-- File list -->






</div><!-- id="navigation" -->

<div id="content">

<h1>Module <code>Game</code></h1>

<p>Singleton that provides the necessary operations for running the game.</p>


<p><b>Author:</b>
<table class="authors_list">

	<tr><td class="name">milkmanjack</td></tr>

</table>
</p>





<h2>Functions</h2>
<table class="function_list">

	<tr>
	<td class="name" nowrap><a href="#Game.announce">Game.announce</a>&nbsp;(message, mode, minState)</td>
	<td class="summary">Announce something to connecting Players.<br/> This is mostly temporary, but I'm leaving it in now for testing purposes.<br/> More reasonable implementation later.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.connectPlayer">Game.connectPlayer</a>&nbsp;(player, hotboot)</td>
	<td class="summary">Connects a Player.<br/> Calls Game.onPlayerConnect(player) before adding to players list.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.debug">Game.debug</a>&nbsp;(message)</td>
	<td class="summary">Shortcut to Game.logger:debug(message) </td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.deque">Game.deque</a>&nbsp;(event)</td>
	<td class="summary">Shortcut for Game.scheduler:deque(event) </td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.disconnectPlayer">Game.disconnectPlayer</a>&nbsp;(player)</td>
	<td class="summary">Disconnect a Player.<br/> Calls Game.onPlayerDisconnect(player) before removing from players list or destroying client.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.error">Game.error</a>&nbsp;(message)</td>
	<td class="summary">Shortcut to Game.logger:error(message) </td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.fatal">Game.fatal</a>&nbsp;(message)</td>
	<td class="summary">Shortcut to Game.logger:fatal(message) </td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.generateCommands">Game.generateCommands</a>&nbsp;()</td>
	<td class="summary">Generates a list of every Command for the CommandParser.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.getDevelopers">Game.getDevelopers</a>&nbsp;()</td>
	<td class="summary">Retreive the Game's list of developers.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.getName">Game.getName</a>&nbsp;()</td>
	<td class="summary">Retreive the Game's name.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.getPlayers">Game.getPlayers</a>&nbsp;()</td>
	<td class="summary">Retreive the Game's players list.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.getState">Game.getState</a>&nbsp;()</td>
	<td class="summary">Retreive the Game's state.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.getVersion">Game.getVersion</a>&nbsp;()</td>
	<td class="summary">Retreive the Game's version.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.hotboot">Game.hotboot</a>&nbsp;()</td>
	<td class="summary">Hotboot the game.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.info">Game.info</a>&nbsp;(message)</td>
	<td class="summary">Shortcut to Game.logger:info(message) </td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.isReady">Game.isReady</a>&nbsp;()</td>
	<td class="summary">Check if the Game is ready to be played.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.log">Game.log</a>&nbsp;(level, message)</td>
	<td class="summary">Shortcut to Game.logger:log(level,message) </td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.logCommand">Game.logCommand</a>&nbsp;(player, input)</td>
	<td class="summary">Logs Player input.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.nextPlayerID">Game.nextPlayerID</a>&nbsp;()</td>
	<td class="summary">Get a unique player ID.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.onPlayerConnect">Game.onPlayerConnect</a>&nbsp;(player, hotboot)</td>
	<td class="summary">Specifies further actions for a connecting Player.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.onPlayerDisconnect">Game.onPlayerDisconnect</a>&nbsp;(player)</td>
	<td class="summary">Specifies further actions for a disconnecting Player.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.onPlayerInput">Game.onPlayerInput</a>&nbsp;(player, input)</td>
	<td class="summary">Determine what to do with input given by a Player.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.openOnPort">Game.openOnPort</a>&nbsp;(port)</td>
	<td class="summary">Open the game for play on the given port.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.openOnServer">Game.openOnServer</a>&nbsp;(server)</td>
	<td class="summary">Open the game for play on the given server.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.queue">Game.queue</a>&nbsp;(event)</td>
	<td class="summary">Shortcut for Game.scheduler:queue(event) </td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.recoverFromHotboot">Game.recoverFromHotboot</a>&nbsp;(preservedData)</td>
	<td class="summary">Recovers old players after a hotboot.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.setState">Game.setState</a>&nbsp;(state)</td>
	<td class="summary">Set the Game's state.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.shutdown">Game.shutdown</a>&nbsp;()</td>
	<td class="summary">Shutdown the game.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.time">Game.time</a>&nbsp;()</td>
	<td class="summary">Returns a timestamp used for most Game operations.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.update">Game.update</a>&nbsp;()</td>
	<td class="summary">Updates the game as necessary.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.warn">Game.warn</a>&nbsp;(message)</td>
	<td class="summary">Shortcut to Game.logger:warn(message) </td>
	</tr>

</table>



<h2>Tables</h2>
<table class="table_list">

	<tr>
	<td class="name" nowrap><a href="#Game">Game</a></td>
	<td class="summary">Singleton that provides the necessary operations for running the game.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.AcceptEvent">Game.AcceptEvent</a></td>
	<td class="summary">This Event acts as the middle ground for client connections, accepting clients on behalf of the server, and informing the game about it.<br/> Game.PollEvent and Game.AcceptEvent are mandatory events that must be part of the Game scheduler.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.PollEvent">Game.PollEvent</a></td>
	<td class="summary">This Event acts as the middle ground for client input, polling clients from the server for input and informing the game about it.<br/> Also the starting point for destroying clients that have disconnected and cannot be reached.<br/> Game.PollEvent and Game.AcceptEvent are mandatory events that must be part of the Game scheduler.</td>
	</tr>

	<tr>
	<td class="name" nowrap><a href="#Game.players">Game.players</a></td>
	<td class="summary">Contains all Players connected to the game.</td>
	</tr>

</table>



<br/>
<br/>



<h2><a name="functions"></a>Functions</h2>
<dl class="function">



<dt><a name="Game.announce"></a><strong>Game.announce</strong>&nbsp;(message, mode, minState)</dt>
<dd>
Announce something to connecting Players.<br/> This is mostly temporary, but I'm leaving it in now for testing purposes.<br/> More reasonable implementation later.


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>message</em></code>: The message to be announced.
	</li>
	
	<li>
	  <code><em>mode</em></code>: The mode of the message.<br/>Must be a valid member of MessageMode.
	</li>
	
	<li>
	  <code><em>minState</em></code>: The state a Player must be at to see the message (or "higher").
	</li>
	
</ul>








</dd>




<dt><a name="Game.connectPlayer"></a><strong>Game.connectPlayer</strong>&nbsp;(player, hotboot)</dt>
<dd>
Connects a Player.<br/> Calls Game.onPlayerConnect(player) before adding to players list.


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>player</em></code>: The Player to be connected.
	</li>
	
	<li>
	  <code><em>hotboot</em></code>: If true, player is reconnecting after hotboot.
	</li>
	
</ul>








</dd>




<dt><a name="Game.debug"></a><strong>Game.debug</strong>&nbsp;(message)</dt>
<dd>
Shortcut to Game.logger:debug(message)


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>message</em></code>: Message to be logged as debug.
	</li>
	
</ul>








</dd>




<dt><a name="Game.deque"></a><strong>Game.deque</strong>&nbsp;(event)</dt>
<dd>
Shortcut for Game.scheduler:deque(event)


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>event</em></code>: Event to deque.
	</li>
	
</ul>








</dd>




<dt><a name="Game.disconnectPlayer"></a><strong>Game.disconnectPlayer</strong>&nbsp;(player)</dt>
<dd>
Disconnect a Player.<br/> Calls Game.onPlayerDisconnect(player) before removing from players list or destroying client.


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>player</em></code>: The Player to be disconnected.
	</li>
	
</ul>








</dd>




<dt><a name="Game.error"></a><strong>Game.error</strong>&nbsp;(message)</dt>
<dd>
Shortcut to Game.logger:error(message)


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>message</em></code>: Message to be logged as error.
	</li>
	
</ul>








</dd>




<dt><a name="Game.fatal"></a><strong>Game.fatal</strong>&nbsp;(message)</dt>
<dd>
Shortcut to Game.logger:fatal(message)


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>message</em></code>: Message to be logged as fatal.
	</li>
	
</ul>








</dd>




<dt><a name="Game.generateCommands"></a><strong>Game.generateCommands</strong>&nbsp;()</dt>
<dd>
Generates a list of every Command for the CommandParser.









</dd>




<dt><a name="Game.getDevelopers"></a><strong>Game.getDevelopers</strong>&nbsp;()</dt>
<dd>
Retreive the Game's list of developers.







<h3>Return value:</h3>
<ul>A tuple of each developer</ul>



</dd>




<dt><a name="Game.getName"></a><strong>Game.getName</strong>&nbsp;()</dt>
<dd>
Retreive the Game's name.







<h3>Return value:</h3>
<ul>The name of the Game.</ul>



</dd>




<dt><a name="Game.getPlayers"></a><strong>Game.getPlayers</strong>&nbsp;()</dt>
<dd>
Retreive the Game's players list.







<h3>Return value:</h3>
<ul>Player list.</ul>



</dd>




<dt><a name="Game.getState"></a><strong>Game.getState</strong>&nbsp;()</dt>
<dd>
Retreive the Game's state.







<h3>Return value:</h3>
<ul>The Game's state.<br/>Must be a valid member of GameState.</ul>



</dd>




<dt><a name="Game.getVersion"></a><strong>Game.getVersion</strong>&nbsp;()</dt>
<dd>
Retreive the Game's version.







<h3>Return value:</h3>
<ul>The version of the Game.</ul>



</dd>




<dt><a name="Game.hotboot"></a><strong>Game.hotboot</strong>&nbsp;()</dt>
<dd>
Hotboot the game. The Game and all of the pertinent data will be recycled during a hotboot, so don't worry too much. The main focus is on preserving the server socket, client sockets, and player mobs.







<h3>Return value:</h3>
<ul>true on success.<br/>false followed by an error otherwise.</ul>



</dd>




<dt><a name="Game.info"></a><strong>Game.info</strong>&nbsp;(message)</dt>
<dd>
Shortcut to Game.logger:info(message)


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>message</em></code>: Message to be logged as info.
	</li>
	
</ul>








</dd>




<dt><a name="Game.isReady"></a><strong>Game.isReady</strong>&nbsp;()</dt>
<dd>
Check if the Game is ready to be played. return true if the game's state is at GameState.READY.<br/>false otherwise.









</dd>




<dt><a name="Game.log"></a><strong>Game.log</strong>&nbsp;(level, message)</dt>
<dd>
Shortcut to Game.logger:log(level,message)


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>level</em></code>: Level of this log.
	</li>
	
	<li>
	  <code><em>message</em></code>: Message to be logged.
	</li>
	
</ul>








</dd>




<dt><a name="Game.logCommand"></a><strong>Game.logCommand</strong>&nbsp;(player, input)</dt>
<dd>
Logs Player input.


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>player</em></code>: The Player giving input.
	</li>
	
	<li>
	  <code><em>input</em></code>: The input the Player gave.
	</li>
	
</ul>








</dd>




<dt><a name="Game.nextPlayerID"></a><strong>Game.nextPlayerID</strong>&nbsp;()</dt>
<dd>
Get a unique player ID.







<h3>Return value:</h3>
<ul>A unique player ID.</ul>



</dd>




<dt><a name="Game.onPlayerConnect"></a><strong>Game.onPlayerConnect</strong>&nbsp;(player, hotboot)</dt>
<dd>
Specifies further actions for a connecting Player.


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>player</em></code>: The Player connecting.
	</li>
	
	<li>
	  <code><em>hotboot</em></code>: If true, player is reconnecting after hotboot.
	</li>
	
</ul>








</dd>




<dt><a name="Game.onPlayerDisconnect"></a><strong>Game.onPlayerDisconnect</strong>&nbsp;(player)</dt>
<dd>
Specifies further actions for a disconnecting Player.


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>player</em></code>: The Player disconnecting.
	</li>
	
</ul>








</dd>




<dt><a name="Game.onPlayerInput"></a><strong>Game.onPlayerInput</strong>&nbsp;(player, input)</dt>
<dd>
Determine what to do with input given by a Player.


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>player</em></code>: The Player providing the input.
	</li>
	
	<li>
	  <code><em>input</em></code>: The input to be processed.
	</li>
	
</ul>








</dd>




<dt><a name="Game.openOnPort"></a><strong>Game.openOnPort</strong>&nbsp;(port)</dt>
<dd>
Open the game for play on the given port.


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>port</em></code>: The port to be hosted on. Defaults to Game.defaultPort{@link Game.defaultPort}.
	</li>
	
</ul>






<h3>Return value:</h3>
<ul>true on success.<br/>false followed by an error otherwise.</ul>



</dd>




<dt><a name="Game.openOnServer"></a><strong>Game.openOnServer</strong>&nbsp;(server)</dt>
<dd>
Open the game for play on the given server.


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>server</em></code>: Server to be used by the Game as opposed to setting up a new one. Used when hotbooting.
	</li>
	
</ul>






<h3>Return value:</h3>
<ul>true on success.<br/>false followed by an error otherwise.</ul>



</dd>




<dt><a name="Game.queue"></a><strong>Game.queue</strong>&nbsp;(event)</dt>
<dd>
Shortcut for Game.scheduler:queue(event)


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>event</em></code>: Event to queue.
	</li>
	
</ul>








</dd>




<dt><a name="Game.recoverFromHotboot"></a><strong>Game.recoverFromHotboot</strong>&nbsp;(preservedData)</dt>
<dd>
Recovers old players after a hotboot.


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>preservedData</em></code>: A table containing formatted tables that are used to reconstitute old players. Most importantly, their sockets are included in this table, but also things like their client options, and even mob IDs for loading temporary player files.
	</li>
	
</ul>








</dd>




<dt><a name="Game.setState"></a><strong>Game.setState</strong>&nbsp;(state)</dt>
<dd>
Set the Game's state.


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>state</em></code>: The state to be assigned.<br/>Must be a valid member of GameState.
	</li>
	
</ul>








</dd>




<dt><a name="Game.shutdown"></a><strong>Game.shutdown</strong>&nbsp;()</dt>
<dd>
Shutdown the game.







<h3>Return value:</h3>
<ul>true on success.<br/>false followed by an error otherwise.</ul>



</dd>




<dt><a name="Game.time"></a><strong>Game.time</strong>&nbsp;()</dt>
<dd>
Returns a timestamp used for most Game operations.







<h3>Return value:</h3>
<ul>A timestamp reflecting the current time.</ul>



</dd>




<dt><a name="Game.update"></a><strong>Game.update</strong>&nbsp;()</dt>
<dd>
Updates the game as necessary. Things like updating the scheduler and such.









</dd>




<dt><a name="Game.warn"></a><strong>Game.warn</strong>&nbsp;(message)</dt>
<dd>
Shortcut to Game.logger:warn(message)


<h3>Parameters:</h3>
<ul>
	
	<li>
	  <code><em>message</em></code>: Message to be logged as warn.
	</li>
	
</ul>








</dd>


</dl>




<h2><a name="tables"></a>Tables</h2>
<dl class="table">

<dt><a name="Game"></a><strong>Game</strong></dt>
<dd>Singleton that provides the necessary operations for running the game.<br /><br />


<h3>Fields:</h3>
<ul>
	
	<li>
	  <code><em>name</em></code>: The name we would like to be called.
	</li>
	
	<li>
	  <code><em>version</em></code>: The version of this release.
	</li>
	
	<li>
	  <code><em>defaultPort</em></code>: The port we'll use if one isn't provided.
	</li>
	
	<li>
	  <code><em>state</em></code>: Our state. Always a member of the GameState table.
	</li>
	
	<li>
	  <code><em>playerID</em></code>: Unique ID to be assigned to the next new Player.
	</li>
	
	<li>
	  <code><em>server</em></code>: Server we're using.
	</li>
	
	<li>
	  <code><em>scheduler</em></code>: Scheduler we're using.
	</li>
	
	<li>
	  <code><em>parser</em></code>: CommandParser we're using.
	</li>
	
	<li>
	  <code><em>map</em></code>: The Map we'll be using.
	</li>
	
	<li>
	  <code><em>logger</em></code>: Logger that prints to the standard output.
	</li>
	
	<li>
	  <code><em>fileLogger</em></code>: Logger that prints to the standard log file for this session.
	</li>
	
	<li>
	  <code><em>commandLogger</em></code>: Logger that prints all command input to the standard command log file for this session.
	</li>
	
</ul>


</dd>


<dt><a name="Game.AcceptEvent"></a><strong>Game.AcceptEvent</strong></dt>
<dd>This Event acts as the middle ground for client connections, accepting clients on behalf of the server, and informing the game about it.<br/> Game.PollEvent and Game.AcceptEvent are mandatory events that must be part of the Game scheduler.<br /><br />



</dd>


<dt><a name="Game.PollEvent"></a><strong>Game.PollEvent</strong></dt>
<dd>This Event acts as the middle ground for client input, polling clients from the server for input and informing the game about it.<br/> Also the starting point for destroying clients that have disconnected and cannot be reached.<br/> Game.PollEvent and Game.AcceptEvent are mandatory events that must be part of the Game scheduler.<br /><br />



</dd>


<dt><a name="Game.players"></a><strong>Game.players</strong></dt>
<dd>Contains all Players connected to the game.<br /><br />



</dd>


</dl>



</div> <!-- id="content" -->

</div> <!-- id="main" -->

<div id="about">
	<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
</div> <!-- id="about" -->

</div> <!-- id="container" -->	
</body>
</html>