| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?php
- require_once($path["entity"] . "Entity.php");
- /**
- * Monster.
- *
- * Represents an object from the table 'monster'.
- */
- class Monster_Skill extends Entity{
- /**
- * Skill identifier.
- */
- public $id;
- /**
- * Skill order.
- */
- public $idx;
- /**
- * Skill name.
- */
- public $name;
- /**
- * Skill description.
- */
- public $desc;
- /**
- * Wether the skill is passive or not.
- */
- public $pasive;
- /**
- * Base monster. {@see Monster_Base}
- */
- public $awaken;
- /**
- * Wether the skill is a leader one.
- */
- public $leader;
- /**
- * Skill image.
- */
- public $img;
- /**
- * The {@see Monster_Skill} upgrading this one.
- */
- public $upgrade;
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * skill, populating it and it's items.
- *
- * @param SQLite3 $db Connection to the database.
- * @param int $id Monster identifier.
- */
- public function __construct($db, $id){
- global $path;
- parent::__construct($db);
- $s =
- "SELECT " .
- " id, " .
- " idx, " .
- " name, " .
- " desc, " .
- " passive, " .
- " upgrade, " .
- " awaken, " .
- " leader, " .
- " img, " .
- " cooldown " .
- "FROM monster_skill " .
- "WHERE id = $id; ";
- $q = $this->db->query($s);
- $r = $q->fetchArray(SQLITE3_ASSOC);
- if ($r){
- $this->id = $r["id"];
- $this->idx = $r["idx"];
- $this->name = $r["name"];
- $this->desc = $r["desc"];
- $this->passive = $r["passive"];
- $this->awaken = $r["awaken"];
- $this->leader = $r["leader"];
- $this->img = $path["img"]["skill"] . $r["img"];
- $this->cooldown = $r["cooldown"];
- if ($r["upgrade"] != 0){
- $this->upgrade = new Monster_Skill($this->db, $r["upgrade"]);
- }
- }
- }
- }
- ?>
|