Răsfoiți Sursa

Dimensional hole records and sealed shrine data read on profile parsing.
Style changes.
Code organization.

Iñigo Valentin 3 ani în urmă
părinte
comite
1a7a50e36f
51 a modificat fișierele cu 533 adăugiri și 2536 ștergeri
  1. 148 8
      application/API/v1/profile/PUT.php
  2. 23 15
      application/Constant.php
  3. 8 26
      application/Controller.php
  4. 0 551
      application/action/Optimize_List_Action.php
  5. 0 221
      application/action/Optimize_Options_Action.php
  6. 6 1
      application/config.php
  7. 1 1
      application/helper/APPLICATION.php
  8. 1 1
      application/helper/DB.php
  9. 1 1
      application/helper/HELPER.php
  10. 69 58
      application/helper/HTML.php
  11. 1 1
      application/helper/NET.php
  12. 1 1
      application/helper/TEXT.php
  13. BIN
      application/key.sqlite
  14. 0 63
      application/page/Optimizer_Page.php
  15. 0 56
      application/page/Optimizer_Unit_Page.php
  16. 2 2
      application/page/Report_Skillup_Page.php
  17. 2 0
      application/page/Units_Page.php
  18. 0 136
      application/view/inc/header_player.php
  19. 0 16
      application/view/monster.php
  20. 0 245
      application/view/optimizer.php
  21. 77 147
      application/view/player.php
  22. 2 2
      application/view/unit.php
  23. 18 311
      application/view/units.php
  24. 0 372
      public/css/optimizer.css
  25. 54 92
      public/css/player.css
  26. 110 95
      public/css/ui.css
  27. 0 112
      public/css/units.css
  28. BIN
      public/img/icon/star.png
  29. BIN
      public/img/skill/00015101.png
  30. BIN
      public/img/skill/00015102.png
  31. BIN
      public/img/skill/00015103.png
  32. BIN
      public/img/skill/00015104.png
  33. BIN
      public/img/skill/00015105.png
  34. BIN
      public/img/skill/00015106.png
  35. BIN
      public/img/skill/00015107.png
  36. BIN
      public/img/skill/00015108.png
  37. BIN
      public/img/skill/00015109.png
  38. BIN
      public/img/skill/00015110.png
  39. BIN
      public/img/skill/00015111.png
  40. BIN
      public/img/skill/00015112.png
  41. BIN
      public/img/skill/00015113.png
  42. BIN
      public/img/skill/00015114.png
  43. BIN
      public/img/skill/00015115.png
  44. BIN
      public/img/skill/00015201.png
  45. BIN
      public/img/skill/00015202.png
  46. BIN
      public/img/skill/00015203.png
  47. BIN
      public/img/skill/00015204.png
  48. BIN
      public/img/skill/00015205.png
  49. BIN
      public/img/skill/00015206.png
  50. BIN
      public/img/skill/00015207.png
  51. 9 2
      swex-plugin/swdb.js

+ 148 - 8
application/API/v1/profile/PUT.php

