query($s); $r = $q->fetchArray(SQLITE3_ASSOC); $this->id = $r["id"]; $this->uid = $r["uid"]; $this->dtime = $r["dtime"]; $type = 0; if (APPLICATION::valid_id("RAID_RIFT_DUNGEON_ID", $r["area"]) && $r["stage"] < 1){ $type = AREA_TYPE_ID::RIFT_RAID_DUNGEON; } elseif (APPLICATION::valid_id("SCENARIO_ID", $r["area"])){ $type = AREA_TYPE_ID::SCENARIO; } elseif (APPLICATION::valid_id("ELEMENTAL_RIFT_DUNGEON_ID", $r["area"]) && $r["stage"] < 1){ $type = AREA_TYPE_ID::RIFT_DUNGEON; } elseif (APPLICATION::valid_id("DUNGEON_ID", $r["area"])){ $type = AREA_TYPE_ID::CAIROS_DUNGEON; } $this->area = new K_Area($r["area"], $type); $this->stage = $r["stage"]; $this->difficulty = $r["difficulty"]; $this->win = $r["win"]; $this->time = $r["time"]; $this->mana = $r["mana"]; $this->energy = $r["energy"]; $this->crystal = $r["crystal"]; $this->helper = $r["helper"]; $this->score = $r["score"]; $this->rank = $r["rank"]; $s = " SELECT unit, k_unit, (SELECT count(id) FROM unit WHERE unit.unit = k_unit) AS owned, leader, front FROM run_party WHERE run = $id ORDER BY front DESC, leader DESC; "; $q = $db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ if ($r["owned"] > 0){ array_push($this->party, new Unit($r["unit"], false)); } else{ array_push($this->party, new K_Unit($r["k_unit"], false)); } if ($r["leader"] == 1){ $this->leader = $r["unit"]; } if ($r["front"] == 1){ array_push($this->frontline, $r["unit"]); } } $s = " SELECT item, amount FROM run_drop_item WHERE run = $this->id; "; $q = $db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ $i = new Inventory($r["item"]); $i->amount = $r["amount"]; array_push($this->item, $i); } $s = " SELECT unit FROM run_drop_unit WHERE run = $this->id; "; $q = $db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ array_push($this->unit, new K_Unit($r["unit"])); } $s = " SELECT unit FROM run_drop_sd WHERE run = $this->id; "; $q = $db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ array_push($this->sd, new K_Unit($r["unit"])); } $s = " SELECT unit, amount FROM run_drop_unit_pieces WHERE run = $this->id; "; $q = $db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ $i = [ "unit" => new K_Unit($r["unit"]), "amount" => $r["amount"] ]; array_push($this->unit_piece, $i); } $s = " SELECT amount FROM run_drop_shapeshifting WHERE run = $this->id; "; $q = $db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); if ($r){ $this->shapeshifting = $r["amount"]; } $s = " SELECT id, type, slot, stars, ancient, quality, value, efficiency, main_stat, main_stat_value, innate_stat, innate_stat_value, substat_1, substat_1_value, substat_2, substat_2_value, substat_3, substat_3_value, substat_4, substat_4_value FROM run_drop_rune WHERE run = $this->id; "; $q = $db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ $rune = new Rune($r["id"]); if (!isset($rune->id)){ $rune->id = $r["id"]; $rune->level = 0; $rune->assigned_to = null; $rune->type = new K_Rune_Set($r["type"]); $rune->slot = $r["slot"]; $rune->stars = $r["stars"]; $rune->ancient = $r["ancient"]; $rune->quality = $r["quality"]; $rune->original_quality = $r["quality"]; $rune->value = $r["value"]; $rune->value = 0; $rune->efficiency = $r["efficiency"]; // TODO: Calculate? $rune->max_efficiency = $r["efficiency"]; $rune->main_stat = $r["main_stat"]; $rune->main_stat_value = $r["main_stat_value"]; $rune->innate_stat = $r["innate_stat"]; $rune->innate_stat_value = $r["innate_stat_value"]; $rune->substat_1 = $r["substat_1"]; $rune->substat_1_value = $r["substat_1_value"]; $rune->substat_1_enchant = 0; $rune->substat_1_grind = 0; $rune->substat_2 = $r["substat_2"]; $rune->substat_2_value = $r["substat_2_value"]; $rune->substat_2_enchant = 0; $rune->substat_2_grind = 0; $rune->substat_3 = $r["substat_3"]; $rune->substat_3_value = $r["substat_3_value"]; $rune->substat_3_enchant = 0; $rune->substat_3_grind = 0; $rune->substat_4 = $r["substat_4"]; $rune->substat_4_value = $r["substat_4_value"]; $rune->substat_4_enchant = 0; $rune->substat_4_grind = 0; $rune->refresh_names(); } array_push($this->rune, $rune); } } } ?>