| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- <?php
- require_once($path["entity"] . "Entity.php");
- /**
- * An area.
- *
- * Represents an object from the table 'k_area'.
- */
- class K_Area extends Entity{
- /**
- * Area identifier (it may not be unique!).
- */
- public $id;
- /**
- * Area type.
- */
- public $type;
- /**
- * Area name.
- */
- public $name;
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * run, populating it and it's items.
- *
- * @param SQLite3 $db Connection to the database.
- * @param int $id Area identifier.
- * @param int $type Area type (required).
- */
- public function __construct($db, $id, $type){
- global $path;
- global $AREA_TYPE;
- parent::__construct($db);
- $this->id = $id;
- $s = "
- SELECT
- id,
- type,
- name
- FROM k_area
- WHERE id = '$id'
- ORDER BY type = '$type' DESC;
- ";
- $q = $this->db->query($s);
- $r = $q->fetchArray(SQLITE3_ASSOC);
- if ($r){
- $this->type = $r["type"];
- $this->name = $r["name"];
- }
- elseif($this->id > 1000){
- $this->type = $AREA_TYPE["CAIROS_DUNGEON"];
- $this->name = "Hall of Heroes";
- }
- }
- /**
- * Gets the path to the area image. The image must be in the
- * img/content/area/ directory, and its name must be the monster id,
- * padded with '0' to 9 digites, and the extension must be '.png'.
- *
- * @return path to the image, or a path to a fixed unknown image if it
- * doesn't exist.
- */
- public function get_image($stage = null){
- global $base_dir;
- global $path;
- global $AREA_TYPE;
- global $DUNGEON;
- if ($this->id > 10000 && file_exists($base_dir . "img/content/area/HOH.png")){
- // Hall of Heroes
- return $path["img"]["content"] . "area/HOH.png";
- }
- elseif (
- (
- $this->type == $AREA_TYPE["SCENARIO"] ||
- $this->type == $AREA_TYPE["RIFT_DUNGEON"] ||
- $this->type == $AREA_TYPE["DIMENSIONAL_HOLE"] ||
- $this->type == $AREA_TYPE["RIFT_RAID"] ||
- $this->type == $AREA_TYPE["ARENA"] ||
- $this->type == $AREA_TYPE["GUILD_WAR"] ||
- $this->type == $AREA_TYPE["GUILD_SIEGE"] ||
- $this->type == $AREA_TYPE["TARTARUS_LABYRINTH"] ||
- $this->type == $AREA_TYPE["TRIAL_OF_ASCENSION"] ||
- $this->type == $AREA_TYPE["WORLD_BOSS"] ||
- $this->type == $AREA_TYPE["DIMENSIONAL_RIFT"]
- ) && file_exists($base_dir . "img/content/area/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png")
- ){
- return $path["img"]["content"] . "area/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png";
- }
- elseif ($this->type == $AREA_TYPE["CAIROS_DUNGEON"] && in_array($this->id, $DUNGEON)){
- switch ($this->id){
- case $DUNGEON["GIANTS_KEEP"]:
- switch ($stage){
- case 1:
- case 6:
- // Light
- if (file_exists($base_dir . "img/content/unit/00060204.png")){
- return $path["img"]["content"] . "unit/00060204.png";
- }
- break;
- break;
- case 2:
- case 7:
- // Dark
- if (file_exists($base_dir . "img/content/unit/00060204.png")){
- return $path["img"]["content"] . "unit/00060204.png";
- }
- break;
- case 3:
- case 8:
- // Wind
- if (file_exists($base_dir . "img/content/unit/00060203.png")){
- return $path["img"]["content"] . "unit/00060203.png";
- }
- break;
- case 4:
- case 9:
- // Fire
- if (file_exists($base_dir . "img/content/unit/00060202.png")){
- return $path["img"]["content"] . "unit/00060202.png";
- }
- break;
- case 5:
- case 10:
- // Water
- if (file_exists($base_dir . "img/content/unit/00060201.png")){
- return $path["img"]["content"] . "unit/00060201.png";
- }
- break;
- }
- break;
- case $DUNGEON["DRAGONS_LAIR"]:
- switch ($stage){
- case 1:
- case 6:
- // Wind
- if (file_exists($base_dir . "img/content/unit/00060303.png")){
- return $path["img"]["content"] . "unit/00060303.png";
- }
- break;
- break;
- case 2:
- case 7:
- // Light
- if (file_exists($base_dir . "img/content/unit/00060304.png")){
- return $path["img"]["content"] . "unit/00060304.png";
- }
- break;
- case 3:
- case 8:
- // Water
- if (file_exists($base_dir . "img/content/unit/00060301.png")){
- return $path["img"]["content"] . "unit/00060301.png";
- }
- break;
- case 4:
- case 9:
- // Dark
- if (file_exists($base_dir . "img/content/unit/00060305.png")){
- return $path["img"]["content"] . "unit/00060305.png";
- }
- break;
- case 5:
- case 10:
- // Fire
- if (file_exists($base_dir . "img/content/unit/00060302.png")){
- return $path["img"]["content"] . "unit/00060302.png";
- }
- break;
- }
- break;
- case $DUNGEON["NECROPOLIS"]:
- switch ($stage){
- case 1:
- case 6:
- // Water
- if (file_exists($base_dir . "img/content/unit/000621301.png")){
- return $path["img"]["content"] . "unit/000621301.png";
- }
- break;
- break;
- case 2:
- case 7:
- // Fire
- if (file_exists($base_dir . "img/content/unit/000621302.png")){
- return $path["img"]["content"] . "unit/000621302.png";
- }
- break;
- case 3:
- case 8:
- // Wind
- if (file_exists($base_dir . "img/content/unit/000621303.png")){
- return $path["img"]["content"] . "unit/000621303.png";
- }
- break;
- case 4:
- case 9:
- // Light
- if (file_exists($base_dir . "img/content/unit/000621304.png")){
- return $path["img"]["content"] . "unit/000621304.png";
- }
- break;
- case 5:
- case 10:
- // Dark
- if (file_exists($base_dir . "img/content/unit/000621305.png")){
- return $path["img"]["content"] . "unit/000621305.png";
- }
- break;
- }
- break;
- case $DUNGEON["HALL_OF_WATER"]:
- if (file_exists($base_dir . "img/content/unit/00060101.png")){
- return $path["img"]["content"] . "unit/00060101.png";
- }
- break;
- case $DUNGEON["HALL_OF_FIRE"]:
- if (file_exists($base_dir . "img/content/unit/00060102.png")){
- return $path["img"]["content"] . "unit/00060102.png";
- }
- break;
- case $DUNGEON["HALL_OF_WIND"]:
- if (file_exists($base_dir . "img/content/unit/00060103.png")){
- return $path["img"]["content"] . "unit/00060103.png";
- }
- break;
- case $DUNGEON["HALL_OF_LIGHT"]:
- if (file_exists($base_dir . "img/content/unit/00060104.png")){
- return $path["img"]["content"] . "unit/00060104.png";
- }
- break;
- case $DUNGEON["HALL_OF_DARK"]:
- if (file_exists($base_dir . "img/content/unit/00060105.png")){
- return $path["img"]["content"] . "unit/00060105.png";
- }
- break;
- case $DUNGEON["HALL_OF_MAGIC"]:
- if (file_exists($base_dir . "img/content/unit/00062004.png")){
- return $path["img"]["content"] . "unit/00062004.png";
- }
- break;
- default:
- if (file_exists($base_dir . "img/content/area/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png")){
- return $path["img"]["content"] . "area/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png";
- }
- }
- }
- return $path["img"]["layout"] . "unknown.png";
- }
- }
- ?>
|