فهرست منبع

IDs treated as text to prevento overflow in 32bit systems.

Iñigo Valentin 5 سال پیش
والد
کامیت
f8bf5d3850
41فایلهای تغییر یافته به همراه159 افزوده شده و 154 حذف شده
  1. 2 2
      application/API/v3/units/GET.php
  2. 2 2
      application/action/change_game_mode.php
  3. 4 4
      application/action/delete_team.php
  4. 4 4
      application/action/edit_profile.php
  5. 11 11
      application/action/new_team.php
  6. 5 5
      application/action/optimize_get_rune_list.php
  7. 3 3
      application/action/rate_team.php
  8. 11 11
      application/action/save_run_team.php
  9. 2 2
      application/entity/Artifact.php
  10. 3 3
      application/entity/Artifact_Effect.php
  11. 1 1
      application/entity/Artifact_Stat.php
  12. 1 1
      application/entity/Building.php
  13. 1 1
      application/entity/Decoration.php
  14. 1 1
      application/entity/Enchantment.php
  15. 5 5
      application/entity/Fusion.php
  16. 2 2
      application/entity/Guild.php
  17. 1 1
      application/entity/Guild_Member.php
  18. 2 2
      application/entity/Inventory.php
  19. 3 3
      application/entity/K_Area.php
  20. 1 1
      application/entity/K_Building.php
  21. 2 2
      application/entity/K_Decoration.php
  22. 1 1
      application/entity/K_Effect.php
  23. 1 1
      application/entity/K_Guild_Skill.php
  24. 2 2
      application/entity/K_Guild_Skill_Group.php
  25. 2 2
      application/entity/K_Inventory.php
  26. 1 1
      application/entity/K_Leader_Skill.php
  27. 1 1
      application/entity/K_Rune_Set.php
  28. 3 3
      application/entity/K_Skill.php
  29. 2 2
      application/entity/K_Skill_Level.php
  30. 1 1
      application/entity/K_Source.php
  31. 5 5
      application/entity/K_Unit.php
  32. 1 1
      application/entity/K_Unit_Transformation.php
  33. 14 14
      application/entity/Player.php
  34. 6 6
      application/entity/Record.php
  35. 9 9
      application/entity/Run.php
  36. 17 17
      application/entity/Rune.php
  37. 2 2
      application/entity/Rune_Stat.php
  38. 2 2
      application/entity/Team.php
  39. 15 15
      application/entity/Unit.php
  40. 1 1
      application/page/Teams_Page.php
  41. 6 1
      application/view/monster.php

+ 2 - 2
application/API/v3/units/GET.php

@@ -58,7 +58,7 @@
             k_unit.archetype = k_archetype.id AND
             k_unit.id = :id ;
         ");