@@ -1105,7 +1105,7 @@ function parse_collection($db, $player_id, $json){
  */
 function parse_records($db, $player_id, $json){
 
-    # Page 1: Cairos non-elemental, rift raid, rift dungeon.
+    # Page 1: Palayer stats, Cairos non-elemental
     if (intval($json->{"lobby_wizard_log"}->{"page_no"}) == 1){
 
         // Update data in player table
@@ -1121,7 +1121,8 @@ function parse_records($db, $player_id, $json){
             top_rank_siege = :top_rank_siege,
             top_rank_wboss = :top_rank_wboss,
             top_rank_toan = :top_rank_toan,
-            top_rank_toah = :top_rank_toah
+            top_rank_toah = :top_rank_toah,
+            top_rank_toal = :top_rank_toal
           WHERE id = :id;
         ");
         $statement->bindValue(":joined", $json->{"lobby_wizard_log"}->{"account_create_timestamp"}, SQLITE3_TEXT);
@@ -1133,10 +1134,11 @@ function parse_records($db, $player_id, $json){
         $statement->bindValue(":top_rank_wboss", $json->{"lobby_wizard_log"}->{"world_boss_best_rank_id"}, SQLITE3_INTEGER);
         $statement->bindValue(":top_rank_toan", $json->{"lobby_wizard_log"}->{"trial_tower_normal_best_floor"}, SQLITE3_INTEGER);
         $statement->bindValue(":top_rank_toah", $json->{"lobby_wizard_log"}->{"trial_tower_hard_best_floor"}, SQLITE3_INTEGER);
+        $statement->bindValue(":top_rank_toal", $json->{"lobby_wizard_log"}->{"trial_tower_hell_best_star"}, SQLITE3_INTEGER);
         $statement->bindValue(":id", $player_id, SQLITE3_INTEGER);
         $statement->execute();
 
-        // Loop Cairos records
+        // Loop Cairos records (non elemental dungeons)
         foreach ($json->{"lobby_wizard_log"}->{"dungeon_best_clear_info_list"} as $record){
             // Delete prevous data
             $statement = $db->prepare("
@@ -1235,7 +1237,7 @@ function parse_records($db, $player_id, $json){
             ");
             $statement->bindValue(":player", $player_id, SQLITE3_INTEGER);
             $statement->bindValue(":area_type", AREA_TYPE_ID::RIFT_RAID, SQLITE3_INTEGER);
-            $statement->bindValue(":area", $record->{"stage_id"}, SQLITE3_INTEGER);
+            $statement->bindValue(":area", AREA_TYPE_ID::RIFT_RAID, SQLITE3_INTEGER);
             $statement->bindValue(":stage", $record->{"stage_id"}, SQLITE3_INTEGER);
             $statement->bindValue(":time", $record->{"clear_time"}, SQLITE3_TEXT);
             $statement->bindValue(":score", 0, SQLITE3_INTEGER);
@@ -1252,7 +1254,7 @@ function parse_records($db, $player_id, $json){
                 ");
                 $statement->bindValue(":player", $player_id, SQLITE3_INTEGER);
                 $statement->bindValue(":area_type", AREA_TYPE_ID::RIFT_RAID, SQLITE3_INTEGER);
-                $statement->bindValue(":area", $record->{"stage_id"}, SQLITE3_INTEGER);
+                $statement->bindValue(":area", AREA_TYPE_ID::RIFT_RAID, SQLITE3_INTEGER);
                 $statement->bindValue(":unit", $party->{"unit_id"}, SQLITE3_INTEGER);
                 $statement->bindValue(":monster", $party->{"unit_master_id"}, SQLITE3_INTEGER);
                 $statement->bindValue(":leader", $party->{"leader"}, SQLITE3_INTEGER);
@@ -1338,7 +1340,7 @@ function parse_records($db, $player_id, $json){
                     $statement->bindValue(":rank", "SS", SQLITE3_TEXT);
                     break;
                 case 12:
-                    $statement->bindValue(":rank", "SS", SQLITE3_TEXT);
+                    $statement->bindValue(":rank", "SSS", SQLITE3_TEXT);
                     break;
                 default:
                     $statement->bindValue(":rank", "F", SQLITE3_TEXT);
@@ -1368,9 +1370,72 @@ function parse_records($db, $player_id, $json){
                 $statement->execute();
             }
         }
+        
+        // Loop Dimension Hole records
+        foreach ( $json->{"lobby_wizard_log"}->{"dimension_hole_dungeon_best_clear_info_list"} as $record){
+
+            // Delete prevous data
+            $statement = $db->prepare("
+              DELETE FROM record_party
+              WHERE
+                player = :player AND
+                area_type = :area_type AND
+                area = :area;
+            ");
+            $statement->bindValue(":player", $player_id, SQLITE3_INTEGER);
+            $statement->bindValue(":area_type", AREA_TYPE_ID::DIMENSIONAL_HOLE, SQLITE3_INTEGER);
+            $statement->bindValue(":area", $record->{"dimension_hole_dungeon_id"}, SQLITE3_INTEGER);
+            $statement->execute();
+            $statement = $db->prepare("
+              DELETE FROM record
+              WHERE
+                player = :player AND
+                area_type = :area_type AND
+                area = :area;
+            ");
+            $statement->bindValue(":player", $player_id, SQLITE3_INTEGER);
+            $statement->bindValue(":area_type", AREA_TYPE_ID::DIMENSIONAL_HOLE, SQLITE3_INTEGER);
+            $statement->bindValue(":area", $record->{"dimension_hole_dungeon_id"}, SQLITE3_INTEGER);
+            $statement->execute();
+
+            // Insert new data
+            $statement = $db->prepare("
+              INSERT INTO record
+                (player, area_type, area, stage, time, score, rank)
+              VALUES
+                (:player, :area_type, :area, :stage, :time, :score, :rank);
+            ");
+            $statement->bindValue(":player", $player_id, SQLITE3_INTEGER);
+            $statement->bindValue(":area_type", AREA_TYPE_ID::DIMENSIONAL_HOLE, SQLITE3_INTEGER);
+            $statement->bindValue(":area", $record->{"dimension_hole_dungeon_id"}, SQLITE3_INTEGER);
+            $statement->bindValue(":stage", $record->{"difficulty"}, SQLITE3_INTEGER);
+            $statement->bindValue(":time", $record->{"clear_time"}, SQLITE3_INTEGER);
+            $statement->bindValue(":score", 0, SQLITE3_INTEGER);
+            $statement->bindValue(":rank", "", SQLITE3_TEXT);
+            $statement->execute();
+
+            // Loop party
+            foreach ($record->{"my_unit_deck_list"} as $party){
+                $statement = $db->prepare("
+                  INSERT INTO record_party
+                    (player, area_type, area, unit, monster, leader, front)
+                  VALUES
+                    (:player, :area_type, :area, :unit, :monster, :leader, :front);
+                ");
+                $statement->bindValue(":player", $player_id, SQLITE3_INTEGER);
+                $statement->bindValue(":area_type", AREA_TYPE_ID::DIMENSIONAL_HOLE, SQLITE3_INTEGER);
+                $statement->bindValue(":area", $record->{"dimension_hole_dungeon_id"}, SQLITE3_INTEGER);
+                $statement->bindValue(":unit", $party->{"unit_id"}, SQLITE3_INTEGER);
+                $statement->bindValue(":monster", $party->{"unit_master_id"}, SQLITE3_INTEGER);
+                $statement->bindValue(":leader", $party->{"leader"}, SQLITE3_INTEGER);
+                $statement->bindValue(":front", 0, SQLITE3_INTEGER);
+                $statement->execute();
+            }
+        }
     }
 
-    # Page 2: Cairos non-elemental, rift raid, rift dungeon.
+    # Page 2: All of Cairos dungeons.
+    # TODO: Non elementals can be skipped here, they are processed in page 1 too
     elseif (intval($json->{"lobby_wizard_log"}->{"page_no"} == 2)){
         // Loop Cairos records
         foreach ($json->{"lobby_wizard_log"}->{"dungeon_best_clear_info_list"} as $record){
@@ -1434,9 +1499,11 @@ function parse_records($db, $player_id, $json){
             }
         }
     }
+    // Page 3 has Rift Raid and Dungeons, can be skipped (data in page 1 too).
     elseif (intval($json->{"lobby_wizard_log"}->{"page_no"}) == 3){
         return "204 Page not logged (only pages 1 and 2 are needed).";
     }
+    // Page 4 has Dimension Hole Dungeons, can be skipped (data in page 1 too).
     elseif (intval($json->{"lobby_wizard_log"}->{"page_no"}) == 4){
         return "204 Page not logged (only pages 1 and 2 are needed).";
     }
@@ -1448,6 +1515,43 @@ function parse_records($db, $player_id, $json){
     return "201 Created.";
 }
 
+/**
+ * Parses the request and response to the getUnitStorageList command and
+ * adds the units in the Sealed Shrine as items.
+ *
+ * @param resource $db Database connection.
+ * @param int $player_id Player ID.
+ * @param mixed[] $json Response.
+ */
+function parse_sealed_shrine($db, $player_id, $json){
+    foreach ($json->{"unit_storage_list"} as $monster){
+        $id = $monster->{"unit_master_id"};
+        // Delete prevous data
+        $statement = $db->prepare("
+          DELETE FROM item
+          WHERE
+            player = :player AND
+            type = :type AND
+            id = :id;
+        ");
+        $statement->bindValue(":player", $player_id, SQLITE3_INTEGER);
+        $statement->bindValue(":type", INVENTORY_TYPE_ID::SEALED_MONSTER, SQLITE3_INTEGER);
+        $statement->bindValue(":id", $id, SQLITE3_INTEGER);
+        $statement->execute();
+        $statement = $db->prepare("
+          INSERT INTO item (player, id, type, amount)
+          VALUES (:player, :id, :type, :amount);
+        ");
+        $statement->bindValue(":player", $player_id, SQLITE3_INTEGER);
+        $statement->bindValue(":type", INVENTORY_TYPE_ID::SEALED_MONSTER, SQLITE3_INTEGER);
+        $statement->bindValue(":id", $id, SQLITE3_INTEGER);
+        $statement->bindValue(":amount", $monster->{"quantity"}, SQLITE3_INTEGER);
+        $statement->execute();
+    }
+    // Return success
+    return "201 Created.";
+}
+
 try{
 
     header("Content-type: application/json; charset=utf-8");
@@ -1471,6 +1575,14 @@ try{
         syslog(LOG_INFO, "[APIv1] HTTP/1.1 400 No data received.");
         return 400;
     }
+    
+    // Try to get request text, required for some commands.
+    $request = null;
+    $json_request = null;
+    if (isset($_PUT["request"])){
+        $request = $_PUT["request"];
+        $json_request = json_decode($request);
+    }
 
     // Check data format.
     $json = json_decode($data);
@@ -1485,7 +1597,8 @@ try{
     $accepted_commands = [
         "HubUserLogin", // Login, full profile
         "GetUnitCollection", // Unit collection
-        "GetLobbyWizardLog" // Records
+        "GetLobbyWizardLog", // Records
+        "getUnitStorageList" // Sealed units
     ];
     if (!in_array($command, $accepted_commands)){
         header("HTTP/1.1 405 Command not implemented.");
@@ -1652,6 +1765,30 @@ try{
                 return 401;
             }
             break;
+        case "getUnitStorageList":
+            if ($request == null || $request == false){
+                header("HTTP/1.1 400 Request data required for getUnitStorageList action.");
+                syslog(LOG_INFO, "[APIv1] HTTP/1.1 400 Request data required for getUnitStorageList action.");
+                return 400;
+            }
+            $player_id = $json_request->{"wizard_id"};
+            $statement = $db->prepare("
+              SELECT COUNT(player.id) AS c
+              FROM
+                user,
+                player
+              WHERE
+                user.id = player.user AND
+                player.id = :player AND
+                user.api_key = :api_key;");
+            $statement->bindValue(":player", $player_id, SQLITE3_INTEGER);
+            $statement->bindValue(":api_key", $key, SQLITE3_TEXT);
+            if (1 != $statement->execute()->fetchArray(SQLITE3_ASSOC)["c"]){
+                header("HTTP/1.1 401 Invalid credentials.");
+                syslog(LOG_INFO, "[APIv1] HTTP/1.1 401 Invalid credentials.");
+                return 401;
+            }
+            break;
     }
     if ($command == "GetUnitCollection"){ // This command doesnt provide wizard_id
         // TODO: The new user/player distinction wont work here
@@ -1677,6 +1814,9 @@ try{
         case "GetLobbyWizardLog":
             $result = parse_records($db, $player_id, $json);
             break;
+        case "getUnitStorageList":
+            $result = parse_sealed_shrine($db, $player_id, $json);
+            break;
     }
 
     // Process result

+ 23 - 15
application/Constant.php

@@ -9,6 +9,11 @@
  * @package SWDB
  */
 
+/**
+ * Dummy class.
+ */
+class Constant{}
+
  /**
   * Stage difficulty constants.
   *
@@ -1079,6 +1084,11 @@ final class INVENTORY_TYPE_ID{
      * Enhancing Monster.
      */
     const ENHANCING_MONSTER = 61;
+    
+    /**
+     * Monster in the Sealed Shrine.
+     */
+    const SEALED_MONSTER = 62;
 };
 
 /**
@@ -4632,22 +4642,20 @@ final class ARENA_RANK_ID{
  */
 final class WORLD_BOSS_RANK_ID{
 
-    /**
-     * Beginer.
-     */
     const RANK = [
-        0 => "F",
-        1 => "D",
-        2 => "C",
-        3 => "B-",
-        4 => "B",
-        5 => "B+",
-        6 => "A-",
-        7 => "A",
-        8 => "A+",
-        9 => "S",
-        10 => "SS",
-        11 => "SSS"
+        0 => "None",
+        1 => "F",
+        2 => "D",
+        3 => "C",
+        4 => "B-",
+        5 => "B",
+        6 => "B+",
+        7 => "A-",
+        8 => "A",
+        9 => "A+",
+        10 => "S",
+        11 => "SS",
+        12 => "SSS"
     ];
 
 }

+ 8 - 26
application/Controller.php

@@ -10,11 +10,11 @@
  */
 
 require_once(__DIR__ . "/config.php");
-require_once(PATH::HELPER . "DB_Helper.php");
-require_once(PATH::HELPER . "TEXT_Helper.php");
-require_once(PATH::HELPER . "NET_Helper.php");
-require_once(PATH::HELPER . "HTML_Helper.php");
-require_once(PATH::HELPER . "APPLICATION_Helper.php");
+require_once(PATH::HELPER . "DB.php");
+require_once(PATH::HELPER . "TEXT.php");
+require_once(PATH::HELPER . "NET.php");
+require_once(PATH::HELPER . "HTML.php");
+require_once(PATH::HELPER . "APPLICATION.php");
 require_once(PATH::ENTITY . "User.php");
 require_once(PATH::ENTITY . "Player.php");
 require_once(__DIR__ . "/Constant.php");
@@ -41,17 +41,17 @@ class Controller extends Context{
     private $context;
     
     /**
-     * @var Command to execute (firs part of the url in the domain).
+     * @var string Command to execute (firs part of the url in the domain).
      */
     private $command = "";
 
     /**
-     * @var Response status
+     * @var int Response status
      */
     private $status = 201;
 
     /**
-     * @var Response message.
+     * @var string Response message.
      */
     private $message = "OK";
 
@@ -295,14 +295,6 @@ class Controller extends Context{
                 $action = strtoupper($this->params[1]);
                 switch ($action){
                     // Special cases where the output must be printed:
-                    case "OPTIMIZE_LIST":
-                        require_once(PATH::ACTION . "Optimize_List_Action.php");
-                        $action = new Optimize_List_Action();
-                        break;
-                    case "OPTIMIZE_OPTIONS":
-                        require_once(PATH::ACTION . "Optimize_Options_Action.php");
-                        $action = new Optimize_Options_Action();
-                        break;
                     case "CHANGE_GAME_MODE":
                         require_once(PATH::ACTION . "Change_Game_Mode_Action.php");
                         $action = new Change_Game_Mode_Action();
@@ -443,16 +435,6 @@ class Controller extends Context{
                             $page = new Report_Page();
                         }
                         break;
-                    case "OPTIMIZER":
-                        if (sizeof($this->params) > 3){
-                            require_once(PATH::PAGE . "Optimizer_Unit_Page.php");
-                            $page = new Optimizer_Unit_Page($this->params[3]);
-                        }
-                        else{
-                            require_once(PATH::PAGE . "Optimizer_Page.php");
-                            $page = new Optimizer_Page();
-                        }
-                    break;
                 }
                 break;
             case "MONSTERS":

+ 0 - 551
application/action/Optimize_List_Action.php

@@ -1,551 +0,0 @@
-<?php
-/**
- * File for the rune optimization action.
- *
- * Implements an action function to be called from the {@see Controller}.
- *
- * @author Iñigo Valentin <i@inigovalentin.com>
- * @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3
- * @package SWDB
- */
-
-require_once(PATH::ACTION . "Action.php");
-
-/**
- * Selects the runes for optimization.
- *
- * Reads the POST parameters looking for the following KEYS:
- *  player: Player ID.
- *  mode: Game mode ({@see GAME_MODE_ID}).
- *  unit: Unit ID.
- *  source: Source of the runes to select (assigned, unassigned, ...).
- *  tuning: 1: All +12; 2: Even +15, odd + 12; 3: All +15.
- *  set[]: Selected rune sets ({@see RUNE_SET_ID}).
- *  
- * Then it selects all the runes matching the cryteria.
- * 
- * @category Action
- */
-class Optimize_List_Action extends Action{
-
-    /**
-     * Executes the action.
-     */
-    public function execute(){
-    
-        // Increase max execution time.
-        set_time_limit(60);
-    
-        $candidates = [
-            1 => [],
-            2 => [],
-            3 => [],
-            4 => [],
-            5 => [],
-            6 => []
-        ];
-    
-        $response = null;
-    
-        $player = filter_input(INPUT_POST, 'player');
-        if ($player == null){
-            $this->code = 400;
-            $this->message = "POST parameter 'player' not specified.";
-            return;
-        }
-        $game_mode = GAME_MODE_ID::NORMAL;
-        if (filter_input(INPUT_POST, 'mode') == GAME_MODE_ID::RTA){
-            $game_mode = GAME_MODE_ID::RTA;
-        }
-    
-        $unit_id = filter_input(INPUT_POST, 'unit');
-        if ($unit_id == null){
-            $this->code = 400;
-            $this->message = "POST parameter 'unit' not specified.";
-            return;
-        }
-    
-        // Sets
-        $sets = [];
-        foreach ($_POST["set"] as $x){
-            array_push($sets, intval($x));
-        }
-        if (sizeof($sets) < 2 || sizeof($sets) > 3){
-            $this->code = 400;
-            $this->message = "POST parameter 'set' not specified or invalid. Two or three rune sets must be specified. Broken sets are not supported.";
-            return;
-        }
-        
-        $focus = [];
-        if (isset($_POST["focus_0"]) && intval($_POST["focus_0"]) > 0){
-            array_push($focus, intval($_POST["focus_0"]));
-        }
-        if (isset($_POST["focus_1"]) && intval($_POST["focus_1"]) > 0){
-            array_push($focus, intval($_POST["focus_1"]));
-        }
-        if (isset($_POST["focus_2"]) && intval($_POST["focus_2"]) > 0){
-            array_push($focus, intval($_POST["focus_2"]));
-        }
-        // Remove doubles and sort. The order will be HP, ATK, DEF, SPD, CRR, CRD, RES, ACC
-        $focus = array_unique($focus, SORT_NUMERIC);
-    
-        // Main stats in even slots.
-        $stats = [];
-        foreach ($_POST["stat"] as $x){
-            array_push($stats, intval($x));
-        }
-    
-        $source = filter_input(INPUT_POST, 'source');
-        if ($source == null){
-            $this->code = 400;
-            $this->message = "POST parameter 'source' not specified.";
-            return;
-        }
-    
-        $tuning = filter_input(INPUT_POST, 'tuning');
-        if ($tuning == null){
-            $this->code = 400;
-            $this->message = "POST parameter 'tuning' not specified.";
-            return;
-        }
-    
-        // Instantiate the unit
-        $unit = new Unit($unit_id);
-    
-        // Get build query:
-        $base_s = "
-          SELECT
-            id,
-            type,
-            slot,
-            level,
-            stars,
-            (SELECT stat FROM rune_stat WHERE rune = rune.id AND slot = " . RUNE_STAT_SLOT_ID::MAIN . " ) AS main_stat,
-            (SELECT value FROM rune_stat WHERE rune = rune.id AND slot = " . RUNE_STAT_SLOT_ID::MAIN . " ) AS main_stat_value,
-            (SELECT stat FROM rune_stat WHERE rune = rune.id AND slot = " . RUNE_STAT_SLOT_ID::INNATE . " ) AS innate_stat,
-            (SELECT value FROM rune_stat WHERE rune = rune.id AND slot = " . RUNE_STAT_SLOT_ID::INNATE . " ) AS innate_stat_value,
-            (SELECT stat FROM rune_stat WHERE rune = rune.id AND slot = " . RUNE_STAT_SLOT_ID::SUBSTAT_1 . " ) AS substat_1,
-            (SELECT value + grind FROM rune_stat WHERE rune = rune.id AND slot = " . RUNE_STAT_SLOT_ID::SUBSTAT_1 . " ) AS substat_1_value,
-            (SELECT stat FROM rune_stat WHERE rune = rune.id AND slot = " . RUNE_STAT_SLOT_ID::SUBSTAT_2 . " ) AS substat_2,
-            (SELECT value + grind FROM rune_stat WHERE rune = rune.id AND slot = " . RUNE_STAT_SLOT_ID::SUBSTAT_2 . " ) AS substat_2_value,
-            (SELECT stat FROM rune_stat WHERE rune = rune.id AND slot = " . RUNE_STAT_SLOT_ID::SUBSTAT_3 . " ) AS substat_3,
-            (SELECT value + grind FROM rune_stat WHERE rune = rune.id AND slot = " . RUNE_STAT_SLOT_ID::SUBSTAT_3 . " ) AS substat_3_value,
-            (SELECT stat FROM rune_stat WHERE rune = rune.id AND slot = " . RUNE_STAT_SLOT_ID::SUBSTAT_4 . " ) AS substat_4,
-            (SELECT value + grind FROM rune_stat WHERE rune = rune.id AND slot = " . RUNE_STAT_SLOT_ID::SUBSTAT_4 . " ) AS substat_4_value
-          FROM rune
-          WHERE
-            player = :player AND
-            type IN (
-        ";
-        foreach ($sets as $set){
-            $base_s .= ($set . ",");
-        }
-        $base_s .= "-1) AND ";
-        switch ($source){
-            case 0: // Storage only (or itself)
-                $base_s .= "
-                  (
-                    rune.id IN (SELECT DISTINCT rune FROM unit_rune WHERE unit = :unit_id AND rta = " . $game_mode . ")
-                    OR
-                    rune.id NOT IN (SELECT DISTINCT rune FROM unit_rune WHERE rta = " . $game_mode . ")
-                  )";
-                break;
-            case 1: // Units in no teams (or itself)
-                $base_s .= "
-                  (
-                    rune.id IN (SELECT DISTINCT rune FROM unit_rune WHERE unit = :unit_id AND rta = " . $game_mode . ")
-                    OR rune.id NOT IN (SELECT DISTINCT rune FROM unit_rune WHERE rta = " . $game_mode . ")
-                    OR rune.id NOT IN (SELECT DISTINCT rune FROM unit_rune WHERE rta = " . $game_mode . " AND unit NOT IN (SELECT DISTINCT unit FROM team_unit))
-                  )
-                ";
-                break;
-            case 2: // Units in teams with 0 score (or itself)
-                $base_s .= "
-                  (
-                    rune.id IN (SELECT DISTINCT rune FROM unit_rune WHERE unit = :unit_id AND rta = " . $game_mode . ")
-                    OR rune.id NOT IN (SELECT DISTINCT rune FROM unit_rune WHERE rta = " . $game_mode . ")
-                    OR rune.id NOT IN (
-                      SELECT DISTINCT rune 
-                      FROM unit_rune 
-                      WHERE
-                        rta = " . $game_mode . "
-                        AND unit NOT IN (
-                          SELECT DISTINCT unit 
-                          FROM
-                            team,
-                            team_unit
-                          WHERE
-                            team.id = team_unit.team
-                            AND team.score > 0
-                        )
-                    )
-                  )
-                ";
-                break;
-            case 3: // Units with lower overall score (or itself)
-                // TODO
-                break;
-            case 4: // All runes - dont filter
-                $base_s .= " 1 = 1 ";
-                break;
-            default: // Invalid options - return nothing
-                $base_s .= " 1 = 0 ";
-        }
-        $s_order = " ORDER BY stars DESC, original_quality DESC, max_efficiency DESC, efficiency DESC, level DESC";
-        //$s_in = " main_stat IN (:stat_0, :stat_1, :stat_2) ";
-        $s_main = [
-            " main_stat = :stat_0 ",
-            " main_stat = :stat_1 ",
-            " main_stat = :stat_2 ",
-        ];
-        
-        // Process focuses
-        $focus_stats = [];
-        foreach ($focus as $f){
-            switch ($f){
-                case STAT_ID::HP:
-                    array_push($focus_stats, RUNE_STAT_ID::HP);
-                    array_push($focus_stats, RUNE_STAT_ID::HP_P);
-                    break;
-                case STAT_ID::ATK:
-                    array_push($focus_stats, RUNE_STAT_ID::ATK);
-                    array_push($focus_stats, RUNE_STAT_ID::ATK_P);
-                    break;
-                case STAT_ID::DEF:
-                    array_push($focus_stats, RUNE_STAT_ID::DEF);
-                    array_push($focus_stats, RUNE_STAT_ID::DEF_P);
-                    break;
-                case STAT_ID::SPD:
-                    array_push($focus_stats, RUNE_STAT_ID::SPD);
-                    break;
-                case STAT_ID::CRR:
-                    array_push($focus_stats, RUNE_STAT_ID::CRR);
-                    break;
-                case STAT_ID::CRD:
-                    array_push($focus_stats, RUNE_STAT_ID::CRD);
-                    break;
-                case STAT_ID::ACC:
-                    array_push($focus_stats, RUNE_STAT_ID::ACC);
-                    break;
-                case STAT_ID::RES:
-                    array_push($focus_stats, RUNE_STAT_ID::RES);
-                    break;
-            }
-        }
-    
-        $focus_cond = ["", "", "", "", "", "", ""];
-        if (sizeof($focus) > 0){
-            
-            // Slot 1, no ATK flat, no DEF flat, no DEF %
-            $focus_slot = $focus_stats;
-            /*if (array_search(RUNE_STAT_ID::ATK, $focus_slot) !== false){
-                $focus_slot = array_diff($focus_slot, [RUNE_STAT_ID::ATK])//array_splice($focus_slot, array_search(RUNE_STAT_ID::ATK, $focus_slot), 1);
-            }
-            if (array_search(RUNE_STAT_ID::DEF, $focus_slot) !== false){
-                $focus_slot = array_splice($focus_slot, array_search(RUNE_STAT_ID::DEF, $focus_slot), 1);
-            }
-            if (array_search(RUNE_STAT_ID::DEF_P, $focus_slot) !== false){
-                $focus_slot = array_splice($focus_slot, array_search(RUNE_STAT_ID::DEF_P, $focus_slot), 1);
-            }*/
-            $focus_slot = array_diff($focus_slot, [RUNE_STAT_ID::ATK, RUNE_STAT_ID::DEF, RUNE_STAT_ID::DEF_P]);
-            if (sizeof($focus_slot) > 0){
-                $focus_cond[1] .= "
-                  -- FOCUS 1
-                  AND (
-                    rune.id IN (
-                      SELECT DISTINCT rune FROM rune_stat WHERE slot != :slot_main AND stat IN
-                      (
-                ";
-                foreach ($focus_slot as $stat){
-                    $focus_cond[1] .= $stat . ", ";
-                }
-                $focus_cond[1] = rtrim($focus_cond[1], ", ");
-                $focus_cond[1] .= "
-                      )
-                    )
-                  )  -- END FOCUS 1
-                ";
-            }
-            
-            // Slot 3, no ATK flat, no ATK %, no DEF flat.
-            $focus_slot = $focus_stats;
-            /*if (array_search(RUNE_STAT_ID::ATK, $focus_slot) !== false){
-                $focus_slot = array_splice($focus_slot, array_search(RUNE_STAT_ID::ATK, $focus_slot), 1);
-            }
-            if (array_search(RUNE_STAT_ID::ATK_P, $focus_slot) !== false){
-                $focus_slot = array_splice($focus_slot, array_search(RUNE_STAT_ID::ATK_P, $focus_slot), 1);
-            }
-            if (array_search(RUNE_STAT_ID::DEF, $focus_slot) !== false){
-                $focus_slot = array_splice($focus_slot, array_search(RUNE_STAT_ID::DEF, $focus_slot), 1);
-            }*/
-            $focus_slot = array_diff($focus_slot, [RUNE_STAT_ID::ATK, RUNE_STAT_ID::ATK_P, RUNE_STAT_ID::DEF]);
-            if (sizeof($focus_slot) > 0){
-                $focus_cond[3] .= "
-                  -- FOCUS 3
-                  AND (
-                    rune.id IN (
-                      SELECT DISTINCT rune FROM rune_stat WHERE slot != :slot_main AND stat IN
-                      (
-                ";
-                foreach ($focus_slot as $stat){
-                    $focus_cond[3] .= $stat . ", ";
-                }
-                $focus_cond[3] = rtrim($focus_cond[3], ", ");
-                $focus_cond[3] .= "
-                      )
-                    )
-                  )  -- END FOCUS 3
-                ";
-            }
-            
-            // Slot 5, no HP flat.
-            $focus_slot = $focus_stats;
-            /*if (array_search(RUNE_STAT_ID::HP, $focus_slot) !== false){
-                $focus_slot = array_splice($focus_slot, array_search(RUNE_STAT_ID::HP, $focus_slot), 1);
-            }*/
-            $focus_slot = array_diff($focus_slot, [RUNE_STAT_ID::HP]);
-            if (sizeof($focus_slot) > 0){
-                $focus_cond[5] .= "
-                  -- FOCUS 5
-                  AND (
-                    rune.id IN (
-                      SELECT DISTINCT rune FROM rune_stat WHERE slot != :slot_main AND stat IN
-                      (
-                ";
-                foreach ($focus_slot as $stat){
-                    $focus_cond[5] .= $stat . ", ";
-                }
-                $focus_cond[5] = rtrim($focus_cond[5], ", ");
-                $focus_cond[5] .= "
-                      )
-                    )
-                  ) -- END FOCUS 5
-                ";
-            }
-            
-            // TODO: Focus for even slots.
-            // Slot 2, all stat, but include main
-            // Slot 5, no HP flat.
-            $focus_slot = $focus_stats;
-            if (sizeof($focus_slot) > 0){
-                $focus_cond[2] .= "
-                  -- FOCUS EVEN
-                  AND (
-                    rune.id IN (
-                      SELECT DISTINCT rune FROM rune_stat WHERE stat IN
-                      (
-                ";
-                foreach ($focus_slot as $stat){
-                    $focus_cond[2] .= $stat . ", ";
-                }
-                $focus_cond[2] = rtrim($focus_cond[2], ", ");
-                $focus_cond[2] .= "
-                      )
-                    )
-                  ) -- END FOCUS EVEN
-                ";
-            }
-            
-        }
-        
-        //TODO DEBUG
-        //$focus_cond[2] = "";
-    
-        $s = ["", "", "", "", "", "", ""];
-        $s[1] = $base_s . " AND slot = 1 " . $focus_cond[1] . $s_order . " LIMIT :limit_odd;";
-        $s[3] = $base_s . " AND slot = 3 " . $focus_cond[3] . $s_order . " LIMIT :limit_odd;";
-        $s[5] = $base_s . " AND slot = 5 " . $focus_cond[5] . $s_order . " LIMIT :limit_odd;";
-        $s[2] = $base_s . " AND slot = 2 AND " . $s_main[0] . $focus_cond[2] . $s_order . " LIMIT :limit_even;";
-        $s[4] = $base_s . " AND slot = 4 AND " . $s_main[1] . $focus_cond[2] . $s_order . " LIMIT :limit_even;";
-        $s[6] = $base_s . " AND slot = 6 AND " . $s_main[2] . $focus_cond[2] . $s_order . " LIMIT :limit_even;";
-    
-        $total_candidates = 0;
-        for ($i = 1; $i <= 6; $i ++){
-            //error_log($s[$i]);
-            $statement = get_context()->get_db()->prepare($s[$i]);
-            $statement->bindValue(':player', $player, 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);
-            $statement->bindValue(':slot_main', RUNE_STAT_SLOT_ID::MAIN, SQLITE3_INTEGER);
-            $statement->bindValue(':limit_even', 150, SQLITE3_INTEGER);
-            $statement->bindValue(':limit_odd', 100, SQLITE3_INTEGER);
-            //error_log($statement->getSQL(true));
-            $q = $statement->execute();
-            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
-                $rune = $this->create_rune_array($unit, $r, $tuning);
-                //array_push($candidates[$i], new Rune($r["id"]));
-                array_push($candidates[$i], $rune);
-                $total_candidates ++;
-            }
-        }
-        //$max_combinations = sizeof($candidates[1]) * sizeof($candidates[2]) * sizeof($candidates[3]) * sizeof($candidates[4]) * sizeof($candidates[5]) * sizeof($candidates[6]);
-    
-        // Build response
-        $response = json_encode($candidates);
-        if ($response == null){
-            $this->code = 201;
-            $this->message = "No valid combinations found";
-            return;
-        }
-        else{
-            $this->code = 200;
-            $this->message = "OK";
-            $this->output = $response;
-            return;
-        }
-    }
-    
-    /**
-     * Creates an array with the stats provided by a rune on a unit.
-     *
-     * @param Unit $unit Target unit.
-     * @param int $r Rune main stat ID.
-     * @param int $stars Rune stars.
-     * @return int Value of the main stat at the selected level.
-     */
-    private function create_rune_array($unit, $r, $tuning){
-        $rune = [
-            "ID" => $r["id"],
-            "TYPE" => $r["type"],
-            "ATK" => 0,
-            "DEF" => 0,
-            "HP" => 0,
-            "SPD" => 0,
-            "CRR" => 0,
-            "CRD" => 0,
-            "ACC" => 0,
-            "RES" => 0
-        ];
-        // Calculate main stat value based on requested level.
-        $level = $r["level"];
-        $main_value = $r["main_stat_value"];
-        switch ($tuning){
-            case 1: // All +12
-                if ($level < 12){
-                    $main_value = get_main_stat_at_level(12, $r["main_stat"], $r["stars"]);
-                }
-                break;
-            case 2: // Even +15, Odd + 12
-                if ($level < 15 && $r["slot"] % 2 == 0){
-                    $main_value = get_main_stat_at_level(15, $r["main_stat"], $r["stars"]);
-                }
-                elseif ($level < 12 && $r["slot"] % 2 != 0){
-                    $main_value = get_main_stat_at_level(12, $r["main_stat"], $r["stars"]);
-                }
-                break;
-            case 3: // All +15
-                if ($level < 15){
-                    $main_value = get_main_stat_at_level(15, $r["main_stat"], $r["stars"]);
-                }
-                break;
-        }
-        // Array to loop.
-        $stats = [
-            [
-                "STAT" => $r["main_stat"],
-                "VALUE" => $main_value
-            ],
-            [
-                "STAT" => $r["innate_stat"],
-                "VALUE" => $r["innate_stat_value"]
-            ],
-            [
-                "STAT" => $r["substat_1"],
-                "VALUE" => $r["substat_1_value"]
-            ],
-            [
-                "STAT" => $r["substat_2"],
-                "VALUE" => $r["substat_2_value"]
-            ],
-            [
-                "STAT" => $r["substat_3"],
-                "VALUE" => $r["substat_3_value"]
-            ],
-            [
-                "STAT" => $r["substat_4"],
-                "VALUE" => $r["substat_4_value"]
-            ]
-        ];
-        foreach ($stats as $stat){
-            switch ($stat["STAT"]){
-                case RUNE_STAT_ID::ATK:
-                    $rune["ATK"] += $stat["VALUE"];
-                    break;
-                case RUNE_STAT_ID::ATK_P:
-                    $rune["ATK"] += ($unit->get_base_stats()["atk"] * $stat["VALUE"] / 100);
-                    break;
-                case RUNE_STAT_ID::DEF:
-                    $rune["DEF"] += $stat["VALUE"];
-                    break;
-                case RUNE_STAT_ID::DEF_P:
-                    $rune["DEF"] += ($unit->get_base_stats()["def"] * $stat["VALUE"] / 100);
-                    break;
-                case RUNE_STAT_ID::HP:
-                    $rune["HP"] += $stat["VALUE"];
-                    break;
-                case RUNE_STAT_ID::HP_P:
-                    $rune["HP"] += ($unit->get_base_stats()["hp"] * $stat["VALUE"] / 100);
-                    break;
-                case RUNE_STAT_ID::SPD:
-                    $rune["SPD"] += $stat["VALUE"];
-                    break;
-                case RUNE_STAT_ID::CRR:
-                    $rune["CRR"] += $stat["VALUE"];
-                    break;
-                case RUNE_STAT_ID::CRD:
-                    $rune["CRD"] += $stat["VALUE"];
-                    break;
-                case RUNE_STAT_ID::ACC:
-                    $rune["ACC"] += $stat["VALUE"];
-                    break;
-                case RUNE_STAT_ID::RES:
-                    $rune["RES"] += $stat["VALUE"];
-                    break;
-            }
-        }
-        return $rune;
-    }
-    
-    /**
-     * Gets the value of the main stat at an arbitrary level.
-     *
-     * @param int $level Desired level.
-     * @param int $stat Rune main stat ID.
-     * @param int $stars Rune stars.
-     * @return int Value of the main stat at the selected level.
-     */
-    private function get_main_stat_at_level($level, $stat, $stars){
-        $level = intval($level);
-        if ($level < 0 || $level > 15){
-            return 0;
-        }
-        switch ($stat){
-            case RUNE_STAT_ID::HP:
-                return RUNE_STAT_VALUES::HP[$stars][$level];
-            case RUNE_STAT_ID::HP_P:
-                return RUNE_STAT_VALUES::HP_P[$stars][$level];
-            case RUNE_STAT_ID::ATK:
-                return RUNE_STAT_VALUES::ATK[$stars][$level];
-            case RUNE_STAT_ID::ATK_P:
-                return RUNE_STAT_VALUES::ATK_P[$stars][$level];
-            case RUNE_STAT_ID::DEF:
-                return RUNE_STAT_VALUES::DEF[$stars][$level];
-            case RUNE_STAT_ID::DEF_P:
-                return RUNE_STAT_VALUES::DEF_P[$stars][$level];
-            case RUNE_STAT_ID::SPD:
-                return RUNE_STAT_VALUES::SPD[$stars][$level];
-            case RUNE_STAT_ID::CRR:
-                return RUNE_STAT_VALUES::CRR[$stars][$level];
-            case RUNE_STAT_ID::CRD:
-                return RUNE_STAT_VALUES::CRD[$stars][$level];
-            case RUNE_STAT_ID::RES:
-                return RUNE_STAT_VALUES::RES[$stars][$level];
-            case RUNE_STAT_ID::ACC:
-                return RUNE_STAT_VALUES::ACC[$stars][$level];
-            default:
-                return 0;
-        }
-    }
-}

+ 0 - 221
application/action/Optimize_Options_Action.php

@@ -1,221 +0,0 @@
-<?php
-/**
- * File for the team creation action.
- *
- * Implements an action function to be called from the {@see Controller}.
- *
- * @author Iñigo Valentin <i@inigovalentin.com>
- * @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3
- * @package SWDB
- */
-
-require_once(PATH::ACTION . "Action.php");
-
-/**
- * Executes the optimization action.
- *
- * Reads the POST parameters looking for the following KEYS:
- *  player: The player ID.
- *  unit: The unit ID.
- *  tuning: 1: All +12; 2: Even +15, odd + 12; 3: All +15.
- *  options: JSON with rune sets.
- *
- * @category Action
- */
-class Optimize_Options_Action extends Action{
-    
-    /**
-     * Executes the action.
-     */
-    function execute(){
-
-        // Increase max execution time.
-        set_time_limit(60);
-    
-        $runes = [];
-    
-        $response = null;
-    
-        $player = filter_input(INPUT_POST, 'player');
-        if ($player == null){
-            $this->code = 400;
-            error_log("400 player");
-            $this->message = "POST parameter 'player' not specified or invalid.";
-            return;
-        }
-    
-        $unit_id = filter_input(INPUT_POST, 'unit');
-        if ($unit_id == null){
-            $this->code = 400;
-            error_log("400 unit");
-            $this->message = "POST parameter 'unit' not specified or invalid.";
-            return;
-        }
-        $unit = new Unit($unit_id, true, $player);
-        $base_stats = $unit->get_base_stats();
-        $building_stats = $unit->get_building_stats();
-        $artifact_stats = $unit->get_artifact_stats();
-        //$total_stats = $unit->get_stats();
-    
-        $tuning = filter_input(INPUT_POST, 'tuning');
-        if ($tuning == null){
-            $this->code = 400;
-            error_log("400 tining");
-            $this->message = "POST parameter 'tuning' not specified or invalid.";
-            return;
-        }
-    
-        if (filter_input(INPUT_POST, 'options') == null){
-            $this->code = 400;
-            error_log("400 option");
-            $this->message = "POST parameter 'options' not specified or invalid.";
-            return;
-        }
-        $options = json_decode(filter_input(INPUT_POST, 'options'), true);
-        if ($options == null){
-        }
-        foreach ($options as $option){
-            $set = [
-                "runes" => [],
-                "stats" => [
-                    "atk" => $base_stats["atk"],
-                    "def" => $base_stats["def"],
-                    "hp"  => $base_stats["hp"],
-                    "spd" => $base_stats["spd"],
-                    "crr" => $base_stats["crr"],
-                    "crd" => $base_stats["crd"],
-                    "acc" => $base_stats["acc"],
-                    "res" => $base_stats["res"],
-                    "ehp" => $base_stats["ehp"],
-                    "dmg" => $base_stats["dmg"]
-                ]
-            ];
-            foreach ($option["runes"] as $rune_option){
-                $rune = new Rune($rune_option["ID"]);
-                $r = [
-                    "id" => $rune_option["ID"],
-                    "html" => HTML::rune_table($rune)
-                ];
-    
-                // Calculate stat increment
-                // TODO: Main stat at level!
-                $stat_ids = [
-                    $rune->get_main_stat()->get_stat(),
-                    ($rune->get_innate_stat() != null ? $rune->get_innate_stat()->get_stat() : null),
-                    (sizeof($rune->get_substats()) > 0 ? $rune->get_substats()[0]->get_stat() : null),
-                    (sizeof($rune->get_substats()) > 1 ? $rune->get_substats()[1]->get_stat() : null),
-                    (sizeof($rune->get_substats()) > 2 ? $rune->get_substats()[2]->get_stat() : null),
-                    (sizeof($rune->get_substats()) > 3 ? $rune->get_substats()[3]->get_stat() : null)
-                ];
-                $main_value = $rune->get_main_stat()->get_value();
-                switch ($tuning){
-                    case 1: // All +12
-                        if ($rune->get_level() < 12){
-                            $main_value = $rune->get_main_stat_at_level(12);
-                        }
-                        break;
-                    case 2: // Even +15, Odd + 12
-                        if ($rune->get_level() < 15 && $rune->get_slot() % 2 == 0){
-                            $main_value = $rune->get_main_stat_at_level(15);
-                        }
-                        elseif ($rune->get_level() < 12 && $rune->get_slot() % 2 != 0){
-                            $main_value = $rune->get_main_stat_at_level(12);
-                        }
-                        break;
-                    case 3: // All +15
-                        if ($rune->get_level() < 15){
-                            $main_value = $rune->get_main_stat_at_level(15);
-                        }
-                        break;
-                }
-                $stat_values = [
-                    $main_value,
-                    ($stat_ids[1] != null ? $rune->get_innate_stat()->get_value() : 0),
-                    ($stat_ids[2] != null ? $rune->get_substats()[0]->get_value() : 0),
-                    ($stat_ids[3] != null ? $rune->get_substats()[1]->get_value() : 0),
-                    ($stat_ids[4] != null ? $rune->get_substats()[2]->get_value() : 0),
-                    ($stat_ids[5] != null ? $rune->get_substats()[3]->get_value() : 0)
-                ];
-                for ($i = 0; $i < 6; $i ++){
-                    switch ($stat_ids[$i]){
-                        case RUNE_STAT_ID::ATK:
-                            $set["stats"]["atk"] += $stat_values[$i];
-                            break;
-                        case RUNE_STAT_ID::ATK_P:
-                            $set["stats"]["atk"] += ceil($base_stats["atk"] * $stat_values[$i] / 100);
-                            break;
-                        case RUNE_STAT_ID::DEF:
-                            $set["stats"]["def"] += $stat_values[$i];
-                            break;
-                        case RUNE_STAT_ID::DEF_P:
-                            $set["stats"]["def"] += ceil($base_stats["def"] * $stat_values[$i] / 100);
-                            break;
-                        case RUNE_STAT_ID::HP:
-                            $set["stats"]["hp"] += $stat_values[$i];
-                            break;
-                        case RUNE_STAT_ID::HP_P:
-                            $set["stats"]["hp"] += ceil($base_stats["hp"] * $stat_values[$i] / 100);
-                            break;
-                        case RUNE_STAT_ID::SPD:
-                            $set["stats"]["spd"] += $stat_values[$i];
-                            break;
-                        case RUNE_STAT_ID::CRR:
-                            $set["stats"]["crr"] += $stat_values[$i];
-                            break;
-                        case RUNE_STAT_ID::CRD:
-                            $set["stats"]["crd"] += $stat_values[$i];
-                            break;
-                        case RUNE_STAT_ID::ACC:
-                            $set["stats"]["acc"] += $stat_values[$i];
-                            break;
-                        case RUNE_STAT_ID::RES:
-                            $set["stats"]["res"] += $stat_values[$i];
-                            break;
-                    }
-                }
-    
-                // Calculate EHP and DMG
-                $set["stats"]["ehp"] = ceil(((($set["stats"]["def"] * 3.5) + 1140) * $set["stats"]["hp"]) / 1000);
-                $atk = $set["stats"]["atk"];
-                $crr = $set["stats"]["crr"];
-                if ($crr > 100){
-                    $crr = 100;
-                }
-                $crd = $set["stats"]["crd"];
-                $edmg = ceil(($atk * (100 - $crr) / 100) + (($atk + ($atk * $crd / 100)) * $crr / 100));
-                $set["stats"]["dmg"] = $edmg;
-                //error_log("attack before extras: " . $set["stats"]["atk"]);
-                
-                // Add artifacts and buildings
-                $set["stats"]["atk"] += ($building_stats["atk"] + $artifact_stats["atk"]);
-                $set["stats"]["def"] += ($building_stats["def"] + $artifact_stats["def"]);
-                $set["stats"]["hp"]  += ($building_stats["hp"]  + $artifact_stats["hp"]);
-                $set["stats"]["spd"] += ($building_stats["spd"] + $artifact_stats["spd"]);
-                $set["stats"]["crr"] += ($building_stats["crr"] + $artifact_stats["crr"]);
-                $set["stats"]["crd"] += ($building_stats["crd"] + $artifact_stats["crd"]);
-                $set["stats"]["acc"] += ($building_stats["acc"] + $artifact_stats["acc"]);
-                $set["stats"]["res"] += ($building_stats["res"] + $artifact_stats["res"]);
-                $set["stats"]["ehp"] += ($building_stats["ehp"] + $artifact_stats["ehp"]);
-                $set["stats"]["dmg"] += ($building_stats["dmg"] + $artifact_stats["dmg"]);
-                //error_log("attack after extras: " . $set["stats"]["atk"]);
-                // Add to the array
-                array_push($set["runes"], $r);
-    
-            }
-            array_push($runes, $set);
-        }
-    
-        // Send back the response
-        $response = json_encode($runes);
-        if ($response == null){
-            $this->code = 204;
-            $this->message = "No combinations found.";
-        }
-        else{
-            $this->code = 200;
-            $this->message = "OK.";
-            $this->output = $response;
-        }
-        return;
-    }
-}

+ 6 - 1
application/config.php

@@ -14,13 +14,18 @@
  */
 define('BASE_PATH', $_SERVER["DOCUMENT_ROOT"] . "/");
 
-require_once(__DIR__ . "/helper/NET_Helper.php");
+require_once(__DIR__ . "/helper/NET.php");
 
 /**
  * The site base URL.
  */
 define('BASE_URL', NET::get_protocol() . $_SERVER["HTTP_HOST"] . "/");
 
+/**
+ * Dummy config class.
+ */
+class config{}
+
 /**
  * App related constants.
  *

+ 1 - 1
application/helper/APPLICATION_Helper.php → application/helper/APPLICATION.php

@@ -9,7 +9,7 @@
  * @package SWDB
  */
 
-require_once(PATH::HELPER . "Helper.php");
+require_once(PATH::HELPER . "HELPER.php");
 
 /**
  * Application helper.

+ 1 - 1
application/helper/DB_Helper.php → application/helper/DB.php

@@ -9,7 +9,7 @@
  * @package SWDB
  */
 
-require_once(PATH::HELPER . "Helper.php");
+require_once(PATH::HELPER . "HELPER.php");
 
 /**
  * Database helper.

+ 1 - 1
application/helper/Helper.php → application/helper/HELPER.php

@@ -17,4 +17,4 @@
  * @abstract
  * @category Helper
  */
-abstract class Helper{}
+abstract class HELPER{}

+ 69 - 58
application/helper/HTML_Helper.php → application/helper/HTML.php

@@ -9,7 +9,7 @@
  * @package SWDB
  */
 
-require_once(PATH::HELPER . "Helper.php");
+require_once(PATH::HELPER . "HELPER.php");
 require_once(PATH::ENTITY . "Unit.php");
 require_once(PATH::ENTITY . "Monster.php");
 require_once(PATH::ENTITY . "Building.php");
@@ -48,12 +48,12 @@ final class HTML extends Helper{
      * @param Unit|Monster Entity to get the info from.
      * @return string HTML content for a monster panel. Empty on error.
      */
-    public static function unit_panel($unit) {
+    public static function unit_panel($unit, $simple = false, $href = null) {
         if ($unit instanceof Unit){
             $k = $unit->get_monster();
             $stars = $unit->get_stars();
             $level = true;
-            $teams = (sizeof($unit->get_teams()) > 0);
+            $teams = (sizeof($unit->get_teams()));
             $lock = $unit->is_locked();
             $storage = $unit->is_in_storage();
             $maxed = ($unit->get_level() == 40 && $unit->is_fully_skilled());
@@ -70,71 +70,81 @@ final class HTML extends Helper{
         else{
             return "";
         }
-        $html = "";
-        if ($k->get_awakens_from() == null && $k->get_awakens_to() == null){
-            // No to, no from
-            if ($k->get_base_stars() >= 4){
-                // SFV Collab event units, always awakened.
-                $star_class = "star_purple";
-            }
-            elseif($k->get_archetype() == ARCHETYPE_ID::MATERIAL && $k->get_element() == ELEMENT_ID::LIGHT){
-                // Rainbowmon, always awakened
-                $star_class = "star_purple";
-            }
-            elseif($k->get_archetype() == ARCHETYPE_ID::MATERIAL && $k->get_element() == ELEMENT_ID::DARK){
-                // Devilmon, always unawakened
-                $star_class = "star_silver";
+        $html = "<div class='monster_panel " . (($simple === true) ? "simple" : "") . "'>\n";
+        if (false === $simple){
+            if ($k->get_awakens_from() == null && $k->get_awakens_to() == null){
+                // No to, no from
+                if ($k->get_base_stars() >= 4){
+                    // SFV Collab event units, always awakened.
+                    $star_src = "star-purple";
+                }
+                elseif($k->get_archetype() == ARCHETYPE_ID::MATERIAL && $k->get_element() == ELEMENT_ID::LIGHT){
+                    // Rainbowmon, always awakened
+                    $star_src = "star-purple";
+                }
+                elseif($k->get_archetype() == ARCHETYPE_ID::MATERIAL && $k->get_element() == ELEMENT_ID::DARK){
+                    // Devilmon, always unawakened
+                    $star_src = "star-silver";
+                }
+                else{
+                    // Unawakeable monster
+                    $star_src = "star-silver";
+                }
             }
-            else{
-                // Unawakeable monster
-                $star_class = "star_silver";
+            elseif ($k->get_awakens_from() != ""){
+                // Already awakened
+                if ($k->get_base_stars() - $k->get_natural_stars() == 1){
+                    // Normal awaken.
+                    $star_src ="star-purple";
+                }
+                else{
+                    // Second awaken.
+                    $star_src ="star-red";
+                }
             }
-        }
-        elseif ($k->get_awakens_from() != ""){
-            // Already awakened
-            if ($k->get_base_stars() - $k->get_natural_stars() == 1){
-                // Normal awaken.
-                $star_class ="star_purple";
+            elseif ($k->get_awakens_to() != ""){
+                // Awakeable.
+                $star_src ="star-gold";
             }
-            else{
-                // Second awaken.
-                $star_class ="star_red";
+            $html .= "<span class='stars'>\n";
+            for ($i = 0; $i < $stars; $i ++){
+                $html .= "<img class='star' src='" . URL::IMG["ICON"] . $star_src . ".png'/>\n";
             }
-        }
-        elseif ($k->get_awakens_to() != ""){
-            // Awakeable.
-            $star_class ="star_gold";
-        }
-        $html .= "<span class='stars'>\n";
-        for ($i = 0; $i < $stars; $i ++){
-            $html .= "<img class='star $star_class' src='" . URL::IMG["ICON"] . "star.png'/>\n";
-        }
-        $html .= "</span>\n";
-        $html .= "<img title='" . $k->get_title() . "' class='monster border_" . $k->get_element_name() . "' src='" . $k->get_image() . "'/>\n";
-        if ($level){
-            $html .= "<span class='level'>\n";
-            $html .= $unit->get_level() . "\n";
             $html .= "</span>\n";
         }
-        $html .= "<span class='badges'>\n";
-        if ($maxed){
-            $html .= "<img title='Maxed unit' src='" . URL::IMG["ICON"] . "maxed.png'>";
+        if ($href != null){
+            $html .= "<a title='" . $k->get_title() . "' href='$href'>";
         }
-        if ($teams > 0){
-            $title = $teams . " teams";
-            if ($teams == 1){
-                $title = "1 team: " . $unit->get_teams()[0]->get_name();
+        $html .= "<img title='" . $k->get_title() . "' class='monster border_" . $k->get_element_name() . "' src='" . $k->get_image() . "'/>\n";
+        if (false === $simple){
+            if ($level){
+                $html .= "<span class='level'>\n";
+                $html .= $unit->get_level() . "\n";
+                $html .= "</span>\n";
             }
-            $html .= "<img title='$title' src='" . URL::IMG["ICON"] . "team.png'>";
-        }
-        if ($lock == 1){
-            $html .= "<img title='Locked' src='" . URL::IMG["ICON"] . "lock.png'>";
+            $html .= "<span class='badges'>\n";
+            if ($maxed){
+                $html .= "<img title='Maxed unit' src='" . URL::IMG["ICON"] . "maxed.png'>";
+            }
+            if ($teams > 0){
+                $title = $teams . " teams";
+                if ($teams == 1){
+                    $title = "1 team: " . $unit->get_teams()[0]->get_name();
+                }
+                $html .= "<img title='$title' src='" . URL::IMG["ICON"] . "team.png'>";
+            }
+            if ($lock == 1){
+                $html .= "<img title='Locked' src='" . URL::IMG["ICON"] . "lock.png'>";
+            }
+            if ($storage){
+                $html .= "<img title='In storage' src='" . URL::IMG["ICON"] . "storage.png'>";
+            }
+            $html .= "</span>\n";
         }
-        if ($storage){
-            $html .= "<img title='In storage' src='" . URL::IMG["ICON"] . "storage.png'>";
+        if ($href != null){
+            $html .= "</a>";
         }
-
-        $html .= "</span>\n";
+        $html .= "</div>\n";
         return $html;
     }
 
@@ -199,6 +209,7 @@ final class HTML extends Helper{
             $html .= "</a>\n";
             $html .= "</div>\n";
         }
+
         return $html;
     }
 

+ 1 - 1
application/helper/NET_Helper.php → application/helper/NET.php

@@ -9,7 +9,7 @@
  * @package SWDB
  */
 
-require_once(PATH::HELPER . "Helper.php");
+require_once(PATH::HELPER . "HELPER.php");
 
 /**
  * Netowrk helper.

+ 1 - 1
application/helper/TEXT_Helper.php → application/helper/TEXT.php

@@ -9,7 +9,7 @@
  * @package SWDB
  */
 
-require_once(PATH::HELPER . "Helper.php");
+require_once(PATH::HELPER . "HELPER.php");
 
 /**
  * Text helper.

BIN
application/key.sqlite


+ 0 - 63
application/page/Optimizer_Page.php

@@ -1,63 +0,0 @@
- <?php
-/**
- * Optimizer team list page file.
- *
- * Provides a class with all the properties and methods to display the page.
- *
- * @author Iñigo Valentin <i@inigovalentin.com>
- * @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3
- * @package SWDB
- */
-
-require_once(PATH::PAGE . "Page.php");
-require_once(PATH::ENTITY . "Team.php");
-
-/**
- * Optimizer team list page model.
- *
- * @category Page
- */
-class Optimizer_Page extends Page{
-
-    /**
-     * @var Team[] Teams to show.
-     */
-    private $teams = [];
-
-    /**
-     * Constructor.
-     *
-     * Retrieves the data and initializes the variables.
-     */
-    public function __construct(){
-        
-        parent::__construct();
-        $this->set_public(false);
-        $this->set_view("optimizer.php");
-        $this->set_title("Optimizer");
-        $this->set_description("Rune optimizer");
-        $this->set_canonical("player/" . get_context()->get_player()->get_id() . "/optimizer/");
-        $this->add_css("optimizer.css");
-        
-        // Get teams
-        $statement = get_context()->get_db()->prepare("
-          SELECT id FROM team WHERE player = :player ORDER BY area_type, area");
-        $statement->bindValue(":player", get_context()->get_player()->get_id(), SQLITE3_TEXT);
-        $result_set = $statement->execute();
-        while ($result = $result_set->fetchArray(SQLITE3_ASSOC)){
-            array_push($this->teams, new Team($result["id"]));
-        }
-        $this->set_code(200);
-        $this->set_message("OK");
-        
-    }
-    /**
-     * Retrieves the player teams.
-     *
-     * @return Team[] Player teams.
-     */
-    public function get_teams(){
-        return $this->teams;
-    }
-
-}

+ 0 - 56
application/page/Optimizer_Unit_Page.php

@@ -1,56 +0,0 @@
- <?php
-/**
- * Optimizer unit page file.
- *
- * Provides a class with all the properties and methods to display the page.
- *
- * @author Iñigo Valentin <i@inigovalentin.com>
- * @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3
- * @package SWDB
- */
-
-require_once(PATH::PAGE . "Page.php");
-require_once(PATH::ENTITY . "Unit.php");
-
-/**
- * Optimizer team list page model.
- *
- * @category Page
- */
-class Optimizer_Unit_Page extends Page{
-
-    /**
-     * @var Unit The unit to optimize.
-     */
-    private $unit;
-
-    /**
-     * Constructor.
-     *
-     * Retrieves the data and initializes the variables.
-     *
-     * @param string $id Selected unit id.
-     */
-    public function __construct($id){
-        parent::__construct();
-        $this->set_public(false);
-        $this->set_view("optimizer_unit.php");
-        $this->unit = new Unit($id);
-        $this->set_title("Optimize " . $this->unit->get_title());
-        $this->set_description("Optimize " . $this->unit->get_title() . "'s runes");
-        $this->set_canonical("player/" . get_context()->get_player()->get_id() . "/optimize/" . $this->unit->get_id());
-        $this->add_css("optimizer.css");
-        $this->set_code(200);
-        $this->set_message("OK");
-    }
-    /**
-     * Retrieves the unit to optimize.
-     *
-     * @return Unit Unit to optimize.
-     */
-    public function get_unit(){
-        return $this->unit;
-    }
-
-}
-?>

+ 2 - 2
application/page/Report_Skillup_Page.php

@@ -245,9 +245,9 @@ class Report_Skillup_Page extends Page{
                 AND monster.natural_stars BETWEEN :min_natural_stars AND :max_natural_stars
             ";
         }
-        if (!$this->filters["IN_STORAGE"]){
+        if (! $this->filters["IN_STORAGE"]){
             $query .= "
-              AND unit.building <> :storage_building
+              AND unit.building NOT IN (SELECT id FROM building WHERE buildable = :storage_building)
             ";
         }
         if (! $this->filters["WITHOUT_RUNES"]){

+ 2 - 0
application/page/Units_Page.php

@@ -34,6 +34,8 @@ class Units_Page extends Page{
         "MIN_STARS" => 1,
         "MAX_STARS" => 6,
         "IN_STORAGE" => false,
+        "IN_SHRINE" => false,
+        "IN_MATERIAL" => false,
         "WITHOUT_RUNES" => false,
         "EFFECT" => [],
         "EFFECT_OPTION" => "any"

+ 0 - 136
application/view/inc/header_player.php

@@ -1,136 +0,0 @@
-<?php
-    /**
-     * Site header view.
-     *
-     * To be included from all views.
-     *
-     * @category View
-     */
-
-if (get_context()->get_player() != null){
-?>
-    <script>
-        function setMode(rta){
-            if (rta === true){
-                mode = <?=GAME_MODE_ID::RTA?>;
-            }
-            else if (rta === false){
-                mode = <?=GAME_MODE_ID::NORMAL?>;
-            }
-            else{
-                return false;
-            }
-            params = '?player=<?=(get_context()->get_player() != null) ? get_context()->get_player()->get_id() : "0"?>&mode=' + mode;
-            var xhttp = new XMLHttpRequest();
-            xhttp.onreadystatechange = function() {
-                if (this.readyState == 4){
-                    if (this.status == 204){
-                        window.location.reload(false);
-                    }
-                }
-            };
-            xhttp.open('GET', '/action/change_game_mode/' + params, true);
-            xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
-            xhttp.send();
-            return true;
-        }
-    </script>
-    <nav class='menu' id='menu_player'>
-        <table>
-            <tr>
-                <td rowspan='2'>
-                    <select id='player_select'>
-                        <option selected='selected' value='<?=get_context()->get_player()->get_id()?>'>
-                            <?=get_context()->get_player()->get_name()?>
-                        </option>
-                    </select>
-                </td>
-                <td class='item'>
-                    <a href='/player/<?=get_context()->get_player()->get_id()?>/'>
-                        Profile
-                    </a>
-                </td>
-                <td class='item'>
-                    <a href='/player/<?=get_context()->get_player()->get_id()?>/units/'>
-                        Units
-                    </a>
-                </td>
-                <td class='item'>
-                    <a href='/player/<?=get_context()->get_player()->get_id()?>/runes/'>
-                        Runes
-                    </a>
-                </td>
-                <td class='item'>
-                    <a href='/player/<?=get_context()->get_player()->get_id()?>/artifacts/'>
-                        Artifacts
-                    </a>
-                </td>
-                <td class='item'>
-                    <a href='/player/<?=get_context()->get_player()->get_id()?>/enchantments/'>
-                        Enchantments
-                    </a>
-                </td>
-                <td class='item'>
-                    <a href='/player/<?=get_context()->get_player()->get_id()?>/teams/'>
-                        Teams
-                    </a>
-                </td>
-                <!-- <td class='last profile'>
-                    <a href='/<?=get_context()->get_player()->get_id()?>/profile/'>
-                        <?=get_context()->get_player()->get_name()?>
-                    </a>
-                </td>-->
-                <!-- <td class='item'>
-                    <a href='/<?=get_context()->get_player()->get_id()?>/monsters/'>
-                        Monsters
-                    </a>
-                </td>-->
-                <td class='item'>
-                    <a href='/<?=get_context()->get_player()->get_id()?>/guild/'>
-                        Guild
-                    </a>
-                </td>
-                <!-- TODO: Check if player == user -->
-                <td class='item'>
-                    <a href='/<?=get_context()->get_player()->get_id()?>/runs/'>
-                        Runs
-                    </a>
-                </td>
-                <!-- TODO: Check if player == user -->
-                <td class='item'>
-                    <a href='/player/<?=get_context()->get_player()->get_id()?>/report/'>
-                        Reports
-                    </a>
-                </td>
-                <!-- TODO: Check if player == user -->
-                <td class='item'>
-                    <a href='/player/<?=get_context()->get_player()->get_id()?>/optimizer/'>
-                        Optimizer
-                    </a>
-                </td>
-                <td class='no_item'>
-                </td>
-                <!--<td class='item'>
-                    <a href='/<?=get_context()->get_player()->get_id()?>/stats/'>
-                        Stats
-                    </a>
-                </td>-->
-                <td class='last mode'>
-                    <div id='mode_switch'>
-                        <span class='mode'>
-                            N<span class='desktop'>ormal</span>
-                        </span>
-                        <label class='switch'>
-                            <input type="checkbox" <?=(get_context()->get_game_mode() == GAME_MODE_ID::RTA ? "checked='cheecked'" : "")?> onChange='setMode(this.checked);'/>
-                            <span class="slider round"></span>
-                        </label>
-                        <span class='mode'>
-                            R<span class='desktop'>TA</span>
-                        </span>
-                    </div>
-                </td>
-            </tr>
-        </table>
-    </nav>
-<?php
-}

+ 0 - 16
application/view/monster.php

@@ -166,22 +166,6 @@
                             </table>
                             <div class='extra'>
 <?php
-                                if (count($monster->get_sources()) > 0){
-?>
-                                    <!-- TODO NOT WORKING<div class='sources'>
-                                        <span>
-                                            Obtainable from:
-                                        </span>
-<?php
-                                        foreach ($monster->get_sources() as $source){
-?>
-                                            <img title='<?=$source->get_name()?>' class='source' src='<?=$source->get_image()?>' />
-<?php
-                                        }
-?>
-                                    </div>-->
-<?php
-                                }
                                 if (count($monster->get_essences()) > 0){
 ?>
                                     <div class='essences'>

+ 0 - 245
application/view/optimizer.php

@@ -1,245 +0,0 @@
-<?php
-/**
- * Optimizer teams view.
- *
- * Contains the view layout and ome code to present the data.
- *
- * @author Iñigo Valentin <i@inigovalentin.com>
- * @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3
- * @package SWDB
- * @category View
- * @property Optimizer_Page $page The page model.
- * @var Optimizer_Page $page The page model.
- */
-?>
-<!DOCTYPE html>
-<html lang='en'>
-    <head>
-        <?=$page->generate_head()?>
-        <script>
-            units = [];
-<?php
-            $units_added = [];
-            foreach ($page->get_teams() as $team){
-                foreach ($team->get_units() as $unit){
-                    if (!in_array($unit->get_id(), $units_added)){
-                        array_push($units_added, $unit->get_id());
-                        $panel = json_encode("<div class='monster_panel'>" . HTML::unit_panel($unit) . "</div>");
-?>
-                        units.push(
-                            {
-                                id: "<?=$unit->get_id()?>",
-                                score: <?=$team->get_score()?>,
-                                panel: <?=$panel?>
-                            }
-                        );
-<?php
-                    }
-                    else{
-                        // Find in array and increase score
-?>
-                        for (let i = 0; i < units.length; i++) {
-                            if (units[i].id == "<?=$unit->get_id()?>"){
-                                units[i].score += <?=$team->get_score()?>;
-                                break;
-                            }
-                        }
-<?php
-                    }
-                }
-            }
-?>
-            /**
-             * Changes the score of a team.
-             *
-             * @param team ID of the team to change.
-             * @param score New score.
-             * @return true on success, false on error.
-             */
-            function rateTeam(team, score){
-                params = '?player=<?=get_context()->get_player()->get_id()?>&team=' + team + '&score=' + score;
-                console.log(params);
-                var xhttp = new XMLHttpRequest();
-                xhttp.onreadystatechange = function() {
-                    if (this.readyState == 4){
-                        // TODO
-                        // Loop units array and set the new score
-                        calculateScores();
-                    }
-                };
-                xhttp.open('GET', '/action/rate_team/' + params, true);
-                xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
-                xhttp.send();
-                return true;
-            }
-
-            /**
-             * Redirect to a unit optimization page.
-             *
-             * @param unit ID of the unit to optimize.
-             */
-            function optimize(unit){
-                window.location.href = "/player/<?=get_context()->get_player()->get_id()?>/optimizer/" + unit;
-            }
-
-            /**
-             * Builds the unitpriority table.
-             *
-             * Calculates the score of each unit acording to teams score, and
-             * builds a sorted table enabling a link to optimization.
-             */
-            function calculateScores(){
-                // Sort array, descending score
-                units = units.sort(function(a, b){return b.score - a.score;});
-
-                // Draw table
-                const container = document.getElementById('unit_list');
-                while (container.firstChild) {
-                    container.removeChild(container.lastChild);
-                }
-                let table = document.createElement('table');
-                let tr = document.createElement('tr');
-                let th = document.createElement('th');
-                th.innerHTML = 'Unit';
-                th.setAttribute('class', 'unit');
-                tr.appendChild(th);
-                th = document.createElement('th');
-                th.setAttribute('class', 'score');
-                th.innerHTML = 'Score';
-                tr.appendChild(th);
-                th = document.createElement('th');
-                th.innerHTML = 'Action';
-                th.setAttribute('class', 'action');
-                tr.appendChild(th);
-                table.appendChild(tr);
-                var odd = 'odd';
-                for (let i = 0; i < units.length; i++) {
-                    let tr = document.createElement('tr');
-                    let td = document.createElement('td');
-                    td.setAttribute('class', 'unit ' + odd);
-                    td.innerHTML = units[i].panel;
-                    tr.appendChild(td);
-                    td = document.createElement('td');
-                    td.setAttribute('class', 'score ' + odd);
-                    td.innerHTML = units[i].score;
-                    tr.appendChild(td);
-                    td = document.createElement('td');
-                    td.setAttribute('class', 'action ' + odd);
-                    btn = document.createElement('input');
-                    btn.setAttribute('type', 'button');
-                    btn.setAttribute('value', 'Optimize');
-                    btn.setAttribute('onclick', 'optimize("' + units[i].id + '")'); 
-                    td.appendChild(btn);
-                    tr.appendChild(td);
-                    table.appendChild(tr);
-                    if (odd == ''){
-                        odd = 'odd';
-                    }
-                    else{
-                        odd = '';
-                    }
-                }
-                container.appendChild(table);
-            }
-
-        </script>
-    </head>
-    <body onLoad='calculateScores();'>
-        <header>
-<?php
-            include __DIR__ . "/inc/header_app.php";
-            include __DIR__ . "/inc/header_player.php";
-?>
-        </header>
-        <aside>
-            <h2>
-                Optimizer
-            </h2>
-            <p>
-                Rate your teams and optimize the units that you use the most.
-                <br/>
-                <br/>
-                <br/>
-                To optimize units that are not on teams, do so from the <a href='/<?=get_context()->get_player()->get_id()?>/units/'>units page</a>.
-            </p>
-        </aside>
-        <main>
-            <section class='content'>
-                <h2>
-                    Teams
-                </h2>
-                <article>
-                    <table id='teams'>
-                        <tr>
-                            <th>
-                                Team
-                            </th>
-                            <th>
-                                Units
-                            </th>
-                            <th>
-                                Score
-                            </th>
-                        </tr>
-<?php
-                        $odd = "odd";
-                        foreach ($page->get_teams() as $team){
-?>
-                            <tr>
-                                <td class='team <?=$odd?>'>
-                                    <?=$team->get_name()?>
-                                </td>
-                                <td class='units <?=$odd?>'>
-<?php
-                                    $prev_front = false;
-                                    $front = "undefined";
-                                    foreach ($team->get_units() as $unit){
-                                        $front = in_array($unit->get_id(), $team->get_frontline());
-                                        if ($front != "undefined" && $prev_front != $front){
-?>
-                                            <hr class='frontline'/>
-<?php
-                                        }
-?>
-                                        <a href='/<?=get_context()->get_player()->get_id()?>/units/<?=$unit->get_id()?>' target='_blank'>
-                                            <div class='monster_panel'>
-                                                <?=HTML::unit_panel($unit)?>
-<?php
-                                                if ($unit->get_id() == $team->get_leader()){
-?>
-                                                    <img alt='Leader' class='leader' src='<?=URL::IMG["ICON"]?>leader.png'/>
-<?php
-                                                }
-?>
-                                            </div>
-                                        </a>
-<?php
-                                        $prev_front = $front;
-                                    }
-?>
-                                </td>
-                                <td class='score <?=$odd?>'>
-                                    <input type='number' min='0' max='20' value='<?=$team->get_score()?>' onChange='rateTeam(<?=$team->get_id()?>, this.value);'/>
-                                </td>
-                            </tr>
-<?php
-                            if ($odd == ""){
-                                $odd = "odd";
-                            }
-                            else{
-                                $odd = "";
-                            }
-                        }
-?>
-                    </table>
-                    <div id='unit_list'>
-                    </div>
-                </article>
-            </section> <!-- .list -->
-        </main>
-
-<?php
-        include __DIR__ . "/inc/footer.php";
-?>
-    </body>
-</html>

+ 77 - 147
application/view/player.php

@@ -20,17 +20,13 @@
     <body>
         <header>
 <?php
-            include __DIR__ . "/inc/header_app.php";
-            include __DIR__ . "/inc/header_player.php";
+            include __DIR__ . "/inc/header.php";
 ?>
         </header>
         <aside>
             <h2>
-                <?=get_context()->get_player()->get_name()?>
-            </h2>
-            <p>
                 <?=get_context()->get_player()->get_name()?>'s profile
-            </p>
+            </h2>
             <table id='profile'>
                 <tr>
                     <td class='label'>
@@ -87,141 +83,80 @@
                             <h4>
                                 Placements
                             </h4>
-                            <div id='placements_rep'>
-                                <h5>
-                                    Rep monster:
-                                </h5>
-                                <div class='monster_panel'>
-                                    <?=HTML::unit_panel(get_context()->get_player()->get_rep())?>
-                                </div> <!-- .monster_panel -->
-                            </div>
-                            <div id='placements_arena'>
-                                <h5>
-                                    Arena defense:
-                                </h5>
-<?php
-                                $first = true;
-                                foreach (get_context()->get_player()->get_arena_defense() as $defense){
-                                    if (
-                                      $first && 
-                                      null != $defense->get_monster()->get_leader_skill() &&
-                                      (
-                                        $defense->get_monster()->get_leader_skill()->get_area() == EFFECT_AREA_ID::GENERAL ||
-                                        $defense->get_monster()->get_leader_skill()->get_area() == EFFECT_AREA_ID::ARENA
-                                      )
-                                    ){
-?>
-                                        <div class='skill'>
-                                            <img class='skill_img' title='<?=$defense->get_monster()->get_leader_skill()->get_description()?>' src='<?=$defense->get_monster()->get_leader_skill()->get_image()?>'/>
-                                        </div>
+                            <table>
+                                <tr>
+                                    <th>
+                                        Rep.
+                                    </th>
+                                    <td>
+                                        <?=HTML::unit_panel(get_context()->get_player()->get_rep(), $simple=true, $href="/player/" . get_context()->get_player()->get_id() . "/units/" . get_context()->get_player()->get_rep()->get_id())?>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <th>
+                                        Arena
+                                    </th>
+                                    <td>
+<?php
+                                        foreach (get_context()->get_player()->get_arena_defense() as $defense){
+?>
+                                            <?=HTML::unit_panel($defense, $simple=true, $href="/player/" . get_context()->get_player()->get_id() . "/units/" . $defense->get_id())?>
 <?php
-                                    }
-                                    $first = false;
+                                        }
 ?>
-                                    <div class='monster_panel'>
-                                        <?=HTML::unit_panel($defense)?>
-                                    </div>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <th>
+                                        G. War
+                                    </th>
+                                    <td>
+                                        <div class='team'>
 <?php
-                                }
+                                            foreach (get_context()->get_player()->get_gw_defense()[0] as $defense){
+?>
+                                                <?=HTML::unit_panel($defense, $simple=true, $href="/player/" . get_context()->get_player()->get_id() . "/units/" . $defense->get_id())?>
+<?php
+                                            }
 ?>
-                            </div>
-                            <div id='placements_gw'>
-                                <h5>
-                                    Guild War defense:
-                                </h5>
-<?php
-                                $first = true;
-                                // TODO: Watch if null
-                                foreach (get_context()->get_player()->get_gw_defense()[0] as $defense){
-                                    if (
-                                      $first &&
-                                      null != $defense->get_monster()->get_leader_skill() &&
-                                      (
-                                        $defense->get_monster()->get_leader_skill()->get_area() == EFFECT_AREA_ID::GENERAL ||
-                                        $defense->get_monster()->get_leader_skill()->get_area() == EFFECT_AREA_ID::GUILD
-                                      )
-                                    ){
-?>
-                                        <div class='skill'>
-                                            <img class='skill_img' title='<?=$defense->get_monster()->get_leader_skill()->get_description()?>' src='<?=$defense->get_monster()->get_leader_skill()->get_image()?>'/>
                                         </div>
+                                        <div class='team'>
 <?php
-                                    }
-                                    $first = false;
+                                            foreach (get_context()->get_player()->get_gw_defense()[1] as $defense){
 ?>
-                                    <div class='monster_panel'>
-                                        <?=HTML::unit_panel($defense)?>
-                                    </div>
+                                                <?=HTML::unit_panel($defense, $simple=true, $href="/player/" . get_context()->get_player()->get_id() . "/units/" . $defense->get_id())?>
 <?php
-                                }
-                                
-?>
-                                <hr/>
-<?php
-                                $first = true;
-                                // TODO: Watch if null
-                                foreach (get_context()->get_player()->get_gw_defense()[1] as $defense){
-                                        // TODO: Guild content, not arena.
-                                        if (
-                                          $first &&
-                                          null != $defense->get_monster()->get_leader_skill() &&
-                                          (
-                                            $defense->get_monster()->get_leader_skill()->get_area() == EFFECT_AREA_ID::GENERAL ||
-                                            $defense->get_monster()->get_leader_skill()->get_area() == EFFECT_AREA_ID::GUILD
-                                          )
-                                        ){
-?>
-                                        <div class='skill'>
-                                            <img class='skill_img' title='<?=$defense->get_monster()->get_leader_skill()->get_description()?>' src='<?=$defense->get_monster()->get_leader_skill()->get_image()?>'/>
+                                            }
+?>
                                         </div>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <th colspan='2'>
+                                        Siege defences
+                                    </th>
+                                </tr>
+                                <tr>
+                                    <td id='siege_def' colspan='2'>
 <?php
-                                    }
-                                    $first = false;
+                                        foreach (get_context()->get_player()->get_siege_defense() as $formation){
 ?>
-                                    <div class='monster_panel'>
-                                        <?=HTML::unit_panel($defense)?>
-                                    </div>
+                                            <div class='team'>
 <?php
-                                }
-?>
-                            </div>
-                            <div id='placements_siege'>
-                                <h5>
-                                    Siege Battle defenses:
-                                </h5>
-<?php
-                                
-                                foreach (get_context()->get_player()->get_siege_defense() as $formation){
-                                    $first = true;
-                                    foreach($formation as $defense){
+                                                foreach($formation as $defense){
 
-                                        if (
-                                          $first &&
-                                          null != $defense->get_monster()->get_leader_skill() &&
-                                          (
-                                            $defense->get_monster()->get_leader_skill()->get_area() == EFFECT_AREA_ID::GENERAL ||
-                                            $defense->get_monster()->get_leader_skill()->get_area() == EFFECT_AREA_ID::GUILD
-                                          )
-                                        ){
-?>
-                                            <div class='skill'>
-                                                <img class='skill_img' title='<?=$defense->get_monster()->get_leader_skill()->get_description()?>' src='<?=$defense->get_monster()->get_leader_skill()->get_image()?>'/>
-                                            </div>
-<?php
-                                        }
-                                        $first = false;
 ?>
-                                        <div class='monster_panel'>
-                                            <?=HTML::unit_panel($defense)?>
-                                        </div>
+                                                    <?=HTML::unit_panel($defense, $simple=true, $href="/player/" . get_context()->get_player()->get_id() . "/units/" . $defense->get_id())?>
 <?php
-                                    }
+                                                }
 ?>
-                                    <hr/>
-    <?php
-                                }
+                                            </div>
+<?php
+                                        }
 ?>
-                            </div>
+                                    </td>
+                                </tr>
+                            </table>
                         </div>
                         <div id='building' class='profile_section'>
                             <h4>
@@ -445,7 +380,7 @@
                                     </tr>
                                     <tr>
                                         <td class='label'>
-                                            Trial of Ascension (N)
+                                            Trial of Ascension (Normal)
                                         </td>
                                         <td class='value toa'>
                                             <?=get_context()->get_player()->get_top_rank_toan()?>F
@@ -453,12 +388,21 @@
                                     </tr>
                                     <tr>
                                         <td class='label'>
-                                            Trial of Ascension (N)
+                                            Trial of Ascension (Hard)
                                         </td>
                                         <td class='value toa'>
                                             <?=get_context()->get_player()->get_top_rank_toah()?>F
                                         </td>
                                     </tr>
+                                    <tr>
+                                        <td class='label'>
+                                            Trial of Ascension (Hell)
+                                        </td>
+                                        <td class='value toa'>
+                                            <?=get_context()->get_player()->get_top_rank_toal()?>
+                                            <img id='toal_star' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                        </td>
+                                    </tr>
                                 </table>
                                 <table id='battle_records'>
 <?php
@@ -474,13 +418,15 @@
                                                     $title = "";
                                                     switch ($record->get_area()->get_type()){
                                                         case AREA_TYPE_ID::CAIROS_DUNGEON:
+                                                        case AREA_TYPE_ID::DIMENSIONAL_HOLE:
                                                             $title = $record->get_area()->get_name() . " " . $record->get_stage() . "F";
                                                             break;
                                                         case AREA_TYPE_ID::RIFT_DUNGEON:
                                                             $title = $record->get_area()->get_name();
                                                             break;
                                                         case AREA_TYPE_ID::RIFT_RAID:
-                                                            $title = $record->get_area()->get_name();
+                                                            $title = $record->get_area()->get_name() . " " . $record->get_stage();
+                                                            break;
 
                                                     }
 ?>
@@ -531,32 +477,16 @@
                                                     }
                                                     if ($party instanceof Monster){
                                                         $disabled = "disabled";
+                                                        $href = null;
                                                     }
                                                     else{
                                                         $disabled = "";
+                                                        $href="/player/" . get_context()->get_player()->get_id() . "/units/" . $party->get_id();
                                                     }
-                                                    if ($disabled == ""){
-?>
-                                                        <a target='_blank' href='/player/<?=get_context()->get_player()->get_id()?>/units/<?=$party->get_id()?>'>
-<?php
-                                                    }
-?>
-                                                    <div class='monster_panel <?=$disabled?>'>
-                                                        <?=HTML::unit_panel($party)?>
-<?php
-                                                            if ($party->get_id() == $record->get_leader()){
 ?>
-                                                                <img alt='Leader' class='leader' src='<?=URL::IMG["ICON"]?>leader.png'/>
+                                                    <?=HTML::unit_panel($party, $simple=true, $href="/player/" . get_context()->get_player()->get_id() . "/units/" . $defense->get_id())?>
 <?php
-                                                            }
-?>
-                                                    </div>
-<?php
-                                                    if ($disabled == ""){
-?>
-                                                        </a>
-<?php
-                                                    }
+
                                                     $prev_front = $front;
                                                 }
 ?>

+ 2 - 2
application/view/unit.php

@@ -364,8 +364,8 @@
                     </table>
                 </article>
                 <article id='artifacts'>
-                    <?=HTML::artifact_table($page->get_unit()->get_artifacts()[ARTIFACT_TYPE::ARCHETYPE])?>
-                    <?=HTML::artifact_table($page->get_unit()->get_artifacts()[ARTIFACT_TYPE::ELEMENT])?>
+                    <?=HTML::artifact_table($page->get_unit()->get_artifacts()[ARTIFACT_TYPE::ARCHETYPE - 1])?>
+                    <?=HTML::artifact_table($page->get_unit()->get_artifacts()[ARTIFACT_TYPE::ELEMENT - 1])?>
                 </article>
                 <article id='runes'>
 <?php

+ 18 - 311
application/view/units.php

@@ -18,8 +18,7 @@
     <body>
         <header>
 <?php
-            include __DIR__ . "/inc/header_app.php";
-            include __DIR__ . "/inc/header_player.php";
+            include __DIR__ . "/inc/header.php";
 ?>
         </header>
         <aside id='filters' class='content filters'>
@@ -27,7 +26,7 @@
                 Monsters
             </h2>
             <p>
-                Monsters
+                Filters
             </p>
             <form action='/player/<?=get_context()->get_player()->get_id()?>/units/' method='get'  id='filter_monsters' class='filter'>
                 <table>
@@ -40,7 +39,7 @@
                             $selected = Array("", "", "", "", "");
                             $selected[$page->get_filter("ELEMENT") - 1] = "selected";
 ?>
-                            <select name='element'>
+                            <select multiple name='element'>
                                 <option> </option>
                                 <option value='<?=ELEMENT_ID::FIRE?>' <?=$selected[1]?>>Fire</option>
                                 <option value='<?=ELEMENT_ID::WATER?>' <?=$selected[0]?>>Water</option>
@@ -71,13 +70,25 @@
                     <tr>
                         <td class='filter' colspan='2'>
 <?php
-                            $checked = "";
+                            $checkedStorage = "";
+                            $checkedShrine = "";
+                            $checkedMaterial = "";
                             if ($page->get_filter("IN_STORAGE")){
-                                $checked = "checked";
+                                $checkedStorage = "checked";
+                            }
+                            if ($page->get_filter("IN_SHRINE")){
+                                $checkedShrine = "checked";
+                            }
+                            if ($page->get_filter("IN_MATERIAL")){
+                                $checkedMaterial = "checked";
                             }
 ?>
-                            <input type='checkbox' name='in_storage' id='filter_in_storage'<?=$checked?>/>
+                            <input type='checkbox' name='in_storage' id='filter_in_storage' <?=$checkedStorage?>/>
                             <label for='filter_in_storage'>Monsters in storage</label>
+                            <input type='checkbox' name='in_shrine' id='filter_in_shrine' <?=$checkedShrine?>/>
+                            <label for='filter_in_storage'>Monsters in the Sealed Shrine</label>
+                            <input type='checkbox' name='in_material' id='filter_in_material' <?=$checkedMaterial?>/>
+                            <label for='filter_in_storage'>Monsters in Enhancing Storage</label>
                         </td>
                     </tr>
                     <tr>
@@ -154,310 +165,6 @@
                                     <?=HTML::unit_panel($unit)?>
                                 </div>
                             </a>
-                            <div class='monster_tooltip'>
-                                <h4>
-                                    <?=$unit->get_title()?>
-                                </h4>
-                                <table class='stats'>
-                                    <tr>
-                                        <th>
-                                            Stats
-                                        </th>
-                                        <th>
-                                            Base
-                                        </th>
-                                        <th>
-                                            Runes
-                                        </th>
-                                        <th>
-                                            Artif.
-                                        </th>
-                                        <th>
-                                            Bldg.
-                                        </th>
-                                        <th>
-                                            Total
-                                        </th>
-                                    </tr>
-                                    <tr>
-                                        <th>
-                                            ATK
-                                        </th>
-                                        <td class='base'>
-                                            <?=$unit->get_base_stats()["atk"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_rune_stats()["atk"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_artifact_stats()["atk"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_building_stats()["atk"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='total'>
-                                            <?=$unit->get_stats()["atk"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                    </tr>
-                                    <tr>
-                                        <th>
-                                            DEF
-                                        </th>
-                                        <td class='base'>
-                                            <?=$unit->get_base_stats()["def"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_rune_stats()["def"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_artifact_stats()["def"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_building_stats()["def"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='total'>
-                                            <?=$unit->get_stats()["def"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                    </tr>
-                                    <tr>
-                                        <th>
-                                            HP
-                                        </th>
-                                        <td class='base'>
-                                            <?=$unit->get_base_stats()["hp"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_rune_stats()["hp"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_artifact_stats()["hp"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_building_stats()["hp"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='total'>
-                                            <?=$unit->get_stats()["hp"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                    </tr>
-                                    <tr>
-                                        <th>
-                                            SPD
-                                        </th>
-                                        <td class='base'>
-                                            <?=$unit->get_base_stats()["spd"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_rune_stats()["spd"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_artifact_stats()["spd"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_building_stats()["spd"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='total'>
-                                            <?=$unit->get_stats()["spd"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                    </tr>
-                                    <tr>
-                                        <th>
-                                            CRR
-                                        </th>
-                                        <td class='base'>
-                                            <?=$unit->get_base_stats()["crr"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_rune_stats()["crr"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_artifact_stats()["crr"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_building_stats()["crr"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                        <td class='total'>
-                                            <?=$unit->get_stats()["crr"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                    </tr>
-                                    <tr>
-                                        <th>
-                                            CRD
-                                        </th>
-                                        <td class='base'>
-                                            <?=$unit->get_base_stats()["crd"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_rune_stats()["crd"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_artifact_stats()["crd"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_building_stats()["crd"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                        <td class='total'>
-                                            <?=$unit->get_stats()["crd"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                    </tr>
-                                    <tr>
-                                        <th>
-                                            ACC
-                                        </th>
-                                        <td class='base'>
-                                            <?=$unit->get_base_stats()["acc"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_rune_stats()["acc"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_artifact_stats()["acc"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_building_stats()["acc"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                        <td class='total'>
-                                            <?=$unit->get_stats()["acc"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                    </tr>
-                                    <tr>
-                                        <th>
-                                            RES
-                                        </th>
-                                        <td class='base'>
-                                            <?=$unit->get_base_stats()["res"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_rune_stats()["res"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_artifact_stats()["res"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_building_stats()["res"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                        <td class='total'>
-                                            <?=$unit->get_stats()["res"]?>
-                                            <span class='percent'>%</span>
-                                        </td>
-                                    </tr>
-                                    <tr>
-                                        <th>
-                                            EHP
-                                        </th>
-                                        <td class='base'>
-                                            <?=$unit->get_base_stats()["ehp"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_rune_stats()["ehp"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_artifact_stats()["ehp"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_building_stats()["ehp"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='total'>
-                                            <?=$unit->get_stats()["ehp"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                    </tr>
-                                    <tr>
-                                        <th>
-                                            DMG
-                                        </th>
-                                        <td class='base'>
-                                            <?=$unit->get_base_stats()["dmg"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_rune_stats()["dmg"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_artifact_stats()["dmg"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='extra'>
-                                            +<?=$unit->get_building_stats()["dmg"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                        <td class='total'>
-                                            <?=$unit->get_stats()["dmg"]?>
-                                            <span class='percent'>&nbsp;</span>
-                                        </td>
-                                    </tr>
-                                </table>
-                                <div class='skills'>
-<?php
-                                    $skill_num = 0;
-                                    foreach ($unit->get_monster()->get_skills() as $skill){
-                                        $cur_lvl = $unit->get_skill_levels()[$skill_num];
-                                        $max_lvl = $skill->get_max_level();
-                                        if ($max_lvl == $cur_lvl){
-                                            $maxed = "maxed";
-                                        }
-                                        else{
-                                            $maxed = "";
-                                        }
-?>
-                                        <div class='skill'>
-                                            <img src='<?=$skill->get_image()?>'/>
-                                            <span class='skill_level <?=$maxed?>'>
-                                                <?=$cur_lvl?>/<?=$max_lvl?>
-                                            </span>
-                                            <span class='skill_name'>
-                                                <?=$skill->get_name()?>
-                                            </span>
-                                        </div>
-<?php
-                                        $skill_num ++;
-                                    }
-?>
-                                </div>
-                            </div>
                         </div>
 <?php
                 }

+ 0 - 372
public/css/optimizer.css

@@ -1,372 +0,0 @@
-table#teams{
-    display: inline-block;
-    vertical-align: top;
-    border-collapse: collapse;
-    border: 0.1em solid #000000;
-    border-radius: 0.4em;
-}
-
-table#teams th{
-    border-top: 0.1em solid #000000;
-    border-bottom: 0.1em solid #000000;
-    background-color: #00000066;
-}
-
-table#teams td{
-    border-bottom: 0.1em solid #000000;
-    text-align: left;
-    padding: 0.2em;
-    height: 2em;
-}
-
-table#teams td.odd{
-    background-color: #00000033;
-}
-
-table#teams td.team{
-    font-weight: bold;
-}
-
-table#teams td.description{
-    font-size: 90%;
-}
-
-
-table#teams td.units{
-    width: 12em;
-    text-align: center;
-}
-
-table#teams td.units hr.frontline{
-    display: block;
-    width: 9em;
-    margin: 0 auto 0.2em auto;
-    color: #666666;
-}
-
-table#teams td.units div.monster_panel{
-    font-size: 25%;
-}
-
-table#teams td.units div.monster_panel img.leader{
-    width: 5em;
-    height: 5em;
-    display: block;
-    position: absolute;
-    top: -1.7em;
-    left: -0.7em;
-}
-
-div#unit_list{
-    display: inline-block;
-    width: 30%;
-    vertical-align: top;
-    text-align: center
-}
-
-div#unit_list table{
-    border-collapse: collapse;
-    border: 0.1em solid #000000;
-    display: inline-block;
-    vertical-align: top;
-    border-radius: 0.4em;
-}
-
-div#unit_list table th{
-    padding: 0.2em 0.4em;
-    background-color: #00000066;
-}
-
-div#unit_list table td{
-    vertical-align: middle;
-    text-align: center;
-    margin: 0;
-    border-bottom: 0.1em solid #000000;
-    padding: 0;
-}
-
-div#unit_list table td.odd{
-    background-color: #00000033;
-}
-
-div#unit_list table div.monster_panel{
-    font-size: 25%;
-}
-
-div#unit_list table td.action input[type="button"]{
-    font-size: 90%;
-    padding: 0.1em;
-}
-
-aside div#monster_info{
-    display: block;
-    text-align: center;
-}
-aside div#monster_info div#monster_details{
-    display: block;
-    margin: auto;
-    font-size: 70%;
-}
-@media only screen and (max-width: 788px){
-    aside div#monster_info div#monster_details{
-        display: inline-block;
-        vertical-align: top;
-        text-align: center;
-    }
-}
-aside div#monster_info div#monster_details div#teams{
-    text-align: left;
-    margin-left: 4em;
-}
-
-aside div#monster_info div#monster_details div#teams h4{
-    margin: 0.2em auto;
-}
-
-section#monster article#profile table#stats{
-    font-size: 90%;
-    vertical-align: top;
-    display: inline-block;
-    border: 0.1em solid black;
-    color: #ffffff;
-    margin: auto;
-    border-collapse: collapse;
-    border-radius: 0.4em;
-}
-
-section#monster article#profile table#stats{
-    font-size: 90%;
-    vertical-align: top;
-    display: inline-block;
-    border: 0.1em solid black;
-    color: #ffffff;
-    margin: auto;
-    border-collapse: collapse;
-    border-radius: 0.4em;
-}
-
-section#monster article#profile table#stats th{
-    font-weight: bold;
-    background-color: #00000066;
-}
-
-section#monster article#profile table#stats td{
-    font-weight: bold;
-    background-color: #ffffff33;
-    text-align: right;
-    font-family: monospace;
-    font-size: 120%;
-}
-
-section#monster article#profile table#stats td span.percent{
-    margin: 0 0 0 -0.7em;
-    font-size: 80%;
-}
-
-section#monster article#profile table#stats td, th{
-    padding: 0.2em;
-    border: 0.1em solid #000000;
-}
-
-section#monster article#profile table#stats td.extra{
-    color: #aaaaff;
-}
-
-section#monster article#profile table#stats td.total{
-    color: #f2c920;
-    font-weight: bold;
-}
-
-section#monster article#profile div#artifacts{
-    display: inline-block;
-}
-
-section#monster article#profile div#artifacts table.artifact{
-    display: block;
-}
-
-section#parameters article{
-    text-align: left;
-}
-
-section#parameters article table{
-    margin: auto;
-}
-
-section#parameters article input[type="number"]{
-    width: 4em;
-    text-align: right;
-    -moz-appearance: textfield;
-}
-
-section#parameters span.slider_percent{
-    display: inline-block;
-    width: 1em;
-    font-size: 70%;
-}
-
-section#parameters a.filter_control{
-    width: 1em;
-    height: 1em;
-    display: inline-block;
-    vertical-align: bottom;
-}
-section#parameters a.filter_control img{
-    width: 0.8em;
-    height: 0.8em;
-    left: 0.15em;
-    position: relative;
-}
-
-section#parameters article img#wait{
-    width: 2.5em;
-    height: 2.5em;
-    display: none;
-}
-section#parameters td#log{
-    border: 0.1em solid #000000;
-    border-radius: 0.3em;
-    vertical-align: bottom;
-    overflow-y: scroll;
-    position: relative;
-    background-color: #000000;
-}
-section#parameters td#log div#log_title{
-    position: absolute;
-    font-weight: bold;
-    color: #ffffff;
-    top: 0;
-    left: 0;
-    right: 0;
-    border-bottom: 0.1em solid #ffffff;
-    background-color: #000000;
-}
-section#parameters td#log div#log_title span#log_clear{
-    float: right;
-    cursor: pointer;
-    font-size: 90%;
-}
-section#parameters td#log div#log_window{
-    padding-top: 1.5em;
-    height: 5em;
-    overflow-y: scroll;
-    scrollbar-width: thin;
-}
-section#parameters td#log div#log_window span.log_message{
-    font-family: monospace;
-    display: block;
-    margin: 0 0 0 0.5em;
-    font-size: 90%;
-}
-section#results{
-    display: none;
-}
-
-section#results div#results_info{
-    text-align: left;
-    font-weight: bold;
-    margin: 2em auto 1em 10%
-}
-
-section#results td.option_stats table.stat_table{
-    border-collapse: collapse;
-    vertical-align: top;
-    display: inline-block;
-    border: 0.1em solid black;
-    color: #ffffff;
-    margin: auto;
-    border-radius: 0.4em;
-}
-
-section#results td.option_stats table.stat_table td{
-    border: 0.1em solid #00000033;
-}
-
-section#results td.option_stats table.stat_table td.label{
-    text-align: left;
-    font-family: monospace;
-    font-size: 110%;
-    font-weight: bold;
-    background-color: #00000066;
-}
-
-section#results td.option_stats table.stat_table td.value{
-    text-align: right;
-    font-family: monospace;
-    font-size: 110%;
-}
-
-section#results td.option_stats table.stat_table td.value span.variation{
-    font-size: 90%;
-    width: 4em;
-    display: inline-block;
-    text-align: left;
-    padding-left: 0.5em;
-    font-weight: bold
-}
-
-section#results td.option_stats table.stat_table td.value span.variation.increment{
-    color: #00ff00;
-}
-
-section#results td.option_stats table.stat_table td.value span.variation.increment::before {
-    content: "▲"; /*"&#9650;";*/
-}
-
-section#results td.option_stats table.stat_table td.value span.variation.decrement{
-    color: #ff0000;
-}
-section#results td.option_stats table.stat_table td.value span.variation.decrement::before {
-    content: "▼"; /*"&#9660;";*/
-}
-
-section#results td.runes table.rune{
-    font-size: 80%;
-}
-
-section#results table#table_optimizations{
-    border-collapse: collapse;
-    margin: auto;
-    border-left: 0.1em solid #000000cc;
-    border-right: 0.1em solid #000000cc;
-}
-
-section#results td.option_stats, section#results td.runes{
-    vertical-align: top;
-    padding: 1em 3em;
-    border-top: 0.1em solid #000000cc;
-    border-bottom: 0.1em solid #000000cc;
-}
-section#results td.option_stats{
-    padding-right: 0.5em;
-}
-section#results td.runes{
-    padding-left: 0.5em;
-}
-
-div#message_container{
-    display: none;
-    position: fixed;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    background-color: #00000099;
-}
-
-div#message_container section{
-    position: fixed;
-    top: 30%;
-    left: 20%;
-    right: 20%;
-    bottom: 30%;
-}
-
-div#message_container section p#message_text{
-
-}
-
-div#message_container section input#message_button{
-    position: absolute;
-    bottom: 2em;
-}

+ 54 - 92
public/css/player.css

@@ -31,11 +31,12 @@ div.profile_section{
 
 div.profile_section h4{
     margin: 0 -0.5em 0.5em -0.5em;
-    border-top-left-radius: 0.5em;
-    border-top-right-radius: 0.5em;
+    border-top-left-radius: 0.2em;
+    border-top-right-radius: 0.2em;
     padding: 0.2em;
     border-bottom: 0.1em solid var(--ui-color-border);
-    background-color: #00000033;
+    background-color: var(--subsection-title-background);
+    text-shadow: var(--subsection-title-shadow);
 }
 
 aside table#profile{
@@ -44,8 +45,8 @@ aside table#profile{
 }
 
 aside table#profile td{
-    border-top: 0.1em solid #00000077;
-    border-bottom: 0.1em solid #00000077;
+    border-top: 0.1em solid var(--ui-color-border);
+    border-bottom: 0.1em solid var(--ui-color-border);
 }
 
 aside table#profile td.label{
@@ -62,94 +63,49 @@ article#profile div#placements h5{
     margin-bottom: 0.3em;
 }
 
-article#profile div#placements div#placements_rep div.monster_panel{
-    font-size: 45%;
-    margin: 0.2em;
-}
-article#profile div#placements div#placements_arena div.skill{
-    display: inline-block;
-    vertical-align: middle;
-    margin-top: -1.5em;
-}
-article#profile div#placements div#placements_arena div.skill img{
-    width:2em;
-    height: 2em;
-}
-article#profile div#placements div#placements_arena div.monster_panel{
-    font-size: 35%;
-    margin: 0.15em;
-}
-article#profile div#placements div#placements_gw div.skill{
-    display: inline-block;
-    vertical-align: middle;
-    margin-top: -1.5em;
-}
-article#profile div#placements div#placements_gw div.skill img{
-    width:2em;
-    height: 2em;
-}
-article#profile div#placements div#placements_gw div.monster_panel{
-    font-size: 40%;
-    margin: 0.2em;
-}
-article#profile div#placements div#placements_gw hr{
-    width: 12em;
-    margin: 0.1em auto;
-}
-article#profile div#placements div#placements_siege div.skill{
-    display: inline-block;
-    vertical-align: middle;
-    margin-top: -1.5em;
+article#profile div#placements table{
+    border-collapse: collapse;
+    width: 100%;
+    margin: auto;
 }
-article#profile div#placements div#placements_siege div.skill img{
-    width:2em;
-    height: 2em;
+
+article#profile div#placements table td, article#profile div#placements table th{
+    border: 0.1em solid var(--ui-color-border);
+    text-align: left;
 }
-article#profile div#placements div#placements_siege div.monster_panel{
-    font-size: 40%;
-    margin: 0.2em;
+article#profile div#placements table th{
+    background-color: #00000044;
+    text-align: left;
+    padding: 0.1em 0.5em;
 }
-article#profile div#placements div#placements_siege hr{
-    width: 12em;
-    margin: 0.1em auto;
+article#profile div#placements table td{
+    text-align: center;
 }
 
-article#profile div#building div.building_panel{
-    font-size: 50%;
+article#profile div#placements table td#siege_def{
+    text-align: center;
 }
 
-
-article#profile div.inventory div.item_panel{
+article#profile div#placements table td div.team{
     display: inline-block;
-    width: 2em;
-    height: 2em;
-    margin: 0.2em 0em;
-    position: relative;
-    border-radius: 15%;
-    vertical-align: middle;
+    background-color: var(--color-unit-group-background);
+    border: 0.1em solid var(--color-unit-group-border);;
+    border-radius: 0.2em;
+    padding: 0.2em 0.2em 0 0.2em;
+    margin: 0.1em auto;
 }
 
-article#profile div.inventory div.item_panel img.item{
-    width: 2em;
-    height: 2em;
-    border-style: solid;
-    border-width: 0.1em;
-    border-radius: 15%;
+article#profile div#placements table td div.monster_panel{
+    font-size: 30%;
 }
 
