0, "crystal" => 0, "energy" => 0, "energy_max" => 0, "arena_energy" => 0, "arena_energy_max" => 0, "darkportal_energy" => 0, "darkportal_energy_max" => 0, "dimension_energy" => 0, "dimension_energy_max" => 0, "honor_point" => 0, "guild_point" => 0, "honor_medal" => 0, "honor_mark" => 0, "event_coin" => 0, "social_point" => 0, "ancient_stone" => 0, "costume_point" => 0, ]; /** * @var \Building[] List of Buildings. */ public $building = []; /** * @var \Decoration[] List of Decorations. */ public $decoration = []; /** * @var \Inventory[] List of Scrolls in Inventory. */ public $inventory_scroll = []; /** * @var \Inventory[] List of rune crafting items in Inventory. */ public $inventory_craft_rune = []; /** * @var \Inventory[] List of rune crafting items in Inventory. */ public $inventory_craft = []; /** * @var \Inventory[] List of rune crafting items in Inventory. */ public $inventory_essence = []; /** * @var \Record[] Player record runs. */ public $record = []; /** * Constructor. * * Searches the database and retrieves the information about the * player, populating it and it's items. * * @param int $id Monster identifier. * @param bool $complete If false, query only monster and k_monster. * @global int Player ID. * @global resource Database connection. */ public function __construct($id, $complete = true){ global $UID; global $db; $s = " SELECT uid, name, level, country, experience, rep, mana, crystal, energy, energy_max, arena_energy, arena_energy_max, darkportal_energy, darkportal_energy_max, dimension_energy, dimension_energy_max, honor_point, guild_point, honor_medal, honor_mark, event_coin, social_point, costume_point, joined, top_rank_arena, top_rank_world_arena, top_rank_special_league, top_rank_gw, top_rank_siege, top_rank_wboss, top_rank_toan, top_rank_toah FROM player WHERE uid = '$UID'; "; $q = $db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); if ($r){ $this->uid = $r["uid"]; $this->name = $r["name"]; $this->level = $r["level"]; $this->country = $r["country"]; $this->experience = $r["experience"]; if (strlen($r["rep"]) > 0){ $this->rep = new Unit($r["rep"]); } $this->currency["mana"] = $r["mana"]; $this->currency["crystal"] = $r["crystal"]; $this->currency["energy"] = $r["energy"]; $this->currency["energy_max"] = $r["energy_max"]; $this->currency["arena_energy"] = $r["arena_energy"]; $this->currency["arena_energy_max"] = $r["arena_energy_max"]; $this->currency["darkportal_energy"] = $r["darkportal_energy"]; $this->currency["darkportal_energy_max"] = $r["darkportal_energy_max"]; $this->currency["dimension_energy"] = $r["dimension_energy"]; $this->currency["dimension_energy_max"] = $r["dimension_energy_max"]; $this->currency["honor_point"] = $r["honor_point"]; $this->currency["guild_point"] = $r["guild_point"]; $this->currency["honor_medal"] = $r["honor_medal"]; $this->currency["honor_mark"] = $r["honor_mark"]; $this->currency["event_coin"] = $r["event_coin"]; $this->currency["social_point"] = $r["social_point"]; $this->currency["costume_point"] = $r["costume_point"]; $this->joined = $r["joined"]; $this->top_rank_arena = $r["top_rank_arena"]; $this->top_rank_world_arena = $r["top_rank_world_arena"]; $this->top_rank_special_league = $r["top_rank_special_league"]; $this->top_rank_gw = $r["top_rank_gw"]; $this->top_rank_siege = $r["top_rank_siege"]; $this->top_rank_wboss = $r["top_rank_wboss"]; $this->top_rank_toan = $r["top_rank_toan"]; $this->top_rank_toah = $r["top_rank_toah"]; } $s = " SELECT unit FROM defense WHERE uid = '$UID' ORDER BY position; "; $q = $db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ array_push($this->defense, new Unit($r["unit"], false)); } $s = " SELECT unit, position FROM gw_defense WHERE uid = '$UID' ORDER BY position; "; $q = $db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ if ($r["position"] <= 3){ array_push($this->gw_defense[0], new Unit($r["unit"], false)); } else{ array_push($this->gw_defense[1], new Unit($r["unit"], false)); } } $s = " SELECT building.id, min(building) FROM building, k_building WHERE uid = '$UID' AND building.building = k_building.id GROUP BY building.building; "; $q = $db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ array_push($this->building, new Building($r["id"])); } $s = " SELECT id FROM decoration WHERE uid = '$UID'; "; $q = $db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ array_push($this->decoration, new Decoration($r["id"])); } $s = " SELECT id, type FROM inventory WHERE uid = '$UID' AND type = " . INVENTORY_TYPE_ID::SCROLL . " AND amount > 0 ORDER BY inventory.type; "; $q = $db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ array_push($this->inventory_scroll, new Inventory($r["id"], $r["type"])); } // Rune crafting items are marked as generic crafting. $s = " SELECT inventory.id AS id, inventory.type AS type FROM inventory WHERE inventory.uid = '$UID' AND inventory.type = " . INVENTORY_TYPE_ID::RUNE_CRAFT . " AND amount > 0 ORDER BY inventory.id; "; $q = $db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ array_push($this->inventory_craft_rune, new Inventory($r["id"], $r["type"])); } $s = " SELECT inventory.id AS id, inventory.type AS type FROM inventory WHERE inventory.uid = '$UID' AND inventory.type = " . INVENTORY_TYPE_ID::CRAFT_STUFF . " AND amount > 0 ORDER BY inventory.id; "; $q = $db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ array_push($this->inventory_craft, new Inventory($r["id"], $r["type"])); } $s = " SELECT inventory.id AS id, inventory.type AS type FROM inventory, k_inventory WHERE inventory.id = k_inventory.id AND inventory.type = k_inventory.type AND inventory.uid = '$UID' AND inventory.type = " . INVENTORY_TYPE_ID::ESSENCES . " AND amount > 0 ORDER BY upper(name) NOT LIKE '%MAGIC%', upper(name) NOT LIKE '%FIRE%', upper(name) NOT LIKE '%WATER%', upper(name) NOT LIKE '%WIND%', upper(name) NOT LIKE '%LIGHT%', upper(name) NOT LIKE '%DARK%', upper(name) NOT LIKE '%LOW%', upper(name) NOT LIKE '%MID%', upper(name) NOT LIKE '%HIGH%' ; "; $q = $db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ array_push($this->inventory_essence, new Inventory($r["id"], $r["type"])); } $s = " SELECT uid, area_type, area FROM record WHERE uid = '$UID' ORDER BY CASE WHEN (area_type = 2 AND area = 8001) THEN 1 -- Giant's Keep WHEN (area_type = 2 AND area = 9001) THEN 2 -- Dragon's Lair WHEN (area_type = 2 AND area = 6001) THEN 3 -- Necropolis WHEN (area_type = 2 AND area = 9501) THEN 4 -- Steel Fortress WHEN (area_type = 2 AND area = 9502) THEN 5 -- Punisher's Crypt WHEN (area_type = 4) THEN 6 -- Rift of Worlds WHEN (area_type = 3 AND area = 1001) THEN 7 -- Rift Dungeon - Ice Beast WHEN (area_type = 3 AND area = 2001) THEN 8 -- Rift Dungeon - Fire Beast WHEN (area_type = 3 AND area = 3001) THEN 9 -- Rift Dungeon - Wind Beast WHEN (area_type = 3 AND area = 4001) THEN 10 -- Rift Dungeon - Light Beast WHEN (area_type = 3 AND area = 5001) THEN 11 -- Rift Dungeon - Dark Beast WHEN (area_type = 2 AND area = 5001) THEN 12 -- Hall of Magic WHEN (area_type = 2 AND area = 3001) THEN 13 -- Hall of Water WHEN (area_type = 2 AND area = 2001) THEN 14 -- Hall of Fire WHEN (area_type = 2 AND area = 4001) THEN 15 -- Hall of Wind WHEN (area_type = 2 AND area = 7001) THEN 16 -- Hall of Light WHEN (area_type = 2 AND area = 1001) THEN 17 -- Hall of Dark ELSE area END ASC "; $q = $db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ array_push($this->record, new Record($r["uid"], $r["area_type"], $r["area"])); } } } ?>