get_db()->prepare(" SELECT slot, effect, value, enchant, grind FROM artifact_effect WHERE artifact = :artifact AND slot = :slot; "); $statement->bindValue(':artifact', $artifact, SQLITE3_TEXT); $statement->bindValue(':slot', $slot, SQLITE3_TEXT); $r = $statement->execute()->fetchArray(SQLITE3_ASSOC); if ($r){ $this->effect = $r["effect"]; $this->value = $r["value"]; $this->enchant = $r["enchant"]; $this->grind = $r["grind"]; $statement = get_context()->get_db()->prepare(" SELECT name FROM effect_artifact WHERE id = :id; "); $statement->bindValue(':id', $this->effect, SQLITE3_TEXT); $r = $statement->execute()->fetchArray(SQLITE3_ASSOC); if ($r){ $this->name = str_replace("{}", $this->value, $r["name"]); } } } /** * Retrieves the artifact effect's slot identifier. * * @see ARTIFACT_EFFECT_SLOT_ID * * @return int Effect slot ID. */ public function get_slot(){ return $this->slot; } /** * Artifact effect identifier. * * @return int Effect ID. */ public function get_effect(){ return $this->effect; } /** * Retrieves the artifact effect name. * * @return string The effect name. */ public function get_name(){ return $this->name; } /** * Retrieves the value of the artifact effect, excluding grinds. * * @return number Effect value. */ public function get_value(){ return $this->value; } /** * Retrieves the grinded value on the effect. * * @return number Effect grinded value. */ public function get_grind(){ return $this->grind; } /** * Checks if the effect has been enchanted. * * @return boolean True if the effect was enchanted, false otherwise */ public function is_enchanted(){ return filter_var($this->enchant, FILTER_VALIDATE_BOOLEAN); } } ?>