get_db()->prepare($s); $statement->bindValue(':player', $player, SQLITE3_TEXT); $statement->bindValue(':id', $id, SQLITE3_TEXT); $statement->bindValue(':type', $type, SQLITE3_TEXT); $r = $statement->execute()->fetchArray(SQLITE3_ASSOC); if ($r){ $this->player = $r["player"]; $this->type = $r["type"]; $this->amount = $r["amount"]; if ($r["type"] == INVENTORY_TYPE_ID::GUILD_MONSTER_PIECE || $r["type"] == INVENTORY_TYPE_ID::MONSTER_PIECE){ $this->is_monster_pieces = true; $this->id = new Monster($r["id"]); $this->name = HTML::e($this->id->get_title()) . " Pieces"; $this->description = HTML::e($this->id->get_title()) . " Pieces"; } else{ $this->is_monster_pices = false; $this->id = $r["id"]; $this->name = HTML::e($r["name"]); $this->description = HTML::e($r["description"]); } } } /** * Retrieves the owner's player identifier * * @return string Owner's ID. */ public function get_player(){ return $this->player; } /** * Retrieves the item identifier. * If the item is a monster piece, the unit instance will be returned instead * * @return int|Monster Item ID or monster instance */ public function get_id(){ return $this->id; } /** * Retrieves the item name. * * @return string Item name. */ public function get_name(){ return $this->name; } /** * Retrieves the item type. * * @return int Item type. */ public function get_type(){ return $this->type; } /** * Retrieves the owned amount of the item. * * @return int Owned amount. */ public function get_amount(){ return $this->amount; } /** * Checks if the item is a monste piece. * * @return boolean True for monster pieces, false otherwise. */ public function is_monster_pieces(){ return $this->is_monster_pieces; } /** * Gets the path to the item image. * * @return string Image URL, or a fixed unknown image. */ public function get_image(){ return APPLICATION::img("INVENTORY", $this->id); } } ?>