-article#profile div.inventory div.item_panel span.amount{
-    position: relative;
-    font-weight: bold;
-    color: #000;
-    text-shadow: 0 0 0.1em #fff, 0 0 0.2em #fff, 0 0 0.4em #fff, 0 0 0.4em #fff;
-    font-size: 0.8em;
-    bottom: 1.6em;
-    z-index: 1;
-    display: block;
-    text-align: right;
-    pointer-events: none;
+article#profile div#building div.building_panel{
+    font-size: 50%;
 }
 
+article#profile div#inventory div.item_panel{
+    font-size: 50%;
+}
 
 article#profile div#inventory ul{
     column-count: 2;
@@ -170,8 +126,8 @@ article#profile div#records div.record table#rank_records{
 }
 
 article#profile div#records div.record table#rank_records td{
-    border-top: 0.1em solid #00000077;
-    border-bottom: 0.1em solid #00000077;
+    border-top: 0.1em solid var(--ui-color-border);
+    border-bottom: 0.1em solid var(--ui-color-border);
 }
 
 article#profile div#records div.record table#rank_records td.label{
@@ -182,8 +138,8 @@ article#profile div#records div.record table#rank_records td.value{
     text-align: center;
 }
 article#profile div#records div.record table#rank_records td.value.rank img{
