db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); $this->id = $r["id"]; $this->name = $r["name"]; $this->description = $r["description"]; $this->slot = $r["slot"]; $this->cooltime = $r["cooltime"]; $this->hits = $r["hits"]; $this->passive = $r["passive"]; $this->aoe = $r["aoe"]; $this->max_level = $r["max_level"]; $this->multiplier_formula = $r["multiplier_formula"]; $s = "SELECT " . " skill, " . " level " . "FROM k_skill_level " . "WHERE skill = " . $this->id . " " . "ORDER BY level; "; $q = $this->db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ array_push($this->level, new K_Skill_Level($this->db, $r["skill"], $r["level"])); } $s = "SELECT effect " . "FROM k_skill_effect " . "WHERE skill = " . $this->id . "; "; $q = $this->db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ array_push($this->effect, new K_Effect($this->db, $r["effect"])); } } /** * Gets the path to the skill image. The image must be in the * img/skill/ directory, and its name must be the set id, * padded with '0' to 8 digits, and the extension must be '.png'. * * @return Path to the image, or a path to a fixed unknown image if it * doesn't exist. */ public function get_image(){ global $base_dir; global $path; if (file_exists($base_dir . "img/skill/" . str_pad($this->id, 8, '0', STR_PAD_LEFT) . ".png")){ return $path["img"]["skill"] . str_pad($this->id, 8, '0', STR_PAD_LEFT) . ".png"; } else{ return $path["img"]["root"] . "unknown.png"; } } } ?>