Просмотр исходного кода

Game data updated to v6.3.9. Parser updated to v5 schema.

Iñigo Valentin 5 лет назад
Родитель
Сommit
63ead27590
100 измененных файлов с 208 добавлено и 208 удалено
  1. BIN
      application/key.sqlite
  2. 208 208
      parser/swarfarm_parser
  3. BIN
      public/img/artifact/base.png
  4. BIN
      public/img/skill/00003151.png
  5. BIN
      public/img/skill/00003152.png
  6. BIN
      public/img/skill/00003153.png
  7. BIN
      public/img/skill/00003154.png
  8. BIN
      public/img/skill/00003155.png
  9. BIN
      public/img/skill/00003156.png
  10. BIN
      public/img/skill/00003157.png
  11. BIN
      public/img/skill/00003158.png
  12. BIN
      public/img/skill/00003159.png
  13. BIN
      public/img/skill/00003160.png
  14. BIN
      public/img/skill/00003161.png
  15. BIN
      public/img/skill/00003162.png
  16. BIN
      public/img/skill/00003163.png
  17. BIN
      public/img/skill/00003164.png
  18. BIN
      public/img/skill/00003165.png
  19. BIN
      public/img/skill/00003166.png
  20. BIN
      public/img/skill/00003167.png
  21. BIN
      public/img/skill/00003168.png
  22. BIN
      public/img/skill/00003169.png
  23. BIN
      public/img/skill/00003170.png
  24. BIN
      public/img/skill/00003171.png
  25. BIN
      public/img/skill/00013717.png
  26. 0 0
      public/img/skill/00015101.png
  27. 0 0
      public/img/skill/00015102.png
  28. 0 0
      public/img/skill/00015103.png
  29. 0 0
      public/img/skill/00015104.png
  30. 0 0
      public/img/skill/00015105.png
  31. 0 0
      public/img/skill/00015106.png
  32. 0 0
      public/img/skill/00015107.png
  33. 0 0
      public/img/skill/00015108.png
  34. 0 0
      public/img/skill/00015109.png
  35. 0 0
      public/img/skill/00015110.png
  36. 0 0
      public/img/skill/00015111.png
  37. 0 0
      public/img/skill/00015112.png
  38. 0 0
      public/img/skill/00015113.png
  39. 0 0
      public/img/skill/00015114.png
  40. 0 0
      public/img/skill/00015115.png
  41. 0 0
      public/img/skill/00015201.png
  42. 0 0
      public/img/skill/00015202.png
  43. 0 0
      public/img/skill/00015203.png
  44. 0 0
      public/img/skill/00015204.png
  45. 0 0
      public/img/skill/00015205.png
  46. 0 0
      public/img/skill/00015206.png
  47. 0 0
      public/img/skill/00015207.png
  48. BIN
      public/img/skill/00015208.png
  49. BIN
      public/img/skill/00015209.png
  50. BIN
      public/img/skill/00015210.png
  51. BIN
      public/img/skill/00015211.png
  52. BIN
      public/img/skill/00015212.png
  53. BIN
      public/img/skill/00015213.png
  54. BIN
      public/img/skill/00015214.png
  55. BIN
      public/img/skill/00015215.png
  56. BIN
      public/img/skill/00015301.png
  57. BIN
      public/img/skill/00015302.png
  58. BIN
      public/img/skill/00015303.png
  59. BIN
      public/img/skill/00015304.png
  60. BIN
      public/img/skill/00015305.png
  61. BIN
      public/img/skill/00015306.png
  62. BIN
      public/img/skill/00015307.png
  63. BIN
      public/img/skill/00015308.png
  64. BIN
      public/img/skill/00015309.png
  65. BIN
      public/img/skill/00015310.png
  66. BIN
      public/img/skill/00015311.png
  67. BIN
      public/img/skill/00015312.png
  68. BIN
      public/img/skill/00015313.png
  69. BIN
      public/img/skill/00015314.png
  70. BIN
      public/img/skill/00015315.png
  71. BIN
      public/img/skill/00015316.png
  72. BIN
      public/img/skill/00015317.png
  73. BIN
      public/img/skill/00015318.png
  74. BIN
      public/img/skill/00015319.png
  75. BIN
      public/img/skill/00015320.png
  76. BIN
      public/img/skill/00015321.png
  77. BIN
      public/img/skill/00130101.png
  78. BIN
      public/img/skill/00130102.png
  79. BIN
      public/img/skill/00130103.png
  80. BIN
      public/img/skill/00130104.png
  81. BIN
      public/img/skill/00130105.png
  82. BIN
      public/img/skill/00130106.png
  83. BIN
      public/img/skill/00130107.png
  84. BIN
      public/img/skill/00130108.png
  85. BIN
      public/img/skill/00130109.png
  86. BIN
      public/img/skill/00130110.png
  87. BIN
      public/img/unit/00012031.png
  88. BIN
      public/img/unit/00012032.png
  89. BIN
      public/img/unit/00012033.png
  90. BIN
      public/img/unit/00012034.png
  91. BIN
      public/img/unit/00012035.png
  92. BIN
      public/img/unit/00025201.png
  93. BIN
      public/img/unit/00025202.png
  94. BIN
      public/img/unit/00025203.png
  95. BIN
      public/img/unit/00025204.png
  96. BIN
      public/img/unit/00025205.png
  97. BIN
      public/img/unit/00025211.png
  98. BIN
      public/img/unit/00025212.png
  99. BIN
      public/img/unit/00025213.png
  100. BIN
      public/img/unit/00025214.png

BIN
application/key.sqlite


+ 208 - 208
parser/swarfarm_parser

