id = $id; $this->type = $type; $s = " SELECT id, type, name FROM k_area WHERE id = '$id' AND type = '$type' ORDER BY type = '$type' DESC; "; $q = $this->db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); if ($r){ $this->name = HTML::e($r["name"]); } elseif($this->id > 1000){ $this->type = AREA_TYPE_ID::CAIROS_DUNGEON; $this->name = "Hall of Heroes"; } } /** * Gets the path to the area image. The image must be in the * img/area/ directory, and its name must be the area type id, * padded with '0' to 9 digites, and the extension must be '.png'. * * @param string $stage Stage number, for a better image in Cairos. * @return string Image URL, or a fixed unknown image. */ public function get_image($stage = null){ if ($this->id > 10000 && file_exists(PATH::BASE . "img/area/HOH.png")){ // Hall of Heroes return URL::IMG["AREA"] . "HOH.png"; } elseif ( ( $this->type == AREA_TYPE_ID::SCENARIO || //$this->type == AREA_TYPE_ID::RIFT_DUNGEON || //$this->type == AREA_TYPE_ID::DIMENSIONAL_HOLE || //$this->type == AREA_TYPE_ID::RIFT_RAID || $this->type == AREA_TYPE_ID::ARENA || $this->type == AREA_TYPE_ID::GUILD_WAR || $this->type == AREA_TYPE_ID::GUILD_SIEGE || //$this->type == AREA_TYPE_ID::TARTARUS_LABYRINTH || //$this->type == AREA_TYPE_ID::TRIAL_OF_ASCENSION || $this->type == AREA_TYPE_ID::WORLD_BOSS || $this->type == AREA_TYPE_ID::DIMENSIONAL_RIFT ) && file_exists(PATH::BASE . "img/area/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png") ){ return URL::IMG["AREA"] . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png"; } elseif ($this->type == AREA_TYPE_ID::CAIROS_DUNGEON && APPLICATION::valid_id("DUNGEON_ID", $this->id)){ switch ($this->id){ case DUNGEON_ID::GIANTS_KEEP: switch ($stage){ case 1: case 6: // Light if (file_exists(PATH::BASE . "img/unit/00060204.png")){ return URL::IMG["UNIT"] . "00060204.png"; } break; break; case 2: case 7: // Dark if (file_exists(PATH::BASE . "img/unit/00060204.png")){ return URL::IMG["UNIT"] . "00060204.png"; } break; case 3: case 8: // Wind if (file_exists(PATH::BASE . "img/unit/00060203.png")){ return URL::IMG["UNIT"] . "00060203.png"; } break; case 4: case 9: // Fire if (file_exists(PATH::BASE . "img/unit/00060202.png")){ return URL::IMG["UNIT"] . "00060202.png"; } break; case 5: case 10: // Water if (file_exists(PATH::BASE . "img/unit/00060201.png")){ return URL::IMG["UNIT"] . "00060201.png"; } break; } break; case DUNGEON_ID::DRAGONS_LAIR: switch ($stage){ case 1: case 6: // Wind if (file_exists(PATH::BASE . "img/unit/00060303.png")){ return URL::IMG["UNIT"] . "00060303.png"; } break; break; case 2: case 7: // Light if (file_exists(PATH::BASE . "img/unit/00060304.png")){ return URL::IMG["UNIT"] . "00060304.png"; } break; case 3: case 8: // Water if (file_exists(PATH::BASE . "img/unit/00060301.png")){ return URL::IMG["UNIT"] . "00060301.png"; } break; case 4: case 9: // Dark if (file_exists(PATH::BASE . "img/unit/00060305.png")){ return URL::IMG["UNIT"] . "00060305.png"; } break; case 5: case 10: // Fire if (file_exists(PATH::BASE . "img/unit/00060302.png")){ return URL::IMG["UNIT"] . "00060302.png"; } break; } break; case DUNGEON_ID::NECROPOLIS: switch ($stage){ case 1: case 6: // Water if (file_exists(PATH::BASE . "img/unit/00062101.png")){ return URL::IMG["UNIT"] . "00062101.png"; } break; break; case 2: case 7: // Fire if (file_exists(PATH::BASE . "img/unit/00062102.png")){ return URL::IMG["UNIT"] . "00062102.png"; } break; case 3: case 8: // Wind if (file_exists(PATH::BASE . "img/unit/00062103.png")){ return URL::IMG["UNIT"] . "00062103.png"; } break; case 4: case 9: // Light if (file_exists(PATH::BASE . "img/unit/00062104.png")){ return URL::IMG["UNIT"] . "00062104.png"; } break; case 5: case 10: // Dark if (file_exists(PATH::BASE . "img/unit/00062105.png")){ return URL::IMG["UNIT"] . "00062105.png"; } break; } break; case DUNGEON_ID::HALL_OF_WATER: if (file_exists(PATH::BASE . "img/unit/00060101.png")){ return URL::IMG["UNIT"] . "00060101.png"; } break; case DUNGEON_ID::HALL_OF_FIRE: if (file_exists(PATH::BASE . "img/unit/00060102.png")){ return URL::IMG["UNIT"] . "00060102.png"; } break; case DUNGEON_ID::HALL_OF_WIND: if (file_exists(PATH::BASE . "img/unit/00060103.png")){ return URL::IMG["UNIT"] . "00060103.png"; } break; case DUNGEON_ID::HALL_OF_LIGHT: if (file_exists(PATH::BASE . "img/unit/00060104.png")){ return URL::IMG["UNIT"] . "00060104.png"; } break; case DUNGEON_ID::HALL_OF_DARK: if (file_exists(PATH::BASE . "img/unit/00060105.png")){ return $PATH["IMG"]["UNIT"] . "00060105.png"; } break; case DUNGEON_ID::HALL_OF_MAGIC: if (file_exists(PATH::BASE . "img/unit/00062004.png")){ return URL::IMG["UNIT"] . "00062004.png"; } break; default: if (file_exists(PATH::BASE . "img/area/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png")){ return URL::IMG["AREA"] . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png"; } } } elseif ($this->type == AREA_TYPE_ID::RIFT_DUNGEON && APPLICATION::valid_id("ELEMENTAL_RIFT_DUNGEON_ID", $this->id)){ switch ($this->id){ case ELEMENTAL_RIFT_DUNGEON_ID::ICE_BEAST: if (file_exists(PATH::BASE . "img/unit/00043001.png")){ return URL::IMG["UNIT"] . "00043001.png"; } break; case ELEMENTAL_RIFT_DUNGEON_ID::FIRE_BEAST: if (file_exists(PATH::BASE . "img/unit/00043002.png")){ return URL::IMG["UNIT"] . "00043002.png"; } break; case ELEMENTAL_RIFT_DUNGEON_ID::WIND_BEAST: if (file_exists(PATH::BASE . "img/unit/00043003.png")){ return URL::IMG["UNIT"] . "00043003.png"; } break; case ELEMENTAL_RIFT_DUNGEON_ID::LIGHT_BEAST: if (file_exists(PATH::BASE . "img/unit/00043004.png")){ return URL::IMG["UNIT"] . "00043004.png"; } break; case ELEMENTAL_RIFT_DUNGEON_ID::DARK_BEAST: if (file_exists(PATH::BASE . "img/unit/00043005.png")){ return URL::IMG["UNIT"] . "00043005.png"; } break; default: if (file_exists(PATH::BASE . "img/area/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png")){ return URL::IMG["AREA"] . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png"; } break; } } elseif ($this->type == AREA_TYPE_ID::RIFT_RAID){ if (file_exists(PATH::BASE . "img/unit/00044007.png")){ return URL::IMG["UNIT"] . "00044007.png"; } } elseif ($this->type == AREA_TYPE_ID::DIMENSIONAL_HOLE){ switch ($this->id){ case DUNGEON_ID::FOREST_OF_ROARING_BEASTS: if (file_exists(PATH::BASE . "img/unit/00047002.png")){ return URL::IMG["UNIT"] . "00047002.png"; } break; case DUNGEON_ID::SANCTUARY_OF_DREAMING_FAIRIES: if (file_exists(PATH::BASE . "img/unit/00047001.png")){ return URL::IMG["UNIT"] . "00047001.png"; } break; case DUNGEON_ID::CLIFF_OF_TOUGH_BEASTS_MEN: if (file_exists(PATH::BASE . "img/unit/00047002.png")){ return URL::IMG["UNIT"] . "00047003.png"; } break; case DUNGEON_ID::KARZHAN_REMAINS_WARBEAR: switch ($stage){ case 1: if (file_exists(PATH::BASE . "img/unit/00010734.png")){ return URL::IMG["UNIT"] . "00010734.png"; } break; case 2: if (file_exists(PATH::BASE . "img/unit/00010733.png")){ return URL::IMG["UNIT"] . "00010733.png"; } break; case 3: if (file_exists(PATH::BASE . "img/unit/00010731.png")){ return URL::IMG["UNIT"] . "00010731.png"; } break; case 4: if (file_exists(PATH::BASE . "img/unit/00010735.png")){ return URL::IMG["UNIT"] . "00010735.png"; } break; case 5: if (file_exists(PATH::BASE . "img/unit/00010732.png")){ return URL::IMG["UNIT"] . "00010732.png"; } break; default: if (file_exists(PATH::BASE . "img/area/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png")){ return URL::IMG["AREA"] . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png"; } break; } break; case DUNGEON_ID::KARZHAN_REMAINS_INUGAMI: switch ($stage){ case 1: if (file_exists(PATH::BASE . "img/unit/00011031.png")){ return URL::IMG["UNIT"] . "00011031.png"; } break; case 2: if (file_exists(PATH::BASE . "img/unit/00011033.png")){ return URL::IMG["UNIT"] . "00011033.png"; } break; case 3: if (file_exists(PATH::BASE . "img/unit/00011032.png")){ return URL::IMG["UNIT"] . "00011032.png"; } break; case 4: if (file_exists(PATH::BASE . "img/unit/00011034.png")){ return URL::IMG["UNIT"] . "00011034.png"; } break; case 5: if (file_exists(PATH::BASE . "img/unit/00011035.png")){ return URL::IMG["UNIT"] . "00011035.png"; } break; default: if (file_exists(PATH::BASE . "img/area/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png")){ return URL::IMG["AREA"] . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png"; } break; } break; case DUNGEON_ID::ELLUNIA_REMAINS_FAIRY: switch ($stage){ case 1: if (file_exists(PATH::BASE . "img/unit/00010132.png")){ return URL::IMG["UNIT"] . "00010132.png"; } break; case 2: if (file_exists(PATH::BASE . "img/unit/00010134.png")){ return URL::IMG["UNIT"] . "00010134.png"; } break; case 3: if (file_exists(PATH::BASE . "img/unit/00010131.png")){ return URL::IMG["UNIT"] . "00010131.png"; } break; case 4: if (file_exists(PATH::BASE . "img/unit/00010133.png")){ return URL::IMG["UNIT"] . "00010133.png"; } break; case 5: if (file_exists(PATH::BASE . "img/unit/00010134.png")){ return URL::IMG["UNIT"] . "00010134.png"; } break; default: if (file_exists(PATH::BASE . "img/area/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png")){ return URL::IMG["AREA"] . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png"; } break; } break; case DUNGEON_ID::ELLUNIA_REMAINS_PIXIE: switch ($stage){ case 1: if (file_exists(PATH::BASE . "img/unit/00010334.png")){ return URL::IMG["UNIT"] . "00010334.png"; } break; case 2: if (file_exists(PATH::BASE . "img/unit/00010332.png")){ return URL::IMG["UNIT"] . "00010332.png"; } break; case 3: if (file_exists(PATH::BASE . "img/unit/00010335.png")){ return URL::IMG["UNIT"] . "00010335.png"; } break; case 4: if (file_exists(PATH::BASE . "img/unit/00010333.png")){ return URL::IMG["UNIT"] . "00010333.png"; } break; case 5: if (file_exists(PATH::BASE . "img/unit/00010331.png")){ return URL::IMG["UNIT"] . "00010331.png"; } break; default: if (file_exists(PATH::BASE . "img/area/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png")){ return URL::IMG["AREA"] . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png"; } break; } break; case DUNGEON_ID::LUMEL_REMAINS_WEREWOLF: switch ($stage){ case 1: if (file_exists(PATH::BASE . "img/unit/00014035.png")){ return URL::IMG["UNIT"] . "00014035.png"; } break; case 2: if (file_exists(PATH::BASE . "img/unit/00014033.png")){ return URL::IMG["UNIT"] . "00014033.png"; } break; case 3: if (file_exists(PATH::BASE . "img/unit/00014031.png")){ return URL::IMG["UNIT"] . "00014031.png"; } break; case 4: if (file_exists(PATH::BASE . "img/unit/00014034.png")){ return URL::IMG["UNIT"] . "00014034.png"; } break; case 5: if (file_exists(PATH::BASE . "img/unit/00014032.png")){ return URL::IMG["UNIT"] . "00014032.png"; } break; default: if (file_exists(PATH::BASE . "img/area/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png")){ return URL::IMG["AREA"] . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png"; } break; } break; case DUNGEON_ID::LUMEL_REMAINS_MARTIAL_CAT: switch ($stage){ case 1: if (file_exists(PATH::BASE . "img/unit/00015032.png")){ return URL::IMG["UNIT"] . "00015032.png"; } break; case 2: if (file_exists(PATH::BASE . "img/unit/00015034.png")){ return URL::IMG["UNIT"] . "00015034.png"; } break; case 3: if (file_exists(PATH::BASE . "img/unit/00015031.png")){ return URL::IMG["UNIT"] . "00015031.png"; } break; case 4: if (file_exists(PATH::BASE . "img/unit/00015035.png")){ return URL::IMG["UNIT"] . "00015035.png"; } break; case 5: if (file_exists(PATH::BASE . "img/unit/00015033.png")){ return URL::IMG["UNIT"] . "00015033.png"; } break; default: if (file_exists(PATH::BASE . "img/area/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png")){ return URL::IMG["AREA"] . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png"; } break; } break; default: if (file_exists(PATH::BASE . "img/area/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png")){ return URL::IMG["AREA"] . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png"; } break; } } elseif ($this->type == AREA_TYPE_ID::TARTARUS_LABYRINTH){ switch ($stage){ case LABYRINTH_STAGES_ID::TARTARUS: if (file_exists(PATH::BASE . "img/unit/00046001.png")){ return URL::IMG["UNIT"] . "00046001.png"; } break; case LABYRINTH_STAGES_ID::LEOS: if (file_exists(PATH::BASE . "img/unit/00046101.png")){ return URL::IMG["UNIT"] . "00046101.png"; } break; case LABYRINTH_STAGES_ID::KOTTOS: if (file_exists(PATH::BASE . "img/unit/00046102.png")){ return URL::IMG["UNIT"] . "00046102.png"; } break; case LABYRINTH_STAGES_ID::AQUILES: if (file_exists(PATH::BASE . "img/unit/00046103.png")){ return URL::IMG["UNIT"] . "00046103.png"; } break; default: if (file_exists(PATH::BASE . "img/area/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png")){ return URL::IMG["AREA"] . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png"; } else{ return URL::IMG["UNKNOWN"]; } } } elseif ($this->type == AREA_TYPE_ID::TRIAL_OF_ASCENSION){ if (file_exists(PATH::BASE . "img/area/TRIAL_OF_ASCENSION.png")){ return URL::IMG["AREA"] . "TRIAL_OF_ASCENSION.png"; } else{ return URL::IMG["UNKNOWN"]; } } else{ if (file_exists(PATH::BASE . "img/area/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png")){ return URL::IMG["AREA"] . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png"; } else{ return URL::IMG["UNKNOWN"]; } } } } ?>