db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); if ($r){ $this->id = $r["id"]; $this->assigned_to = $r["assigned_to"]; $this->type = new K_Rune_Set($this->db, $r["type"]); $this->slot = $r["slot"]; $this->stars = $r["stars"]; $this->level = $r["level"]; $this->ancient = $r["ancient"]; $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->main_stat = $r["main_stat"]; $this->main_stat_value = $r["main_stat_value"]; $this->innate_stat = $r["innate_stat"]; $this->innate_stat_value = $r["innate_stat_value"]; $this->substat_1 = $r["substat_1"]; $this->substat_1_value = $r["substat_1_value"]; $this->substat_1_enchant = $r["substat_1_enchant"]; $this->substat_1_grind = $r["substat_1_grind"]; $this->substat_2 = $r["substat_2"]; $this->substat_2_value = $r["substat_2_value"]; $this->substat_2_enchant = $r["substat_2_enchant"]; $this->substat_2_grind = $r["substat_2_grind"]; $this->substat_3 = $r["substat_3"]; $this->substat_3_value = $r["substat_3_value"]; $this->substat_3_enchant = $r["substat_3_enchant"]; $this->substat_3_grind = $r["substat_3_grind"]; $this->substat_4 = $r["substat_4"]; $this->substat_4_value = $r["substat_4_value"]; $this->substat_4_enchant = $r["substat_4_enchant"]; $this->substat_4_grind = $r["substat_4_grind"]; $this->refresh_names(); } } /** * Calculates name variables. */ public function refresh_names(){ $this->main_stat_name = $this->stat_name($this->main_stat); $this->innate_stat_name = $this->stat_name($this->innate_stat); $this->substat_1_name = $this->stat_name($this->substat_1); $this->substat_2_name = $this->stat_name($this->substat_2); $this->substat_3_name = $this->stat_name($this->substat_3); $this->substat_4_name = $this->stat_name($this->substat_4); $this->quality_name = $this->get_quality_name($this->quality); $this->original_quality_name = $this->get_quality_name($this->original_quality); } /** * Gets a stat name from the mappings. * * @param int $stat Stat id. * @return string Stat name (Uppercase) */ private function stat_name($stat){ switch ($stat){ case RUNE_STAT_ID::HP: return "HP"; case RUNE_STAT_ID::HP_P: return "HP%"; case RUNE_STAT_ID::ATK: return "ATK"; case RUNE_STAT_ID::ATK_P: return "ATK%"; case RUNE_STAT_ID::DEF: return "DEF"; case RUNE_STAT_ID::DEF_P: return "DEF%"; case RUNE_STAT_ID::SPD: return "SPD"; case RUNE_STAT_ID::CRR: return "CRR"; case RUNE_STAT_ID::CRD: return "CRD"; case RUNE_STAT_ID::RES: return "RES"; case RUNE_STAT_ID::ACC: return "ACC"; default: return ""; } } /** * Gets a stat name frm 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 ""; } } } ?>