| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- require_once($path["entity"] . "Entity.php");
- //require_once($path["entity"] . "Monster.php");
- /**
- * Monster.
- *
- * Represents an object from the table 'monster'.
- */
- class Fusion extends Entity{
- /**
- * {@see Monster} to fuse.
- */
- public $target;
- /**
- * {@see Monster} material.
- */
- public $source = [];
- /**
- * Stars of the monster to fuse.
- */
- public $target_stars;
- /**
- * Stars of the source monsters.
- */
- public $source_stars;
- /**
- * Monster materials level.
- */
- public $source_level;
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * project, populating it and it's items.
- *
- * @param SQLite3 $db Connection to the database.
- * @param int $id Target monster id.
- */
- public function __construct($db, $id){
- global $path;
- parent::__construct($db);
- $s =
- "SELECT " .
- " target, " .
- " target_stars, " .
- " source, " .
- " source_stars, " .
- " source_level " .
- "FROM fusion " .
- "WHERE target = $id; ";
- $q = $this->db->query($s);
- $set = false;
- while ($r = $q->fetchArray(SQLITE3_ASSOC)){
- if ($set == false){
- $this->target_stars = $r["target_stars"];
- $this->source_stars = $r["source_stars"];
- $this->source_level = $r["source_level"];
- $this->target = new Monster($this->db, $r["target"]);
- $set = true;
- }
- array_push($this->source, new Monster($this->db, $r["source"]));
- }
- }
- }
- ?>
|