From 1e52affe15fb13e920f8942de998073238be6d01 Mon Sep 17 00:00:00 2001 From: piernov Date: Mon, 9 May 2016 14:05:50 +0200 Subject: Finish Inventory PHPDoc --- doc/phpdoc/classes.svg | 22 +- doc/phpdoc/classes/Inventory.html | 135 +++-------- doc/phpdoc/classes/Item.html | 2 +- doc/phpdoc/classes/Monster.html | 2 +- doc/phpdoc/deprecated.html | 2 +- doc/phpdoc/errors.html | 116 +++------ doc/phpdoc/graph_class.html | 2 +- doc/phpdoc/index.html | 4 +- doc/phpdoc/markers.html | 64 ++--- doc/phpdoc/namespaces/default.html | 28 +-- doc/phpdoc/packages/Default.html | 2 +- doc/phpdoc/packages/default.html | 368 ++++++++++++++--------------- doc/phpdoc/packages/inc.Inventory.inc.html | 2 +- doc/phpdoc/packages/inc.Item.inc.html | 2 +- doc/phpdoc/packages/inc.Monster.inc.html | 2 +- doc/phpdoc/packages/inc.account.inc.html | 2 +- doc/phpdoc/packages/inc.craftmine.inc.html | 2 +- doc/phpdoc/packages/inc.dungeon.inc.html | 2 +- doc/phpdoc/packages/inc.guild.inc.html | 2 +- doc/phpdoc/packages/inc.html | 368 ++++++++++++++--------------- doc/phpdoc/packages/inc.messages.inc.html | 2 +- doc/phpdoc/packages/inc.mine.inc.html | 2 +- doc/phpdoc/packages/inc.perso.inc.html | 2 +- doc/phpdoc/packages/inc.savegame.inc.html | 2 +- doc/phpdoc/packages/inc.shop.inc.html | 2 +- inc/Inventory.inc | 36 ++- 26 files changed, 545 insertions(+), 630 deletions(-) diff --git a/doc/phpdoc/classes.svg b/doc/phpdoc/classes.svg index e64f82f..7422c49 100644 --- a/doc/phpdoc/classes.svg +++ b/doc/phpdoc/classes.svg @@ -13,20 +13,20 @@ Global - -\\Monster - -Monster - -\\Inventory - -Inventory +\\Inventory + +Inventory -\\Item - -Item +\\Item + +Item + + +\\Monster + +Monster diff --git a/doc/phpdoc/classes/Inventory.html b/doc/phpdoc/classes/Inventory.html index 48730e5..18149d5 100644 --- a/doc/phpdoc/classes/Inventory.html +++ b/doc/phpdoc/classes/Inventory.html @@ -124,8 +124,8 @@
  • - -
    addToXML
    +
    + Generates an XML tree describing the Inventory
    addToXML
  • @@ -142,8 +142,8 @@
  • - -
    removeItem
    +
    + Removes an Item object to the singleton's Inventory from session, not taking into account the Item's count.
    removeItem
  • @@ -154,8 +154,8 @@
  • - -
    useItem
    +
    + Consumes an Item object to the singleton's Inventory from session, decrementing the Item's count and removing it if count reaches 0.
    useItem
  • @@ -173,13 +173,13 @@
  • - -
    _removeItem
    +
    + Removes an Item object from the Inventory, not taking into account the Item's count.
    _removeItem
  • - -
    _useItem
    +
    + Consumes an Item object from the Inventory, decrementing the Item's count and removing it if count reaches 0.
    _useItem
  • @@ -264,8 +264,8 @@
    -

    _removeItem

    -
    _removeItem( $item) 
    +

    Removes an Item object from the Inventory, not taking into account the Item's count.

    +
    _removeItem(\Item $item) : void
    @@ -275,26 +275,12 @@
    - - - - - - - -
    - - -
    - - -

    Arguments

    $item

    -

    + \Item

    Item to remove from the Inventory

    @@ -303,8 +289,8 @@
    -

    _useItem

    -
    _useItem( $item) 
    +

    Consumes an Item object from the Inventory, decrementing the Item's count and removing it if count reaches 0.

    +
    _useItem(\Item $item) : array|false
    @@ -314,28 +300,16 @@
    - - - - - - - -
    - - -
    - - -

    Arguments

    $item

    -

    + \Item

    Item to consume from the Inventory

    +

    Response

    + array|false

    Item and updated Item's count, false if it was not found

    @@ -369,8 +343,8 @@
    -

    addToXML

    -
    addToXML( $root) 
    +

    Generates an XML tree describing the Inventory

    +
    addToXML(\SimpleXMLElement $root) : void
    @@ -380,26 +354,12 @@
    - - - - - - - -
    - - -
    - - -

    Arguments

    $root

    -

    + \SimpleXMLElement

    root XML element to add the Inventory's Items to

    @@ -466,8 +426,8 @@
    -

    removeItem

    -
    removeItem( $item) 
    +

    Removes an Item object to the singleton's Inventory from session, not taking into account the Item's count.

    +
    removeItem(\Item $item) : void
    static
    @@ -477,26 +437,12 @@
    - - - - - - - -
    - - -
    - - -

    Arguments

    $item

    -

    + \Item

    Item to remove from the Inventory

    @@ -534,8 +480,8 @@
    -

    useItem

    -
    useItem( $item) 
    +

    Consumes an Item object to the singleton's Inventory from session, decrementing the Item's count and removing it if count reaches 0.

    +
    useItem(\Item $item) : array|false
    static
    @@ -545,28 +491,16 @@
    - - - - - - - -
    - - -
    - - -

    Arguments

    $item

    -

    + \Item

    Item to consume from the Inventory

    +

    Response

    + array|false

    Item and updated Item's count, false if it was not found

    @@ -576,8 +510,8 @@

    Properties

    -

    Arrays of array with Item and Item's count

    -
    items : 
    +

    Arrays of array with Item object and Item's count as int

    +
    items : array
    @@ -587,15 +521,16 @@
    - + var +

    Arrays of array with Item object and Item's count as int

    Type(s)

    - + array
    @@ -619,7 +554,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/classes/Item.html b/doc/phpdoc/classes/Item.html index 9dbd580..eab07f2 100644 --- a/doc/phpdoc/classes/Item.html +++ b/doc/phpdoc/classes/Item.html @@ -477,7 +477,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/classes/Monster.html b/doc/phpdoc/classes/Monster.html index 5f22810..859dead 100644 --- a/doc/phpdoc/classes/Monster.html +++ b/doc/phpdoc/classes/Monster.html @@ -404,7 +404,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/deprecated.html b/doc/phpdoc/deprecated.html index 0257223..9aaf18f 100644 --- a/doc/phpdoc/deprecated.html +++ b/doc/phpdoc/deprecated.html @@ -120,7 +120,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:22 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/errors.html b/doc/phpdoc/errors.html index 2c096da..6d6d671 100644 --- a/doc/phpdoc/errors.html +++ b/doc/phpdoc/errors.html @@ -108,14 +108,14 @@ -
  • craftmine.php
  • -
  • upload.php
  • -
  • inc/Monster.inc
  • -
  • inc/Inventory.inc
  • -
  • inc/shop.inc
  • -
  • inc/perso.inc
  • +
  • upload.php
  • +
  • craftmine.php
  • +
  • inc/Inventory.inc
  • +
  • inc/shop.inc
  • +
  • inc/perso.inc
  • inc/Item.inc
  • - +
  • inc/Monster.inc
  • +
    @@ -126,10 +126,10 @@
    - +

    - craftmine.php + upload.php 1

    @@ -152,10 +152,10 @@
    - +

    - upload.php + craftmine.php 1

    @@ -178,10 +178,10 @@
    - +

    - inc/Monster.inc + inc/Inventory.inc 1

    @@ -208,11 +208,15 @@
    - +
    +
    +
    +
    +

    - inc/Inventory.inc - 11 + inc/shop.inc + 1

    @@ -226,58 +230,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
    error0No summary was found for this file
    error77Argument $item is missing from the Docblock of _removeItem
    error77No summary for method _removeItem()
    error86Argument $item is missing from the Docblock of removeItem
    error86No summary for method removeItem()
    error91Argument $item is missing from the Docblock of _useItem
    error91No summary for method _useItem()
    error106Argument $item is missing from the Docblock of useItem
    error106No summary for method useItem()
    error112Argument $root is missing from the Docblock of addToXML
    error112No summary for method addToXML()48Argument $name is missing from the Docblock of getItem
    @@ -290,10 +244,10 @@
    - +

    - inc/shop.inc + inc/perso.inc 1

    @@ -308,18 +262,18 @@ error - 48 - Argument $name is missing from the Docblock of getItem + 27 + Argument $num is missing from the Docblock of increasePerso
    - +

    - inc/perso.inc + inc/Item.inc 1

    @@ -334,18 +288,18 @@ error - 27 - Argument $num is missing from the Docblock of increasePerso + 0 + No summary was found for this file
    - +

    - inc/Item.inc + inc/Monster.inc 1

    @@ -367,10 +321,6 @@
    -
    -
    -
    -
    @@ -379,7 +329,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/graph_class.html b/doc/phpdoc/graph_class.html index 0143bcc..068a2e8 100644 --- a/doc/phpdoc/graph_class.html +++ b/doc/phpdoc/graph_class.html @@ -121,7 +121,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:22 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/index.html b/doc/phpdoc/index.html index 7fc372b..1c76dcf 100644 --- a/doc/phpdoc/index.html +++ b/doc/phpdoc/index.html @@ -129,7 +129,7 @@
  • - Errors 17 + Errors 7
  • @@ -155,7 +155,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/markers.html b/doc/phpdoc/markers.html index 33d05f7..4765760 100644 --- a/doc/phpdoc/markers.html +++ b/doc/phpdoc/markers.html @@ -99,11 +99,11 @@
    @@ -115,29 +115,7 @@
    -
    - -

    - - inc/Monster.inc - 1 -

    -
    - - - - - - - - - - - -
    TypeLineDescription
    TODO23unused
    -
    -
    -
    +

    @@ -169,7 +147,7 @@

    -
    +

    @@ -196,7 +174,7 @@

    -
    +

    @@ -218,7 +196,29 @@

    -
    +
    + +

    + + inc/Monster.inc + 1 +

    +
    + + + + + + + + + + + +
    TypeLineDescription
    TODO23unused
    +
    +
    +
    @@ -227,7 +227,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/namespaces/default.html b/doc/phpdoc/namespaces/default.html index fa3b993..87e1895 100644 --- a/doc/phpdoc/namespaces/default.html +++ b/doc/phpdoc/namespaces/default.html @@ -1580,19 +1580,6 @@ XML errors are simply ignored and an error is sent to the client if something wr

    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:

    - -sudo chown :http data/save -sudo chmod g+w data/save - -
    - « More »
    -

    GUILD_COST

    Amount of gold required to build the miners guild.

    @@ -1609,6 +1596,19 @@ sudo chmod g+w data/save
    « More »
    +
    +

    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:

    + +sudo chown :http data/save +sudo chmod g+w data/save + +
    + « More »
    +
    @@ -1650,7 +1650,7 @@ sudo chmod g+w data/save Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/packages/Default.html b/doc/phpdoc/packages/Default.html index 0ab1111..0caa25c 100644 --- a/doc/phpdoc/packages/Default.html +++ b/doc/phpdoc/packages/Default.html @@ -154,7 +154,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/packages/default.html b/doc/phpdoc/packages/default.html index 36062e5..5b519ce 100644 --- a/doc/phpdoc/packages/default.html +++ b/doc/phpdoc/packages/default.html @@ -308,7 +308,7 @@
  • - \Monster.inc + \Inventory.inc
  • @@ -320,11 +320,11 @@

    Classes, interfaces and traits

    -
    -

    Monster

    -

    Represent an Item in the shop or in the Inventory.

    -
    - « More » +
    +

    Inventory

    +

    Represent the player's Inventory.

    +
    Implemented as a singleton in the session.
    + « More »
    @@ -342,7 +342,7 @@
  • - \craftmine.inc + \dungeon.inc
  • @@ -350,11 +350,53 @@

    Functions

    -
    -

    sendCraftMine

    -

    Sends all data from previous session on page load.

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

    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 »
    @@ -420,26 +462,55 @@
  • - \Inventory.inc + \guild.inc
  • - +
    +

    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 » +
    + +
    -

    Classes, interfaces and traits

    - - -
    -

    Inventory

    -

    Represent the player's Inventory.

    -
    Implemented as a singleton in the session.
    - « 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 »
    + @@ -566,7 +637,7 @@ sudo chmod g+w data/save
  • - \dungeon.inc + \shop.inc
  • @@ -574,53 +645,53 @@ sudo chmod g+w data/save

    Functions

    -
    -

    generateMonster

    -

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

    +
    +

    loadShop

    +

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

    - « More » + « More »
    -
    -

    initDungeon

    -

    Marks the dungeon as accessible in the session.

    +
    +

    getItem

    +

    Gets an Item object from the shop from its name.

    - « More » + « More »
    -
    -

    sendDungeon

    -

    Returns the dungeon array if it was created.

    +
    +

    initShop

    +

    Marks the shop as created in the session.

    - « More » + « 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 » +
    +

    sendShop

    +

    Returns the shop array if it was created.

    +
    + « More »
    -
    -

    launchDungeon

    -

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

    -
    - « 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 »
    -
    -

    sendDungeonProgress

    -

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

    +
    +

    buyItem

    +

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

    - « More » + « More »
    -
    -

    exitDungeon

    -

    Marks the dungeon as not accessible in the session.

    +
    +

    useItem

    +

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

    - « More » + « More »
    @@ -640,7 +711,7 @@ sudo chmod g+w data/save
  • - \account.inc + \mine.inc
  • @@ -648,18 +719,25 @@ sudo chmod g+w data/save

    Functions

    -
    -

    debitAccount

    -

    Debits the account of a certain amount of gold.

    +
    +

    initCraftMine

    +

    Initializes the gold amount and miners count in the session.

    - « More » + « More »
    -
    -

    creditAccount

    -

    Credits the account of a certain amount of gold.

    +
    +

    withdrawMine

    +

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

    - « More » + « More » +
    + +
    +

    sendMine

    +

    Returns the amount of gold currently owned by the player.

    +
    + « More »
    @@ -679,7 +757,7 @@ sudo chmod g+w data/save
  • - \shop.inc + \craftmine.inc
  • @@ -687,53 +765,50 @@ sudo chmod g+w data/save

    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 » +
    +

    sendCraftMine

    +

    Sends all data from previous session on page load.

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

    initShop

    -

    Marks the shop as created in the session.

    -
    - « More » -
    +
    + + + + + + -
    -

    buyItem

    -

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

    + +
    +

    Functions

    +
    +

    debitAccount

    +

    Debits the account of a certain amount of gold.

    - « More » + « More »
    -
    -

    useItem

    -

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

    +
    +

    creditAccount

    +

    Credits the account of a certain amount of gold.

    - « More » + « More »
    @@ -840,101 +915,26 @@ sudo chmod g+w data/save
  • - \guild.inc + \Monster.inc
  • -
    -

    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 » -
    - -
    - - +
    +

    Classes, interfaces and traits

    - - - -
    -

    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.

    +
    +

    Monster

    +

    Represent an Item in the shop or in the Inventory.

    - « More » + « More »
    - - @@ -947,7 +947,7 @@ sudo chmod g+w data/save Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/packages/inc.Inventory.inc.html b/doc/phpdoc/packages/inc.Inventory.inc.html index 2316a5d..4cc9b21 100644 --- a/doc/phpdoc/packages/inc.Inventory.inc.html +++ b/doc/phpdoc/packages/inc.Inventory.inc.html @@ -162,7 +162,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/packages/inc.Item.inc.html b/doc/phpdoc/packages/inc.Item.inc.html index f9c1c45..bea2d41 100644 --- a/doc/phpdoc/packages/inc.Item.inc.html +++ b/doc/phpdoc/packages/inc.Item.inc.html @@ -162,7 +162,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/packages/inc.Monster.inc.html b/doc/phpdoc/packages/inc.Monster.inc.html index dada9c0..234a20d 100644 --- a/doc/phpdoc/packages/inc.Monster.inc.html +++ b/doc/phpdoc/packages/inc.Monster.inc.html @@ -162,7 +162,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/packages/inc.account.inc.html b/doc/phpdoc/packages/inc.account.inc.html index 49b5440..b77b8f4 100644 --- a/doc/phpdoc/packages/inc.account.inc.html +++ b/doc/phpdoc/packages/inc.account.inc.html @@ -167,7 +167,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/packages/inc.craftmine.inc.html b/doc/phpdoc/packages/inc.craftmine.inc.html index fa7ffff..3d98bbd 100644 --- a/doc/phpdoc/packages/inc.craftmine.inc.html +++ b/doc/phpdoc/packages/inc.craftmine.inc.html @@ -160,7 +160,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/packages/inc.dungeon.inc.html b/doc/phpdoc/packages/inc.dungeon.inc.html index 7d5d6a3..a6c2668 100644 --- a/doc/phpdoc/packages/inc.dungeon.inc.html +++ b/doc/phpdoc/packages/inc.dungeon.inc.html @@ -202,7 +202,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/packages/inc.guild.inc.html b/doc/phpdoc/packages/inc.guild.inc.html index f301c47..ed8ab9b 100644 --- a/doc/phpdoc/packages/inc.guild.inc.html +++ b/doc/phpdoc/packages/inc.guild.inc.html @@ -191,7 +191,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/packages/inc.html b/doc/phpdoc/packages/inc.html index c5528a7..b1e32db 100644 --- a/doc/phpdoc/packages/inc.html +++ b/doc/phpdoc/packages/inc.html @@ -252,7 +252,7 @@
  • - \Monster.inc + \Inventory.inc
  • @@ -264,11 +264,11 @@

    Classes, interfaces and traits

    -
    -

    Monster

    -

    Represent an Item in the shop or in the Inventory.

    -
    - « More » +
    +

    Inventory

    +

    Represent the player's Inventory.

    +
    Implemented as a singleton in the session.
    + « More »
    @@ -286,7 +286,7 @@
  • - \craftmine.inc + \dungeon.inc
  • @@ -294,11 +294,53 @@

    Functions

    -
    -

    sendCraftMine

    -

    Sends all data from previous session on page load.

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

    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 »
    @@ -364,26 +406,55 @@
  • - \Inventory.inc + \guild.inc
  • - +
    +

    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 » +
    + +
    -

    Classes, interfaces and traits

    - - -
    -

    Inventory

    -

    Represent the player's Inventory.

    -
    Implemented as a singleton in the session.
    - « 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 »
    + @@ -510,7 +581,7 @@ sudo chmod g+w data/save
  • - \dungeon.inc + \shop.inc
  • @@ -518,53 +589,53 @@ sudo chmod g+w data/save

    Functions

    -
    -

    generateMonster

    -

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

    +
    +

    loadShop

    +

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

    - « More » + « More »
    -
    -

    initDungeon

    -

    Marks the dungeon as accessible in the session.

    +
    +

    getItem

    +

    Gets an Item object from the shop from its name.

    - « More » + « More »
    -
    -

    sendDungeon

    -

    Returns the dungeon array if it was created.

    +
    +

    initShop

    +

    Marks the shop as created in the session.

    - « More » + « 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 » +
    +

    sendShop

    +

    Returns the shop array if it was created.

    +
    + « More »
    -
    -

    launchDungeon

    -

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

    -
    - « 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 »
    -
    -

    sendDungeonProgress

    -

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

    +
    +

    buyItem

    +

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

    - « More » + « More »
    -
    -

    exitDungeon

    -

    Marks the dungeon as not accessible in the session.

    +
    +

    useItem

    +

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

    - « More » + « More »
    @@ -584,7 +655,7 @@ sudo chmod g+w data/save
  • - \account.inc + \mine.inc
  • @@ -592,18 +663,25 @@ sudo chmod g+w data/save

    Functions

    -
    -

    debitAccount

    -

    Debits the account of a certain amount of gold.

    +
    +

    initCraftMine

    +

    Initializes the gold amount and miners count in the session.

    - « More » + « More »
    -
    -

    creditAccount

    -

    Credits the account of a certain amount of gold.

    +
    +

    withdrawMine

    +

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

    - « More » + « More » +
    + +
    +

    sendMine

    +

    Returns the amount of gold currently owned by the player.

    +
    + « More »
    @@ -623,7 +701,7 @@ sudo chmod g+w data/save
  • - \shop.inc + \craftmine.inc
  • @@ -631,53 +709,50 @@ sudo chmod g+w data/save

    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 » +
    +

    sendCraftMine

    +

    Sends all data from previous session on page load.

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

    initShop

    -

    Marks the shop as created in the session.

    -
    - « More » -
    +
    + + + + + + -
    -

    buyItem

    -

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

    + +
    +

    Functions

    +
    +

    debitAccount

    +

    Debits the account of a certain amount of gold.

    - « More » + « More »
    -
    -

    useItem

    -

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

    +
    +

    creditAccount

    +

    Credits the account of a certain amount of gold.

    - « More » + « More »
    @@ -784,101 +859,26 @@ sudo chmod g+w data/save
  • - \guild.inc + \Monster.inc
  • -
    -

    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 » -
    - -
    - - +
    +

    Classes, interfaces and traits

    - - - -
    -

    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.

    +
    +

    Monster

    +

    Represent an Item in the shop or in the Inventory.

    - « More » + « More »
    - - @@ -890,7 +890,7 @@ sudo chmod g+w data/save Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/packages/inc.messages.inc.html b/doc/phpdoc/packages/inc.messages.inc.html index eef0408..23ce6ad 100644 --- a/doc/phpdoc/packages/inc.messages.inc.html +++ b/doc/phpdoc/packages/inc.messages.inc.html @@ -174,7 +174,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/packages/inc.mine.inc.html b/doc/phpdoc/packages/inc.mine.inc.html index 0fb2c21..734a429 100644 --- a/doc/phpdoc/packages/inc.mine.inc.html +++ b/doc/phpdoc/packages/inc.mine.inc.html @@ -174,7 +174,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/packages/inc.perso.inc.html b/doc/phpdoc/packages/inc.perso.inc.html index d724706..8c471aa 100644 --- a/doc/phpdoc/packages/inc.perso.inc.html +++ b/doc/phpdoc/packages/inc.perso.inc.html @@ -181,7 +181,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/packages/inc.savegame.inc.html b/doc/phpdoc/packages/inc.savegame.inc.html index 4009130..2ec1e2d 100644 --- a/doc/phpdoc/packages/inc.savegame.inc.html +++ b/doc/phpdoc/packages/inc.savegame.inc.html @@ -240,7 +240,7 @@ sudo chmod g+w data/save Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/doc/phpdoc/packages/inc.shop.inc.html b/doc/phpdoc/packages/inc.shop.inc.html index fbdefe6..6908e0f 100644 --- a/doc/phpdoc/packages/inc.shop.inc.html +++ b/doc/phpdoc/packages/inc.shop.inc.html @@ -202,7 +202,7 @@ Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.
    Documentation is powered by phpDocumentor and
    - generated on Sun, 08 May 2016 20:44:21 +0200.
    + generated on Mon, 09 May 2016 14:01:23 +0200.
    diff --git a/inc/Inventory.inc b/inc/Inventory.inc index 73d82c8..58cf709 100644 --- a/inc/Inventory.inc +++ b/inc/Inventory.inc @@ -8,9 +8,9 @@ * @author Pierre-Emmanuel Novac */ class Inventory { - /** - * Arrays of array with Item and Item's count - */ + /** + * @var array Arrays of array with Item object and Item's count as int + */ public $items = array(); /** @@ -74,6 +74,12 @@ class Inventory { return $tab; } + /** + * Removes an Item object from the Inventory, not taking into account the Item's count. + * + * @param Item $item Item to remove from the Inventory + * @return void + */ private function _removeItem($item) { foreach($this->items as $k => $object) { if($object[0] == $item) { @@ -83,11 +89,23 @@ class Inventory { } } + /** + * Removes an Item object to the singleton's Inventory from session, not taking into account the Item's count. + * + * @param Item $item Item to remove from the Inventory + * @return void + */ public static function removeItem($item) { $inv = self::get(); $inv->_removeItem($item); } + /** + * Consumes an Item object from the Inventory, decrementing the Item's count and removing it if count reaches 0. + * + * @param Item $item Item to consume from the Inventory + * @return array|false Item and updated Item's count, false if it was not found + */ private function _useItem($item) { foreach($this->items as $k => $object){ if($object[0] == $item) { @@ -103,12 +121,24 @@ class Inventory { return false; } + /** + * Consumes an Item object to the singleton's Inventory from session, decrementing the Item's count and removing it if count reaches 0. + * + * @param Item $item Item to consume from the Inventory + * @return array|false Item and updated Item's count, false if it was not found + */ public static function useItem($item) { $inv = self::get(); $it = $inv->_useItem($item); return $it; } + /** + * Generates an XML tree describing the Inventory + * + * @param SimpleXMLElement $root root XML element to add the Inventory's Items to + * @return void + */ public function addToXML($root) { foreach($this->items as $item) $item[0]->addToXML($root, $item[1]); -- cgit v1.2.3-54-g00ecf