get_db()->prepare(" SELECT id, family, monster FROM monster_transformation WHERE id = :id; "); $statement->bindValue(':id', $id, SQLITE3_TEXT); $r = $statement->execute()->fetchArray(SQLITE3_ASSOC); if ($r){ $this->id = $r["id"]; $this->family = $r["family"]; $this->monster = $r["monster"]; $this->load_skills(); } } /** * Loads the information about the monster skills in the transformed form. */ private function load_skills(){ $this->skill = []; $statement = get_context()->get_db()->prepare(" SELECT skill FROM skill, monster_skill WHERE id = skill AND monster = :id ORDER BY slot; "); $statement->bindValue(':id', $this->id, SQLITE3_TEXT); $q = $statement->execute(); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ array_push($this->skill, new Skill($r["skill"])); } } /** * Gets the path to the monster image. The image must be in the * img/monster/ directory, and it's name must be the monster id, * padded with '0' to 8 digits, and the extension must be '.png'. * * @return string Image URL, or a fixed unknown image. */ public function get_image(){ return APPLICATION::img("UNIT", $this->id); } } ?>