-    width: 1.5em;
-    height: 1.5em;
+    width: 1.2em;
+    height: 1.2em;
 }
 article#profile div#records div.record table#rank_records td.value.wboss{
     font-size: 110%;
@@ -197,26 +153,31 @@ article#profile div#records div.record table#rank_records td.value.toa{
     font-weight: bold;
 }
 
+article#profile div#records div.record table#rank_records td.value.toa img#toal_star{
+    height: 1em;
+    filter: sepia(100%) saturate(500%) hue-rotate(10deg) saturate(200%);
+}
+
 article#profile div#records div.record table#battle_records{
     border-collapse: collapse;
     margin: 0 auto;
 }
 
 article#profile div#records div.record table#battle_records td{
-    border-top: 0.1em solid #00000077;
-    border-bottom: 0.1em solid #00000077;
+    border-top: 0.1em solid var(--ui-color-border);
+    border-bottom: 0.1em solid var(--ui-color-border);
 }
 article#profile div#records div.record table#battle_records td.record_dungeon img{
-    width: 2em;
-    height: 2em;
-    border: 0.2em solid #555555;
+    width: 1.5em;
+    height: 1.5em;
+    border: 0.1em solid #555555;
     border-radius: 0.5em;
     background-color: #777777;
 }
 
 article#profile div#records div.record table#battle_records td.record_party{
