db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); $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_pices = true; $this->id = new K_Unit($this->db, $r["id"]); $this->name = HTML::e($this->id->title) . " Pieces"; $this->description = HTML::e($this->id->title) . " Pieces"; } else{ $this->is_monster_pices = false; $this->id = $r["id"]; $this->name = HTML::e($r["name"]); $this->description = HTML::e($r["description"]); } } /** * Gets the path to the item image. The image must be in the * img/content/inventory/ directory, and its name must be the item id, * padded with '0' to 9 digites, and the extension must be '.png'. * * @return string Image URL, or a fixed unknown image. */ public function get_image(){ if (file_exists(PATH::BASE . "img/inventory/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png")){ return URL::IMG["INVENTORY"] . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png"; } else{ return URL::IMG["UNKNOWN"]; } } } ?>