slot; } /** * Retrieves the stat identifier. * * @see RUNE_STAT_ID * * @return number Stat ID. */ public function get_stat(){ return $this->stat; } /** * Retrieves the stat name. * * @return string Stat name. */ public function get_stat_name(){ return $this->stat_name; } /** * Retrieves the stat value, without grinds. * * @return number Stat value. */ public function get_value(){ return $this->value; } /** * Retrieves the grinded value of the stat. * * @return number Grinded value. */ public function get_grind(){ return $this->grind; } /** * Checks if the stat has been changed by gems. * * @return bool True if the stat was enchanted, false otherwise. */ public function is_enchanted(){ return $this->enchant; } /** * Constructor. * * Searches the database and retrieves the information about the * rune stat, populating it and it's items. * * @param int $id Rune id. */ public function __construct($rune, $slot){ $statement = get_context()->get_db()->prepare(" SELECT slot, stat, value, enchant, grind FROM rune_stat WHERE rune = :rune AND slot = :slot; "); $statement->bindValue(':rune', $rune, SQLITE3_TEXT); $statement->bindValue(':slot', $slot, SQLITE3_TEXT); $r = $statement->execute()->fetchArray(SQLITE3_ASSOC); if ($r){ $this->slot = $r["slot"]; $this->stat = $r["stat"]; $this->value = $r["value"]; if ($r["enchant"] == 1){ $this->enchant = true; } else{ $this->enchant = false; } $this->grind = $r["grind"]; switch ($this->stat){ case RUNE_STAT_ID::HP: $this->stat_name = "HP"; break; case RUNE_STAT_ID::HP_P: $this->stat_name = "HP%"; break; case RUNE_STAT_ID::ATK: $this->stat_name = "ATK"; break; case RUNE_STAT_ID::ATK_P: $this->stat_name = "ATK%"; break; case RUNE_STAT_ID::DEF: $this->stat_name = "DEF"; break; case RUNE_STAT_ID::DEF_P: $this->stat_name = "DEF%"; break; case RUNE_STAT_ID::SPD: $this->stat_name = "SPD"; break; case RUNE_STAT_ID::CRR: $this->stat_name = "CRR"; break; case RUNE_STAT_ID::CRD: $this->stat_name = "CRD"; break; case RUNE_STAT_ID::RES: $this->stat_name = "RES"; break; case RUNE_STAT_ID::ACC: $this->stat_name = "ACC"; break; } } } } ?>