-    font-size: 30%;
-    width: 45em;
+    font-size: 25%;
+    width: 37.5em;
 }
 
 article#profile div#records div.record table#battle_records td.record_party.frontlines{
@@ -225,6 +186,8 @@ article#profile div#records div.record table#battle_records td.record_party.fron
 
 article#profile div#records div.record table#battle_records td.record_party hr{
     width: 33em;
+    height: 0;
+    border-top: 0.1em solir var(--ui-color-border);
 }
 
 article#profile div#records div.record table#battle_records td.record_info{
@@ -238,13 +201,12 @@ article#profile div#records div.record table#battle_records td.record_info span.
 
 article#profile div#records div.record table#battle_records td.record_info span.title{
     font-weight: bold;
-    font-size: 110%;
     display: block;
     margin: 0.1em;
 }
 
 article#profile div#records div.record table#battle_records td.record_info span.time{
-    font-size: 90%;
+    font-size: 80%;
     font-style: italic;
 }
 article#profile div#records div.record table#battle_records td.record_info span.time span.ms{

+ 110 - 95
public/css/ui.css

@@ -9,7 +9,7 @@
      * Global elements
      */
     --global-color: #ffffff;
-    --global-background: #000000;
+    --global-background: #261d14;
     /**
      * Links.
      */
