get_db()->prepare(" SELECT id, name, description, area, affected_stat, element, max_level FROM decorative WHERE id = :id; "); $statement->bindValue(':id', $id, SQLITE3_TEXT); $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 = get_context()->get_db()->prepare(" SELECT level, bonus, cost FROM decorative_level WHERE decorative = :id "); $statement->bindValue(':id', $id, SQLITE3_TEXT); $q = $statement->execute(); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ $this->level_bonus[$r["level"]] = $r["bonus"]; $this->level_cost[$r["level"]] = $r["cost"]; } } } /** * Retrieves the decorative identifier. * * @return int Decorative ID. */ public function get_id(){ return $this->id; } /** * Retrieves the name of the decorative. * * @return string Decorative name. */ public function get_name(){ return $this->name; } /** * Retrieves $the decorative description. * * @return string Decorative description. */ public function get_description(){ return $this->description; } /** * Retrieves the identifier of the area where the decorative has an effect * * @see AREA_TYPE_ID * * @return int Area type ID, null if the decorative has a global effect. */ public function get_area_type(){ return $this->area; } /** * Retrieves the stat raised by the decorative, if any. * * @see STAT_ID * * @return int Stat ID, null if non applicable. */ public function get_stat(){ return $this->stat; } /** * Retrieves the element the effect applies to, if any. * * @see ELEMENT_ID * * @return int Element ID, null if not an elemental decorative. */ public function get_element(){ return $this->element; } /** * Retrieves the maximum level of the decorative. * * @return int Maximum level. */ public function get_max_level(){ return $this->max_level; } /** * Retrieves a list of bonuses indexed by the decorative level. * * @return number[] Array of bonuses by level. */ public function get_level_bonus(){ return $this->level_bonus; } /** * Retrieves a list of prices indexed by the decorative level. * * @return number[] Array of prices by level. */ public function get_level_cost(){ return $this->level_cost; } /** * Gets the path to the decorative image. * * @return string Image URL, or a fixed unknown image. */ public function get_image(){ return APPLICATION::img("DECORATION", $this->id); } } ?>