Classes, interfaces and traits

Inventory

Represent the player's Inventory.

Implemented as a singleton in the session.
« More »

Functions

generateMonster

Loads all the dungeon's monsters from the XML file data/monsters.xml.

« More »

initDungeon

Marks the dungeon as accessible in the session.

« More »

sendDungeon

Returns the dungeon array if it was created.

« More »

buildDungeon

Allows acces to the dungeon in the session and sends it to the client.

Debits the dungeon's ticket cost from the player's gold.
« More »

launchDungeon

Sends monsters for a specific floor as specified by the floor POST parameter to the client.

« More »

sendDungeonProgress

Updates floor and monster number from the POST parameters in the session.

« More »

exitDungeon

Marks the dungeon as not accessible in the session.

« More »

Functions

sendMessage

Sends a message to the client.

« More »

sendError

Sends an error message to the client.

Simple wrapper calling sendMessage with "error" as $type.
« More »

sendInfo

Sends an info message to the client.

Simple wrapper calling sendMessage with "info" as $type.
« More »

Functions

createGuild

Create the miners guild in the session.

Debits GUILD_COST from the player's gold.
« More »

hireMiner

Hire one miner.

Debits MINER_COST from the player's gold.
« More »

sendMiners

Returns the number of miners currently in the guild.

« More »

Constants

GUILD_COST

Amount of gold required to build the miners guild.

« More »

MINER_COST

Amount of gold required to hire a miner.

« More »

Functions

genXML

Recursively generates an XML tree from an array.

If objects are found, call addToXML() methods which should serialize the object as a child of the XML tree passed as parameter.
« More »

genSave

Generates the XML save tree from the session.

« More »

genFilename

Generates the save file name using current date/time.

The date function will use the server's timezone which could be inconsistent with the client timezone.
« More »

saveGame

Save the XML save tree as an XML file named after the results of genFilename in SAVEDIR.

Fails and send an error the the client if permissions are incorrectly set. Watch for errors in PHP log.
« More »

downSave

Sends the current game or a specific save file given by the filename GET parameter to the client.

« More »

listSaves

Sends the list of available saves to the client.

Warning: this function changes directory.
« More »

parseSave

Reads an XML tree and deserializes it to an array.

« More »

deleteSave

Deletes a save file given as the filename POST parameter.

« More »

loadSave

Loads a save file given as the filename POST parameter to the session.

Empties the session beforehand.
« More »

uploadSave

Reads a save file sent by the client.

Parse the received file then generate it again to clean it for any unwanted and make sure that it is a valid XML save file. XML errors are simply ignored and an error is sent to the client if something wrong happens.
« More »

Constants

SAVEDIR

Directory to save to and load from.

The PHP/Apache user must have write permission on this directory. Use the following commands to give write permissions to the http group: <samp> sudo chown :http data/save sudo chmod g+w data/save </samp>
« More »

Functions

loadShop

Loads all the shop's items from the XML file data/items.xml.

« More »

getItem

Gets an Item object from the shop from its name.

« More »

initShop

Marks the shop as created in the session.

« More »

sendShop

Returns the shop array if it was created.

« More »

buildShop

Creates the shop in the session and sends it to the client.

Debits the shop's cost from the player's gold.
« More »

buyItem

Debits the item's cost specified as the item POST parameter, adds it to the Inventory and sends it to the client.

« More »

useItem

Invoke useItem on an item passed as the item POST parameter, sends to the client the updated player stats and the item.

« More »

Functions

initCraftMine

Initializes the gold amount and miners count in the session.

« More »

withdrawMine

Transfers all gold from the mine to the player's account.

« More »

sendMine

Returns the amount of gold currently owned by the player.

« More »

Functions

sendCraftMine

Sends all data from previous session on page load.

All data from the different modules are packed in an array.
« More »

Functions

debitAccount

Debits the account of a certain amount of gold.

« More »

creditAccount

Credits the account of a certain amount of gold.

« More »

Functions

sendPerso

Returns all player's stats after initializing them if needed.

« More »

increasePerso

Increases a player's stat.

« More »

updatePerso

Copies stats given in POST request to session.

« More »

initPerso

Initializes the player's stats.

« More »

Classes, interfaces and traits

Item

Represent an Item in the shop or in the Inventory.

« More »

Classes, interfaces and traits

Monster

Represent an Item in the shop or in the Inventory.

« More »