@@ -32,9 +32,10 @@
     /**
      * Sidebar.
      */
-    --sidebar-width: 22em;
-    --sidebar-background: #331100;
+    --sidebar-width: 18em;
+    --sidebar-background: #2c2218;
     --sidebar-border: 0.13em solid var(--ui-color-border);
+    --sidebar-title-padding: 3em 0 0.2em 1em;
     /**
      * Sections.
      */
@@ -43,20 +44,21 @@
     --section-padding: 0.3em;
     --section-margin: 0.2em;
     --section-title-margin: -0.3em -0.3em 0.3em -0.3em;
-    --section-title-background: #6c2d0d;
+    --section-title-background: #d4ae67;
     --section-title-border-radius: 0.35em;
     --section-title-padding: 0.2em 0 0.2em 1em;
     --section-title-font-size: 100%;
     --section-title-font-weight: bold;
-    --section-background-list: #331100;
-    --section-background-content: #755739;
+    --section-background-list: #25120c;
+    --section-background-content: #321c0f;
+    --section-title-shadow: 0 0 0.2em #312515;
+
     /**
-     * Star filters.
+     * Subsections
      */
-    --star-filter-silver: sepia(100%) saturate(500%) grayscale(100%) drop-shadow(0 0 0.1em #000000) drop-shadow(0 0 0.1em #000000) drop-shadow(0 0 0.1em #000000);
-    --star-filter-gold: sepia(100%) saturate(500%) hue-rotate(10deg) saturate(200%) drop-shadow(0 0 0.1em #000) drop-shadow(0 0 0.1em #000) drop-shadow(0 0 0.1em #000);
-    --star-filter-purple: sepia(100%) saturate(500%) hue-rotate(295deg) saturate(1200%) drop-shadow(0 0 0.1em #000) drop-shadow(0 0 0.1em #000) drop-shadow(0 0 0.1em #000);
-    --star-filter-red: sepia(100%) saturate(500%) hue-rotate(320deg) saturate(500%) drop-shadow(0 0 0.1em #000) drop-shadow(0 0 0.1em #000) drop-shadow(0 0 0.1em #000);
+    --subsection-title-background: #886d3b;
+    --subsection-title-shadow: 0 0 0.2em #312515;
+
     /**
      * Elemental colors.
      */
@@ -97,6 +99,8 @@
     --color-monster-tooltip-header: #150e00;
     --color-table-rune-background: #7d6640;
     --color-table-rune-border: #3c2929;
+    --color-unit-group-background: #2b1e06;
+    --color-unit-group-border: #7d6c4b;
 }
 
 
@@ -141,12 +145,6 @@
 .background_Dark{background-color: var(--element-color-dark);}
 .background_Magic{background-color: var(--element-color-magic);}
 
-/* Star colors. */
-img.star.star_silver{filter: var(--star-filter-silver);}
-img.star.star_gold{filter: var(--star-filter-gold);}
-img.star.star_purple{filter: var(--star-filter-purple);}
-img.star.star_red{filter: var(--star-filter-red);}
-
 html {height: 100%;}
 body{
     background-color: var(--global-background);
@@ -156,10 +154,10 @@ body{
     display: grid;
     /* Header and footer span the entire width, sidebars and content are fixed, with empty space on sides */
     grid-template-areas:
-    "header header"
-    "sidebar content"
-    "footer footer";
-    grid-template-columns: var(--sidebar-width); auto;
+      "header header"
+      "sidebar content"
+      "footer footer";
+      grid-template-columns: var(--sidebar-width); auto;
 }
 @media only screen and (max-width: 788px){
     body{
@@ -200,89 +198,80 @@ header{
     z-index: 1000;
 }
 
-header nav.menu{
+header nav{
     display: block;
     border-bottom: var(--header-border);
 }
-header nav.menu table td{
-    font-size: 100%;
-    font-weight: bold;
-    text-transform: capitalize;
-    font-variant: small-caps;
-    text-decoration: none;
+header nav table td{
     position: relative;
     padding: 0;
     vertical-align: middle;
 }
-@media screen and (max-width : 768px){
-    header nav.menu table td{
-        font-size: 85%;
-    }
-}
-header nav.menu table td.item{
+header nav table td.item{
     border: var(--nav-separator);
     text-align: center;
     padding: 0;
 }
-header nav.menu table td.last{
+header nav table td.last{
     width: 100%;
     text-align: right;
     padding-right: 0.5em;
 }
-header nav.menu table td.item a{
+header nav table td.item a{
+    font-size: 80%;
+    font-weight: bold;
+    font-variant: small-caps;
+    text-decoration: none;
+    font-family: sans-serif;
     color: var(--nav-color);
     text-shadow: var(--nav-shadow);
     transition: all .4s ease-in-out;
     display: block;
     padding: 0.3em 0.6em;
 }
-header nav.menu table td.item a:hover{
+header nav table td.item a:hover{
     background-color: var(--nav-background-hover);
     color: var(--nav-color-hover);
     text-shadow: var(--nav-shadow-hover);
 }
 
-header nav#menu_app h1#logo_text{
-    text-transform: none;
-    font-style: italic;
-    margin: 0em 10px;
-    text-shadow: 0 0 0.1em var(--ui-color-a-shadow), 0 0 0.1em var(--ui-color-a-shadow);
+header nav h1#logo_text{
+    margin: 0em 0.5em;
     line-height: 0.6;
     text-align: center;
-    width: 150px;
+    font-family: sans-serif;
+    font-size: 110%;
+}
+
+header nav td#search{
+    min-width: 13em;
+    text-align: center;
 }
 
-header nav#menu_app td#search input:first-child{
+header nav td#search input:first-child{
     /* Search text input */
     margin: auto 0.2em auto 1em;
+    width: 10em;
 }
 
-header nav#menu_app td#search input:last-child{
+header nav td#search input:last-child{
     /* Search button */
     margin: auto 1em auto 0.2em;
     padding: 0 0.4em;
 }
 
-header nav#menu_player select#player_select{
-    width: 150px ; /* Px, the same as the logo*/
+header nav select#player_select{
     margin: 0em 10px;
 }
 
-header table td.profile nav#profile{
+header table td.profile nav{
     float: right;
     margin-right: 0.5em;
     position: absolute;
     right: 0;
     top: 0em;
 }
-@media screen and (max-width : 768px){
-    header table td.profile nav#profile{
-        margin-right: 0.5em;
-        position: absolute;
-        top: 2em;
-        right: 0.5em;
-    }
-}
+
 header table td.profile a{
     border-left: 0;
     font-size: 110%;
@@ -304,25 +293,28 @@ header table td.profile a:hover{
     color: var(--nav-color-hover);
     text-shadow: var(--nav-shadow-hover);
 }
-header table td.mode div#mode_switch{
-    display: inline-block;
+header nav table td.mode{
+    text-align: center;
+}
+header nav table td.mode div#mode_switch{
+    display: block;
     font-size: 70%;
 }
-header table td.mode div#mode_switch label{
+header nav table td.mode div#mode_switch label{
     vertical-align: middle;
 }
-header table td.mode div#mode_switch .switch {
+header nav table td.mode div#mode_switch .switch {
     position: relative;
     display: inline-block;
     width: 2em;
     height: 1.5em;
 }
-header table td.mode div#mode_switch .switch input {
+header nav table td.mode div#mode_switch .switch input {
     opacity: 0;
     width: 0;
     height: 0;
 }
-header table td.mode div#mode_switch .slider {
+header nav table td.mode div#mode_switch .slider {
     position: absolute;
     cursor: pointer;
     top: 0;
@@ -333,7 +325,7 @@ header table td.mode div#mode_switch .slider {
     -webkit-transition: .4s;
     transition: .4s;
 }
-header table td.mode div#mode_switch .slider:before {
+header nav table td.mode div#mode_switch .slider:before {
     position: absolute;
     content: "";
     height: 1em;
@@ -344,21 +336,21 @@ header table td.mode div#mode_switch .slider:before {
     -webkit-transition: .4s;
     transition: .4s;
 }
-header table td.mode div#mode_switch input:checked + .slider {
+header nav table td.mode div#mode_switch input:checked + .slider {
   background-color: #324b4f;
 }
