prepare(" SELECT id, name, description, area, affected_stat, element, max_level FROM k_decoration WHERE id = :id; "); $statement->bindValue(':id', $id, SQLITE3_INTEGER); $r = $statement->execute()->fetchArray(SQLITE3_ASSOC); if ($r){ $this->id = $r["id"]; $this->name = HTML::e($r["name"]); $this->description = HTML::e($r["description"]); $this->area = $r["area"]; $this->stat = $r["affected_stat"]; $this->element = $r["element"]; $this->max_level = $r["max_level"]; $statement = $db->prepare(" SELECT level, bonus, cost FROM k_decoration_level WHERE decoration = :id "); $statement->bindValue(':id', $id, SQLITE3_INTEGER); $q = $statement->execute(); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ $this->level_bonus[$r["level"]] = $r["bonus"]; $this->level_cost[$r["level"]] = $r["cost"]; } } } /** * Gets the path to the building image. The image must be in the * img/decoration/ directory, and its name must be the decoration * id, padded with '0' to 4 digites, and the extension must be '.png'. * * @return string Image URL, or a fixed unknown image. */ public function get_image(){ return APPLICATION::img("DECORATION", $this->id); } } ?>