| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- require_once($path["entity"] . "Entity.php");
- require_once($path["entity"] . "Monster.php");
- /**
- * Owned monster.
- *
- * Represents an object from the table 'collection'.
- */
- class Monster_Collection extends Entity{
- /**
- * Collection item identifier.
- */
- public $id;
- /**
- * {@see Monster}.
- */
- public $monster;
- /**
- * Stars of the monster.
- */
- public $stars;
- /**
- * Monster level.
- */
- public $_level;
- /**
- * Monster awakened.
- */
- public $awaken;
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * owned monster, populating it and it's items.
- *
- * @param MySQL_connection $db Connection to the database.
- * @param int $id Monster id in the collection.
- */
- public function __construct($db, $id){
- global $path;
- parent::__construct($db);
- $s =
- "SELECT " .
- " id, " .
- " monster, " .
- " stars, " .
- " level, " .
- " awaken " .
- "FROM monster_collection " .
- "WHERE id = $id; ";
- $q = mysqli_query($this->db, $s);
- $set = false;
- if (mysqli_num_rows($q) > 0){
- $r = mysqli_fetch_array($q);
- $this->id = $r["id"];
- $this->stars = $r["stars"];
- $this->level = $r["level"];
- $this->awaken = $r["awaken"];
- $this->monster = new Monster($this->db, $r["monster"]);
- }
- }
- }
- ?>
|