-header table td.mode div#mode_switch input:focus + .slider {
+header nav table td.mode div#mode_switch input:focus + .slider {
   box-shadow: 0 0 1px #2196F3;
 }
-header table td.mode div#mode_switch input:checked + .slider:before {
+header nav table td.mode div#mode_switch input:checked + .slider:before {
   -webkit-transform: translateX(0.5em);
   -ms-transform: translateX(0.5em);
   transform: translateX(0.5em);
 }
-header table td.mode div#mode_switch .slider.round {
+header nav table td.mode div#mode_switch .slider.round {
     border-radius: 1.5em;
 }
-header table td.mode div#mode_switch .slider.round:before {
+header nav table td.mode div#mode_switch .slider.round:before {
     border-radius: 50%;
 }
 
@@ -394,14 +386,14 @@ aside h2{
     margin: -0.3em -0.3em 0.5em -0.3em;
     border-bottom: var(--section-border);
     background-color: var(--section-title-background);
-    padding: var(--section-title-padding);
+    padding: var(--sidebar-title-padding);
     font-size: var(--section-title-font-size);
     font-weight: var(--section-title-font-weight);
     text-align: left;
     text-transform: capitalize;
     font-variant: small-caps;
     height: 1.2em;
-    padding-top: 5em;
+    text-shadow: var(--section-title-shadow);
 }
 @media only screen and (max-width: 788px){
     aside h2{
@@ -442,7 +434,7 @@ main{
     }
 }
 footer{
-    font-size: 80%;
+    font-size: 70%;
     text-align: center;
     border-top: var(--header-border);
     border-top-right-radius: var(--header-border-radius);
@@ -451,7 +443,6 @@ footer{
     background-color: var(--header-background);
     padding: 0;
     grid-area: footer;
-    position: sticky;
     bottom: 0;
     z-index: 1000;
 }
@@ -580,6 +571,7 @@ section h2{
     text-transform: capitalize;
     font-variant: small-caps;
     height: 1.2em;
+    text-shadow: var(--section-title-shadow);
 }
 @media screen and (max-width : 990px){
     section h2{
@@ -771,7 +763,6 @@ div.monster_panel{
     display: inline-block;
     width: 7em;
     height: 7em;
-    margin: 0.5em;
     position: relative;
     border-radius: 15%;
     overflow: hidden;
@@ -787,27 +778,21 @@ div.monster_panel{
 
 div.monster_panel span.stars{
     position: absolute;
-    top: 0.4em;
-    right: 0.5em;
+    top: 0.3em;
+    left: 0.3em;
     pointer-events: none;
 }
-@media screen and (max-width : 990px){
-    div.monster_panel span.stars{
-        top: 0.3em;
-        right: 0.4em;
-    }
-}
 
 div.monster_panel span.stars img.star{
-    width: 1.3em;
-    height: 1.3em;
-    margin-left: -0.65em;
+    width: 1.5em;
+    height: 1.5em;
+    margin-right: -0.95em;
     pointer-events: none;
 }
 @media screen and (max-width : 990px){
     div.monster_panel span.stars img.star{
-        width: 0.9em;
-        height: 0.9em;
+        width: 1.1em;
+        height: 1.1em;
         margin-left: -0.5em;
     }
 }
@@ -818,6 +803,7 @@ div.monster_panel img.monster{
     border-style: solid;
     border-width: 0.3em;
     border-radius: 15%;
+    box-shadow: inset 0 0 0.3em #000;
 }
 @media screen and (max-width : 990px){
     div.monster_panel img.monster{
@@ -832,11 +818,11 @@ div.monster_panel span.level{
     position: relative;
     font-weight: bold;
     color: #000;
-    text-shadow: 0 0 0.1em #fff, 0 0 0.1em #fff, 0 0 0.2em #fff, 0 0 0.2em #fff, 0 0 0.5em #fff, 0 0 0.5em #fff;
-    font-size: 2em;
-    width: 90%;
+    text-shadow: 0 0 0.5em #fff, 0 0 0.1em #fff, 0 0 0.5em #fff, 0 0 0.1em #fff;
+    font-size: 1.5em;
+    width: 95%;
     text-align: right;
-    bottom: 1.3em;
+    bottom: 1.5em;
     z-index: 1;
     pointer-events: none;
     display: block;
@@ -910,7 +896,6 @@ div.building_panel{
     display: inline-block;
     width: 4em;
     height: 4em;
-    margin: 0.2em 0em;
     position: relative;
     border-radius: 15%;
     vertical-align: middle;
@@ -926,16 +911,46 @@ div.building_panel img.building, img.decoration{
 
 div.building_panel span.level{
     position: relative;
-    bottom: 1.6em;
     font-weight: bold;
     color: #000;
-    text-shadow: 0 0 0.1em #fff, 0 0 0.2em #fff, 0 0 0.4em #fff, 0 0 0.4em #fff;
-    bottom: 1.4em;
+    text-shadow: 0 0 0.5em #fff, 0 0 0.1em #fff, 0 0 0.5em #fff, 0 0 0.1em #fff;
+    font-size: 1.5em;
+    width: 95%;
+    text-align: right;
+    bottom: 1.5em;
     z-index: 1;
-    font-size: 1em;
+    pointer-events: none;
     display: block;
+}
+
+div.item_panel{
+    display: inline-block;
+    width: 4em;
+    height: 4em;
+    position: relative;
+    border-radius: 15%;
+    vertical-align: middle;
+}
+
+div.item_panel img.item{
+    width: 4em;
+    height: 4em;
+    border-style: solid;
+    border-width: 0.1em;
+    border-radius: 15%;
+}
+div.item_panel span.amount{
+    position: relative;
+    font-weight: bold;
+    color: #000;
+    text-shadow: 0 0 0.5em #fff, 0 0 0.1em #fff, 0 0 0.5em #fff, 0 0 0.1em #fff;
+    font-size: 1.3em;
+    width: 95%;
     text-align: right;
+    bottom: 1.5em;
+    z-index: 1;
     pointer-events: none;
+    display: block;
 }
  
  

+ 0 - 112
public/css/units.css

@@ -25,115 +25,3 @@ section#list div.monster{
     position: relative;
     font-size: 80%;
 }
-
-section#list div.monster div.monster_tooltip{
-    position: absolute;
-    top: 0;
-    left: 6em;
-    z-index: 10;
-    display: none;
-    background: var(--color-monster-tooltip-background);
-    border: 0.2em solid var(--ui-color-border);
-    border-radius: 0.5em;
-    padding: 0.5em;
-}
-
-section#list div.monster:hover div.monster_tooltip{
-    display: block;
-}
-@media screen and (max-width : 990px){
-    section#list div.monster:hover div.monster_tooltip{
-        display: none;
-    }
-}
-
-section#list div.monster div.monster_tooltip h4{
-    font-weight: bold;
-    text-shadow: 0 0 0.2em #000000, 0 0 0.2em #000000, 0 0 0.4em #000000;
-    margin: 0.1em;
-    display: block;
-}
-
-section#list div.monster div.monster_tooltip table.stats{
-    font-size: 80%;
-    border: 0.1em solid black;
-    color: #ffffff;
-    border-collapse: collapse;
-}
-
-section#list div.monster div.monster_tooltip table.stats th{
-    font-weight: bold;
-    border-bottom: 0.1em solid black;
-    background-color: var(--color-monster-tooltip-header);
-}
-
-section#list div.monster div.monster_tooltip table.stats tr{
-    line-height: 0.8em;
-}
-
-section#list div.monster div.monster_tooltip table.stats td{
-    border: 0.1em solid #00000055;
-    border-bottom: 0.1em solid black;
-    color: #cccccc;
-    text-align: right;
-    font-family: monospace;
-    font-size: 120%;
-    min-width: 4.5em;
-}
-
-section#list div.monster div.monster_tooltip table.stats td span.percent{
-    margin: 0 0 0 -0.7em;
-    font-size: 80%;
-}
-
-section#list div.monster div.monster_tooltip table.stats td.extra{
-    color: #aaaaff;
-}
-
-section#list div.monster div.monster_tooltip table.stats td.total{
-    color: #f2c920;
-    font-weight: bold;
-    min-width: 4.5em;
-}
-
-section#list div.monster div.monster_tooltip div.skills{
-    text-align: center;
-}
-
-section#list div.monster div.monster_tooltip div.skills div.skill{
-    display: inline-block;
-    vertical-align: top;
-    max-width: 22%;
-    margin: 0.5em;
-    font-size: 70%;
-    color: #ffffff;
-    text-align: center;
-}
-
-section#list div.monster div.monster_tooltip div.skills div.skill img{
-    width: 3em;
-    height: 3em;
-    border: 0.3em solid var(--ui-color-border);
-    border-radius: 0.5em;
-}
-section#list div.monster div.monster_tooltip div.skills div.skill span.skill_level{
-    font-size: 130%;
-    position: relative;
-    bottom: 1.4em;
-    width: 3em;
-    margin: auto;
-    display: block;
-    text-align: right;
-    padding-right: 0.4em;
-    text-shadow: 0 0 0.2em #000000, 0 0 0.2em #000000, 0 0 0.4em #000000, 0 0 0.4em #000000, 0 0 0.6em #000000, 0 0 0.6em #000000, 0 0 0.8em #000000, 0 0 0.8em #000000;
-}
-
-section#list div.monster div.monster_tooltip div.skills div.skill span.skill_level.maxed{
-    color: #f2c920;
-}
-
-section#list div.monster div.monster_tooltip div.skills div.skill span.skill_name{
-    text-shadow: 0 0 0.2em #000000, 0 0 0.2em #000000, 0 0 0.4em #000000;
-    margin-top: -1.8em;
-    display: block;
-}