@@ -189,8 +189,8 @@ function show_help(){
     echo " | -o     | --only-downloads |  Download images, but don't make changes to       |\n";
     echo " |        |                  |  the database.                                    |\n";
     echo " +--------+------------------+---------------------------------------------------+\n";
-    echo " | -n     | --only-new       |  Look for new units or skills, but don't update   |\n";
-    echo " |        |                  |  existing ones.                                   |\n";
+    echo " | -n     | --only-new       |  Look for new monsters or skills, but don't       |\n";
+    echo " |        |                  |  update existing ones.                            |\n";
     echo " +--------+------------------+---------------------------------------------------+\n";
     echo " | -v [n] | --verbosity [n]  |  Controls the script output to the console.       |\n";
     echo " |        |                  |  Values for [n]:                                  |\n";
@@ -211,14 +211,14 @@ function show_help(){
  */
 function connect_to_database(){
     // Connect to the database
-    $db = new SQLite3(PATH . "application/sw.sqlite");
+    $db = new SQLite3(PATH . "application/key.sqlite");
     if (!$db) {
         output(0, "Error connecting to th database: " . $db->lastErrorMsg());
         exit();
     }
     // Disable integrity
     $db->query("PRAGMA foreign_keys=OFF;");
-    output(4, "Connected to databse: " . PATH . "application/sw.sqlite");
+    output(4, "Connected to dataabse: " . PATH . "application/key.sqlite");
     return $db;
 }
 
@@ -320,14 +320,14 @@ while ($next != null){
     $next = $contents->next;
     $list = $contents->results;
     foreach ($list as $skill){
-        $statement = $db->prepare("SELECT * FROM k_skill WHERE id = :id");
+        $statement = $db->prepare("SELECT * FROM skill WHERE id = :id");
         $statement->bindValue(":id", $skill->com2us_id, SQLITE3_INTEGER);
         $q = $statement->execute();
         $r = $q->fetchArray(SQLITE3_ASSOC);
         if (!$r){
             // New skill, insert directly
             $statement = $db->prepare("
-              INSERT INTO k_skill(
+              INSERT INTO skill(
                 id,
                 name,
                 description,
@@ -367,12 +367,12 @@ while ($next != null){
             $out = PATH . "public/img/skill/" . sprintf('%08d', $skill->com2us_id) . ".png";
             download($url, $out);
             $level = 1;
-            $statement = $db->prepare("INSERT INTO k_skill_level (skill, level, description) VALUES (:skill, :level, :description);");
+            $statement = $db->prepare("INSERT INTO skill_level (skill, level, description) VALUES (:skill, :level, :description);");
             $statement->bindValue(":skill", $skill->com2us_id, SQLITE3_INTEGER);
             $statement->bindValue(":level", $level, SQLITE3_INTEGER);
             foreach ($skill->upgrades as $upgrade){
                 $level ++;
-                $statement = $db->prepare("INSERT INTO k_skill_level (skill, level, description) VALUES (:skill, :level, :description);");
+                $statement = $db->prepare("INSERT INTO skill_level (skill, level, description) VALUES (:skill, :level, :description);");
                 $statement->bindValue(":skill", $skill->com2us_id, SQLITE3_INTEGER);
                 $statement->bindValue(":level", $level, SQLITE3_INTEGER);
                 $statement->bindValue(":description", str_replace("{0}", $upgrade->amount, $upgrade->effect), SQLITE3_TEXT);
@@ -380,7 +380,7 @@ while ($next != null){
                 $statement->execute();
             }
             foreach ($skill->effects as $effect){
-                $statement = $db->prepare("INSERT INTO k_skill_effect (skill, effect) VALUES (:skill, :effect);");
+                $statement = $db->prepare("INSERT INTO skill_effect (skill, effect) VALUES (:skill, :effect);");
                 $statement->bindValue(":skill", $skill->com2us_id, SQLITE3_INTEGER);
                 $statement->bindValue(":effect", $effect->effect->id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
@@ -390,35 +390,35 @@ while ($next != null){
         else{
             // Existing skill, compare all values
             if ($r["name"] != $skill->name){
-                $statement = $db->prepare("UPDATE k_skill SET name = :name WHERE id = :id;");
+                $statement = $db->prepare("UPDATE skill SET name = :name WHERE id = :id;");
                 $statement->bindValue(":name", $skill->name, SQLITE3_TEXT);
                 $statement->bindValue(":id", $skill->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
             if ($r["description"] != $skill->description){
-                $statement = $db->prepare("UPDATE k_skill SET description = :description WHERE id = :id;");
+                $statement = $db->prepare("UPDATE skill SET description = :description WHERE id = :id;");
                 $statement->bindValue(":description", $skill->description, SQLITE3_TEXT);
                 $statement->bindValue(":id", $skill->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
             if ($r["slot"] != $skill->slot){
-                $statement = $db->prepare("UPDATE k_skill SET slot = :slot WHERE id = :id;");
+                $statement = $db->prepare("UPDATE skill SET slot = :slot WHERE id = :id;");
                 $statement->bindValue(":slot", $skill->slot, SQLITE3_TEXT);
                 $statement->bindValue(":id", $skill->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
             if ($r["cooltime"] != $skill->cooltime){
-                $statement = $db->prepare("UPDATE k_skill SET cooltime = :cooltime WHERE id = :id;");
+                $statement = $db->prepare("UPDATE skill SET cooltime = :cooltime WHERE id = :id;");
                 $statement->bindValue(":cooltime", $skill->cooltime, SQLITE3_TEXT);
                 $statement->bindValue(":id", $skill->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
             if ($r["hits"] != $skill->hits){
-                $statement = $db->prepare("UPDATE k_skill SET hits = :hits WHERE id = :id;");
+                $statement = $db->prepare("UPDATE skill SET hits = :hits WHERE id = :id;");
                 $statement->bindValue(":hits", $skill->hits, SQLITE3_TEXT);
                 $statement->bindValue(":id", $skill->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
@@ -426,7 +426,7 @@ while ($next != null){
             }
             $passive = ($skill->passive == 1) ? (1) : (0);
             if ($r["passive"] != $passive){
-                $statement = $db->prepare("UPDATE k_skill SET passive = :passive WHERE id = :id;");
+                $statement = $db->prepare("UPDATE skill SET passive = :passive WHERE id = :id;");
                 $statement->bindValue(":passive", $passive, SQLITE3_TEXT);
                 $statement->bindValue(":id", $skill->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
@@ -434,21 +434,21 @@ while ($next != null){
             }
             $aoe = ($skill->aoe == 1) ? (1) : (0);
             if ($r["aoe"] != $aoe){
-                $statement = $db->prepare("UPDATE k_skill SET aoe = :aoe WHERE id = :id;");
+                $statement = $db->prepare("UPDATE skill SET aoe = :aoe WHERE id = :id;");
                 $statement->bindValue(":aoe", $aoe, SQLITE3_TEXT);
                 $statement->bindValue(":id", $skill->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
             if ($r["max_level"] != $skill->max_level){
-                $statement = $db->prepare("UPDATE k_skill SET max_level = :max_level WHERE id = :id;");
+                $statement = $db->prepare("UPDATE skill SET max_level = :max_level WHERE id = :id;");
                 $statement->bindValue(":max_level", $skill->max_level, SQLITE3_TEXT);
                 $statement->bindValue(":id", $skill->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
             if ($r["multiplier_formula"] != $skill->multiplier_formula){
-                $statement = $db->prepare("UPDATE k_skill SET multiplier_formula = :multiplier_formula WHERE id = :id;");
+                $statement = $db->prepare("UPDATE skill SET multiplier_formula = :multiplier_formula WHERE id = :id;");
                 $statement->bindValue(":multiplier_formula", $skill->multiplier_formula, SQLITE3_TEXT);
                 $statement->bindValue(":id", $skill->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
@@ -456,17 +456,17 @@ while ($next != null){
             }
 
             // Compare existing effects
-            $statement = $db->prepare("SELECT count(effect) AS c FROM k_skill_effect WHERE skill = :skill;");
+            $statement = $db->prepare("SELECT count(effect) AS c FROM skill_effect WHERE skill = :skill;");
             $statement->bindValue(":skill", $skill->com2us_id, SQLITE3_INTEGER);
             $q = $statement->execute();
             $r = $q->fetchArray(SQLITE3_ASSOC);
             if ($r["c"] != sizeof($skill->effects)){
-                $statement = $db->prepare("DELETE FROM k_skill_effect WHERE skill = :skill;");
+                $statement = $db->prepare("DELETE FROM skill_effect WHERE skill = :skill;");
                 $statement->bindValue(":skill", $skill->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
                 foreach ($skill->effects as $effect){
-                    $statement = $db->prepare("INSERT INTO k_skill_effect (skill, effect) VALUES (:skill, :effect);");
+                    $statement = $db->prepare("INSERT INTO skill_effect (skill, effect) VALUES (:skill, :effect);");
                     $statement->bindValue(":skill", $skill->com2us_id, SQLITE3_INTEGER);
                     $statement->bindValue(":effect", $effect->effect->id, SQLITE3_INTEGER);
                     output(4, "QUERY: " . $statement->getSQL(true));
@@ -483,10 +483,10 @@ while ($next != null){
     //echo "NEXTPAGE: " . $next;
 }
 
-// Loop units pages
+// Loop monsters pages
 $next = URL_UNIT;
 while ($next != null){
-    output(3, "Reading units page: $next");
+    output(3, "Reading monsters page: $next");
     $contents = file_get_contents($next);
     if($contents === false){
         output(0, "Unable to retrieve monster list.");
@@ -495,14 +495,14 @@ while ($next != null){
     $contents = json_decode($contents);
     $next = $contents->next;
     $list = $contents->results;
-    foreach ($list as $unit){
-        $statement = $db->prepare("SELECT * FROM k_unit WHERE id = :id");
-        $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+    foreach ($list as $monster){
+        $statement = $db->prepare("SELECT * FROM monster WHERE id = :id");
+        $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
         $q = $statement->execute();
         $r = $q->fetchArray(SQLITE3_ASSOC);
         if (!$r){
             $statement = $db->prepare("
-              INSERT INTO k_unit(
+              INSERT INTO monster(
                 id,
                 family,
                 name,
@@ -568,62 +568,62 @@ while ($next != null){
                 :craft_cost
               );
             ");
-            $statement->bindValue(":id", $unit->com2us_id, SQLITE3_TEXT);
-            $statement->bindValue(":family", $unit->family_id, SQLITE3_INTEGER);
-            $statement->bindValue(":name", $unit->name, SQLITE3_TEXT);
-            $statement->bindValue(":element", get_element_id($unit->element), SQLITE3_INTEGER);
-            $statement->bindValue(":archetype", get_archetype_id($unit->archetype), SQLITE3_INTEGER);
-            $statement->bindValue(":base_stars", $unit->base_stars, SQLITE3_INTEGER);
-            $statement->bindValue(":natural_stars", $unit->natural_stars, SQLITE3_INTEGER);
-            $statement->bindValue(":obtainable", $unit->obtainable, SQLITE3_INTEGER);
-            $statement->bindValue(":can_awaken", $unit->can_awaken, SQLITE3_INTEGER);
-            $statement->bindValue(":awaken_bonus", $unit->awaken_bonus, SQLITE3_TEXT);
-            $statement->bindValue(":skill_ups_to_max", $unit->skill_ups_to_max, SQLITE3_INTEGER);
-            if (isset($unit->leader_skill->id)){
-                $statement->bindValue(":leader_skill", $unit->leader_skill, SQLITE3_INTEGER);
+            $statement->bindValue(":id", $monster->com2us_id, SQLITE3_TEXT);
+            $statement->bindValue(":family", $monster->family_id, SQLITE3_INTEGER);
+            $statement->bindValue(":name", $monster->name, SQLITE3_TEXT);
+            $statement->bindValue(":element", get_element_id($monster->element), SQLITE3_INTEGER);
+            $statement->bindValue(":archetype", get_archetype_id($monster->archetype), SQLITE3_INTEGER);
+            $statement->bindValue(":base_stars", $monster->base_stars, SQLITE3_INTEGER);
+            $statement->bindValue(":natural_stars", $monster->natural_stars, SQLITE3_INTEGER);
+            $statement->bindValue(":obtainable", $monster->obtainable, SQLITE3_INTEGER);
+            $statement->bindValue(":can_awaken", $monster->can_awaken, SQLITE3_INTEGER);
+            $statement->bindValue(":awaken_bonus", $monster->awaken_bonus, SQLITE3_TEXT);
+            $statement->bindValue(":skill_ups_to_max", $monster->skill_ups_to_max, SQLITE3_INTEGER);
+            if (isset($monster->leader_skill->id)){
+                $statement->bindValue(":leader_skill", $monster->leader_skill, SQLITE3_INTEGER);
             }
             else{
                 $statement->bindValue(":leader_skill", null, SQLITE3_INTEGER);
             }
-            $statement->bindValue(":hp", $unit->base_hp, SQLITE3_INTEGER);
-            $statement->bindValue(":attack", $unit->base_attack, SQLITE3_INTEGER);
-            $statement->bindValue(":defense", $unit->base_defense, SQLITE3_INTEGER);
-            $statement->bindValue(":speed", $unit->speed, SQLITE3_INTEGER);
-            $statement->bindValue(":crit_rate", $unit->crit_rate, SQLITE3_INTEGER);
-            $statement->bindValue(":crit_damage", $unit->crit_damage, SQLITE3_INTEGER);
-            $statement->bindValue(":resistance", $unit->resistance, SQLITE3_INTEGER);
-            $statement->bindValue(":accuracy", $unit->accuracy, SQLITE3_INTEGER);
-            $statement->bindValue(":raw_hp", $unit->raw_hp, SQLITE3_INTEGER);
-            $statement->bindValue(":raw_attack", $unit->raw_attack, SQLITE3_INTEGER);
-            $statement->bindValue(":raw_defense", $unit->raw_defense, SQLITE3_INTEGER);
-            $statement->bindValue(":max_lvl_hp", $unit->max_lvl_hp, SQLITE3_INTEGER);
-            $statement->bindValue(":max_lvl_attack", $unit->max_lvl_attack, SQLITE3_INTEGER);
-            $statement->bindValue(":max_lvl_defense", $unit->max_lvl_defense, SQLITE3_INTEGER);
-            $statement->bindValue(":awakens_from", get_com2us_id($unit->awakens_from), SQLITE3_TEXT);
-            $statement->bindValue(":awakens_to", get_com2us_id($unit->awakens_to), SQLITE3_TEXT);
-            $statement->bindValue(":fusion_food", $unit->fusion_food, SQLITE3_INTEGER);
-            $statement->bindValue(":homunculus", $unit->homunculus, SQLITE3_INTEGER);
+            $statement->bindValue(":hp", $monster->base_hp, SQLITE3_INTEGER);
+            $statement->bindValue(":attack", $monster->base_attack, SQLITE3_INTEGER);
+            $statement->bindValue(":defense", $monster->base_defense, SQLITE3_INTEGER);
+            $statement->bindValue(":speed", $monster->speed, SQLITE3_INTEGER);
+            $statement->bindValue(":crit_rate", $monster->crit_rate, SQLITE3_INTEGER);
+            $statement->bindValue(":crit_damage", $monster->crit_damage, SQLITE3_INTEGER);
+            $statement->bindValue(":resistance", $monster->resistance, SQLITE3_INTEGER);
+            $statement->bindValue(":accuracy", $monster->accuracy, SQLITE3_INTEGER);
+            $statement->bindValue(":raw_hp", $monster->raw_hp, SQLITE3_INTEGER);
+            $statement->bindValue(":raw_attack", $monster->raw_attack, SQLITE3_INTEGER);
+            $statement->bindValue(":raw_defense", $monster->raw_defense, SQLITE3_INTEGER);
+            $statement->bindValue(":max_lvl_hp", $monster->max_lvl_hp, SQLITE3_INTEGER);
+            $statement->bindValue(":max_lvl_attack", $monster->max_lvl_attack, SQLITE3_INTEGER);
+            $statement->bindValue(":max_lvl_defense", $monster->max_lvl_defense, SQLITE3_INTEGER);
+            $statement->bindValue(":awakens_from", get_com2us_id($monster->awakens_from), SQLITE3_TEXT);
+            $statement->bindValue(":awakens_to", get_com2us_id($monster->awakens_to), SQLITE3_TEXT);
+            $statement->bindValue(":fusion_food", $monster->fusion_food, SQLITE3_INTEGER);
+            $statement->bindValue(":homunculus", $monster->homunculus, SQLITE3_INTEGER);
             $statement->bindValue(":craft_cost", 0, SQLITE3_INTEGER);
             output(4, "QUERY: " . $statement->getSQL(true));
             $statement->execute();
 
-            $url = 'https://swarfarm.com/static/herders/images/monsters/' . $unit->image_filename;   
-            $out = PATH . "public/img/unit/" . sprintf('%08d', $unit->com2us_id) . ".png";
+            $url = 'https://swarfarm.com/static/herders/images/monsters/' . $monster->image_filename;   
+            $out = PATH . "public/img/unit/" . sprintf('%08d', $monster->com2us_id) . ".png";
             download($url, $out);
 
             // Skills (not in database yet, but they will be once skills are parsed)
-            foreach ($unit->skills as $skill){
-                $statement = $db->prepare("INSERT INTO k_unit_skill (unit, skill) VALUES (:unit, :skill);");
-                $statement->bindValue(":unit", $unit->com2us_id, SQLITE3_INTEGER);
+            foreach ($monster->skills as $skill){
+                $statement = $db->prepare("INSERT INTO monster_skill (monster, skill) VALUES (:monster, :skill);");
+                $statement->bindValue(":monster", $monster->com2us_id, SQLITE3_INTEGER);
                 $statement->bindValue(":skill", $skill, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
 
             // Essences to awaken
-            foreach ($unit->awaken_cost as $essence){
-                $statement = $db->prepare("INSERT INTO k_unit_essence (unit, item, amount) VALUES (:unit, :item, :amount);");
-                $statement->bindValue(":unit", $unit->com2us_id, SQLITE3_INTEGER);
+            foreach ($monster->awaken_cost as $essence){
+                $statement = $db->prepare("INSERT INTO monster_essence (monster, item, amount) VALUES (:monster, :item, :amount);");
+                $statement->bindValue(":monster", $monster->com2us_id, SQLITE3_INTEGER);
                 $statement->bindValue(":item", $essence->item->com2us_id, SQLITE3_INTEGER);
                 $statement->bindValue(":amount", $essence->quantity, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
@@ -631,9 +631,9 @@ while ($next != null){
             }
 
             // Unit sources
-            foreach ($unit->source as $source){
-                $statement = $db->prepare("INSERT INTO k_unit_source (unit, source) VALUES (:unit, :source);");
-                $statement->bindValue(":unit", $unit->com2us_id, SQLITE3_INTEGER);
+            foreach ($monster->source as $source){
+                $statement = $db->prepare("INSERT INTO monster_source (monster, source) VALUES (:monster, :source);");
+                $statement->bindValue(":monster", $monster->com2us_id, SQLITE3_INTEGER);
                 $statement->bindValue(":source", $source->id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
@@ -641,227 +641,227 @@ while ($next != null){
         }
         else{
             // Compare all values
-            if ($r["family"] != $unit->family_id){
-                $statement = $db->prepare("UPDATE k_unit SET family = :family WHERE id = :id;");
-                $statement->bindValue(":family", $unit->family_id, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["family"] != $monster->family_id){
+                $statement = $db->prepare("UPDATE monster SET family = :family WHERE id = :id;");
+                $statement->bindValue(":family", $monster->family_id, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["name"] != $unit->name){
-                $statement = $db->prepare("UPDATE k_unit SET name = :name WHERE id = :id;");
-                $statement->bindValue(":name", $unit->name, SQLITE3_TEXT);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["name"] != $monster->name){
+                $statement = $db->prepare("UPDATE monster SET name = :name WHERE id = :id;");
+                $statement->bindValue(":name", $monster->name, SQLITE3_TEXT);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            $element = get_element_id($unit->element);
+            $element = get_element_id($monster->element);
             if ($r["element"] != $element){
-                $statement = $db->prepare("UPDATE k_unit SET element = :element WHERE id = :id;");
+                $statement = $db->prepare("UPDATE monster SET element = :element WHERE id = :id;");
                 $statement->bindValue(":element", $element, SQLITE3_TEXT);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            $archetype = get_archetype_id($unit->archetype);
+            $archetype = get_archetype_id($monster->archetype);
             if ($r["archetype"] != $archetype){
-                $statement = $db->prepare("UPDATE k_unit SET archetype = :archetype WHERE id = :id;");
+                $statement = $db->prepare("UPDATE monster SET archetype = :archetype WHERE id = :id;");
                 $statement->bindValue(":archetype", $archetype, SQLITE3_TEXT);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["base_stars"] != $unit->base_stars){
-                $statement = $db->prepare("UPDATE k_unit SET base_stars = :base_stars WHERE id = :id;");
-                $statement->bindValue(":base_stars", $unit->base_stars, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["base_stars"] != $monster->base_stars){
+                $statement = $db->prepare("UPDATE monster SET base_stars = :base_stars WHERE id = :id;");
+                $statement->bindValue(":base_stars", $monster->base_stars, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["natural_stars"] != $unit->natural_stars){
-                $statement = $db->prepare("UPDATE k_unit SET natural_stars = :natural_stars WHERE id = :id;");
-                $statement->bindValue(":natural_stars", $unit->natural_stars, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["natural_stars"] != $monster->natural_stars){
+                $statement = $db->prepare("UPDATE monster SET natural_stars = :natural_stars WHERE id = :id;");
+                $statement->bindValue(":natural_stars", $monster->natural_stars, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["obtainable"] != $unit->obtainable){
-                $statement = $db->prepare("UPDATE k_unit SET obtainable = :obtainable WHERE id = :id;");
-                $statement->bindValue(":obtainable", $unit->obtainable, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["obtainable"] != $monster->obtainable){
+                $statement = $db->prepare("UPDATE monster SET obtainable = :obtainable WHERE id = :id;");
+                $statement->bindValue(":obtainable", $monster->obtainable, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["can_awaken"] != $unit->can_awaken){
-                $statement = $db->prepare("UPDATE k_unit SET can_awaken = :can_awaken WHERE id = :id;");
-                $statement->bindValue(":can_awaken", $unit->can_awaken, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["can_awaken"] != $monster->can_awaken){
+                $statement = $db->prepare("UPDATE monster SET can_awaken = :can_awaken WHERE id = :id;");
+                $statement->bindValue(":can_awaken", $monster->can_awaken, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["awaken_bonus"] != $unit->awaken_bonus && $unit->awaken_bonus != 0){
-                $statement = $db->prepare("UPDATE k_unit SET awaken_bonus = :awaken_bonus WHERE id = :id;");
-                $statement->bindValue(":awaken_bonus", $unit->awaken_bonus, SQLITE3_TEXT);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_TEXT);
+            if ($r["awaken_bonus"] != $monster->awaken_bonus && $monster->awaken_bonus != 0){
+                $statement = $db->prepare("UPDATE monster SET awaken_bonus = :awaken_bonus WHERE id = :id;");
+                $statement->bindValue(":awaken_bonus", $monster->awaken_bonus, SQLITE3_TEXT);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_TEXT);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["skill_ups_to_max"] != $unit->skill_ups_to_max){
-                $statement = $db->prepare("UPDATE k_unit SET skill_ups_to_max = :skill_ups_to_max WHERE id = :id;");
-                $statement->bindValue(":skill_ups_to_max", $unit->skill_ups_to_max, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["skill_ups_to_max"] != $monster->skill_ups_to_max){
+                $statement = $db->prepare("UPDATE monster SET skill_ups_to_max = :skill_ups_to_max WHERE id = :id;");
+                $statement->bindValue(":skill_ups_to_max", $monster->skill_ups_to_max, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if (isset($unit->leader_skill->id) && $r["leader_skill"] != $unit->leader_skill->id){
-                $statement = $db->prepare("UPDATE k_unit SET leader_skill = :leader_skill WHERE id = :id;");
-                $statement->bindValue(":leader_skill", $unit->leader_skill->id, SQLITE3_TEXT);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if (isset($monster->leader_skill->id) && $r["leader_skill"] != $monster->leader_skill->id){
+                $statement = $db->prepare("UPDATE monster SET leader_skill = :leader_skill WHERE id = :id;");
+                $statement->bindValue(":leader_skill", $monster->leader_skill->id, SQLITE3_TEXT);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["hp"] != $unit->base_hp){
-                $statement = $db->prepare("UPDATE k_unit SET hp = :hp WHERE id = :id;");
-                $statement->bindValue(":hp", $unit->base_hp, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["hp"] != $monster->base_hp){
+                $statement = $db->prepare("UPDATE monster SET hp = :hp WHERE id = :id;");
+                $statement->bindValue(":hp", $monster->base_hp, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["attack"] != $unit->base_attack){
-                $statement = $db->prepare("UPDATE k_unit SET attack = :attack WHERE id = :id;");
-                $statement->bindValue(":attack", $unit->base_attack, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["attack"] != $monster->base_attack){
+                $statement = $db->prepare("UPDATE monster SET attack = :attack WHERE id = :id;");
+                $statement->bindValue(":attack", $monster->base_attack, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["defense"] != $unit->base_defense){
-                $statement = $db->prepare("UPDATE k_unit SET defense = :defense WHERE id = :id;");
-                $statement->bindValue(":defense", $unit->base_defense, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["defense"] != $monster->base_defense){
+                $statement = $db->prepare("UPDATE monster SET defense = :defense WHERE id = :id;");
+                $statement->bindValue(":defense", $monster->base_defense, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["speed"] != $unit->speed){
-                $statement = $db->prepare("UPDATE k_unit SET speed = :speed WHERE id = :id;");
-                $statement->bindValue(":speed", $unit->speed, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["speed"] != $monster->speed){
+                $statement = $db->prepare("UPDATE monster SET speed = :speed WHERE id = :id;");
+                $statement->bindValue(":speed", $monster->speed, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["crit_rate"] != $unit->crit_rate){
-                $statement = $db->prepare("UPDATE k_unit SET crit_rate = :crit_rate WHERE id = :id;");
-                $statement->bindValue(":crit_rate", $unit->crit_rate, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["crit_rate"] != $monster->crit_rate){
+                $statement = $db->prepare("UPDATE monster SET crit_rate = :crit_rate WHERE id = :id;");
+                $statement->bindValue(":crit_rate", $monster->crit_rate, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["crit_damage"] != $unit->crit_damage){
-                $statement = $db->prepare("UPDATE k_unit SET crit_damage = :crit_damage WHERE id = :id;");
-                $statement->bindValue(":crit_damage", $unit->crit_damage, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["crit_damage"] != $monster->crit_damage){
+                $statement = $db->prepare("UPDATE monster SET crit_damage = :crit_damage WHERE id = :id;");
+                $statement->bindValue(":crit_damage", $monster->crit_damage, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["resistance"] != $unit->resistance){
-                $statement = $db->prepare("UPDATE k_unit SET resistance = :resistance WHERE id = :id;");
-                $statement->bindValue(":resistance", $unit->resistance, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["resistance"] != $monster->resistance){
+                $statement = $db->prepare("UPDATE monster SET resistance = :resistance WHERE id = :id;");
+                $statement->bindValue(":resistance", $monster->resistance, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["accuracy"] != $unit->accuracy){
-                $statement = $db->prepare("UPDATE k_unit SET accuracy = :accuracy WHERE id = :id;");
-                $statement->bindValue(":accuracy", $unit->accuracy, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["accuracy"] != $monster->accuracy){
+                $statement = $db->prepare("UPDATE monster SET accuracy = :accuracy WHERE id = :id;");
+                $statement->bindValue(":accuracy", $monster->accuracy, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["raw_hp"] != $unit->raw_hp){
-                $statement = $db->prepare("UPDATE k_unit SET raw_hp = :raw_hp WHERE id = :id;");
-                $statement->bindValue(":raw_hp", $unit->raw_hp, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["raw_hp"] != $monster->raw_hp){
+                $statement = $db->prepare("UPDATE monster SET raw_hp = :raw_hp WHERE id = :id;");
+                $statement->bindValue(":raw_hp", $monster->raw_hp, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["raw_attack"] != $unit->raw_attack){
-                $statement = $db->prepare("UPDATE k_unit SET raw_attack = :raw_attack WHERE id = :id;");
-                $statement->bindValue(":raw_attack", $unit->raw_attack, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["raw_attack"] != $monster->raw_attack){
+                $statement = $db->prepare("UPDATE monster SET raw_attack = :raw_attack WHERE id = :id;");
+                $statement->bindValue(":raw_attack", $monster->raw_attack, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["raw_defense"] != $unit->raw_defense){
-                $statement = $db->prepare("UPDATE k_unit SET raw_defense = :raw_defense WHERE id = :id;");
-                $statement->bindValue(":raw_defense", $unit->raw_defense, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["raw_defense"] != $monster->raw_defense){
+                $statement = $db->prepare("UPDATE monster SET raw_defense = :raw_defense WHERE id = :id;");
+                $statement->bindValue(":raw_defense", $monster->raw_defense, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["max_lvl_hp"] != $unit->max_lvl_hp){
-                $statement = $db->prepare("UPDATE k_unit SET max_lvl_hp = :max_lvl_hp WHERE id = :id;");
-                $statement->bindValue(":max_lvl_hp", $unit->max_lvl_hp, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["max_lvl_hp"] != $monster->max_lvl_hp){
+                $statement = $db->prepare("UPDATE monster SET max_lvl_hp = :max_lvl_hp WHERE id = :id;");
+                $statement->bindValue(":max_lvl_hp", $monster->max_lvl_hp, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["max_lvl_attack"] != $unit->max_lvl_attack){
-                $statement = $db->prepare("UPDATE k_unit SET max_lvl_attack = :max_lvl_attack WHERE id = :id;");
-                $statement->bindValue(":max_lvl_attack", $unit->max_lvl_attack, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["max_lvl_attack"] != $monster->max_lvl_attack){
+                $statement = $db->prepare("UPDATE monster SET max_lvl_attack = :max_lvl_attack WHERE id = :id;");
+                $statement->bindValue(":max_lvl_attack", $monster->max_lvl_attack, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["max_lvl_defense"] != $unit->max_lvl_defense){
-                $statement = $db->prepare("UPDATE k_unit SET max_lvl_defense = :max_lvl_defense WHERE id = :id;");
-                $statement->bindValue(":max_lvl_defense", $unit->max_lvl_defense, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["max_lvl_defense"] != $monster->max_lvl_defense){
+                $statement = $db->prepare("UPDATE monster SET max_lvl_defense = :max_lvl_defense WHERE id = :id;");
+                $statement->bindValue(":max_lvl_defense", $monster->max_lvl_defense, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            $com2us_id = get_com2us_id($unit->awakens_from);
+            $com2us_id = get_com2us_id($monster->awakens_from);
             if ($r["awakens_from"] != $com2us_id){
-                $statement = $db->prepare("UPDATE k_unit SET awakens_from = :awakens_from WHERE id = :id;");
+                $statement = $db->prepare("UPDATE monster SET awakens_from = :awakens_from WHERE id = :id;");
                 $statement->bindValue(":awakens_from", $com2us_id, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            $com2us_id = get_com2us_id($unit->awakens_to);
+            $com2us_id = get_com2us_id($monster->awakens_to);
             if ($r["awakens_to"] != $com2us_id){
-                $statement = $db->prepare("UPDATE k_unit SET awakens_to = :awakens_to WHERE id = :id;");
+                $statement = $db->prepare("UPDATE monster SET awakens_to = :awakens_to WHERE id = :id;");
                 $statement->bindValue(":awakens_to", $com2us_id, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["fusion_food"] != $unit->fusion_food){
-                $statement = $db->prepare("UPDATE k_unit SET fusion_food = :fusion_food WHERE id = :id;");
-                $statement->bindValue(":fusion_food", $unit->fusion_food, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["fusion_food"] != $monster->fusion_food){
+                $statement = $db->prepare("UPDATE monster SET fusion_food = :fusion_food WHERE id = :id;");
+                $statement->bindValue(":fusion_food", $monster->fusion_food, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
-            if ($r["homunculus"] != $unit->homunculus){
-                $statement = $db->prepare("UPDATE k_unit SET homunculus = :homunculus WHERE id = :id;");
-                $statement->bindValue(":homunculus", $unit->homunculus, SQLITE3_INTEGER);
-                $statement->bindValue(":id", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["homunculus"] != $monster->homunculus){
+                $statement = $db->prepare("UPDATE monster SET homunculus = :homunculus WHERE id = :id;");
+                $statement->bindValue(":homunculus", $monster->homunculus, SQLITE3_INTEGER);
+                $statement->bindValue(":id", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
             }
 
-            // Loop skills. Only for inserting in k_skill and k_unit_skill
-            $statement = $db->prepare("SELECT count(skill) AS c FROM k_unit_skill WHERE unit = :unit;");
-            $statement->bindValue(":unit", $unit->com2us_id, SQLITE3_INTEGER);
+            // Loop skills. Only for inserting in skill and monster_skill
+            $statement = $db->prepare("SELECT count(skill) AS c FROM monster_skill WHERE monster = :monster;");
+            $statement->bindValue(":monster", $monster->com2us_id, SQLITE3_INTEGER);
             $q = $statement->execute();
             $r = $q->fetchArray(SQLITE3_ASSOC);
-            if ($r["c"] != sizeof($unit->skills)){
-                $statement = $db->prepare("DELETE FROM k_unit_skill WHERE unit = :unit;");
-                $statement->bindValue(":unit", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["c"] != sizeof($monster->skills)){
+                $statement = $db->prepare("DELETE FROM monster_skill WHERE monster = :monster;");
+                $statement->bindValue(":monster", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
-                foreach ($unit->skills as $skill){
-                    $statement = $db->prepare("INSERT INTO k_unit_skill (unit, skill) VALUES (:unit, :skill);");
-                    $statement->bindValue(":unit", $unit->com2us_id, SQLITE3_INTEGER);
+                foreach ($monster->skills as $skill){
+                    $statement = $db->prepare("INSERT INTO monster_skill (monster, skill) VALUES (:monster, :skill);");
+                    $statement->bindValue(":monster", $monster->com2us_id, SQLITE3_INTEGER);
                     $statement->bindValue(":skill", $skill, SQLITE3_INTEGER);
                     output(4, "QUERY: " . $statement->getSQL(true));
                     $statement->execute();
@@ -869,18 +869,18 @@ while ($next != null){
             }
 
             // Essences to awaken
-            $statement = $db->prepare("SELECT count(item) AS c FROM k_unit_essence WHERE unit = :unit;");
-            $statement->bindValue(":unit", $unit->com2us_id, SQLITE3_INTEGER);
+            $statement = $db->prepare("SELECT count(item) AS c FROM monster_essence WHERE monster = :monster;");
+            $statement->bindValue(":monster", $monster->com2us_id, SQLITE3_INTEGER);
             $q = $statement->execute();
             $r = $q->fetchArray(SQLITE3_ASSOC);
-            if ($r["c"] != sizeof($unit->awaken_cost)){
-                $statement = $db->prepare("DELETE FROM k_unit_essence WHERE unit = :unit;");
-                $statement->bindValue(":unit", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["c"] != sizeof($monster->awaken_cost)){
+                $statement = $db->prepare("DELETE FROM monster_essence WHERE monster = :monster;");
+                $statement->bindValue(":monster", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
-                foreach ($unit->awaken_cost as $essence){
-                    $statement = $db->prepare("INSERT INTO k_unit_essence (unit, item, amount) VALUES (:unit, :item, :amount);");
-                    $statement->bindValue(":unit", $unit->com2us_id, SQLITE3_INTEGER);
+                foreach ($monster->awaken_cost as $essence){
+                    $statement = $db->prepare("INSERT INTO monster_essence (monster, item, amount) VALUES (:monster, :item, :amount);");
+                    $statement->bindValue(":monster", $monster->com2us_id, SQLITE3_INTEGER);
                     $statement->bindValue(":item", $essence->item->com2us_id, SQLITE3_INTEGER);
                     $statement->bindValue(":amount", $essence->quantity, SQLITE3_INTEGER);
                     output(4, "QUERY: " . $statement->getSQL(true));
@@ -889,18 +889,18 @@ while ($next != null){
             }
 
             // Unit sources
-            $statement = $db->prepare("SELECT count(source) AS c FROM k_unit_source WHERE unit = :unit;");
-            $statement->bindValue(":unit", $unit->com2us_id, SQLITE3_INTEGER);
+            $statement = $db->prepare("SELECT count(source) AS c FROM monster_source WHERE monster = :monster;");
+            $statement->bindValue(":monster", $monster->com2us_id, SQLITE3_INTEGER);
             $q = $statement->execute();
             $r = $q->fetchArray(SQLITE3_ASSOC);
-            if ($r["c"] != sizeof($unit->source)){
-                $statement = $db->prepare("DELETE FROM k_unit_source WHERE unit = :unit;");
-                $statement->bindValue(":unit", $unit->com2us_id, SQLITE3_INTEGER);
+            if ($r["c"] != sizeof($monster->source)){
+                $statement = $db->prepare("DELETE FROM monster_source WHERE monster = :monster;");
+                $statement->bindValue(":monster", $monster->com2us_id, SQLITE3_INTEGER);
                 output(4, "QUERY: " . $statement->getSQL(true));
                 $statement->execute();
-                foreach ($unit->source as $source){
-                    $statement = $db->prepare("INSERT INTO k_unit_source (unit, source) VALUES (:unit, :source);");
-                    $statement->bindValue(":unit", $unit->com2us_id, SQLITE3_INTEGER);
+                foreach ($monster->source as $source){
+                    $statement = $db->prepare("INSERT INTO monster_source (monster, source) VALUES (:monster, :source);");
+                    $statement->bindValue(":monster", $monster->com2us_id, SQLITE3_INTEGER);
                     $statement->bindValue(":source", $source->id, SQLITE3_INTEGER);
                     output(4, "QUERY: " . $statement->getSQL(true));
                     $statement->execute();
@@ -908,8 +908,8 @@ while ($next != null){
             }
 
             // Image download
-            $out = PATH . "public/img/unit/" . sprintf('%08d', $unit->com2us_id) . ".png";
-            $url = 'https://swarfarm.com/static/herders/images/monsters/' . $unit->image_filename;   
+            $out = PATH . "public/img/unit/" . sprintf('%08d', $monster->com2us_id) . ".png";
+            $url = 'https://swarfarm.com/static/herders/images/monsters/' . $monster->image_filename;   
             download($url, $out);
         }
     }

BIN
public/img/artifact/base.png


BIN
public/img/skill/00003151.png


BIN
public/img/skill/00003152.png


BIN
public/img/skill/00003153.png


BIN
public/img/skill/00003154.png


BIN
public/img/skill/00003155.png


BIN
public/img/skill/00003156.png


BIN
public/img/skill/00003157.png


BIN
public/img/skill/00003158.png


BIN
public/img/skill/00003159.png


BIN
public/img/skill/00003160.png


BIN
public/img/skill/00003161.png


BIN
public/img/skill/00003162.png


BIN
public/img/skill/00003163.png


BIN
public/img/skill/00003164.png


BIN
public/img/skill/00003165.png


BIN
public/img/skill/00003166.png


BIN
public/img/skill/00003167.png


BIN
public/img/skill/00003168.png


BIN
public/img/skill/00003169.png


BIN
public/img/skill/00003170.png


BIN
public/img/skill/00003171.png


BIN
public/img/skill/00013717.png


+ 0 - 0
public/img/skill/00015101.png


+ 0 - 0
public/img/skill/00015102.png


+ 0 - 0
public/img/skill/00015103.png


+ 0 - 0
public/img/skill/00015104.png


+ 0 - 0
public/img/skill/00015105.png


+ 0 - 0
public/img/skill/00015106.png


+ 0 - 0
public/img/skill/00015107.png


+ 0 - 0
public/img/skill/00015108.png


+ 0 - 0
public/img/skill/00015109.png


+ 0 - 0
public/img/skill/00015110.png


+ 0 - 0
public/img/skill/00015111.png


+ 0 - 0
public/img/skill/00015112.png


+ 0 - 0
public/img/skill/00015113.png


+ 0 - 0
public/img/skill/00015114.png


+ 0 - 0
public/img/skill/00015115.png


+ 0 - 0
public/img/skill/00015201.png


+ 0 - 0
public/img/skill/00015202.png


+ 0 - 0
public/img/skill/00015203.png


+ 0 - 0
public/img/skill/00015204.png


+ 0 - 0
public/img/skill/00015205.png


+ 0 - 0
public/img/skill/00015206.png


+ 0 - 0
public/img/skill/00015207.png


BIN
public/img/skill/00015208.png


BIN
public/img/skill/00015209.png


BIN
public/img/skill/00015210.png


BIN
public/img/skill/00015211.png


BIN
public/img/skill/00015212.png


BIN
public/img/skill/00015213.png


BIN
public/img/skill/00015214.png


BIN
public/img/skill/00015215.png


BIN
public/img/skill/00015301.png


BIN
public/img/skill/00015302.png


BIN
public/img/skill/00015303.png


BIN
public/img/skill/00015304.png


BIN
public/img/skill/00015305.png


BIN
public/img/skill/00015306.png


BIN
public/img/skill/00015307.png


BIN
public/img/skill/00015308.png


BIN
public/img/skill/00015309.png


BIN
public/img/skill/00015310.png


BIN
public/img/skill/00015311.png


BIN
public/img/skill/00015312.png


BIN
public/img/skill/00015313.png


BIN
public/img/skill/00015314.png


BIN
public/img/skill/00015315.png


BIN
public/img/skill/00015316.png


BIN
public/img/skill/00015317.png


BIN
public/img/skill/00015318.png


BIN
public/img/skill/00015319.png


BIN
public/img/skill/00015320.png


BIN
public/img/skill/00015321.png


BIN
public/img/skill/00130101.png


BIN
public/img/skill/00130102.png


BIN
public/img/skill/00130103.png


BIN
public/img/skill/00130104.png


BIN
public/img/skill/00130105.png


BIN
public/img/skill/00130106.png


BIN
public/img/skill/00130107.png


BIN
public/img/skill/00130108.png


BIN
public/img/skill/00130109.png


BIN
public/img/skill/00130110.png


BIN
public/img/unit/00012031.png


BIN
public/img/unit/00012032.png


BIN
public/img/unit/00012033.png


BIN
public/img/unit/00012034.png


BIN
public/img/unit/00012035.png


BIN
public/img/unit/00025201.png


BIN
public/img/unit/00025202.png


BIN
public/img/unit/00025203.png


BIN
public/img/unit/00025204.png


BIN
public/img/unit/00025205.png


BIN
public/img/unit/00025211.png


BIN
public/img/unit/00025212.png


BIN
public/img/unit/00025213.png


BIN
public/img/unit/00025214.png


Некоторые файлы не были показаны из-за большого количества измененных файлов