| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
- require_once($path["entity"] . "Entity.php");
- /**
- * Monster skill.
- *
- * Represents an object from the table 'k_skill'.
- */
- class K_Leader_Skill extends Entity{
- /**
- * Skill identifier.
- */
- public $id;
- /**
- * Skill attribute.
- */
- public $attribute;
- /**
- * Attribute incrrease amount.
- */
- public $amount;
- /**
- * Effect area.
- */
- public $area;
- /**
- * Affected elements.
- */
- public $element;
- /**
- * 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 Skill identifier.
- */
- public function __construct($db, $id){
- global $path;
- parent::__construct($db);
- $s =
- "SELECT " .
- " id, " .
- " attribute, " .
- " amount, " .
- " area, " .
- " element " .
- "FROM k_leader_skill " .
- "WHERE id = $id; ";
- $q = $this->db->query($s);
- $r = $q->fetchArray(SQLITE3_ASSOC);
- $this->id = $r["id"];
- $this->attribute = $r["attribute"];
- $this->amount = $r["amount"];
- $this->area = $r["area"];
- $this->element = $r["element"];
- }
-
- public function get_image(){
- global $base_dir;
- global $path;
- if (file_exists($base_dir . "img/content/skill_leader/" . str_pad($this->id, 4, '0', STR_PAD_LEFT) . ".png")){
- return $path["img"]["content"] . "skill_leader/" . str_pad($this->id, 4, '0', STR_PAD_LEFT) . ".png";
- }
- else{
- return $path["img"]["layout"] . "unknown.png";
- }
- }
-
- public function create_description(){
- $s = "Increases the " . $this->attribute . " of ally monsters ";
- if (strlen($this->element) > 0){
- $s = $s . " with " . $this->element . " attribute ";
- }
- $s = $s . " by " . $this->amount . "%";
- switch ($this->area){
- case "Dungeon":
- $s = $s . " in the Dungeons";
- break;
- case "Arena":
- $s = $s . " in the Arena";
- break;
- case "Guild":
- $s = $s . " in Guild content";
- break;
- }
- $s = $s . ".";
- return $s;
- }
- }
- ?>
|