BIN
public/img/icon/star.png


BIN
public/img/skill/00015101.png


BIN
public/img/skill/00015102.png


BIN
public/img/skill/00015103.png


BIN
public/img/skill/00015104.png


BIN
public/img/skill/00015105.png


BIN
public/img/skill/00015106.png


BIN
public/img/skill/00015107.png


BIN
public/img/skill/00015108.png


BIN
public/img/skill/00015109.png


BIN
public/img/skill/00015110.png


BIN
public/img/skill/00015111.png


BIN
public/img/skill/00015112.png


BIN
public/img/skill/00015113.png


BIN
public/img/skill/00015114.png


BIN
public/img/skill/00015115.png


BIN
public/img/skill/00015201.png


BIN
public/img/skill/00015202.png


BIN
public/img/skill/00015203.png


BIN
public/img/skill/00015204.png


BIN
public/img/skill/00015205.png


BIN
public/img/skill/00015206.png


BIN
public/img/skill/00015207.png


+ 9 - 2
swex-plugin/swdb.js

@@ -1,7 +1,7 @@
 const dateFormat = require('/usr/local/lib/node_modules/dateformat');
 
 var querystring = require('querystring');
-var http = require('http');
+var http = require('https');
 
 module.exports = {
     defaultConfig: {
@@ -101,6 +101,13 @@ module.exports = {
                 success = "Collection succesfully updated!";
                 params['response'] = JSON.stringify(res);
                 break;
+            case 'getUnitStorageList':
+                apiCommand = "profile/";
+                method = "PUT";
+                success = "Sealed Shrine succesfully updated!";
+                params['request'] = JSON.stringify(req);
+                params['response'] = JSON.stringify(res);
+                break;
             // Profile logbook
             case 'GetLobbyWizardLog':
                 apiCommand = "profile/";
@@ -213,7 +220,7 @@ module.exports = {
                         this.log('error', '[HTTP/1.1 500] The server returned an error.');
                         break;
                     default:
-                        this.log('error', `[HTTP/1.1 ${res.statusCode}] Unexpected error.`);
+                        this.log('error', `[HTTP/1.1 ${res.statusCode}] Unexpected error: ${body}`);
                 }
             }).bind(this));
         }).bind(this));