|
|
@@ -257,7 +257,7 @@
|
|
|
$this->can_awaken = $r["can_awaken"];
|
|
|
$this->awaken_bonus = $r["awaken_bonus"];
|
|
|
$this->skill_ups_to_max = $r["skill_ups_to_max"];
|
|
|
- if ($complete && $r["leader_skill"]){
|
|
|
+ if (strlen($r["leader_skill"]) > 0){
|
|
|
$this->leader_skill = new K_Leader_Skill($this->db, $r["leader_skill"]);
|
|
|
}
|
|
|
$this->base_hp = $r["base_hp"];
|
|
|
@@ -281,49 +281,82 @@
|
|
|
$this->craft_cost = $r["craft_cost"];
|
|
|
}
|
|
|
if ($complete){
|
|
|
- $s =
|
|
|
- "SELECT " .
|
|
|
- " skill " .
|
|
|
- "FROM " .
|
|
|
- " k_skill, " .
|
|
|
- " k_monster_skill " .
|
|
|
- "WHERE " .
|
|
|
- " id = skill AND " .
|
|
|
- " monster = $id " .
|
|
|
- "ORDER BY slot; ";
|
|
|
- $q = $this->db->query($s);
|
|
|
- while ($r = $q->fetchArray(SQLITE3_ASSOC)){
|
|
|
- array_push($this->skill, new K_Skill($this->db, $r["skill"]));
|
|
|
- }
|
|
|
- $s =
|
|
|
- "SELECT " .
|
|
|
- " element, " .
|
|
|
- " grade, " .
|
|
|
- " amount " .
|
|
|
- "FROM k_monster_essence " .
|
|
|
- "WHERE " .
|
|
|
- " monster = $id " .
|
|
|
- "ORDER BY " .
|
|
|
- " element <> 'Magic', " .
|
|
|
- " grade <> 'Low', " .
|
|
|
- " grade <> 'Mid'; ";
|
|
|
- $q = $this->db->query($s);
|
|
|
- while ($r = $q->fetchArray(SQLITE3_ASSOC)){
|
|
|
- $e = [
|
|
|
- "element" => $r["element"],
|
|
|
- "grade" => $r["grade"],
|
|
|
- "amount" => $r["amount"]
|
|
|
- ];
|
|
|
- array_push($this->essences, $e);
|
|
|
- }
|
|
|
- $s =
|
|
|
- "SELECT source " .
|
|
|
- "FROM k_monster_source " .
|
|
|
- "WHERE monster = $id; ";
|
|
|
- $q = $this->db->query($s);
|
|
|
- while ($r = $q->fetchArray(SQLITE3_ASSOC)){
|
|
|
- array_push($this->sources, new K_Source($this->db, $r["source"]));
|
|
|
- }
|
|
|
+ $this->load_essences();
|
|
|
+ $this->load_skills();
|
|
|
+ $this->load_sources();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Loads the information about the essences to awake the monster.
|
|
|
+ * It is autoatically called at construction time if the
|
|
|
+ * $complete parameter is true (by default). No point in calling it
|
|
|
+ * twice.
|
|
|
+ */
|
|
|
+ public function load_essences(){
|
|
|
+ $this->essences = [];
|
|
|
+ $s =
|
|
|
+ "SELECT " .
|
|
|
+ " element, " .
|
|
|
+ " grade, " .
|
|
|
+ " amount " .
|
|
|
+ "FROM k_monster_essence " .
|
|
|
+ "WHERE " .
|
|
|
+ " monster = " . $this->id . " " .
|
|
|
+ "ORDER BY " .
|
|
|
+ " element <> 'Magic', " .
|
|
|
+ " grade <> 'Low', " .
|
|
|
+ " grade <> 'Mid'; ";
|
|
|
+ $q = $this->db->query($s);
|
|
|
+ while ($r = $q->fetchArray(SQLITE3_ASSOC)){
|
|
|
+ $e = [
|
|
|
+ "element" => $r["element"],
|
|
|
+ "grade" => $r["grade"],
|
|
|
+ "amount" => $r["amount"]
|
|
|
+ ];
|
|
|
+ array_push($this->essences, $e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Loads the information about the monster skills.
|
|
|
+ * It is autoatically called at construction time if the
|
|
|
+ * $complete parameter is true (by default). No point in calling it
|
|
|
+ * twice.
|
|
|
+ */
|
|
|
+ public function load_skills(){
|
|
|
+ $this->skill = [];
|
|
|
+ $s =
|
|
|
+ "SELECT " .
|
|
|
+ " skill " .
|
|
|
+ "FROM " .
|
|
|
+ " k_skill, " .
|
|
|
+ " k_monster_skill " .
|
|
|
+ "WHERE " .
|
|
|
+ " id = skill AND " .
|
|
|
+ " monster = " . $this->id . " " .
|
|
|
+ "ORDER BY slot; ";
|
|
|
+ $q = $this->db->query($s);
|
|
|
+ while ($r = $q->fetchArray(SQLITE3_ASSOC)){
|
|
|
+ array_push($this->skill, new K_Skill($this->db, $r["skill"]));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Loads the information about the monster sources.
|
|
|
+ * It is autoatically called at construction time if the
|
|
|
+ * $complete parameter is true (by default). No point in calling it
|
|
|
+ * twice.
|
|
|
+ */
|
|
|
+ public function load_sources(){
|
|
|
+ $this->sources = [];
|
|
|
+ $s =
|
|
|
+ "SELECT source " .
|
|
|
+ "FROM k_monster_source " .
|
|
|
+ "WHERE monster = " . $this->id . ";";
|
|
|
+ $q = $this->db->query($s);
|
|
|
+ while ($r = $q->fetchArray(SQLITE3_ASSOC)){
|
|
|
+ array_push($this->sources, new K_Source($this->db, $r["source"]));
|
|
|
}
|
|
|
}
|
|
|
|