| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- <?php
- require_once($path["entity"] . "Entity.php");
- require_once($path["entity"] . "K_Monster.php");
- require_once($path["entity"] . "Rune.php");
- /**
- * Monster.
- *
- * Represents an object from the table 'monster'.
- */
- class Monster extends Entity{
- /**
- * Monster identifier.
- */
- public $id;
- /**
- * Monster official identifier.
- */
- public $com2us_id;
- /**
- * {@see K_Monster}.
- */
- public $monster;
- /**
- * Monster stars.
- */
- public $stars;
- /**
- * Monster level.
- */
- public $level;
- /**
- * Level of skill 1
- */
- public $skill_1_level;
- /**
- * Level of skill 2
- */
- public $skill_2_level;
- /**
- * Level of skill 3
- */
- public $skill_3_level;
- /**
- * Level of skill 4
- */
- public $skill_4_level;
- /**
- * Monster base HP stat.
- */
- public $base_hp;
- /**
- * Monster base ATK stat.
- */
- public $base_attack;
- /**
- * Monster base DEF stat.
- */
- public $base_defense;
- /**
- * Monster base SPD stat.
- */
- public $base_speed;
- /**
- * Monster base CRR stat.
- */
- public $base_crit_rate;
- /**
- * Monster base CRD stat.
- */
- public $base_crit_damage;
- /**
- * Monster base RES stat.
- */
- public $base_resistance;
- /**
- * Monster base ACC stat.
- */
- public $base_accuracy;
- /**
- * Monster rune HP stat.
- */
- public $rune_hp;
- /**
- * Monster rune ATK stat.
- */
- public $rune_attack;
- /**
- * Monster rune DEF stat.
- */
- public $rune_defense;
- /**
- * Monster rune SPD stat.
- */
- public $rune_speed;
- /**
- * Monster rune CRR stat.
- */
- public $rune_crit_rate;
- /**
- * Monster rune CRD stat.
- */
- public $rune_crit_damage;
- /**
- * Monster rune RES stat.
- */
- public $rune_resistance;
- /**
- * Monster rune ACC stat.
- */
- public $rune_accuracy;
- /**
- * Average rune efficiency.
- */
- public $avg_rune_efficiency;
- /**
- * Indicates if the monster is fodder.
- */
- public $fodder;
- /**
- * Indicates if the monster is in storage.
- */
- public $in_storage;
- /**
- * Indicates if the monster is ignored in fusion calc.
- */
- public $ignore_for_fusion;
- /**
- * Monster priority.
- */
- public $priority;
- /**
- * Notes on the monster.
- */
- public $notes;
- /**
- * Equiped {@see Rune}s
- */
- public $rune = [];
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * monster, populating it and it's items.
- *
- * @param SQLite3 $db Connection to the database.
- * @param int $id Monster identifier.
- * @param complete If false, query only monster and k_monster.
- */
- public function __construct($db, $id, $complete = true){
- global $path;
- parent::__construct($db);
- $s =
- "SELECT " .
- " id, " .
- " com2us_id, " .
- " monster, " .
- " stars, " .
- " level, " .
- " skill_1_level, " .
- " skill_2_level, " .
- " skill_3_level, " .
- " skill_4_level, " .
- " base_hp, " .
- " base_attack, " .
- " base_defense, " .
- " base_speed, " .
- " base_crit_rate, " .
- " base_crit_damage, " .
- " base_resistance, " .
- " base_accuracy, " .
- " rune_hp, " .
- " rune_attack, " .
- " rune_defense, " .
- " rune_speed, " .
- " rune_crit_rate, " .
- " rune_crit_damage, " .
- " rune_resistance, " .
- " rune_accuracy, " .
- " avg_rune_efficiency, " .
- " fodder, " .
- " in_storage, " .
- " ignore_for_fusion, " .
- " priority, " .
- " notes " .
- "FROM monster " .
- "WHERE id = '$id'; ";
- $q = $this->db->query($s);
- $r = $q->fetchArray(SQLITE3_ASSOC);
- $this->id = $r["id"];
- $this->com2us_id = $r["com2us_id"];
- if (strlen($r["monster"]) > 0){
- $this->monster = new K_Monster($this->db, $r["monster"], $complete);
- }
- $this->stars = $r["stars"];
- $this->level = $r["level"];
- $this->skill_1_level = $r["skill_1_level"];
- $this->skill_2_level = $r["skill_2_level"];
- $this->skill_3_level = $r["skill_3_level"];
- $this->skill_4_level = $r["skill_4_level"];
- $this->base_hp = $r["base_hp"];
- $this->base_attack = $r["base_attack"];
- $this->base_defense = $r["base_defense"];
- $this->base_speed = $r["base_speed"];
- $this->base_crit_rate = $r["base_crit_rate"];
- $this->base_crit_damage = $r["base_crit_damage"];
- $this->base_resistance = $r["base_resistance"];
- $this->base_accuracy = $r["base_accuracy"];
- $this->rune_hp = $r["rune_hp"];
- $this->rune_attack = $r["rune_attack"];
- $this->rune_defense = $r["rune_defense"];
- $this->rune_speed = $r["rune_speed"];
- $this->rune_crit_rate = $r["rune_crit_rate"];
- $this->rune_crit_damage = $r["rune_crit_damage"];
- $this->rune_resistance = $r["rune_resistance"];
- $this->rune_accuracy = $r["rune_accuracy"];
- $this->avg_rune_efficiency = $r["avg_rune_efficiency"];
- $this->fodder = $r["fodder"];
- $this->in_storage = $r["in_storage"];
- $this->ignore_for_fusion = $r["ignore_for_fusion"];
- $this->priority = $r["priority"];
- $this->notes = $r["notes"];
- if ($complete){
- $this->load_runes();
- }
- }
- /**
- * Loads the information about the equiped runes.
- * It is autoatically called at construction time if the
- * $complete parameter is true (by default). No point in calling it
- * twice.
- */
- public function load_runes(){
- $this->rune = [];
- $s =
- "SELECT rune " .
- "FROM monster_rune " .
- "WHERE monster = '$this->id'; ";
- $q = $this->db->query($s);
- while ($r = $q->fetchArray(SQLITE3_ASSOC)){
- array_push($this->rune, new Rune($this->db, $r["rune"]));
- }
- }
- }
- ?>
|