prepare(" SELECT id, type, attribute, archetype, level, quality, original_quality, value, efficiency, max_efficiency, locked FROM artifact WHERE id = :id; "); $statement->bindValue(':id', $id, SQLITE3_TEXT); $r = $statement->execute()->fetchArray(SQLITE3_ASSOC); if ($r){ $this->id = $r["id"]; $this->type = $r["type"]; $this->element = $r["attribute"]; $this->archetype = $r["archetype"]; $this->level = $r["level"]; $this->quality = $r["quality"]; $this->original_quality = $r["original_quality"]; $this->value = $r["value"]; $this->efficiency = $r["efficiency"]; $this->max_efficiency = $r["max_efficiency"]; $this->locked = $r["locked"]; $this->quality_name = $this->get_quality_name($this->quality); $this->original_quality_name = $this->get_quality_name($this->original_quality); // Get stat $this->stat = new Artifact_Stat($this->id); // Get effects $statement = $db->prepare(" SELECT slot FROM artifact_effect WHERE artifact = :artifact ORDER BY slot; "); $statement->bindValue(':artifact', $this->id, SQLITE3_TEXT); $q = $statement->execute(); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ array_push($this->effects, new Artifact_Effect($this->id, $r["slot"])); } } } /** * Gets the quality name from the mappings. * * @param int $q Quality id. * @return string Quality (Uppercase) */ private function get_quality_name($q){ switch ($q){ case QUALITY_ID::NORMAL: return "NORMAL"; case QUALITY_ID::MAGIC: return "MAGIC"; case QUALITY_ID::RARE: return "RARE"; case QUALITY_ID::HERO: return "HERO"; case QUALITY_ID::LEGEND: return "LEGEND"; default: return ""; } } } ?>