-        $statement->bindValue(":id", $id, SQLITE3_INTEGER);
+        $statement->bindValue(":id", $id, SQLITE3_TEXT);
         $q = $statement->execute();
         $r = $q->fetchArray(SQLITE3_ASSOC);
         if ($r){
@@ -210,7 +210,7 @@
                 k_unit_skill.unit = :id 
               ORDER BY slot;
             ");
-            $statement_skills->bindValue(":id", $id, SQLITE3_INTEGER);
+            $statement_skills->bindValue(":id", $id, SQLITE3_TEXT);
             $q_skills = $statement_skills->execute();
             while ($r_skills = $q_skills->fetchArray(SQLITE3_ASSOC)){
                 $skill = [

+ 2 - 2
application/action/change_game_mode.php

@@ -33,8 +33,8 @@
           SET mode = :mode
           WHERE uid = :uid;
         ");
-        $statement->bindValue(":mode", $mode, SQLITE3_INTEGER);
-        $statement->bindValue(":uid", $player, SQLITE3_INTEGER);
+        $statement->bindValue(":mode", $mode, SQLITE3_TEXT);
+        $statement->bindValue(":uid", $player, SQLITE3_TEXT);
         $statement->execute();
         header("HTTP/1.1 201 OK");
         die();

+ 4 - 4
application/action/delete_team.php

@@ -25,12 +25,12 @@
         $player = filter_input(INPUT_POST, 'uid');
         $id = filter_input(INPUT_POST, 'id');
         $statement = $db->prepare('DELETE FROM team WHERE uid = :uid AND id = :id;');
-        $statement->bindValue(':uid', $player, SQLITE3_INTEGER);
-        $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+        $statement->bindValue(':uid', $player, SQLITE3_TEXT);
+        $statement->bindValue(':id', $id, SQLITE3_TEXT);
         $statement->execute();
         $statement = $db->prepare('DELETE FROM team_unit WHERE team = :id;');
-        $statement->bindValue(':uid', $player, SQLITE3_INTEGER);
-        $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+        $statement->bindValue(':uid', $player, SQLITE3_TEXT);
+        $statement->bindValue(':id', $id, SQLITE3_TEXT);
         $statement->execute();
         return 0;
     }

+ 4 - 4
application/action/edit_profile.php

@@ -37,7 +37,7 @@
                 return -1;
             }
             $s = $db->prepare('UPDATE player SET mail = :mail WHERE uid = :uid;');
-            $s->bindValue(':uid', $player, SQLITE3_INTEGER);
+            $s->bindValue(':uid', $player, SQLITE3_TEXT);
             $s->bindValue(':mail', $mail, SQLITE3_TEXT);
             if(!$s->execute()){
                 return -2;
@@ -48,7 +48,7 @@
             $pass = sha1(filter_input(INPUT_POST, 'pass'));
             $currentPass = sha1(filter_input(INPUT_POST, 'currentPass'));
             $s = $db->prepare('SELECT COUNT(uid) AS count FROM player WHERE uid = :uid AND password = :currentPass;');
-            $s->bindValue(':uid', $player, SQLITE3_INTEGER);
+            $s->bindValue(':uid', $player, SQLITE3_TEXT);
             $s->bindValue(':currentPass', $currentPass, SQLITE3_TEXT);
             $q = $s->execute();
             $r = $q->fetchArray(SQLITE3_ASSOC);
@@ -56,7 +56,7 @@
                 return -3;
             }
             $s = $db->prepare('UPDATE player SET password = :pass WHERE uid = :uid AND password = :currentPass;');
-            $s->bindValue(':uid', $player, SQLITE3_INTEGER);
+            $s->bindValue(':uid', $player, SQLITE3_TEXT);
             $s->bindValue(':pass', $pass, SQLITE3_TEXT);
             $s->bindValue(':currentPass', $currentPass, SQLITE3_TEXT);
             if(!$s->execute()){
@@ -72,7 +72,7 @@
                 $api .= $characters[rand(0, $charactersLength - 1)];
             }
             $s = $db->prepare('UPDATE player SET api_key = :api WHERE uid = :uid;');
-            $s->bindValue(':uid', $player, SQLITE3_INTEGER);
+            $s->bindValue(':uid', $player, SQLITE3_TEXT);
             $s->bindValue(':api', $api, SQLITE3_TEXT);
             if(!$s->execute()){
                 return -5;

+ 11 - 11
application/action/new_team.php

@@ -172,15 +172,15 @@
         $r = $q->fetchArray(SQLITE3_ASSOC);
         $team_id = $r["id"];
         $statement = $db->prepare('INSERT INTO team (uid, id, name, description, area_type, area, stage, difficulty, score) VALUES (:uid, :id, :name, :description, :area_type, :area, :stage, :difficulty, :score);');
-        $statement->bindValue(':uid', $player, SQLITE3_INTEGER);
-        $statement->bindValue(':id', $team_id, SQLITE3_INTEGER);
+        $statement->bindValue(':uid', $player, SQLITE3_TEXT);
+        $statement->bindValue(':id', $team_id, SQLITE3_TEXT);
         $statement->bindValue(':name', $name, SQLITE3_TEXT);
         $statement->bindValue(':description', $description, SQLITE3_TEXT);
-        $statement->bindValue(':area_type', $area_type, SQLITE3_INTEGER);
-        $statement->bindValue(':area', $area, SQLITE3_INTEGER);
-        $statement->bindValue(':stage', $stage, SQLITE3_INTEGER);
-        $statement->bindValue(':difficulty', $difficulty, SQLITE3_INTEGER);
-        $statement->bindValue(':score', $score, SQLITE3_INTEGER);
+        $statement->bindValue(':area_type', $area_type, SQLITE3_TEXT);
+        $statement->bindValue(':area', $area, SQLITE3_TEXT);
+        $statement->bindValue(':stage', $stage, SQLITE3_TEXT);
+        $statement->bindValue(':difficulty', $difficulty, SQLITE3_TEXT);
+        $statement->bindValue(':score', $score, SQLITE3_TEXT);
         $res = $statement->execute();
         if (!$res){
             return -5;
@@ -200,10 +200,10 @@
               INSERT INTO team_unit (team, unit, leader, front)
               VALUES (:team, :unit, :leader, :front);
             ");
-            $statement->bindValue(':team', $team_id, SQLITE3_INTEGER);
-            $statement->bindValue(':unit', $i, SQLITE3_INTEGER);
-            $statement->bindValue(':leader', $leader, SQLITE3_INTEGER);
-            $statement->bindValue(':front', $front, SQLITE3_INTEGER);
+            $statement->bindValue(':team', $team_id, SQLITE3_TEXT);
+            $statement->bindValue(':unit', $i, SQLITE3_TEXT);
+            $statement->bindValue(':leader', $leader, SQLITE3_TEXT);
+            $statement->bindValue(':front', $front, SQLITE3_TEXT);
             $statement->execute();
             $j ++;
         }

+ 5 - 5
application/action/optimize_get_rune_list.php

@@ -177,11 +177,11 @@
         $total_candidates = 0;
         for ($i = 1; $i <= 6; $i ++){
             $statement = $db->prepare($s[$i]);
-            $statement->bindValue(':uid', $uid, SQLITE3_INTEGER);
-            $statement->bindValue(':unit_id', $unit_id, SQLITE3_INTEGER);
-            $statement->bindValue(':stat_0', $stats[0], SQLITE3_INTEGER);
-            $statement->bindValue(':stat_1', $stats[1], SQLITE3_INTEGER);
-            $statement->bindValue(':stat_2', $stats[2], SQLITE3_INTEGER);
+            $statement->bindValue(':uid', $uid, SQLITE3_TEXT);
+            $statement->bindValue(':unit_id', $unit_id, SQLITE3_TEXT);
+            $statement->bindValue(':stat_0', $stats[0], SQLITE3_TEXT);
+            $statement->bindValue(':stat_1', $stats[1], SQLITE3_TEXT);
+            $statement->bindValue(':stat_2', $stats[2], SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 $rune = create_rune_array($unit, $r, $tuning);

+ 3 - 3
application/action/rate_team.php

@@ -33,9 +33,9 @@
             uid = :uid AND
             id = :team;
         ");
-        $statement->bindValue(":score", $score, SQLITE3_INTEGER);
-        $statement->bindValue(":uid", $player, SQLITE3_INTEGER);
-        $statement->bindValue(":team", $team, SQLITE3_INTEGER);
+        $statement->bindValue(":score", $score, SQLITE3_TEXT);
+        $statement->bindValue(":uid", $player, SQLITE3_TEXT);
+        $statement->bindValue(":team", $team, SQLITE3_TEXT);
         $statement->execute();
         return 0;
     }

+ 11 - 11
application/action/save_run_team.php

@@ -49,22 +49,22 @@
             k_area.id = run.area AND
             run.helper = 0;
         ");
-        $statement->bindValue(':uid', $player, SQLITE3_INTEGER);
-        $statement->bindValue(':run', $run, SQLITE3_INTEGER);
+        $statement->bindValue(':uid', $player, SQLITE3_TEXT);
+        $statement->bindValue(':run', $run, SQLITE3_TEXT);
         $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
         if (!$r){
             return -2;
         }
         $statement = $db->prepare('INSERT INTO team (uid, id, name, description, area_type, area, stage, difficulty, score) VALUES (:uid, :id, :name, :description, :area_type, :area, :stage, :difficulty, :score);');
-        $statement->bindValue(':uid', $player, SQLITE3_INTEGER);
-        $statement->bindValue(':id', $team_id, SQLITE3_INTEGER);
+        $statement->bindValue(':uid', $player, SQLITE3_TEXT);
+        $statement->bindValue(':id', $team_id, SQLITE3_TEXT);
         $statement->bindValue(':name', $name, SQLITE3_TEXT);
         $statement->bindValue(':description', $description, SQLITE3_TEXT);
-        $statement->bindValue(':area_type', $r["area_type"], SQLITE3_INTEGER);
-        $statement->bindValue(':area', $r["area"], SQLITE3_INTEGER);
-        $statement->bindValue(':stage', $r["stage"], SQLITE3_INTEGER);
-        $statement->bindValue(':difficulty', $r["difficulty"], SQLITE3_INTEGER);
-        $statement->bindValue(':score', 0, SQLITE3_INTEGER);
+        $statement->bindValue(':area_type', $r["area_type"], SQLITE3_TEXT);
+        $statement->bindValue(':area', $r["area"], SQLITE3_TEXT);
+        $statement->bindValue(':stage', $r["stage"], SQLITE3_TEXT);
+        $statement->bindValue(':difficulty', $r["difficulty"], SQLITE3_TEXT);
+        $statement->bindValue(':score', 0, SQLITE3_TEXT);
         $res = $statement->execute();
         if (!$res){
             return -3;
@@ -76,8 +76,8 @@
               INSERT INTO team_unit (team, unit)
               VALUES (:team, :unit)
             ");
-            $statement->bindValue(':team', $team_id, SQLITE3_INTEGER);
-            $statement->bindValue(':unit', $r["unit"], SQLITE3_INTEGER);
+            $statement->bindValue(':team', $team_id, SQLITE3_TEXT);
+            $statement->bindValue(':unit', $r["unit"], SQLITE3_TEXT);
             $statement->execute();
         }
         return 0;

+ 2 - 2
application/entity/Artifact.php

@@ -144,7 +144,7 @@
               FROM artifact
               WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->id = $r["id"];
@@ -171,7 +171,7 @@
                   WHERE artifact = :artifact
                   ORDER BY slot;
                 ");
-                $statement->bindValue(':artifact', $this->id, SQLITE3_INTEGER);
+                $statement->bindValue(':artifact', $this->id, SQLITE3_TEXT);
                 $q = $statement->execute();
                 while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                     array_push($this->effects, new Artifact_Effect($this->id, $r["slot"]));

+ 3 - 3
application/entity/Artifact_Effect.php

@@ -81,8 +81,8 @@
                 artifact = :artifact AND
                 slot = :slot;
             ");
-            $statement->bindValue(':artifact', $artifact, SQLITE3_INTEGER);
-            $statement->bindValue(':slot', $slot, SQLITE3_INTEGER);
+            $statement->bindValue(':artifact', $artifact, SQLITE3_TEXT);
+            $statement->bindValue(':slot', $slot, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->effect = $r["effect"];
@@ -95,7 +95,7 @@
                   FROM k_artifact_effect
                   WHERE id = :id;
                 ");
-                $statement->bindValue(':id', $this->effect, SQLITE3_INTEGER);
+                $statement->bindValue(':id', $this->effect, SQLITE3_TEXT);
                 $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
                 if ($r){
                     $this->name = str_replace("{}", $this->value, $r["name"]);

+ 1 - 1
application/entity/Artifact_Stat.php

@@ -59,7 +59,7 @@
               WHERE
                 artifact = :artifact
             ");
-            $statement->bindValue(':artifact', $artifact, SQLITE3_INTEGER);
+            $statement->bindValue(':artifact', $artifact, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->stat = $r["stat"];

+ 1 - 1
application/entity/Building.php

@@ -59,7 +59,7 @@
               FROM building
               WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->uid = $r["uid"];

+ 1 - 1
application/entity/Decoration.php

@@ -58,7 +58,7 @@
               FROM decoration
               WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->uid = $r["uid"];

+ 1 - 1
application/entity/Enchantment.php

@@ -141,7 +141,7 @@
                 enchantment.quality = k_enchantment_range.quality AND
                 enchantment.stat = k_enchantment_range.stat;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->id = $r["id"];

+ 5 - 5
application/entity/Fusion.php

@@ -54,8 +54,8 @@
                   k_unit.awakens_to = :id
                 );
             ");
-            $statement->bindValue(':uid', $uid, SQLITE3_INTEGER);
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':uid', $uid, SQLITE3_TEXT);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 array_push($this->owned, new Unit($r["id"], false));
@@ -138,7 +138,7 @@
                 product = (SELECT awakens_to FROM k_unit WHERE id = $id) OR
                 product = (SELECT awakens_from FROM k_unit WHERE id = $id);
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             $this->product = new Monster_Fusion($r["product"], $uid);
             $this->product_awaken = new Monster_Fusion($this->product->awakens_to, $uid);
@@ -160,7 +160,7 @@
                     k_fusion.product = k_unit.id
                 );
             ");
-            $statement->bindValue(':product', $this->product->id, SQLITE3_INTEGER);
+            $statement->bindValue(':product', $this->product->id, SQLITE3_TEXT);
             $q_f = $statement->execute();
             while ($r_f = $q_f->fetchArray(SQLITE3_ASSOC)){
                 array_push($this->fusion, new Fusion($r_f["ingredient"], $uid));
@@ -188,7 +188,7 @@
                   )
                 );
             ");
-            $statement->bindValue(':product', $this->product->id, SQLITE3_INTEGER);
+            $statement->bindValue(':product', $this->product->id, SQLITE3_TEXT);
             $q_m = $statement->execute();
             while ($r_m = $q_m->fetchArray(SQLITE3_ASSOC)){
                 $m = new Monster_Fusion($r_m["id"], $uid);

+ 2 - 2
application/entity/Guild.php

@@ -100,7 +100,7 @@
               FROM guild
               WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $q = $statement->execute();
             $r = $q->fetchArray(SQLITE3_ASSOC);
             if ($r){
@@ -124,7 +124,7 @@
                 grade = 2 DESC,
                 arena_score DESC;
             ");
-            $statement->bindValue(':guild', $this->id, SQLITE3_INTEGER);
+            $statement->bindValue(':guild', $this->id, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 array_push($this->members, new Guild_Member($r["id"]));

+ 1 - 1
application/entity/Guild_Member.php

@@ -106,7 +106,7 @@
               FROM guild_member
               WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->id = $r["id"];

+ 2 - 2
application/entity/Inventory.php

@@ -88,8 +88,8 @@
                 $s .= "AND inventory.type = :type";
             }
             $statement = $db->prepare($s);
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
-            $statement->bindValue(':type', $type, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
+            $statement->bindValue(':type', $type, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->type = $r["type"];

+ 3 - 3
application/entity/K_Area.php

@@ -64,8 +64,8 @@
                   type = :type
                 ORDER BY type DESC;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
-            $statement->bindValue(':type', $type, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
+            $statement->bindValue(':type', $type, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->name = HTML::e($r["name"]);
@@ -80,7 +80,7 @@
                   FROM k_area_type
                   WHERE id = :type;
                 ");
-                $statement->bindValue(':type', $type, SQLITE3_INTEGER);
+                $statement->bindValue(':type', $type, SQLITE3_TEXT);
                 if ($r){
                     $this->name = HTML::e($r["name"]);
                 }

+ 1 - 1
application/entity/K_Building.php

@@ -58,7 +58,7 @@
               FROM k_building
                WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->id = $r["id"];

+ 2 - 2
application/entity/K_Decoration.php

@@ -92,7 +92,7 @@
                 FROM k_decoration
                WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->id = $r["id"];
@@ -110,7 +110,7 @@
                     FROM k_decoration_level
                     WHERE decoration = :id
                 ");
-                $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+                $statement->bindValue(':id', $id, SQLITE3_TEXT);
                 $q = $statement->execute();
                 while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                     $this->level_bonus[$r["level"]] = $r["bonus"];

+ 1 - 1
application/entity/K_Effect.php

@@ -63,7 +63,7 @@
               FROM k_effect
               WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->id = $r["id"];

+ 1 - 1
application/entity/K_Guild_Skill.php

@@ -63,7 +63,7 @@
               FROM k_guild_skill
               WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->id = $r["id"];

+ 2 - 2
application/entity/K_Guild_Skill_Group.php

@@ -63,7 +63,7 @@
               FROM k_guild_skill_group
               WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->id = $r["id"];
@@ -74,7 +74,7 @@
                   FROM k_guild_skill
                   WHERE skill_group = :id;
                 ");
-                $statement->bindValue(':id', $this->id, SQLITE3_INTEGER);
+                $statement->bindValue(':id', $this->id, SQLITE3_TEXT);
                 $q = $statement->execute();
                 while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                     array_push($this->skills, new K_Guild_Skill($r["id"]));

+ 2 - 2
application/entity/K_Inventory.php

@@ -70,8 +70,8 @@
                 $s .= "AND k_inventory.type = :type";
             }
             $statement = $db->prepare($s);
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
-            $statement->bindValue(':type', $type, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
+            $statement->bindValue(':type', $type, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->type = $r["type"];

+ 1 - 1
application/entity/K_Leader_Skill.php

@@ -69,7 +69,7 @@
               FROM k_leader_skill
              WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->id = $r["id"];

+ 1 - 1
application/entity/K_Rune_Set.php

@@ -63,7 +63,7 @@
               FROM k_rune_set
               WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->id = $r["id"];

+ 3 - 3
application/entity/K_Skill.php

@@ -117,7 +117,7 @@
               FROM k_skill
               WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->id = $r["id"];
@@ -138,7 +138,7 @@
                   WHERE skill = :skill
                   ORDER BY level;
                 ");
-                $statement->bindValue(':skill', $this->id, SQLITE3_INTEGER);
+                $statement->bindValue(':skill', $this->id, SQLITE3_TEXT);
                 $q = $statement->execute();
                 while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                     array_push($this->level, new K_Skill_Level($r["skill"], $r["level"]));
@@ -148,7 +148,7 @@
                   FROM k_skill_effect
                   WHERE skill = :skill;
                 ");
-                $statement->bindValue(':skill', $this->id, SQLITE3_INTEGER);
+                $statement->bindValue(':skill', $this->id, SQLITE3_TEXT);
                 $q = $statement->execute();
                 while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                     array_push($this->effect, new K_Effect($r["effect"]));

+ 2 - 2
application/entity/K_Skill_Level.php

@@ -60,8 +60,8 @@
                 skill = :skill AND
                 level = :level;
             ");
-            $statement->bindValue(':skill', $skill, SQLITE3_INTEGER);
-            $statement->bindValue(':level', $level, SQLITE3_INTEGER);
+            $statement->bindValue(':skill', $skill, SQLITE3_TEXT);
+            $statement->bindValue(':level', $level, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->skill = $r["skill"];

+ 1 - 1
application/entity/K_Source.php

@@ -62,7 +62,7 @@
               FROM k_source
               WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->id = $r["id"];

+ 5 - 5
application/entity/K_Unit.php

@@ -273,7 +273,7 @@
               FROM k_unit
               WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->family = $r["family"];
@@ -400,7 +400,7 @@
                 unit = :unit
               ORDER BY item;
             ");
-            $statement->bindValue(':unit', $this->id, SQLITE3_INTEGER);
+            $statement->bindValue(':unit', $this->id, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 $e = [
@@ -428,7 +428,7 @@
               FROM k_unit_transformation
               WHERE  unit = :unit;
             ");
-            $statement->bindValue(':unit', $this->id, SQLITE3_INTEGER);
+            $statement->bindValue(':unit', $this->id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->transformation = new K_Unit_Transformation($r["id"]);
@@ -457,7 +457,7 @@
                 unit = :unit
               ORDER BY slot;
             ");
-            $statement->bindValue(':unit', $this->id, SQLITE3_INTEGER);
+            $statement->bindValue(':unit', $this->id, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 array_push($this->skill, new K_Skill($r["skill"]));
@@ -481,7 +481,7 @@
               FROM k_unit_source
               WHERE unit = :unit;
             ");
-            $statement->bindValue(':unit', $this->id, SQLITE3_INTEGER);
+            $statement->bindValue(':unit', $this->id, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 array_push($this->sources, new K_Source($r["source"]));

+ 1 - 1
application/entity/K_Unit_Transformation.php

@@ -64,7 +64,7 @@
               FROM k_unit_transformation
                WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->id = $r["id"];

+ 14 - 14
application/entity/Player.php

@@ -222,7 +222,7 @@
               FROM player
               WHERE uid = :uid;
             ");
-            $statement->bindValue(':uid', $UID, SQLITE3_INTEGER);
+            $statement->bindValue(':uid', $UID, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->uid = $r["uid"];
@@ -266,7 +266,7 @@
                 WHERE uid = :uid
                 ORDER BY position;
             ");
-            $statement->bindValue(':uid', $UID, SQLITE3_INTEGER);
+            $statement->bindValue(':uid', $UID, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 array_push($this->defense, new Unit($r["unit"], false));
@@ -279,7 +279,7 @@
                 WHERE uid = :uid
                 ORDER BY position;
             ");
-            $statement->bindValue(':uid', $UID, SQLITE3_INTEGER);
+            $statement->bindValue(':uid', $UID, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 if ($r["position"] <= 3){
@@ -301,7 +301,7 @@
                   building.building = k_building.id 
                 GROUP BY building.building;
             ");
-            $statement->bindValue(':uid', $UID, SQLITE3_INTEGER);
+            $statement->bindValue(':uid', $UID, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 array_push($this->building, new Building($r["id"]));
@@ -311,7 +311,7 @@
                 FROM decoration
                 WHERE uid = :uid;
             ");
-            $statement->bindValue(':uid', $UID, SQLITE3_INTEGER);
+            $statement->bindValue(':uid', $UID, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 array_push($this->decoration, new Decoration($r["id"]));
@@ -327,8 +327,8 @@
                   amount > 0
                 ORDER BY inventory.type;
             ");
-            $statement->bindValue(':uid', $UID, SQLITE3_INTEGER);
-            $statement->bindValue(':type', INVENTORY_TYPE_ID::SCROLL, SQLITE3_INTEGER);
+            $statement->bindValue(':uid', $UID, SQLITE3_TEXT);
+            $statement->bindValue(':type', INVENTORY_TYPE_ID::SCROLL, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 array_push($this->inventory_scroll, new Inventory($r["id"], $r["type"]));
@@ -346,8 +346,8 @@
                   amount > 0
                 ORDER BY inventory.id;
             ");
-            $statement->bindValue(':uid', $UID, SQLITE3_INTEGER);
-            $statement->bindValue(':type', INVENTORY_TYPE_ID::ENCHANTMENT, SQLITE3_INTEGER);
+            $statement->bindValue(':uid', $UID, SQLITE3_TEXT);
+            $statement->bindValue(':type', INVENTORY_TYPE_ID::ENCHANTMENT, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 array_push($this->inventory_craft_rune, new Inventory($r["id"], $r["type"]));
@@ -364,8 +364,8 @@
                   amount > 0
                 ORDER BY inventory.id;
             ");
-            $statement->bindValue(':uid', $UID, SQLITE3_INTEGER);
-            $statement->bindValue(':type', INVENTORY_TYPE_ID::CRAFT_STUFF, SQLITE3_INTEGER);
+            $statement->bindValue(':uid', $UID, SQLITE3_TEXT);
+            $statement->bindValue(':type', INVENTORY_TYPE_ID::CRAFT_STUFF, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 array_push($this->inventory_craft, new Inventory($r["id"], $r["type"]));
@@ -395,8 +395,8 @@
                   upper(name) NOT LIKE '%HIGH%'
                 ;
             ");
-            $statement->bindValue(':uid', $UID, SQLITE3_INTEGER);
-            $statement->bindValue(':type', INVENTORY_TYPE_ID::ESSENCES, SQLITE3_INTEGER);
+            $statement->bindValue(':uid', $UID, SQLITE3_TEXT);
+            $statement->bindValue(':type', INVENTORY_TYPE_ID::ESSENCES, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 array_push($this->inventory_essence, new Inventory($r["id"], $r["type"]));
@@ -430,7 +430,7 @@
                     ELSE area 
                     END ASC
             ");
-            $statement->bindValue(':uid', $UID, SQLITE3_INTEGER);
+            $statement->bindValue(':uid', $UID, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 array_push($this->record, new Record($r["uid"], $r["area_type"], $r["area"]));

+ 6 - 6
application/entity/Record.php

@@ -100,9 +100,9 @@
                   area_type = :area_type AND
                   area = :area;
             ");
-            $statement->bindValue(':uid', $uid, SQLITE3_INTEGER);
-            $statement->bindValue(':area_type', $area_type, SQLITE3_INTEGER);
-            $statement->bindValue(':area', $area, SQLITE3_INTEGER);
+            $statement->bindValue(':uid', $uid, SQLITE3_TEXT);
+            $statement->bindValue(':area_type', $area_type, SQLITE3_TEXT);
+            $statement->bindValue(':area', $area, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->uid = $r["uid"];
@@ -127,9 +127,9 @@
                       front DESC,
                       leader DESC;
                 ");
-                $statement->bindValue(':uid', $uid, SQLITE3_INTEGER);
-                $statement->bindValue(':area_type', $area_type, SQLITE3_INTEGER);
-                $statement->bindValue(':area', $area, SQLITE3_INTEGER);
+                $statement->bindValue(':uid', $uid, SQLITE3_TEXT);
+                $statement->bindValue(':area_type', $area_type, SQLITE3_TEXT);
+                $statement->bindValue(':area', $area, SQLITE3_TEXT);
                 $q = $statement->execute();
                 while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                     if ($r["owned"] > 0){

+ 9 - 9
application/entity/Run.php

@@ -199,7 +199,7 @@
               FROM run
               WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->id = $r["id"];
@@ -231,7 +231,7 @@
                       front DESC,
                       leader DESC;
                 ");
-                $statement->bindValue(':run', $id, SQLITE3_INTEGER);
+                $statement->bindValue(':run', $id, SQLITE3_TEXT);
                 $q = $statement->execute();
                 while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                     if ($r["owned"] > 0){
@@ -254,7 +254,7 @@
                     FROM run_drop_item
                     WHERE run = :run;
                 ");
-                $statement->bindValue(':run', $this->id, SQLITE3_INTEGER);
+                $statement->bindValue(':run', $this->id, SQLITE3_TEXT);
                 $q = $statement->execute();
                 while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                     $i = new Inventory($r["item"]);
@@ -266,7 +266,7 @@
                     FROM run_drop_unit
                     WHERE run = :run;
                 ");
-                $statement->bindValue(':run', $this->id, SQLITE3_INTEGER);
+                $statement->bindValue(':run', $this->id, SQLITE3_TEXT);
                 $q = $statement->execute();
                 while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                     array_push($this->unit, new K_Unit($r["unit"]));
@@ -276,7 +276,7 @@
                     FROM run_drop_sd
                     WHERE run = :run;
                 ");
-                $statement->bindValue(':run', $this->id, SQLITE3_INTEGER);
+                $statement->bindValue(':run', $this->id, SQLITE3_TEXT);
                 $q = $statement->execute();
                 while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                     array_push($this->sd, new K_Unit($r["unit"]));
@@ -288,7 +288,7 @@
                     FROM run_drop_unit_pieces
                     WHERE run = :run;
                 ");
-                $statement->bindValue(':run', $this->id, SQLITE3_INTEGER);
+                $statement->bindValue(':run', $this->id, SQLITE3_TEXT);
                 $q = $statement->execute();
                 while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                     $i = [
@@ -302,7 +302,7 @@
                     FROM run_drop_shapeshifting
                     WHERE run = :run;
                 ");
-                $statement->bindValue(':run', $this->id, SQLITE3_INTEGER);
+                $statement->bindValue(':run', $this->id, SQLITE3_TEXT);
                 $q = $statement->execute();
                 $r = $q->fetchArray(SQLITE3_ASSOC);
                 if ($r){
@@ -333,7 +333,7 @@
                     FROM run_drop_rune
                     WHERE run = :run;
                 ");
-                $statement->bindValue(':run', $this->id, SQLITE3_INTEGER);
+                $statement->bindValue(':run', $this->id, SQLITE3_TEXT);
                 $q = $statement->execute();
                 while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                     $rune = new Rune($r["id"]);
@@ -426,7 +426,7 @@
                     run_drop_enchantment.quality = k_enchantment_range.quality AND
                     run_drop_enchantment.stat = k_enchantment_range.stat;
                 ");
-                $statement->bindValue(':run', $this->id, SQLITE3_INTEGER);
+                $statement->bindValue(':run', $this->id, SQLITE3_TEXT);
                 $q = $statement->execute();
                 while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                     $enchantment = new Enchantment($r["id"]);

+ 17 - 17
application/entity/Rune.php

@@ -159,7 +159,7 @@
               FROM rune
               WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->id = $r["id"];
@@ -182,7 +182,7 @@
                   WHERE rune = :rune
                   ORDER BY slot;
                 ");
-                $statement->bindValue(':rune', $this->id, SQLITE3_INTEGER);
+                $statement->bindValue(':rune', $this->id, SQLITE3_TEXT);
                 $q = $statement->execute();
                 while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                     $stat = new Rune_Stat($this->id, $r["slot"]);
@@ -297,11 +297,11 @@
             if ($this->innate_stat != null && $this->innate_stat->value > 0){
                 $value = $this->innate_stat->value;
                 $statement = $db->prepare($query);
-                $statement->bindValue(':ancient', $this->ancient, SQLITE3_INTEGER);
-                $statement->bindValue(':initial', 1, SQLITE3_INTEGER);
-                $statement->bindValue(':upgrade', 0, SQLITE3_INTEGER);
-                $statement->bindValue(':stars', $this->stars, SQLITE3_INTEGER);
-                $statement->bindValue(':stat', $this->innate_stat->stat, SQLITE3_INTEGER);
+                $statement->bindValue(':ancient', $this->ancient, SQLITE3_TEXT);
+                $statement->bindValue(':initial', 1, SQLITE3_TEXT);
+                $statement->bindValue(':upgrade', 0, SQLITE3_TEXT);
+                $statement->bindValue(':stars', $this->stars, SQLITE3_TEXT);
+                $statement->bindValue(':stat', $this->innate_stat->stat, SQLITE3_TEXT);
                 $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
                 if ($r){
                     $min_initial = 0;//$r["min"];
@@ -314,18 +314,18 @@
                     $value = $this->stats[$i]->value;
                     $value = $this->stats[$i]->value;
                     $statement = $db->prepare($query);
-                    $statement->bindValue(':ancient', $this->ancient, SQLITE3_INTEGER);
-                    $statement->bindValue(':initial', 1, SQLITE3_INTEGER);
-                    $statement->bindValue(':upgrade', 0, SQLITE3_INTEGER);
-                    $statement->bindValue(':stars', $this->stars, SQLITE3_INTEGER);
-                    $statement->bindValue(':stat', $this->stats[$i]->stat, SQLITE3_INTEGER);
+                    $statement->bindValue(':ancient', $this->ancient, SQLITE3_TEXT);
+                    $statement->bindValue(':initial', 1, SQLITE3_TEXT);
+                    $statement->bindValue(':upgrade', 0, SQLITE3_TEXT);
+                    $statement->bindValue(':stars', $this->stars, SQLITE3_TEXT);
+                    $statement->bindValue(':stat', $this->stats[$i]->stat, SQLITE3_TEXT);
                     $r_initial = $statement->execute()->fetchArray(SQLITE3_ASSOC);
                     $statement = $db->prepare($query);
-                    $statement->bindValue(':ancient', $this->ancient, SQLITE3_INTEGER);
-                    $statement->bindValue(':initial', 0, SQLITE3_INTEGER);
-                    $statement->bindValue(':upgrade', 1, SQLITE3_INTEGER);
-                    $statement->bindValue(':stars', $this->stars, SQLITE3_INTEGER);
-                    $statement->bindValue(':stat', $this->stats[$i]->stat, SQLITE3_INTEGER);
+                    $statement->bindValue(':ancient', $this->ancient, SQLITE3_TEXT);
+                    $statement->bindValue(':initial', 0, SQLITE3_TEXT);
+                    $statement->bindValue(':upgrade', 1, SQLITE3_TEXT);
+                    $statement->bindValue(':stars', $this->stars, SQLITE3_TEXT);
+                    $statement->bindValue(':stat', $this->stats[$i]->stat, SQLITE3_TEXT);
                     $r_upgrade = $statement->execute()->fetchArray(SQLITE3_ASSOC);
                     if ($r_initial && $r_upgrade){
                         $min_initial = 0;//$r_initial["min"];

+ 2 - 2
application/entity/Rune_Stat.php

@@ -80,8 +80,8 @@
                 rune = :rune AND
                 slot = :slot;
             ");
-            $statement->bindValue(':rune', $rune, SQLITE3_INTEGER);
-            $statement->bindValue(':slot', $slot, SQLITE3_INTEGER);
+            $statement->bindValue(':rune', $rune, SQLITE3_TEXT);
+            $statement->bindValue(':slot', $slot, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->slot = $r["slot"];

+ 2 - 2
application/entity/Team.php

@@ -107,7 +107,7 @@
               FROM team
               WHERE id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->uid = $r["uid"];
@@ -129,7 +129,7 @@
                         front DESC,
                         leader DESC;
                     ");
-                    $statement->bindValue(':team', $this->id, SQLITE3_INTEGER);
+                    $statement->bindValue(':team', $this->id, SQLITE3_TEXT);
                     $q = $statement->execute();
                     while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                         array_push($this->unit, new Unit($r["unit"], false));

+ 15 - 15
application/entity/Unit.php

@@ -406,8 +406,8 @@
                 uid = :uid AND
                 id = :id;
             ");
-            $statement->bindValue(':id', $id, SQLITE3_INTEGER);
-            $statement->bindValue(':uid', $uid, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $id, SQLITE3_TEXT);
+            $statement->bindValue(':uid', $uid, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->uid = $r["uid"];
@@ -450,7 +450,7 @@
                         unit = :unit
                       ORDER BY slot;
                     ");
-                    $statement->bindValue(':unit', $this->id, SQLITE3_INTEGER);
+                    $statement->bindValue(':unit', $this->id, SQLITE3_TEXT);
                     $q = $statement->execute();
                     while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                         array_push($this->skill_levels, $r["level"]);
@@ -462,8 +462,8 @@
                         stars = :stars AND
                         level = :level;
                     ");
-                    $statement->bindValue(':stars', $this->stars, SQLITE3_INTEGER);
-                    $statement->bindValue(':level', $this->level, SQLITE3_INTEGER);
+                    $statement->bindValue(':stars', $this->stars, SQLITE3_TEXT);
+                    $statement->bindValue(':level', $this->level, SQLITE3_TEXT);
                     $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
                     if ($r){
                         $this->experience_level = $r["exp"];
@@ -501,9 +501,9 @@
                 unit.building = building.id AND
                 building.building = :building;
             ");
-            $statement->bindValue(':id', $this->id, SQLITE3_INTEGER);
-            $statement->bindValue(':uid', $UID, SQLITE3_INTEGER);
-            $statement->bindValue(':building', BUILDING_ID::MONSTER_STORAGE, SQLITE3_INTEGER);
+            $statement->bindValue(':id', $this->id, SQLITE3_TEXT);
+            $statement->bindValue(':uid', $UID, SQLITE3_TEXT);
+            $statement->bindValue(':building', BUILDING_ID::MONSTER_STORAGE, SQLITE3_TEXT);
             $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
             if ($r){
                 $this->in_storage = true;
@@ -537,8 +537,8 @@
                 unit = :unit AND
                 rta = :rta;
             ");
-            $statement->bindValue(':unit', $this->id, SQLITE3_INTEGER);
-            $statement->bindValue(':rta', $MODE, SQLITE3_INTEGER);
+            $statement->bindValue(':unit', $this->id, SQLITE3_TEXT);
+            $statement->bindValue(':rta', $MODE, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 array_push($this->rune, new Rune($r["rune"]));
@@ -561,8 +561,8 @@
                 unit = :unit AND
                 rta = :rta;
             ");
-            $statement->bindValue(':unit', $this->id, SQLITE3_INTEGER);
-            $statement->bindValue(':rta', $MODE, SQLITE3_INTEGER);
+            $statement->bindValue(':unit', $this->id, SQLITE3_TEXT);
+            $statement->bindValue(':rta', $MODE, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 $artifact = new Artifact($r["artifact"]);
@@ -603,7 +603,7 @@
                 area = :area AND
                 affected_stat IN (:stat_atk, :stat_def, :stat_hp, :stat_spd, :stat_crd);
             ");
-            $statement->bindValue(':uid', $UID, SQLITE3_INTEGER);
+            $statement->bindValue(':uid', $UID, SQLITE3_TEXT);
             $statement->bindValue(':area', EFFECT_AREA_ID::GENERAL, SQLITE3_INTEGER);
             $statement->bindValue(':stat_atk', STAT_ID::ATK, SQLITE3_INTEGER);
             $statement->bindValue(':stat_def', STAT_ID::DEF, SQLITE3_INTEGER);
@@ -693,8 +693,8 @@
                 team.id = team_unit.team AND
                 team_unit.unit = :unit;
             ");
-            $statement->bindValue(':uid', $UID, SQLITE3_INTEGER);
-            $statement->bindValue(':unit', $this->id, SQLITE3_INTEGER);
+            $statement->bindValue(':uid', $UID, SQLITE3_TEXT);
+            $statement->bindValue(':unit', $this->id, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 array_push($this->teams, new Team($r["id"], false));

+ 1 - 1
application/page/Teams_Page.php

@@ -54,7 +54,7 @@
               FROM unit
               WHERE unit.uid = :uid;
             ");
-            $statement->bindValue(':uid', $UID, SQLITE3_INTEGER);
+            $statement->bindValue(':uid', $UID, SQLITE3_TEXT);
             $q = $statement->execute();
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 array_push($this->units, new Unit($r["id"], false));

+ 6 - 1
application/view/monster.php

@@ -375,7 +375,12 @@
                         $rune = $page->unit->rune[$i - 1];
                         $total_efficiency += $rune->efficiency;
                         $total_max_efficiency += $rune->max_efficiency;
-                        $total_reached_efficiency += ($rune->efficiency * 100 / $rune->max_efficiency);
+                        if ($rune->max_efficiency > 0){
+                            $total_reached_efficiency += ($rune->efficiency * 100 / $rune->max_efficiency);
+                        }
+                        else{
+                            $total_reached_efficiency = 0;
+                        }
                         $total_level += $rune->level;
                         $total_stars += $rune->stars;
                         $total_value += $rune->value;