db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); $this->type = $r["type"]; $this->amount = $r["amount"]; if ($r["type"] == $INVENTORY_TYPE["GUILD_MONSTER_PIECE"] || $r["type"] == $INVENTORY_TYPE["MONSTER_PIECE"]){ $this->is_monster_pices = true; $this->id = new K_Unit($this->db, $r["id"]); $this->name = $this->id->title . " Pieces"; $this->description = $this->id->title . " Pieces"; } else{ $this->is_monster_pices = false; $this->id = $r["id"]; $this->name = $r["name"]; $this->description = $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 monster id, * padded with '0' to 9 digites, and the extension must be '.png'. * * @return path to the image, or a path to a fixed unknown image if it * doesn't exist. */ public function get_image(){ global $base_dir; global $path; if (file_exists($base_dir . "img/content/inventory/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png")){ return $path["img"]["content"] . "inventory/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png"; } else{ return $path["img"]["layout"] . "unknown.png"; } } } ?>