view = $path["view"] . "frame/portrait.php"; $id = $params["id"]; $s = "SELECT id " . "FROM monster_collection " . "WHERE id = " . $id . "; "; $q = $this->db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); if ($r){ $this->collection = new Monster_Collection($this->db, $r["id"]); $this->id = $id; $this->name = $this->collection->monster->name; $this->name_aw = $this->collection->monster->name_aw; $this->stars = $this->collection->stars; $this->default_stars = $this->collection->monster->stars; $this->skill = $this->collection->monster->skill; $this->level = $this->collection->level; $this->max_level = 10 + (5 * $this->stars); $this->awaken = $this->collection->awaken; $this->img = $this->collection->monster->image; $this->img_aw = $this->collection->monster->image_aw; $this->element = $this->collection->monster->element; if ($this->level == 0 || $this->stars == 0){ $this->owned = false; } if ($this->awaken == 1){ $this->cur_name = $this->name_aw; $this->cur_img = $this->img_aw; $this->img_star = $star_src = $path["img"]["layout"] . "icon/star_aw.png"; } else{ $this->cur_name = $this->element . " " . $this->name; $this->cur_img = $this->img; $this->img_star = $star_src = $path["img"]["layout"] . "icon/star.png"; } // Get stats $l = $this->level; $t = $this->stars; $i = $this->collection->monster->id; $w = $this->awaken; $s = "SELECT min + (((max - min) / ((stars + 2) * 5)) * ($l + $l / ((stars + 2) * 5))) AS stat " . "FROM monster_stat " . "WHERE " . " monster = $i AND " . " stars = $t AND " . " awake = $w AND " . " stat = 'HP'; "; error_log($s); $q = $this->db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); if ($r){ $this->hp = $r["stat"]; } $s = "SELECT min + (((max - min) / ((stars + 2) * 5)) * ($l + $l / ((stars + 2) * 5))) AS stat " . "FROM monster_stat " . "WHERE " . " monster = $i AND " . " stars = $t AND " . " awake = $w AND " . " stat = 'ATK'; "; $q = $this->db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); if ($r){ $this->atk = $r["stat"]; } $s = "SELECT min + (((max - min) / ((stars + 2) * 5)) * ($l + $l / ((stars + 2) * 5))) AS stat " . "FROM monster_stat " . "WHERE " . " monster = $i AND " . " stars = $t AND " . " awake = $w AND " . " stat = 'DEF'; "; $q = $this->db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); if ($r){ $this->def = $r["stat"]; } $s = "SELECT min AS stat " . "FROM monster_stat " . "WHERE " . " monster = $i AND " . " stars = $t AND " . " awake = $w AND " . " stat = 'SPD'; "; $q = $this->db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); if ($r){ $this->spd = $r["stat"]; } $s = "SELECT min AS stat " . "FROM monster_stat " . "WHERE " . " monster = $i AND " . " stars = $t AND " . " awake = $w AND " . " stat = 'CRIR'; "; $q = $this->db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); if ($r){ $this->crir = $r["stat"]; } $s = "SELECT min AS stat " . "FROM monster_stat " . "WHERE " . " monster = $i AND " . " stars = $t AND " . " awake = $w AND " . " stat = 'CRID'; "; $q = $this->db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); if ($r){ $this->crid = $r["stat"]; } $s = "SELECT min AS stat " . "FROM monster_stat " . "WHERE " . " monster = $i AND " . " stars = $t AND " . " awake = $w AND " . " stat = 'RES'; "; $q = $this->db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); if ($r){ $this->res = $r["stat"]; } $s = "SELECT min AS stat " . "FROM monster_stat " . "WHERE " . " monster = $i AND " . " stars = $t AND " . " awake = $w AND " . " stat = 'ACC'; "; $q = $this->db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); if ($r){ $this->acc = $r["stat"]; } } } } ?>