Prechádzať zdrojové kódy

Removed rune upgrade report. Filter code now in ther own pages and views. Links to ptmize eny unit in monster view. Team rating form teams section. No more custom filters, and some filters fixed and others improved. New UI layout, with a fixed sidebar.

Iñigo Valentin 5 rokov pred
rodič
commit
23151e07a9
68 zmenil súbory, kde vykonal 6317 pridanie a 6944 odobranie
  1. 0 119
      application/Constant.php
  2. 5 4
      application/Controller.php
  3. 2 9
      application/action/delete_team.php
  4. 36 0
      application/action/rate_team.php
  5. 2 2
      application/entity/Fusion.php
  6. 0 1
      application/entity/K_Unit.php
  7. 33 26
      application/helper/HTML_Helper.php
  8. 10 1
      application/page/Catalog_Page.php
  9. 71 1
      application/page/Monsters_Page.php
  10. 3 0
      application/page/Optimizer_Page.php
  11. 53 2
      application/page/Report_Runecraft_Page.php
  12. 0 404
      application/page/Report_Runeupgrade_Page.php
  13. 94 10
      application/page/Report_Skillup_Page.php
  14. 65 62
      application/page/Runes_Page.php
  15. 3 0
      application/page/Teams_Page.php
  16. BIN
      application/sw.sqlite
  17. 253 106
      application/view/artifacts.php
  18. 72 50
      application/view/catalog.php
  19. 222 61
      application/view/enchantments.php
  20. 232 272
      application/view/fusion.php
  21. 224 197
      application/view/guild.php
  22. 404 399
      application/view/home.php
  23. 0 204
      application/view/inc/filter_artifacts.php
  24. 0 47
      application/view/inc/filter_catalog.php
  25. 0 161
      application/view/inc/filter_enchantments.php
  26. 0 40
      application/view/inc/filter_fusion.php
  27. 0 71
      application/view/inc/filter_monsters.php
  28. 0 263
      application/view/inc/filter_report_runecraft.php
  29. 0 281
      application/view/inc/filter_report_runeupgrade.php
  30. 0 104
      application/view/inc/filter_report_skillup.php
  31. 0 263
      application/view/inc/filter_runes.php
  32. 0 128
      application/view/inc/filter_runs.php
  33. 0 82
      application/view/inc/filter_stats.php
  34. 0 43
      application/view/inc/filter_teams.php
  35. 0 1
      application/view/inc/header.php
  36. 41 37
      application/view/landing.php
  37. 486 485
      application/view/monster.php
  38. 246 217
      application/view/monster_info.php
  39. 393 306
      application/view/monsters.php
  40. 84 64
      application/view/optimizer.php
  41. 609 602
      application/view/optimizer_unit.php
  42. 104 67
      application/view/profile.php
  43. 38 44
      application/view/report.php
  44. 432 46
      application/view/report_runecraft.php
  45. 0 119
      application/view/report_runeupgrade.php
  46. 231 94
      application/view/report_skillup.php
  47. 365 62
      application/view/runes.php
  48. 286 180
      application/view/runs.php
  49. 323 275
      application/view/stats.php
  50. 144 101
      application/view/teams.php
  51. 37 18
      public/css/artifacts.css
  52. 2 3
      public/css/catalog.css
  53. 80 11
      public/css/enchantments.css
  54. 0 114
      public/css/filters.css
  55. 48 296
      public/css/fusion.css
  56. 4 4
      public/css/guild.css
  57. 7 14
      public/css/home.css
  58. 82 127
      public/css/monster.css
  59. 9 0
      public/css/monster_info.css
  60. 40 18
      public/css/monsters.css
  61. 17 11
      public/css/optimizer.css
  62. 7 0
      public/css/profile.css
  63. 77 52
      public/css/report_runecraft.css
  64. 0 46
      public/css/report_runeupgrade.css
  65. 57 58
      public/css/report_skillup.css
  66. 72 21
      public/css/runes.css
  67. 6 2
      public/css/teams.css
  68. 206 36
      public/css/ui.css

+ 0 - 119
application/Constant.php

@@ -3156,7 +3156,6 @@
             11 => "SSS"
         ];
 
-        
     }
 
     /**
@@ -3166,16 +3165,6 @@
      */
     final class FILTER{
 
-        /**
-         * Default values for the catalog filters.
-         */
-        const CATALOG = [
-            "ELEMENT" => 0,
-            "NAME" => "",
-            "MIN_STARS" => 1,
-            "MAX_STARS" => 5
-        ];
-
         /**
          * Default values for the fusion filters.
          */
@@ -3183,114 +3172,6 @@
             "PRODUCT" => 0
         ];
 
-        /**
-         * Default values for the monster filters.
-         */
-        const MONSTER = [
-            "ELEMENT" => -1,
-            "NAME" => "",
-            "MIN_STARS" => 1,
-            "MAX_STARS" => 6,
-            "IN_STORAGE" => false,
-            "WITHOUT_RUNES" => false
-        ];
-
-        /**
-         * Default values for the rune craft report filters.
-         */
-        const RUNECRAFT = [
-            "MONSTER_NAME" => "",
-            "MONSTER_MIN_STARS" => 5,
-            "MONSTER_MAX_STARS" => 6,
-            "MONSTER_IN_STORAGE" => false,
-            "RUNE_MIN_STARS" => 5,
-            "RUNE_MAX_STARS" => 6,
-            "RUNE_MIN_LEVEL" => 0,
-            "RUNE_MAX_LEVEL" => 15,
-            "RUNE_MIN_QUALITY" => QUALITY_ID::HERO,
-            "RUNE_MAX_QUALITY" => QUALITY_ID::LEGEND,
-            "RUNE_MIN_ORIGINAL_QUALITY" => QUALITY_ID::HERO,
-            "RUNE_MAX_ORIGINAL_QUALITY" => QUALITY_ID::LEGEND,
-            "RUNE_MIN_EFFICIENCY" => 0,
-            "RUNE_MAX_EFFICIENCY" => 100,
-            "RUNE_MIN_MAX_EFFICIENCY" => 0,
-            "RUNE_MAX_MAX_EFFICIENCY" => 100,
-            "RUNE_SLOT" => [],
-            "GRIND" => 1,
-            "GRIND_MIN_QUALITY" => QUALITY_ID::RARE,
-            "GRIND_STAT" => [
-                RUNE_STAT_ID::HP_P,
-                RUNE_STAT_ID::ATK_P,
-                RUNE_STAT_ID::DEF_P,
-                RUNE_STAT_ID::SPD,
-                RUNE_STAT_ID::CRD,
-                RUNE_STAT_ID::CRR,
-                RUNE_STAT_ID::ACC
-            ],
-            "GEM" => 1,
-            "GEM_MIN_QUALITY" => QUALITY_ID::RARE,
-            "GEM_STAT_FROM" => [
-                RUNE_STAT_ID::HP,
-                RUNE_STAT_ID::ATK,
-                RUNE_STAT_ID::DEF,
-                RUNE_STAT_ID::RES
-            ],
-            "GEM_STAT_TO" => [
-                RUNE_STAT_ID::HP_P,
-                RUNE_STAT_ID::ATK_P,
-                RUNE_STAT_ID::DEF_P,
-                RUNE_STAT_ID::SPD,
-                RUNE_STAT_ID::CRD,
-                RUNE_STAT_ID::CRR,
-                RUNE_STAT_ID::ACC
-            ]
-        ];
-
-        /**
-         * Default values for the rune upgrade report filters.
-         */
-        const RUNEUPGRADE = [
-            "MONSTER_MIN_STARS" => 5,
-            "MONSTER_MAX_STARS" => 6,
-            "MONSTER_NAME" => "",
-            "MONSTER_IN_STORAGE" => false,
-            "MONSTER_TEAMS" => false,
-            "RUNE_MIN_STARS" => 5,
-            "RUNE_MAX_STARS" => 6,
-            "RUNE_MIN_LEVEL" => 0,
-            "RUNE_MAX_LEVEL" => 15,
-            "RUNE_MIN_QUALITY" => QUALITY_ID::NORMAL,
-            "RUNE_MAX_QUALITY" => QUALITY_ID::LEGEND,
-            "RUNE_MIN_ORIGINAL_QUALITY" => QUALITY_ID::NORMAL,
-            "RUNE_MAX_ORIGINAL_QUALITY" => QUALITY_ID::LEGEND,
-            "RUNE_MIN_EFFICIENCY" => 0,
-            "RUNE_MAX_EFFICIENCY" => 100,
-            "RUNE_MIN_MAX_EFFICIENCY" => 0,
-            "RUNE_MAX_MAX_EFFICIENCY" => 100,
-            "RUNE_SLOT" => [],
-            "ALTERNATIVE_MIN_STARS" => 5,
-            "ALTERNATIVE_MIN_ORIGINAL_QUALITY" => 0,
-            "ALTERNATIVE_MIN_LEVEL" => 0,
-            "ALTERNATIVE_CONDITION" => 3,
-            "ALTERNATIVE_SOURCE" => 0
-        ];
-
-        /**
-         * Default values for the skill-up report filters.
-         */
-        const SKILLUP = [
-            "MIN_STARS" => 5,
-            "MAX_STARS" => 6,
-            "MIN_NATURAL_STARS" => 5,
-            "MAX_NATURAL_STARS" => 5,
-            "IN_STORAGE" => false,
-            "WITHOUT_RUNES" => false,
-            "FAMILY" => false,
-            "MAXED" => false,
-            "2A" => false,
-            "HOMUNCULUS" => false
-        ];
-
         /**
          * Default values for the rune filters.
          */

+ 5 - 4
application/Controller.php

@@ -115,6 +115,11 @@
                         action();
                         return;
                         break;
+                    case "RATE_TEAM":
+                        require_once(PATH::ACTION . "rate_team.php");
+                        action();
+                        return;
+                        break;
                     case "SAVE_RUN_TEAM":
                         require_once(PATH::ACTION . "save_run_team.php");
                         action();
@@ -268,10 +273,6 @@
                         require_once(PATH::PAGE . "Report_Skillup_Page.php");
                         $page = new Report_Skillup_Page($pars[1]);
                     }
-                    elseif (strtoupper($pars[1]) == "RUNEUPGRADE"){
-                        require_once(PATH::PAGE . "Report_Runeupgrade_Page.php");
-                        $page = new Report_Runeupgrade_Page($pars[1]);
-                    }
                     elseif (strtoupper($pars[1]) == "RUNECRAFT"){
                         require_once(PATH::PAGE . "Report_Runecraft_Page.php");
                         $page = new Report_Runecraft_Page($pars[1]);

+ 2 - 9
application/action/delete_team.php

@@ -9,18 +9,11 @@
      */
 
     /**
-     * Logs the user out and redirects to the login page.
+     * Deletes a team.
      *
      * Reads the POST parameters looking for the following KEYS:
      *  uid
-     *  area_type
-     *  area
-     *  stage
-     *  difficulty
-     *  ids
-     *  name
-     *  description
-     * Validates the data and creates the team in the database.
+     *  id
      * 
      * @return int 0 on success, negative values on error.
      * @category Action

+ 36 - 0
application/action/rate_team.php

@@ -0,0 +1,36 @@
+<?php
+
+    /**
+     * File for the team score modification.
+     *
+     * Implements an action function to be called from the {@see Controller}.
+     * 
+     * @category Action
+     */
+
+    /**
+     * Sets the score for a team.
+     *
+     * Reads the POST parameters looking for the following KEYS:
+     *  uid
+     *  team
+     *  score
+     * Validates the data and sets the score.
+     * 
+     * @return int 0 on success, negative values on error.
+     * @category Action
+     * @global resource Database connection.
+     */
+    function action(){
+        global $db;
+        $player = filter_input(INPUT_GET, 'uid');
+        $team = filter_input(INPUT_GET, 'team');
+        $score = intval(filter_input(INPUT_GET, 'score'));
+        $statement = $db->prepare('UPDATE team SET score = :score WHERE uid = :uid AND id = :team;');
+        $statement->bindValue(':score', $score);
+        $statement->bindValue(':uid', $player);
+        $statement->bindValue(':team', $team);
+        $res = $statement->execute();
+        return 0;
+    }
+?>

+ 2 - 2
application/entity/Fusion.php

@@ -17,7 +17,7 @@
     /**
      * Extension of K_Unit that also stores information about owned
      * monsters.
-     * 
+     *
      * @category Entity
      */
     class Monster_Fusion extends K_Unit{
@@ -39,7 +39,7 @@
          */
         public function __construct($id, $uid){
             global $db;
-            parent::__construct($id, false);
+            parent::__construct($id, true);
             $s = "
               SELECT unit.id AS id
               FROM

+ 0 - 1
application/entity/K_Unit.php

@@ -398,7 +398,6 @@
               "WHERE " .
               "  unit = " . $this->id . " " .
               "ORDER BY item; ";
-            error_log($s);
             $q = $db->query($s);
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 $e = [

+ 33 - 26
application/helper/HTML_Helper.php

@@ -227,17 +227,21 @@
             $html .= "<td class='stat'>\n";
             if (in_array($rune->main_stat_name, array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){
                 $stat_name = str_replace("%", "", $rune->main_stat_name);
-                $stat_value = "+ " . $rune->main_stat_value . "%";
+                $stat_value = "+" . $rune->main_stat_value . "%";
             }
             else{
                 $stat_name = $rune->main_stat_name;
-                $stat_value = "+ " . $rune->main_stat_value. "&nbsp;";
+                $stat_value = "+" . $rune->main_stat_value. "&nbsp;";
             }
             $html .= $stat_name . "\n";
             $html .= "</td>\n";
             $html .= "<td class='value'>\n";
             $html .= $stat_value . "\n";
-            $html .= "<td>\n";
+            $html .= "</td>\n";
+            $html .= "<td class='grind'>\n";
+            $html .= "</td>\n";
+            $html .= "<td class='enchant'>\n";
+            $html .= "</td>\n";
             $html .= "</tr>\n";
             // Innate stat
             $html .= "<tr class='innate_stat'>\n";
@@ -248,17 +252,19 @@
             }
             elseif (in_array($rune->innate_stat_name, array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){
                 $stat_name = str_replace("%", "", $rune->innate_stat_name);
-                $stat_value = "+ " . $rune->innate_stat_value . "%";
+                $stat_value = "+" . $rune->innate_stat_value . "%";
             }
             else{
                 $stat_name = $rune->innate_stat_name;
-                $stat_value = "+ " . $rune->innate_stat_value. "&nbsp;";;
+                $stat_value = "+" . $rune->innate_stat_value. "&nbsp;";;
             }
             $html .= $stat_name . "\n";
             $html .= "</td>\n";
             $html .= "<td class='value'>\n";
             $html .= $stat_value . "\n";
-            $html .= "<td>\n";
+            $html .= "</td>\n";
+            $html .= "<td class='grind'>\n";
+            $html .= "</td>\n";
             $html .= "</tr>\n";
             $substats = array($rune->substat_1, $rune->substat_2, $rune->substat_3, $rune->substat_4);
             $substats_name = array($rune->substat_1_name, $rune->substat_2_name, $rune->substat_3_name, $rune->substat_4_name);
@@ -272,11 +278,11 @@
                 }
                 elseif (in_array($substats_name[$i], array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){
                     $stat_name = str_replace("%", "", $substats_name[$i]);
-                    $stat_value = "+ " . $substats_value[$i] . "%";
+                    $stat_value = "+" . $substats_value[$i] . "%";
                 }
                 else{
                     $stat_name = $substats_name[$i];
-                    $stat_value = "+ " . $substats_value[$i]. "&nbsp;";
+                    $stat_value = "+" . $substats_value[$i]. "&nbsp;";
                 }
                 $grind = "";
                 if ($substats_grind[$i] > 0){
@@ -291,9 +297,8 @@
                 $html .= "</td>\n";
                 $html .= "<td class='value'>\n";
                 $html .= $stat_value . "\n";
-                $html .= "<span class='grind grind_$grind'>\n";
+                $html .= "<td class='grind grind_$grind'>\n";
                 $html .= $grind . "\n";
-                $html .= "</span>\n";
                 if ($substats_enchant[$i] == 1){
                     $html .= "<img title='Enchanted' src='" . URL::IMG["RUNE"] . "enchanted.png'/>\n";
                 }
@@ -307,7 +312,7 @@
             $html .= "<table class='table_details'>\n";
             $html .= "<tr>\n";
             $html .= "<td class='title'>\n";
-            $html .= "Quality:\n";
+            $html .= "QY.:\n";
             $html .= "</td>\n";
             $html .= "<td class='value'>\n";
             $html .= "<span class='quality quality_" . strtolower($rune->quality_name) . "'>\n";
@@ -317,7 +322,7 @@
             $html .= "</tr>\n";
             $html .= "<tr>\n";
             $html .= "<td class='title'>\n";
-            $html .= "Original q.:\n";
+            $html .= "O.QY.:\n";
             $html .= "</td>\n";
             $html .= "<td class='value'>\n";
             $html .= "<span class='quality quality_" . strtolower($rune->original_quality_name) . "'>\n";
@@ -335,7 +340,7 @@
             $html .= "</tr>\n";
             $html .= "<tr>\n";
             $html .= "<td class='title'>\n";
-            $html .= "Efficiency:\n";
+            $html .= "EFF.:\n";
             $html .= "</td>\n";
             $html .= "<td class='value'>\n";
             $html .= number_format($rune->efficiency, 2, ".", ",") . "%\n";
@@ -343,20 +348,12 @@
             $html .= "</tr>\n";
             $html .= "<tr>\n";
             $html .= "<td class='title'>\n";
-            $html .= "Max. eff.:\n";
+            $html .= "MX.E.:\n";
             $html .= "</td>\n";
             $html .= "<td class='value'>\n";
             $html .= number_format($rune->max_efficiency, 2, ".", ",") . "%\n";
             $html .= "</td>\n";
             $html .= "</tr>\n";
-            $html .= "<tr>\n";
-            $html .= "<td class='title'>\n";
-            $html .= "Reached. eff.:\n";
-            $html .= "</td>\n";
-            $html .= "<td class='value'>\n";
-            $html .= number_format($rune->efficiency * 100 / $rune->max_efficiency, 2, ".", ",") . "%\n";
-            $html .= "</td>\n";
-            $html .= "</tr>\n";
             $html .= "</table>\n";
             $html .= "</td>\n";
             $html .= "</tr>\n";
@@ -462,7 +459,7 @@
             $html .= "<tr class='effect main_stat'>\n";
             $html .= "<td class='effect'>\n";
             $stat_name = $artifact->main_stat_name;
-            $stat_value = "+ " . $artifact->main_stat_value;
+            $stat_value = "+" . $artifact->main_stat_value;
             $html .= $stat_name . "\n";
             $html .= $stat_value . "\n";
             $html .= "</td>\n";
@@ -471,7 +468,17 @@
             for ($i = 0; $i < 4; $i ++){
                 $html .= "<tr class='effect'>\n";
                 $html .= "<td class='effect'>\n";
-                $html .= $effects[$i];
+                $name = $effects[$i];
+                $name = str_replace("Increasing", "Inc.", $name);
+                $name = str_replace("Decrease", "Dec.", $name);
+                $name = str_replace("Critical", "Crit.", $name);
+                $name = str_replace("Received ", "", $name);
+                $name = str_replace("Damage", "Dmg.", $name);
+                $name = str_replace("Additional", "Addl.", $name);
+                $name = str_replace("Proportional", "Rel.", $name);
+                $name = str_replace("Counterattack", "Counter", $name);
+                $name = str_replace("Dealt by Attacking Together", "Attacking Together", $name);
+                $html .= $name;
                 $html .= "</td>\n";
                 $html .= "</tr>\n";
             }
@@ -584,11 +591,11 @@
             }
             if (in_array($craft->stat_name, array("CRR", "CRD", "RES", "ACC", "HP%", "ATK%", "DEF%"))){
                 $stat_name = str_replace("%", "", $craft->stat_name);
-                $stat_value = "+ " . $craft->min . "~" . $craft->max . "%";
+                $stat_value = "+" . $craft->min . "~" . $craft->max . "%";
             }
             else{
                 $stat_name = $craft->stat_name;
-                $stat_value = "+ " . $craft->min . "~" . $craft->max;
+                $stat_value = "+" . $craft->min . "~" . $craft->max;
             }
             $html .= "<div class='craft_panel craft_quality_" . strtolower($craft->quality_name) . " rune_ancient_" . $craft->ancient . "'>\n";
             $html .= "<img class='craft_base' src='" . $base . "'/>\n";

+ 10 - 1
application/page/Catalog_Page.php

@@ -26,6 +26,16 @@
          */
         public $units = [];
 
+        /**
+         * @var mixed[] Default filter values.
+         */
+        public $filters = [
+            "ELEMENT" => -1,
+            "NAME" => "",
+            "MIN_STARS" => 1,
+            "MAX_STARS" => 6,
+        ];
+
         /**
          * Constructor.
          *
@@ -52,7 +62,6 @@
          * and adds them to the $filters array.
          */
         private function parse_filters(){
-            $this->filters = FILTER::CATALOG;
             if (isset($_GET["element"]) && APPLICATION::valid_id("ELEMENT_ID", strtoupper($_GET["element"]))){
                 $this->filters["ELEMENT"] = $_GET["element"];
             }

+ 71 - 1
application/page/Monsters_Page.php

@@ -12,6 +12,7 @@
      */
     require_once(PATH::PAGE . "Page.php");
     require_once(PATH::ENTITY . "Unit.php");
+    require_once(PATH::ENTITY . "K_Effect.php");
 
     /**
      * Monster list page model.
@@ -25,6 +26,25 @@
          */
         public $monsters = [];
 
+        /**
+         * @var mixed[] Default filter values.
+         */
+        public $filters = [
+            "ELEMENT" => -1,
+            "NAME" => "",
+            "MIN_STARS" => 1,
+            "MAX_STARS" => 6,
+            "IN_STORAGE" => false,
+            "WITHOUT_RUNES" => false,
+            "EFFECT" => [],
+            "EFFECT_OPTION" => "any"
+        ];
+
+        /**
+         * @var K_Effect[] All availabe skill effects, for the tfilter selector.
+         */
+        public $effects = [];
+
         /**
          * Constructor.
          *
@@ -41,6 +61,12 @@
             while ($r_mon = $q_mon->fetchArray(SQLITE3_ASSOC)){
                 array_push($this->monsters, new Unit($r_mon["id"]));
             }
+            // Get skill effects
+            $s_eff = "SELECT id FROM k_effect ORDER BY is_buff DESC";
+            $q_eff = $db->query($s_eff);
+            while ($r_eff = $q_eff->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->effects, new K_Effect($r_eff["id"]));
+            }
             $this->title = "Monsters - SWDB";
             $this->description = "Owned monsters";
             $this->canonical = URL::BASE . "monsters/";
@@ -51,7 +77,6 @@
          * and adds them to the $filters array.
          */
         private function parse_filters(){
-            $this->filters = FILTER::MONSTER;
             if (isset($_GET["element"]) && APPLICATION::valid_id("ELEMENT_ID", strtoupper($_GET["element"]))){
                 $this->filters["ELEMENT"] = $_GET["element"];
             }
@@ -73,6 +98,17 @@
             if (isset($_GET["without_runes"]) && $_GET["without_runes"] == "on"){
                 $this->filters["WITHOUT_RUNES"] = true;
             }
+            if (isset($_GET["effect"])){
+                $effects = $_GET["effect"];
+                foreach ($effects as $effect){
+                    if (intval($effect) > 0){
+                        array_push($this->filters["EFFECT"], intval($effect));
+                    }
+                }
+            }
+            if (isset($_GET["effect_option"]) && ($_GET["effect_option"] == "and" || $_GET["effect_option"] == "or")){
+                $this->filters["EFFECT_OPTION"] = $_GET["effect_option"];
+            }
             return;
         }
 
@@ -109,6 +145,40 @@
             if (!$this->filters["WITHOUT_RUNES"]){
                 $s = $s . " AND unit.id IN (SELECT DISTINCT assigned_to FROM rune) ";
             }
+            if (sizeof($this->filters["EFFECT"]) > 0){
+                if ($this->filters["EFFECT_OPTION"] == "and"){
+                    foreach ($this->filters["EFFECT"] as $effect){
+                        $s .= "
+                        AND k_unit.id IN (
+                          SELECT DISTINCT unit
+                          FROM
+                            k_unit_skill,
+                            k_skill_effect
+                          WHERE
+                            k_unit_skill.skill = k_skill_effect.skill AND
+                            k_skill_effect.effect = $effect
+                        )
+                        ";
+                    }
+                }
+                elseif ($this->filters["EFFECT_OPTION"] == "or"){
+                    $s .= " AND ( ";
+                    foreach ($this->filters["EFFECT"] as $effect){
+                        $s .= "
+                        k_unit.id IN (
+                          SELECT DISTINCT unit
+                          FROM
+                            k_unit_skill,
+                            k_skill_effect
+                          WHERE
+                            k_unit_skill.skill = k_skill_effect.skill AND
+                            k_skill_effect.effect = $effect
+                        ) OR
+                        ";
+                    }
+                    $s .= " 1 = 2 ) ";
+                }
+            }
             $s = $s . "
                 ORDER BY 
                   stars DESC,

+ 3 - 0
application/page/Optimizer_Page.php

@@ -64,6 +64,9 @@
               SELECT id
               FROM team
               WHERE uid = '$UID'
+              ORDER BY
+                area_type,
+                area
             ";
             return $s;
         }

+ 53 - 2
application/page/Report_Runecraft_Page.php

@@ -40,6 +40,57 @@
          */
         public $upgrades = [];
 
+        /**
+         * @var mixed[] Default filter values.
+         */
+        public $filters = [
+            "MONSTER_NAME" => "",
+            "MONSTER_MIN_STARS" => 5,
+            "MONSTER_MAX_STARS" => 6,
+            "MONSTER_IN_STORAGE" => false,
+            "RUNE_MIN_STARS" => 5,
+            "RUNE_MAX_STARS" => 6,
+            "RUNE_MIN_LEVEL" => 0,
+            "RUNE_MAX_LEVEL" => 15,
+            "RUNE_MIN_QUALITY" => QUALITY_ID::HERO,
+            "RUNE_MAX_QUALITY" => QUALITY_ID::LEGEND,
+            "RUNE_MIN_ORIGINAL_QUALITY" => QUALITY_ID::HERO,
+            "RUNE_MAX_ORIGINAL_QUALITY" => QUALITY_ID::LEGEND,
+            "RUNE_MIN_EFFICIENCY" => 0,
+            "RUNE_MAX_EFFICIENCY" => 100,
+            "RUNE_MIN_MAX_EFFICIENCY" => 0,
+            "RUNE_MAX_MAX_EFFICIENCY" => 100,
+            "RUNE_SLOT" => [],
+            "GRIND" => 1,
+            "GRIND_MIN_QUALITY" => QUALITY_ID::RARE,
+            "GRIND_STAT" => [
+                RUNE_STAT_ID::HP_P,
+                RUNE_STAT_ID::ATK_P,
+                RUNE_STAT_ID::DEF_P,
+                RUNE_STAT_ID::SPD,
+                RUNE_STAT_ID::CRD,
+                RUNE_STAT_ID::CRR,
+                RUNE_STAT_ID::ACC
+            ],
+            "GEM" => 1,
+            "GEM_MIN_QUALITY" => QUALITY_ID::RARE,
+            "GEM_STAT_FROM" => [
+                RUNE_STAT_ID::HP,
+                RUNE_STAT_ID::ATK,
+                RUNE_STAT_ID::DEF,
+                RUNE_STAT_ID::RES
+            ],
+            "GEM_STAT_TO" => [
+                RUNE_STAT_ID::HP_P,
+                RUNE_STAT_ID::ATK_P,
+                RUNE_STAT_ID::DEF_P,
+                RUNE_STAT_ID::SPD,
+                RUNE_STAT_ID::CRD,
+                RUNE_STAT_ID::CRR,
+                RUNE_STAT_ID::ACC
+            ]
+        ];
+
         /**
          * Constructor.
          *
@@ -103,7 +154,7 @@
          * min_stars (1-6) and in_storage (on/off).
          */
         private function parse_filters(){
-            $this->filters = FILTER::RUNECRAFT;
+            //$this->filters = FILTER::RUNECRAFT;
             // Monster
             if (isset($_GET["monster_min_stars"]) && intval($_GET["monster_min_stars"]) > 0 && intval($_GET["monster_min_stars"]) < 7){
                 $this->filters["MONSTER_MIN_STARS"] = $_GET["monster_min_stars"];
@@ -241,7 +292,7 @@
                   k_rune_craft_type.ancient = rune.ancient AND
                 ";
             if (strlen($this->filters["MONSTER_NAME"]) > 0){
-                $s = $s . " upper(k_unit.name) LIKE = upper('%" . $this->filters["MONSTER_NAME"] . "%') AND ";
+                $s = $s . " upper(k_unit.name) LIKE upper('%" . $this->filters["MONSTER_NAME"] . "%') AND ";
             }
             if (!$this->filters["MONSTER_IN_STORAGE"]){
                 $s = $s . " unit.building <> " . BUILDING_ID::MONSTER_STORAGE . " AND ";

+ 0 - 404
application/page/Report_Runeupgrade_Page.php

@@ -1,404 +0,0 @@
- <?php
-    /**
-     * Upgradeable runes report page model.
-     *
-     * Provides a class with all the properties and methods to display the page.
-     *
-     * @category Page
-     */
-
-    /**
-     * Require dependent files if not present.
-     */
-    require_once(PATH::PAGE . "Page.php");
-    require_once(PATH::ENTITY . "Custom_Filter.php");
-    require_once(PATH::ENTITY . "Unit.php");
-    require_once(PATH::ENTITY . "Rune.php");
-
-    /**
-     * Upgradeable runes report page model.
-     *
-     * @category Page
-     */
-    class Report_Runeupgrade_Page extends Page{
-
-        /**
-         * @var \Filter[] Custom filters for this page.
-         */
-        public $custom_filters = [];
-
-        /**
-         * @var mixed[] List of available upgrades.
-         *
-         * Can be described as:
-         * $upgrades = [
-         *   [
-         *     unit (Unit),
-         *     upgrade = [
-         *       [
-         *         rune (Rune),
-         *         alternative = [(Rune)]
-         *       ]
-         *     ]
-         *   ]
-         * ]
-         */
-        public $upgrades = [];
-
-        /**
-         * Constructor.
-         *
-         * Retrieves the data and initializes the variables.
-         *
-         * @global int Player ID.
-         * @global resource Database connection.
-         */
-        public function __construct(){
-            global $UID;
-            global $db;
-            $this->view = PATH::VIEW . "report_runeupgrade.php";
-            $this->parse_filters();
-            if (!isset($_GET["custom_filter"])){
-                $s = $this->build_query();
-            }
-            else{
-                $s = $this->build_custom_query($_GET["custom_filter"]);
-            }
-            $q = $db->query($s);
-            $prev_monster = "";
-            $prev_rune = "";
-            $upgrade = null;
-            $rupgrade = null;
-            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
-                if ($r["unit"] != $prev_monster){
-                    if ($prev_rune != ""){
-                        array_push($upgrade["upgrade"], $rupgrade);
-                    }
-                    if ($prev_monster != ""){
-                        array_push($this->upgrades, $upgrade);
-                    }
-                    $prev_monster = $r["unit"];
-                    $prev_rune = "";
-                    $upgrade = [
-                        "unit" => new Unit($r["unit"]),
-                        "upgrade" => [],
-                    ];
-                    $rupgrade = [
-                        "rune" => new Rune($r["id"]),
-                        "alternative" => [],
-                    ];
-                }
-                if ($r["id"] != $prev_rune){
-                    if ($prev_rune != ""){
-                        array_push($upgrade["upgrade"], $rupgrade);
-                    }
-                    $prev_rune = $r["id"];
-                    $rupgrade = [
-                        "rune" => new Rune($r["id"]),
-                        "alternative" => [],
-                    ];
-                }
-                $rune_alt = new Rune($r["alternative"]);
-                // If the alternative rune isassigned
-                if (strlen($rune_alt->assigned_to) > 0){
-                    $rune_alt->assigned_to = new Unit($rune_alt->assigned_to);
-                }
-                array_push($rupgrade["alternative"], $rune_alt);
-            }
-            // Last entries
-            array_push($upgrade["upgrade"], $rupgrade);
-            array_push($this->upgrades, $upgrade);
-
-            // Get custom filters for the form
-            $s = "
-              SELECT id
-              FROM filter
-              WHERE
-                uid = '$UID' AND
-                page = 'REPORT_RUNEUPGRADE';
-            ";
-            $q = $db->query($s);
-            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
-                array_push($this->custom_filters, new Custom_Filter($r["id"]));
-            }
-            $this->title = "Replaceable runes - SWDB";
-            $this->description = "Find equiped runes that can be substituted for better ones.";
-            $this->canonical = URL::BASE . "report/runeupgrade/";
-        }
-
-        /**
-         * Parses the filters passed in the request and sets $filters.
-         * Filters must be in $_GET, nd the available ones are max_stars (1-6),
-         * min_stars (1-6) and in_storage (on/off).
-         */
-        private function parse_filters(){
-            $this->filters = FILTER::RUNEUPGRADE;
-            // Monster
-            if (isset($_GET["monster_min_stars"]) && intval($_GET["monster_min_stars"]) > 0 && intval($_GET["monster_min_stars"]) < 7){
-                $this->filters["MONSTER_MIN_STARS"] = $_GET["monster_min_stars"];
-            }
-            if (isset($_GET["monster_max_stars"]) && intval($_GET["monster_max_stars"]) > 0 && intval($_GET["monster_max_stars"]) < 7){
-                $this->filters["MONSTER_MAX_STARS"] = $_GET["monster_max_stars"];
-            }
-            if (isset($_GET["monster_in_storage"]) && $_GET["monster_in_storage"] == "on"){
-                $this->filters["MONSTER_IN_STORAGE"] = true;
-            }
-            else{
-                $this->filters["MONSTER_IN_STORAGE"] = false;
-            }
-            if (isset($_GET["monster_teams"]) && $_GET["monster_teams"] == "on"){
-                $this->filters["MONSTER_TEAMS"] = true;
-            }
-            else{
-                $this->filters["MONSTER_TEAMS"] = false;
-            }
-            if (isset($_GET["monster_name"]) && strlen($_GET["monster_name"]) > 0){
-                $this->filters["MONSTER_NAME"] = SQLite3::escapeString($_GET["monster_name"]);
-            }
-            // Runes
-            if (isset($_GET["rune_min_stars"]) && intval($_GET["rune_min_stars"]) > 0 && intval($_GET["rune_min_stars"]) < 7){
-                $this->filters["RUNE_MIN_STARS"] = $_GET["rune_min_stars"];
-            }
-            if (isset($_GET["rune_max_stars"]) && intval($_GET["rune_max_stars"]) > 0 && intval($_GET["rune_max_stars"]) < 7){
-                $this->filters["RUNE_MAX_STARS"] = $_GET["rune_max_stars"];
-            }
-            if (isset($_GET["rune_min_level"]) && intval($_GET["rune_min_level"]) >= 0 && intval($_GET["rune_min_level"]) <= 15){
-                $this->filters["RUNE_MIN_LEVEL"] = $_GET["rune_min_level"];
-            }
-            if (isset($_GET["rune_max_level"]) && intval($_GET["rune_max_level"]) >= 0 && intval($_GET["rune_max_level"]) <= 15){
-                $this->filters["RUNE_MAX_LEVEL"] = $_GET["rune_max_level"];
-            }
-            if (isset($_GET["rune_min_quality"]) && intval($_GET["rune_min_quality"]) >= QUALITY_ID::NORMAL && intval($_GET["rune_min_quality"]) <= QUALITY_ID::LEGEND){
-                $this->filters["RUNE_MIN_QUALITY"] = $_GET["rune_min_quality"];
-            }
-            if (isset($_GET["rune_max_quality"]) && intval($_GET["rune_max_quality"]) >= QUALITY_ID::NORMAL && intval($_GET["rune_max_quality"]) <= QUALITY_ID::LEGEND){
-                $this->filters["RUNE_MAX_QUALITY"] = $_GET["rune_max_quality"];
-            }
-            if (isset($_GET["rune_min_original_quality"]) && intval($_GET["rune_min_original_quality"]) >= QUALITY_ID::NORMAL && intval($_GET["rune_min_original_quality"]) <= QUALITY_ID::LEGEND){
-                $this->filters["RUNE_MIN_ORIGINAL_QUALITY"] = $_GET["rune_min_original_quality"];
-            }
-            if (isset($_GET["rune_max_original_quality"]) && intval($_GET["rune_max_original_quality"]) >= QUALITY_ID::NORMAL && intval($_GET["rune_max_original_quality"]) <= QUALITY_ID::LEGEND){
-                $this->filters["RUNE_MAX_ORIGINAL_QUALITY"] = $_GET["rune_max_original_quality"];
-            }
-            if (isset($_GET["rune_min_efficiency"]) && intval($_GET["rune_min_efficiency"]) >= 0 && intval($_GET["rune_min_efficiency"]) <= 100){
-                $this->filters["RUNE_MIN_EFFICIENCY"] = $_GET["rune_min_efficiency"];
-            }
-            if (isset($_GET["rune_max_efficiency"]) && intval($_GET["rune_max_efficiency"]) >= 0 && intval($_GET["rune_max_efficiency"]) <= 100){
-                $this->filters["RUNE_MAX_EFFICIENCY"] = $_GET["rune_max_efficiency"];
-            }
-            if (isset($_GET["rune_min_max_efficiency"]) && intval($_GET["rune_min_max_efficiency"]) >= 0 && intval($_GET["rune_min_max_efficiency"]) <= 100){
-                $this->filters["RUNE_MIN_MAX_EFFICIENCY"] = $_GET["rune_min_max_efficiency"];
-            }
-            if (isset($_GET["rune_max_max_efficiency"]) && intval($_GET["rune_max_max_efficiency"]) >= 0 && intval($_GET["rune_max_max_efficiency"]) <= 100){
-                $this->filters["RUNE_MAX_MAX_EFFICIENCY"] = $_GET["rune_max_max_efficiency"];
-            }
-            if (isset($_GET["rune_slot"])){
-                $slots = $_GET["rune_slot"];
-                foreach ($slots as $slot){
-                    if (intval($slot) >= 1 && intval($slot) < 7){
-                        array_push($this->filters["RUNE_SLOT"], intval($slot));
-                    }
-                }
-            }
-            // Alternatives
-            if (isset($_GET["alternative_min_stars"]) && intval($_GET["alternative_min_stars"]) > 0 && intval($_GET["alternative_min_stars"]) < 7){
-                $this->filters["ALTERNATIVE_MIN_STARS"] = $_GET["alternative_min_stars"];
-            }
-            if (isset($_GET["alternative_min_level"]) && intval($_GET["alternative_min_level"]) >= 0 && intval($_GET["alternative_min_level"]) <= 15){
-                $this->filters["ALTERNATIVE_MIN_LEVEL"] = $_GET["alternative_min_level"];
-            }
-            if (isset($_GET["alternative_min_original_quality"]) && intval($_GET["alternative_min_original_quality"]) >= QUALITY_ID::NORMAL && intval($_GET["alternative_min_original_quality"]) <= QUALITY_ID::LEGEND){
-                $this->filters["ALTERNATIVE_MIN_ORIGINAL_QUALITY"] = $_GET["alternative_min_original_quality"];
-            }
-            if (isset($_GET["alternative_condition"]) && intval($_GET["alternative_condition"]) >= 0 && intval($_GET["alternative_condition"]) <= QUALITY_ID::LEGEND){
-                $this->filters["ALTERNATIVE_CONDITION"] = $_GET["alternative_condition"];
-            }
-            if (isset($_GET["alternative_source"]) && intval($_GET["alternative_source"]) >= 0 && intval($_GET["alternative_source"]) <= 2){
-                $this->filters["ALTERNATIVE_SOURCE"] = $_GET["alternative_source"];
-            }
-            return;
-        }
-
-        /**
-         * Builds the query to the rune table using the a custom filter.
-         * 
-         * @param int $filter Custom filter ID.
-         * @return string The query to be executed.
-         * @global int Player ID.
-         * @global resource Database connection.
-         */
-        private function build_custom_query($filter){
-            global $UID;
-            global $db;
-            $s = "
-              SELECT condition
-              FROM filter
-              WHERE
-                uid = '$UID' AND
-                id = $filter;
-            ";
-            $q = $db->query($s);
-            $r = $q->fetchArray(SQLITE3_ASSOC);
-            $cond = $r["condition"];
-            $s = "
-              SELECT
-                unit.id AS unit,
-                rune.id AS id,
-                rune_alt.id AS alternative
-              FROM
-                rune,
-                rune rune_alt,
-                unit,
-                k_unit
-              WHERE
-                unit.uid = '$UID' AND
-                rune.uid = '$UID' AND
-                rune_alt.uid = '$UID' AND
-                unit.id = rune.assigned_to AND
-                unit.unit = k_unit.id AND
-                rune.type = rune_alt.type AND 
-                rune.slot = rune_alt.slot AND 
-                rune.main_stat = rune_alt.main_stat AND 
-                rune.id <> rune_alt.id AND
-                (
-                  $cond
-                )
-              ORDER BY
-                (SELECT COUNT(DISTINCT(area_type || area)) FROM team, team_unit WHERE team.id = team_unit.team AND team_unit.unit = unit.id AND team.uid = '$UID') DESC,
-                unit.stars DESC,
-                unit.level DESC,
-                unit.id,
-                rune.slot,
-                id,
-                rune_alt.stars DESC,
-                rune_alt.original_quality DESC,
-                rune_alt.main_stat_value DESC;
-            ";
-            return $s;
-        }
-
-        /**
-         * Builds the query for the page, using the providded or default filters.
-         *
-         * @return string The query to be executed.
-         * @global int Player ID.
-         */
-        private function build_query(){
-            global $UID;
-            $s = "
-              SELECT
-                unit.id AS unit,
-                rune.id AS id,
-                rune_alt.id AS alternative
-              FROM
-                rune,
-                rune rune_alt,
-                unit,
-                k_unit
-              WHERE
-                unit.uid = '$UID' AND
-                rune.uid = '$UID' AND
-                rune_alt.uid = '$UID' AND
-                unit.id = rune.assigned_to AND
-                unit.unit = k_unit.id AND
-                unit.stars >= " . $this->filters["MONSTER_MIN_STARS"] . " AND
-                unit.stars <= " . $this->filters["MONSTER_MAX_STARS"] . " AND
-                rune.stars >= " . $this->filters["RUNE_MIN_STARS"] . " AND 
-                rune.stars <= " . $this->filters["RUNE_MAX_STARS"] . " AND 
-                rune.level >= " . $this->filters["RUNE_MIN_LEVEL"] . " AND 
-                rune.level <= " . $this->filters["RUNE_MAX_LEVEL"] . " AND 
-                rune.quality >= " . $this->filters["RUNE_MIN_QUALITY"] . " AND 
-                rune.quality <= " . $this->filters["RUNE_MAX_QUALITY"] . " AND 
-                rune.original_quality >= " . $this->filters["RUNE_MIN_ORIGINAL_QUALITY"] . " AND 
-                rune.original_quality <= " . $this->filters["RUNE_MAX_ORIGINAL_QUALITY"] . " AND 
-                rune.efficiency >= " . $this->filters["RUNE_MIN_EFFICIENCY"] . " AND 
-                rune.efficiency <= " . $this->filters["RUNE_MAX_EFFICIENCY"] . " AND 
-                rune.max_efficiency >= " . $this->filters["RUNE_MIN_MAX_EFFICIENCY"] . " AND 
-                rune.max_efficiency <= " . $this->filters["RUNE_MAX_MAX_EFFICIENCY"] . " AND 
-                rune.type = rune_alt.type AND 
-                rune.slot = rune_alt.slot AND 
-                rune.main_stat = rune_alt.main_stat AND 
-                rune.id <> rune_alt.id AND
-                rune_alt.stars >= " . $this->filters["ALTERNATIVE_MIN_STARS"] . " AND 
-                rune_alt.level >= " . $this->filters["ALTERNATIVE_MIN_LEVEL"] . " AND 
-                rune_alt.original_quality >= " . $this->filters["ALTERNATIVE_MIN_ORIGINAL_QUALITY"] . " AND
-            ";
-            switch ($this->filters["ALTERNATIVE_SOURCE"]){
-                case 0: // Unassigned
-                    $s = $s . " rune_alt.assigned_to IS NULL AND ";
-                    break;
-                case 1: // Unassigned or assigned to lower star monsters
-                    $s = $s . "
-                      (
-                        rune_alt.assigned_to IS NULL OR
-                        rune_alt.assigned_to IN (SELECT id FROM unit m WHERE m.stars < unit.stars)
-                      ) AND
-                    ";
-                    break;
-                // Case 2: Assigned or unassigned.
-            }  
-            switch ($this->filters["ALTERNATIVE_CONDITION"]){
-                case 0: // Higher grade, any quality
-                    $s = $s .
-                    "  rune_alt.stars >= rune.stars ";
-                    break;
-                case 1: // Higher grade or higher quality
-                    $s = $s .
-                    "  ( " .
-                    "    rune_alt.stars > rune.stars OR " .
-                    "    rune_alt.original_quality > rune.original_quality " .
-                    "  ) ";
-                    break;
-                case 2: // Equal or higher grade and equal or higher quality
-                    $s = $s . 
-                       "  rune_alt.stars >= rune.stars AND " .
-                       "  rune_alt.original_quality >= rune.original_quality ";
-                    break;
-                case 3: // Equal or higher grade and higher quality
-                    $s = $s . 
-                       "  rune_alt.stars >= rune.stars AND " .
-                       "  rune_alt.original_quality > rune.original_quality ";
-                    break;
-                case 4: // Equal grade and equal or higher quality
-                    $s = $s . 
-                       "  rune_alt.stars > rune.stars AND " .
-                       "  rune_alt.original_quality >= rune.original_quality ";
-                    break;
-                default: // Case 5: Higher grade and higher quality
-                    $s = $s . 
-                       "  rune_alt.stars > rune.stars AND " .
-                       "  rune_alt.original_quality > rune.original_quality ";
-                    break;
-            }
-            if (strlen($this->filters["MONSTER_NAME"]) > 0){
-                $s = $s . " AND upper(k_unit.name) LIKE = upper('%" . $this->filters["MONSTER_NAME"] . "%') ";
-            }
-            if (!$this->filters["MONSTER_IN_STORAGE"]){
-                $s = $s . " AND unit.building <> " . BUILDING_ID::MONSTER_STORAGE;
-            }
-            if (!$this->filters["MONSTER_TEAMS"]){
-                $s = $s . " AND unit.id in (SELECT unit FROM team, team_unit WHERE team.id = team_unit.team AND team_unit.unit = unit.id AND team.uid = '$UID') ";
-            }
-            if (count($this->filters["RUNE_SLOT"]) > 0){
-                $s = $s . " AND rune.slot IN ( ";
-                foreach($this->filters["RUNE_SLOT"] as $t){
-                    $s = $s . "$t, ";
-                }
-                $s = $s . "-1) ";
-            }
-            $s = $s . "
-              ORDER BY
-                (SELECT COUNT(DISTINCT(area_type || area)) FROM team, team_unit WHERE team.id = team_unit.team AND team_unit.unit = unit.id AND team.uid = '$UID') DESC,
-                unit.stars DESC,
-                unit.level DESC,
-                unit.id,
-                rune.slot,
-                id,
-                rune_alt.stars DESC,
-                rune_alt.original_quality DESC,
-                rune_alt.main_stat_value DESC;
-            ";
-            return $s;
-        }
-    }
-?>

+ 94 - 10
application/page/Report_Skillup_Page.php

@@ -25,6 +25,24 @@
          */
         public $units = [];
 
+        /**
+         * @var mixed[] Default filter values.
+         */
+        public $filters = [
+            "MIN_STARS" => 5,
+            "MAX_STARS" => 6,
+            "MIN_NATURAL_STARS" => 5,
+            "MAX_NATURAL_STARS" => 5,
+            "IN_STORAGE" => false,
+            "WITHOUT_RUNES" => false,
+            "FAMILY" => false,
+            "MAXED" => false,
+            "2A" => true,
+            "HOMUNCULUS" => true,
+            "UNIT" => 0, // 0: All, 1: In teams, 2: In teams (score > 0)
+            "PONDERATION" => [1, 1.5, 2, 2.5]
+        ];
+
         /**
          * Constructor.
          *
@@ -51,18 +69,18 @@
          * and adds them to the $filters array.
          */
         private function parse_filters(){
-            $this->filters = FILTER::SKILLUP;
+            //$this->filters = FILTER::SKILLUP;
             if (isset($_GET["min_stars"]) && intval($_GET["min_stars"]) > 0 && intval($_GET["min_stars"]) < 7){
-                $this->filters["MIN_STARS"] = $_GET["min_stars"];
+                $this->filters["MIN_STARS"] = intval($_GET["min_stars"]);
             }
             if (isset($_GET["max_stars"]) && intval($_GET["max_stars"]) > 0 && intval($_GET["max_stars"]) < 7){
-                $this->filters["MAX_STARS"] = $_GET["max_stars"];
+                $this->filters["MAX_STARS"] = intval($_GET["max_stars"]);
             }
             if (isset($_GET["min_natural_stars"]) && intval($_GET["min_natural_stars"]) > 0 && intval($_GET["min_natural_stars"]) < 6){
-                $this->filters["MIN_NATURAL_STARS"] = $_GET["min_natural_stars"];
+                $this->filters["MIN_NATURAL_STARS"] = intval($_GET["min_natural_stars"]);
             }
             if (isset($_GET["max_natural_stars"]) && intval($_GET["max_natural_stars"]) > 0 && intval($_GET["max_natural_stars"]) < 6){
-                $this->filters["MAX_NATURAL_STARS"] = $_GET["max_natural_stars"];
+                $this->filters["MAX_NATURAL_STARS"] = intval($_GET["max_natural_stars"]);
             }
             if (isset($_GET["in_storage"]) && $_GET["in_storage"] == "on"){
                 $this->filters["IN_STORAGE"] = true;
@@ -76,13 +94,27 @@
             if (isset($_GET["maxed"]) && $_GET["maxed"] == "on"){
                 $this->filters["MAXED"] = true;
             }
-            if (isset($_GET["2a"]) && $_GET["2a"] == "on"){
-                $this->filters["2A"] = true;
+            if (!isset($_GET["2a"]) || $_GET["2a"] != "on"){
+                $this->filters["2A"] = false;
             }
             if (isset($_GET["homunculus"]) && $_GET["homunculus"] == "on"){
                 $this->filters["HOMUNCULUS"] = true;
             }
-
+            if (isset($_GET["unit"]) && intval($_GET["unit"]) >= 0 && intval($_GET["unit"]) <= 2){
+                $this->filters["UNIT"] = intval($_GET["unit"]);
+            }
+            if (isset($_GET["pond_1"]) && floatval($_GET["pond_1"]) >= 0 && floatval($_GET["pond_1"]) <= 4){
+                $this->filters["PONDERATION"][0] = floatval($_GET["pond_1"]);
+            }
+            if (isset($_GET["pond_2"]) && floatval($_GET["pond_2"]) >= 0 && floatval($_GET["pond_2"]) <= 4){
+                $this->filters["PONDERATION"][1] = floatval($_GET["pond_2"]);
+            }
+            if (isset($_GET["pond_3"]) && floatval($_GET["pond_3"]) >= 0 && floatval($_GET["pond_3"]) <= 4){
+                $this->filters["PONDERATION"][2] = floatval($_GET["pond_3"]);
+            }
+            if (isset($_GET["pond_4"]) && floatval($_GET["pond_4"]) >= 0 && floatval($_GET["pond_4"]) <= 4){
+                $this->filters["PONDERATION"][3] = floatval($_GET["pond_4"]);
+            }
             return;
         }
 
@@ -98,9 +130,27 @@
             $s = "
               SELECT DISTINCT
                 unit.id AS id,
-                sum(unit_skill.level * (CAST(k_skill.slot + 1 AS FLOAT) / 2.0)) AS ponderated_lvl,
+                --sum(unit_skill.level * (CAST(k_skill.slot + 1 AS FLOAT) / 2.0)) AS ponderated_lvl,
+                sum(unit_skill.level *
+                  CASE
+                    WHEN k_skill.slot = 1 THEN  " . $this->filters["PONDERATION"][0] . "
+                    WHEN k_skill.slot = 2 THEN  " . $this->filters["PONDERATION"][1] . "
+                    WHEN k_skill.slot = 3 THEN  " . $this->filters["PONDERATION"][2] . "
+                    WHEN k_skill.slot = 4 THEN  " . $this->filters["PONDERATION"][3] . "
+                    ELSE 1
+                    END
+                ) AS ponderated_lvl,
                 sum(unit_skill.level) AS lvl,
-                sum(k_skill.max_level * (CAST(k_skill.slot + 1 AS FLOAT) / 2.0)) AS ponderated_max_lvl,
+                --sum(k_skill.max_level * (CAST(k_skill.slot + 1 AS FLOAT) / 2.0)) AS ponderated_max_lvl,
+                sum(k_skill.max_level * 
+                  CASE
+                    WHEN k_skill.slot = 1 THEN  " . $this->filters["PONDERATION"][0] . "
+                    WHEN k_skill.slot = 2 THEN  " . $this->filters["PONDERATION"][1] . "
+                    WHEN k_skill.slot = 3 THEN  " . $this->filters["PONDERATION"][2] . "
+                    WHEN k_skill.slot = 4 THEN  " . $this->filters["PONDERATION"][3] . "
+                    ELSE 1
+                  END
+                ) AS ponderated_max_lvl,
                 sum(k_skill.max_level) AS max_lvl
               FROM
                 unit,
@@ -112,6 +162,39 @@
                 unit.uid = '$UID' AND
                 unit.unit = k_unit.id AND
                 unit_skill.unit = unit.id AND ";
+            switch ($this->filters["UNIT"]){
+                case 0: // All units, do ot fiter.
+                    break;
+                case 1: // Units in teams.
+                    $s .= "
+                      (
+                        unit.id IN (
+                          SELECT DISTINCT unit 
+                          FROM
+                            team,
+                            team_unit 
+                          WHERE
+                            team.id = team_unit.team AND
+                            team.uid = '$UID'
+                        )
+                      ) AND ";
+                    break;
+                case 2: // Units in teams with score.
+                    $s .= "
+                      (
+                        unit.id IN (
+                          SELECT DISTINCT unit 
+                          FROM
+                            team,
+                            team_unit 
+                          WHERE
+                            team.id = team_unit.team AND
+                            team.uid = '$UID' AND
+                            team.score > 0
+                        )
+                      ) AND ";
+                    break;
+            }
             if (!$this->filters["HOMUNCULUS"]){
                 $s .= "
                   k_unit.homunculus <> 1 AND 
@@ -190,6 +273,7 @@
                 CAST(lvl AS FLOAT) / CAST(max_lvl AS FLOAT),
                 max_lvl - lvl DESC
             ";
+            error_log($s);
             return $s;
         }
     }

+ 65 - 62
application/page/Runes_Page.php

@@ -32,9 +32,28 @@
         public $runes = [];
 
         /**
-         * @var \Filter[] Custom filters for this page.
+         * @var mixed[] Default filter values.
          */
-        public $custom_filters = [];
+        public $filters = [
+            "TYPE" => [],
+            "MAIN" => [],
+            "SUB" => [],
+            "SLOT" => [],
+            "MIN_QUALITY" => QUALITY_ID::NORMAL,
+            "MAX_QUALITY" => QUALITY_ID::LEGEND,
+            "MIN_ORIGINAL_QUALITY" => QUALITY_ID::NORMAL,
+            "MAX_ORIGINAL_QUALITY" => QUALITY_ID::LEGEND,
+            "MIN_STARS" => 1,
+            "MAX_STARS" => 6,
+            "MIN_LEVEL" => 0,
+            "MAX_LEVEL" => 15,
+            "MIN_EFFICIENCY" => 0,
+            "MAX_EFFICIENCY" => 100,
+            "MIN_MAX_EFFICIENCY" => 0,
+            "MAX_MAX_EFFICIENCY" => 100,
+            "ASSIGNED" => 1,
+            "GROUP" => "SLOT"
+        ];
 
         /**
          * Constructor.
@@ -49,13 +68,8 @@
             global $db;
             $this->view = PATH::VIEW . "runes.php";
             $this->parse_filters();
-            if (!isset($_GET["custom_filter"])){
                 $s = $this->build_query();
                 $this->filters["GROUP"] = 1;
-            }
-            else{
-                $s = $this->build_custom_query($_GET["custom_filter"]);
-            }
             $q = $db->query($s);
             while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                 $rune = new Rune($r["id"]);
@@ -85,21 +99,20 @@
          * and adds them to the $filters array.
          */
         private function parse_filters(){
-            $this->filters = FILTER::RUNE;
             if (isset($_GET["type"])){
                 $types = $_GET["type"];
                 foreach ($types as $type){
                     array_push($this->filters["TYPE"], intval($type));
                 }
             }
-            if (isset($_GET["main"])){
-                $mains = $_GET["main"];
+            if (isset($_GET["main_stat"])){
+                $mains = $_GET["main_stat"];
                 foreach ($mains as $main){
                     array_push($this->filters["MAIN"], intval($main));
                 }
             }
-            if (isset($_GET["sub"])){
-                $subs = $_GET["sub"];
+            if (isset($_GET["sub_stat"])){
+                $subs = $_GET["sub_stat"];
                 foreach ($subs as $sub){
                     array_push($this->filters["SUB"], intval($sub));
                 }
@@ -157,67 +170,57 @@
         }
 
         /**
-         * Builds the query to the rune table using the a custom filter.
+         * Builds the query to the rune table using the selected or default
+         * filters.
          * 
-         * @param int $filter Custom filter ID.
          * @return string The query to be executed.
          * @global int Player ID.
-         * @global resource Database connection.
          */
-        private function build_custom_query($filter){
+        private function build_query(){
             global $UID;
-            global $db;
-            $s = "
-              SELECT condition
-              FROM filter
-              WHERE
-                uid = '$UID' AND
-                id = $filter;
-            ";
-            $q = $db->query($s);
-            $r = $q->fetchArray(SQLITE3_ASSOC);
-            $cond = $r["condition"];
             $s = "
               SELECT
                 id,
                 assigned_to
               FROM rune
-              WHERE uid = '$UID' AND (
-                $cond
-              )
-              ORDER BY slot, type, stars DESC, original_quality DESC, quality DESC, level;
+              WHERE
+                uid = '$UID' AND
+                stars >= " . $this->filters["MIN_STARS"] . " AND
+                stars <= " . $this->filters["MAX_STARS"] . " AND
+                level >= " . $this->filters["MIN_LEVEL"] . " AND
+                level <= " . $this->filters["MAX_LEVEL"] . " AND
+                quality >= " . $this->filters["MIN_QUALITY"] . " AND
+                quality <= " . $this->filters["MAX_QUALITY"] . " AND
+                original_quality >= " . $this->filters["MIN_ORIGINAL_QUALITY"] . " AND
+                original_quality <= " . $this->filters["MAX_ORIGINAL_QUALITY"] . " AND
+                efficiency >= " . $this->filters["MIN_EFFICIENCY"] . " AND
+                efficiency <= " . $this->filters["MAX_EFFICIENCY"] . " AND
+                max_efficiency >= " . $this->filters["MIN_MAX_EFFICIENCY"] . " AND
+                max_efficiency <= " . $this->filters["MAX_MAX_EFFICIENCY"] . "
             ";
-            return $s;
-        }
-
-        /**
-         * Builds the query to the rune table using the selected or default
-         * filters.
-         * 
-         * @return string The query to be executed.
-         * @global int Player ID.
-         */
-        private function build_query(){
-            global $UID;
-            $s =
-              "SELECT " .
-              "  id, " .
-              "  assigned_to " .
-              "FROM rune " .
-              "WHERE " .
-              "  uid = '$UID' AND " .
-              "  stars >= " . $this->filters["MIN_STARS"] . " AND " .
-              "  stars <= " . $this->filters["MAX_STARS"] . " AND " .
-              "  level >= " . $this->filters["MIN_LEVEL"] . " AND " .
-              "  level <= " . $this->filters["MAX_LEVEL"] . " AND " .
-              "  quality >= " . $this->filters["MIN_QUALITY"] . " AND " .
-              "  quality <= " . $this->filters["MAX_QUALITY"] . " AND " .
-              "  original_quality >= " . $this->filters["MIN_ORIGINAL_QUALITY"] . " AND " .
-              "  original_quality <= " . $this->filters["MAX_ORIGINAL_QUALITY"] . " AND " .
-              "  efficiency >= " . $this->filters["MIN_EFFICIENCY"] . " AND " .
-              "  efficiency <= " . $this->filters["MAX_EFFICIENCY"] . " AND " .
-              "  max_efficiency >= " . $this->filters["MIN_MAX_EFFICIENCY"] . " AND " .
-              "  max_efficiency <= " . $this->filters["MAX_MAX_EFFICIENCY"] . " ";
+            if (count($this->filters["MAIN"]) > 0){
+                $s = $s . " AND main_stat IN ( ";
+                foreach($this->filters["MAIN"] as $t){
+                    $s = $s . "'$t', ";
+                }
+                $s = $s . "'DUMMY0') ";
+            }
+            if (count($this->filters["SUB"]) > 0){
+                $values = "(";
+                foreach($this->filters["SUB"] as $t){
+                    $values = $values . "'$t', ";
+                }
+                $values = $values . "'DUMMY0') ";
+                $s = $s . "
+                  AND ( 
+                    innate_stat IN $values OR
+                    substat_1 IN $values OR
+                    substat_2 IN $values OR
+                    substat_3 IN $values OR
+                    substat_4 IN $values
+                  )
+                ";
+            }
             if (count($this->filters["TYPE"]) > 0){
                 $s = $s . " AND upper(type) IN ( ";
                 foreach($this->filters["TYPE"] as $t){

+ 3 - 0
application/page/Teams_Page.php

@@ -91,6 +91,9 @@
               SELECT id
               FROM team
               WHERE uid = '$UID'
+              ORDER BY
+                area_type,
+                area
             ";
             if (APPLICATION::valid_id("AREA_ID", $this->filters["AREA"])){
                 $s = $s . " AND area  = '" . strtoupper($this->filters["AREA"]) . "') ";

BIN
application/sw.sqlite


+ 253 - 106
application/view/artifacts.php

@@ -18,7 +18,6 @@
         <!-- CSS files -->
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>artifacts.css'/>
-        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
         <!-- Meta tags -->
         <link rel='canonical' href='<?=$page->canonical?>'/>
         <link rel='author' href='<?=$page->author?>'/>
@@ -37,128 +36,276 @@
         <meta name='twitter:image' content='<?=$page->icon?>'/>
         <meta name='twitter:url' content='<?=$page->canonical?>'/>
         <meta name='robots' content='index follow'/>
-        <script>
-
-            /**
-             * Shows or hiddes the filters panel.
-             */
-            function toggleFilters(){
-                var content = document.getElementById('filters_content');
-                var slid = document.getElementById('filters_slid');
-                if (content.style.maxHeight != '55em'){
-                    content.style.maxHeight = '55em';
-                    slid.style.transform = 'rotate(90deg)';
-                }
-                else{
-                    content.style.maxHeight = '0px';
-                    slid.style.transform = 'rotate(0deg)';
-                }
-            };
-        </script>
     </head>
     <body>
 <?php
         include __DIR__ . "/inc/header.php";
 ?>
-        <section class='filters'>
-            <h2 id='filters_title' onClick='toggleFilters();'>
-                <img id='filters_slid' id='filters_slid' alt=' ' src='<?=URL::IMG["ICON"]?>slid.png'/>
-                Artifact filters
+        <aside class='filters'>
+            <h2>
+                Artifacts
             </h2>
-            <article id='filters_content'>
-<?php
-                $filters = $page->filters;
-                $custom_filters = $page->custom_filters;
-                include __DIR__ . "/inc/filter_artifacts.php";
-?>
-            </article>
-
-        </section> <!-- #filters -->
-<?php
-            $prev_group = "";
-            $group = "";
-            $group_title = "";
-            $group_image = "";
-            foreach ($page->artifacts as $artifact){
-                $group = $artifact->type . "-" . $artifact->element . "-" . $artifact->archetype;
-                
-                if ($prev_group != $group){
-                    switch ($artifact->type){
-                        case ARTIFACT_TYPE::ELEMENT:
-                            switch ($artifact->element){
-                                case ELEMENT_ID::WATER:
-                                    $group_title = "Water";
-                                    $group_image = URL::IMG["ARTIFACT"] . "element_water.png";
-                                    break;
-                                case ELEMENT_ID::FIRE:
-                                    $group_title = "Fire";
-                                    $group_image = URL::IMG["ARTIFACT"] . "element_fire.png";
-                                    break;
-                                case ELEMENT_ID::WIND:
-                                    $group_title = "Wind";
-                                    $group_image = URL::IMG["ARTIFACT"] . "element_wind.png";
-                                    break;
-                                case ELEMENT_ID::LIGHT:
-                                    $group_title = "Light";
-                                    $group_image = URL::IMG["ARTIFACT"] . "element_light.png";
-                                    break;
-                                case ELEMENT_ID::DARK:
-                                    $group_title = "Dark";
-                                    $group_image = URL::IMG["ARTIFACT"] . "element_dark.png";
-                                    break;
-                            }
-                            break;
-                        case ARTIFACT_TYPE::ARCHETYPE:
-                            switch ($artifact->archetype){
-                                case ARCHETYPE_ID::ATTACK:
-                                    $group_title = "Attack";
-                                    $group_image = URL::IMG["ARTIFACT"] . "type_attack.png";
-                                    break;
-                                case ARCHETYPE_ID::DEFENSE:
-                                    $group_title = "Defense";
-                                    $group_image = URL::IMG["ARTIFACT"] . "type_defense.png";
-                                    break;
-                                case ARCHETYPE_ID::SUPPORT:
-                                    $group_title = "Support";
-                                    $group_image = URL::IMG["ARTIFACT"] . "type_support.png";
-                                    break;
-                                case ARCHETYPE_ID::HP:
-                                    $group_title = "HP";
-                                    $group_image = URL::IMG["ARTIFACT"] . "type_hp.png";
+            <p>
+                Manage your enchantments
+            </p>
+            <form action='/<?=$UID?>/artifacts/' method='get' id='filter_artifacts' class='filter'>
+                <table>
+                    <tr>
+                        <td class='label'>
+                            Element:
+                        </td>
+                        <td>
+                            <select multiple name='element[]' id='filter_element'>
+<?php
+                                $reflect = new ReflectionClass("ELEMENT_ID");
+                                foreach($reflect->getConstants() as $name => $id){
+                                    if ($id != ELEMENT_ID::PURE){
+                                        $selected = "";
+                                        if (in_array($id, $page->filters["ELEMENT"])){
+                                            $selected = "selected='selected'";
+                                        }
+?>
+                                        <option value='<?=$id?>' <?=$selected?>><?=$name?></option>
+<?php
+                                    }
+                                }
+?>
+                            </select>
+                        </td>
+                    <tr>
+                    </tr>
+                        <td class='label'>
+                            Type:
+                        </td>
+                        <td>
+                            <select multiple name='archetype[]' id='filter_archetype'>
+<?php
+                                $reflect = new ReflectionClass("ARCHETYPE_ID");
+                                foreach($reflect->getConstants() as $name => $id){
+                                    if ($id != ARCHETYPE_ID::NONE && $id != ARCHETYPE_ID::MATERIAL){
+                                        $selected = "";
+                                        if (in_array($id, $page->filters["ARCHETYPE"])){
+                                            $selected = "selected='selected'";
+                                        }
+?>
+                                        <option value='<?=$id?>' <?=$selected?>><?=$name?></option>
+<?php
+                                    }
+                                }
+?>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Main stat:
+                        </td>
+                        <td>
+                            <select multiple name='main_stat[]' id='filter_main_stat'>
+<?php
+                                $reflect = new ReflectionClass("ARTIFACT_STAT_ID");
+                                foreach($reflect->getConstants() as $name => $id){
+                                    $selected = "";
+                                    if (in_array($id, $page->filters["MAIN"])){
+                                        $selected = "selected='selected'";
+                                    }
+?>
+                                    <option value='<?=$id?>' <?=$selected?>><?=$name?></option>
+<?php
+                                }
+?>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Level:
+                        </td>
+                        <td>
+                            <input type='number' name='min_level' id='filter_level_min' min='0' max='15' value='<?=$page->filters["MIN_LEVEL"]?>'/>
+                            -
+                            <input type='number' name='max_level' id='filter_level_max' min='0' max='15' value='<?=$page->filters["MAX_LEVEL"]?>'/>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Quality:
+                        </td>
+                        <td>
+<?php
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["MIN_QUALITY"] - 1] = "selected";
+?>
+                            <select name='min_quality' id='filter_quality_min'>
+                                <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
+                                <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
+                                <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
+                                <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
+                                <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
+                            </select>
+                            -
+<?php
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["MAX_QUALITY"] - 1] = "selected";
+?>
+                            <select name='max_quality' id='filter_quality_max'>
+                                <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
+                                <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
+                                <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
+                                <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
+                                <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            O. quality:
+                        </td>
+                        <td>
+<?php
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["MIN_ORIGINAL_QUALITY"] - 1] = "selected";
+?>
+                            <select name='min_original_quality' id='filter_original_quality_min'>
+                                <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
+                                <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
+                                <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
+                                <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
+                                <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
+                            </select>
+                            -
+<?php
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["MAX_ORIGINAL_QUALITY"] - 1] = "selected";
+?>
+                            <select name='max_original_quality' id='filter_original_quality_max'>
+                                <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
+                                <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
+                                <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
+                                <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
+                                <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Assigned:
+                        </td>
+                        <td>
+<?php
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["ASSIGNED"]] = "selected";
+?>
+                            <select name='assigned' id='filter_assigned'>
+                                <option value='0' <?=$selected[0]?>>All</option>
+                                <option value='1' <?=$selected[1]?>>Assigned</option>
+                                <option value='2' <?=$selected[2]?>>Unassigned</option>
+                                <option value='3' <?=$selected[3]?>>All (no storage)</option>
+                                <option value='4' <?=$selected[4]?>>Assigned (no storage)</option>
+                            </select>
+                        </td>
+                    </tr>
+                </table>
+                <div id='filter_apply'>
+                    <input type='submit' value='Apply'/>
+                </div>
+            </form>
+        </aside> <!-- #filters -->
+        <main>
+            <section class='content' id='artifacts'>
+                <h2>
+                    Artifacts
+                </h2>
+                <table>
+<?php
+                    $prev_group = "";
+                    $group = "";
+                    $group_title = "";
+                    $group_image = "";
+                    foreach ($page->artifacts as $artifact){
+                        $group = $artifact->type . "-" . $artifact->element . "-" . $artifact->archetype;
+                        if ($prev_group != $group){
+                            switch ($artifact->type){
+                                case ARTIFACT_TYPE::ELEMENT:
+                                    switch ($artifact->element){
+                                        case ELEMENT_ID::WATER:
+                                            $group_title = "Water";
+                                            $group_image = URL::IMG["ARTIFACT"] . "element_water.png";
+                                            break;
+                                        case ELEMENT_ID::FIRE:
+                                            $group_title = "Fire";
+                                            $group_image = URL::IMG["ARTIFACT"] . "element_fire.png";
+                                            break;
+                                        case ELEMENT_ID::WIND:
+                                            $group_title = "Wind";
+                                            $group_image = URL::IMG["ARTIFACT"] . "element_wind.png";
+                                            break;
+                                        case ELEMENT_ID::LIGHT:
+                                            $group_title = "Light";
+                                            $group_image = URL::IMG["ARTIFACT"] . "element_light.png";
+                                            break;
+                                        case ELEMENT_ID::DARK:
+                                            $group_title = "Dark";
+                                            $group_image = URL::IMG["ARTIFACT"] . "element_dark.png";
+                                            break;
+                                    }
                                     break;
+                                case ARTIFACT_TYPE::ARCHETYPE:
+                                    switch ($artifact->archetype){
+                                        case ARCHETYPE_ID::ATTACK:
+                                            $group_title = "Attack";
+                                            $group_image = URL::IMG["ARTIFACT"] . "type_attack.png";
+                                            break;
+                                        case ARCHETYPE_ID::DEFENSE:
+                                            $group_title = "Defense";
+                                            $group_image = URL::IMG["ARTIFACT"] . "type_defense.png";
+                                            break;
+                                        case ARCHETYPE_ID::SUPPORT:
+                                            $group_title = "Support";
+                                            $group_image = URL::IMG["ARTIFACT"] . "type_support.png";
+                                            break;
+                                        case ARCHETYPE_ID::HP:
+                                            $group_title = "HP";
+                                            $group_image = URL::IMG["ARTIFACT"] . "type_hp.png";
+                                            break;
+                                    }
                             }
-                    }
-                    if ($prev_group == ""){
+                            if ($prev_group == ""){
 ?>
-                        <section class='list'>
+                                <tr>
+                                    <td class='header'>
 <?php
-                    }
-                    else{
+                            }
+                            else{
 ?>
-                            </article>
-                        </section>
-                        <section class='list'>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td class='header'>
 <?php
-                    }
-                    $prev_group = $group;
+                            }
+                            $prev_group = $group;
 ?>
-                    <h2>
-                        <img class='group_image_<?=$group?>' alt='<?=$group_title?>' src='<?=$group_image?>'>
-                        <span>
-                            <?=$group_title?>
-                        </span>
-                    </h2>
-                    <article>
+                            <img class='group_image_<?=$group?>' alt='<?=$group_title?>' src='<?=$group_image?>'>
+                            <span>
+                                <?=$group_title?>
+                            </span>
+                            </td>
+                            </tr>
+                            <tr>
+                            <td>
 <?php
-                }
+                        }
 ?>
-                <?=HTML::artifact_table($artifact, $artifact->assigned_to)?>
+                        <?=HTML::artifact_table($artifact, $artifact->assigned_to)?>
 <?php
-            }
+                    }
 ?>
-            </article> <!-- Close last group -->
-        </section>
-
+                    </td> <!-- Close last group -->
+                    </tr>
+                </table>
+            </section>
+        </main>
 <?php
         include __DIR__ . "/inc/footer.php";
 ?>

+ 72 - 50
application/view/catalog.php

@@ -19,7 +19,6 @@
         <!-- CSS files -->
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>catalog.css'/>
-        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
         <!-- Meta tags -->
         <link rel='canonical' href='<?=$page->canonical?>'/>
         <link rel='author' href='<?=$page->author?>'/>
@@ -38,72 +37,95 @@
         <meta name='twitter:image' content='<?=$page->icon?>'/>
         <meta name='twitter:url' content='<?=$page->canonical?>'/>
         <meta name='robots' content='index follow'/>
-        <script>
 
-            /**
-             * Shows or hiddes the filters panel.
-             */
-            function toggleFilters(){
-                var content = document.getElementById('filters_content');
-                var slid = document.getElementById('filters_slid');
-                if (content.style.maxHeight != '30em'){
-                    content.style.maxHeight = '30em';
-                    slid.style.transform = 'rotate(90deg)';
-                }
-                else{
-                    content.style.maxHeight = '0px';
-                    slid.style.transform = 'rotate(0deg)';
-                }
-            };
-        </script>
     </head>
     <body>
 <?php
         include __DIR__ . "/inc/header.php";
 ?>
-        <section class='filters'>
-            <h2 id='filters_title' onClick='toggleFilters();'>
-                <img id='filters_slid' id='filters_slid' alt=' ' src='<?=URL::IMG["ICON"]?>slid.png'/>
-                Catalog filters
+        <aside id='filters' class='content filters'>
+            <h2 id='filters_title'>
+                Catalog
             </h2>
-            <article id='filters_content'>
+            <p>
+                A list with every monster in the game.
+            </p>
+            <form action='/<?=$UID?>/catalog/' method='get' id='filter_catalog' class='filter'>
+                <table>
+                    <tr>
+                        <td class='label'>
+                            Element:
+                        </td>
+                        <td>
 <?php
-                $filters = $page->filters;
-                include __DIR__ . "/inc/filter_catalog.php";
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["ELEMENT"] - 1] = "selected";
 ?>
-            </article>
+                            <select name='element'>
+                                <option value='0'>All</option>
+                                <option value='<?=ELEMENT_ID::WATER?>' <?=$selected[0]?>>Water</option>
+                                <option value='<?=ELEMENT_ID::FIRE?>' <?=$selected[1]?>>Fire</option>
+                                <option value='<?=ELEMENT_ID::WIND?>' <?=$selected[2]?>>Wind</option>
+                                <option value='<?=ELEMENT_ID::LIGHT?>' <?=$selected[3]?>>Light</option>
+                                <option value='<?=ELEMENT_ID::DARK?>' <?=$selected[4]?>>Dark</option>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label' id='filter_stars'>
+                            Stars:
+                        </td>
+                        <td>
+                            <input type='number' name='min_stars' id='filter_stars_min' min='1' max='5' value='<?=$page->filters["MIN_STARS"]?>'/>
+                            -
+                            <input type='number' name='max_stars' id='filter_stars_max' min='1' max='5' value='<?=$page->filters["MAX_STARS"]?>'/>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Name:
+                        </td>
+                        <td>
+                            <input type='text' name='name' id='filter_name' value='<?=$page->filters["NAME"]?>'/>
+                        </td>
+                    </tr>
+                </table>
+                <input type='submit' value='Apply'/>
+            </form>
 
-        </section> <!-- #filters -->
-        <section class='list'>
-            <h2>
-                Catalog
-            </h2>
-            <article>
+        </aside> <!-- #filters -->
+        <main>
+            <section id='list' class='list'>
+                <h2>
+                    Catalog
+                </h2>
+                <article>
 <?php
-                $element = "";
-                foreach ($page->units as $mon){
-                    if ($mon->element != $element){
-                        if ($element != ""){
+                    $element = "";
+                    foreach ($page->units as $mon){
+                        if ($mon->element != $element){
+                            if ($element != ""){
 ?>
-                            </article>
-                            <article>
+                                </article>
+                                <article>
 <?php
+                            }
+                            $element = $mon->element;
                         }
-                        $element = $mon->element;
-                    }
 ?>
-                    <div class='monster'>
-                        <a href='/<?=$UID?>/catalog/<?=$mon->id?>'>
-                            <div class='monster_panel'>
-                                <?=HTML::unit_panel($mon)?>
-                            </div>
-                        </a>
-                    </div>
+                        <div class='monster'>
+                            <a href='/<?=$UID?>/catalog/<?=$mon->id?>'>
+                                <div class='monster_panel'>
+                                    <?=HTML::unit_panel($mon)?>
+                                </div>
+                            </a>
+                        </div>
 <?php
-                }
+                    }
 ?>
-            </article>
-        </section> <!-- #catalog -->
+                </article>
+            </section> <!-- #catalog -->
+        </main>
 
 <?php
         include __DIR__ . "/inc/footer.php";

+ 222 - 61
application/view/enchantments.php

@@ -18,7 +18,6 @@
         <!-- CSS files -->
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>enchantments.css'/>
-        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
         <!-- Meta tags -->
         <link rel='canonical' href='<?=$page->canonical?>'/>
         <link rel='author' href='<?=$page->author?>'/>
@@ -38,89 +37,251 @@
         <meta name='twitter:url' content='<?=$page->canonical?>'/>
         <meta name='robots' content='index follow'/>
         <script>
-
             /**
-             * Shows or hiddes the filters panel.
+             * Hack to treat all type selects as one.
+             *
+             * @param clicked Numeric order of the select clicked.
+             * @param event onMouseDown event.
              */
-            function toggleFilters(){
-                var content = document.getElementById('filters_content');
-                var slid = document.getElementById('filters_slid');
-                if (content.style.maxHeight != '55em'){
-                    content.style.maxHeight = '55em';
-                    slid.style.transform = 'rotate(90deg)';
+            function fixTypeSelect(clicked, event){
+                if (!event.ctrlKey){
+                    // If controll was not being held, clean all other selects
+                    const selects = document.querySelectorAll('.select_type');
+                    Array.from(selects).forEach((element, index) => {
+                        if (element.id != "select_type_" + clicked){
+                            element.selectedIndex = -1;
+                        }
+                    });
                 }
-                else{
-                    content.style.maxHeight = '0px';
-                    slid.style.transform = 'rotate(0deg)';
+            }
+
+            /**
+             * Hack to treat all main stat selects as one.
+             *
+             * @param clicked Numeric order of the select clicked.
+             * @param event onMouseDown event.
+             */
+            function fixMainSelect(clicked, event){
+                if (!event.ctrlKey){
+                    // If controll was not being held, clean all other selects
+                    const selects = document.querySelectorAll('.select_main');
+                    Array.from(selects).forEach((element, index) => {
+                        if (element.id != "select_main_" + clicked){
+                            element.selectedIndex = -1;
+                        }
+                    });
                 }
-            };
+            }
         </script>
     </head>
     <body>
 <?php
         include __DIR__ . "/inc/header.php";
 ?>
-        <section class='filters'>
-            <h2 id='filters_title' onClick='toggleFilters();'>
-                <img id='filters_slid' id='filters_slid' alt=' ' src='<?=URL::IMG["ICON"]?>slid.png'/>
-                Artifact filters
+        <aside class='filters'>
+            <h2>
+                Enchantments
             </h2>
-            <article id='filters_content'>
+            <p>
+                Manage your enchantments
+            </p>
+            <form action='/<?=$UID?>/enchantments/' method='get' id='filter_artifacts' class='filter'>
+                <table>
+                    <tr>
+                        <td class='label'>
+                            Type:
+                        </td>
+                        <td>
+                            <select multiple name='type[]' id='filter_type'>
+<?php
+                                $selected = "";
+                                if (in_array("GRI", $page->filters["TYPE"])){
+                                    $selected = "selected='selected'";
+                                }
+?>
+                                <option value='GRI' <?=$selected?>>Grindstone</option>
+<?php
+                                $selected = "";
+                                if (in_array("GEM", $page->filters["TYPE"])){
+                                    $selected = "selected='selected'";
+                                }
+?>
+                                <option value='GEM' <?=$selected?>>Gem</option>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Quality:
+                        </td>
+                        <td>
+<?php
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["MIN_QUALITY"] - 1] = "selected";
+?>
+                            <select name='min_quality' id='filter_quality_min'>
+                                <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
+                                <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
+                                <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
+                                <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
+                                <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
+                            </select>
+                            -
+<?php
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["MAX_QUALITY"] - 1] = "selected";
+?>
+                            <select name='max_quality' id='filter_quality_max'>
+                                <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
+                                <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
+                                <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
+                                <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
+                                <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Rune:
+                        </td>
+                        <td class='rune'>
+                            <div>
+                                <select multiple name='rune[]' id='filter_rune'>
+<?php
+                                    $selected = "";
+                                    if (in_array(0, $page->filters["RUNE"])){
+                                        $selected = "selected='selected'";
+                                    }
+?>
+                                    <option value='0' <?=$selected?>>Inmemorial</option>
+<?php
+                                    $reflect = new ReflectionClass("RUNE_SET_ID");
+                                    $i = 1;
+                                    $j = 1;
+                                    foreach($reflect->getConstants() as $name => $id){
+                                        $selected = "";
+                                        if (in_array($id, $page->filters["TYPE"])){
+                                            $selected = "selected='selected'";
+                                        }
+                                        $name_format = ucwords(strtolower($name));
+                                        if (strlen($name_format) > 9){
+                                            $name_format = substr($name_format, 0, 9) . ".";
+                                        }
+?>
+                                        <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
+<?php
+                                        if (($i + 1) % 6 == 0 && ($i + 1) < sizeof($reflect->getConstants())){
+?>
+                                            </select><select multiple name='type[]' class='select_type' id='select_type_<?=$j?>' onMouseDown='fixTypeSelect(<?=$j?>, event);'>
+<?php
+                                            $j ++;
+                                        }
+                                        $i ++;
+                                    }
+?>
+                                </select>
+                            </div>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Stat:
+                        </td>
+                        <td class='stats'>
+                            <div>
+                                <select multiple name='stat[]' id='filter_stat'>
+<?php
+                                    $reflect = new ReflectionClass("RUNE_STAT_ID");
+                                    $i = 0;
+                                    $j = 1;
+                                    foreach($reflect->getConstants() as $name => $id){
+                                        $selected = "";
+                                        if (in_array($id, $page->filters["SUB"])){
+                                            $selected = "selected='selected'";
+                                        }
+                                        $name_format = ucwords(str_replace("_P", "%", $name));
+?>
+                                        <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
+<?php
+                                        if (($i + 1) % 2 == 0){
+?>
+                                            </select><select multiple name='main_stat[]' class='select_sub' id='filter_sub_stat_<?=$j?>' onMouseDown='fixSubSelect(<?=$j?>, event);'>
 <?php
-                $filters = $page->filters;
-                $custom_filters = $page->custom_filters;
-                include __DIR__ . "/inc/filter_enchantments.php";
+                                            $j ++;
+                                        }
+                                        $i ++;
+                                    }
 ?>
-            </article>
+                                </select>
+                            </div>
+                        </td>
+                    </tr>
+                </table>
+                <div id='filter_apply'>
+                    <input type='submit' value='Apply'/>
+                </div>
+                </div>
+            </form>
 
-        </section> <!-- #filters -->
-<?php
-            $prev_group = "";
-            $group = "";
-            $group_title = "";
-            $group_image = "";
-            foreach ($page->grindstones as $grindstone){
-                //$group = $grindstone->rune->id . "-" . $grindstone->gem . "-" . $grindstone->inmemorial;
-                $group = $grindstone->rune->id . "-" . $grindstone->inmemorial;
-                if ($prev_group != $group){
-                    if ($grindstone->inmemorial == 1){
-                        $group_title = "Inmemorial";
-                        $group_image = URL::IMG["ICON"] . "star.png";
-                    }
-                    else{
-                        $group_title = $grindstone->rune->name;
-                        $group_image = URL::IMG["RUNE"] . str_pad($grindstone->rune->id, 2, '0', STR_PAD_LEFT) . ".png";
-                    }
-                    if ($prev_group == ""){
+        </aside> <!-- #filters -->
+        <main>
+            <section class='content' id='enchantments'>
+                <h2>
+                    Enchantments
+                </h2>
+                <table>
+<?php
+                    $prev_group = "";
+                    $group = "";
+                    $group_title = "";
+                    $group_image = "";
+                    foreach ($page->grindstones as $grindstone){
+                        $group = $grindstone->rune->id . "-" . $grindstone->inmemorial;
+                        if ($prev_group != $group){
+                            if ($grindstone->inmemorial == 1){
+                                $group_title = "Inmemorial";
+                                $group_image = URL::IMG["ICON"] . "star.png";
+                            }
+                            else{
+                                $group_title = $grindstone->rune->name;
+                                $group_image = URL::IMG["RUNE"] . str_pad($grindstone->rune->id, 2, '0', STR_PAD_LEFT) . ".png";
+                            }
+                            if ($prev_group == ""){
 ?>
-                        <section class='list'>
+                                <tr>
+                                    <td class='header'>
 <?php
-                    }
-                    else{
+                            }
+                            else{
 ?>
-                            </article>
-                        </section>
-                        <section class='list'>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td class='header'>
 <?php
-                    }
-                    $prev_group = $group;
+                            }
+                            $prev_group = $group;
 ?>
-                    <h2>
-                        <img class='group_image_<?=$group?>' alt='<?=$group_title?>' src='<?=$group_image?>'>
-                        <span>
-                            <?=$group_title?>
-                        </span>
-                    </h2>
-                    <article>
+                            <img class='group_image_<?=$group?>' alt='<?=$group_title?>' src='<?=$group_image?>'>
+                            <span>
+                                <?=$group_title?>
+                            </span>
+                            </td>
+                            </tr>
+                            <tr>
+                            <td>
 <?php
-                }
+                        }
 ?>
-                <?=HTML::craft_panel($grindstone)?>
+                        <?=HTML::craft_panel($grindstone)?>
 <?php
-            }
+                    }
 ?>
-            </article> <!-- Close last group -->
-        </section>
+                    </td> <!-- Close last group -->
+                    </tr>
+                </table>
+            </section>
+        </main>
 
 <?php
         include __DIR__ . "/inc/footer.php";

+ 232 - 272
application/view/fusion.php

@@ -19,7 +19,6 @@
         <!-- CSS files -->
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>fusion.css'/>
-        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
         <!-- Meta tags -->
         <link rel='canonical' href='<?=$page->canonical?>'/>
         <link rel='author' href='<?=$page->author?>'/>
@@ -38,124 +37,81 @@
         <meta name='twitter:image' content='<?=$page->icon?>'/>
         <meta name='twitter:url' content='<?=$page->canonical?>'/>
         <meta name='robots' content='index follow'/>
-        <script>
-
-            /**
-             * Shows or hiddes the filters panel.
-             */
-            function toggleFilters(){
-                var content = document.getElementById('filters_content');
-                var slid = document.getElementById('filters_slid');
-                if (content.style.maxHeight != '30em'){
-                    content.style.maxHeight = '30em';
-                    slid.style.transform = 'rotate(90deg)';
-                }
-                else{
-                    content.style.maxHeight = '0px';
-                    slid.style.transform = 'rotate(0deg)';
-                }
-            };
-        </script>
     </head>
     <body>
 <?php
         include __DIR__ . "/inc/header.php";
 ?>
-        <section class='filters'>
-            <h2 id='filters_title' onClick='toggleFilters();'>
-                <img id='filters_slid' id='filters_slid' alt=' ' src='<?=URL::IMG["ICON"]?>slid.png'/>
+        <aside>
+            <h2>
                 Fusion filters
             </h2>
-            <article id='filters_content'>
-<?php
-                $filters = $page->filters;
-                include __DIR__ . "/inc/filter_fusion.php";
+            <p>
+                Monster fusion tree
+            </p>
+            <form action='/<?=$UID?>/fusion/' method='get' id='filter_fusion' class='filter'>
+                <table>
+                    <tr>
+                        <td class='label'>
+                            Target:
+                        </td>
+                        <td>
+                            <select name='product' id='filter_product'>
+                                <option value=''>All</option>
+<?php
+                                foreach ($page->products as $product){
+                                    if ($product->id == $page->filters["PRODUCT"]){
+                                        $selected = "selected";
+                                    }
+                                    else{
+                                        $selected = "";
+                                    }
 ?>
-            </article>
-
-        </section> <!-- #filters -->
+                                        <option value='<?=$product->id?>' <?=$selected?>><?=$product->element_name?> <?=$product->name?></option>
 <?php
-        foreach ($page->fusion as $fusion){
+                                }
 ?>
-            <section class='content'>
+                            </select>
+                        </td>
+                    </tr>
+                </table>
+                <input type='submit' value='Apply'/>
+            </form>
+        </aside> <!-- #filters -->
+        <main>
+            <section id='fusions' class='list'>
                 <h2>
-                    <?=$fusion->product->title?>
+                    Fusions
                 </h2>
                 <article>
-                    <div class='f5'>
-                        <div class='product'>
-                            <a target='_blank' title='<?=$fusion->product->name?>' href='/<?=$UID?>/catalog/<?=$fusion->product->id?>'>
-                                <div class='monster_panel'>
-                                    <span class='stars'>
-                                        <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
-                                        <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
-                                        <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
-                                        <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
-                                        <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
-                                    </span>
-                                    <img title='<?=$fusion->product->name?>' class='monster border_<?=$fusion->product->element_name?>' src='<?=$fusion->product->get_image()?>'/>
-                                    <span class='level'>
-                                        1
-                                    </span>
-                                </div><!-- .monster_panel -->
-                            </a>
-                            <div class='owned'>
-                                <span class='owned'>
-                                    Collection:
-                                </span>
-<?php
-                                foreach ($fusion->product->owned as $owned){
-                                    if ($owned->unit->awakens_from == "" && $owned->unit->awakens_to == ""){
-                                        // No to, no from, silver monster.
-                                        $star_class ="star_silver";
-                                        $mon_title = $owned->unit->element_name . " " . $owned->unit->name;
-                                    }
-                                    elseif ($owned->unit->awakens_from != "" && $owned->unit->awakens_to == ""){
-                                        // Already awakened
-                                        if ($owned->unit->base_stars - $owned->unit->natural_stars == 1){
-                                            // Normal awaken.
-                                            $star_class ="star_purple";
-                                        }
-                                        else{
-                                            // Second awaken.
-                                            $star_class ="star_red";
-                                        }
-                                        $mon_title = $owned->unit->name;
-                                    }
-                                    elseif ($owned->unit->awakens_to != ""){
-                                        // Awakeable.
-                                        $star_class ="star_gold";
-                                        $mon_title = $owned->unit->element_name . " " . $owned->unit->name;
-                                    }
-                                    $mon_title = $mon_title . " - " . $owned->stars . "* - Lv." . $owned->level;
+<?php
+                    foreach ($page->fusion as $fusion){
 ?>
-                                    <a target="_blank" title='<?=$mon_title?>' href='/<?=$UID?>/monsters/<?=$owned->id?>'>
+                            <table>
+                            <tr>
+                                <td class='f5' colspan='16'>
+                                    <a target='_blank' title='<?=$fusion->product->name?>' href='/<?=$UID?>/catalog/<?=$fusion->product->id?>'>
                                         <div class='monster_panel'>
                                             <span class='stars'>
-<?php
-                                                for ($i = 0; $i < $owned->stars; $i ++){
-?>
-                                                    <img class='star <?=$star_class?>' src='<?=URL::IMG["ICON"]?>star.png'/>
-<?php
-                                                }
-?>
+                                                <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                                <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                                <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                                <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                                <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
                                             </span>
-                                            <img title='<?=$mon_title?>' class='monster border_<?=$owned->unit->element_name?>' src='<?=$owned->unit->get_image()?>'/>
+                                            <img title='<?=$fusion->product->name?>' class='monster border_<?=$fusion->product->element_name?>' src='<?=$fusion->product->get_image()?>'/>
                                             <span class='level'>
-                                                <?=$owned->level?>
+                                                1
                                             </span>
-                                        </div>
+                                        </div><!-- .monster_panel -->
                                     </a>
+                                </td>
+                            </tr>
+                            <tr>
 <?php
-                                }// foreach ($fusion->product->owned as $owned)
-?>
-                            </div><!-- .owned -->
-                        </div><!-- .product --><div class='ingredients'><!-- No newline because CSS reads it as a whitespace -->
-<?php
-                            foreach ($fusion->fusion as $sub_fusion){
+                                foreach ($fusion->fusion as $sub_fusion){
 ?>
-                                <div class='f4'>
-                                    <div class='product'>
+                                    <td class='f4' colspan='4'>
                                         <a target='_blank' title='<?=$sub_fusion->product_awaken->name?>' href='/<?=$UID?>/catalog/<?=$sub_fusion->product_awaken->id?>'>
                                             <div class='awakened monster_panel'>
                                                 <span class='stars'>
@@ -171,6 +127,21 @@
                                                 </span>
                                             </div><!-- .awakened .monster_panel -->
                                         </a>
+                                        <!-- TODO FIX -->
+                                        <div class='essences'>
+<?php
+                                            foreach ($sub_fusion->product->essences as $essence){
+?>
+                                                <div class='essence border_<?=explode(" ", $essence["item"]->name)[2]?>'>
+                                                    <img alt='<?=$essence["item"]->name?>' title='<?=$essence["amount"]?>x <?=$essence["item"]->name?>' class='essence' src='<?=$essence["item"]->get_image()?>'/>
+                                                    <span>
+                                                        <?=$essence["amount"]?>
+                                                    </span>
+                                                </div>
+<?php
+                                            }
+?>
+                                        </div><!-- .essences -->
                                         <a target='_blank' title='<?=$sub_fusion->product->name?>' href='/<?=$UID?>/catalog/<?=$sub_fusion->product->id?>'>
                                             <div class='unawakened monster_panel'>
                                                 <span class='stars'>
@@ -188,20 +159,6 @@
                                                 </span>
                                             </div><!-- .unawakened .monster_panel -->
                                         </a>
-                                        <div class='essences'>
-<?php
-                                            foreach ($sub_fusion->product->essences as $essence){
-?>
-                                                <div class='essence border_<?=$essence["element"]?>'>
-                                                    <img alt='<?=$essence["item"]->name?>' title='<?=$essence["amount"]?>x <?=$essence["item"]->name?>' class='essence' src='<?=$essence["item"]->get_image()?>'/>
-                                                    <span>
-                                                        <?=$essence["amount"]?>
-                                                    </span>
-                                                </div>
-<?php
-                                            }
-?>
-                                        </div><!-- .essences -->
                                         <div class='owned'>
                                             <span class='owned'>
                                                 Collection:
@@ -253,179 +210,165 @@
                                             }
 ?>
                                         </div><!-- .owned -->
-                                    </div><!-- .product --><div class='ingredients'><!-- No newline because CSS reads it as a whitespace -->
-<?php
-                                        $num = 0;
-                                        foreach ($sub_fusion->ingredient as $sub_monster){
-?>
-                                            <div class='f3'>
-                                                <div class='product'>
-                                                    <a target='_blank' title='<?=$sub_monster->name?>' href='/<?=$UID?>/catalog/<?=$sub_monster->id?>'>
-                                                        <div class='awakened monster_panel'>
-                                                            <span class='stars'>
-                                                                <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
-                                                                <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
-                                                                <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
-                                                                <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
-                                                            </span>
-                                                            <img title='<?=$sub_monster->name?>' class='monster border_<?=$sub_monster->element_name?>' src='<?=$sub_monster->get_image()?>'/>
-                                                            <span class='level'>
-                                                                30
-                                                            </span>
-                                                        </div><!-- .awakened .monster_panel -->
-                                                    </a>
-                                                    <div class='essences'>
+                                    </td>
 <?php
-                                                        foreach ($sub_fusion->ingredient_unawaken[$num]->essences as $essence){
+                                }
 ?>
-                                                            <div class='essence border_<?=explode(" ", $essence["item"]->name)[2]?>'>
-                                                                <img alt='<?=$essence["item"]->name?>' title='<?=$essence["amount"]?>x <?=$essence["item"]->name?>' class='essence' src='<?=$essence["item"]->get_image()?>'/>
-                                                                <span>
-                                                                    <?=$essence["amount"]?>
-                                                                </span>
-                                                            </div>
-<?php
-                                                        }
-?>
-                                                    </div><!-- .essences -->
-                                                    <a target='_blank' title='<?=$sub_fusion->ingredient_unawaken[$num]->name?>' href='/<?=$UID?>/catalog/<?=$sub_fusion->ingredient_unawaken[$num]->id?>'>
-                                                        <div class='unawakened monster_panel'>
-                                                            <span class='stars'>
+                                    <td class='f4 extra' colspan='4'>
+                                        <a target='_blank' title='<?=$fusion->ingredient[0]->name?>' href='/<?=$UID?>/catalog/<?=$fusion->ingredient[0]->id?>'>
+                                            <div class='awakened monster_panel'>
+                                                <span class='stars'>
+                                                    <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                                    <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                                    <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                                    <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                                    <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                                </span>
+                                                <img title='<?=$fusion->ingredient[0]->name?>' class='monster border_<?=$fusion->ingredient[0]->element_name?>' src='<?=$fusion->ingredient[0]->get_image()?>'/>
+                                                <span class='level'>
+                                                    35
+                                                </span>
+                                            </div><!-- .awakened .monster_panel -->
+                                        </a>
+                                        <div class='essences'>
 <?php
-                                                                for ($i = 0; $i < $sub_fusion->ingredient_unawaken[$num]->base_stars; $i ++){
+                                            foreach ($fusion->ingredient_unawaken[0]->essences as $essence){
 ?>
-                                                                    <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                                <div class='essence border_<?=explode(" ", $essence["item"]->name)[2]?>'>
+                                                    <img alt='<?=$essence["item"]->name?>' title='<?=$essence["amount"]?>x <?=$essence["item"]->name?>' class='essence' src='<?=$essence["item"]->get_image()?>'/>
+                                                    <span>
+                                                        <?=$essence["amount"]?>
+                                                    </span>
+                                                </div>
 <?php
-                                                                }
+                                            }
 ?>
-                                                            </span>
-                                                            <img title='<?=$sub_fusion->ingredient_unawaken[$num]->name?>' class='monster border_<?=$sub_fusion->ingredient_unawaken[$num]->element_name?>' src='<?=$sub_fusion->ingredient_unawaken[$num]->get_image()?>'/>
-                                                            <span class='level'>
-                                                                1
-                                                            </span>
-                                                        </div><!-- .unawakened .monster_panel -->
-                                                    </a>
-                                                    <div class='owned'>
-                                                        <span class='owned'>
-                                                            Collection:
-                                                        </span>
+                                        </div><!-- .essences -->
+                                        <a target='_blank' title='<?=$fusion->ingredient_unawaken[0]->name?>' href='/<?=$UID?>/catalog/<?=$fusion->ingredient_unawaken[0]->id?>'>
+                                            <div class='unawakened monster_panel'>
+                                                <span class='stars'>
 <?php
-                                                        foreach ($sub_monster->owned as $owned){
-                                                            if ($owned->unit->awakens_from == "" && $owned->unit->awakens_to == ""){
-                                                                // No to, no from, silver monster.
-                                                                $star_class ="star_silver";
-                                                                $mon_title = $owned->unit->element_name . " " . $owned->unit->name;
-                                                            }
-                                                            elseif ($owned->unit->awakens_from != "" && $owned->unit->awakens_to == ""){
-                                                                // Already awakened
-                                                                if ($owned->unit->base_stars - $owned->unit->natural_stars == 1){
-                                                                    // Normal awaken.
-                                                                    $star_class ="star_purple";
-                                                                }
-                                                                else{
-                                                                    // Second awaken.
-                                                                    $star_class ="star_red";
-                                                                }
-                                                                $mon_title = $owned->unit->name;
-                                                            }
-                                                            elseif ($owned->unit->awakens_to != ""){
-                                                                // Awakeable.
-                                                                $star_class ="star_gold";
-                                                                $mon_title = $owned->unit->element_name . " " . $owned->unit->name;
-                                                            }
-                                                            $mon_title = $mon_title . " - " . $owned->stars . "* - Lv." . $owned->level;
+                                                    for ($i = 0; $i < $fusion->ingredient[0]->base_stars; $i ++){
 ?>
-                                                            <a target="_blank" title='<?=$mon_title?>' href='/<?=$UID?>/monsters/<?=$owned->id?>'>
-                                                                <div class='monster_panel'>
-                                                                    <span class='stars'>
+                                                        <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
 <?php
-                                                                        for ($i = 0; $i < $owned->stars; $i ++){
+                                                    }
 ?>
-                                                                            <img class='star <?=$star_class?>' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                                </span>
+                                                <img title='<?=$fusion->ingredient_unawaken[0]->name?>' class='monster border_<?=$fusion->ingredient_unawaken[0]->element_name?>' src='<?=$fusion->ingredient_unawaken[0]->get_image()?>'/>
+                                                <span class='level'>
+                                                    1
+                                                </span>
+                                            </div><!-- .unawakened .monster_panel -->
+                                        </a>
+                                        <div class='owned'>
+                                            <span class='owned'>
+                                                Collection:
+                                            </span>
 <?php
-                                                                        }
+                                            foreach ($fusion->ingredient[0]->owned as $owned){
 ?>
-                                                                    </span>
-                                                                    <img title='<?=$mon_title?>' class='monster border_<?=$owned->unit->element_name?>' src='<?=$owned->unit->get_image()?>'/>
-                                                                    <span class='level'>
-                                                                        <?=$owned->level?>
-                                                                    </span>
-                                                                </div>
-                                                            </a>
+                                                <div class='monster_panel'>
+                                                    <span class='stars'>
 <?php
+                                                        if ($owned->unit->awakens_from == "" && $owned->unit->awakens_to == ""){
+                                                            // No to, no from, silver monster.
+                                                            $star_class ="star_silver";
+                                                            $mon_title = $owned->unit->element_name . " " . $owned->unit->name;
                                                         }
+                                                        elseif ($owned->unit->awakens_from != "" && $owned->unit->awakens_to == ""){
+                                                            // Already awakened
+                                                            if ($owned->unit->base_stars - $owned->unit->natural_stars == 1){
+                                                                // Normal awaken.
+                                                                $star_class ="star_purple";
+                                                            }
+                                                            else{
+                                                                // Second awaken.
+                                                                $star_class ="star_red";
+                                                            }
+                                                            $mon_title = $owned->unit->name;
+                                                        }
+                                                        elseif ($owned->unit->awakens_to != ""){
+                                                            // Awakeable.
+                                                            $star_class ="star_gold";
+                                                            $mon_title = $owned->unit->element_name . " " . $owned->unit->name;
+                                                        }
+                                                        for ($i = 0; $i < $owned->stars; $i ++){
 ?>
-                                                    </div><!-- .owned -->
-                                                </div><!-- product -->
-                                            </div><!-- .f3 -->
-<?php
-                                            $num ++;
-                                        }
-?>
-                                    </div><!-- .ingredients -->
-                                </div><!-- .f4 -->
+                                                        <img class='star <?=$star_class?>' src='<?=URL::IMG["ICON"]?>star.png'/>
 <?php
-                            } // foreach ($fusion->product->owned as $owned)
+                                                        }
 ?>
-                            <!-- Last ingredient, non fuseable -->
-                            <div class='f4 extra'>
-                                <div class='product'>
-                                    <a target='_blank' title='<?=$fusion->ingredient[0]->name?>' href='/<?=$UID?>/catalog/<?=$fusion->ingredient[0]->id?>'>
-                                        <div class='awakened monster_panel'>
-                                            <span class='stars'>
-                                                <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
-                                                <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
-                                                <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
-                                                <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
-                                                <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
-                                            </span>
-                                            <img title='<?=$fusion->ingredient[0]->name?>' class='monster border_<?=$fusion->ingredient[0]->element_name?>' src='<?=$fusion->ingredient[0]->get_image()?>'/>
-                                            <span class='level'>
-                                                35
-                                            </span>
-                                        </div><!-- .awakened .monster_panel -->
-                                    </a>
-                                    <div class='essences'>
+                                                    </span>
+                                                    <img title='<?=$mon_title?>' class='monster border_<?=$owned->unit->element_name?>' src='<?=$owned->unit->get_image()?>'/>
+                                                    <span class='level'>
+                                                        <?=$owned->level?>
+                                                    </span>
+                                                </div>
 <?php
-                                        foreach ($fusion->ingredient_unawaken[0]->essences as $essence){
+                                            }
 ?>
-                                            <div class='essence border_<?=explode(" ", $essence["item"]->name)[2]?>'>
-                                                <img alt='<?=$essence["item"]->name?>' title='<?=$essence["amount"]?>x <?=$essence["item"]->name?>' class='essence' src='<?=$essence["item"]->get_image()?>'/>
-                                                <span>
-                                                    <?=$essence["amount"]?>
-                                                </span>
-                                            </div>
+                                        </div><!-- .owned -->
+                                    </td>
+                                </tr>
+                                <tr>
+<?php
+                                foreach ($fusion->fusion as $sub_fusion){
+                                    $num = 0;
+                                    foreach ($sub_fusion->ingredient as $sub_monster){
+?>
+                                        <td class='f3'>
+                                            <a target='_blank' title='<?=$sub_monster->name?>' href='/<?=$UID?>/catalog/<?=$sub_monster->id?>'>
+                                                <div class='awakened monster_panel'>
+                                                    <span class='stars'>
+                                                        <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                                        <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                                        <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                                        <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                                    </span>
+                                                    <img title='<?=$sub_monster->name?>' class='monster border_<?=$sub_monster->element_name?>' src='<?=$sub_monster->get_image()?>'/>
+                                                    <span class='level'>
+                                                        30
+                                                    </span>
+                                                </div><!-- .awakened .monster_panel -->
+                                            </a>
+                                            <div class='essences'>
 <?php
-                                        }
+                                                foreach ($sub_fusion->ingredient_unawaken[$num]->essences as $essence){
 ?>
-                                    </div><!-- .essences -->
-                                    <a target='_blank' title='<?=$fusion->ingredient_unawaken[0]->name?>' href='/<?=$UID?>/catalog/<?=$fusion->ingredient_unawaken[0]->id?>'>
-                                        <div class='unawakened monster_panel'>
-                                            <span class='stars'>
+                                                    <div class='essence border_<?=explode(" ", $essence["item"]->name)[2]?>'>
+                                                        <img alt='<?=$essence["item"]->name?>' title='<?=$essence["amount"]?>x <?=$essence["item"]->name?>' class='essence' src='<?=$essence["item"]->get_image()?>'/>
+                                                        <span>
+                                                            <?=$essence["amount"]?>
+                                                        </span>
+                                                    </div>
 <?php
-                                                for ($i = 0; $i < $fusion->ingredient[0]->base_stars; $i ++){
+                                                }
 ?>
-                                                    <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                            </div><!-- .essences -->
+                                            <a target='_blank' title='<?=$sub_fusion->ingredient_unawaken[$num]->name?>' href='/<?=$UID?>/catalog/<?=$sub_fusion->ingredient_unawaken[$num]->id?>'>
+                                                <div class='unawakened monster_panel'>
+                                                    <span class='stars'>
 <?php
-                                                }
+                                                        for ($i = 0; $i < $sub_fusion->ingredient_unawaken[$num]->base_stars; $i ++){
 ?>
-                                            </span>
-                                            <img title='<?=$fusion->ingredient_unawaken[0]->name?>' class='monster border_<?=$fusion->ingredient_unawaken[0]->element_name?>' src='<?=$fusion->ingredient_unawaken[0]->get_image()?>'/>
-                                            <span class='level'>
-                                                1
-                                            </span>
-                                        </div><!-- .unawakened .monster_panel -->
-                                    </a>
-                                    <div class='owned'>
-                                        <span class='owned'>
-                                            Collection:
-                                        </span>
+                                                            <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
 <?php
-                                        foreach ($fusion->ingredient[0]->owned as $owned){
+                                                        }
 ?>
-                                            <div class='monster_panel'>
-                                                <span class='stars'>
+                                                    </span>
+                                                    <img title='<?=$sub_fusion->ingredient_unawaken[$num]->name?>' class='monster border_<?=$sub_fusion->ingredient_unawaken[$num]->element_name?>' src='<?=$sub_fusion->ingredient_unawaken[$num]->get_image()?>'/>
+                                                    <span class='level'>
+                                                        1
+                                                    </span>
+                                                </div><!-- .unawakened .monster_panel -->
+                                            </a>
+                                            <div class='owned'>
+                                                <span class='owned'>
+                                                    Collection:
+                                                </span>
 <?php
+                                                foreach ($sub_monster->owned as $owned){
                                                     if ($owned->unit->awakens_from == "" && $owned->unit->awakens_to == ""){
                                                         // No to, no from, silver monster.
                                                         $star_class ="star_silver";
@@ -448,30 +391,47 @@
                                                         $star_class ="star_gold";
                                                         $mon_title = $owned->unit->element_name . " " . $owned->unit->name;
                                                     }
-                                                    for ($i = 0; $i < $owned->stars; $i ++){
+                                                    $mon_title = $mon_title . " - " . $owned->stars . "* - Lv." . $owned->level;
 ?>
-                                                    <img class='star <?=$star_class?>' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                                    <a target="_blank" title='<?=$mon_title?>' href='/<?=$UID?>/monsters/<?=$owned->id?>'>
+                                                        <div class='monster_panel'>
+                                                            <span class='stars'>
 <?php
-                                                    }
+                                                                for ($i = 0; $i < $owned->stars; $i ++){
 ?>
-                                                </span>
-                                                <img title='<?=$mon_title?>' class='monster border_<?=$owned->unit->element_name?>' src='<?=$owned->unit->get_image()?>'/>
-                                                <span class='level'>
-                                                    <?=$owned->level?>
-                                                </span>
-                                            </div>
+                                                                    <img class='star <?=$star_class?>' src='<?=URL::IMG["ICON"]?>star.png'/>
+<?php
+                                                                }
+?>
+                                                            </span>
+                                                            <img title='<?=$mon_title?>' class='monster border_<?=$owned->unit->element_name?>' src='<?=$owned->unit->get_image()?>'/>
+                                                            <span class='level'>
+                                                                <?=$owned->level?>
+                                                            </span>
+                                                        </div>
+                                                    </a>
+<?php
+                                                }
+?>
+                                            </div><!-- .owned -->
+                                        </td>
+<?php
+                                        $num ++;
+                                    }
+                                }
+?>
+                                <td class='empty' colspan='4'>
+                                </td>
+                            </tr>
+                        </table>
 <?php
-                                        }
+                    }
 ?>
-                                    </div><!-- .owned -->
-                                </div><!-- .product -->
-                            </div><!-- .f4 -->
-                        </div><!-- .ingredients -->
-                    </div><!-- .f5 -->
+                    
                 </article>
             </section>
+        </main>
 <?php
-        } // foreach ($page->fusion as $fusion)
         include __DIR__ . "/inc/footer.php";
 ?>
     </body>

+ 224 - 197
application/view/guild.php

@@ -40,252 +40,279 @@
     <body>
 <?php
         include __DIR__ . "/inc/header.php";
-        if (!isset($page->guild)){
 ?>
-            <section id='no_guild'>
+        <aside>
+<?php
+            if (!isset($page->guild)){
+?>
                 <h2>
                     Guild
                 </h2>
-                You are not currently in a guild.
-            </section>
+                <p>
+                    You are not currently in a guild.
+                </p>
 <?php
-        }
-        else{
+            }
+            else{
 ?>
-            <section id='guild_info' class='content'>
                 <h2>
                     <?=$page->guild->name?>
                 </h2>
-                <div id='guild_details'>
-                    <span id='guild_level'>
-                        Lv. <?=$page->guild->level?>
-                    </span>
-                    <span id='guild_experience'>
-                        (Exp: <?=$page->guild->experience?>)
-                    </span>
-                    <p id='guild_comment'>
-                        <?=$page->guild->comment?>
-                    </p>
-                    <p id='guild_notice'>
-                        <?=$page->guild->notice?>
-                    </p>
-                    <div id='guild_skills'>
+                <span id='guild_level'>
+                    Lv. <?=$page->guild->level?>
+                </span>
+                <span id='guild_experience'>
+                    (Exp: <?=$page->guild->experience?>)
+                </span>
+                <p id='guild_comment'>
+                    <?=$page->guild->comment?>
+                </p>
+                <p id='guild_notice'>
+                    <?=$page->guild->notice?>
+                </p>
+<?php
+            }
+?>
+        </aside>
+        <main>
+<?php
+            if (!isset($page->guild)){
+?>
+                <section id='no_guild'>
+                    <h2>
+                        Guild
+                    </h2>
+                    You are not currently in a guild.
+                </section>
 <?php
-                        foreach ($page->skill_groups as $group){
+            }
+            else{
 ?>
-                            <div class='skill_group'>
-                                <span class='skill_group_title'>
-                                    <?=$group->name?>
-                                </span>
-                                <img class='skill_group_image' alt='<?=$group->name?>' src='<?=$group->get_image()?>'/>
-                                <div class='skill_group_content'>
-                                    <span class='description'>
-                                        <?=$group->description?>
+                <section id='guild_info' class='content'>
+                    <h2>
+                        <?=$page->guild->name?>
+                    </h2>
+                    <div id='guild_details'>
+                        <div id='guild_skills'>
+<?php
+                            foreach ($page->skill_groups as $group){
+?>
+                                <div class='skill_group'>
+                                    <span class='skill_group_title'>
+                                        <?=$group->name?>
                                     </span>
-                                    <ul>
+                                    <img class='skill_group_image' alt='<?=$group->name?>' src='<?=$group->get_image()?>'/>
+                                    <div class='skill_group_content'>
+                                        <span class='description'>
+                                            <?=$group->description?>
+                                        </span>
+                                        <ul>
 <?php
-                                        foreach ($group->skills as $skill){
-                                            if ($skill->level > $page->guild->level){
-                                                $unavailable = "unavailable";
-                                            }
-                                            else{
-                                                $unavailable = "";
-                                            }
+                                            foreach ($group->skills as $skill){
+                                                if ($skill->level > $page->guild->level){
+                                                    $unavailable = "unavailable";
+                                                }
+                                                else{
+                                                    $unavailable = "";
+                                                }
 ?>
-                                            <li class='<?=$unavailable?>'>
-                                                Lv. <?=$skill->level?>: <?=$skill->effect?>
-                                            </li>
+                                                <li class='<?=$unavailable?>'>
+                                                    Lv. <?=$skill->level?>: <?=$skill->effect?>
+                                                </li>
 <?php
-                                        }
+                                            }
 ?>
-                                    </ul>
+                                        </ul>
+                                    </div>
                                 </div>
-                            </div>
 <?php
-                        }
+                            }
 ?>
+                        </div>
                     </div>
-                </div>
-                <table id='guild_members'>
-                    <tr>
-                        <th>
-                            &nbsp;
-                        </th>
-                        <th>
-                            Name
-                        </th>
-                        <th>
-                            Lv.
-                        </th>
-                        <th colspan='2'>
-                            Arena
-                        </th>
-                        <th>
-                            War
-                        </th>
-                        <th>
-                            Def
-                        </th>
-                        <th>
-                            Login
-                        </th>
-                    </tr>
+                    <table id='guild_members'>
+                        <tr>
+                            <th>
+                                &nbsp;
+                            </th>
+                            <th>
+                                Name
+                            </th>
+                            <th>
+                                Lv.
+                            </th>
+                            <th colspan='2'>
+                                Arena
+                            </th>
+                            <th>
+                                War
+                            </th>
+                            <th>
+                                Def
+                            </th>
+                            <th>
+                                Login
+                            </th>
+                        </tr>
 <?php
-                    $odd = "";
-                    foreach ($page->guild->members as $member){
+                        $odd = "";
+                        foreach ($page->guild->members as $member){
 ?>
-                        <tr>
-                            <td class='grade <?=$odd?>'>
+                            <tr>
+                                <td class='grade <?=$odd?>'>
 <?php
-                                if ($member->grade == GUILD_MEMBER_GRADE_ID::LEADER){
+                                    if ($member->grade == GUILD_MEMBER_GRADE_ID::LEADER){
 ?>
-                                    <img alt='yes' src='<?=URL::IMG["ICON"] . "leader.png"?>'/>
+                                        <img alt='yes' src='<?=URL::IMG["ICON"] . "leader.png"?>'/>
 <?php
-                                }
-                                elseif ($member->grade == GUILD_MEMBER_GRADE_ID::VICELEADER){
+                                    }
+                                    elseif ($member->grade == GUILD_MEMBER_GRADE_ID::VICELEADER){
 ?>
-                                    <img alt='yes' src='<?=URL::IMG["ICON"] . "viceleader.png"?>'/>
+                                        <img alt='yes' src='<?=URL::IMG["ICON"] . "viceleader.png"?>'/>
 <?php
-                                }
+                                    }
 ?>
-                            </td>
-                            <td class='name <?=$odd?>'>
-                                <?=$member->name?>
-                            </td>
-                            <td class='level <?=$odd?>'>
-                                <?=$member->level?>
-                            </td>
-                            <td class='score <?=$odd?>'>
-                                <?=$member->arena_score?>
-                            </td>
-                            <td class='score_icon <?=$odd?>'>
+                                </td>
+                                <td class='name <?=$odd?>'>
+                                    <?=$member->name?>
+                                </td>
+                                <td class='level <?=$odd?>'>
+                                    <?=$member->level?>
+                                </td>
+                                <td class='score <?=$odd?>'>
+                                    <?=$member->arena_score?>
+                                </td>
+                                <td class='score_icon <?=$odd?>'>
 <?php
-                                if ($member->arena_score >= ARENA_RANKING_POINTS::BEGINER && (ARENA_RANKING_RANK::BEGINER == null || $member->rating <= ARENA_RANKING_RANK::BEGINER)){
-                                    $src = URL::IMG["RANK"] . "0900.png";
-                                    $tit = "Beginer";
-                                }
-                                if ($member->arena_score >= ARENA_RANKING_POINTS::CHALLENGER_1 && (ARENA_RANKING_RANK::CHALLENGER_1 == null || $member->rating <= ARENA_RANKING_RANK::CHALLENGER_1)){
-                                    $src = URL::IMG["RANK"] . "1001.png";
-                                    $tit = "Challenger 1";
-                                }
-                                if ($member->arena_score >= ARENA_RANKING_POINTS::CHALLENGER_2 && (ARENA_RANKING_RANK::CHALLENGER_2 == null || $member->rating <= ARENA_RANKING_RANK::CHALLENGER_2)){
-                                    $src = URL::IMG["RANK"] . "1002.png";
-                                    $tit = "Challenger 2";
-                                }
-                                if ($member->arena_score >= ARENA_RANKING_POINTS::CHALLENGER_3 && (ARENA_RANKING_RANK::CHALLENGER_3 == null || $member->rating <= ARENA_RANKING_RANK::CHALLENGER_3)){
-                                    $src = URL::IMG["RANK"] . "1003.png";
-                                    $tit = "Challenger 3";
-                                }
-                                if ($member->arena_score >= ARENA_RANKING_POINTS::FIGHTER_1 && (ARENA_RANKING_RANK::FIGHTER_1 == null || $member->rating <= ARENA_RANKING_RANK::FIGHTER_1)){
-                                    $src = URL::IMG["RANK"] . "2001.png";
-                                    $tit = "Fighter 1";
-                                }
-                                if ($member->arena_score >= ARENA_RANKING_POINTS::FIGHTER_2 && (ARENA_RANKING_RANK::FIGHTER_2 == null || $member->rating <= ARENA_RANKING_RANK::FIGHTER_2)){
-                                    $src = URL::IMG["RANK"] . "2002.png";
-                                    $tit = "Fighter 2";
-                                }
-                                if ($member->arena_score >= ARENA_RANKING_POINTS::FIGHTER_3 && (ARENA_RANKING_RANK::FIGHTER_3 == null || $member->rating <= ARENA_RANKING_RANK::FIGHTER_3)){
-                                    $src = URL::IMG["RANK"] . "2003.png";
-                                    $tit = "Fighter 3";
-                                }
-                                if ($member->arena_score >= ARENA_RANKING_POINTS::CONQUEROR_1 && (ARENA_RANKING_RANK::CONQUEROR_1 == null || $member->rating <= ARENA_RANKING_RANK::CONQUEROR_1)){
-                                    $src = URL::IMG["RANK"] . "3001.png";
-                                    $tit = "Conqueror 1";
-                                }
-                                if ($member->arena_score >= ARENA_RANKING_POINTS::CONQUEROR_2 && (ARENA_RANKING_RANK::CONQUEROR_2 == null || $member->rating <= ARENA_RANKING_RANK::CONQUEROR_2)){
-                                    $src = URL::IMG["RANK"] . "3002.png";
-                                    $tit = "Conqueror 2";
-                                }
-                                if ($member->arena_score >= ARENA_RANKING_POINTS::CONQUEROR_3 && (ARENA_RANKING_RANK::CONQUEROR_3 == null || $member->rating <= ARENA_RANKING_RANK::CONQUEROR_3)){
-                                    $src = URL::IMG["RANK"] . "3003.png";
-                                    $tit = "Conqueror 3";
-                                }
-                                if ($member->arena_score >= ARENA_RANKING_POINTS::GUARDIAN_1 && (ARENA_RANKING_RANK::GUARDIAN_1 == null || $member->rating <= ARENA_RANKING_RANK::GUARDIAN_1)){
-                                    $src = URL::IMG["RANK"] . "4001.png";
-                                    $tit = "Guardian 1";
-                                }
-                                if ($member->arena_score >= ARENA_RANKING_POINTS::GUARDIAN_2 && (ARENA_RANKING_RANK::GUARDIAN_2 == null || $member->rating <= ARENA_RANKING_RANK::GUARDIAN_2)){
-                                    $src = URL::IMG["RANK"] . "4002.png";
-                                    $tit = "Guardian 2";
-                                }
-                                if ($member->arena_score >= ARENA_RANKING_POINTS::GUARDIAN_3 && (ARENA_RANKING_RANK::GUARDIAN_3 == null || $member->rating <= ARENA_RANKING_RANK::GUARDIAN_3)){
-                                    $src = URL::IMG["RANK"] . "4003.png";
-                                    $tit = "Guardian 3";
-                                }
-                                if ($member->arena_score >= ARENA_RANKING_POINTS::LEGEND && (ARENA_RANKING_RANK::LEGEND == null || $member->rating <= ARENA_RANKING_RANK::LEGEND)){
-                                    $src = URL::IMG["RANK"] . "5001.png";
-                                    $tit = "Legend";
-                                }
+                                    if ($member->arena_score >= ARENA_RANKING_POINTS::BEGINER && (ARENA_RANKING_RANK::BEGINER == null || $member->rating <= ARENA_RANKING_RANK::BEGINER)){
+                                        $src = URL::IMG["RANK"] . "0900.png";
+                                        $tit = "Beginer";
+                                    }
+                                    if ($member->arena_score >= ARENA_RANKING_POINTS::CHALLENGER_1 && (ARENA_RANKING_RANK::CHALLENGER_1 == null || $member->rating <= ARENA_RANKING_RANK::CHALLENGER_1)){
+                                        $src = URL::IMG["RANK"] . "1001.png";
+                                        $tit = "Challenger 1";
+                                    }
+                                    if ($member->arena_score >= ARENA_RANKING_POINTS::CHALLENGER_2 && (ARENA_RANKING_RANK::CHALLENGER_2 == null || $member->rating <= ARENA_RANKING_RANK::CHALLENGER_2)){
+                                        $src = URL::IMG["RANK"] . "1002.png";
+                                        $tit = "Challenger 2";
+                                    }
+                                    if ($member->arena_score >= ARENA_RANKING_POINTS::CHALLENGER_3 && (ARENA_RANKING_RANK::CHALLENGER_3 == null || $member->rating <= ARENA_RANKING_RANK::CHALLENGER_3)){
+                                        $src = URL::IMG["RANK"] . "1003.png";
+                                        $tit = "Challenger 3";
+                                    }
+                                    if ($member->arena_score >= ARENA_RANKING_POINTS::FIGHTER_1 && (ARENA_RANKING_RANK::FIGHTER_1 == null || $member->rating <= ARENA_RANKING_RANK::FIGHTER_1)){
+                                        $src = URL::IMG["RANK"] . "2001.png";
+                                        $tit = "Fighter 1";
+                                    }
+                                    if ($member->arena_score >= ARENA_RANKING_POINTS::FIGHTER_2 && (ARENA_RANKING_RANK::FIGHTER_2 == null || $member->rating <= ARENA_RANKING_RANK::FIGHTER_2)){
+                                        $src = URL::IMG["RANK"] . "2002.png";
+                                        $tit = "Fighter 2";
+                                    }
+                                    if ($member->arena_score >= ARENA_RANKING_POINTS::FIGHTER_3 && (ARENA_RANKING_RANK::FIGHTER_3 == null || $member->rating <= ARENA_RANKING_RANK::FIGHTER_3)){
+                                        $src = URL::IMG["RANK"] . "2003.png";
+                                        $tit = "Fighter 3";
+                                    }
+                                    if ($member->arena_score >= ARENA_RANKING_POINTS::CONQUEROR_1 && (ARENA_RANKING_RANK::CONQUEROR_1 == null || $member->rating <= ARENA_RANKING_RANK::CONQUEROR_1)){
+                                        $src = URL::IMG["RANK"] . "3001.png";
+                                        $tit = "Conqueror 1";
+                                    }
+                                    if ($member->arena_score >= ARENA_RANKING_POINTS::CONQUEROR_2 && (ARENA_RANKING_RANK::CONQUEROR_2 == null || $member->rating <= ARENA_RANKING_RANK::CONQUEROR_2)){
+                                        $src = URL::IMG["RANK"] . "3002.png";
+                                        $tit = "Conqueror 2";
+                                    }
+                                    if ($member->arena_score >= ARENA_RANKING_POINTS::CONQUEROR_3 && (ARENA_RANKING_RANK::CONQUEROR_3 == null || $member->rating <= ARENA_RANKING_RANK::CONQUEROR_3)){
+                                        $src = URL::IMG["RANK"] . "3003.png";
+                                        $tit = "Conqueror 3";
+                                    }
+                                    if ($member->arena_score >= ARENA_RANKING_POINTS::GUARDIAN_1 && (ARENA_RANKING_RANK::GUARDIAN_1 == null || $member->rating <= ARENA_RANKING_RANK::GUARDIAN_1)){
+                                        $src = URL::IMG["RANK"] . "4001.png";
+                                        $tit = "Guardian 1";
+                                    }
+                                    if ($member->arena_score >= ARENA_RANKING_POINTS::GUARDIAN_2 && (ARENA_RANKING_RANK::GUARDIAN_2 == null || $member->rating <= ARENA_RANKING_RANK::GUARDIAN_2)){
+                                        $src = URL::IMG["RANK"] . "4002.png";
+                                        $tit = "Guardian 2";
+                                    }
+                                    if ($member->arena_score >= ARENA_RANKING_POINTS::GUARDIAN_3 && (ARENA_RANKING_RANK::GUARDIAN_3 == null || $member->rating <= ARENA_RANKING_RANK::GUARDIAN_3)){
+                                        $src = URL::IMG["RANK"] . "4003.png";
+                                        $tit = "Guardian 3";
+                                    }
+                                    if ($member->arena_score >= ARENA_RANKING_POINTS::LEGEND && (ARENA_RANKING_RANK::LEGEND == null || $member->rating <= ARENA_RANKING_RANK::LEGEND)){
+                                        $src = URL::IMG["RANK"] . "5001.png";
+                                        $tit = "Legend";
+                                    }
 ?>
-                                <img alt='<?=$tit?>' src='<?=$src?>'/>
-                            </td>
-                            <td class='war <?=$odd?>'>
+                                    <img alt='<?=$tit?>' src='<?=$src?>'/>
+                                </td>
+                                <td class='war <?=$odd?>'>
 <?php
-                                if ($member->in_war){
+                                    if ($member->in_war){
 ?>
-                                    <img alt='yes' src='<?=URL::IMG["ICON"] . "ok.png"?>'/>
+                                        <img alt='yes' src='<?=URL::IMG["ICON"] . "ok.png"?>'/>
 <?php
-                                }
+                                    }
 ?>
-                            </td>
-                            <td class='defense <?=$odd?>'>
+                                </td>
+                                <td class='defense <?=$odd?>'>
 <?php
-                                if ($member->has_defense){
+                                    if ($member->has_defense){
 ?>
-                                    <img alt='yes' src='<?=URL::IMG["ICON"] . "ok.png"?>'/>
+                                        <img alt='yes' src='<?=URL::IMG["ICON"] . "ok.png"?>'/>
 <?php
-                                }
+                                    }
 ?>
-                            </td>
+                                </td>
 <?php
-                            $now = time();
-                            $date = (new DateTime("@$member->last_login"))->format('Y-m-d H:i:s');
-                            $days = $now - strtotime($date);
-                            $days = floor($days / (60 * 60 * 24));
-                            if ($days == 0){
-                                $hours = floor($days / (60 * 60));
-                                if ($hours == 0){
-                                    $last_login = "Online";
-                                }
-                                else if ($hours == 1){
-                                    $last_login = "1 hour";
+                                $now = time();
+                                $date = (new DateTime("@$member->last_login"))->format('Y-m-d H:i:s');
+                                $days = $now - strtotime($date);
+                                $days = floor($days / (60 * 60 * 24));
+                                if ($days == 0){
+                                    $hours = floor($days / (60 * 60));
+                                    if ($hours == 0){
+                                        $last_login = "Online";
+                                    }
+                                    else if ($hours == 1){
+                                        $last_login = "1 hour";
+                                    }
+                                    else{
+                                        $last_login = floor($days / (60 * 60)) . " hours";
+                                    }
+                                    $warning = "";
                                 }
                                 else{
-                                    $last_login = floor($days / (60 * 60)) . " hours";
+                                    $last_login = "$days days";
+                                    if ($days < 2){
+                                        $last_login = "$days day";
+                                        $warning = "";
+                                    }
+                                    elseif ($days < 5){
+                                        $warning = "warning";
+                                    }
+                                    else{
+                                        $warning = "danger";
+                                    }
                                 }
-                                $warning = "";
+?>
+                                <td class='last_login <?=$odd?> <?=$warning?>'>
+                                    <?=$last_login?>
+                                </td>
+                            </tr>
+<?php
+                            if ($odd == ""){
+                                $odd = "odd";
                             }
                             else{
-                                $last_login = "$days days";
-                                if ($days < 2){
-                                    $last_login = "$days day";
-                                    $warning = "";
-                                }
-                                elseif ($days < 5){
-                                    $warning = "warning";
-                                }
-                                else{
-                                    $warning = "danger";
-                                }
+                                $odd = "";
                             }
+                        }
 ?>
-                            <td class='last_login <?=$odd?> <?=$warning?>'>
-                                <?=$last_login?>
-                            </td>
-                        </tr>
+                    </table>
+                </section>
 <?php
-                        if ($odd == ""){
-                            $odd = "odd";
-                        }
-                        else{
-                            $odd = "";
-                        }
-                    }
+            }
 ?>
-                </table>
-            </section>
+        </main>
 <?php
-        }
         include __DIR__ . "/inc/footer.php";
 ?>
     </body>

+ 404 - 399
application/view/home.php

@@ -41,488 +41,493 @@
 <?php
         include __DIR__ . "/inc/header.php";
 ?>
-        <section class='content'>
+        <aside>
             <h2>
-                <span>
-                    Summoners War DataBase
-                </span>
+                <?=$page->player->name?>
             </h2>
-            <article id='profile'>
-                <div class='panel' id='panel_left'>
-                    <div id='player' class='profile_section'>
-                        <h4>
-                            <?=$page->player->name?>
-                        </h4>
-                        <table>
-                            <tr>
-                                <td class='label'>
-                                    Lv.
-                                </td>
-                                <td class='value'>
-                                    <?=$page->player->level?>
-                                </td>
-                            </tr>
-                            <tr>
-                                <td class='label'>
-                                    Exp.
-                                </td>
-                                <td class='value'>
-                                    <?=$page->player->experience?>
-                                </td>
-                            </tr>
-                            <tr>
-                                <td class='label'>
-                                    Country
-                                </td>
-                                <td class='value'>
-                                    <?=$page->player->country?>
-                                </td>
-                            </tr>
-                            <tr>
-                                <td class='label'>
-                                    Since
-                                </td>
-                                <td class='value'>
-                                    <?=date('Y-m-d', $page->player->joined)?>
-                                </td>
-                            </tr>
-                            <tr>
-                                <td class='label'>
-                                    Days
-                                </td>
-                                <td class='value'>
-                                    <?=round((time() - $page->player->joined) / (60 * 60 * 24))?>
-                                </td>
-                            </tr>
-                        </table>
-                    </div>
-                    <div id='placements' class='profile_section'>
-                        <h4>
-                            Placements
-                        </h4>
-                        <div id='placements_rep'>
-                            <h5>
-                                Rep monster:
-                            </h5>
-                            <div class='monster_panel'>
-                                <?=HTML::unit_panel($page->player->rep)?>
-                            </div> <!-- .monster_panel -->
-                        </div>
-                        <div id='placements_arena'>
-                            <h5>
-                                Arena defense:
-                            </h5>
-<?php
-                            $first = true;
-                            foreach ($page->player->defense as $defense){
-?>
+            <p>
+                <?=$page->player->name?>'s profile
+            </p>
+            <table id='profile'>
+                <tr>
+                    <td class='label'>
+                        Lv.
+                    </td>
+                    <td class='value'>
+                        <?=$page->player->level?>
+                    </td>
+                </tr>
+                <tr>
+                    <td class='label'>
+                        Exp.
+                    </td>
+                    <td class='value'>
+                        <?=$page->player->experience?>
+                    </td>
+                </tr>
+                <tr>
+                    <td class='label'>
+                        Country
+                    </td>
+                    <td class='value'>
+                        <?=$page->player->country?>
+                    </td>
+                </tr>
+                <tr>
+                    <td class='label'>
+                        Since
+                    </td>
+                    <td class='value'>
+                        <?=date('Y-m-d', $page->player->joined)?>
+                    </td>
+                </tr>
+                <tr>
+                    <td class='label'>
+                        Days
+                    </td>
+                    <td class='value'>
+                        <?=round((time() - $page->player->joined) / (60 * 60 * 24))?>
+                    </td>
+                </tr>
+            </table>
+        </aside>
+        <main>
+            <section class='content'>
+                <h2>
+                    <span>
+                        Summoners War DataBase
+                    </span>
+                </h2>
+                <article id='profile'>
+                    <div class='panel' id='panel_left'>
+                        <div id='placements' class='profile_section'>
+                            <h4>
+                                Placements
+                            </h4>
+                            <div id='placements_rep'>
+                                <h5>
+                                    Rep monster:
+                                </h5>
                                 <div class='monster_panel'>
-                                    <?=HTML::unit_panel($defense)?>
-                                </div>
+                                    <?=HTML::unit_panel($page->player->rep)?>
+                                </div> <!-- .monster_panel -->
+                            </div>
+                            <div id='placements_arena'>
+                                <h5>
+                                    Arena defense:
+                                </h5>
+<?php
+                                $first = true;
+                                foreach ($page->player->defense as $defense){
+?>
+                                    <div class='monster_panel'>
+                                        <?=HTML::unit_panel($defense)?>
+                                    </div>
 <?php
-                                if ($first && isset($defense->unit->leader_skill) && ($defense->unit->leader_skill->area == $EFFECT_AREA["GENERAL"] || $defense->unit->leader_skill->area == $EFFECT_AREA["ARENA"])){
+                                    if ($first && isset($defense->unit->leader_skill) && ($defense->unit->leader_skill->area == $EFFECT_AREA["GENERAL"] || $defense->unit->leader_skill->area == $EFFECT_AREA["ARENA"])){
 ?>
-                                    <div class='skill'>
-                                        <img class='skill_img' title='<?=$defense->unit->leader_skill->create_description()?>' src='<?=$defense->unit->leader_skill->get_image()?>'/>
-                                    </div>
+                                        <div class='skill'>
+                                            <img class='skill_img' title='<?=$defense->unit->leader_skill->create_description()?>' src='<?=$defense->unit->leader_skill->get_image()?>'/>
+                                        </div>
 <?php
+                                    }
+                                    $first = false;
                                 }
-                                $first = false;
-                            }
 ?>
-                        </div>
-                        <div id='placements_gw'>
-                            <h5>
-                                Guild War defense:
-                            </h5>
+                            </div>
+                            <div id='placements_gw'>
+                                <h5>
+                                    Guild War defense:
+                                </h5>
 <?php
-                            $first = true;
-                            foreach ($page->player->gw_defense[0] as $defense){
+                                $first = true;
+                                foreach ($page->player->gw_defense[0] as $defense){
 ?>
-                                <div class='monster_panel'>
-                                    <?=HTML::unit_panel($defense)?>
-                                </div>
+                                    <div class='monster_panel'>
+                                        <?=HTML::unit_panel($defense)?>
+                                    </div>
 <?php
-                                if ($first && isset($defense->unit->leader_skill) && ($defense->unit->leader_skill->area == $EFFECT_AREA["GENERAL"] || $defense->unit->leader_skill->area == $EFFECT_AREA["ARENA"])){
+                                    if ($first && isset($defense->unit->leader_skill) && ($defense->unit->leader_skill->area == $EFFECT_AREA["GENERAL"] || $defense->unit->leader_skill->area == $EFFECT_AREA["ARENA"])){
 ?>
-                                    <div class='skill'>
-                                        <img class='skill_img' title='<?=$defense->unit->leader_skill->create_description()?>' src='<?=$defense->unit->leader_skill->get_image()?>'/>
-                                    </div>
+                                        <div class='skill'>
+                                            <img class='skill_img' title='<?=$defense->unit->leader_skill->create_description()?>' src='<?=$defense->unit->leader_skill->get_image()?>'/>
+                                        </div>
 <?php
+                                    }
+                                    $first = false;
                                 }
-                                $first = false;
-                            }
 ?>
-                            <hr/>
+                                <hr/>
                         <?php
-                            $first = true;
-                            foreach ($page->player->gw_defense[1] as $defense){
+                                $first = true;
+                                foreach ($page->player->gw_defense[1] as $defense){
 ?>
-                                <div class='monster_panel'>
-                                    <?=HTML::unit_panel($defense)?>
-                                </div>
+                                    <div class='monster_panel'>
+                                        <?=HTML::unit_panel($defense)?>
+                                    </div>
 <?php
-                                if ($first && isset($defense->unit->leader_skill) && ($defense->unit->leader_skill->area == $EFFECT_AREA["GENERAL"] || $defense->unit->leader_skill->area == $EFFECT_AREA["ARENA"])){
+                                    if ($first && isset($defense->unit->leader_skill) && ($defense->unit->leader_skill->area == $EFFECT_AREA["GENERAL"] || $defense->unit->leader_skill->area == $EFFECT_AREA["ARENA"])){
 ?>
-                                    <div class='skill'>
-                                        <img class='skill_img' title='<?=$defense->unit->leader_skill->create_description()?>' src='<?=$defense->unit->leader_skill->get_image()?>'/>
-                                    </div>
+                                        <div class='skill'>
+                                            <img class='skill_img' title='<?=$defense->unit->leader_skill->create_description()?>' src='<?=$defense->unit->leader_skill->get_image()?>'/>
+                                        </div>
 <?php
+                                    }
+                                    $first = false;
                                 }
-                                $first = false;
-                            }
 ?>
+                            </div>
                         </div>
-                    </div>
-                    <div id='building' class='profile_section'>
-                        <h4>
-                            Buildings
-                        </h4>
+                        <div id='building' class='profile_section'>
+                            <h4>
+                                Buildings
+                            </h4>
+<?php
+                            // Buildings
+                            $half = sizeof($page->player->building) / 2;
+                            $i = 0;
+                            foreach ($page->player->building as $building){
+                                if ($i == $half){
+?>
+                                    <br class='desktop'/>
 <?php
-                        // Buildings
-                        $half = sizeof($page->player->building) / 2;
-                        $i = 0;
-                        foreach ($page->player->building as $building){
-                            if ($i == $half){
+                                }
 ?>
-                                <br class='desktop'/>
+                                <?=HTML::building_panel($building)?>
 <?php
+                                $i ++;
                             }
 ?>
-                            <?=HTML::building_panel($building)?>
+                            <br/>
 <?php
-                            $i ++;
-                        }
+                            // Decorations
+                            $half = sizeof($page->player->decoration) / 2;
+                            $i = 0;
+                            foreach ($page->player->decoration as $decoration){
+                                if ($i == $half){
 ?>
-                        <br/>
+                                    <br class='desktop'/>
 <?php
-                        // Decorations
-                        $half = sizeof($page->player->decoration) / 2;
-                        $i = 0;
-                        foreach ($page->player->decoration as $decoration){
-                            if ($i == $half){
+                                }
 ?>
-                                <br class='desktop'/>
+                                <?=HTML::building_panel($decoration)?>
 <?php
+                                $i ++;
                             }
 ?>
-                            <?=HTML::building_panel($decoration)?>
-<?php
-                            $i ++;
-                        }
-?>
-                    </div>
-                    <div class='inventory profile_section' id='inventory'>
-                        <h4>
-                            Inventory
-                        </h4>
-                        <ul>
-                            <li>
-                                <img title='Energy' src='<?=URL::IMG["CURRENCY"]?>energy.png'/>
-                                <?=$page->player->currency["energy"]?> / <?=$page->player->currency["energy_max"]?>
-                            </li>
-                            <li>
-                                <img title='Arena Invitations' src='<?=URL::IMG["CURRENCY"]?>arenaenergy.png'/>
-                                <?=$page->player->currency["arena_energy"]?> / <?=$page->player->currency["arena_energy_max"]?>
-                            </li>
-                            <li>
-                                <img title='Dimensional Energy' src='<?=URL::IMG["CURRENCY"]?>dimensionenergy.png'/>
-                                <?=$page->player->currency["dimension_energy"]?> / <?=$page->player->currency["dimension_energy_max"]?>
-                            </li>
-                            <li>
-                                <img title='Dimensional Crystal' src='<?=URL::IMG["CURRENCY"]?>darkportalenergy.png'/>
-                                <?=$page->player->currency["darkportal_energy"]?> / <?=$page->player->currency["darkportal_energy_max"]?>
-                            </li>
-                            <li>
-                                <img title='Mana' src='<?=URL::IMG["CURRENCY"]?>mana.png'/>
-                                <?=$page->player->currency["mana"]?>
-                            </li>
-                            <li>
-                                <img title='Crystal' src='<?=URL::IMG["CURRENCY"]?>crystal.png'/>
-                                <?=$page->player->currency["crystal"]?>
-                            </li>
-                            <li>
-                                <img title='Social Points' src='<?=URL::IMG["CURRENCY"]?>socialpoint.png'/>
-                                <?=$page->player->currency["social_point"]?>
-                            </li>
-                            <li>
-                                <img title='Honor Points' src='<?=URL::IMG["CURRENCY"]?>honor.png'/>
-                                <?=$page->player->currency["honor_point"]?>
-                            </li>
-                            <li>
-                                <img title='Guild Points' src='<?=URL::IMG["CURRENCY"]?>guildpoint.png'/>
-                                <?=$page->player->currency["guild_point"]?>
-                            </li>
-                            <li>
-                                <img title='Honor Medals' src='<?=URL::IMG["CURRENCY"]?>badge.png'/>
-                                <?=$page->player->currency["honor_medal"]?>
-                            </li>
-                            <li>
-                                <img src='<?=URL::IMG["CURRENCY"]?>mark.png'/>
-                                <?=$page->player->currency["honor_mark"]?>
-                            </li>
-                            <li>
-                                <img title='Ancient Coins' src='<?=URL::IMG["CURRENCY"]?>ancientcoin.png'/>
-                                <?=$page->player->currency["event_coin"]?>
-                            </li>
-                            <li>
-                                <img title='Ancient Crystal' src='<?=URL::IMG["CURRENCY"]?>ancientstone.png'/>
-                                <?=$page->player->currency["ancient_stone"]?>
-                            </li>
-                            <li>
-                                <img title='Shapeshifting Stones' src='<?=URL::IMG["CURRENCY"]?>costumestone.png'/>
-                                <?=$page->player->currency["costume_point"]?>
-                            </li>
-                        </ul>
-<?php
-                        // Scrolls
-                        $half = sizeof($page->player->building) / 2;
-                        $i = 0;
-                        foreach ($page->player->inventory_scroll as $item){
-                            if ($half > 6 && $i == $half){
-?>
-                                <br class='desktop'/>
+                        </div>
+                        <div class='inventory profile_section' id='inventory'>
+                            <h4>
+                                Inventory
+                            </h4>
+                            <ul>
+                                <li>
+                                    <img title='Energy' src='<?=URL::IMG["CURRENCY"]?>energy.png'/>
+                                    <?=$page->player->currency["energy"]?> / <?=$page->player->currency["energy_max"]?>
+                                </li>
+                                <li>
+                                    <img title='Arena Invitations' src='<?=URL::IMG["CURRENCY"]?>arenaenergy.png'/>
+                                    <?=$page->player->currency["arena_energy"]?> / <?=$page->player->currency["arena_energy_max"]?>
+                                </li>
+                                <li>
+                                    <img title='Dimensional Energy' src='<?=URL::IMG["CURRENCY"]?>dimensionenergy.png'/>
+                                    <?=$page->player->currency["dimension_energy"]?> / <?=$page->player->currency["dimension_energy_max"]?>
+                                </li>
+                                <li>
+                                    <img title='Dimensional Crystal' src='<?=URL::IMG["CURRENCY"]?>darkportalenergy.png'/>
+                                    <?=$page->player->currency["darkportal_energy"]?> / <?=$page->player->currency["darkportal_energy_max"]?>
+                                </li>
+                                <li>
+                                    <img title='Mana' src='<?=URL::IMG["CURRENCY"]?>mana.png'/>
+                                    <?=$page->player->currency["mana"]?>
+                                </li>
+                                <li>
+                                    <img title='Crystal' src='<?=URL::IMG["CURRENCY"]?>crystal.png'/>
+                                    <?=$page->player->currency["crystal"]?>
+                                </li>
+                                <li>
+                                    <img title='Social Points' src='<?=URL::IMG["CURRENCY"]?>socialpoint.png'/>
+                                    <?=$page->player->currency["social_point"]?>
+                                </li>
+                                <li>
+                                    <img title='Honor Points' src='<?=URL::IMG["CURRENCY"]?>honor.png'/>
+                                    <?=$page->player->currency["honor_point"]?>
+                                </li>
+                                <li>
+                                    <img title='Guild Points' src='<?=URL::IMG["CURRENCY"]?>guildpoint.png'/>
+                                    <?=$page->player->currency["guild_point"]?>
+                                </li>
+                                <li>
+                                    <img title='Honor Medals' src='<?=URL::IMG["CURRENCY"]?>badge.png'/>
+                                    <?=$page->player->currency["honor_medal"]?>
+                                </li>
+                                <li>
+                                    <img src='<?=URL::IMG["CURRENCY"]?>mark.png'/>
+                                    <?=$page->player->currency["honor_mark"]?>
+                                </li>
+                                <li>
+                                    <img title='Ancient Coins' src='<?=URL::IMG["CURRENCY"]?>ancientcoin.png'/>
+                                    <?=$page->player->currency["event_coin"]?>
+                                </li>
+                                <li>
+                                    <img title='Ancient Crystal' src='<?=URL::IMG["CURRENCY"]?>ancientstone.png'/>
+                                    <?=$page->player->currency["ancient_stone"]?>
+                                </li>
+                                <li>
+                                    <img title='Shapeshifting Stones' src='<?=URL::IMG["CURRENCY"]?>costumestone.png'/>
+                                    <?=$page->player->currency["costume_point"]?>
+                                </li>
+                            </ul>
+<?php
+                            // Scrolls
+                            $half = sizeof($page->player->building) / 2;
+                            $i = 0;
+                            foreach ($page->player->inventory_scroll as $item){
+                                if ($half > 6 && $i == $half){
+?>
+                                    <br class='desktop'/>
 <?php
+                                }
+?>
+                                <?=HTML::item_panel($item)?>
+<?php
+                                $i ++;
                             }
 ?>
-                            <?=HTML::item_panel($item)?>
+                            <br/>
 <?php
-                            $i ++;
-                        }
+                            // Rune craft materials
+                            $prev = 0;
+                            foreach ($page->player->inventory_craft_rune as $item){
 ?>
-                        <br/>
+                                <?=HTML::item_panel($item)?>
 <?php
-                        // Rune craft materials
-                        $prev = 0;
-                        foreach ($page->player->inventory_craft_rune as $item){
+                                $prev = $item->id;
+                            }
 ?>
-                            <?=HTML::item_panel($item)?>
+                            <br/>
 <?php
-                            $prev = $item->id;
-                        }
+                            // Other craft materials
+                            $prev = 0;
+                            foreach ($page->player->inventory_craft as $item){
+                                if ($prev != 0 && $prev < 5000 && $item->id > 5000){
 ?>
-                        <br/>
+                                    <br class='desktop'/>
 <?php
-                        // Other craft materials
-                        $prev = 0;
-                        foreach ($page->player->inventory_craft as $item){
-                            if ($prev != 0 && $prev < 5000 && $item->id > 5000){
+                                }
 ?>
-                                <br class='desktop'/>
+                                <?=HTML::item_panel($item)?>
 <?php
+                                $prev = $item->id;
                             }
 ?>
-                            <?=HTML::item_panel($item)?>
+                            <br/>
 <?php
-                            $prev = $item->id;
-                        }
+                            // Essences
+                            $prev = "";
+                            $i = 0;
+                            foreach ($page->player->inventory_essence as $item){
+                                //if ($prev != "" && $prev != preg_split('/\s+/', $item->name)[2]){
+                                if ($i > 0 && $i % 6 == 0){
 ?>
-                        <br/>
+                                    <br class='desktop'/>
 <?php
-                        // Essences
-                        $prev = "";
-                        $i = 0;
-                        foreach ($page->player->inventory_essence as $item){
-                            //if ($prev != "" && $prev != preg_split('/\s+/', $item->name)[2]){
-                            if ($i > 0 && $i % 6 == 0){
+                                }
 ?>
-                                <br class='desktop'/>
+                                <?=HTML::item_panel($item)?>
 <?php
+                                $prev = preg_split('/\s+/', $item->name)[2];
+                                $i ++;
                             }
 ?>
-                            <?=HTML::item_panel($item)?>
-<?php
-                            $prev = preg_split('/\s+/', $item->name)[2];
-                            $i ++;
-                        }
-?>
-                    </div>
-                </div> <!-- #panel_left -->
-                <div class='panel' id='panel_right'>
-                    <div class='profile_section' id='records'>
-                        <h4>
-                            Records
-                        </h4>
-                        <div class='record'>
-                            <table id='rank_records'>
-                                <tr>
-                                    <td class='label'>
-                                        Arena
-                                    </td>
-                                    <td class='value rank'>
-                                        <?=HTML::arena_rank_icon($page->player->top_rank_arena)?>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <td class='label'>
-                                        World Arena
-                                    </td>
-                                    <td class='value rank'>
-                                        <?=HTML::arena_rank_icon($page->player->top_rank_world_arena)?>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <td class='label'>
-                                        Special League
-                                    </td>
-                                    <td class='value rank'>
-                                        <?=HTML::arena_rank_icon($page->player->top_rank_special_league)?>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <td class='label'>
-                                        Guild War
-                                    </td>
-                                    <td class='value rank'>
-                                        <?=HTML::arena_rank_icon($page->player->top_rank_gw - 10)?>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <td class='label'>
-                                        Siege Battle
-                                    </td>
-                                    <td class='value rank'>
-                                        <?=HTML::arena_rank_icon($page->player->top_rank_siege)?>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <td class='label'>
-                                        World Boss
-                                    </td>
-                                    <td class='value wboss'>
-                                        <?=WORLD_BOSS_RANK_ID::RANK[$page->player->top_rank_wboss]?>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <td class='label'>
-                                        Trial of Ascension (N)
-                                    </td>
-                                    <td class='value toa'>
-                                        <?=$page->player->top_rank_toan?>F
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <td class='label'>
-                                        Trial of Ascension (N)
-                                    </td>
-                                    <td class='value toa'>
-                                        <?=$page->player->top_rank_toah?>F
-                                    </td>
-                                </tr>
-                            </table>
-                            <table id='battle_records'>
-<?php
-                                foreach ($page->player->record as $record){
-?>
+                        </div>
+                    </div> <!-- #panel_left -->
+                    <div class='panel' id='panel_right'>
+                        <div class='profile_section' id='records'>
+                            <h4>
+                                Records
+                            </h4>
+                            <div class='record'>
+                                <table id='rank_records'>
                                     <tr>
-                                        <td class='record_dungeon'>
-                                            <img title='<?=$record->area->name?>' class='area' src='<?=$record->area->get_image()?>'/>
+                                        <td class='label'>
+                                            Arena
                                         </td>
-                                        <td class='record_info'>
-                                            <span class='title'>
-<?php
-                                                $title = "";
-                                                switch ($record->area->type){
-                                                    case AREA_TYPE_ID::CAIROS_DUNGEON:
-                                                        $title = $record->area->name . " " . $record->stage . "F";
-                                                        break;
-                                                    case AREA_TYPE_ID::RIFT_DUNGEON:
-                                                        $title = $record->area->name;
-                                                        break;
-                                                    case AREA_TYPE_ID::RIFT_RAID:
-                                                        $title = $record->area->name;
-                                                    
-                                                }
-?>
-                                                <?=$title?>
-                                            </span>
+                                        <td class='value rank'>
+                                            <?=HTML::arena_rank_icon($page->player->top_rank_arena)?>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class='label'>
+                                            World Arena
+                                        </td>
+                                        <td class='value rank'>
+                                            <?=HTML::arena_rank_icon($page->player->top_rank_world_arena)?>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class='label'>
+                                            Special League
+                                        </td>
+                                        <td class='value rank'>
+                                            <?=HTML::arena_rank_icon($page->player->top_rank_special_league)?>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class='label'>
+                                            Guild War
+                                        </td>
+                                        <td class='value rank'>
+                                            <?=HTML::arena_rank_icon($page->player->top_rank_gw - 10)?>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class='label'>
+                                            Siege Battle
+                                        </td>
+                                        <td class='value rank'>
+                                            <?=HTML::arena_rank_icon($page->player->top_rank_siege)?>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class='label'>
+                                            World Boss
+                                        </td>
+                                        <td class='value wboss'>
+                                            <?=WORLD_BOSS_RANK_ID::RANK[$page->player->top_rank_wboss]?>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class='label'>
+                                            Trial of Ascension (N)
+                                        </td>
+                                        <td class='value toa'>
+                                            <?=$page->player->top_rank_toan?>F
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class='label'>
+                                            Trial of Ascension (N)
+                                        </td>
+                                        <td class='value toa'>
+                                            <?=$page->player->top_rank_toah?>F
+                                        </td>
+                                    </tr>
+                                </table>
+                                <table id='battle_records'>
+<?php
+                                    foreach ($page->player->record as $record){
+?>
+                                        <tr>
+                                            <td class='record_dungeon'>
+                                                <img title='<?=$record->area->name?>' class='area' src='<?=$record->area->get_image()?>'/>
+                                            </td>
+                                            <td class='record_info'>
+                                                <span class='title'>
+<?php
+                                                    $title = "";
+                                                    switch ($record->area->type){
+                                                        case AREA_TYPE_ID::CAIROS_DUNGEON:
+                                                            $title = $record->area->name . " " . $record->stage . "F";
+                                                            break;
+                                                        case AREA_TYPE_ID::RIFT_DUNGEON:
+                                                            $title = $record->area->name;
+                                                            break;
+                                                        case AREA_TYPE_ID::RIFT_RAID:
+                                                            $title = $record->area->name;
+                                                        
+                                                    }
+?>
+                                                    <?=$title?>
+                                                </span>
 <?php
-                                            if ($record->area->type == AREA_TYPE_ID::RIFT_DUNGEON){
+                                                if ($record->area->type == AREA_TYPE_ID::RIFT_DUNGEON){
 ?>
-                                                <span class='score'>
-                                                    <?=$record->score?>
-                                                </span>
-                                                <span class='rank'>
-                                                    <?=$record->rank?>
-                                                </span>
+                                                    <span class='score'>
+                                                        <?=$record->score?>
+                                                    </span>
+                                                    <span class='rank'>
+                                                        <?=$record->rank?>
+                                                    </span>
 <?php
-                                            }
-                                            else{
-                                                $s = floor($record->time / 1000);
-                                                $m = floor($s / 60);
-                                                $s = floor($s % 60);
-                                                $ms = ($record-> time - (1000 * 60 * $m) - (1000 * 60 * $s) / 100);
-                                                $s = str_pad($s, 2, '0', STR_PAD_LEFT);
-                                                $ms = str_pad($ms, 2, '0', STR_PAD_LEFT);
-?>
-                                                <span class='time'>
-                                                    <?=$m?>:<?=$s?><span class='ms'>.<?=$ms?></span>
-                                                </span>
+                                                }
+                                                else{
+                                                    $s = floor($record->time / 1000);
+                                                    $m = floor($s / 60);
+                                                    $s = floor($s % 60);
+                                                    $ms = ($record-> time - (1000 * 60 * $m) - (1000 * 60 * $s) / 100);
+                                                    $s = str_pad($s, 2, '0', STR_PAD_LEFT);
+                                                    $ms = str_pad($ms, 2, '0', STR_PAD_LEFT);
+?>
+                                                    <span class='time'>
+                                                        <?=$m?>:<?=$s?><span class='ms'>.<?=$ms?></span>
+                                                    </span>
 <?php
-                                            }
+                                                }
 ?>
-                                        </td>
+                                            </td>
 <?php
-                                        $class_frontline = "";
-                                        if ($record->area->type == AREA_TYPE_ID::RIFT_DUNGEON || $record->area->type == AREA_TYPE_ID::RIFT_RAID){
-                                            $class_frontline = "frontlines";
-                                        }
+                                            $class_frontline = "";
+                                            if ($record->area->type == AREA_TYPE_ID::RIFT_DUNGEON || $record->area->type == AREA_TYPE_ID::RIFT_RAID){
+                                                $class_frontline = "frontlines";
+                                            }
 ?>
-                                        <td class='record_party <?=$class_frontline?>'>
+                                            <td class='record_party <?=$class_frontline?>'>
 <?php
-                                            $prev_front = false;
-                                            $front = "undefined";
-                                            foreach ($record->party as $party){
-                                                $front = in_array($party->id, $record->frontline);
-                                                if ($front != "undefined" && $prev_front != $front){
+                                                $prev_front = false;
+                                                $front = "undefined";
+                                                foreach ($record->party as $party){
+                                                    $front = in_array($party->id, $record->frontline);
+                                                    if ($front != "undefined" && $prev_front != $front){
 ?>
-                                                    <hr class='frontline'/>
+                                                        <hr class='frontline'/>
 <?php
-                                                }
-                                                if ($party instanceof K_Unit){
-                                                    $enable_save = false;
-                                                    $disabled = "disabled";
-                                                }
-                                                else{
-                                                    $disabled = "";
-                                                }
-                                                if ($disabled == ""){
+                                                    }
+                                                    if ($party instanceof K_Unit){
+                                                        $enable_save = false;
+                                                        $disabled = "disabled";
+                                                    }
+                                                    else{
+                                                        $disabled = "";
+                                                    }
+                                                    if ($disabled == ""){
 ?>
-                                                    <a target='_blank' href='/<?=$UID?>>/monster/<?=$party->id?>'>
+                                                        <a target='_blank' href='/<?=$UID?>>/monster/<?=$party->id?>'>
 <?php
-                                                }
+                                                    }
 ?>
-                                                <div class='monster_panel <?=$disabled?>'>
-                                                    <?=HTML::unit_panel($party)?>
+                                                    <div class='monster_panel <?=$disabled?>'>
+                                                        <?=HTML::unit_panel($party)?>
 <?php
-                                                        if ($party->id == $record->leader){
+                                                            if ($party->id == $record->leader){
 ?>
-                                                            <img alt='Leader' class='leader' src='<?=URL::IMG["ICON"]?>leader.png'/>
+                                                                <img alt='Leader' class='leader' src='<?=URL::IMG["ICON"]?>leader.png'/>
 <?php
-                                                        }
+                                                            }
 ?>
-                                                </div>
+                                                    </div>
 <?php
-                                                if ($disabled == ""){
+                                                    if ($disabled == ""){
 ?>
-                                                    </a>
+                                                        </a>
 <?php
+                                                    }
+                                                    $prev_front = $front;
                                                 }
-                                                $prev_front = $front;
-                                            }
 ?>
-                                        </td>
-                                    </tr>
-                                
+                                            </td>
+                                        </tr>
+                                    
 <?php
-                                }
+                                    }
 ?>
-                            </table>
+                                </table>
+                            </div>
                         </div>
-                    </div>
-                </div> <!-- #panel_right -->
-            </article>
-        </section>
+                    </div> <!-- #panel_right -->
+                </article>
+            </section>
+        </main>
 <?php
         include __DIR__ . "/inc/footer.php";
 ?>

+ 0 - 204
application/view/inc/filter_artifacts.php

@@ -1,204 +0,0 @@
-<?php
-    /**
-     * Artifact filter view.
-     *
-     * To be included from the artifact view.
-     *
-     * @category View
-     * @property_read mixed[] $filters Selected filters.
-     * @property_read int $page Player ID.
-     */
-
-    if (count($custom_filters) > 0){
-?>
-        <script>
-            /**
-             * Changes the filter description.
-             *
-             * @param id Filter id.
-             */
-            function customFilterDescription(id){
-                switch (id){
-<?php
-                    foreach($custom_filters AS $filter){
-?>
-                        case '<?=$filter->id?>':
-                            document.getElementById("custom_filter_description").style.display = 'block';
-                            document.getElementById("custom_filter_description").innerHTML = '<?=$filter->description?>';
-                            break;
-<?php
-                    }
-?>
-                }
-            }
-        </script>
-        <form action='/<?=$UID?>/artifacts/' method='get' id='custom_filter_artifacts' class='custom_filter'>
-            <span class='custom_filter_title'>Custom filters:</span>
-            <select name='custom_filter' onChange='customFilterDescription(this.value);' onload='customFilterDescription("<?=filter_input(INPUT_GET, 'custom_filter')?>");'>
-                <option> </option>
-<?php
-                 foreach($custom_filters AS $filter){
-                    if (filter_input(INPUT_GET, 'custom_filter') == $filter->id){
-                        $selected = "selected='selected'";
-                    }
-                    else{
-                        $selected = "";
-                    }
-?>
-                    <option value='<?=$filter->id?>' <?=$selected?>><?=$filter->name?></option>
-<?php
-                 }
-?>
-            </select>
-            <input type='submit' value='Apply'/>
-            <p id='custom_filter_description'> </p>
-            <script>
-                customFilterDescription("<?=filter_input(INPUT_GET, 'custom_filter')?>");
-            </script>
-        </form>
-<?php
-    }
-?>
-<form action='/<?=$UID?>/artifacts/' method='get' id='filter_artifacts' class='filter'>
-    <div class='custom_filters'>
-    <table>
-        <tr>
-            <td class='filter'>
-                <span>Element:</span>
-                <select multiple name='element[]' id='filter_element'>
-<?php
-                    $reflect = new ReflectionClass("ELEMENT_ID");
-                    foreach($reflect->getConstants() as $name => $id){
-                        if ($id != ELEMENT_ID::PURE){
-                            $selected = "";
-                            if (in_array($id, $filters["ELEMENT"])){
-                                $selected = "selected='selected'";
-                            }
-?>
-                            <option value='<?=$id?>' <?=$selected?>><?=$name?></option>
-<?php
-                        }
-                    }
-?>
-                </select>
-            </td>
-            <td class='filter'>
-                <span>Type:</span>
-                <select multiple name='archetype[]' id='filter_archetype'>
-<?php
-                    $reflect = new ReflectionClass("ARCHETYPE_ID");
-                    foreach($reflect->getConstants() as $name => $id){
-                        if ($id != ARCHETYPE_ID::NONE && $id != ARCHETYPE_ID::MATERIAL){
-                            $selected = "";
-                            if (in_array($id, $filters["ARCHETYPE"])){
-                                $selected = "selected='selected'";
-                            }
-?>
-                            <option value='<?=$id?>' <?=$selected?>><?=$name?></option>
-<?php
-                        }
-                    }
-?>
-                </select>
-            </td>
-            <td class='filter'>
-                <span>Main stat:</span>
-                <select multiple name='main_stat[]' id='filter_main_stat'>
-<?php
-                    $reflect = new ReflectionClass("ARTIFACT_STAT_ID");
-                    foreach($reflect->getConstants() as $name => $id){
-                        $selected = "";
-                        if (in_array($id, $filters["MAIN"])){
-                            $selected = "selected='selected'";
-                        }
-?>
-                        <option value='<?=$id?>' <?=$selected?>><?=$name?></option>
-<?php
-                    }
-?>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter'>
-                <span>Level:</span>
-                <input type='number' name='min_level' id='filter_level_min' min='0' max='15' value='<?=$filters["MIN_LEVEL"]?>'/>
-                -
-                <input type='number' name='max_level' id='filter_level_max' min='0' max='15' value='<?=$filters["MAX_LEVEL"]?>'/>
-            </td>
-            <td class='filter' colspan='2'>
-                <span>Quality:</span>
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["MIN_QUALITY"] - 1] = "selected";
-?>
-                <select name='min_quality' id='filter_quality_min'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-                -
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["MAX_QUALITY"] - 1] = "selected";
-?>
-                <select name='max_quality' id='filter_quality_max'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter'>
-                <span>
-                    Assigned:
-                </span>
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["ASSIGNED"]] = "selected";
-?>
-                <select name='assigned' id='filter_assigned'>
-                    <option value='0' <?=$selected[0]?>>All</option>
-                    <option value='1' <?=$selected[1]?>>Assigned</option>
-                    <option value='2' <?=$selected[2]?>>Unassigned</option>
-                    <option value='3' <?=$selected[3]?>>All (no storage)</option>
-                    <option value='4' <?=$selected[4]?>>Assigned (no storage)</option>
-                </select>
-            </td>
-            <td class='filter' colspan='2'>
-                <span>Original quality:</span>
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["MIN_ORIGINAL_QUALITY"] - 1] = "selected";
-?>
-                <select name='min_original_quality' id='filter_original_quality_min'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-                -
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["MAX_ORIGINAL_QUALITY"] - 1] = "selected";
-?>
-                <select name='max_original_quality' id='filter_original_quality_max'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-            </td>
-        </tr>
-    </table>
-    <div id='filter_apply'>
-        <input type='submit' value='Apply'/>
-    </div>
-</form>

+ 0 - 47
application/view/inc/filter_catalog.php

@@ -1,47 +0,0 @@
-<?php
-    /**
-     * Catalog filter view.
-     *
-     * To be included from the catalog view.
-     *
-     * @category View
-     * @property_read mixed[] $filters Selected filters.
-     * @property_read int $page Player ID.
-     */
-?>
-<form action='/<?=$UID?>/catalog/' method='get' id='filter_catalog' class='filter'>
-    <table>
-        <tr>
-            <td class='filter'>
-                <span>Element:</span>
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["ELEMENT"] - 1] = "selected";
-?>
-                <select name='element'>
-                    <option value='0'>All</option>
-                    <option value='<?=ELEMENT_ID::WATER?>' <?=$selected[0]?>>Water</option>
-                    <option value='<?=ELEMENT_ID::FIRE?>' <?=$selected[1]?>>Fire</option>
-                    <option value='<?=ELEMENT_ID::WIND?>' <?=$selected[2]?>>Wind</option>
-                    <option value='<?=ELEMENT_ID::LIGHT?>' <?=$selected[3]?>>Light</option>
-                    <option value='<?=ELEMENT_ID::DARK?>' <?=$selected[4]?>>Dark</option>
-                </select>
-            </td>
-            <td class='filter' id='filter_stars'>
-                <span>Stars:</span>
-                <input type='number' name='min_stars' id='filter_stars_min' min='1' max='5' value='<?=$filters["MIN_STARS"]?>'/>
-                -
-                <input type='number' name='max_stars' id='filter_stars_max' min='1' max='5' value='<?=$filters["MAX_STARS"]?>'/>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='2'>
-                <span>Name:</span>
-                <input type='text' name='name' id='filter_name' value='<?=$filters["NAME"]?>'/>
-            </td>
-        </tr>
-    </table>
-    <div id='filter_apply'>
-        <input type='submit' value='Apply'/>
-    </div>
-</form>

+ 0 - 161
application/view/inc/filter_enchantments.php

@@ -1,161 +0,0 @@
-<?php
-    /**
-     * Artifact filter view.
-     *
-     * To be included from the artifact view.
-     *
-     * @category View
-     * @property_read mixed[] $filters Selected filters.
-     * @property_read int $page Player ID.
-     */
-
-    if (count($custom_filters) > 0){
-?>
-        <script>
-            /**
-             * Changes the filter description.
-             *
-             * @param id Filter id.
-             */
-            function customFilterDescription(id){
-                switch (id){
-<?php
-                    foreach($custom_filters AS $filter){
-?>
-                        case '<?=$filter->id?>':
-                            document.getElementById("custom_filter_description").style.display = 'block';
-                            document.getElementById("custom_filter_description").innerHTML = '<?=$filter->description?>';
-                            break;
-<?php
-                    }
-?>
-                }
-            }
-        </script>
-        <form action='/<?=$UID?>/enchantments/' method='get' id='custom_filter_artifacts' class='custom_filter'>
-            <span class='custom_filter_title'>Custom filters:</span>
-            <select name='custom_filter' onChange='customFilterDescription(this.value);' onload='customFilterDescription("<?=filter_input(INPUT_GET, 'custom_filter')?>");'>
-                <option> </option>
-<?php
-                 foreach($custom_filters AS $filter){
-                    if (filter_input(INPUT_GET, 'custom_filter') == $filter->id){
-                        $selected = "selected='selected'";
-                    }
-                    else{
-                        $selected = "";
-                    }
-?>
-                    <option value='<?=$filter->id?>' <?=$selected?>><?=$filter->name?></option>
-<?php
-                 }
-?>
-            </select>
-            <input type='submit' value='Apply'/>
-            <p id='custom_filter_description'> </p>
-            <script>
-                customFilterDescription("<?=filter_input(INPUT_GET, 'custom_filter')?>");
-            </script>
-        </form>
-<?php
-    }
-?>
-<form action='/<?=$UID?>/enchantments/' method='get' id='filter_artifacts' class='filter'>
-    <div class='custom_filters'>
-    <table>
-        <tr>
-            <td class='filter'>
-                <span>Type:</span>
-                <select multiple name='type[]' id='filter_type'>
-<?php
-                    $selected = "";
-                    if (in_array("GRI", $filters["TYPE"])){
-                        $selected = "selected='selected'";
-                    }
-?>
-                    <option value='GRI' <?=$selected?>>Grindstone</option>
-<?php
-                    $selected = "";
-                    if (in_array("GEM", $filters["TYPE"])){
-                        $selected = "selected='selected'";
-                    }
-?>
-                    <option value='GEM' <?=$selected?>>Gem</option>
-                </select>
-            </td>
-            <td class='filter' colspan='2'>
-                <span>Quality:</span>
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["MIN_QUALITY"] - 1] = "selected";
-?>
-                <select name='min_quality' id='filter_quality_min'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-                -
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["MAX_QUALITY"] - 1] = "selected";
-?>
-                <select name='max_quality' id='filter_quality_max'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter'>
-                <span>Rune:</span>
-                <select multiple name='rune[]' id='filter_rune'>
-<?php
-                    $selected = "";
-                    if (in_array(0, $filters["RUNE"])){
-                        $selected = "selected='selected'";
-                    }
-?>
-                    <option value='0' <?=$selected?>>INMEMORIAL</option>
-<?php
-                    $reflect = new ReflectionClass("RUNE_SET_ID");
-                    foreach($reflect->getConstants() as $name => $id){
-                        $selected = "";
-                        if (in_array($id, $filters["RUNE"])){
-                            $selected = "selected='selected'";
-                        }
-?>
-                        <option value='<?=$id?>' <?=$selected?>><?=$name?></option>
-<?php
-                    }
-?>
-                </select>
-            </td>
-            <td class='filter'>
-                <span>Stat:</span>
-                <select multiple name='stat[]' id='filter_stat'>
-<?php
-                    $reflect = new ReflectionClass("RUNE_STAT_ID");
-                    foreach($reflect->getConstants() as $name => $id){
-                        $selected = "";
-                        if (in_array($id, $filters["STAT"])){
-                            $selected = "selected='selected'";
-                        }
-                        $name_format = ucwords(str_replace("_P", "%", $name));
-?>
-                        <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
-<?php
-                    }
-?>
-                </select>
-            </td>
-        </tr>
-    </table>
-    <div id='filter_apply'>
-        <input type='submit' value='Apply'/>
-    </div>
-    </div>
-</form>

+ 0 - 40
application/view/inc/filter_fusion.php

@@ -1,40 +0,0 @@
-<?php
-    /**
-     * Fusion filter view.
-     *
-     * To be included from the fusion view.
-     *
-     * @category View
-     * @property_read mixed[] $filters Selected filters.
-     * @property_read Fusion_Page $page The page model.
-     * @property_read int $page Player ID.
-     */
-?>
-<form action='/<?=$UID?>/fusion/' method='get' id='filter_fusion' class='filter'>
-    <table>
-        <tr>
-            <td class='filter'>
-                <span>Target:</span>
-                <select name='product' id='filter_product'>
-                    <option value=''>All</option>
-<?php
-                    foreach ($page->products as $product){
-                        if ($product->id == $page->filters["PRODUCT"]){
-                            $selected = "selected";
-                        }
-                        else{
-                            $selected = "";
-                        }
-?>
-                            <option value='<?=$product->id?>' <?=$selected?>><?=$product->element_name?> <?=$product->name?></option>
-<?php
-                    }
-?>
-                </select>
-            </td>
-        </tr>
-    </table>
-    <div id='filter_apply'>
-        <input type='submit' value='Apply'/>
-    </div>
-</form>

+ 0 - 71
application/view/inc/filter_monsters.php

@@ -1,71 +0,0 @@
-<?php
-    /**
-     * Monsters filter view.
-     *
-     * To be included from the monsters view.
-     *
-     * @category View
-     * @property_read mixed[] $filters Selected filters.
-     * @property_read int $page Player ID.
-     */
-?>
-<form action='/<?=$UID?>/monsters/' method='get'  id='filter_monsters' class='filter'>
-    <table>
-        <tr>
-            <td class='filter'>
-                <span>Element:</span>
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["ELEMENT"] - 1] = "selected";
-?>
-                <select name='element'>
-                    <option> </option>
-                    <option value='<?=ELEMENT_ID::FIRE?>' <?=$selected[0]?>>Fire</option>
-                    <option value='<?=ELEMENT_ID::WATER?>' <?=$selected[1]?>>Water</option>
-                    <option value='<?=ELEMENT_ID::WIND?>' <?=$selected[2]?>>Wind</option>
-                    <option value='<?=ELEMENT_ID::LIGHT?>' <?=$selected[3]?>>Light</option>
-                    <option value='<?=ELEMENT_ID::DARK?>' <?=$selected[4]?>>Dark</option>
-                </select>
-            </td>
-            <td class='filter' id='filter_stars'>
-                <span>Stars:</span>
-                <input type='number' name='min_stars' id='filter_stars_min' min='1' max='6' value='<?=$filters["MIN_STARS"]?>'/>
-                -
-                <input type='number' name='max_stars' id='filter_stars_max' min='1' max='6' value='<?=$filters["MAX_STARS"]?>'/>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='2'>
-                <span>Name:</span>
-                <input type='text' name='name' id='filter_name' value='<?=$filters["NAME"]?>'/>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='2'>
-<?php
-                $checked = "";
-                if ($filters["IN_STORAGE"]){
-                    $checked = "checked";
-                }
-?>
-                <input type='checkbox' name='in_storage' id='filter_in_storage'<?=$checked?>/>
-                <label for='filter_in_storage'>Show monsters in storage</label>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='2'>
-<?php
-                $checked = "";
-                if ($filters["WITHOUT_RUNES"]){
-                    $checked = "checked";
-                }
-?>
-                <input type='checkbox' name='without_runes' id='filter_without_runes' <?=$checked?>/>
-                <label for='filter_without_runes'>Show monsters without runes<label>
-            </td>
-        </tr>
-    </table>
-    <div id='filter_apply'>
-        <input type='submit' value='Apply'/>
-    </div>
-</form>

+ 0 - 263
application/view/inc/filter_report_runecraft.php

@@ -1,263 +0,0 @@
-<?php
-    /**
-     * Rune craft report filter view.
-     *
-     * To be included from the rune craft report view.
-     *
-     * @category View
-     * @property_read mixed[] $filters Selected filters.
-     * @property_read int $page Player ID.
-     */
-?>
-<form action='/<?=$UID?>/report/runecraft/' method='get' id='filter_runecraft' class='filter'>
-    <table>
-        <tr>
-            <td class='filter filter_title' rowspan='2'>
-                <span>
-                    Monster
-                </span>
-            </td>
-            <td class='filter' colspan='3'>
-                <span>Name:</span>
-                <input type='text' name='monster_name' id='filter_name' value='<?=$filters["MONSTER_NAME"]?>'/>
-            </td>
-            <td class='filter'>
-                <span>Stars:</span>
-                <input type='number' name='monster_min_stars' id='filter_stars_min' min='1' max='6' value='<?=$filters["MONSTER_MIN_STARS"]?>'/>
-                -
-                <input type='number' name='monster_max_stars' id='filter_stars_max' min='1' max='6' value='<?=$filters["MONSTER_MAX_STARS"]?>'/>
-            </td>
-        </tr>
-            <td class='filter' colspan='4'>
-<?php
-                $checked = "";
-                if ($filters["MONSTER_IN_STORAGE"]){
-                    $checked = "checked";
-                }
-?>
-                <input type='checkbox' name='monster_in_storage' id='filter_monster_in_storage' <?=$checked?>/>
-                <label for='filter_monster_in_storage'>Show monsters in storage</label>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter filter_title filter_separator' rowspan='5'>
-                <span>
-                    Runes
-                </span>
-            </td>
-            <td class='filter filter_stars filter_separator' colspan='2'>
-                <span>Stars:</span>
-                <input type='number' name='rune_min_stars' id='filter_stars_min' min='1' max='6' value='<?=$filters["RUNE_MIN_STARS"]?>'/>
-                -
-                <input type='number' name='rune_max_stars' id='filter_stars_max' min='1' max='6' value='<?=$filters["RUNE_MAX_STARS"]?>'/>
-            </td>
-            <td class='filter filter_separator' colspan='2'>
-                <span>Level:</span>
-                <input type='number' name='rune_min_level' id='filter_level_min' min='0' max='15' value='<?=$filters["RUNE_MIN_LEVEL"]?>'/>
-                -
-                <input type='number' name='rune_max_level' id='filter_level_max' min='0' max='15' value='<?=$filters["RUNE_MAX_LEVEL"]?>'/>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' rowspan='4'>
-                <span>Slot:</span>
-                <select multiple name='rune_slot[]' id='filter_slot'>
-<?php
-                    for ($i = 1; $i <= 6; $i ++){
-                        if (in_array($i, $filters["RUNE_SLOT"])){
-                            $selected = "selected='selected'";
-                        }
-                        else{
-                            $selected = "";
-                        }
-?>
-                        <option value='<?=$i?>' <?=$selected?>><?=$i?></option>
-<?php
-                    }
-?>
-                </select>
-            </td>
-            <td class='filter' colspan='3'>
-                <span>Quality:</span>
-<?php
-
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["RUNE_MIN_QUALITY"] - 1] = "selected";
-?>
-                <select name='rune_min_quality' id='filter_quality_min'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-                -
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["RUNE_MAX_QUALITY"] - 1] = "selected";
-?>
-                <select name='rune_max_quality' id='filter_quality_max'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='3'>
-                <span>Original quality:</span>
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["RUNE_MIN_ORIGINAL_QUALITY"] - 1] = "selected";
-?>
-                <select name='rune_min_original_quality' id='filter_original_quality_min'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-                -
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["RUNE_MAX_ORIGINAL_QUALITY"] - 1] = "selected";
-?>
-                <select name='rune_max_original_quality' id='filter_original_quality_max'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='3'>
-                <span>Efficiency:</span>
-                <input type='number' name='rune_min_efficiency' id='filter_efficiency_min' min='0' max='100' value='<?=$filters["RUNE_MIN_EFFICIENCY"]?>'/>%
-                -
-                <input type='number' name='rune_max_efficiency' id='filter_efficiency_max' min='0' max='100' value='<?=$filters["RUNE_MAX_EFFICIENCY"]?>'/>%
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='3'>
-                <span>Maximum efficiency:</span>
-                <input type='number' name='rune_min_max_efficiency' id='filter_max_efficiency_min' min='0' max='100' value='<?=$filters["RUNE_MIN_MAX_EFFICIENCY"]?>'/>%
-                -
-                <input type='number' name='rune_max_max_efficiency' id='filter_max_efficiency_max' min='0' max='100' value='<?=$filters["RUNE_MAX_MAX_EFFICIENCY"]?>'/>%
-            </td>
-        </tr>
-        <tr>
-            <td class='filter filter_title filter_separator'>
-                <span>
-                    Grindstones
-                </span>
-            </td>
-            <td class='filter filter_stars filter_separator'>
-<?php
-                $checked = "";
-                if ($filters["GRIND"]){
-                    $checked = "checked";
-                }
-?>
-                <input type='checkbox' name='grind' id='filter_grind' <?=$checked?>/>
-                <label for='filter_grind'>Grindstones</label>
-            </td>
-            <td class='filter filter_separator'>
-                <span>Min. quality:</span>
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["GRIND_MIN_QUALITY"] - 1] = "selected";
-?>
-                <select name='grind_min_quality'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-            </td>
-            <td class='filter filter_separator' colspan='2'>
-                <span>Stats:</span>
-                <select multiple name='grind_stat[]' id='filter_grind_stat'>
-                    <option value='<?=RUNE_STAT_ID::HP?>' <?=in_array(RUNE_STAT_ID::HP, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>HP</option>
-                    <option value='<?=RUNE_STAT_ID::HP_P?>' <?=in_array(RUNE_STAT_ID::HP_P, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>HP%</option>
-                    <option value='<?=RUNE_STAT_ID::ATK?>' <?=in_array(RUNE_STAT_ID::ATK, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>ATK</option>
-                    <option value='<?=RUNE_STAT_ID::ATK_P?>' <?=in_array(RUNE_STAT_ID::ATK_P, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>ATK%</option>
-                    <option value='<?=RUNE_STAT_ID::DEF?>' <?=in_array(RUNE_STAT_ID::DEF, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>DEF</option>
-                    <option value='<?=RUNE_STAT_ID::DEF_P?>' <?=in_array(RUNE_STAT_ID::DEF_P, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>DEF%</option>
-                    <option value='<?=RUNE_STAT_ID::SPD?>' <?=in_array(RUNE_STAT_ID::SPD, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>SPD</option>
-                    <option value='<?=RUNE_STAT_ID::CRR?>' <?=in_array(RUNE_STAT_ID::CRR, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>CRR</option>
-                    <option value='<?=RUNE_STAT_ID::CRD?>' <?=in_array(RUNE_STAT_ID::CRD, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>CRD</option>
-                    <option value='<?=RUNE_STAT_ID::RES?>' <?=in_array(RUNE_STAT_ID::RES, $filters["GRIND_STAT"]) ? "selected='selected'" : "";?>>RES</option>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter filter_title filter_separator'>
-                <span>
-                    Gems
-                </span>
-            </td>
-            <td class='filter filter_stars filter_separator'>
-<?php
-                $checked = "";
-                if ($filters["GEM"]){
-                    $checked = "checked";
-                }
-?>
-                <input type='checkbox' name='gem' id='filter_gem' <?=$checked?>/>
-                <label for='filter_gem'>Gems</label>
-            </td>
-            <td class='filter filter_separator'>
-                <span>Min. quality:</span>
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["GEM_MIN_QUALITY"] - 1] = "selected";
-?>
-                <select name='gem_min_quality'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-            </td>
-            <td class='filter filter_separator'>
-                <span>Replace...</span>
-                <select multiple name='gem_stat_from[]' id='filter_gem_stat_from'>
-                    <option value='<?=RUNE_STAT_ID::HP?>' <?=in_array(RUNE_STAT_ID::HP, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>HP</option>
-                    <option value='<?=RUNE_STAT_ID::HP_P?>' <?=in_array(RUNE_STAT_ID::HP_P, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>HP%</option>
-                    <option value='<?=RUNE_STAT_ID::ATK?>' <?=in_array(RUNE_STAT_ID::ATK, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>ATK</option>
-                    <option value='<?=RUNE_STAT_ID::ATK_P?>' <?=in_array(RUNE_STAT_ID::ATK_P, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>ATK%</option>
-                    <option value='<?=RUNE_STAT_ID::DEF?>' <?=in_array(RUNE_STAT_ID::DEF, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>DEF</option>
-                    <option value='<?=RUNE_STAT_ID::DEF_P?>' <?=in_array(RUNE_STAT_ID::DEF_P, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>DEF%</option>
-                    <option value='<?=RUNE_STAT_ID::SPD?>' <?=in_array(RUNE_STAT_ID::SPD, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>SPD</option>
-                    <option value='<?=RUNE_STAT_ID::CRR?>' <?=in_array(RUNE_STAT_ID::CRR, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>CRR</option>
-                    <option value='<?=RUNE_STAT_ID::CRD?>' <?=in_array(RUNE_STAT_ID::CRD, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>CRD</option>
-                    <option value='<?=RUNE_STAT_ID::RES?>' <?=in_array(RUNE_STAT_ID::RES, $filters["GEM_STAT_FROM"]) ? "selected='selected'" : "";?>>RES</option>
-                </select>
-            </td>
-            <td class='filter filter_separator'>
-                <span>...with...</span>
-                <select multiple name='gem_stat_from[]' id='filter_gem_stat_to'>
-                    <option value='<?=RUNE_STAT_ID::HP?>' <?=in_array(RUNE_STAT_ID::HP, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>HP</option>
-                    <option value='<?=RUNE_STAT_ID::HP_P?>' <?=in_array(RUNE_STAT_ID::HP_P, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>HP%</option>
-                    <option value='<?=RUNE_STAT_ID::ATK?>' <?=in_array(RUNE_STAT_ID::ATK, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>ATK</option>
-                    <option value='<?=RUNE_STAT_ID::ATK_P?>' <?=in_array(RUNE_STAT_ID::ATK_P, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>ATK%</option>
-                    <option value='<?=RUNE_STAT_ID::DEF?>' <?=in_array(RUNE_STAT_ID::DEF, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>DEF</option>
-                    <option value='<?=RUNE_STAT_ID::DEF_P?>' <?=in_array(RUNE_STAT_ID::DEF_P, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>DEF%</option>
-                    <option value='<?=RUNE_STAT_ID::SPD?>' <?=in_array(RUNE_STAT_ID::SPD, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>SPD</option>
-                    <option value='<?=RUNE_STAT_ID::CRR?>' <?=in_array(RUNE_STAT_ID::CRR, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>CRR</option>
-                    <option value='<?=RUNE_STAT_ID::CRD?>' <?=in_array(RUNE_STAT_ID::CRD, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>CRD</option>
-                    <option value='<?=RUNE_STAT_ID::RES?>' <?=in_array(RUNE_STAT_ID::RES, $filters["GEM_STAT_TO"]) ? "selected='selected'" : "";?>>RES</option>
-                </select>
-            </td>
-        </tr>
-    </table>
-    <div id='filter_apply'>
-        <input type='submit' value='Apply'/>
-    </div>
-</form>

+ 0 - 281
application/view/inc/filter_report_runeupgrade.php

@@ -1,281 +0,0 @@
-<?php
-    /**
-     * Rune upgrade report filter view.
-     *
-     * To be included from the rune upgrade report view.
-     *
-     * @category View
-     * @property_read mixed[] $filters Selected filters.
-     * @property_read int $page Player ID.
-     */
-?>
-<?php
-    if (count($custom_filters) > 0){
-?>
-        <script>
-
-            /**
-             * Changes the filter description.
-             *
-             * @param id Filter id.
-             */
-            function customFilterDescription(id){
-                switch (id){
-<?php
-                    foreach($custom_filters AS $filter){
-?>
-                        case '<?=$filter->id?>':
-                            document.getElementById("custom_filter_description").style.display = 'block';
-                            document.getElementById("custom_filter_description").innerHTML = '<?=$filter->description?>';
-                            break;
-<?php
-                    }
-?>
-                }
-            }
-        </script>
-        <form action='/<?=$UID?>/report/runeupgrade/' method='get' id='custom_filter_runes' class='custom_filter'>
-            <span class='custom_filter_title'>Custom filters:</span>
-            <select name='custom_filter' onChange='customFilterDescription(this.value);' onload='customFilterDescription("<?=filter_input(INPUT_GET, 'custom_filter')?>");'>
-                <option> </option>
-<?php
-                 foreach($custom_filters AS $filter){
-                    if (filter_input(INPUT_GET, 'custom_filter') == $filter->id){
-                        $selected = "selected='selected'";
-                    }
-                    else{
-                        $selected = "";
-                    }
-?>
-                    <option value='<?=$filter->id?>' <?=$selected?>><?=$filter->name?></option>
-<?php
-                 }
-?>
-            </select>
-            <input type='submit' value='Apply'/>
-            <p id='custom_filter_description'> </p>
-            <script>
-                customFilterDescription("<?=filter_input(INPUT_GET, 'custom_filter')?>");
-            </script>
-        </form>
-<?php
-    }
-?>
-<form action='/<?=$UID?>/report/runeupgrade/' method='get' id='filter_runeupgrade' class='filter'>
-    <table>
-        <tr>
-            <td class='filter filter_title' rowspan='3'>
-                <span>
-                    Monster
-                </span>
-            </td>
-            <td class='filter' colspan='3'>
-                <span>Name:</span>
-                <input type='text' name='monster_name' id='filter_name' value='<?=$filters["MONSTER_NAME"]?>'/>
-            </td>
-            <td class='filter'>
-                <span>Stars:</span>
-                <input type='number' name='monster_min_stars' id='filter_stars_min' min='1' max='6' value='<?=$filters["MONSTER_MIN_STARS"]?>'/>
-                -
-                <input type='number' name='monster_max_stars' id='filter_stars_max' min='1' max='6' value='<?=$filters["MONSTER_MAX_STARS"]?>'/>
-            </td>
-        </tr>
-            <td class='filter' colspan='4'>
-<?php
-                $checked = "";
-                if ($filters["MONSTER_IN_STORAGE"]){
-                    $checked = "checked";
-                }
-?>
-                <input type='checkbox' name='monster_in_storage' id='filter_monster_in_storage' <?=$checked?>/>
-                <label for='filter_monster_in_storage'>Show monsters in storage</label>
-            </td>
-        </tr>
-        </tr>
-            <td class='filter' colspan='4'>
-<?php
-                $checked = "";
-                if ($filters["MONSTER_TEAMS"]){
-                    $checked = "checked";
-                }
-?>
-                <input type='checkbox' name='monster_teams' id='filter_monster_teams' <?=$checked?>/>
-                <label for='filter_monster_teams'>Only show monsters in teams</label>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter filter_title filter_separator' rowspan='5'>
-                <span>
-                    Runes
-                </span>
-            </td>
-            <td class='filter filter_stars filter_separator' colspan='2'>
-                <span>Stars:</span>
-                <input type='number' name='rune_min_stars' id='filter_stars_min' min='1' max='6' value='<?=$filters["RUNE_MIN_STARS"]?>'/>
-                -
-                <input type='number' name='rune_max_stars' id='filter_stars_max' min='1' max='6' value='<?=$filters["RUNE_MAX_STARS"]?>'/>
-            </td>
-            <td class='filter filter_separator' colspan='2'>
-                <span>Level:</span>
-                <input type='number' name='rune_min_level' id='filter_level_min' min='0' max='15' value='<?=$filters["RUNE_MIN_LEVEL"]?>'/>
-                -
-                <input type='number' name='rune_max_level' id='filter_level_max' min='0' max='15' value='<?=$filters["RUNE_MAX_LEVEL"]?>'/>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' rowspan='4'>
-                <span>Slot:</span>
-                <select multiple name='rune_slot[]' id='filter_slot'>
-<?php
-                    for ($i = 0; $i < 6; $i ++){
-                        if (in_array($i, $filters["RUNE_SLOT"])){
-                            $selected = "selected='selected'";
-                        }
-                        else{
-                            $selected = "";
-                        }
-?>
-                        <option value='<?=$i?>' <?=$selected?>><?=$i?></option>
-<?php
-                    }
-?>
-                </select>
-            </td>
-            <td class='filter' colspan='3'>
-                <span>Quality:</span>
-<?php
-
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["RUNE_MIN_QUALITY"] - 1] = "selected";
-?>
-                <select name='rune_min_quality' id='filter_quality_min'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-                -
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["RUNE_MAX_QUALITY"] - 1] = "selected";
-?>
-                <select name='rune_max_quality' id='filter_quality_max'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='3'>
-                <span>Original quality:</span>
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["RUNE_MIN_ORIGINAL_QUALITY"] - 1] = "selected";
-?>
-                <select name='rune_min_original_quality' id='filter_original_quality_min'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-                -
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["RUNE_MAX_ORIGINAL_QUALITY"] - 1] = "selected";
-?>
-                <select name='rune_max_original_quality' id='filter_original_quality_max'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='3'>
-                <span>Efficiency:</span>
-                <input type='number' name='rune_min_efficiency' id='filter_efficiency_min' min='0' max='100' value='<?=$filters["RUNE_MIN_EFFICIENCY"]?>'/>%
-                -
-                <input type='number' name='rune_max_efficiency' id='filter_efficiency_max' min='0' max='100' value='<?=$filters["RUNE_MAX_EFFICIENCY"]?>'/>%
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='3'>
-                <span>Maximum efficiency:</span>
-                <input type='number' name='rune_min_max_efficiency' id='filter_max_efficiency_min' min='0' max='100' value='<?=$filters["RUNE_MIN_MAX_EFFICIENCY"]?>'/>%
-                -
-                <input type='number' name='rune_max_max_efficiency' id='filter_max_efficiency_max' min='0' max='100' value='<?=$filters["RUNE_MAX_MAX_EFFICIENCY"]?>'/>%
-            </td>
-        </tr>
-        <tr>
-            <td class='filter filter_title filter_separator' rowspan='3'>
-                <span>
-                    Alternatives
-                </span>
-            </td>
-            <td class='filter filter_stars filter_separator'>
-                <span>Min. stars:</span>
-                <input type='number' name='alternative_min_stars' id='filter_stars_min' min='1' max='6' value='<?=$filters["ALTERNATIVE_MIN_STARS"]?>'/>
-            </td>
-            <td class='filter filter_separator' colspan='2'>
-                <span>Min. O. quality:</span>
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["ALTERNATIVE_MIN_ORIGINAL_QUALITY"]] = "selected";
-?>
-                <select name='alternative_min_original_quality' id='filter_original_quality_min'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-            </td>
-            <td class='filter filter_separator'>
-                <span>Min. Level:</span>
-                <input type='number' name='alternative_min_level' id='filter_level_min' min='0' max='15' value='<?=$filters["ALTERNATIVE_MIN_LEVEL"]?>'/>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='4'>
-                <span>Condition:</span>
-<?php
-                $selected = Array("", "", "", "", "", "");
-                $selected[$filters["ALTERNATIVE_CONDITION"]] = "selected";
-
-?>
-                <select name='alternative_condition'>
-                    <option value='0' <?=$selected[0]?>>Higher grade, any quality
-                    <option value='1' <?=$selected[1]?>>Higher grade or higher quality
-                    <option value='2' <?=$selected[2]?>>Equal or higher grade and equal or higher quality</option>
-                    <option value='3' <?=$selected[3]?>>Equal or higher grade and higher quality</option>
-                    <option value='4' <?=$selected[4]?>>Equal grade and equal or higher quality</option>
-                    <option value='5' <?=$selected[5]?>>Higher grade and higher quality</option>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='4'>
-                <span>Source:</span>
-<?php
-                $selected = Array("", "", "", "");
-                $selected[$filters["ALTERNATIVE_SOURCE"]] = "selected";
-?>
-                <select name='alternative_source'>
-                    <option value='0' <?=$selected[0]?>>Inventory only</option>
-                    <option value='1' <?=$selected[1]?>>Inventory or assigned to a lower grade monster</option>
-                    <option value='2' <?=$selected[2]?>>Any</option>
-                </select>
-            </td>
-        </tr>
-    </table>
-    <div id='filter_apply'>
-        <input type='submit' value='Apply'/>
-    </div>
-</form>

+ 0 - 104
application/view/inc/filter_report_skillup.php

@@ -1,104 +0,0 @@
-<?php
-    /**
-     * Skillup report filter view.
-     *
-     * To be included from the skillup report view.
-     *
-     * @category View
-     * @property_read mixed[] $filters Selected filters.
-     * @property_read int $page Player ID.
-     */
-?>
-<form action='/<?=$UID?>/report/skillup/' method='get' id='filter_skillup' class='filter'>
-    <table>
-        <tr>
-            <td class='filter' id='filter_stars'>
-                <span>Stars:</span>
-                <input type='number' name='min_stars' min='1' max='6' value='<?=$filters["MIN_STARS"]?>'/>
-                -
-                <input type='number' name='max_stars'  min='1' max='6' value='<?=$filters["MAX_STARS"]?>'/>
-            </td>
-            <td class='filter' id='filter_stars'>
-                <span>Natural stars:</span>
-                <input type='number' name='min_natural_stars' min='1' max='5' value='<?=$filters["MIN_NATURAL_STARS"]?>'/>
-                -
-                <input type='number' name='max_natural_stars' min='1' max='5' value='<?=$filters["MAX_NATURAL_STARS"]?>'/>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='2'>
-<?php
-                $checked = "";
-                if ($filters["FAMILY"]){
-                    $checked = "checked";
-                }
-?>
-                <input type='checkbox' name='family' id='filter_family' <?=$checked?>/>
-                <label for='filter_family'>Show monsters with family with lower grade.</label>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='2'>
-<?php
-                $checked = "";
-                if ($filters["2A"]){
-                    $checked = "checked";
-                }
-?>
-                <input type='checkbox' name='2a' id='filter_2a'<?=$checked?>/>
-                <label for='filter_2a'>Include second-awakened monsters.</label>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='2'>
-<?php
-                $checked = "";
-                if ($filters["HOMUNCULUS"]){
-                    $checked = "checked";
-                }
-?>
-                <input type='checkbox' name='homunculus' id='filter_homunculus' <?=$checked?>/>
-                <label for='filter_homunculus'>Include Homunculus.</label>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='2'>
-<?php
-                $checked = "";
-                if ($filters["IN_STORAGE"]){
-                    $checked = "checked";
-                }
-?>
-                <input type='checkbox' name='in_storage' id='filter_in_storage' <?=$checked?>/>
-                <label for='filter_in_storage'>Show monsters in storage.</label>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='2'>
-<?php
-                $checked = "";
-                if ($filters["WITHOUT_RUNES"]){
-                    $checked = "checked";
-                }
-?>
-                <input type='checkbox' name='without_runes' id='filter_without_runes' <?=$checked?>/>
-                <label for='filter_without_runes'>Show monsters without runes.</label>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='2'>
-<?php
-                $checked = "";
-                if ($filters["MAXED"]){
-                    $checked = "checked";
-                }
-?>
-                <input type='checkbox' name='maxed' id='filter_maxed' <?=$checked?>/>
-                <label for='filter_maxed'>Show fully skilled-up monster</label>
-            </td>
-        </tr>
-    </table>
-    <div id='filter_apply'>
-        <input type='submit' value='Apply'/>
-    </div>
-</form>

+ 0 - 263
application/view/inc/filter_runes.php

@@ -1,263 +0,0 @@
-<?php
-    /**
-     * Rune filter view.
-     *
-     * To be included from the rune view.
-     *
-     * @category View
-     * @property_read mixed[] $filters Selected filters.
-     * @property_read int $page Player ID.
-     */
-
-    if (count($custom_filters) > 0){
-?>
-        <script>
-            /**
-             * Changes the filter description.
-             *
-             * @param id Filter id.
-             */
-            function customFilterDescription(id){
-                switch (id){
-<?php
-                    foreach($custom_filters AS $filter){
-?>
-                        case '<?=$filter->id?>':
-                            document.getElementById("custom_filter_description").style.display = 'block';
-                            document.getElementById("custom_filter_description").innerHTML = '<?=$filter->description?>';
-                            break;
-<?php
-                    }
-?>
-                }
-            }
-        </script>
-        <form action='/<?=$UID?>/runes/' method='get' id='custom_filter_runes' class='custom_filter'>
-            <span class='custom_filter_title'>Custom filters:</span>
-            <select name='custom_filter' onChange='customFilterDescription(this.value);' onload='customFilterDescription("<?=filter_input(INPUT_GET, 'custom_filter')?>");'>
-                <option> </option>
-<?php
-                 foreach($custom_filters AS $filter){
-                    if (filter_input(INPUT_GET, 'custom_filter') == $filter->id){
-                        $selected = "selected='selected'";
-                    }
-                    else{
-                        $selected = "";
-                    }
-?>
-                    <option value='<?=$filter->id?>' <?=$selected?>><?=$filter->name?></option>
-<?php
-                 }
-?>
-            </select>
-            <input type='submit' value='Apply'/>
-            <p id='custom_filter_description'> </p>
-            <script>
-                customFilterDescription("<?=filter_input(INPUT_GET, 'custom_filter')?>");
-            </script>
-        </form>
-<?php
-    }
-?>
-<form action='/<?=$UID?>/runes/' method='get' id='filter_runes' class='filter'>
-    <div class='custom_filters'>
-    <table>
-        <tr>
-            <td class='filter' rowspan='3'>
-                <span>Type:</span>
-                <select multiple name='type[]' id='filter_type'>
-<?php
-
-                    $reflect = new ReflectionClass("RUNE_SET_ID");
-                    foreach($reflect->getConstants() as $name => $id){
-                        $selected = "";
-                        if (in_array($id, $filters["TYPE"])){
-                            $selected = "selected='selected'";
-                        }
-                        $name_format = ucwords(strtolower($name));
-?>
-                        <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
-<?php
-                    }
-?>
-                </select>
-            </td>
-            <td class='filter' rowspan='2'>
-                <span>Slot:</span>
-                <select multiple name='slot[]' id='filter_slot'>
-<?php
-                    for ($i = 1; $i <= 6; $i ++){
-                        if (in_array($i, $filters["SLOT"])){
-                            $selected = "selected='selected'";
-                        }
-                        else{
-                            $selected = "";
-                        }
-?>
-                        <option value='<?=$i?>' <?=$selected?>><?=$i?></option>
-<?php
-                    }
-?>
-                </select>
-            </td>
-            <td class='filter filter_stars' >
-                <span>Stars:</span>
-                <input type='number' name='min_stars' id='filter_stars_min' min='1' max='6' value='<?=$filters["MIN_STARS"]?>'/>
-                -
-                <input type='number' name='max_stars' id='filter_stars_max' min='1' max='6' value='<?=$filters["MAX_STARS"]?>'/>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter'>
-                <span>Level:</span>
-                <input type='number' name='min_level' id='filter_level_min' min='0' max='15' value='<?=$filters["MIN_LEVEL"]?>'/>
-                -
-                <input type='number' name='max_level' id='filter_level_max' min='0' max='15' value='<?=$filters["MAX_LEVEL"]?>'/>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter'>
-                <span>Main stat:</span>
-                <select multiple name='main_stat[]' id='filter_main_stat'>
-<?php
-                    $reflect = new ReflectionClass("RUNE_STAT_ID");
-                    foreach($reflect->getConstants() as $name => $id){
-                        $selected = "";
-                        if (in_array($id, $filters["MAIN"])){
-                            $selected = "selected='selected'";
-                        }
-                        $name_format = ucwords(str_replace("_P", "%", $name));
-?>
-                        <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
-<?php
-                    }
-?>
-                </select>
-            </td>
-            <td class='filter'>
-                <span>Has sub stat:</span>
-                <select multiple name='sub_stat[]' id='filter_sub_stat'>
-<?php
-                    $reflect = new ReflectionClass("RUNE_STAT_ID");
-                    foreach($reflect->getConstants() as $name => $id){
-                        $selected = "";
-                        if (in_array($id, $filters["SUB"])){
-                            $selected = "selected='selected'";
-                        }
-                        $name_format = ucwords(str_replace("_P", "%", $name));
-?>
-                        <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
-<?php
-                    }
-?>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter'>
-                <span>
-                    Assigned:
-                </span>
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["ASSIGNED"]] = "selected";
-?>
-                <select name='assigned' id='filter_assigned'>
-                    <option value='0' <?=$selected[0]?>>All</option>
-                    <option value='1' <?=$selected[1]?>>Assigned</option>
-                    <option value='2' <?=$selected[2]?>>Unassigned</option>
-                    <option value='3' <?=$selected[3]?>>All (no storage)</option>
-                    <option value='4' <?=$selected[4]?>>Assigned (no storage)</option>
-                </select>
-            </td>
-            <td class='filter' colspan='2'>
-                <span>Quality:</span>
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["MIN_QUALITY"] - 1] = "selected";
-?>
-                <select name='min_quality' id='filter_quality_min'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-                -
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["MAX_QUALITY"] - 1] = "selected";
-?>
-                <select name='max_quality' id='filter_quality_max'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter'>
-            </td>
-            <td class='filter' colspan='2'>
-                <span>Original quality:</span>
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["MIN_ORIGINAL_QUALITY"] - 1] = "selected";
-?>
-                <select name='min_original_quality' id='filter_original_quality_min'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-                -
-<?php
-                $selected = Array("", "", "", "", "");
-                $selected[$filters["MAX_ORIGINAL_QUALITY"] - 1] = "selected";
-?>
-                <select name='max_original_quality' id='filter_original_quality_max'>
-                    <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
-                    <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
-                    <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
-                    <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter'>
-            </td>
-            <td class='filter' colspan='2'>
-                <span>Efficiency:</span>
-                <input type='number' name='min_efficiency' id='filter_efficiency_min' min='0' max='100' value='<?=$filters["MIN_EFFICIENCY"]?>'/>%
-                -
-                <input type='number' name='max_efficiency' id='filter_efficiency_max' min='0' max='100' value='<?=$filters["MAX_EFFICIENCY"]?>'/>%
-            </td>
-        </tr>
-        <tr>
-            <td class='filter'>
-                <span>Group by:</span>
-<?php
-                $selected = Array("", "");
-                $selected[$filters["GROUP"]] = "selected";
-?>
-                <select name='group' id='filter_group'>
-                    <option value='0' <?=$selected[0]?>>Slot</option>
-                    <option value='1' <?=$selected[1]?>>Type</option>
-                </select>
-            </td>
-            <td class='filter' colspan='2'>
-                <span>Maximum efficiency:</span>
-                <input type='number' name='min_max_efficiency' id='filter_max_efficiency_min' min='0' max='100' value='<?=$filters["MIN_MAX_EFFICIENCY"]?>'/>%
-                -
-                <input type='number' name='max_max_efficiency' id='filter_max_efficiency_max' min='0' max='100' value='<?=$filters["MAX_MAX_EFFICIENCY"]?>'/>%
-            </td>
-        </tr>
-    </table>
-    <div id='filter_apply'>
-        <input type='submit' value='Apply'/>
-    </div>
-</form>

+ 0 - 128
application/view/inc/filter_runs.php

@@ -1,128 +0,0 @@
-<?php
-    /**
-     * Run filter view.
-     *
-     * To be included from the run view.
-     *
-     * @category View
-     * @property_read mixed[] $filters Selected filters.
-     * @property_read int $page Player ID.
-     */
-?>
-<form action='/<?=$UID?>/runs/' method='get' id='filter_runeupgrade' class='filter'>
-    <table>
-        <tr>
-            <td class='filter filter_title'>
-                <span>
-                    Area
-                </span>
-            </td>
-            <td class='filter' colspan='2'>
-<?php
-                $selected = array_fill(0, 12 + 1, "");
-                $selected[$filters["AREA_TYPE"]] = "selected";
-?>
-                <select name='area_type' id='filter_area_type' onchange='selectAreaType();'>
-                    <option value='0'>All</option>
-                    <option value='<?=AREA_TYPE_ID::SCENARIO?>' <?=$selected[AREA_TYPE_ID::SCENARIO]?>>Scenario</option>
-                    <option value='<?=AREA_TYPE_ID::CAIROS_DUNGEON?>' <?=$selected[AREA_TYPE_ID::CAIROS_DUNGEON]?>>Cairos Dungeon</option>
-                    <option value='<?=AREA_TYPE_ID::RIFT_DUNGEON?>' <?=$selected[AREA_TYPE_ID::RIFT_DUNGEON]?>>Rift Beast</option>
-                    <option value='<?=AREA_TYPE_ID::RIFT_RAID?>' <?=$selected[AREA_TYPE_ID::RIFT_RAID]?>>Rift Raid</option>
-                    <option value='<?=AREA_TYPE_ID::DIMENSIONAL_HOLE?>' <?=$selected[AREA_TYPE_ID::DIMENSIONAL_HOLE]?>>Dimensional Hole</option>
-                    <option value='<?=AREA_TYPE_ID::ARENA?>' <?=$selected[AREA_TYPE_ID::ARENA]?>>Arena</option>
-                    <option value='<?=AREA_TYPE_ID::GUILD_WAR?>' <?=$selected[AREA_TYPE_ID::GUILD_WAR]?>>Guild War</option>
-                    <option value='<?=AREA_TYPE_ID::GUILD_SIEGE?>' <?=$selected[AREA_TYPE_ID::GUILD_SIEGE]?>>Guild Siege</option>
-                    <option value='<?=AREA_TYPE_ID::TARTARUS_LABYRINTH?>' <?=$selected[AREA_TYPE_ID::TARTARUS_LABYRINTH]?>>Tartarus Labyrinth</option>
-                    <option value='<?=AREA_TYPE_ID::TRIAL_OF_ASCENSION?>' <?=$selected[AREA_TYPE_ID::TRIAL_OF_ASCENSION]?>>Trial of Ascension</option>
-                    <option value='<?=AREA_TYPE_ID::WORLD_BOSS?>' <?=$selected[AREA_TYPE_ID::WORLD_BOSS]?>>World Boss</option>
-                    <option value='<?=AREA_TYPE_ID::DIMENSIONAL_RIFT?>' <?=$selected[AREA_TYPE_ID::DIMENSIONAL_RIFT]?>>Dimensional Rift</option>
-                </select>
-<?php
-                $selected = array_fill(0, 9002, "");
-                $selected[$filters["AREA"]] = "selected";
-?>
-                <select id='filter_area_scenario' class='filter_area'>
-                    <option value='0'>All</option>
-                    <option value='<?=SCENARIO_ID::GAREN_FOREST?>' <?=$selected[SCENARIO_ID::GAREN_FOREST]?>>Garen Forest</option>
-                    <option value='<?=SCENARIO_ID::MT_SIZ?>' <?=$selected[SCENARIO_ID::MT_SIZ]?>>Mt. Siz</option>
-                    <option value='<?=SCENARIO_ID::KABIR_RUINS?>' <?=$selected[SCENARIO_ID::KABIR_RUINS]?>>Kabir Ruins</option>
-                    <option value='<?=SCENARIO_ID::MT_WHITE_RAGON?>' <?=$selected[SCENARIO_ID::MT_WHITE_RAGON]?>>Mt. White Ragon</option>
-                    <option value='<?=SCENARIO_ID::TELAIN_FOREST?>' <?=$selected[SCENARIO_ID::TELAIN_FOREST]?>>Telain Forest</option>
-                    <option value='<?=SCENARIO_ID::HYDENI_RUINS?>' <?=$selected[SCENARIO_ID::HYDENI_RUINS]?>>Hydeni Ruins</option>
-                    <option value='<?=SCENARIO_ID::TAMOR_DESERT?>' <?=$selected[SCENARIO_ID::TAMOR_DESERT]?>>Tamor Desert</option>
-                    <option value='<?=SCENARIO_ID::VROFAGUS_RUINS?>' <?=$selected[SCENARIO_ID::VROFAGUS_RUINS]?>>Vrofagus Ruins</option>
-                    <option value='<?=SCENARIO_ID::FAIMON_VOLCANO?>' <?=$selected[SCENARIO_ID::FAIMON_VOLCANO]?>>Faimon Volcano</option>
-                    <option value='<?=SCENARIO_ID::AIDEN_FOREST?>' <?=$selected[SCENARIO_ID::AIDEN_FOREST]?>>Aiden Forest</option>
-                    <option value='<?=SCENARIO_ID::FERUN_CASTLE?>' <?=$selected[SCENARIO_ID::FERUN_CASTLE]?>>Ferun Castle</option>
-                    <option value='<?=SCENARIO_ID::MT_RUNAR?>' <?=$selected[SCENARIO_ID::MT_RUNAR]?>>Mt. Runar</option>
-                    <option value='<?=SCENARIO_ID::CHIRUKA_REMAINS?>' <?=$selected[SCENARIO_ID::CHIRUKA_REMAINS]?>>Charuka Remains</option>
-                </select>
-                <select id='filter_area_cairos' class='filter_area'>
-                    <option value='0'>All</option>
-                    <option value='<?=DUNGEON_ID::GIANTS_KEEP?>' <?=$selected[DUNGEON_ID::GIANTS_KEEP]?>>Giant&#39;s Keep</option>
-                    <option value='<?=DUNGEON_ID::DRAGONS_LAIR?>' <?=$selected[DUNGEON_ID::DRAGONS_LAIR]?>>Dragon&#39;s Lair</option>
-                    <option value='<?=DUNGEON_ID::NECROPOLIS?>' <?=$selected[DUNGEON_ID::NECROPOLIS]?>>Necropolis</option>
-                    <option value='<?=DUNGEON_ID::HALL_OF_MAGIC?>' <?=$selected[DUNGEON_ID::HALL_OF_MAGIC]?>>Hall of Magic</option>
-                    <option value='<?=DUNGEON_ID::HALL_OF_LIGHT?>' <?=$selected[DUNGEON_ID::HALL_OF_LIGHT]?>>Hall of Light</option>
-                    <option value='<?=DUNGEON_ID::HALL_OF_DARK?>' <?=$selected[DUNGEON_ID::HALL_OF_DARK]?>>Hall of Dark</option>
-                    <option value='<?=DUNGEON_ID::HALL_OF_FIRE?>' <?=$selected[DUNGEON_ID::HALL_OF_FIRE]?>>Hall of Fire</option>
-                    <option value='<?=DUNGEON_ID::HALL_OF_WATER?>' <?=$selected[DUNGEON_ID::HALL_OF_WATER]?>>Hall of Water</option>
-                    <option value='<?=DUNGEON_ID::HALL_OF_WIND?>' <?=$selected[DUNGEON_ID::HALL_OF_WIND]?>>Hall of Wind</option>
-                </select>
-                <select id='filter_area_rift_dungeon' class='filter_area'>
-                    <option value='0'>All</option>
-                    <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::LIGHT_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::LIGHT_BEAST]?>>Light Beast</option>
-                    <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::DARK_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::DARK_BEAST]?>>Dark Beast</option>
-                    <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::FIRE_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::FIRE_BEAST]?>>Fire Beast</option>
-                    <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::ICE_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::ICE_BEAST]?>>Ice Beast</option>
-                    <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::WIND_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::WIND_BEAST]?>>Wind Beast</option>
-                </select>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter filter_title filter_separator' rowspan='4'>
-                <span>
-                    Extra
-                </span>
-            </td>
-            <td class='filter filter_separator' colspan='2'>
-                <span>Date range:</span>
-                <input type='date' name='date_min' id='date_min' value='<?=$filters["DATE_MIN"]?>'/>
-                -
-                <input type='date' name='date_max' id='date_max' value='<?=$filters["DATE_MAX"]?>'/>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='2'>
-<?php
-                $checked = "";
-                if ($filters["DEFEAT"]){
-                    $checked = "checked";
-                }
-?>
-                <input type='checkbox' name='defeat' id='filter_defeat' <?=$checked?>/>
-                <label for='filter_defeat'>Show defeats</label>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='2'>
-<?php
-                $checked = "";
-                if ($filters["HELPER"]){
-                    $checked = "checked";
-                }
-?>
-                <input type='checkbox' name='helper' id='filter_helper' <?=$checked?>/>
-                <label for='filter_helper'>Show runs with friends/mentors</label>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter' colspan='2'>
-                <input type='number' name='number' id='number' min='1' value='<?=$filters["NUMBER"]?>'/> runs per page
-            </td>
-        </tr>
-    </table>
-    <div id='filter_apply'>
-        <input type='submit' value='Apply'/>
-    </div>
-</form>

+ 0 - 82
application/view/inc/filter_stats.php

@@ -1,82 +0,0 @@
-<?php
-    /**
-     * Stat  filter view.
-     *
-     * To be included from the stats view.
-     *
-     * @category View
-     * @property_read mixed[] $filters Selected filters.
-     * @property_read int $page Player ID.
-     */
-?>
-<form action='/<?=$UID?>/stats/' method='get' id='filter_runeupgrade' class='filter'>
-    <table>
-        <tr>
-            <td class='filter'>
-                <span>Area:</span>
-            </td>
-        </tr>
-        <tr>
-            <td class='filter'>
-<?php
-                $selected = array_fill(0, 12 + 1, "");
-                $selected[$filters["AREA_TYPE"]] = "selected";
-?>
-                <select name='area_type' id='filter_area_type' onChange='selectAreaType();'>
-                    <option value='0'></option>
-                    <option value='<?=AREA_TYPE_ID::SCENARIO?>' <?=$selected[AREA_TYPE_ID::SCENARIO]?>>Scenario</option>
-                    <option value='<?=AREA_TYPE_ID::CAIROS_DUNGEON?>' <?=$selected[AREA_TYPE_ID::CAIROS_DUNGEON]?>>Cairos Dungeon</option>
-                    <option value='<?=AREA_TYPE_ID::RIFT_DUNGEON?>' <?=$selected[AREA_TYPE_ID::RIFT_DUNGEON]?>>Rift Beast</option>
-                    <option value='<?=AREA_TYPE_ID::RIFT_RAID?>' <?=$selected[AREA_TYPE_ID::RIFT_RAID]?>>Rift Raid</option>
-                    <option value='<?=AREA_TYPE_ID::DIMENSIONAL_HOLE?>' <?=$selected[AREA_TYPE_ID::DIMENSIONAL_HOLE]?>>Dimensional Hole</option>
-                </select>
-<?php
-                $selected = array_fill(0, 9002, "");
-                $selected[$filters["AREA"]] = "selected";
-?>
-                <select class='filter_area' id='filter_area_scenario'>
-                    <option value='0'></option>
-                    <option value='<?=AREA_TYPE_ID::SCENARIO?>' <?=$selected[AREA_TYPE_ID::SCENARIO]?>>Scenario</option>
-                    <option value='<?=AREA_TYPE_ID::CAIROS_DUNGEON?>' <?=$selected[AREA_TYPE_ID::CAIROS_DUNGEON]?>>Cairos Dungeon</option>
-                    <option value='<?=AREA_TYPE_ID::RIFT_DUNGEON?>' <?=$selected[AREA_TYPE_ID::RIFT_DUNGEON]?>>Rift Beast</option>
-                    <option value='<?=AREA_TYPE_ID::RIFT_RAID?>' <?=$selected[AREA_TYPE_ID::RIFT_RAID]?>>Rift Raid</option>
-                    <option value='<?=AREA_TYPE_ID::DIMENSIONAL_HOLE?>' <?=$selected[AREA_TYPE_ID::DIMENSIONAL_HOLE]?>>Dimensional Hole</option>
-                    <option value='<?=AREA_TYPE_ID::ARENA?>' <?=$selected[AREA_TYPE_ID::ARENA]?>>Arena</option>
-                    <option value='<?=AREA_TYPE_ID::GUILD_WAR?>' <?=$selected[AREA_TYPE_ID::GUILD_WAR]?>>Guild War</option>
-                    <option value='<?=AREA_TYPE_ID::GUILD_SIEGE?>' <?=$selected[AREA_TYPE_ID::GUILD_SIEGE]?>>Guild Siege</option>
-                    <option value='<?=AREA_TYPE_ID::TARTARUS_LABYRINTH?>' <?=$selected[AREA_TYPE_ID::TARTARUS_LABYRINTH]?>>Tartarus Labyrinth</option>
-                    <option value='<?=AREA_TYPE_ID::TRIAL_OF_ASCENSION?>' <?=$selected[AREA_TYPE_ID::TRIAL_OF_ASCENSION]?>>Trial of Ascension</option>
-                    <option value='<?=AREA_TYPE_ID::WORLD_BOSS?>' <?=$selected[AREA_TYPE_ID::WORLD_BOSS]?>>World Boss</option>
-                    <option value='<?=AREA_TYPE_ID::DIMENSIONAL_RIFT?>' <?=$selected[AREA_TYPE_ID::DIMENSIONAL_RIFT]?>>Dimensional Rift</option>
-                </select>
-                <select class='filter_area' id='filter_area_cairos'>
-                    <option value='0'></option>
-                    <option value='<?=DUNGEON_ID::GIANTS_KEEP?>' <?=$selected[DUNGEON_ID::GIANTS_KEEP]?>>Giant&#39;s Keep</option>
-                    <option value='<?=DUNGEON_ID::DRAGONS_LAIR?>' <?=$selected[DUNGEON_ID::DRAGONS_LAIR]?>>Dragon&#39;s Lair</option>
-                    <option value='<?=DUNGEON_ID::NECROPOLIS?>' <?=$selected[DUNGEON_ID::NECROPOLIS]?>>Necropolis</option>
-                    <option value='<?=DUNGEON_ID::HALL_OF_MAGIC?>' <?=$selected[DUNGEON_ID::HALL_OF_MAGIC]?>>Hall of Magic</option>
-                    <option value='<?=DUNGEON_ID::HALL_OF_LIGHT?>' <?=$selected[DUNGEON_ID::HALL_OF_LIGHT]?>>Hall of Light</option>
-                    <option value='<?=DUNGEON_ID::HALL_OF_DARK?>' <?=$selected[DUNGEON_ID::HALL_OF_DARK]?>>Hall of Dark</option>
-                    <option value='<?=DUNGEON_ID::HALL_OF_FIRE?>' <?=$selected[DUNGEON_ID::HALL_OF_FIRE]?>>Hall of Fire</option>
-                    <option value='<?=DUNGEON_ID::HALL_OF_WATER?>' <?=$selected[DUNGEON_ID::HALL_OF_WATER]?>>Hall of Water</option>
-                    <option value='<?=DUNGEON_ID::HALL_OF_WIND?>' <?=$selected[DUNGEON_ID::HALL_OF_WIND]?>>Hall of Wind</option>
-                </select>
-                <select id='filter_area_rift_dungeon' class='filter_area'>
-                    <option value='0'></option>
-                    <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::LIGHT_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::LIGHT_BEAST]?>>Light Beast</option>
-                    <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::DARK_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::DARK_BEAST]?>>Dark Beast</option>
-                    <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::FIRE_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::FIRE_BEAST]?>>Fire Beast</option>
-                    <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::ICE_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::ICE_BEAST]?>>Ice Beast</option>
-                    <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::WIND_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::WIND_BEAST]?>>Wind Beast</option>
-                </select>
-                <select id='filter_stage' name='stage'>
-                </select>
-                <select id='filter_difficulty' name='difficulty'>
-                </select>
-            </td>
-        </tr>
-    </table>
-    <div id='filter_apply'>
-        <input type='submit' value='Apply'/>
-    </div>
-</form>

+ 0 - 43
application/view/inc/filter_teams.php

@@ -1,43 +0,0 @@
-<?php
-    /**
-     * Team filter view.
-     *
-     * To be included from the team view.
-     *
-     * @category View
-     * @property_read mixed[] $filters Selected filters.
-     * @property_read Teams_Page $page The page model.
-     * @property_read int $page Player ID.
-     */
-?>
-<form action='/<?=$UID?>/teams/' method='get'  id='filter_monsters' class='filter'>
-    <table>
-        <tr>
-            <td class='filter'>
-                <span>Name:</span>
-                <input type='text' name='name' id='filter_name' value='<?=$page->filters["NAME"]?>'/>
-            </td>
-            <td class='filter'>
-                <span>Area:</span>
-                <select name='area'>
-                    <option value=''> <option>
-                    <option value='<?=AREA_TYPE_ID::SCENARIO?>'>Scenario</option>
-                    <option value='<?=AREA_TYPE_ID::CAIROS_DUNGEON?>'>Cairos Dungeon</option>
-                    <option value='<?=AREA_TYPE_ID::RIFT_DUNGEON?>'>Rift Dungeon</option>
-                    <option value='<?=AREA_TYPE_ID::RIFT_RAID?>'>Rift Raid</option>
-                    <option value='<?=AREA_TYPE_ID::DIMENSIONAL_HOLE?>'>Dimensional Hole></option>
-                    <option value='<?=AREA_TYPE_ID::ARENA?>'>Arena</option>
-                    <option value='<?=AREA_TYPE_ID::GUILD_WAR?>'>Guild War</option>
-                    <option value='<?=AREA_TYPE_ID::GUILD_SIEGE?>'>Guild Siege</option>
-                    <option value='<?=AREA_TYPE_ID::TARTARUS_LABYRINTH?>'>Tartarus Labyrinth</option>
-                    <option value='<?=AREA_TYPE_ID::TRIAL_OF_ASCENSION?>'>Trial of Ascension</option>
-                    <option value='<?=AREA_TYPE_ID::WORLD_BOSS?>'>World Boss</option>
-                    <option value='<?=AREA_TYPE_ID::DIMENSIONAL_RIFT?>'>Dimensinal Rift</option>
-                </select>
-            </td>
-        </tr>
-    </table>
-    <div id='filter_apply'>
-        <input type='submit' value='Apply'/>
-    </div>
-</form>

+ 0 - 1
application/view/inc/header.php

@@ -39,7 +39,6 @@
             <a href='/<?=$UID?>/artifacts/'>
                 Artifacts
             </a>
-            <br class='mobile'/>
             <a href='/<?=$UID?>/fusion/'>
                 Fusion
             </a>

+ 41 - 37
application/view/landing.php

@@ -41,43 +41,47 @@
 <?php
         include __DIR__ . "/inc/header.php";
 ?>
-        <section class='list'>
-            <h2>
-                Select player
-            </h2>
-            <article>
-                <!-- TODO: Action via JS, and fllback in controller -->
-                <form method='POST' action='/action/login/'>
-                    <table>
-                        <tr>
-                            <td class='label'>
-                                <label for='uname'>
-                                    Player
-                                </label>
-                            </td>
-                            <td class='input'>
-                                <input type='text' name='uname' id='uname' required/>
-                            </td>
-                        </tr>
-                        <tr>
-                            <td class='label'>
-                                <label for='password'>
-                                    Password
-                                </label>
-                            </td>
-                            <td class='input'>
-                                <input type='password' name='password' id='password' required/>
-                            </td>
-                        </tr>
-                        <tr>
-                            <td class='submit' colspan='2'>
-                                <input type='submit' value='Go'/>
-                            </td>
-                        </tr>
-                    </table>
-                </form>
-            </article>
-        </section> <!-- #catalog -->
+        <aside>
+        </aside>
+        <main>
+            <section class='list'>
+                <h2>
+                    Select player
+                </h2>
+                <article>
+                    <!-- TODO: Action via JS, and fllback in controller -->
+                    <form method='POST' action='/action/login/'>
+                        <table>
+                            <tr>
+                                <td class='label'>
+                                    <label for='uname'>
+                                        Player
+                                    </label>
+                                </td>
+                                <td class='input'>
+                                    <input type='text' name='uname' id='uname' required/>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td class='label'>
+                                    <label for='password'>
+                                        Password
+                                    </label>
+                                </td>
+                                <td class='input'>
+                                    <input type='password' name='password' id='password' required/>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td class='submit' colspan='2'>
+                                    <input type='submit' value='Go'/>
+                                </td>
+                            </tr>
+                        </table>
+                    </form>
+                </article>
+            </section> <!-- #catalog -->
+        </main>
 
 <?php
         include __DIR__ . "/inc/footer.php";

+ 486 - 485
application/view/monster.php

@@ -42,532 +42,533 @@
 <?php
         include __DIR__ . "/inc/header.php";
 ?>
-        <section id='monster' class='content'>
+        <aside>
             <h2>
-                <span>
-                    <?=$page->unit->title?>
-                </span>
+                <?=$page->unit->title?>
             </h2>
-            <article id='profile'>
-                <div id='monster_info'>
-                    <div class='monster_panel'>
-                        <?=HTML::unit_panel($page->unit)?>
-                    </div>
+            <div id='monster_info'>
+                <div class='monster_panel'>
+                    <?=HTML::unit_panel($page->unit)?>
+                </div>
 <?php
-                    if ($page->unit->experience_level != 0){
-                        $exp_pct = ceil($page->unit->exp_gained * 100 / $page->unit->experience_level);
-                        $exp_txt = $page->unit->exp_gained . " / " . $page->unit->experience_level;
-                    }
-                    else{
-                        $exp_pct = 100;
-                        $exp_txt = "MAX";
-                    }
-                    $now = time();
-                    //$datediff = $now - $page->unit->create_time->getTimestamp();
-                    $datediff = $now - strtotime($page->unit->create_time->format('Y-m-d H:i:s'));
-                    $datediff = floor($datediff / (60 * 60 * 24));
+                if ($page->unit->experience_level != 0){
+                    $exp_pct = ceil($page->unit->exp_gained * 100 / $page->unit->experience_level);
+                    $exp_txt = $page->unit->exp_gained . " / " . $page->unit->experience_level;
+                }
+                else{
+                    $exp_pct = 100;
+                    $exp_txt = "MAX";
+                }
+                $now = time();
+                //$datediff = $now - $page->unit->create_time->getTimestamp();
+                $datediff = $now - strtotime($page->unit->create_time->format('Y-m-d H:i:s'));
+                $datediff = floor($datediff / (60 * 60 * 24));
 ?>
-                    <div id='monster_details'>
-                        <div id='exp'>
-                            <span id='exp_bar' style='width:<?=$exp_pct?>%'></span>
-                            </span>
-                            <span id='exp_text'>
-                                <?=$exp_txt?>
-                            </span>
-                        </div>
-                        Obtained on <?=$page->unit->create_time->format('Y-m-d')?> (<?=$datediff?> days ago)<!-- from <?=$page->unit->source->name?> TODO SOurce name, days ago -->
+                <div id='monster_details'>
+                    <div id='exp'>
+                        <span id='exp_bar' style='width:<?=$exp_pct?>%'></span>
+                        </span>
+                        <span id='exp_text'>
+                            <?=$exp_txt?>
+                        </span>
+                    </div>
+                    Obtained on <?=$page->unit->create_time->format('Y-m-d')?> (<?=$datediff?> days ago)<!-- from <?=$page->unit->source->name?> TODO SOurce name, days ago -->
 <?php
-                        if (sizeof($page->unit->teams) > 0){
+                    if (sizeof($page->unit->teams) > 0){
 ?>
-                            <div id='teams'>
-                                <h4>
-                                    Teams:
-                                </h4>
-                                <ul>
+                        <div id='teams'>
+                            <h4>
+                                Teams:
+                            </h4>
+                            <ul>
 <?php
-                                    foreach($page->unit->teams as $team){
+                                foreach($page->unit->teams as $team){
 ?>
-                                        <li>
-                                            <a target='blank' href='/<?=$UID?>/teams/<?=$team->id?>'>
-                                                <?=$team->name?>
-                                            </a>
-                                        </li>
+                                    <li>
+                                        <a target='blank' href='/<?=$UID?>/teams/<?=$team->id?>'>
+                                            <?=$team->name?>
+                                        </a>
+                                    </li>
 <?php
-                                    }
+                                }
 ?>
-                                </ul>
-                            </div>
+                            </ul>
+                        </div>
 <?php
-                        }
+                    }
 ?>
-                    </div>
+                    <a id='optimize' class='a_button' href='/<?=$UID?>/optimizer/<?=$page->unit->id?>'>
+                        Optimize
+                    </a>
                 </div>
-                <table id='stats'>
-                    <tr>
-                        <th>
-                            Stats
-                        </th>
-                        <th>
-                            Base
-                        </th>
-                        <th>
-                            Runes
-                        </th>
-                        <th>
-                            Artifacts
-                        </th>
-                        <th>
-                            Buildings
-                        </th>
-                        <th>
-                            Total
-                        </th>
-                    </tr>
-                    <tr>
-                        <th>
-                            ATK
-                        </th>
-                        <td class='base'>
-                            <?=$page->unit->attack?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->rune_attack?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->artifact_attack?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->building_attack?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                        <td class='total'>
-                            <?=$page->unit->total_attack?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                    </tr>
-                    <tr>
-                        <th>
-                            DEF
-                        </th>
-                        <td class='base'>
-                            <?=$page->unit->defense?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->rune_defense?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->artifact_defense?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->building_defense?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                        <td class='total'>
-                            <?=$page->unit->total_defense?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                    </tr>
-                    <tr>
-                        <th>
-                            HP
-                        </th>
-                        <td class='base'>
-                            <?=$page->unit->hp?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->rune_hp?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->artifact_hp?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->building_hp?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                        <td class='total'>
-                            <?=$page->unit->total_hp?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                    </tr>
-                    <tr>
-                        <th>
-                            SPD
-                        </th>
-                        <td class='base'>
-                            <?=$page->unit->speed?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->rune_speed?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->artifact_speed?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->building_speed?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                        <td class='total'>
-                            <?=$page->unit->total_speed?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                    </tr>
-                    <tr>
-                        <th>
-                            CRR
-                        </th>
-                        <td class='base'>
-                            <?=$page->unit->crit_rate?>
-                            <span class='percent'>%</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->rune_crit_rate?>
-                            <span class='percent'>%</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->artifact_crit_rate?>
-                            <span class='percent'>%</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->building_crit_rate?>
-                            <span class='percent'>%</span>
-                        </td>
-                        <td class='total'>
-                            <?=$page->unit->total_crit_rate?>
-                            <span class='percent'>%</span>
-                        </td>
-                    </tr>
-                    <tr>
-                        <th>
-                            CRD
-                        </th>
-                        <td class='base'>
-                            <?=$page->unit->crit_damage?>
-                            <span class='percent'>%</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->rune_crit_damage?>
-                            <span class='percent'>%</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->artifact_crit_damage?>
-                            <span class='percent'>%</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->building_crit_damage?>
-                            <span class='percent'>%</span>
-                        </td>
-                        <td class='total'>
-                            <?=$page->unit->total_crit_damage?>
-                            <span class='percent'>%</span>
-                        </td>
-                    </tr>
-                    <tr>
-                        <th>
-                            ACC
-                        </th>
-                        <td class='base'>
-                            <?=$page->unit->accuracy?>
-                            <span class='percent'>%</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->rune_accuracy?>
-                            <span class='percent'>%</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->artifact_accuracy?>
-                            <span class='percent'>%</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->building_accuracy?>
-                            <span class='percent'>%</span>
-                        </td>
-                        <td class='total'>
-                            <?=$page->unit->total_accuracy?>
-                            <span class='percent'>%</span>
-                        </td>
-                    </tr>
-                    <tr>
-                        <th>
-                            RES
-                        </th>
-                        <td class='base'>
-                            <?=$page->unit->resistance?>
-                            <span class='percent'>%</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->rune_resistance?>
-                            <span class='percent'>%</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->artifact_resistance?>
-                            <span class='percent'>%</span>
-                        </td>
-                        <td class='extra'>
-                            +<?=$page->unit->building_resistance?>
-                            <span class='percent'>%</span>
-                        </td>
-                        <td class='total'>
-                            <?=$page->unit->total_resistance?>
-                            <span class='percent'>%</span>
-                        </td>
-                    </tr>
-                    <tr>
-                        <th colspan='5'>
-                            Effective HP
-                        </th>
-                        <td class='total'>
-                            <?=$page->unit->effective_hp?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                    </tr>
-                    <tr>
-                        <th colspan='5'>
-                            Effective DMG
-                        </th>
-                        <td class='total'>
-                            <?=$page->unit->effective_dmg?>
-                            <span class='percent'>&nbsp;</span>
-                        </td>
-                    </tr>
-                </table>
-                <table id='skills'>
-                    <tr>
-                        <th colspan='4'>
-                            Skills
-                        </th>
-                    <tr/>
+            </div>
+        </aside>
+        <main>
+            <section id='monster' class='content'>
+                <h2>
+                    <?=$page->unit->title?>
+                </h2>
+                <article id='stats'>
+                    <table>
+                        <tr>
+                            <th>
+                                Stats
+                            </th>
+                            <th>
+                                Base
+                            </th>
+                            <th>
+                                Runes
+                            </th>
+                            <th>
+                                Artifacts
+                            </th>
+                            <th>
+                                Buildings
+                            </th>
+                            <th>
+                                Total
+                            </th>
+                        </tr>
+                        <tr>
+                            <th>
+                                ATK
+                            </th>
+                            <td class='base'>
+                                <?=$page->unit->attack?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->rune_attack?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->artifact_attack?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->building_attack?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                            <td class='total'>
+                                <?=$page->unit->total_attack?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                        </tr>
+                        <tr>
+                            <th>
+                                DEF
+                            </th>
+                            <td class='base'>
+                                <?=$page->unit->defense?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->rune_defense?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->artifact_defense?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->building_defense?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                            <td class='total'>
+                                <?=$page->unit->total_defense?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                        </tr>
+                        <tr>
+                            <th>
+                                HP
+                            </th>
+                            <td class='base'>
+                                <?=$page->unit->hp?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->rune_hp?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->artifact_hp?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->building_hp?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                            <td class='total'>
+                                <?=$page->unit->total_hp?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                        </tr>
+                        <tr>
+                            <th>
+                                SPD
+                            </th>
+                            <td class='base'>
+                                <?=$page->unit->speed?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->rune_speed?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->artifact_speed?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->building_speed?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                            <td class='total'>
+                                <?=$page->unit->total_speed?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                        </tr>
+                        <tr>
+                            <th>
+                                CRR
+                            </th>
+                            <td class='base'>
+                                <?=$page->unit->crit_rate?>
+                                <span class='percent'>%</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->rune_crit_rate?>
+                                <span class='percent'>%</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->artifact_crit_rate?>
+                                <span class='percent'>%</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->building_crit_rate?>
+                                <span class='percent'>%</span>
+                            </td>
+                            <td class='total'>
+                                <?=$page->unit->total_crit_rate?>
+                                <span class='percent'>%</span>
+                            </td>
+                        </tr>
+                        <tr>
+                            <th>
+                                CRD
+                            </th>
+                            <td class='base'>
+                                <?=$page->unit->crit_damage?>
+                                <span class='percent'>%</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->rune_crit_damage?>
+                                <span class='percent'>%</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->artifact_crit_damage?>
+                                <span class='percent'>%</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->building_crit_damage?>
+                                <span class='percent'>%</span>
+                            </td>
+                            <td class='total'>
+                                <?=$page->unit->total_crit_damage?>
+                                <span class='percent'>%</span>
+                            </td>
+                        </tr>
+                        <tr>
+                            <th>
+                                ACC
+                            </th>
+                            <td class='base'>
+                                <?=$page->unit->accuracy?>
+                                <span class='percent'>%</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->rune_accuracy?>
+                                <span class='percent'>%</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->artifact_accuracy?>
+                                <span class='percent'>%</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->building_accuracy?>
+                                <span class='percent'>%</span>
+                            </td>
+                            <td class='total'>
+                                <?=$page->unit->total_accuracy?>
+                                <span class='percent'>%</span>
+                            </td>
+                        </tr>
+                        <tr>
+                            <th>
+                                RES
+                            </th>
+                            <td class='base'>
+                                <?=$page->unit->resistance?>
+                                <span class='percent'>%</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->rune_resistance?>
+                                <span class='percent'>%</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->artifact_resistance?>
+                                <span class='percent'>%</span>
+                            </td>
+                            <td class='extra'>
+                                +<?=$page->unit->building_resistance?>
+                                <span class='percent'>%</span>
+                            </td>
+                            <td class='total'>
+                                <?=$page->unit->total_resistance?>
+                                <span class='percent'>%</span>
+                            </td>
+                        </tr>
+                        <tr>
+                            <th colspan='5'>
+                                Effective HP
+                            </th>
+                            <td class='total'>
+                                <?=$page->unit->effective_hp?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                        </tr>
+                        <tr>
+                            <th colspan='5'>
+                                Effective DMG
+                            </th>
+                            <td class='total'>
+                                <?=$page->unit->effective_dmg?>
+                                <span class='percent'>&nbsp;</span>
+                            </td>
+                        </tr>
+                    </table>
+                </article>
+                <article id='artifacts'>
+                    <?=HTML::artifact_table($page->unit->artifact_type)?>
+                    <?=HTML::artifact_table($page->unit->artifact_element)?>
+                </article>
+                <article id='runes'>
 <?php
-                    if ($page->unit->unit->leader_skill){
+                    $total_efficiency = 0;
+                    $total_max_efficiency = 0;
+                    $total_reached_efficiency = 0;
+                    $total_level = 0;
+                    $total_stars = 0;
+                    $total_value = 0;
+                    $total_runes = 0;
+                    $show_list = [6, 1, 2, 5, 4, 3];
+                    //foreach ($page->unit->rune as $rune){
+                    foreach ($show_list as $i){
+                        $rune = $page->unit->rune[$i - 1];
+                        $total_efficiency += $rune->efficiency;
+                        $total_max_efficiency += $rune->max_efficiency;
+                        $total_reached_efficiency += ($rune->efficiency * 100 / $rune->max_efficiency);
+                        $total_level += $rune->level;
+                        $total_stars += $rune->stars;
+                        $total_value += $rune->value;
+                        $total_runes ++;
 ?>
+                        <?=HTML::rune_table($rune)?>
+<?php
+                    }
+?>
+                    <!--<table id='table_averages'>
+                        <tr>
+                            <td class='title'>
+                                Avg. level:
+                            </td>
+                            <td class='value'>
+                                <?=number_format($total_level / $total_runes, 2)?>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='title'>
+                                Avg. stars:
+                            </td>
+                            <td class='value'>
+                                <?=number_format($total_stars / $total_runes, 2)?>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='title'>
+                                Avg. value:
+                            </td>
+                            <td class='value'>
+                                <?=number_format($total_value / $total_runes, 2, '.', '')?>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='title'>
+                                Total value:
+                            </td>
+                            <td class='value'>
+                                <?=$total_value?>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='title'>
+                                Avg. efficiency:
+                            </td>
+                            <td class='value'>
+                                <?=number_format($total_efficiency / $total_runes, 2)?>
+                                <span class='percent'>%</span>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='title'>
+                                Avg. max. efficiency:
+                            </td>
+                            <td class='value'>
+                                <?=number_format($total_max_efficiency / $total_runes, 2)?>
+                                <span class='percent'>%</span>
+                            </td>
+                        </tr>
                         <tr>
-                            <td class='skill_img'>
-                                <img src='<?=$page->unit->unit->leader_skill->get_image()?>'/>
+                            <td class='title'>
+                                Avg. reached efficiency:
                             </td>
-                            <td colspan='3' class='skill_text'>
-                                <h4>
-                                    Leader Skill
-                                </h4>
-                                <p>
-                                    <?=$page->unit->unit->leader_skill->create_description()?>
-                                </p>
+                            <td class='value'>
+                                <?=number_format($total_reached_efficiency / $total_runes, 2)?>
+                                <span class='percent'>%</span>
                             </td>
                         </tr>
+                    </table>-->
+                </article>
+                <article id='skills'>
+                    <table id='skills'>
+                        <tr>
+                            <th colspan='4'>
+                                Skills
+                            </th>
+                        <tr/>
 <?php
-                    }
-                    $skill_num = 0;
-                    $absolute_level = 0;
-                    $absolute_max_level = 0;
-                    $ponderated_level = 0;
-                    $ponderated_max_level = 0;
-                    foreach ($page->unit->unit->skill as $skill){
-                        if ($skill->max_level > 1){
-                                $absolute_max_level += $skill->max_level - 1;
-                            }
-                            $cur_lvl = $page->unit->skill_levels[$skill_num];
+                        if ($page->unit->unit->leader_skill){
+?>
+                            <tr>
+                                <td class='skill_img'>
+                                    <img src='<?=$page->unit->unit->leader_skill->get_image()?>'/>
+                                </td>
+                                <td colspan='3' class='skill_text'>
+                                    <h4>
+                                        Leader Skill
+                                    </h4>
+                                    <p>
+                                        <?=$page->unit->unit->leader_skill->create_description()?>
+                                    </p>
+                                </td>
+                            </tr>
+<?php
+                        }
+                        $skill_num = 0;
+                        $absolute_level = 0;
+                        $absolute_max_level = 0;
+                        $ponderated_level = 0;
+                        $ponderated_max_level = 0;
+                        foreach ($page->unit->unit->skill as $skill){
                             if ($skill->max_level > 1){
-                                $absolute_level += $cur_lvl - 1;
-                                $ponderated_level += ($cur_lvl - 1) * (1 + ($skill_num / 2));
-                                $ponderated_max_level += ($skill->max_level - 1) * (1 + ($skill_num / 2));
-                            }
-                            $max_lvl = $skill->max_level;
-                            if ($max_lvl == $cur_lvl){
-                                $maxed = "maxed";
-                            }
-                            else{
-                                $maxed = "";
-                            }
+                                    $absolute_max_level += $skill->max_level - 1;
+                                }
+                                $cur_lvl = $page->unit->skill_levels[$skill_num];
+                                if ($skill->max_level > 1){
+                                    $absolute_level += $cur_lvl - 1;
+                                    $ponderated_level += ($cur_lvl - 1) * (1 + ($skill_num / 2));
+                                    $ponderated_max_level += ($skill->max_level - 1) * (1 + ($skill_num / 2));
+                                }
+                                $max_lvl = $skill->max_level;
+                                if ($max_lvl == $cur_lvl){
+                                    $maxed = "maxed";
+                                }
+                                else{
+                                    $maxed = "";
+                                }
 ?>
-                        <tr>
-                            <td class='skill_img'>
-                                <img src='<?=$skill->get_image()?>'/>
-                                <span class='skill_level <?=$maxed?>'>
-                                    <?=$cur_lvl?>/<?=$max_lvl?>
-                                </span>
-                            </td>
-                            <td class='skill_text'>
-                                <h4>
-                                    <?=$skill->name?>
-                                </h4>
-                                <p>
-                                    <?=$skill->description?>
-                                    &emsp;
-                                    <span class='formula'>
-                                        <?=$skill->multiplier_formula?>
+                            <tr>
+                                <td class='skill_img'>
+                                    <img src='<?=$skill->get_image()?>'/>
+                                    <span class='skill_level <?=$maxed?>'>
+                                        <?=$cur_lvl?>/<?=$max_lvl?>
                                     </span>
-                                </p>
-                                
-                                <div class='effects'>
+                                </td>
+                                <td class='skill_text'>
+                                    <h4>
+                                        <?=$skill->name?>
+                                    </h4>
+                                    <p>
+                                        <?=$skill->description?>
+                                        &emsp;
+                                        <span class='formula'>
+                                            <?=$skill->multiplier_formula?>
+                                        </span>
+                                    </p>
+                                    
+                                    <div class='effects'>
 <?php
-                                    foreach ($skill->effect as $effect){
+                                        foreach ($skill->effect as $effect){
 ?>
-                                        <img class='effect_img' title='<?=$effect->name?>' src='<?=$effect->get_image()?>'/>
+                                            <img class='effect_img' title='<?=$effect->name?>' src='<?=$effect->get_image()?>'/>
 <?php
-                                    }
+                                        }
 ?>
-                                </div>
-                            </td>
+                                    </div>
+                                </td>
 <?php
-                            $cur_lvl = $page->unit->skill_levels[$skill_num];
+                                $cur_lvl = $page->unit->skill_levels[$skill_num];
 ?>
-                            <td class='skill_ups'>
+                                <td class='skill_ups'>
 <?php
-                                if ($skill->max_level > 1){
+                                    if ($skill->max_level > 1){
 ?>
-                                    <table>
+                                        <table>
 <?php
-                                        foreach ($skill->level as $level){
-                                            if ($level->level > 1){
-                                                $aquired = "";
-                                                if ($level->level <= $cur_lvl){
-                                                    $aquired = "aquired";
-                                                }
+                                            foreach ($skill->level as $level){
+                                                if ($level->level > 1){
+                                                    $aquired = "";
+                                                    if ($level->level <= $cur_lvl){
+                                                        $aquired = "aquired";
+                                                    }
         ?>
-                                                <tr>
-                                                    <td class='level <?=$aquired?>'>
-                                                    Lv. <?=$level->level?>
-                                                </td>
-                                                    <td class='upgrade <?=$aquired?>'>
-                                                        <?=$level->description?>
+                                                    <tr>
+                                                        <td class='level <?=$aquired?>'>
+                                                        Lv. <?=$level->level?>
                                                     </td>
-                                                </tr>
+                                                        <td class='upgrade <?=$aquired?>'>
+                                                            <?=$level->description?>
+                                                        </td>
+                                                    </tr>
 <?php
+                                                }
                                             }
-                                        }
 ?>
-                                    </table>
+                                        </table>
 <?php
-                                }
-                                $skill_num ++;
-?>
-                            </td>
-                        </tr>
-<?php
-                    }
-?>
-                    <tr>
-                        <td colspan='3' id='skill_averages'>
-                            Absolute skill-ups: <?=number_format($absolute_level * 100 / $absolute_max_level, 2)?>
-                            <span class='percent'>%</span>
-                            <br/>
-                            Ponderated skill-ups: <?=number_format($ponderated_level * 100 / $ponderated_max_level, 2)?>
-                            <span class='percent'>%</span>
-                        </td>
-                    </tr>
-                </table>
-            </article> <!-- #profile -->
-        </section>
-        <section id='runes' class='content'>
-            <h2>
-                <span>
-                    Runes and Artifacts
-                </span>
-            </h2>
-            <article>
-                <?=HTML::artifact_table($page->unit->artifact_type)?>
-            </article>
-            <article>
-                <?=HTML::artifact_table($page->unit->artifact_element)?>
-            </article>
-            <br class='mobile'/>
-<?php
-            $total_efficiency = 0;
-            $total_max_efficiency = 0;
-            $total_reached_efficiency = 0;
-            $total_level = 0;
-            $total_stars = 0;
-            $total_value = 0;
-            $total_runes = 0;
-            foreach ($page->unit->rune as $rune){
-                $total_efficiency += $rune->efficiency;
-                $total_max_efficiency += $rune->max_efficiency;
-                $total_reached_efficiency += ($rune->efficiency * 100 / $rune->max_efficiency);
-                $total_level += $rune->level;
-                $total_stars += $rune->stars;
-                $total_value += $rune->value;
-                $total_runes ++;
+                                    }
+                                    $skill_num ++;
 ?>
-                <article>
-                    <?=HTML::rune_table($rune)?>
-                </article>
+                                </td>
+                            </tr>
 <?php
-            }
+                        }
 ?>
-            <article id='rune_averages'>
-                <table id='table_averages'>
-                    <tr>
-                        <td class='title'>
-                            Avg. level:
-                        </td>
-                        <td class='value'>
-                            <?=number_format($total_level / $total_runes, 2)?>
-                        </td>
-                    </tr>
-                    <tr>
-                        <td class='title'>
-                            Avg. stars:
-                        </td>
-                        <td class='value'>
-                            <?=number_format($total_stars / $total_runes, 2)?>
-                        </td>
-                    </tr>
-                    <tr>
-                        <td class='title'>
-                            Avg. value:
-                        </td>
-                        <td class='value'>
-                            <?=number_format($total_value / $total_runes, 2, '.', '')?>
-                        </td>
-                    </tr>
-                    <tr>
-                        <td class='title'>
-                            Total value:
-                        </td>
-                        <td class='value'>
-                            <?=$total_value?>
-                        </td>
-                    </tr>
-                    <tr>
-                        <td class='title'>
-                            Avg. efficiency:
-                        </td>
-                        <td class='value'>
-                            <?=number_format($total_efficiency / $total_runes, 2)?>
-                            <span class='percent'>%</span>
-                        </td>
-                    </tr>
-                    <tr>
-                        <td class='title'>
-                            Avg. max. efficiency:
-                        </td>
-                        <td class='value'>
-                            <?=number_format($total_max_efficiency / $total_runes, 2)?>
-                            <span class='percent'>%</span>
-                        </td>
-                    </tr>
-                    <tr>
-                        <td class='title'>
-                            Avg. reached efficiency:
-                        </td>
-                        <td class='value'>
-                            <?=number_format($total_reached_efficiency / $total_runes, 2)?>
-                            <span class='percent'>%</span>
-                        </td>
-                    </tr>
-                </table>
-            </article>
-        </section> <!-- runes -->
+                        <!--<tr>
+                            <td colspan='3' id='skill_averages'>
+                                Absolute skill-ups: <?=number_format($absolute_level * 100 / $absolute_max_level, 2)?>
+                                <span class='percent'>%</span>
+                                <br/>
+                                Ponderated skill-ups: <?=number_format($ponderated_level * 100 / $ponderated_max_level, 2)?>
+                                <span class='percent'>%</span>
+                            </td>
+                        </tr>-->
+                    </table>
+                </article> <!-- #skills -->
+            </section>
+        </main>
 
 <?php
         include __DIR__ . "/inc/footer.php";

+ 246 - 217
application/view/monster_info.php

@@ -40,242 +40,181 @@
     <body>
 <?php
         include __DIR__ . "/inc/header.php";
-        for ($i = 0; $i < 3; $i ++){
-            if ($page->monster[$i] != null){
-?>
-                <section class='content'>
-                    <h2>
-                        <?=$page->monster[$i]->title?>
-                    </h2>
-                    <article class='stage'>
-                        <div class='profile'>
-                            <div class='monster_panel'>
-                                <?=HTML::unit_panel($page->monster[$i])?>
-                            </div>
-                            <?=HTML::unit_transformation_panel($page->monster[$i])?>
-                        </div>
-                        <table class='stats'>
-                            <tr>
-                                <th>
-                                    Type
-                                </th>
-                                <td>
-                                    <?=$page->monster[$i]->archetype_name?>
-                                </td>
-                            </tr>
-                            <tr>
-                                <th>
-                                    ATK
-                                </th>
-                                <td>
-                                    <?=$page->monster[$i]->attack?>&nbsp;
-                                </td>
-                            </tr>
-                            <tr>
-                                <th>
-                                    DEF
-                                </th>
-                                <td>
-                                    <?=$page->monster[$i]->defense?>&nbsp;
-                                </td>
-                            </tr>
-                            <tr>
-                                <th>
-                                    HP
-                                </th>
-                                <td>
-                                    <?=$page->monster[$i]->hp?>&nbsp;
-                                </td>
-                            </tr>
-                            <tr>
-                                <th>
-                                    SPD
-                                </th>
-                                <td>
-                                    <?=$page->monster[$i]->speed?>&nbsp;
-                                </td>
-                            </tr>
-                            <tr>
-                                <th>
-                                    CRR
-                                </th>
-                                <td>
-                                    <?=$page->monster[$i]->crit_rate?>%
-                                </td>
-                            </tr>
-                            <tr>
-                                <th>
-                                    CRD
-                                </th>
-                                <td>
-                                    <?=$page->monster[$i]->crit_damage?>%
-                                </td>
-                            </tr>
-                            <tr>
-                                <th>
-                                    ACC
-                                </th>
-                                <td>
-                                    <?=$page->monster[$i]->accuracy?>%
-                                </td>
-                            </tr>
-                            <tr>
-                                <th>
-                                    RES
-                                </th>
-                                <td>
-                                    <?=$page->monster[$i]->resistance?>%
-                                </td>
-                            </tr>
-                        </table>
-                        <div class='extra'>
-<?php
-                            if (count($page->monster[$i]->sources) > 0){
-?>
-                                <!-- TODO NOT WORKING<div class='sources'>
-                                    <span>
-                                        Obtainable from:
-                                    </span>
-<?php
-                                    foreach ($page->monster[$i]->sources as $source){
-?>
-                                        <img title='<?=$source->name?>' class='source' src='<?=$source->get_image()?>' />
-<?php
-                                    }
-?>
-                                </div>-->
-<?php
-                            }
-                            if (count($page->monster[$i]->essences) > 0){
-?>
-                                <div class='essences'>
-                                    <span>
-                                        Awake with:
-                                    </span>
-<?php
-                                    foreach ($page->monster[$i]->essences as $essence){
-?>
-                                       <div class='essence border_<?=explode(" ", $essence["item"]->name)[2]?>'>
-                                            <img alt='<?=$essence["item"]->name?>' title='<?=$essence["amount"]?>x <?=$essence["item"]->name?>' class='essence' src='<?=$essence["item"]->get_image()?>'/>
-                                            <span>
-                                                <?=$essence["amount"]?>
-                                            </span>
-                                        </div>
-<?php
-                                    }
-?>
-                                </div>
-<?php
-                            }
-                            if (count($page->monster[$i]->sources) > 0){
-?>
-                                <div class='sources'>
-                                    <span>
-                                        Obtainable from:
-                                    </span>
-<?php
-                                    foreach ($page->monster[$i]->sources as $source){
-?>
-                                        <?=HTML::source_panel($source)?>
-<?php
-                                    }
 ?>
+        <aside>
+            <h2>
+                <?=str_replace(" - SWDB", "", $page->title)?>
+            </h2>
+            <p>
+                Monster info:
+            </p>
+            <nav>
+<?php
+                $i = 0;
+                foreach ($page->monster as $monster){
+?>
+                    <a href='#section_<?=$i?>'>
+                        <div class='monster_panel'>
+                            <?=HTML::unit_panel($page->monster[$i])?>
+                        </div>
+                    </a>
+<?php
+                $i ++;
+                }
+?>
+            </nav>
+        </aside>
+        <main>
+<?php
+            for ($i = 0; $i < 3; $i ++){
+                if ($page->monster[$i] != null){
+?>
+                    <section class='content' id='section_<?=$i?>'>
+                        <h2>
+                            <?=$page->monster[$i]->title?>
+                        </h2>
+                        <article class='stage'>
+                            <div class='profile'>
+                                <div class='monster_panel'>
+                                    <?=HTML::unit_panel($page->monster[$i])?>
                                 </div>
-<?php
-                            }
-?>
-                        </div> <!-- .extra -->
-                        <table class='skills'>
-                            <tr>
-                                <th colspan='4'>
-                                    Skills
-                                </th>
-                            <tr/>
-<?php
-                            if ($page->monster[$i]->leader_skill){
-?>
+                                <?=HTML::unit_transformation_panel($page->monster[$i])?>
+                            </div>
+                            <table class='stats'>
                                 <tr>
-                                    <td class='skill_img'>
-                                        <img src='<?=$page->monster[$i]->leader_skill->get_image()?>'/>
+                                    <th>
+                                        Type
+                                    </th>
+                                    <td>
+                                        <?=$page->monster[$i]->archetype_name?>
                                     </td>
-                                    <td colspan='3' class='skill_text'>
-                                        <h4>
-                                            Leader Skill
-                                        </h4>
-                                        <p>
-                                            <?=$page->monster[$i]->leader_skill->create_description()?>
-                                        </p>
+                                </tr>
+                                <tr>
+                                    <th>
+                                        ATK
+                                    </th>
+                                    <td>
+                                        <?=$page->monster[$i]->attack?>&nbsp;
                                     </td>
                                 </tr>
-<?php
-                            }
-                            foreach ($page->monster[$i]->skill as $skill){
-?>
                                 <tr>
-                                    <td class='skill_img'>
-                                        <img src='<?=$skill->get_image()?>'/>
+                                    <th>
+                                        DEF
+                                    </th>
+                                    <td>
+                                        <?=$page->monster[$i]->defense?>&nbsp;
                                     </td>
-                                    <td class='skill_text'>
-                                        <h4>
-                                            <?=$skill->name?>
-                                        </h4>
-                                        <p>
-                                            <?=$skill->description?>
-                                            &emsp;
-                                            <span class='formula'>
-                                                <?=$skill->multiplier_formula?>
-                                            </span>
-                                        </p>
-                                        
-                                        <div class='effects'>
-<?php
-                                            foreach ($skill->effect as $effect){
-?>
-                                                <img class='effect_img' title='<?=$effect->name?>' src='<?=$effect->get_image()?>'/>
+                                </tr>
+                                <tr>
+                                    <th>
+                                        HP
+                                    </th>
+                                    <td>
+                                        <?=$page->monster[$i]->hp?>&nbsp;
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <th>
+                                        SPD
+                                    </th>
+                                    <td>
+                                        <?=$page->monster[$i]->speed?>&nbsp;
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <th>
+                                        CRR
+                                    </th>
+                                    <td>
+                                        <?=$page->monster[$i]->crit_rate?>%
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <th>
+                                        CRD
+                                    </th>
+                                    <td>
+                                        <?=$page->monster[$i]->crit_damage?>%
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <th>
+                                        ACC
+                                    </th>
+                                    <td>
+                                        <?=$page->monster[$i]->accuracy?>%
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <th>
+                                        RES
+                                    </th>
+                                    <td>
+                                        <?=$page->monster[$i]->resistance?>%
+                                    </td>
+                                </tr>
+                            </table>
+                            <div class='extra'>
 <?php
-                                            }
+                                if (count($page->monster[$i]->sources) > 0){
 ?>
-                                        </div>
-                                    </td>
-                                    <td class='skill_ups'>
+                                    <!-- TODO NOT WORKING<div class='sources'>
+                                        <span>
+                                            Obtainable from:
+                                        </span>
 <?php
-                                        if ($skill->max_level > 1){
+                                        foreach ($page->monster[$i]->sources as $source){
 ?>
-                                            <table>
+                                            <img title='<?=$source->name?>' class='source' src='<?=$source->get_image()?>' />
 <?php
-                                            foreach ($skill->level as $level){
-                                                if ($level->level > 1){
+                                        }
 ?>
-                                                        <tr>
-                                                            <td class='level'>
-                                                                Lv. <?=$level->level?>
-                                                            </td>
-                                                            <td class='upgrade'>
-                                                                <?=$level->description?>
-                                                            </td>
-                                                        </tr>
+                                    </div>-->
 <?php
-                                                }
-                                            }
+                                }
+                                if (count($page->monster[$i]->essences) > 0){
 ?>
-                                            </table>
+                                    <div class='essences'>
+                                        <span>
+                                            Awake with:
+                                        </span>
+<?php
+                                        foreach ($page->monster[$i]->essences as $essence){
+?>
+                                        <div class='essence border_<?=explode(" ", $essence["item"]->name)[2]?>'>
+                                                <img alt='<?=$essence["item"]->name?>' title='<?=$essence["amount"]?>x <?=$essence["item"]->name?>' class='essence' src='<?=$essence["item"]->get_image()?>'/>
+                                                <span>
+                                                    <?=$essence["amount"]?>
+                                                </span>
+                                            </div>
 <?php
                                         }
 ?>
-                                    </td>
-                                </tr>
+                                    </div>
 <?php
-                            }
+                                }
+                                if (count($page->monster[$i]->sources) > 0){
 ?>
-                        </table>
-
+                                    <div class='sources'>
+                                        <span>
+                                            Obtainable from:
+                                        </span>
+<?php
+                                        foreach ($page->monster[$i]->sources as $source){
+?>
+                                            <?=HTML::source_panel($source)?>
 <?php
-                        if ($page->monster[$i]->transformation != null){
+                                        }
 ?>
+                                    </div>
+<?php
+                                }
+?>
+                            </div> <!-- .extra -->
                             <table class='skills'>
                                 <tr>
                                     <th colspan='4'>
-                                        Skills (transformed)
+                                        Skills
                                     </th>
                                 <tr/>
 <?php
@@ -296,7 +235,7 @@
                                     </tr>
 <?php
                                 }
-                                foreach ($page->monster[$i]->transformation->skill as $skill){
+                                foreach ($page->monster[$i]->skill as $skill){
 ?>
                                     <tr>
                                         <td class='skill_img'>
@@ -354,16 +293,106 @@
 <?php
                                 }
 ?>
-                            </table> <!-- #transformation_skills -->
+                            </table>
+
+<?php
+                            if ($page->monster[$i]->transformation != null){
+?>
+                                <table class='skills'>
+                                    <tr>
+                                        <th colspan='4'>
+                                            Skills (transformed)
+                                        </th>
+                                    <tr/>
+<?php
+                                    if ($page->monster[$i]->leader_skill){
+?>
+                                        <tr>
+                                            <td class='skill_img'>
+                                                <img src='<?=$page->monster[$i]->leader_skill->get_image()?>'/>
+                                            </td>
+                                            <td colspan='3' class='skill_text'>
+                                                <h4>
+                                                    Leader Skill
+                                                </h4>
+                                                <p>
+                                                    <?=$page->monster[$i]->leader_skill->create_description()?>
+                                                </p>
+                                            </td>
+                                        </tr>
+<?php
+                                    }
+                                    foreach ($page->monster[$i]->transformation->skill as $skill){
+?>
+                                        <tr>
+                                            <td class='skill_img'>
+                                                <img src='<?=$skill->get_image()?>'/>
+                                            </td>
+                                            <td class='skill_text'>
+                                                <h4>
+                                                    <?=$skill->name?>
+                                                </h4>
+                                                <p>
+                                                    <?=$skill->description?>
+                                                    &emsp;
+                                                    <span class='formula'>
+                                                        <?=$skill->multiplier_formula?>
+                                                    </span>
+                                                </p>
+                                                
+                                                <div class='effects'>
+<?php
+                                                    foreach ($skill->effect as $effect){
+?>
+                                                        <img class='effect_img' title='<?=$effect->name?>' src='<?=$effect->get_image()?>'/>
+<?php
+                                                    }
+?>
+                                                </div>
+                                            </td>
+                                            <td class='skill_ups'>
+<?php
+                                                if ($skill->max_level > 1){
+?>
+                                                    <table>
+<?php
+                                                    foreach ($skill->level as $level){
+                                                        if ($level->level > 1){
+?>
+                                                                <tr>
+                                                                    <td class='level'>
+                                                                        Lv. <?=$level->level?>
+                                                                    </td>
+                                                                    <td class='upgrade'>
+                                                                        <?=$level->description?>
+                                                                    </td>
+                                                                </tr>
 <?php
-                        }
+                                                        }
+                                                    }
+?>
+                                                    </table>
+<?php
+                                                }
+?>
+                                            </td>
+                                        </tr>
+<?php
+                                    }
+?>
+                                </table> <!-- #transformation_skills -->
+<?php
+                            }
 ?>
 
-                    </article>
-                </section>
+                        </article>
+                    </section>
+<?php
+                } // if ($page->monster[$i] != null)
+            } // for (int $i = 0; $i < 3; $i ++)
+?>
+        </main>
 <?php
-            } // if ($page->monster[$i] != null)
-        } // for (int $i = 0; $i < 3; $i ++)
         include __DIR__ . "/inc/footer.php";
 ?>
     </body>

+ 393 - 306
application/view/monsters.php

@@ -19,7 +19,6 @@
         <!-- CSS files -->
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>monsters.css'/>
-        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
         <!-- Meta tags -->
         <link rel='canonical' href='<?=$page->canonical?>'/>
         <link rel='author' href='<?=$page->author?>'/>
@@ -38,334 +37,422 @@
         <meta name='twitter:image' content='<?=$page->icon?>'/>
         <meta name='twitter:url' content='<?=$page->canonical?>'/>
         <meta name='robots' content='index follow'/>
-        <script>
-
-            /**
-             * Shows or hiddes the filters panel.
-             */
-            function toggleFilters(){
-                var content = document.getElementById('filters_content');
-                var slid = document.getElementById('filters_slid');
-                if (content.style.maxHeight != '30em'){
-                    content.style.maxHeight = '30em';
-                    slid.style.transform = 'rotate(90deg)';
-                }
-                else{
-                    content.style.maxHeight = '0px';
-                    slid.style.transform = 'rotate(0deg)';
-                }
-            };
-        </script>
     </head>
     <body>
 <?php
         include __DIR__ . "/inc/header.php";
 ?>
-        <section class='filters'>
-            <h2 id='filters_title' onClick='toggleFilters();'>
-                <img id='filters_slid' id='filters_slid' alt=' ' src='<?=URL::IMG["ICON"]?>slid.png'/>
-                Monster filters
+        <aside id='filters' class='content filters'>
+            <h2 id='filters_title'>
+                Monsters
             </h2>
-            <article id='filters_content'>
+            <p>
+                Monsters
+            </p>
+            <form action='/<?=$UID?>/monsters/' method='get'  id='filter_monsters' class='filter'>
+                <table>
+                    <tr>
+                        <td class='label'>
+                            Element:
+                        </td>
+                        <td class='value'>
 <?php
-                $filters = $page->filters;
-                include __DIR__ . "/inc/filter_monsters.php";
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["ELEMENT"] - 1] = "selected";
 ?>
-            </article>
-
-        </section> <!-- #filters -->
-        <section class='list'>
-            <h2>
-                Monsters
-            </h2>
-            <article>
+                            <select name='element'>
+                                <option> </option>
+                                <option value='<?=ELEMENT_ID::FIRE?>' <?=$selected[0]?>>Fire</option>
+                                <option value='<?=ELEMENT_ID::WATER?>' <?=$selected[1]?>>Water</option>
+                                <option value='<?=ELEMENT_ID::WIND?>' <?=$selected[2]?>>Wind</option>
+                                <option value='<?=ELEMENT_ID::LIGHT?>' <?=$selected[3]?>>Light</option>
+                                <option value='<?=ELEMENT_ID::DARK?>' <?=$selected[4]?>>Dark</option>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Stars:
+                        </td>
+                        <td class='value'>
+                            <input type='number' name='min_stars' id='filter_stars_min' min='1' max='6' value='<?=$page->filters["MIN_STARS"]?>'/>
+                            -
+                            <input type='number' name='max_stars' id='filter_stars_max' min='1' max='6' value='<?=$page->filters["MAX_STARS"]?>'/>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Name:
+                        </td>
+                        <td class='value'>
+                            <input type='text' name='name' id='filter_name' value='<?=$page->filters["NAME"]?>'/>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='filter' colspan='2'>
+<?php
+                            $checked = "";
+                            if ($page->filters["IN_STORAGE"]){
+                                $checked = "checked";
+                            }
+?>
+                            <input type='checkbox' name='in_storage' id='filter_in_storage'<?=$checked?>/>
+                            <label for='filter_in_storage'>Monsters in storage</label>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='filter' colspan='2'>
 <?php
-                foreach ($page->monsters as $mon){
+                            $checked = "";
+                            if ($page->filters["WITHOUT_RUNES"]){
+                                $checked = "checked";
+                            }
 ?>
-                    <div class='monster'>
-                        <a href='/<?=$UID?>/monsters/<?=$mon->id?>'>
-                            <div class='monster_panel'>
-                                <?=HTML::unit_panel($mon)?>
+                            <input type='checkbox' name='without_runes' id='filter_without_runes' <?=$checked?>/>
+                            <label for='filter_without_runes'>Monsters without runes<label>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Effects:
+                            <div class='help_tooltip'>
+                                <p>
+                                    Effect the monster can induce. Choose 'All' to search for all of the selected, or 'Any' to search for any of the selected effects. 
+                                </p>
                             </div>
-                        </a>
-                        <div class='monster_tooltip'>
-                            <h4>
-                                <?=$mon->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'>
-                                        <?=$mon->attack?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->rune_attack?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->artifact_attack?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->building_attack?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                    <td class='total'>
-                                        <?=$mon->total_attack?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <th>
-                                        DEF
-                                    </th>
-                                    <td class='base'>
-                                        <?=$mon->defense?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->rune_defense?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->artifact_defense?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->building_defense?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                    <td class='total'>
-                                        <?=$mon->total_defense?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <th>
-                                        HP
-                                    </th>
-                                    <td class='base'>
-                                        <?=$mon->hp?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->rune_hp?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->artifact_hp?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->building_hp?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                    <td class='total'>
-                                        <?=$mon->total_hp?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <th>
-                                        SPD
-                                    </th>
-                                    <td class='base'>
-                                        <?=$mon->speed?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->rune_speed?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->artifact_speed?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->building_speed?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                    <td class='total'>
-                                        <?=$mon->total_speed?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <th>
-                                        CRR
-                                    </th>
-                                    <td class='base'>
-                                        <?=$mon->crit_rate?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->rune_crit_rate?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->artifact_crit_rate?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->building_crit_rate?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                    <td class='total'>
-                                        <?=$mon->total_crit_rate?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <th>
-                                        CRD
-                                    </th>
-                                    <td class='base'>
-                                        <?=$mon->crit_damage?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->rune_crit_damage?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->artifact_crit_damage?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->building_crit_damage?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                    <td class='total'>
-                                        <?=$mon->total_crit_damage?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <th>
-                                        ACC
-                                    </th>
-                                    <td class='base'>
-                                        <?=$mon->accuracy?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->rune_accuracy?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->artifact_accuracy?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->building_accuracy?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                    <td class='total'>
-                                        <?=$mon->total_accuracy?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <th>
-                                        RES
-                                    </th>
-                                    <td class='base'>
-                                        <?=$mon->resistance?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->rune_resistance?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->artifact_resistance?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                    <td class='extra'>
-                                        +<?=$mon->building_resistance?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                    <td class='total'>
-                                        <?=$mon->total_resistance?>
-                                        <span class='percent'>%</span>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <th colspan='5'>
-                                        Effective HP
-                                    </th>
-                                    <td class='total'>
-                                        <?=$mon->effective_hp?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <th colspan='5'>
-                                        Effective DMG
-                                    </th>
-                                    <td class='total'>
-                                        <?=$mon->effective_dmg?>
-                                        <span class='percent'>&nbsp;</span>
-                                    </td>
-                                </tr>
-                            </table>
-                            <div class='skills'>
+                            <br/>
+                            <select name='effect_option' id='filter_effect_option'>
+                                <option value='or' <?=($page->filters["EFFECT_OPTION"] == "or") ? ("selected='selected'") : ("");?>>Any</option>
+                                <option value='and' <?=($page->filters["EFFECT_OPTION"] == "and") ? ("selected='selected'") : ("");?>>All</option>
+                            </select>
+                        </td>
+                        <td class='value'>
+                            <select multiple name='effect[]' id='filter_effect'>
 <?php
-                                $skill_num = 0;
-                                foreach ($mon->unit->skill as $skill){
-                                    $cur_lvl = $mon->skill_levels[$skill_num];
-                                    $max_lvl = $skill->max_level;
-                                    if ($max_lvl == $cur_lvl){
-                                        $maxed = "maxed";
+                                foreach ($page->effects as $effect){
+                                    if (in_array($effect->id, $page->filters["EFFECT"])){
+                                        $selected = "selected='selected'";
                                     }
                                     else{
-                                        $maxed = "";
+                                        $selected = "";
                                     }
+                                    $name = $effect->name;
+                                    $name = strtoupper($name);
+                                    $name = str_replace("INCREASE", "INC.", $name);
+                                    $name = str_replace("DECREASE", "DEC.", $name);
+                                    $name = str_replace("CRITICAL", "CRIT.", $name);
+                                    $name = str_replace("CONTINUOUS", "CONT.", $name);
+                                    $name = str_replace("DAMAGE", "DMG.", $name);
+                                    $name = str_replace("BENEFICIAL", "BENEF.", $name);
+                                    $name = str_replace("BENEFICIAL", "BENEF.", $name);
+                                    $name = str_replace("EFFECTS", "EFF.", $name);
+                                    $name = str_replace("EFFECT", "EFF.", $name);
 ?>
-                                    <div class='skill'>
-                                        <img src='<?=$skill->get_image()?>'/>
-                                        <span class='skill_level <?=$maxed?>'>
-                                            <?=$cur_lvl?>/<?=$max_lvl?>
-                                        </span>
-                                        <span class='skill_name'>
-                                            <?=$skill->name?>
-                                        </span>
-                                    </div>
+                                    <option value='<?=$effect->id?>' <?=$selected?>><?=$name?></option>
 <?php
-                                    $skill_num ++;
                                 }
 ?>
+                            </select>
+                        </td>
+                    </tr>
+                </table>
+                <input type='submit' value='Apply'/>
+            </form>
+        </aside> <!-- #filters -->
+        <main>
+            <section id='list' class='list'>
+                <h2>
+                    Monsters
+                </h2>
+                <article>
+<?php
+                    foreach ($page->monsters as $mon){
+?>
+                        <div class='monster'>
+                            <a href='/<?=$UID?>/monsters/<?=$mon->id?>'>
+                                <div class='monster_panel'>
+                                    <?=HTML::unit_panel($mon)?>
+                                </div>
+                            </a>
+                            <div class='monster_tooltip'>
+                                <h4>
+                                    <?=$mon->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'>
+                                            <?=$mon->attack?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->rune_attack?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->artifact_attack?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->building_attack?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                        <td class='total'>
+                                            <?=$mon->total_attack?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <th>
+                                            DEF
+                                        </th>
+                                        <td class='base'>
+                                            <?=$mon->defense?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->rune_defense?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->artifact_defense?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->building_defense?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                        <td class='total'>
+                                            <?=$mon->total_defense?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <th>
+                                            HP
+                                        </th>
+                                        <td class='base'>
+                                            <?=$mon->hp?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->rune_hp?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->artifact_hp?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->building_hp?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                        <td class='total'>
+                                            <?=$mon->total_hp?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <th>
+                                            SPD
+                                        </th>
+                                        <td class='base'>
+                                            <?=$mon->speed?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->rune_speed?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->artifact_speed?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->building_speed?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                        <td class='total'>
+                                            <?=$mon->total_speed?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <th>
+                                            CRR
+                                        </th>
+                                        <td class='base'>
+                                            <?=$mon->crit_rate?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->rune_crit_rate?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->artifact_crit_rate?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->building_crit_rate?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                        <td class='total'>
+                                            <?=$mon->total_crit_rate?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <th>
+                                            CRD
+                                        </th>
+                                        <td class='base'>
+                                            <?=$mon->crit_damage?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->rune_crit_damage?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->artifact_crit_damage?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->building_crit_damage?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                        <td class='total'>
+                                            <?=$mon->total_crit_damage?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <th>
+                                            ACC
+                                        </th>
+                                        <td class='base'>
+                                            <?=$mon->accuracy?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->rune_accuracy?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->artifact_accuracy?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->building_accuracy?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                        <td class='total'>
+                                            <?=$mon->total_accuracy?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <th>
+                                            RES
+                                        </th>
+                                        <td class='base'>
+                                            <?=$mon->resistance?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->rune_resistance?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->artifact_resistance?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                        <td class='extra'>
+                                            +<?=$mon->building_resistance?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                        <td class='total'>
+                                            <?=$mon->total_resistance?>
+                                            <span class='percent'>%</span>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <th colspan='5'>
+                                            Effective HP
+                                        </th>
+                                        <td class='total'>
+                                            <?=$mon->effective_hp?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <th colspan='5'>
+                                            Effective DMG
+                                        </th>
+                                        <td class='total'>
+                                            <?=$mon->effective_dmg?>
+                                            <span class='percent'>&nbsp;</span>
+                                        </td>
+                                    </tr>
+                                </table>
+                                <div class='skills'>
+<?php
+                                    $skill_num = 0;
+                                    foreach ($mon->unit->skill as $skill){
+                                        $cur_lvl = $mon->skill_levels[$skill_num];
+                                        $max_lvl = $skill->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->name?>
+                                            </span>
+                                        </div>
+<?php
+                                        $skill_num ++;
+                                    }
+?>
+                                </div>
                             </div>
                         </div>
-                    </div>
 <?php
-            }
+                }
 ?>
-                </article>
-            </section> <!-- #catalog -->
+                    </article>
+                </section> <!-- #catalog -->
+            </main>
 
 <?php
         include __DIR__ . "/inc/footer.php";

+ 84 - 64
application/view/optimizer.php

@@ -19,7 +19,6 @@
         <!-- CSS files -->
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>optimizer.css'/>
-        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
         <!-- Meta tags -->
         <link rel='canonical' href='<?=$page->canonical?>'/>
         <link rel='author' href='<?=$page->author?>'/>
@@ -78,8 +77,21 @@
              * @param score New score.
              * @return true on success, false on error.
              */
-            function changeScore(team, score){
-                // TODO
+            function rateTeam(team, score){
+                
+                params = '?uid=<?=$UID?>&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;
             }
 
@@ -158,84 +170,92 @@
 <?php
         include __DIR__ . "/inc/header.php";
 ?>
-        <section class='content'>
+        <aside>
             <h2>
-                Teams
+                Optimizer
             </h2>
-            <article>
-                <table id='teams'>
-                    <tr>
-                        <th>
-                            Team
-                        </th>
-                        <th>
-                            Description
-                        </th>
-                        <th>
-                            Units
-                        </th>
-                        <th>
-                            Score
-                        </th>
-                    </tr>
+            <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='/<?=$UID?>/monsters/'>monsters 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->teams as $team){
+                        $odd = "odd";
+                        foreach ($page->teams as $team){
 ?>
-                        <tr>
-                            <td class='team <?=$odd?>'>
-                                <?=$team->name?>
-                            </td>
-                            <td class='description <?=$odd?>'>
-                                <?=$team->description?>
-                            </td>
-                            <td class='units <?=$odd?>'>
+                            <tr>
+                                <td class='team <?=$odd?>'>
+                                    <?=$team->name?>
+                                </td>
+                                <td class='units <?=$odd?>'>
 <?php
-                                $prev_front = false;
-                                $front = "undefined";
-                                foreach ($team->unit as $unit){
-                                    $front = in_array($unit->id, $team->frontline);
-                                    if ($front != "undefined" && $prev_front != $front){
+                                    $prev_front = false;
+                                    $front = "undefined";
+                                    foreach ($team->unit as $unit){
+                                        $front = in_array($unit->id, $team->frontline);
+                                        if ($front != "undefined" && $prev_front != $front){
 ?>
-                                        <hr class='frontline'/>
+                                            <hr class='frontline'/>
 <?php
-                                    }
+                                        }
 ?>
-                                    <a href='/<?=$UID?>/monsters/<?=$unit->id?>' target='_blank'>
-                                        <div class='monster_panel'>
-                                            <?=HTML::unit_panel($unit)?>
+                                        <a href='/<?=$UID?>/monsters/<?=$unit->id?>' target='_blank'>
+                                            <div class='monster_panel'>
+                                                <?=HTML::unit_panel($unit)?>
 <?php
-                                            if ($unit->id == $team->leader){
+                                                if ($unit->id == $team->leader){
 ?>
-                                                <img alt='Leader' class='leader' src='<?=URL::IMG["ICON"]?>leader.png'/>
+                                                    <img alt='Leader' class='leader' src='<?=URL::IMG["ICON"]?>leader.png'/>
 <?php
-                                            }
+                                                }
 ?>
-                                        </div>
-                                    </a>
+                                            </div>
+                                        </a>
 <?php
-                                    $prev_front = $front;
-                                }
+                                        $prev_front = $front;
+                                    }
 ?>
-                            </td>
-                            <td class='score <?=$odd?>'>
-                                <input type='number' min='0' max='20' value='<?=$team->score?>' onChange='changeScore(<?=$team->id?>, this.value);'/>
-                            </td>
-                        </tr>
+                                </td>
+                                <td class='score <?=$odd?>'>
+                                    <input type='number' min='0' max='20' value='<?=$team->score?>' onChange='rateTeam(<?=$team->id?>, this.value);'/>
+                                </td>
+                            </tr>
 <?php
-                        if ($odd == ""){
-                            $odd = "odd";
-                        }
-                        else{
-                            $odd = "";
+                            if ($odd == ""){
+                                $odd = "odd";
+                            }
+                            else{
+                                $odd = "";
+                            }
                         }
-                    }
 ?>
-                </table>
-                <div id='unit_list'>
-                </div>
-            </article>
-        </section> <!-- .list -->
+                    </table>
+                    <div id='unit_list'>
+                    </div>
+                </article>
+            </section> <!-- .list -->
+        </main>
 
 <?php
         include __DIR__ . "/inc/footer.php";

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 609 - 602
application/view/optimizer_unit.php


+ 104 - 67
application/view/profile.php

@@ -199,75 +199,112 @@
 <?php
         include __DIR__ . "/inc/header.php";
 ?>
-        <section id='monster' class='content'>
+        <aside>
             <h2>
-                <span>
-                    <?=$page->name?>
-                </span>
+                <?=$page->name?>
             </h2>
-            <article>
-                <table id='profile'>
-                    <tr>
-                        <td class='title'>
-                            Username:
-                        </td>
-                        <td class='value'>
-                            <span>
-                                <?=$page->name?>
-                            </span>
-                        </td>
-                        <td class='action'>
-                            <input onclick='logout();' type='button' value='Logout'/>
-                        </td>
-                    </tr>
-                    <tr>
-                        <td class='title'>
-                            eMail:
-                        </td>
-                        <td class='value'>
-                            <span id='static_mail'>
-                                <?=$page->mail?>
-                            </span>
-                            <input id='edit_mail' type='text' value='<?=$page->mail?>'/>
-                        </td>
-                        <td class='action'>
-                            <input id='change_mail' onclick='changeMail();' type='button' value='Change'/>
-                            <input id='save_mail' onclick='saveMail();' type='button' value='Save'/>
-                        </td>
-                    </tr>
-                    <tr>
-                        <td class='title'>
-                            API key:
-                        </td>
-                        <td class='value'>
-                            <span id='api_key'>
-                                <?=$page->api_key?>
-                            </span>
-                        </td>
-                        <td class='action'>
-                            <input id='regenerate_api' onclick='regenerateApi();' type='button' value='Regenerate'/>
-                        </td>
-                    </tr>
-                    <tr>
-                        <td class='title'>
-                            Password:
-                        </td>
-                        <td class='value'>
-                            <span id='static_pass'>
-                                ********
-                            </span>
-                            <input id='edit_pass_current' type='password' placeholder='Currrent password'/>
-                            <input id='edit_pass_new' type='password' placeholder='New password'/>
-                            <input id='edit_pass_repeat' type='password' placeholder='Repeat password'/>
-                        </td>
-                        <td class='action'>
-                            <input id='change_pass' onclick='changePass();' type='button' value='Change'/>
-                            <input id='save_pass' onclick='savePass();' type='button' value='Save'/>
-                        </td>
-                    </tr>
-                </table>
-            </article>
-        </section> <!-- runes -->
+            <p>
+                Edit your profile settings
+            </p>
+        </aside>
+        <main>
+            <section class='content'>
+                <h2>
+                    <?=$page->name?>
+                </h2>
+                <article>
+                    <table id='profile'>
+                        <tr>
+                            <td class='title'>
+                                Username:
+                            </td>
+                            <td class='value'>
+                                <span>
+                                    <?=$page->name?>
+                                </span>
+                            </td>
+                            <td class='action'>
+                                <input onclick='logout();' type='button' value='Logout'/>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='title'>
+                                eMail:
+                            </td>
+                            <td class='value'>
+                                <span id='static_mail'>
+                                    <?=$page->mail?>
+                                </span>
+                                <input id='edit_mail' type='text' value='<?=$page->mail?>'/>
+                            </td>
+                            <td class='action'>
+                                <input id='change_mail' onclick='changeMail();' type='button' value='Change'/>
+                                <input id='save_mail' onclick='saveMail();' type='button' value='Save'/>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='title'>
+                                API key:
+                            </td>
+                            <td class='value'>
+                                <span id='api_key'>
+                                    <?=$page->api_key?>
+                                </span>
+                            </td>
+                            <td class='action'>
+                                <input id='regenerate_api' onclick='regenerateApi();' type='button' value='Regenerate'/>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='title'>
+                                Password:
+                            </td>
+                            <td class='value'>
+                                <span id='static_pass'>
+                                    ********
+                                </span>
+                                <input id='edit_pass_current' type='password' placeholder='Currrent password'/>
+                                <input id='edit_pass_new' type='password' placeholder='New password'/>
+                                <input id='edit_pass_repeat' type='password' placeholder='Repeat password'/>
+                            </td>
+                            <td class='action'>
+                                <input id='change_pass' onclick='changePass();' type='button' value='Change'/>
+                                <input id='save_pass' onclick='savePass();' type='button' value='Save'/>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='title'>
+                                Visibility:
+                            </td>
+                            <td id='visibility'>
+                                <input type='checkbox' name='defeat' id='filter_defeat' <?=$checked?> onChange='toggleVisibility(this.value);'/>
+                                <label for='filter_defeat'>Public profile</label>
+                                <div class='help_tooltip'>
+                                    <p>
+                                        When checked, other users can view you game data. This includes:
+                                        <span>Units</span>
+                                        <span>Teams</span>
+                                        <span>Runes, artifacts and enchantments</span>
+                                        <span>Your guild name</span>
+                                        <span>Records</span>
+                                        <span>Building levels</span>
+                                        <span>Guild name</span>
+                                        This data will never be shown to other players:
+                                        <span>Personal data (email, password...)</span>
+                                        <span>Run logs</span>
+                                        <span>Statistics</span>
+                                        <span>Guild member list</span>
+                                        <span>Inventory</span>
+                                        <span>Building levels</span>
+                                        <span>Guild name</span>
+                                    </p>
+                                </div>
+                            </td>
+                        </tr>
+                    </table>
+                </article>
+            </section>
+        </main>
         <div id='error_window'>
             <section class='content'>
                 <h2>

+ 38 - 44
application/view/report.php

@@ -18,7 +18,6 @@
         <!-- CSS files -->
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>report.css'/>
-        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
         <!-- Meta tags -->
         <link rel='canonical' href='<?=$page->canonical?>'/>
         <link rel='author' href='<?=$page->author?>'/>
@@ -42,51 +41,46 @@
 <?php
         include __DIR__ . "/inc/header.php";
 ?>
-        <section class='content report'>
+        <aside>
             <h2>
-                Pending skill-ups
+                Reports
             </h2>
-            <article>
-                <img alt=' ' src='<?=URL::IMG["UNIT"]?>00015105.png'> <!-- Devilmon image -->
-                <p>
-                    Shows a list of the monstes in need of skilling-up
-                    It sorts monster not by the absolute ammount of remaining power-ups, but by a ponderated list tht takes into account to which skills the previous power ups have gone, placing more value in the more advanced skills. 
-                </p>
-                <a class='a_button' href='/<?=$UID?>/report/skillup/'>
-                    Go
-                </a>
-            </article>
-        </section>
-        <section class='content report'>
-            <h2>
-                Runes to replace
-            </h2>
-            <article class='report'>
-                <img alt=' ' src='<?=URL::IMG["RUNE"]?>base.png'>
-                <p>
-                    Shows monsters with runes that can be upgraded.
-                    It list the runes that can be replaced by other runes in your inventory that have either more stars or a higher base quality.
-                </p>
-                <a class='a_button' href='/<?=$UID?>/report/runeupgrade/'>
-                    Go
-                </a>
-            </article>
-        </section>
-        <section class='content report'>
-            <h2>
-                Runes to upgrade
-            </h2>
-            <article class='report'>
-                <img alt=' ' src='<?=URL::IMG["GRIND"]?>gem_inmemorial.png'> 
-                <p>
-                    Shows monsters with runes that can be crafted.
-                    It list the grindstones and gems that are available for each rune.
-                </p>
-                <a class='a_button' href='/<?=$UID?>/report/runecraft/'>
-                    Go
-                </a>
-            </article>
-        </section>
+            <p>
+                Reports that will help you progress in the game.
+            </p>
+        </aside>
+        <main>
+            <section class='content report'>
+                <h2>
+                    Pending skill-ups
+                </h2>
+                <article>
+                    <img alt=' ' src='<?=URL::IMG["UNIT"]?>00015105.png'> <!-- Devilmon image -->
+                    <p>
+                        Shows a list of the monstes in need of skilling-up
+                        It sorts monster not by the absolute ammount of remaining power-ups, but by a ponderated list tht takes into account to which skills the previous power ups have gone, placing more value in the more advanced skills. 
+                    </p>
+                    <a class='a_button' href='/<?=$UID?>/report/skillup/'>
+                        Go
+                    </a>
+                </article>
+            </section>
+            <section class='content report'>
+                <h2>
+                    Runes to improve
+                </h2>
+                <article class='report'>
+                    <img alt=' ' src='<?=URL::IMG["GRIND"]?>gem_inmemorial.png'> 
+                    <p>
+                        Shows monsters with runes that can be grinded or enchanted.
+                        It list the grindstones and gems that are available for each rune.
+                    </p>
+                    <a class='a_button' href='/<?=$UID?>/report/runecraft/'>
+                        Go
+                    </a>
+                </article>
+            </section>
+        </main>
 <?php
         include __DIR__ . "/inc/footer.php";
 ?>

+ 432 - 46
application/view/report_runecraft.php

@@ -18,7 +18,6 @@
         <!-- CSS files -->
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>report_runecraft.css'/>
-        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
         <!-- Meta tags -->
         <link rel='canonical' href='<?=$page->canonical?>'/>
         <link rel='author' href='<?=$page->author?>'/>
@@ -40,79 +39,466 @@
         <script>
 
             /**
-             * Shows or hiddes the filters panel.
+             * Hack to treat all grindstone stat selects as one.
+             *
+             * @param clicked Numeric order of the select clicked.
+             * @param event onMouseDown event.
              */
-            function toggleFilters(){
-                var content = document.getElementById('filters_content');
-                var slid = document.getElementById('filters_slid');
-                if (content.style.maxHeight != '60em'){
-                    content.style.maxHeight = '60em';
-                    slid.style.transform = 'rotate(90deg)';
+            function fixGrindStatSelect(clicked, event){
+                if (!event.ctrlKey){
+                console.log("NO CTRL: " + clicked);
+                    // If controll was not being held, clean all other selects
+                    if (clicked == 0){
+                        document.getElementById("filter_grind_stat_1").selectedIndex = -1;
+                    }
+                    else if (clicked == 1){
+                        document.getElementById("filter_grind_stat_0").selectedIndex = -1;
+                    }
                 }
-                else{
-                    content.style.maxHeight = '0px';
-                    slid.style.transform = 'rotate(0deg)';
+            }
+
+            /**
+             * Hack to treat all enchant stat from selects as one.
+             *
+             * @param clicked Numeric order of the select clicked.
+             * @param event onMouseDown event.
+             */
+            function fixEnchantStatFromSelect(clicked, event){
+                if (!event.ctrlKey){
+                    // If controll was not being held, clean all other selects
+                    if (clicked == 0){
+                        document.getElementById("filter_gem_stat_from_1").selectedIndex = -1;
+                    }
+                    else if (clicked == 1){
+                        document.getElementById("filter_gem_stat_from_0").selectedIndex = -1;
+                    }
+                }
+            }
+
+            /**
+             * Hack to treat all enchant stat to selects as one.
+             *
+             * @param clicked Numeric order of the select clicked.
+             * @param event onMouseDown event.
+             */
+            function fixEnchantStatToSelect(clicked, event){
+                if (!event.ctrlKey){
+                    // If controll was not being held, clean all other selects
+                    if (clicked == 0){
+                        document.getElementById("filter_gem_stat_to_1").selectedIndex = -1;
+                    }
+                    else if (clicked == 1){
+                        document.getElementById("filter_gem_stat_to_0").selectedIndex = -1;
+                    }
                 }
-            };
+            }
         </script>
     </head>
     <body>
 <?php
         include __DIR__ . "/inc/header.php";
 ?>
-        <section class='filters'>
-            <h2 id='filters_title' onClick='toggleFilters();'>
-                <img id='filters_slid' id='filters_slid' alt=' ' src='<?=URL::IMG["ICON"]?>slid.png'/>
-                Upgrade filters
+        <aside>
+            <h2>
+                Report filters
             </h2>
-            <article id='filters_content'>
+            <form action='/<?=$UID?>/report/runecraft/' method='get' id='filter_runecraft' class='filter'>
+                <table>
+                    <tr>
+                        <td colspan='2' class='header'>
+                            Monster
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Name:
+                            <div class='help_tooltip'>
+                                <p>
+                                    Units whose name contains this (case insensitive). 
+                                </p>
+                            </div>
+                        </td>
+                        <td>
+                            <input type='text' name='monster_name' id='filter_name' value='<?=$page->filters["MONSTER_NAME"]?>'/>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Stars:
+                        </td>
+                        <td>
+                            <input type='number' name='monster_min_stars' id='filter_stars_min' min='1' max='6' value='<?=$page->filters["MONSTER_MIN_STARS"]?>'/>
+                            -
+                            <input type='number' name='monster_max_stars' id='filter_stars_max' min='1' max='6' value='<?=$page->filters["MONSTER_MAX_STARS"]?>'/>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Show units:
+                        </td>
+                        <td>
+<?php
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["TEAM"]] = "selected";
+?>
+                            <select name='unit'>
+                                <option value='0' <?=$selected[0]?>>All</option>
+                                <option value='1' <?=$selected[1]?>>In teams</option>
+                                <option value='2' <?=$selected[2]?>>In teams (score > 0)</option>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label' colspan='2'>
 <?php
-                $filters = $page->filters;
-                include __DIR__ . "/inc/filter_report_runecraft.php";
+                            $checked = "";
+                            if ($page->filters["MONSTER_IN_STORAGE"]){
+                                $checked = "checked";
+                            }
 ?>
-            </article>
+                            <input type='checkbox' name='monster_in_storage' id='filter_monster_in_storage' <?=$checked?>/>
+                            <label for='filter_monster_in_storage'>Show monsters in storage</label>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td colspan='2' class='header'>
+                            Runes
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Stars:
+                        </td>
+                        <td>
+                            <input type='number' name='rune_min_stars' id='filter_stars_min' min='1' max='6' value='<?=$page->filters["RUNE_MIN_STARS"]?>'/>
+                            -
+                            <input type='number' name='rune_max_stars' id='filter_stars_max' min='1' max='6' value='<?=$page->filters["RUNE_MAX_STARS"]?>'/>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Level:
+                        </td>
+                        <td>
+                            <input type='number' name='rune_min_level' id='filter_level_min' min='0' max='15' value='<?=$page->filters["RUNE_MIN_LEVEL"]?>'/>
+                            -
+                            <input type='number' name='rune_max_level' id='filter_level_max' min='0' max='15' value='<?=$page->filters["RUNE_MAX_LEVEL"]?>'/>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Quality:
+                        </td>
+                        <td>
+<?php
 
-        </section> <!-- #filters -->
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["RUNE_MIN_QUALITY"] - 1] = "selected";
+?>
+                            <select name='rune_min_quality' id='filter_quality_min'>
+                                <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
+                                <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
+                                <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
+                                <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
+                                <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
+                            </select>
+                            -
 <?php
-            foreach ($page->upgrades as $upgrade){
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["RUNE_MAX_QUALITY"] - 1] = "selected";
 ?>
-            <section class='content'>
+                            <select name='rune_max_quality' id='filter_quality_max'>
+                                <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
+                                <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
+                                <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
+                                <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
+                                <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            O. quality:
+                        </td>
+                        <td>
+<?php
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["RUNE_MIN_ORIGINAL_QUALITY"] - 1] = "selected";
+?>
+                            <select name='rune_min_original_quality' id='filter_original_quality_min'>
+                                <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
+                                <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
+                                <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
+                                <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
+                                <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
+                            </select>
+                            -
+<?php
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["RUNE_MAX_ORIGINAL_QUALITY"] - 1] = "selected";
+?>
+                            <select name='rune_max_original_quality' id='filter_original_quality_max'>
+                                <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
+                                <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
+                                <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
+                                <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
+                                <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Efficiency:
+                        </td>
+                        <td>
+                            <input type='number' name='rune_min_efficiency' id='filter_efficiency_min' min='0' max='100' value='<?=$page->filters["RUNE_MIN_EFFICIENCY"]?>'/>%
+                            -
+                            <input type='number' name='rune_max_efficiency' id='filter_efficiency_max' min='0' max='100' value='<?=$page->filters["RUNE_MAX_EFFICIENCY"]?>'/>%
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Max. eff.:
+                        </td>
+                        <td>
+                            <input type='number' name='rune_min_max_efficiency' id='filter_max_efficiency_min' min='0' max='100' value='<?=$page->filters["RUNE_MIN_MAX_EFFICIENCY"]?>'/>%
+                            -
+                            <input type='number' name='rune_max_max_efficiency' id='filter_max_efficiency_max' min='0' max='100' value='<?=$page->filters["RUNE_MAX_MAX_EFFICIENCY"]?>'/>%
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='slot label'>
+                            Slot:
+                        </td>
+                        <td class='slot'>
+                            <select multiple name='rune_slot[]' id='filter_slot'>
+<?php
+                                for ($i = 1; $i <= 6; $i ++){
+                                    if (in_array($i, $page->filters["RUNE_SLOT"])){
+                                        $selected = "selected='selected'";
+                                    }
+                                    else{
+                                        $selected = "";
+                                    }
+?>
+                                    <option value='<?=$i?>' <?=$selected?>><?=$i?></option>
+<?php
+                                }
+?>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td colspan='2' class='header'>
+<?php
+                            $checked = "";
+                            if ($page->filters["GRIND"]){
+                                $checked = "checked";
+                            }
+?>
+                            <input type='checkbox' name='grind' id='filter_grind' <?=$checked?>/>
+                            <label for='filter_grind'>Grindstones</label>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Min. quality:
+                        </td>
+                        <td>
+<?php
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["GRIND_MIN_QUALITY"] - 1] = "selected";
+?>
+                            <select name='grind_min_quality'>
+                                <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
+                                <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
+                                <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
+                                <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
+                                <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='stats label'>
+                            Stats:
+                        </td>
+                        <td class='stats'>
+                            <div>
+                                <select multiple name='grind_stat[]' id='filter_grind_stat_0' onMouseDown='fixGrindStatSelect(0, event);'>
+<?php
+                                    $reflect = new ReflectionClass("RUNE_STAT_ID");
+                                    $count = 1;
+                                    $i = 0;
+                                    foreach($reflect->getConstants() as $name => $id){
+                                        $selected = "";
+                                        if (in_array($id, $page->filters["GRIND_STAT"])){
+                                            $selected = "selected='selected'";
+                                        }
+                                        $name_format = ucwords(str_replace("_P", "%", $name));
+?>
+                                        <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
+<?php
+                                        if (($i + 1) % 2 == 0){
+?>
+                                            </select><select multiple name='grind_stat[]' id='filter_grind_stat_<?=$count?>'  onMouseDown='fixGrindStatSelect(<?=$count?>, event);'>
+<?php
+                                            $count ++;
+                                        }
+                                        $i ++;
+                                    }
+?>
+                                </select>
+                            </div>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td colspan='2' class='header'>
+<?php
+                            $checked = "";
+                            if ($page->filters["GEM"]){
+                                $checked = "checked";
+                            }
+?>
+                            <input type='checkbox' name='gem' id='filter_gem' <?=$checked?>/>
+                            <label for='filter_gem'>Gems</label>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Min. quality:
+                        </td>
+                        <td>
+<?php
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["GEM_MIN_QUALITY"] - 1] = "selected";
+?>
+                            <select name='gem_min_quality'>
+                                <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
+                                <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
+                                <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
+                                <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
+                                <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='stats label'>
+                            Replace...
+                        </td>
+                        <td class='stats'>
+                            <div>
+                                <select multiple name='gem_stat_from[]' id='filter_gem_stat_from_0' onMouseDown='fixEnchantStatFromSelect(0, event);'>
+<?php
+                                    $reflect = new ReflectionClass("RUNE_STAT_ID");
+                                    $count = 1;
+                                    $i = 0;
+                                    foreach($reflect->getConstants() as $name => $id){
+                                        $selected = "";
+                                        if (in_array($id, $page->filters["GEM_STAT_FROM"])){
+                                            $selected = "selected='selected'";
+                                        }
+                                        $name_format = ucwords(str_replace("_P", "%", $name));
+?>
+                                        <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
+<?php
+                                        if (($i + 1) % 2 == 0){
+?>
+                                            </select><select multiple name='gem_stat_from[]' id='filter_gem_stat_from_<?=$count?>'  onMouseDown='fixEnchantStatFromSelect(<?=$count?>, event);'>
+<?php
+                                            $count ++;
+                                        }
+                                        $i ++;
+                                    }
+?>
+                                </select>
+                            </div>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='stats label'>
+                            ...with:
+                        </td>
+                        <td class='stats'>
+                            <div>
+                                <select multiple name='gem_stat_from[]' id='filter_gem_stat_to_0'  onMouseDown='fixEnchantStatToSelect(0, event);'>
+<?php
+                                    $reflect = new ReflectionClass("RUNE_STAT_ID");
+                                    $count = 1;
+                                    $i = 0;
+                                    foreach($reflect->getConstants() as $name => $id){
+                                        $selected = "";
+                                        if (in_array($id, $page->filters["GEM_STAT_TO"])){
+                                            $selected = "selected='selected'";
+                                        }
+                                        $name_format = ucwords(str_replace("_P", "%", $name));
+?>
+                                        <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
+<?php
+                                        if (($i + 1) % 2 == 0){
+?>
+                                            </select><select multiple name='gem_stat_to[]' id='filter_gem_stat_to_<?=$count?>'  onMouseDown='fixEnchantStatToSelect(<?=$count?>, event);'>
+<?php
+                                            $count ++;
+                                        }
+                                        $i ++;
+                                    }
+?>
+                                </select>
+                            </td>
+                        </td>
+                    </tr>
+                </table>
+                <input type='submit' value='Apply'/>
+            </form>
+        </aside>
+        <main>
+            <section id='results' class='content'>
                 <h2>
                     <span>
                         <?=$upgrade["unit"]->title?>
                     </span>
                 </h2>
-                <article>
-                    <div class='monster'>
-                        <div class='profile'>
-                            <div class='monster_panel'>
-                                <?=HTML::unit_panel($upgrade["unit"])?>
-                            </div>
-                        </div> <!-- .profile -->
-                    </div>
-                    <div class='monster_runes'>
+                <table id='results'>
+<?php
+                    foreach ($page->upgrades as $upgrade){
+    ?>
+                        <tr>
+                            <td class='header' colspan='2'>
+                                <a href='/<?=$UID?>/monsters/<?=$unit->id?>/' target='_blank'>
+                                    <div class='monster_panel'>
+                                        <?=HTML::unit_panel($upgrade["unit"])?>
+                                    </div>
+                                </a>
+                                <h4>
+                                    <?=$upgrade["unit"]->title?>
+                                </h4>
+                            </td>
+                        </tr>
 <?php
                         foreach ($upgrade["upgrade"] as $rupgrade){
-?>
-                            <?=HTML::rune_table($rupgrade["rune"])?>
-                            <div class='craft'>
+    ?>
+                            <tr>
+                                <td class='rune'>
+                                    <?=HTML::rune_table($rupgrade["rune"])?>
+                                </td>
+                                <td class='upgrades'>
 <?php
-                                foreach ($rupgrade["craft"] as $craft){
-?>
-                                    <?=HTML::craft_panel($craft)?>
+                                    foreach ($rupgrade["craft"] as $craft){
+    ?>
+                                        <?=HTML::craft_panel($craft)?>
 <?php
-                                }
-?>
-                            </div>
-                            <br/>
+                                    }
+    ?>
+                                </td>
+                            </tr>
 <?php
                         }
-?>
-                    </div> <!-- .monster_runes -->
-                </article>
+                    }
+    ?>
+                </table>
             </section>
+        </main>
 <?php
-            }
         include __DIR__ . "/inc/footer.php";
 ?>
     </body>

+ 0 - 119
application/view/report_runeupgrade.php

@@ -1,119 +0,0 @@
-<?php
-    /**
-     * Rune upgrade report view.
-     *
-     * Contains the view layout and ome code to present the data.
-     *
-     * @category View
-     * @property_read Report_Runecupgrade_Page $page The page model.
-     */
-?>
-<!DOCTYPE html>
-<html lang='en'>
-    <head>
-        <meta content='text/html; charset=utf-8' http-equiv='content-type'/>
-        <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1'/>
-        <title><?=$page->title?></title>
-        <link rel='shortcut icon' href='<?=$page->favicon?>'/>
-        <!-- CSS files -->
-        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
-        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>report_runeupgrade.css'/>
-        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
-        <!-- Meta tags -->
-        <link rel='canonical' href='<?=$page->canonical?>'/>
-        <link rel='author' href='<?=$page->author?>'/>
-        <link rel='publisher' href='<?=$page->author?>'/>
-        <meta name='description' content='<?=$page->description?>'/>
-        <meta property='og:title' content='<?=$page->title?>'/>
-        <meta property='og:url' content='<?=$page->canonical?>'/>
-        <meta property='og:description' content='<?=$page->description?>'/>
-        <meta property='og:image' content='<?=$page->icon?>'/>
-        <meta property='og:site_name' content='<?=$page->name?>'/>
-        <meta property='og:type' content='website'/>
-        <meta property='og:locale' content='en'/>
-        <meta name='twitter:card' content='summary'/>
-        <meta name='twitter:title' content='<?=$page->title?>'/>
-        <meta name='twitter:description' content='<?=$page->description?>'/>
-        <meta name='twitter:image' content='<?=$page->icon?>'/>
-        <meta name='twitter:url' content='<?=$page->canonical?>'/>
-        <meta name='robots' content='index follow'/>
-        <script>
-
-            /**
-             * Shows or hiddes the filters panel.
-             */
-            function toggleFilters(){
-                var content = document.getElementById('filters_content');
-                var slid = document.getElementById('filters_slid');
-                if (content.style.maxHeight != '50em'){
-                    content.style.maxHeight = '50em';
-                    slid.style.transform = 'rotate(90deg)';
-                }
-                else{
-                    content.style.maxHeight = '0px';
-                    slid.style.transform = 'rotate(0deg)';
-                }
-            };
-        </script>
-    </head>
-    <body id='body_report_runeupgrade'>
-<?php
-        include __DIR__ . "/inc/header.php";
-?>
-        <section class='filters'>
-            <h2 id='filters_title' onClick='toggleFilters();'>
-                <img id='filters_slid' id='filters_slid' alt=' ' src='<?=URL::IMG["ICON"]?>slid.png'/>
-                Upgrade filters
-            </h2>
-            <article id='filters_content'>
-<?php
-                $filters = $page->filters;
-                $custom_filters = $page->custom_filters;
-                include __DIR__ . "/inc/filter_report_runeupgrade.php";
-?>
-            </article>
-
-        </section> <!-- #filters -->
-<?php
-            foreach ($page->upgrades as $upgrade){
-?>
-            <section class='content'>
-                <h2>
-                    <span>
-                        <?=$upgrade["unit"]->title?>
-                    </span>
-                </h2>
-                <article>
-                    <div class='monster'>
-                        <div class='profile'>
-                            <div class='monster_panel'>
-                                <?=HTML::unit_panel($upgrade["unit"])?>
-                            </div>
-                        </div> <!-- .profile -->
-                    </div>
-                    <div class='monster_runes'>
-<?php
-                        foreach ($upgrade["upgrade"] as $rupgrade){
-?>
-                            <?=HTML::rune_table($rupgrade["rune"])?>
-                            <div class='alternatives'>
-<?php
-                                foreach ($rupgrade["alternative"] as $alternative){
-?>
-                                    <?=HTML::rune_table($alternative, $alternative->assigned_to)?>
-<?php
-                                }
-?>
-                            </div>
-<?php
-                        }
-?>
-                    </div> <!-- .monster_runes -->
-                </article>
-            </section>
-<?php
-            }
-        include __DIR__ . "/inc/footer.php";
-?>
-    </body>
-</html>

+ 231 - 94
application/view/report_skillup.php

@@ -18,7 +18,6 @@
         <!-- CSS files -->
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>report_skillup.css'/>
-        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
         <!-- Meta tags -->
         <link rel='canonical' href='<?=$page->canonical?>'/>
         <link rel='author' href='<?=$page->author?>'/>
@@ -37,81 +36,203 @@
         <meta name='twitter:image' content='<?=$page->icon?>'/>
         <meta name='twitter:url' content='<?=$page->canonical?>'/>
         <meta name='robots' content='index follow'/>
-        <script>
-
-            /**
-             * Shows or hiddes the filters panel.
-             */
-            function toggleFilters(){
-                var content = document.getElementById('filters_content');
-                var slid = document.getElementById('filters_slid');
-                if (content.style.maxHeight != '30em'){
-                    content.style.maxHeight = '30em';
-                    slid.style.transform = 'rotate(90deg)';
-                }
-                else{
-                    content.style.maxHeight = '0px';
-                    slid.style.transform = 'rotate(0deg)';
-                }
-            };
-        </script>
     </head>
     <body id='body_report_skillup'>
 <?php
         include __DIR__ . "/inc/header.php";
 ?>
-        <section class='filters'>
-            <h2 id='filters_title' onClick='toggleFilters();'>
-                <img id='filters_slid' id='filters_slid' alt=' ' src='<?=URL::IMG["ICON"]?>slid.png'/>
-                Monster filters
+        <aside class='content filters' id='filters'>
+            <h2 id='filters_title'>
+                Report filters
             </h2>
             <article id='filters_content'>
+                <form action='/<?=$UID?>/report/skillup/' method='get' id='filter_skillup' class='filter'>
+                    <table>
+                        <tr>
+                            <td class='filter' id='filter_stars'>
+                                Stars:
+                            </td>
+                            <td>
+                                <input type='number' name='min_stars' min='1' max='6' value='<?=$page->filters["MIN_STARS"]?>'/>
+                                -
+                                <input type='number' name='max_stars'  min='1' max='6' value='<?=$page->filters["MAX_STARS"]?>'/>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='filter' id='filter_stars'>
+                                Natural stars:
+                            </td>
+                            <td>
+                                <input type='number' name='min_natural_stars' min='1' max='5' value='<?=$page->filters["MIN_NATURAL_STARS"]?>'/>
+                                -
+                                <input type='number' name='max_natural_stars' min='1' max='5' value='<?=$page->filters["MAX_NATURAL_STARS"]?>'/>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='filter'>
+                                Show units:
+                            </td>
+                            <td>
 <?php
-                $filters = $page->filters;
-                include __DIR__ . "/inc/filter_report_skillup.php";
+                                $selected = Array("", "", "", "", "");
+                                $selected[$page->filters["UNIT"]] = "selected";
 ?>
-            </article>
-
-        </section> <!-- #filters -->
+                                <select name='unit'>
+                                    <option value='0' <?=$selected[0]?>>All</option>
+                                    <option value='1' <?=$selected[1]?>>In teams</option>
+                                    <option value='2' <?=$selected[2]?>>In teams (score > 0)</option>
+                                </select>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td rowspan='2' class='filter'>
+                                Ponderation:
+                                <div class='help_tooltip'>
+                                    <p>
+                                        Skill weight in the calculation based on it's position. 
+                                    </p>
+                                </div>
+                            </td>
+                            <td class='filter'>
+                                &nbsp;S1:<input type='number' step='0.1' min='0' max='4' name='pond_1' id='pond_1' value='<?=$page->filters["PONDERATION"][0]?>'/>
+                                &nbsp;S2:<input type='number' step='0.1' min='0' max='4' name='pond_2' id='pond_2' value='<?=$page->filters["PONDERATION"][1]?>'/>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='filter'>
+                                &nbsp;S3:<input type='number' step='0.1' min='0' max='4' name='pond_3' id='pond_3' value='<?=$page->filters["PONDERATION"][2]?>'/>
+                                &nbsp;S4:<input type='number' step='0.1' min='0' max='4' name='pond_4' id='pond_4' value='<?=$page->filters["PONDERATION"][3]?>'/>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='filter' colspan='2'>
+<?php
+                                $checked = "";
+                                if ($page->filters["FAMILY"]){
+                                    $checked = "checked";
+                                }
+?>
+                                <input type='checkbox' name='family' id='filter_family' <?=$checked?>/>
+                                <label for='filter_family'>Mons. with lower grade siblings.</label>
+                                <div class='help_tooltip'>
+                                    <p>
+                                        Include monsters that have family members with less stars than seleced in the stars filters.
+                                    </p>
+                                </div>
+                                </span>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='filter' colspan='2'>
+<?php
+                                $checked = "";
+                                if ($page->filters["2A"]){
+                                    $checked = "checked";
+                                }
+?>
+                                <input type='checkbox' name='2a' id='filter_2a'<?=$checked?>/>
+                                <label for='filter_2a'>Include second-awakened monsters.</label>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='filter' colspan='2'>
+<?php
+                                $checked = "";
+                                if ($page->filters["HOMUNCULUS"]){
+                                    $checked = "checked";
+                                }
+?>
+                                <input type='checkbox' name='homunculus' id='filter_homunculus' <?=$checked?>/>
+                                <label for='filter_homunculus'>Include Homunculus.</label>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='filter' colspan='2'>
+<?php
+                                $checked = "";
+                                if ($page->filters["IN_STORAGE"]){
+                                    $checked = "checked";
+                                }
+?>
+                                <input type='checkbox' name='in_storage' id='filter_in_storage' <?=$checked?>/>
+                                <label for='filter_in_storage'>Show monsters in storage.</label>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='filter' colspan='2'>
+<?php
+                                $checked = "";
+                                if ($page->filters["WITHOUT_RUNES"]){
+                                    $checked = "checked";
+                                }
+?>
+                                <input type='checkbox' name='without_runes' id='filter_without_runes' <?=$checked?>/>
+                                <label for='filter_without_runes'>Show monsters without runes.</label>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='filter' colspan='2'>
 <?php
-        $index = 1;
-        foreach ($page->units as $unit){
-            switch ($index % 10){
-                case 1:
-                    $index_title = $index . "<span class='superindex'>st</span> - " . $unit->title;
-                    break;
-                case 2:
-                    $index_title = $index . "<span class='superindex'>nd</span> - " . $unit->title;
-                    break;
-                case 3:
-                    $index_title = $index . "<span class='superindex'>rd</span> - " . $unit->title;
-                    break;
-                default:
-                    $index_title = $index . "<span class='superindex'>th</span> - " . $unit->title;
-                    break;
-            }
-            switch ($index % 100){
-                case 11:
-                case 12:
-                case 13:
-                    $index_title = $index . "<span class='superindex'>th</span> - " . $unit_title;
-                    break;
-            }
+                                $checked = "";
+                                if ($page->filters["MAXED"]){
+                                    $checked = "checked";
+                                }
 ?>
-            <section class='content'>
+                                <input type='checkbox' name='maxed' id='filter_maxed' <?=$checked?>/>
+                                <label for='filter_maxed'>Show fully skilled-up monster</label>
+                            </td>
+                        </tr>
+                    </table>
+                    <input type='submit' value='Apply'/>
+                </form>
+            </article>
+        </aside> <!-- #filters -->
+        <main>
+            <section class='content' id='results'>
                 <h2>
                     <span>
-                        <?=$index_title?>
+                        Results
                     </span>
                 </h2>
-                <article>
-                    <div class='monster'>
-                        <div class='profile'>
-                            <div class='monster_panel'>
-                                <?=HTML::unit_panel($unit)?>
-                            </div>
-                        </div> <!-- .profile -->
-                        <div class='skills'>
+                <table id='results'>
+<?php
+                    $index = 1;
+                    foreach ($page->units as $unit){
+                        switch ($index % 10){
+                            case 1:
+                                $index_title = $index . "<span class='superindex'>st</span> - " . $unit->title;
+                                break;
+                            case 2:
+                                $index_title = $index . "<span class='superindex'>nd</span> - " . $unit->title;
+                                break;
+                            case 3:
+                                $index_title = $index . "<span class='superindex'>rd</span> - " . $unit->title;
+                                break;
+                            default:
+                                $index_title = $index . "<span class='superindex'>th</span> - " . $unit->title;
+                                break;
+                        }
+                        switch ($index % 100){
+                            case 11:
+                            case 12:
+                            case 13:
+                                $index_title = $index . "<span class='superindex'>th</span> - " . $unit_title;
+                                break;
+                        }
+?>
+                        <tr>
+                            <td colspan='7' class='header'>
+                                <?=$index_title?>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td rowspan='3' class='img'>
+                                <a href='/<?=$UID?>/monsters/<?=$unit->id?>/' target='_blank'>
+                                    <div class='monster_panel'>
+                                        <?=HTML::unit_panel($unit)?>
+                                    </div>
+                                </a>
+                            </td>
 <?php
                             $skill_num = 1;
                             $absolute_level = 0;
@@ -136,7 +257,7 @@
                                     $maxed = "";
                                 }
 ?>
-                                <div class='skill'>
+                                <td rowspan='3' class='skill'>
                                     <img title='<?=$skill->description?>' src='<?=$skill->get_image()?>'/>
                                     <span class='skill_level <?=$maxed?>'>
                                         <?=$cur_lvl?>/<?=$max_lvl?>
@@ -144,47 +265,63 @@
                                     <span class='skill_name'>
                                         <?=$skill->name?>
                                     </span>
-                                </div>
+                                </td>
 <?php
                                 $skill_num ++;
                             }
+                            while ($skill_num < 5){
 ?>
-                        </div> <!-- #skills -->
-                        <table id='skill_averages'>
-                            <tr>
-                                <td class='title'>
-                                    Absolute skill-ups:
+                                <td rowspan='3' class='skill empty'>
                                 </td>
-                                <td class='value'>
-                                    <?=number_format($absolute_level * 100 / $absolute_max_level, 2)?>%
-                                </td>
-                            </tr>
-                            <tr>
-                                <td class='title'>
+<?php
+                                $skill_num ++;
+                            }
+?>
+                            <td class='label'>
+                                <span class='desktop'>
+                                    Absolute skill-ups:
+                                </span>
+                                <span class='mobile'>
+                                    Abs:
+                                </span>
+                            </td>
+                            <td class='value'>
+                                <?=number_format($absolute_level * 100 / $absolute_max_level, 2)?>%
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='label'>
+                                <span class='desktop'>
                                     Ponderated skill-ups:
-                                </td>
-                                <td class='value'>
-                                    <?=number_format($ponderated_level * 100 / $ponderated_max_level, 2)?>%
-                                </td>
-                            </tr>
-                            <tr>
-                                <td class='title'>
+                                </span>
+                                <span class='mobile'>
+                                    Pond:
+                                </span>
+                            </td>
+                            <td class='value'>
+                                <?=number_format($ponderated_level * 100 / $ponderated_max_level, 2)?>%
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class='label'>
+                                <span class='desktop'>
                                     Remaining skill-ups:
-                                </td>
-                                <td class='value'>
-                                    <?=$absolute_max_level - $absolute_level?>
-                                </td>
-                            </tr>
-                        </table>
-                    </div>
-                </article>
-            </section> 
+                                </span>
+                                <span class='mobile'>
+                                    Left:
+                                </span>
+                            </td>
+                            <td class='value'>
+                                <?=$absolute_max_level - $absolute_level?>&nbsp;
+                            </td>
+                        </tr>
 <?php
-            $index ++;
-        }
+                    $index ++;
+                }
 ?>
-
-
+                </table>
+            </section>
+        </main>
 <?php
         include __DIR__ . "/inc/footer.php";
 ?>

+ 365 - 62
application/view/runes.php

@@ -18,7 +18,6 @@
         <!-- CSS files -->
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>runes.css'/>
-        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
         <!-- Meta tags -->
         <link rel='canonical' href='<?=$page->canonical?>'/>
         <link rel='author' href='<?=$page->author?>'/>
@@ -40,89 +39,393 @@
         <script>
 
             /**
-             * Shows or hiddes the filters panel.
+             * Hack to treat all type selects as one.
+             *
+             * @param clicked Numeric order of the select clicked.
+             * @param event onMouseDown event.
              */
-            function toggleFilters(){
-                var content = document.getElementById('filters_content');
-                var slid = document.getElementById('filters_slid');
-                if (content.style.maxHeight != '55em'){
-                    content.style.maxHeight = '55em';
-                    slid.style.transform = 'rotate(90deg)';
+            function fixTypeSelect(clicked, event){
+                if (!event.ctrlKey){
+                    // If controll was not being held, clean all other selects
+                    const selects = document.querySelectorAll('.select_type');
+                    Array.from(selects).forEach((element, index) => {
+                        if (element.id != "select_type_" + clicked){
+                            element.selectedIndex = -1;
+                        }
+                    });
                 }
-                else{
-                    content.style.maxHeight = '0px';
-                    slid.style.transform = 'rotate(0deg)';
+            }
+
+            /**
+             * Hack to treat all main stat selects as one.
+             *
+             * @param clicked Numeric order of the select clicked.
+             * @param event onMouseDown event.
+             */
+            function fixMainSelect(clicked, event){
+                if (!event.ctrlKey){
+                    // If controll was not being held, clean all other selects
+                    const selects = document.querySelectorAll('.select_main');
+                    Array.from(selects).forEach((element, index) => {
+                        if (element.id != "select_main_" + clicked){
+                            element.selectedIndex = -1;
+                        }
+                    });
                 }
-            };
+            }
+
+            /**
+             * Hack to treat all sub stat selects as one.
+             *
+             * @param clicked Numeric order of the select clicked.
+             * @param event onMouseDown event.
+             */
+            function fixSubSelect(clicked, event){
+                if (!event.ctrlKey){
+                    // If controll was not being held, clean all other selects
+                    const selects = document.querySelectorAll('.select_sub');
+                    Array.from(selects).forEach((element, index) => {
+                        if (element.id != "select_sub_" + clicked){
+                            element.selectedIndex = -1;
+                        }
+                    });
+                }
+            }
         </script>
     </head>
     <body>
 <?php
         include __DIR__ . "/inc/header.php";
 ?>
-        <section class='filters'>
-            <h2 id='filters_title' onClick='toggleFilters();'>
-                <img id='filters_slid' id='filters_slid' alt=' ' src='<?=URL::IMG["ICON"]?>slid.png'/>
+        <aside class='content filters' id='filters'>
+            <h2 id='filters_title'>
                 Rune filters
             </h2>
-            <article id='filters_content'>
+            <p>
+                Manage your runes
+            </p>
+            <form action='/<?=$UID?>/runes/' method='get' id='filter_runes' class='filter'>
+                <table>
+                    <tr>
+                        <td class='label' >
+                            Stars:
+                        </td>
+                        <td>
+                            <input type='number' name='min_stars' id='filter_stars_min' min='1' max='6' value='<?=$page->filters["MIN_STARS"]?>'/>
+                            -
+                            <input type='number' name='max_stars' id='filter_stars_max' min='1' max='6' value='<?=$page->filters["MAX_STARS"]?>'/>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Quality:
+                        </td>
+                        <td>
 <?php
-                $filters = $page->filters;
-                $custom_filters = $page->custom_filters;
-                include __DIR__ . "/inc/filter_runes.php";
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["MIN_QUALITY"] - 1] = "selected";
 ?>
-            </article>
-
-        </section> <!-- #filters -->
-<?php
-            $prev_group = "";
-            $group = "";
-            $group_title = "";
-            $group_image = "";
-            foreach ($page->runes as $rune){
-                switch ($page->filters["GROUP"]){
-                    case 1: // "TYPE":
-                        $group = $rune->type->name;
-                        $group_title = $rune->type->name;
-                        $group_image = URL::IMG["RUNE"] . str_pad($rune->type->id, 2, '0', STR_PAD_LEFT) . ".png";
-                        break;
-                    default:
-                        $group = $rune->slot;
-                        $group_title = "Slot " . $rune->slot;
-                        $group_image = URL::IMG["RUNE"] . "base.png";
-                }
-                if ($prev_group != $group){
-                    if ($prev_group == ""){
+                            <select name='min_quality' id='filter_quality_min'>
+                                <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
+                                <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
+                                <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
+                                <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
+                                <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
+                            </select>
+                            -
+<?php
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["MAX_QUALITY"] - 1] = "selected";
 ?>
-                        <section class='list'>
+                            <select name='max_quality' id='filter_quality_max'>
+                                <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
+                                <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
+                                <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
+                                <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
+                                <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            O. quality:
+                        </td>
+                        <td>
 <?php
-                    }
-                    else{
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["MIN_ORIGINAL_QUALITY"] - 1] = "selected";
 ?>
-                            </article>
-                        </section>
-                        <section class='list'>
+                            <select name='min_original_quality' id='filter_original_quality_min'>
+                                <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
+                                <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
+                                <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
+                                <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
+                                <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
+                            </select>
+                            -
 <?php
-                    }
-                    $prev_group = $group;
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["MAX_ORIGINAL_QUALITY"] - 1] = "selected";
 ?>
-                    <h2>
-                        <img class='group_image_<?=$group?>' alt='<?=$group_title?>' src='<?=$group_image?>'>
-                        <span>
-                            <?=$group_title?>
-                        </span>
-                    </h2>
-                    <article>
+                            <select name='max_original_quality' id='filter_original_quality_max'>
+                                <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
+                                <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
+                                <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
+                                <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
+                                <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Level:
+                        </td>
+                        <td>
+                            <input type='number' name='min_level' id='filter_level_min' min='0' max='15' value='<?=$page->filters["MIN_LEVEL"]?>'/>
+                            -
+                            <input type='number' name='max_level' id='filter_level_max' min='0' max='15' value='<?=$page->filters["MAX_LEVEL"]?>'/>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Efficiency:
+                        </td>
+                        <td>
+                            <input type='number' name='min_efficiency' id='filter_efficiency_min' min='0' max='100' value='<?=$page->filters["MIN_EFFICIENCY"]?>'/>%
+                            -
+                            <input type='number' name='max_efficiency' id='filter_efficiency_max' min='0' max='100' value='<?=$page->filters["MAX_EFFICIENCY"]?>'/>%
+                        </td>
+                    </tr>
+                        <td class='label'>
+                            Max. eff.:
+                        </td>
+                        <td>
+                            <input type='number' name='min_max_efficiency' id='filter_max_efficiency_min' min='0' max='100' value='<?=$page->filters["MIN_MAX_EFFICIENCY"]?>'/>%
+                            -
+                            <input type='number' name='max_max_efficiency' id='filter_max_efficiency_max' min='0' max='100' value='<?=$page->filters["MAX_MAX_EFFICIENCY"]?>'/>%
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Main stat:
+                        </td>
+                        <td class='stats'>
+                            <div>
+                                <select multiple name='main_stat[]' class='select_main' id='filter_main_stat_0' onMouseDown='fixMainSelect(0, event);'>
 <?php
-                }
+                                    $i = 0;
+                                    $j = 1;
+                                    $reflect = new ReflectionClass("RUNE_STAT_ID");
+                                    foreach($reflect->getConstants() as $name => $id){
+                                        $selected = "";
+                                        if (in_array($id, $page->filters["MAIN"])){
+                                            $selected = "selected='selected'";
+                                        }
+                                        $name_format = ucwords(str_replace("_P", "%", $name));
 ?>
-                <?=HTML::rune_table($rune, $rune->assigned_to)?>
+                                        <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
 <?php
-            }
+                                        if (($i + 1) % 2 == 0){
 ?>
-            </article> <!-- Close last group -->
-        </section>
-
+                                            </select><select multiple name='main_stat[]' class='select_main' id='filter_main_stat_<?=$j?>' onMouseDown='fixMainSelect(<?=$j?>, event);'>
+<?php
+                                            $j ++;
+                                        }
+                                        $i ++;
+                                    }
+?>
+                                </select>
+                            </div>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Sub stats:
+                        </td>
+                        <td class='stats'>
+                            <div>
+                                <select multiple name='sub_stat[]' class='select_sub' id='filter_sub_stat' onMouseDown='fixSubSelect(0, event);'>
+<?php
+                                    $reflect = new ReflectionClass("RUNE_STAT_ID");
+                                    $i = 0;
+                                    $j = 1;
+                                    foreach($reflect->getConstants() as $name => $id){
+                                        $selected = "";
+                                        if (in_array($id, $page->filters["SUB"])){
+                                            $selected = "selected='selected'";
+                                        }
+                                        $name_format = ucwords(str_replace("_P", "%", $name));
+?>
+                                        <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
+<?php
+                                        if (($i + 1) % 2 == 0){
+?>
+                                            </select><select multiple name='main_stat[]' class='select_sub' id='filter_sub_stat_<?=$j?>' onMouseDown='fixSubSelect(<?=$j?>, event);'>
+<?php
+                                            $j ++;
+                                        }
+                                        $i ++;
+                                    }
+?>
+                                </select>
+                            </div>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Type:
+                        </td>
+                        <td class='type'>
+                            <div>
+                                <select multiple name='type[]' class='select_type' id='select_type_0' onMouseDown='fixTypeSelect(0, event);'>
+<?php
+                                    $reflect = new ReflectionClass("RUNE_SET_ID");
+                                    $i = 0;
+                                    $j = 1;
+                                    foreach($reflect->getConstants() as $name => $id){
+                                        $selected = "";
+                                        if (in_array($id, $page->filters["TYPE"])){
+                                            $selected = "selected='selected'";
+                                        }
+                                        $name_format = ucwords(strtolower($name));
+                                        if (strlen($name_format) > 9){
+                                            $name_format = substr($name_format, 0, 9) . ".";
+                                        }
+?>
+                                        <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
+<?php
+                                        if (($i + 1) % 6 == 0 && ($i + 1) < sizeof($reflect->getConstants())){
+?>
+                                            </select><select multiple name='type[]' class='select_type' id='select_type_<?=$j?>' onMouseDown='fixTypeSelect(<?=$j?>, event);'>
+<?php
+                                            $j ++;
+                                        }
+                                        $i ++;
+                                    }
+?>
+                                </select>
+                            </div>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Slot:
+                        </td>
+                        <td class='slot'>
+                            <select multiple name='slot[]' id='filter_slot'>
+<?php
+                                for ($i = 1; $i <= 6; $i ++){
+                                    if (in_array($i, $page->filters["SLOT"])){
+                                        $selected = "selected='selected'";
+                                    }
+                                    else{
+                                        $selected = "";
+                                    }
+?>
+                                    <option value='<?=$i?>' <?=$selected?>><?=$i?></option>
+<?php
+                                }
+?>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='label'>
+                            Assigned:
+                        </td>
+                        <td>
+<?php
+                            $selected = Array("", "", "", "", "");
+                            $selected[$page->filters["ASSIGNED"]] = "selected";
+?>
+                            <select name='assigned' id='filter_assigned'>
+                                <option value='0' <?=$selected[0]?>>All</option>
+                                <option value='1' <?=$selected[1]?>>Assigned</option>
+                                <option value='2' <?=$selected[2]?>>Unassigned</option>
+                                <option value='3' <?=$selected[3]?>>All (no storage)</option>
+                                <option value='4' <?=$selected[4]?>>Assigned (no storage)</option>
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='filter'>
+                            Group by:
+                        </td>
+                        <td>
+<?php
+                            $selected = Array("", "");
+                            $selected[$page->filters["GROUP"]] = "selected";
+?>
+                            <select name='group' id='filter_group'>
+                                <option value='0' <?=$selected[0]?>>Slot</option>
+                                <option value='1' <?=$selected[1]?>>Type</option>
+                            </select>
+                        </td>
+                    </tr>
+                </table>
+                <input type='submit' value='Apply'/>
+            </form>
+        </aside> <!-- #filters -->
+        <main>
+            <section class='content' id='runes'>
+                <h2>
+                    Runes
+                </h2>
+                <table>
+<?php
+                    $prev_group = "";
+                    $group = "";
+                    $group_title = "";
+                    $group_image = "";
+                    foreach ($page->runes as $rune){
+                        switch ($page->filters["GROUP"]){
+                            case 1: // "TYPE":
+                                $group = $rune->type->name;
+                                $group_title = $rune->type->name;
+                                $group_image = URL::IMG["RUNE"] . str_pad($rune->type->id, 2, '0', STR_PAD_LEFT) . ".png";
+                                break;
+                            default:
+                                $group = $rune->slot;
+                                $group_title = "Slot " . $rune->slot;
+                                $group_image = URL::IMG["RUNE"] . "base.png";
+                        }
+                        if ($prev_group != $group){
+                            if ($prev_group == ""){
+?>
+                                <tr>
+                                    <td class='header'>
+<?php
+                            }
+                            else{
+?>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td class='header'>
+<?php
+                            }
+                            $prev_group = $group;
+?>
+                            <img class='group_image_<?=$group?>' alt='<?=$group_title?>' src='<?=$group_image?>'>
+                            <span>
+                                <?=$group_title?>
+                            </span>
+                            </td>
+                            </tr>
+                            <tr>
+                            <td>
+<?php
+                        }
+?>
+                        <?=HTML::rune_table($rune, $rune->assigned_to)?>
+<?php
+                    }
+?>
+                    </td> <!-- Close last group -->
+                    </tr>
+                </table>
+            </section>
+        </main>
 <?php
         include __DIR__ . "/inc/footer.php";
 ?>

+ 286 - 180
application/view/runs.php

@@ -19,7 +19,6 @@
         <!-- CSS files -->
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>runs.css'/>
-        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
         <!-- Meta tags -->
         <link rel='canonical' href='<?=$page->canonical?>'/>
         <link rel='author' href='<?=$page->author?>'/>
@@ -141,260 +140,367 @@
 <?php
         include __DIR__ . "/inc/header.php";
 ?>
-        <section class='filters'>
-            <h2 id='filters_title' onClick='toggleFilters();'>
-                <img id='filters_slid' id='filters_slid' alt=' ' src='<?=URL::IMG["ICON"]?>slid.png'/>
-                Run filters
-            </h2>
-            <article id='filters_content'>
-<?php
-                $filters = $page->filters;
-                include __DIR__ . "/inc/filter_runs.php";
-?>
-            </article>
-
-        </section> <!-- #filters -->
-        <section class='content'>
+        <aside>
             <h2>
-                Runs
+                Logged runs
             </h2>
-            <article>
-                <table id='runs'>
+            <p>
+                View and compare saved runs
+            </p>
+            <form action='/<?=$UID?>/runs/' method='get' id='filter_runeupgrade' class='filter'>
+                <table>
                     <tr>
-                        <th>
+                        <td class='label'>
                             Area
-                        </th>
-                        <th>
-                            Date
-                        </th>
-                        <th>
-                            Team
-                        </th>
-                        <th>
-                            Time/Rank
-                        </th>
-                        <th>
-                            Reward
-                        </th>
+                        </td>
+                        <td>
+<?php
+                            $selected = array_fill(0, 12 + 1, "");
+                            $selected[$page->filters["AREA_TYPE"]] = "selected";
+?>
+                            <select name='area_type' id='filter_area_type' onchange='selectAreaType();'>
+                                <option value='0'>All</option>
+                                <option value='<?=AREA_TYPE_ID::SCENARIO?>' <?=$selected[AREA_TYPE_ID::SCENARIO]?>>Scenario</option>
+                                <option value='<?=AREA_TYPE_ID::CAIROS_DUNGEON?>' <?=$selected[AREA_TYPE_ID::CAIROS_DUNGEON]?>>Cairos Dungeon</option>
+                                <option value='<?=AREA_TYPE_ID::RIFT_DUNGEON?>' <?=$selected[AREA_TYPE_ID::RIFT_DUNGEON]?>>Rift Beast</option>
+                                <option value='<?=AREA_TYPE_ID::RIFT_RAID?>' <?=$selected[AREA_TYPE_ID::RIFT_RAID]?>>Rift Raid</option>
+                                <option value='<?=AREA_TYPE_ID::DIMENSIONAL_HOLE?>' <?=$selected[AREA_TYPE_ID::DIMENSIONAL_HOLE]?>>Dimensional Hole</option>
+                                <option value='<?=AREA_TYPE_ID::ARENA?>' <?=$selected[AREA_TYPE_ID::ARENA]?>>Arena</option>
+                                <option value='<?=AREA_TYPE_ID::GUILD_WAR?>' <?=$selected[AREA_TYPE_ID::GUILD_WAR]?>>Guild War</option>
+                                <option value='<?=AREA_TYPE_ID::GUILD_SIEGE?>' <?=$selected[AREA_TYPE_ID::GUILD_SIEGE]?>>Guild Siege</option>
+                                <option value='<?=AREA_TYPE_ID::TARTARUS_LABYRINTH?>' <?=$selected[AREA_TYPE_ID::TARTARUS_LABYRINTH]?>>Tartarus Labyrinth</option>
+                                <option value='<?=AREA_TYPE_ID::TRIAL_OF_ASCENSION?>' <?=$selected[AREA_TYPE_ID::TRIAL_OF_ASCENSION]?>>Trial of Ascension</option>
+                                <option value='<?=AREA_TYPE_ID::WORLD_BOSS?>' <?=$selected[AREA_TYPE_ID::WORLD_BOSS]?>>World Boss</option>
+                                <option value='<?=AREA_TYPE_ID::DIMENSIONAL_RIFT?>' <?=$selected[AREA_TYPE_ID::DIMENSIONAL_RIFT]?>>Dimensional Rift</option>
+                            </select>
+<?php
+                            $selected = array_fill(0, 9002, "");
+                            $selected[$page->filters["AREA"]] = "selected";
+?>
+                            <select id='filter_area_scenario' class='filter_area'>
+                                <option value='0'>All</option>
+                                <option value='<?=SCENARIO_ID::GAREN_FOREST?>' <?=$selected[SCENARIO_ID::GAREN_FOREST]?>>Garen Forest</option>
+                                <option value='<?=SCENARIO_ID::MT_SIZ?>' <?=$selected[SCENARIO_ID::MT_SIZ]?>>Mt. Siz</option>
+                                <option value='<?=SCENARIO_ID::KABIR_RUINS?>' <?=$selected[SCENARIO_ID::KABIR_RUINS]?>>Kabir Ruins</option>
+                                <option value='<?=SCENARIO_ID::MT_WHITE_RAGON?>' <?=$selected[SCENARIO_ID::MT_WHITE_RAGON]?>>Mt. White Ragon</option>
+                                <option value='<?=SCENARIO_ID::TELAIN_FOREST?>' <?=$selected[SCENARIO_ID::TELAIN_FOREST]?>>Telain Forest</option>
+                                <option value='<?=SCENARIO_ID::HYDENI_RUINS?>' <?=$selected[SCENARIO_ID::HYDENI_RUINS]?>>Hydeni Ruins</option>
+                                <option value='<?=SCENARIO_ID::TAMOR_DESERT?>' <?=$selected[SCENARIO_ID::TAMOR_DESERT]?>>Tamor Desert</option>
+                                <option value='<?=SCENARIO_ID::VROFAGUS_RUINS?>' <?=$selected[SCENARIO_ID::VROFAGUS_RUINS]?>>Vrofagus Ruins</option>
+                                <option value='<?=SCENARIO_ID::FAIMON_VOLCANO?>' <?=$selected[SCENARIO_ID::FAIMON_VOLCANO]?>>Faimon Volcano</option>
+                                <option value='<?=SCENARIO_ID::AIDEN_FOREST?>' <?=$selected[SCENARIO_ID::AIDEN_FOREST]?>>Aiden Forest</option>
+                                <option value='<?=SCENARIO_ID::FERUN_CASTLE?>' <?=$selected[SCENARIO_ID::FERUN_CASTLE]?>>Ferun Castle</option>
+                                <option value='<?=SCENARIO_ID::MT_RUNAR?>' <?=$selected[SCENARIO_ID::MT_RUNAR]?>>Mt. Runar</option>
+                                <option value='<?=SCENARIO_ID::CHIRUKA_REMAINS?>' <?=$selected[SCENARIO_ID::CHIRUKA_REMAINS]?>>Charuka Remains</option>
+                            </select>
+                            <select id='filter_area_cairos' class='filter_area'>
+                                <option value='0'>All</option>
+                                <option value='<?=DUNGEON_ID::GIANTS_KEEP?>' <?=$selected[DUNGEON_ID::GIANTS_KEEP]?>>Giant&#39;s Keep</option>
+                                <option value='<?=DUNGEON_ID::DRAGONS_LAIR?>' <?=$selected[DUNGEON_ID::DRAGONS_LAIR]?>>Dragon&#39;s Lair</option>
+                                <option value='<?=DUNGEON_ID::NECROPOLIS?>' <?=$selected[DUNGEON_ID::NECROPOLIS]?>>Necropolis</option>
+                                <option value='<?=DUNGEON_ID::HALL_OF_MAGIC?>' <?=$selected[DUNGEON_ID::HALL_OF_MAGIC]?>>Hall of Magic</option>
+                                <option value='<?=DUNGEON_ID::HALL_OF_LIGHT?>' <?=$selected[DUNGEON_ID::HALL_OF_LIGHT]?>>Hall of Light</option>
+                                <option value='<?=DUNGEON_ID::HALL_OF_DARK?>' <?=$selected[DUNGEON_ID::HALL_OF_DARK]?>>Hall of Dark</option>
+                                <option value='<?=DUNGEON_ID::HALL_OF_FIRE?>' <?=$selected[DUNGEON_ID::HALL_OF_FIRE]?>>Hall of Fire</option>
+                                <option value='<?=DUNGEON_ID::HALL_OF_WATER?>' <?=$selected[DUNGEON_ID::HALL_OF_WATER]?>>Hall of Water</option>
+                                <option value='<?=DUNGEON_ID::HALL_OF_WIND?>' <?=$selected[DUNGEON_ID::HALL_OF_WIND]?>>Hall of Wind</option>
+                            </select>
+                            <select id='filter_area_rift_dungeon' class='filter_area'>
+                                <option value='0'>All</option>
+                                <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::LIGHT_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::LIGHT_BEAST]?>>Light Beast</option>
+                                <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::DARK_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::DARK_BEAST]?>>Dark Beast</option>
+                                <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::FIRE_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::FIRE_BEAST]?>>Fire Beast</option>
+                                <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::ICE_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::ICE_BEAST]?>>Ice Beast</option>
+                                <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::WIND_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::WIND_BEAST]?>>Wind Beast</option>
+                            </select>
+                        </td>
                     </tr>
+                    <tr>
+                        <td class='label'>
+                            Date range:
+                        </td>
+                        <td>
+                            <input type='date' name='date_min' id='date_min' value='<?=$page->filters["DATE_MIN"]?>'/>
+                            -
+                            <input type='date' name='date_max' id='date_max' value='<?=$page->filters["DATE_MAX"]?>'/>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td colspan='2'>
 <?php
-                    foreach ($page->runs as $run){
-                        $enable_save = true;
+                            $checked = "";
+                            if ($page->filters["DEFEAT"]){
+                                $checked = "checked";
+                            }
 ?>
-                        <tr id='run_<?=$run->id?>'>
-                            <td class='area'>
-                                <div class='area'>
-                                    <img title='<?=$run->area->name?>' class='area' src='<?=$run->area->get_image($run->stage)?>'/>
+                            <input type='checkbox' name='defeat' id='filter_defeat' <?=$checked?>/>
+                            <label for='filter_defeat'>Show defeats</label>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td colspan='2'>
 <?php
-                                    if ($run->stage > 0){
+                            $checked = "";
+                            if ($page->filters["HELPER"]){
+                                $checked = "checked";
+                            }
 ?>
-                                        <span class='stage'><?=$run->stage?></span>
+                            <input type='checkbox' name='helper' id='filter_helper' <?=$checked?>/>
+                            <label for='filter_helper'>Show runs with friends/mentors</label>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td colspan='2'>
+                            <input type='number' name='number' id='number' min='1' value='<?=$page->filters["NUMBER"]?>'/> runs per page
+                        </td>
+                    </tr>
+                </table>
+                <input type='submit' value='Apply'/>
+            </form>
+        </aside>
+        <main>
+            <section class='content'>
+                <h2>
+                    Runs
+                </h2>
+                <article>
+                    <table id='runs'>
+                        <tr>
+                            <th>
+                                Area
+                            </th>
+                            <th>
+                                Date
+                            </th>
+                            <th>
+                                Team
+                            </th>
+                            <th>
+                                Time/Rank
+                            </th>
+                            <th>
+                                Reward
+                            </th>
+                        </tr>
 <?php
-                                    }
-                                    if(APPLICATION::valid_id("SCENARIO_ID", $run->area->id)){
+                        foreach ($page->runs as $run){
+                            $enable_save = true;
 ?>
-                                        <span class='difficulty'>
+                            <tr id='run_<?=$run->id?>'>
+                                <td class='area'>
+                                    <div class='area'>
+                                        <img title='<?=$run->area->name?>' class='area' src='<?=$run->area->get_image($run->stage)?>'/>
 <?php
-                                            if ($run->area->type == AREA_TYPE_ID::TARTARUS_LABYRINTH){
-                                                $difficulty = $run->difficulty;
-                                            }
-                                            else{
-                                                $difficulty = $run->difficulty - 1;
-                                            }
-                                            for ($i = 0; $i < $difficulty; $i ++){
+                                        if ($run->stage > 0){
 ?>
-                                                <img class='difficulty' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                            <span class='stage'><?=$run->stage?></span>
 <?php
-                                            }
+                                        }
+                                        if(APPLICATION::valid_id("SCENARIO_ID", $run->area->id)){
 ?>
-                                        </span>
+                                            <span class='difficulty'>
 <?php
-                                    }
+                                                if ($run->area->type == AREA_TYPE_ID::TARTARUS_LABYRINTH){
+                                                    $difficulty = $run->difficulty;
+                                                }
+                                                else{
+                                                    $difficulty = $run->difficulty - 1;
+                                                }
+                                                for ($i = 0; $i < $difficulty; $i ++){
 ?>
-                                </div>
-                            </td>
-                            <td class='date'>
+                                                    <img class='difficulty' src='<?=URL::IMG["ICON"]?>star.png'/>
 <?php
-                                $date = date_create($run->dtime);
+                                                }
 ?>
-                                <?=date_format($date, "Y/m/d H:i:s")?>
-                            </td>
-                            <td class='team <?=$class_frontline?>'>
+                                            </span>
 <?php
-                                if ($run->helper == 1){
-                                    $enable_save = false;
+                                        }
 ?>
-                                    <div class='monster_panel helper'>
-                                        <img class='monster' title='Friend/Menstor' src='<?=URL::IMG["CURRENCY"]?>socialpoint.png'/>
                                     </div>
+                                </td>
+                                <td class='date'>
 <?php
-                                }
-                                $prev_front = false;
-                                $front = "undefined";
-                                foreach ($run->party as $party){
-                                    $front = in_array($party->id, $run->frontline);
-                                    if ($front != "undefined" && $prev_front != $front){
+                                    $date = date_create($run->dtime);
 ?>
-                                        <hr class='frontline'/>
+                                    <?=date_format($date, "Y/m/d H:i:s")?>
+                                </td>
+                                <td class='team <?=$class_frontline?>'>
 <?php
-                                    }
-                                    if ($party instanceof K_Unit){
+                                    if ($run->helper == 1){
                                         $enable_save = false;
-                                        $disabled = "disabled";
-                                    }
-                                    else{
-                                        $disabled = "";
-                                    }
-                                    if ($disabled == ""){
 ?>
-                                        <a target='_blank' href='/<?=$UID?>>/monster/<?=$party->id?>'>
+                                        <div class='monster_panel helper'>
+                                            <img class='monster' title='Friend/Menstor' src='<?=URL::IMG["CURRENCY"]?>socialpoint.png'/>
+                                        </div>
 <?php
                                     }
+                                    $prev_front = false;
+                                    $front = "undefined";
+                                    foreach ($run->party as $party){
+                                        $front = in_array($party->id, $run->frontline);
+                                        if ($front != "undefined" && $prev_front != $front){
 ?>
-                                    <div class='monster_panel <?=$disabled?>'>
-                                        <?=HTML::unit_panel($party)?>
+                                            <hr class='frontline'/>
 <?php
-                                            if ($party->id == $run->leader){
+                                        }
+                                        if ($party instanceof K_Unit){
+                                            $enable_save = false;
+                                            $disabled = "disabled";
+                                        }
+                                        else{
+                                            $disabled = "";
+                                        }
+                                        if ($disabled == ""){
 ?>
-                                                <img alt='Leader' class='leader' src='<?=URL::IMG["ICON"]?>leader.png'/>
+                                            <a target='_blank' href='/<?=$UID?>>/monster/<?=$party->id?>'>
 <?php
-                                            }
+                                        }
 ?>
-                                    </div>
+                                        <div class='monster_panel <?=$disabled?>'>
+                                            <?=HTML::unit_panel($party)?>
 <?php
-                                    if ($disabled == ""){
+                                                if ($party->id == $run->leader){
 ?>
-                                        </a>
+                                                    <img alt='Leader' class='leader' src='<?=URL::IMG["ICON"]?>leader.png'/>
 <?php
-                                    }
-                                    $prev_front = $front;
-                                }
+                                                }
 ?>
-                            </td>
-                            <td class='time'>
+                                        </div>
 <?php
-                                if ($run->area->type == AREA_TYPE_ID::RIFT_DUNGEON){
+                                        if ($disabled == ""){
 ?>
-                                    <span class='rank'>
-                                        <?=$run->rank?>
-                                    </span>
-                                    <span class='score'>
-                                        <?=$run->score?>
-                                    </span>
+                                            </a>
 <?php
-                                }
-                                else{
-                                    if ($run->win == 1){
-                                        $s = floor($run->time / 1000);
-                                        $m = floor($s / 60);
-                                        $s = floor($s % 60);
-                                        $ms = ($run-> time - (1000 * 60 * $m) - (1000 * 60 * $s) / 100);
-                                        $s = str_pad($s, 2, '0', STR_PAD_LEFT);
-                                        $ms = str_pad($ms, 2, '0', STR_PAD_LEFT);
+                                        }
+                                        $prev_front = $front;
+                                    }
 ?>
-                                        <?=$m?>:<?=$s?><span class='ms'>.<?=$ms?></span>
+                                </td>
+                                <td class='time'>
+<?php
+                                    if ($run->area->type == AREA_TYPE_ID::RIFT_DUNGEON){
+?>
+                                        <span class='rank'>
+                                            <?=$run->rank?>
+                                        </span>
+                                        <span class='score'>
+                                            <?=$run->score?>
+                                        </span>
 <?php
                                     }
                                     else{
+                                        if ($run->win == 1){
+                                            $s = floor($run->time / 1000);
+                                            $m = floor($s / 60);
+                                            $s = floor($s % 60);
+                                            $ms = ($run-> time - (1000 * 60 * $m) - (1000 * 60 * $s) / 100);
+                                            $s = str_pad($s, 2, '0', STR_PAD_LEFT);
+                                            $ms = str_pad($ms, 2, '0', STR_PAD_LEFT);
+?>
+                                            <?=$m?>:<?=$s?><span class='ms'>.<?=$ms?></span>
+<?php
+                                        }
+                                        else{
 ?>
-                                        <span class='defeated'>Defeated</span>
+                                            <span class='defeated'>Defeated</span>
 <?php
+                                        }
                                     }
-                                }
 ?>
-                            </td>
-                            <td class='reward'>
+                                </td>
+                                <td class='reward'>
 <?php
-                                if ($run->energy > 0){
+                                    if ($run->energy > 0){
 ?>
-                                    <div class='item'>
-                                        <img class='item' title='Energy' src='<?=URL::IMG["CURRENCY"]?>energy.png'/>
-                                        <span class='item'><?=$run->energy?></span>
-                                    </div>
+                                        <div class='item'>
+                                            <img class='item' title='Energy' src='<?=URL::IMG["CURRENCY"]?>energy.png'/>
+                                            <span class='item'><?=$run->energy?></span>
+                                        </div>
 <?php
-                                }
-                                if ($run->mana > 0){
+                                    }
+                                    if ($run->mana > 0){
 ?>
-                                    <div class='item'>
-                                        <img class='item' title='Mana' src='<?=URL::IMG["CURRENCY"]?>mana.png'/>
-                                        <span class='item'><?=$run->mana?></span>
-                                    </div>
+                                        <div class='item'>
+                                            <img class='item' title='Mana' src='<?=URL::IMG["CURRENCY"]?>mana.png'/>
+                                            <span class='item'><?=$run->mana?></span>
+                                        </div>
 <?php
-                                }
-                                if ($run->crystal > 0){
+                                    }
+                                    if ($run->crystal > 0){
 ?>
-                                    <div class='item'>
-                                        <img class='item' title='Crystal' src='<?=URL::IMG["CURRENCY"]?>crystal.png'/>
-                                        <span class='item'><?=$run->crystal?></span>
-                                    </div>
+                                        <div class='item'>
+                                            <img class='item' title='Crystal' src='<?=URL::IMG["CURRENCY"]?>crystal.png'/>
+                                            <span class='item'><?=$run->crystal?></span>
+                                        </div>
 <?php
-                                }
-                                foreach ($run->unit as $unit){
+                                    }
+                                    foreach ($run->unit as $unit){
 ?>
-                                    <div class='item'>
-                                        <img class='item' title='<?=$unit->title?>' src='<?=$unit->get_image()?>'/>
-                                    </div>
+                                        <div class='item'>
+                                            <img class='item' title='<?=$unit->title?>' src='<?=$unit->get_image()?>'/>
+                                        </div>
 <?php
-                                }
-                                foreach ($run->item as $item){
+                                    }
+                                    foreach ($run->item as $item){
 ?>
-                                    <div class='item'>
-                                        <img class='item' title='<?=$item->name?>' src='<?=$item->get_image()?>'/>
-                                        <span class='item'><?=$item->amount?></span>
-                                    </div>
+                                        <div class='item'>
+                                            <img class='item' title='<?=$item->name?>' src='<?=$item->get_image()?>'/>
+                                            <span class='item'><?=$item->amount?></span>
+                                        </div>
 <?php
-                                }
-                                foreach ($run->sd as $sd){
+                                    }
+                                    foreach ($run->sd as $sd){
 ?>
-                                    <div class='item'>
-                                        <img class='item' title='<?=$sd->unit->title?>' src='<?=$sd->unit->get_image()?>'/>
-                                        <img class='item' title=' ' src='<?=URL::IMG["MISC"]?>mask-sd.png'/>
-                                    </div>
+                                        <div class='item'>
+                                            <img class='item' title='<?=$sd->unit->title?>' src='<?=$sd->unit->get_image()?>'/>
+                                            <img class='item' title=' ' src='<?=URL::IMG["MISC"]?>mask-sd.png'/>
+                                        </div>
 <?php
-                                }
-                                foreach ($run->unit_piece as $piece){
+                                    }
+                                    foreach ($run->unit_piece as $piece){
 ?>
-                                    <div class='item'>
-                                        <img class='item' title='<?=$piece->unit->title?>' src='<?=$piece->unit->get_image()?>'/>
-                                        <img class='item' title=' ' src='<?=URL::IMG["MISC"]?>mask-piece.png'/>
-                                        <span class='item'><?=$piece->quantity?></span>
-                                    </div>
+                                        <div class='item'>
+                                            <img class='item' title='<?=$piece->unit->title?>' src='<?=$piece->unit->get_image()?>'/>
+                                            <img class='item' title=' ' src='<?=URL::IMG["MISC"]?>mask-piece.png'/>
+                                            <span class='item'><?=$piece->quantity?></span>
+                                        </div>
 <?php
-                                }
-                                if ($run->shapeshifting > 0){
+                                    }
+                                    if ($run->shapeshifting > 0){
 ?>
-                                    <div class='item'>
-                                        <img class='item' title='Shapeshifting Stones' src='<?=URL::IMG["CURRENCY"]?>costumestone.png'/>
-                                        <span class='item'><?=$run->shapeshifting?></span>
-                                    </div>
+                                        <div class='item'>
+                                            <img class='item' title='Shapeshifting Stones' src='<?=URL::IMG["CURRENCY"]?>costumestone.png'/>
+                                            <span class='item'><?=$run->shapeshifting?></span>
+                                        </div>
 <?php
-                                }
-                                foreach ($run->rune as $rune){
+                                    }
+                                    foreach ($run->rune as $rune){
 ?>
-                                    <div class='item item_rune'>
-                                        <img class='item' title='Rune' src='<?=URL::IMG["RUNE"]?>base.png'/>
-                                        <?=HTML::rune_table($rune)?>
-                                    </div>
+                                        <div class='item item_rune'>
+                                            <img class='item' title='Rune' src='<?=URL::IMG["RUNE"]?>base.png'/>
+                                            <?=HTML::rune_table($rune)?>
+                                        </div>
 <?php
-                                }
+                                    }
 ?>
-                            </td>
-                            <td class='action'>
+                                </td>
+                                <td class='action'>
 <?php
-                                if ($enable_save){
+                                    if ($enable_save){
 ?>
-                                    <img alt='Save Team' class='save_team' onclick='saveForm(<?=$run->id?>, true);' src='<?=URL::IMG["ICON"]?>save.png'/>
+                                        <img alt='Save Team' class='save_team' onclick='saveForm(<?=$run->id?>, true);' src='<?=URL::IMG["ICON"]?>save.png'/>
 <?php
-                                }
+                                    }
 ?>
-                            </td>
-                        </tr>
+                                </td>
+                            </tr>
 <?php
-                    }
+                        }
 ?>
-                </table>
-            </article>
-        </section>
+                    </table>
+                </article>
+            </section>
+        </main>
         <section id='save_team' class='content'>
             <h2>
                 Save run

+ 323 - 275
application/view/stats.php

@@ -19,7 +19,6 @@
         <!-- CSS files -->
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>stats.css'/>
-        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
         <!-- Meta tags -->
         <link rel='canonical' href='<?=$page->canonical?>'/>
         <link rel='author' href='<?=$page->author?>'/>
@@ -40,22 +39,6 @@
         <meta name='robots' content='index follow'/>
         <script>
 
-            /**
-             * Shows or hiddes the filters panel.
-             */
-            function toggleFilters(){
-                var content = document.getElementById('filters_content');
-                var slid = document.getElementById('filters_slid');
-                if (content.style.maxHeight != '30em'){
-                    content.style.maxHeight = '30em';
-                    slid.style.transform = 'rotate(90deg)';
-                }
-                else{
-                    content.style.maxHeight = '0px';
-                    slid.style.transform = 'rotate(0deg)';
-                }
-            };
-
             function selectAreaType(){
                 var areaType = document.getElementById('filter_area_type').options[document.getElementById('filter_area_type').selectedIndex].value;
                 // Clear all selectors
@@ -538,302 +521,367 @@
 <?php
         include __DIR__ . "/inc/header.php";
 ?>
-        <section class='filters'>
-            <h2 id='filters_title' onClick='toggleFilters();'>
-                <img id='filters_slid' id='filters_slid' alt=' ' src='<?=URL::IMG["ICON"]?>slid.png'/>
-                Stat filters
+        <aside class='filters'>
+            <h2>
+                Statistics
             </h2>
-            <article id='filters_content'>
+            <form action='/<?=$UID?>/stats/' method='get' class='filter'>
+                <table>
+                    <tr>
+                        <td class='filter'>
+                            <span>Area:</span>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class='filter'>
 <?php
-                $filters = $page->filters;
-                include __DIR__ . "/inc/filter_stats.php";
+                            $selected = array_fill(0, 12 + 1, "");
+                            $selected[$page->filters["AREA_TYPE"]] = "selected";
 ?>
-            </article>
-
-        </section> <!-- #filters -->
+                            <select name='area_type' id='filter_area_type' onChange='selectAreaType();'>
+                                <option value='0'></option>
+                                <option value='<?=AREA_TYPE_ID::SCENARIO?>' <?=$selected[AREA_TYPE_ID::SCENARIO]?>>Scenario</option>
+                                <option value='<?=AREA_TYPE_ID::CAIROS_DUNGEON?>' <?=$selected[AREA_TYPE_ID::CAIROS_DUNGEON]?>>Cairos Dungeon</option>
+                                <option value='<?=AREA_TYPE_ID::RIFT_DUNGEON?>' <?=$selected[AREA_TYPE_ID::RIFT_DUNGEON]?>>Rift Beast</option>
+                                <option value='<?=AREA_TYPE_ID::RIFT_RAID?>' <?=$selected[AREA_TYPE_ID::RIFT_RAID]?>>Rift Raid</option>
+                                <option value='<?=AREA_TYPE_ID::DIMENSIONAL_HOLE?>' <?=$selected[AREA_TYPE_ID::DIMENSIONAL_HOLE]?>>Dimensional Hole</option>
+                            </select>
 <?php
-        if ($page->show_data){
+                            $selected = array_fill(0, 9002, "");
+                            $selected[$page->filters["AREA"]] = "selected";
 ?>
-            <section class='content'>
-                <h2>
-                    Stats
-                </h2>
-                <article>
-                    <div id='win' class='diagram'>
-                        <h3>
-                            Victory rate
-                        </h3>
-                        <canvas id='diagram_win' width='200' height='200'></canvas>
+                            <select class='filter_area' id='filter_area_scenario'>
+                                <option value='0'></option>
+                                <option value='<?=AREA_TYPE_ID::SCENARIO?>' <?=$selected[AREA_TYPE_ID::SCENARIO]?>>Scenario</option>
+                                <option value='<?=AREA_TYPE_ID::CAIROS_DUNGEON?>' <?=$selected[AREA_TYPE_ID::CAIROS_DUNGEON]?>>Cairos Dungeon</option>
+                                <option value='<?=AREA_TYPE_ID::RIFT_DUNGEON?>' <?=$selected[AREA_TYPE_ID::RIFT_DUNGEON]?>>Rift Beast</option>
+                                <option value='<?=AREA_TYPE_ID::RIFT_RAID?>' <?=$selected[AREA_TYPE_ID::RIFT_RAID]?>>Rift Raid</option>
+                                <option value='<?=AREA_TYPE_ID::DIMENSIONAL_HOLE?>' <?=$selected[AREA_TYPE_ID::DIMENSIONAL_HOLE]?>>Dimensional Hole</option>
+                                <option value='<?=AREA_TYPE_ID::ARENA?>' <?=$selected[AREA_TYPE_ID::ARENA]?>>Arena</option>
+                                <option value='<?=AREA_TYPE_ID::GUILD_WAR?>' <?=$selected[AREA_TYPE_ID::GUILD_WAR]?>>Guild War</option>
+                                <option value='<?=AREA_TYPE_ID::GUILD_SIEGE?>' <?=$selected[AREA_TYPE_ID::GUILD_SIEGE]?>>Guild Siege</option>
+                                <option value='<?=AREA_TYPE_ID::TARTARUS_LABYRINTH?>' <?=$selected[AREA_TYPE_ID::TARTARUS_LABYRINTH]?>>Tartarus Labyrinth</option>
+                                <option value='<?=AREA_TYPE_ID::TRIAL_OF_ASCENSION?>' <?=$selected[AREA_TYPE_ID::TRIAL_OF_ASCENSION]?>>Trial of Ascension</option>
+                                <option value='<?=AREA_TYPE_ID::WORLD_BOSS?>' <?=$selected[AREA_TYPE_ID::WORLD_BOSS]?>>World Boss</option>
+                                <option value='<?=AREA_TYPE_ID::DIMENSIONAL_RIFT?>' <?=$selected[AREA_TYPE_ID::DIMENSIONAL_RIFT]?>>Dimensional Rift</option>
+                            </select>
+                            <select class='filter_area' id='filter_area_cairos'>
+                                <option value='0'></option>
+                                <option value='<?=DUNGEON_ID::GIANTS_KEEP?>' <?=$selected[DUNGEON_ID::GIANTS_KEEP]?>>Giant&#39;s Keep</option>
+                                <option value='<?=DUNGEON_ID::DRAGONS_LAIR?>' <?=$selected[DUNGEON_ID::DRAGONS_LAIR]?>>Dragon&#39;s Lair</option>
+                                <option value='<?=DUNGEON_ID::NECROPOLIS?>' <?=$selected[DUNGEON_ID::NECROPOLIS]?>>Necropolis</option>
+                                <option value='<?=DUNGEON_ID::HALL_OF_MAGIC?>' <?=$selected[DUNGEON_ID::HALL_OF_MAGIC]?>>Hall of Magic</option>
+                                <option value='<?=DUNGEON_ID::HALL_OF_LIGHT?>' <?=$selected[DUNGEON_ID::HALL_OF_LIGHT]?>>Hall of Light</option>
+                                <option value='<?=DUNGEON_ID::HALL_OF_DARK?>' <?=$selected[DUNGEON_ID::HALL_OF_DARK]?>>Hall of Dark</option>
+                                <option value='<?=DUNGEON_ID::HALL_OF_FIRE?>' <?=$selected[DUNGEON_ID::HALL_OF_FIRE]?>>Hall of Fire</option>
+                                <option value='<?=DUNGEON_ID::HALL_OF_WATER?>' <?=$selected[DUNGEON_ID::HALL_OF_WATER]?>>Hall of Water</option>
+                                <option value='<?=DUNGEON_ID::HALL_OF_WIND?>' <?=$selected[DUNGEON_ID::HALL_OF_WIND]?>>Hall of Wind</option>
+                            </select>
+                            <select id='filter_area_rift_dungeon' class='filter_area'>
+                                <option value='0'></option>
+                                <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::LIGHT_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::LIGHT_BEAST]?>>Light Beast</option>
+                                <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::DARK_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::DARK_BEAST]?>>Dark Beast</option>
+                                <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::FIRE_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::FIRE_BEAST]?>>Fire Beast</option>
+                                <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::ICE_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::ICE_BEAST]?>>Ice Beast</option>
+                                <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::WIND_BEAST?>' <?=$selected[ELEMENTAL_RIFT_DUNGEON_ID::WIND_BEAST]?>>Wind Beast</option>
+                            </select>
+                            <select id='filter_stage' name='stage'>
+                            </select>
+                            <select id='filter_difficulty' name='difficulty'>
+                            </select>
+                        </td>
+                    </tr>
+                </table>
+                <input type='submit' value='Apply'/>
+            </form>
+        </aside> <!-- #filters -->
+        <main>
 <?php
-                        $total = $page->win_lose[0] + $page->win_lose[1];
-                        // Fix divisions by 0 (dont use in total count):
-                        if ($total == 0){
-                            $total ++;
-                        }
+            if ($page->show_data){
 ?>
-                        <table class='legend'>
-                            <tr class='color_1'>
-                                <td>
-                                    Victories:
-                                </td>
-                                <td>
-                                    <?=$page->win_lose[0]?>
-                                </td>
-                                <td>
-                                    (<?=number_format(($page->win_lose[0] * 100) / $total, 2, ".", ",")?>%)
-                                </td>
-                            </tr>
-                            <tr class='color_2'>
-                                <td>
-                                    Defeats:
-                                </td>
-                                <td>
-                                    <?=$page->win_lose[1]?>
-                                </td>
-                                <td>
-                                    (<?=number_format(($page->win_lose[1] * 100) / $total, 2, ".", ",")?>%)
-                                </td>
-                            </tr>
-                            <tr class='color_0'>
-                                <td>
-                                    Total:
-                                </td>
-                                <td colspan='2'>
-                                    <?=($page->win_lose[0] + $page->win_lose[1])?>
-                                </td>
-                            </tr>
-                        </table>
-                    </div>
-                    <div id='drop_type' class='diagram'>
-                        <h3>
-                            Drop rate
-                        </h3>
-                        <canvas id='diagram_drop_type' width='200' height='200'></canvas>
-                        <table class='legend'>
+                <section class='content'>
+                    <h2>
+                        Stats
+                    </h2>
+                    <article>
+                        <div id='win' class='diagram'>
+                            <h3>
+                                Victory rate
+                            </h3>
+                            <canvas id='diagram_win' width='200' height='200'></canvas>
 <?php
-                            // Do some calculations
-                            $rune = $page->drop_type["rune"];
-                            $rucr = $page->drop_type["rune_craft"];
-                            $item = $page->drop_type["item"];
-                            $sedu = $page->drop_type["sd"];
-                            $shap = $page->drop_type["shapeshifting"];
-                            $unit = $page->drop_type["unit"];
-                            $total = $rune + $rucr + $item + $sedu + $shap + $unit;
-                            // Fix divisions by 0:
+                            $total = $page->win_lose[0] + $page->win_lose[1];
+                            // Fix divisions by 0 (dont use in total count):
                             if ($total == 0){
                                 $total ++;
                             }
 ?>
-                            <tr class='color_1'>
-                                <td>
-                                    Rune:
-                                </td>
-                                <td>
-                                    <?=$rune?>
-                                </td>
-                                <td>
-                                    (<?=number_format(($rune * 100) / $total, 2, ".", ",")?>%)
-                                </td>
-                            </tr>
-                            <tr class='color_2'>
-                                <td>
-                                    Rune craft item:
-                                </td>
-                                <td>
-                                    <?=$rucr?>
-                                </td>
-                                <td>
-                                    (<?=number_format(($rucr * 100) / $total, 2, ".", ",")?>%)
-                                </td>
-                            </tr>
-                            <tr class='color_3'>
-                                <td>
-                                    Item:
-                                </td>
-                                <td>
-                                    <?=$item?>
-                                </td>
-                                <td>
-                                    (<?=number_format(($item * 100) / $total, 2, ".", ",")?>%)
-                                </td>
-                            </tr>
-                            <tr class='color_4'>
-                                <td>
-                                    Secret Dungeon:
-                                </td>
-                                <td>
-                                    <?=$sedu?>
-                                </td>
-                                <td>
-                                    (<?=number_format(($sedu * 100) / $total, 2, ".", ",")?>%)
-                                </td>
-                            </tr>
-                            <tr class='color_5'>
-                                <td>
-                                    Transmog Stone:
-                                </td>
-                                <td>
-                                    <?=$shap?>
-                                </td>
-                                <td>
-                                    (<?=number_format(($shap * 100) / $total, 2, ".", ",")?>%)
-                                </td>
-                            </tr>
-                            <tr class='color_6'>
-                                <td>
-                                    Unit:
-                                </td>
-                                <td>
-                                    <?=$unit?>
-                                </td>
-                                <td>
-                                    (<?=number_format(($unit * 100) / $total, 2, ".", ",")?>%)
-                                </td>
-                            </tr>
-                        </table>
-                    </div>
-                    <div id='drop_rune_slot' class='diagram'>
-                        <h3>
-                            Rune drops by slot
-                        </h3>
-                        <canvas id='diagram_rune_slot' width='200' height='200'></canvas>
-                        <table class='legend'>
+                            <table class='legend'>
+                                <tr class='color_1'>
+                                    <td>
+                                        Victories:
+                                    </td>
+                                    <td>
+                                        <?=$page->win_lose[0]?>
+                                    </td>
+                                    <td>
+                                        (<?=number_format(($page->win_lose[0] * 100) / $total, 2, ".", ",")?>%)
+                                    </td>
+                                </tr>
+                                <tr class='color_2'>
+                                    <td>
+                                        Defeats:
+                                    </td>
+                                    <td>
+                                        <?=$page->win_lose[1]?>
+                                    </td>
+                                    <td>
+                                        (<?=number_format(($page->win_lose[1] * 100) / $total, 2, ".", ",")?>%)
+                                    </td>
+                                </tr>
+                                <tr class='color_0'>
+                                    <td>
+                                        Total:
+                                    </td>
+                                    <td colspan='2'>
+                                        <?=($page->win_lose[0] + $page->win_lose[1])?>
+                                    </td>
+                                </tr>
+                            </table>
+                        </div>
+                        <div id='drop_type' class='diagram'>
+                            <h3>
+                                Drop rate
+                            </h3>
+                            <canvas id='diagram_drop_type' width='200' height='200'></canvas>
+                            <table class='legend'>
 <?php
-                            $total = array_sum($page->drop_rune_slot);
-                            // Fix divisions by 0:
-                            if ($total == 0){
-                                $total ++;
-                            }
-                            for ($i = 1; $i <= 6; $i ++){
-                                $val = $page->drop_rune_slot[strval($i)]
+                                // Do some calculations
+                                $rune = $page->drop_type["rune"];
+                                $rucr = $page->drop_type["rune_craft"];
+                                $item = $page->drop_type["item"];
+                                $sedu = $page->drop_type["sd"];
+                                $shap = $page->drop_type["shapeshifting"];
+                                $unit = $page->drop_type["unit"];
+                                $total = $rune + $rucr + $item + $sedu + $shap + $unit;
+                                // Fix divisions by 0:
+                                if ($total == 0){
+                                    $total ++;
+                                }
 ?>
-                                <tr class='color_0'>
+                                <tr class='color_1'>
+                                    <td>
+                                        Rune:
+                                    </td>
+                                    <td>
+                                        <?=$rune?>
+                                    </td>
+                                    <td>
+                                        (<?=number_format(($rune * 100) / $total, 2, ".", ",")?>%)
+                                    </td>
+                                </tr>
+                                <tr class='color_2'>
+                                    <td>
+                                        Rune craft item:
+                                    </td>
+                                    <td>
+                                        <?=$rucr?>
+                                    </td>
+                                    <td>
+                                        (<?=number_format(($rucr * 100) / $total, 2, ".", ",")?>%)
+                                    </td>
+                                </tr>
+                                <tr class='color_3'>
+                                    <td>
+                                        Item:
+                                    </td>
+                                    <td>
+                                        <?=$item?>
+                                    </td>
+                                    <td>
+                                        (<?=number_format(($item * 100) / $total, 2, ".", ",")?>%)
+                                    </td>
+                                </tr>
+                                <tr class='color_4'>
+                                    <td>
+                                        Secret Dungeon:
+                                    </td>
+                                    <td>
+                                        <?=$sedu?>
+                                    </td>
+                                    <td>
+                                        (<?=number_format(($sedu * 100) / $total, 2, ".", ",")?>%)
+                                    </td>
+                                </tr>
+                                <tr class='color_5'>
+                                    <td>
+                                        Transmog Stone:
+                                    </td>
+                                    <td>
+                                        <?=$shap?>
+                                    </td>
+                                    <td>
+                                        (<?=number_format(($shap * 100) / $total, 2, ".", ",")?>%)
+                                    </td>
+                                </tr>
+                                <tr class='color_6'>
                                     <td>
-                                        Slot <?=$i?>:
+                                        Unit:
                                     </td>
                                     <td>
-                                         <?=$val?>
+                                        <?=$unit?>
                                     </td>
                                     <td>
-                                        (<?=number_format(($val * 100) / $total, 2, ".", ",")?>%)
+                                        (<?=number_format(($unit * 100) / $total, 2, ".", ",")?>%)
                                     </td>
                                 </tr>
+                            </table>
+                        </div>
+                        <div id='drop_rune_slot' class='diagram'>
+                            <h3>
+                                Rune drops by slot
+                            </h3>
+                            <canvas id='diagram_rune_slot' width='200' height='200'></canvas>
+                            <table class='legend'>
 <?php
-                            }
+                                $total = array_sum($page->drop_rune_slot);
+                                // Fix divisions by 0:
+                                if ($total == 0){
+                                    $total ++;
+                                }
+                                for ($i = 1; $i <= 6; $i ++){
+                                    $val = $page->drop_rune_slot[strval($i)]
 ?>
-                        </table>
-                    </div>
-                    <div id='drop_rune_stars' class='diagram'>
-                        <h3>
-                            Rune drops by stars
-                        </h3>
-                        <canvas id='diagram_rune_stars' width='200' height='200'></canvas>
-                        <table class='legend'>
+                                    <tr class='color_0'>
+                                        <td>
+                                            Slot <?=$i?>:
+                                        </td>
+                                        <td>
+                                            <?=$val?>
+                                        </td>
+                                        <td>
+                                            (<?=number_format(($val * 100) / $total, 2, ".", ",")?>%)
+                                        </td>
+                                    </tr>
 <?php
-                            $total = array_sum($page->drop_rune_stars);
-                            // Fix divisions by 0:
-                            if ($total == 0){
-                                $total ++;
-                            }
-                            for ($i = 6; $i >= 1; $i --){
-                                $val = $page->drop_rune_stars[strval($i)]
+                                }
 ?>
-                                <tr class='color_0'>
-                                    <td>
+                            </table>
+                        </div>
+                        <div id='drop_rune_stars' class='diagram'>
+                            <h3>
+                                Rune drops by stars
+                            </h3>
+                            <canvas id='diagram_rune_stars' width='200' height='200'></canvas>
+                            <table class='legend'>
 <?php
-                                        for ($j = 1; $j <= $i; $j ++){
+                                $total = array_sum($page->drop_rune_stars);
+                                // Fix divisions by 0:
+                                if ($total == 0){
+                                    $total ++;
+                                }
+                                for ($i = 6; $i >= 1; $i --){
+                                    $val = $page->drop_rune_stars[strval($i)]
 ?>
-                                            <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
+                                    <tr class='color_0'>
+                                        <td>
 <?php
-                                        }
+                                            for ($j = 1; $j <= $i; $j ++){
 ?>
+                                                <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
+<?php
+                                            }
+?>
+                                        </td>
+                                        <td>
+                                            <?=$val?>
+                                        </td>
+                                        <td>
+                                            (<?=number_format(($val * 100) / $total, 2, ".", ",")?>%)
+                                        </td>
+                                    </tr>
+<?php
+                                }
+?>
+                            </table>
+                        </div>
+                        <div id='drop_rune_quality' class='diagram'>
+                            <h3>
+                                Rune drops by quality
+                            </h3>
+                            <canvas id='diagram_rune_quality' width='200' height='200'></canvas>
+                            <table class='legend'>
+<?php
+                                $total = array_sum($page->drop_rune_quality);
+                                // Fix divisions by 0:
+                                if ($total == 0){
+                                    $total ++;
+                                }
+?>
+                                <tr class='color_legend'>
+                                    <td>
+                                        Legend:
                                     </td>
                                     <td>
-                                        <?=$val?>
+                                        <?=$page->drop_rune_quality[QUALITY_ID::LEGEND]?>
                                     </td>
                                     <td>
-                                        (<?=number_format(($val * 100) / $total, 2, ".", ",")?>%)
+                                        (<?=number_format(($page->drop_rune_quality[QUALITY_ID::LEGEND] * 100) / $total, 2, ".", ",")?>%)
                                     </td>
                                 </tr>
+                                <tr class='color_hero'>
+                                    <td>
+                                        Hero:
+                                    </td>
+                                    <td>
+                                        <?=$page->drop_rune_quality[QUALITY_ID::HERO]?>
+                                    </td>
+                                    <td>
+                                        (<?=number_format(($page->drop_rune_quality[QUALITY_ID::HERO] * 100) / $total, 2, ".", ",")?>%)
+                                    </td>
+                                </tr>
+                                <tr class='color_rare'>
+                                    <td>
+                                        Rare:
+                                    </td>
+                                    <td>
+                                        <?=$page->drop_rune_quality[QUALITY_ID::RARE]?>
+                                    </td>
+                                    <td>
+                                        (<?=number_format(($page->drop_rune_quality[QUALITY_ID::RARE] * 100) / $total, 2, ".", ",")?>%)
+                                    </td>
+                                </tr>
+                                <tr class='color_magic'>
+                                    <td>
+                                        Magic:
+                                    </td>
+                                    <td>
+                                        <?=$page->drop_rune_quality[QUALITY_ID::MAGIC]?>
+                                    </td>
+                                    <td>
+                                        (<?=number_format(($page->drop_rune_quality[QUALITY_ID::MAGIC] * 100) / $total, 2, ".", ",")?>%)
+                                    </td>
+                                </tr>
+                                <tr class='color_normal'>
+                                    <td>
+                                        Normal:
+                                    </td>
+                                    <td>
+                                        <?=$page->drop_rune_quality[QUALITY_ID::NORMAL]?>
+                                    </td>
+                                    <td>
+                                        (<?=number_format(($page->drop_rune_quality[QUALITY_ID::NORMAL] * 100) / $total, 2, ".", ",")?>%)
+                                    </td>
+                                </tr>
+                            </table>
+                        </div>
+                    </article>
+                </section>
 <?php
-                            }
-?>
-                        </table>
-                    </div>
-                    <div id='drop_rune_quality' class='diagram'>
-                        <h3>
-                            Rune drops by quality
-                        </h3>
-                        <canvas id='diagram_rune_quality' width='200' height='200'></canvas>
-                        <table class='legend'>
-<?php
-                            $total = array_sum($page->drop_rune_quality);
-                            // Fix divisions by 0:
-                            if ($total == 0){
-                                $total ++;
-                            }
+            }
 ?>
-                            <tr class='color_legend'>
-                                <td>
-                                    Legend:
-                                </td>
-                                <td>
-                                    <?=$page->drop_rune_quality[QUALITY_ID::LEGEND]?>
-                                </td>
-                                <td>
-                                    (<?=number_format(($page->drop_rune_quality[QUALITY_ID::LEGEND] * 100) / $total, 2, ".", ",")?>%)
-                                </td>
-                            </tr>
-                            <tr class='color_hero'>
-                                <td>
-                                    Hero:
-                                </td>
-                                <td>
-                                    <?=$page->drop_rune_quality[QUALITY_ID::HERO]?>
-                                </td>
-                                <td>
-                                    (<?=number_format(($page->drop_rune_quality[QUALITY_ID::HERO] * 100) / $total, 2, ".", ",")?>%)
-                                </td>
-                            </tr>
-                            <tr class='color_rare'>
-                                <td>
-                                    Rare:
-                                </td>
-                                <td>
-                                    <?=$page->drop_rune_quality[QUALITY_ID::RARE]?>
-                                </td>
-                                <td>
-                                    (<?=number_format(($page->drop_rune_quality[QUALITY_ID::RARE] * 100) / $total, 2, ".", ",")?>%)
-                                </td>
-                            </tr>
-                            <tr class='color_magic'>
-                                <td>
-                                    Magic:
-                                </td>
-                                <td>
-                                    <?=$page->drop_rune_quality[QUALITY_ID::MAGIC]?>
-                                </td>
-                                <td>
-                                    (<?=number_format(($page->drop_rune_quality[QUALITY_ID::MAGIC] * 100) / $total, 2, ".", ",")?>%)
-                                </td>
-                            </tr>
-                            <tr class='color_normal'>
-                                <td>
-                                    Normal:
-                                </td>
-                                <td>
-                                    <?=$page->drop_rune_quality[QUALITY_ID::NORMAL]?>
-                                </td>
-                                <td>
-                                    (<?=number_format(($page->drop_rune_quality[QUALITY_ID::NORMAL] * 100) / $total, 2, ".", ",")?>%)
-                                </td>
-                            </tr>
-                        </table>
-                    </div>
-                </article>
-            </section>
+        </main>
 <?php
-        }
         include __DIR__ . "/inc/footer.php";
 ?>
     </body>

+ 144 - 101
application/view/teams.php

@@ -19,7 +19,6 @@
         <!-- CSS files -->
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
         <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>teams.css'/>
-        <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
         <!-- Meta tags -->
         <link rel='canonical' href='<?=$page->canonical?>'/>
         <link rel='author' href='<?=$page->author?>'/>
@@ -64,6 +63,30 @@
 <?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 = '?uid=<?=$UID?>&team=' + team + '&score=' + score;
+                console.log(params);
+                var xhttp = new XMLHttpRequest();
+                xhttp.onreadystatechange = function() {
+                    //if (this.readyState == 4){
+                    //    alert("STATUS: " + this.status);
+                    //}
+                };
+                xhttp.open('GET', '/action/rate_team/' + params, true);
+                xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
+                xhttp.send();
+                return true;
+            }
+
             /**
              * Shows or hiddes the new team panel.
              * 
@@ -655,23 +678,6 @@
                 }
             }
 
-
-            /**
-             * Shows or hiddes the filters panel.
-             */
-            function toggleFilters(){
-                var content = document.getElementById('filters_content');
-                var slid = document.getElementById('filters_slid');
-                if (content.style.maxHeight != '30em'){
-                    content.style.maxHeight = '30em';
-                    slid.style.transform = 'rotate(90deg)';
-                }
-                else{
-                    content.style.maxHeight = '0px';
-                    slid.style.transform = 'rotate(0deg)';
-                }
-            };
-
             /**
              * Closes the error dialog.
              */
@@ -692,112 +698,149 @@
 <?php
         include __DIR__ . "/inc/header.php";
 ?>
-        <section class='filters'>
-            <h2 id='filters_title' onClick='toggleFilters();'>
-                <img id='filters_slid' id='filters_slid' alt=' ' src='<?=URL::IMG["ICON"]?>slid.png'/>
-                Team filters
-            </h2>
-            <article id='filters_content'>
-<?php
-                $filters = $page->filters;
-                include __DIR__ . "/inc/filter_teams.php";
-?>
-            </article>
-
-        </section> <!-- #filters -->
-        <section class='content'>
+        <aside>
             <h2>
                 Teams
             </h2>
-            <article>
-                <table id='teams'>
+            <p>
+                View and manage teams
+            </p>
+            <form action='/<?=$UID?>/teams/' method='get'  id='filter_monsters' class='filter'>
+                <table>
                     <tr>
-                        <th>
-                            Team
-                        </th>
-                        <th>
-                            Description
-                        </th>
-                        <th>
-                            Units
-                        </th>
-                        <th>
-                            Actions
-                        </th>
+                        <td class='label'>
+                            Name:
+                        </td>
+                        <td>
+                            <input type='text' name='name' id='filter_name' value='<?=$page->filters["NAME"]?>'/>
+                        </td>
                     </tr>
+                    <tr>
+                        <td class='label'>
+                            Area:
+                        </td>
+                        <td>
+                            <select name='area'>
+                                <option value=''> </option>
+                                <option value='<?=AREA_TYPE_ID::SCENARIO?>'>Scenario</option>
+                                <option value='<?=AREA_TYPE_ID::CAIROS_DUNGEON?>'>Cairos Dungeon</option>
+                                <option value='<?=AREA_TYPE_ID::RIFT_DUNGEON?>'>Rift Dungeon</option>
+                                <option value='<?=AREA_TYPE_ID::RIFT_RAID?>'>Rift Raid</option>
+                                <option value='<?=AREA_TYPE_ID::DIMENSIONAL_HOLE?>'>Dimensional Hole></option>
+                                <option value='<?=AREA_TYPE_ID::ARENA?>'>Arena</option>
+                                <option value='<?=AREA_TYPE_ID::GUILD_WAR?>'>Guild War</option>
+                                <option value='<?=AREA_TYPE_ID::GUILD_SIEGE?>'>Guild Siege</option>
+                                <option value='<?=AREA_TYPE_ID::TARTARUS_LABYRINTH?>'>Tartarus Labyrinth</option>
+                                <option value='<?=AREA_TYPE_ID::TRIAL_OF_ASCENSION?>'>Trial of Ascension</option>
+                                <option value='<?=AREA_TYPE_ID::WORLD_BOSS?>'>World Boss</option>
+                                <option value='<?=AREA_TYPE_ID::DIMENSIONAL_RIFT?>'>Dimensinal Rift</option>
+                            </select>
+                        </td>
+                    </tr>
+                </table>
+                <input type='submit' value='Apply'/>
+            </form>
+        </aside>
+        <main>
+            <section class='content'>
+                <h2>
+                    Teams
+                </h2>
+                <article>
+                    <table id='teams'>
+                        <tr>
+                            <th>
+                                Team
+                            </th>
+                            <th>
+                                Description
+                            </th>
+                            <th>
+                                Units
+                            </th>
+                            <th>
+                                Score
+                            </th>
+                            <th>
+                                Actions
+                            </th>
+                        </tr>
 <?php
-                    $odd = "odd";
-                    foreach ($page->teams as $team){
+                        $odd = "odd";
+                        foreach ($page->teams as $team){
 ?>
-                        <tr>
-                            <td class='team <?=$odd?>'>
-                                <h4>
-                                    <img title='<?=$team->area->name?>' class='area' src='<?=$team->area->get_image($team->stage)?>'/>
+                            <tr>
+                                <td class='team <?=$odd?>'>
+                                    <h4>
+                                        <img title='<?=$team->area->name?>' class='area' src='<?=$team->area->get_image($team->stage)?>'/>
 <?php
-                                    if ($team->stage > 0 && $team->area->type != AREA_TYPE_ID::TARTARUS_LABYRINTH){
+                                        if ($team->stage > 0 && $team->area->type != AREA_TYPE_ID::TARTARUS_LABYRINTH){
 ?>
-                                        <span class='stage'><?=$team->stage?></span>
+                                            <span class='stage'><?=$team->stage?></span>
 <?php
-                                    }
+                                        }
 ?>
-                                    <span class='team_name'><?=$team->name?></span>
-                                </h4>
-                            </td>
-                            <td class='description <?=$odd?>'>
-                                <?=$team->description?>
-                            </td>
-                            <td class='units <?=$odd?>'>
+                                        <span class='team_name'><?=$team->name?></span>
+                                    </h4>
+                                </td>
+                                <td class='description <?=$odd?>'>
+                                    <?=$team->description?>
+                                </td>
+                                <td class='units <?=$odd?>'>
 <?php
-                                $prev_front = false;
-                                $front = "undefined";
-                                foreach ($team->unit as $unit){
-                                    $front = in_array($unit->id, $team->frontline);
-                                    if ($front != "undefined" && $prev_front != $front){
+                                    $prev_front = false;
+                                    $front = "undefined";
+                                    foreach ($team->unit as $unit){
+                                        $front = in_array($unit->id, $team->frontline);
+                                        if ($front != "undefined" && $prev_front != $front){
 ?>
-                                        <hr class='frontline'/>
+                                            <hr class='frontline'/>
 <?php
-                                    }
+                                        }
 ?>
-                                    <a href='/<?=$UID?>/monsters/<?=$unit->id?>'>
-                                        <div class='monster_panel'>
-                                            <?=HTML::unit_panel($unit)?>
+                                        <a href='/<?=$UID?>/monsters/<?=$unit->id?>'>
+                                            <div class='monster_panel'>
+                                                <?=HTML::unit_panel($unit)?>
 <?php
-                                            if ($unit->id == $team->leader){
+                                                if ($unit->id == $team->leader){
 ?>
-                                                <img alt='Leader' class='leader' src='<?=URL::IMG["ICON"]?>leader.png'/>
+                                                    <img alt='Leader' class='leader' src='<?=URL::IMG["ICON"]?>leader.png'/>
 <?php
-                                            }
+                                                }
 ?>
-                                        </div>
-                                    </a>
+                                            </div>
+                                        </a>
 <?php
-                                    $prev_front = $front;
-                                }
+                                        $prev_front = $front;
+                                    }
 ?>
-                            </td>
-                            <td class='action <?=$odd?>'>
-                                <a title='Edit team' class='a_button' onclick='editTeam(<?=$team->id?>)'>
-                                    <img alt='Edit team' src='<?=URL::IMG["ICON"]?>edit.png'/>
-                                </a>
-                                <a title='Remove team' class='a_button' onclick='deleteTeam(<?=$team->id?>)'>
-                                    <img alt='Remove team' src='<?=URL::IMG["ICON"]?>nok.png'/>
-                                </a>
-                                
-                            </td>
-                        </tr>
+                                </td>
+                                <td class='score <?=$odd?>'>
+                                    <input type='number' min='0' max='20' value='<?=$team->score?>' onChange='rateTeam(<?=$team->id?>, this.value);'/>
+                                </td>
+                                <td class='action <?=$odd?>'>
+                                    <a title='Edit team' class='a_button' onclick='editTeam(<?=$team->id?>)'>
+                                        <img alt='Edit team' src='<?=URL::IMG["ICON"]?>edit.png'/>
+                                    </a>
+                                    <a title='Remove team' class='a_button' onclick='deleteTeam(<?=$team->id?>)'>
+                                        <img alt='Remove team' src='<?=URL::IMG["ICON"]?>nok.png'/>
+                                    </a>
+                                </td>
+                            </tr>
 <?php
-                        if ($odd == ""){
-                            $odd = "odd";
-                        }
-                        else{
-                            $odd = "";
+                            if ($odd == ""){
+                                $odd = "odd";
+                            }
+                            else{
+                                $odd = "";
+                            }
                         }
-                    }
 ?>
-                </table>
-                <input type='button' onClick='showNewTeam(true);' value='New Team'/>
-            </article>
-        </section> <!-- .list -->
+                    </table>
+                    <input type='button' onClick='showNewTeam(true);' value='New Team'/>
+                </article>
+            </section> <!-- .list -->
+        </main>
 
 <?php
         include __DIR__ . "/inc/footer.php";
@@ -870,7 +913,7 @@
                                 <option value=''> </option>
                                 <option value='<?=DUNGEON_ID::FOREST_OF_ROARING_BEASTS?>'>Forest or Roaring Beasts</option>
                                 <option value='<?=DUNGEON_ID::KARZHAN_REMAINS_WARBEAR?>'>Karzhan Remains (Warbear)</option>
-                                <option value='<?=DUNGEON_ID::KARZHAN_REMAINS_WARBEAR?>'>Karzhan Remains (Inugami)</option>
+                                <option value='<?=DUNGEON_ID::KARZHAN_REMAINS_INUGAMI?>'>Karzhan Remains (Inugami)</option>
                                 <option value='<?=DUNGEON_ID::SANCTUARY_OF_DREAMING_FAIRIES?>'>Sanctuary of Dreaming Fairies</option>
                                 <option value='<?=DUNGEON_ID::ELLUNIA_REMAINS_FAIRY?>'>Ellunia Remains (Fairy)</option>
                                 <option value='<?=DUNGEON_ID::ELLUNIA_REMAINS_PIXIE?>'>Ellunia Remains (Pixie)</option>

+ 37 - 18
public/css/artifacts.css

@@ -1,42 +1,61 @@
-section.filters td.filter select#filter_element{
+aside form.filter td select#filter_element{
     overflow: hidden;
-    height: 7em;
+    height: 1.5em;
 }
-section.filters td.filter select#filter_archetype{
-    height: 6em;
-    overflow: hidden;
+aside form.filter td select#filter_element option{
+    display: inline-block;
 }
-section.filters td.filter select#filter_main_stat{
-    height: 5em;
+aside form.filter td select#filter_archetype{
     overflow: hidden;
+    height: 1.5em;
+}
+aside form.filter td select#filter_archetype option{
+    display: inline-block;
 }
-section.filters td.filter select#filter_sub_stat{
-    height: 5em;
+aside form.filter td select#filter_main_stat{
     overflow: hidden;
+    height: 1.5em;
+}
+aside form.filter td select#filter_main_stat option{
+    display: inline-block;
+}
+section#artifacts > table{
+    margin: auto;
+    border-collapse: collapse;
+    border: 0.2em solid #000000;
+    border-top: 0;
+    display: inline-block;
+    border-radius: 0.4em;
+}
+section#artifacts > table td.header{
+    background-color: #00000066;
+    color: #ffffff;
+    border-top: 0.2em solid #000000;
+    font-weight: bold;
+    text-align: left;
 }
-
-section h2 img, span{
+section#artifacts > table td.header img, span{
     display: inline-block;
     vertical-align: middle;
 }
-section h2 img{
+section#artifacts > table td.header img{
     height: 1.5em;
 }
-section h2 img.group_image_1{
+section#artifacts > table td.header img.group_image_1{
     transform: rotate(0deg);
 }
-section h2 img.group_image_2{
+section#artifacts > table td.header img.group_image_2{
     transform: rotate(57deg);
 }
-section h2 img.group_image_3{
+section#artifacts > table td.header img.group_image_3{
     transform: rotate(123deg);
 }
-section h2 img.group_image_4{
+section#artifacts > table td.header img.group_image_4{
     transform: rotate(180deg);
 }
-section h2 img.group_image_5{
+section#artifacts > table td.header img.group_image_5{
     transform: rotate(237deg);
 }
-section h2 img.group_image_6{
+section#artifacts > table td.header img.group_image_6{
     transform: rotate(303deg);
 }

+ 2 - 3
public/css/catalog.css

@@ -1,8 +1,7 @@
-section.list article{
+section#list article{
     margin-bottom: 1.5em;
 }
-
-section.list article div.monster{
+section#list article div.monster{
     display: inline-block;
     font-size: 60%;
     margin: 0.2em;

+ 80 - 11
public/css/enchantments.css

@@ -1,19 +1,88 @@
-section.filters td.filter select#filter_type{
-    height: 2.8em;
-    overflow: hidden;
+aside form.filter table td select#filter_type{
+    height: 1.5em;
+}
+aside form.filter table td select#filter_type option{
+    display: inline-block;
+}
+aside form.filter table td.rune div{
+    display: inline-block;
+    box-shadow: var(--input-box-shadow);
+}
+aside form.filter table td.rune select{
+    height: 8.5em;
+    box-shadow: none;
+}
+aside form.filter table td.rune select:not(:first-child){
+    border-left: 0;
+    border-top-left-radius: 0;
+    border-bottom-left-radius: 0;
+}
+aside form.filter table td.rune select:not(:last-child){
+    border-right: 0;
+    border-top-right-radius: 0;
+    border-bottom-right-radius: 0;
+}
+aside form.filter table td.rune select option{
+    font-size: 90%;
+}
+aside form.filter table td.stats div{
+    display: inline-block;
+    box-shadow: var(--input-box-shadow);
 }
-section.filters td.filter select#filter_rune{
-    height: 27em;
-    overflow: hidden;
+aside form.filter table td.stats select{
+    height: 3em;
+    box-shadow: none;
 }
-section.filters td.filter select#filter_stat{
-    height: 15.7em;
-    overflow: hidden;
+aside form.filter table td.stats select:not(:first-child){
+    border-left: 0;
+    border-top-left-radius: 0;
+    border-bottom-left-radius: 0;
 }
-section h2 img, span{
+aside form.filter table td.stats select:not(:last-child){
+    border-right: 0;
+    border-top-right-radius: 0;
+    border-bottom-right-radius: 0;
+}
+aside form.filter table td.stats select option{
+    font-size: 90%;
+}
+section#enchantments > table{
+    margin: auto;
+    border-collapse: collapse;
+    border: 0.2em solid #000000;
+    border-top: 0;
+    display: inline-block;
+    border-radius: 0.4em;
+}
+section#enchantments > table td.header{
+    background-color: #00000066;
+    color: #ffffff;
+    border-top: 0.2em solid #000000;
+    font-weight: bold;
+    text-align: left;
+}
+section#enchantments > table td.header img, span{
     display: inline-block;
     vertical-align: middle;
 }
-section h2 img{
+section#enchantments > table td.header img{
     height: 1.5em;
 }
+section#enchantments > table td.header img.group_image_1{
+    transform: rotate(0deg);
+}
+section#enchantments > table td.header img.group_image_2{
+    transform: rotate(57deg);
+}
+section#enchantments > table td.header img.group_image_3{
+    transform: rotate(123deg);
+}
+section#enchantments > table td.header img.group_image_4{
+    transform: rotate(180deg);
+}
+section#enchantments > table td.header img.group_image_5{
+    transform: rotate(237deg);
+}
+section#enchantments > table td.header img.group_image_6{
+    transform: rotate(303deg);
+}

+ 0 - 114
public/css/filters.css

@@ -1,114 +0,0 @@
-/* Filters section, for lists. */
-section.filters{
-    display: inline-block;
-    min-width: 40%;
-    background-color: #aa8866;
-    overflow: hidden;
-    padding-bottom: 0;
-    transition: all .3s ease-in-out;
-}
-@media screen and (max-width : 990px){
-    section.filters{
-        font-size: 80%;
-    }
-}
-section.filters h2#filters_title{
-    cursor: pointer;
-    margin-bottom: 0;
-    user-select: none;
-}
-
-section.filters h2#filters_title img#filters_slid{
-    transform: rotate(0deg);
-    width: 1em;
-    height: 1em;
-    vertical-align: middle;
-    transition: all .4s ease-in-out;
-}
-
-section.filters article#filters_content{
-    overflow: hidden;
-    margin: 0;
-    padding: 0;
-    display: block;
-    height: auto;
-    transition: all .6s ease-in-out;
-    max-height: 0;
-}
-
-
-form.custom_filter{
-    border-bottom: 0.1em solid #ffffff;
-    padding-bottom: 0.5em;
-    margin: 0 1em 1em 1em;
-}
-
-form.custom_filter p#custom_filter_description{
-    display: none;
-    font-size: 70%;
-    margin: 0.2em;
-    background-color: #886644;
-    border-radius: 0.4em;
-    border: 0.1em solid #000000;
-}
-
-form.filter{
-    text-align:center;
-}
-
-form.filter table{
-    margin: auto;
-    display: inline;
-    border-collapse: collapse;
-}
-form.filter table td.filter{
-    vertical-align: top;
-    padding: 0.2em;
-    text-align: center;
-    color: #ffffff;
-}
-form.filter table td.filter span{
-    display: block;
-    margin: 0.1em;
-    font-size: 80%;
-}
-
-form.filter td.filter_title{
-    text-transform: capitalize;
-    font-variant: small-caps;
-    font-weight: bold;
-    border-right: 0.2em solid #ffffff;
-    text-align: center;
-    vertical-align: top;
-    padding-bottom: 0.5em;
-}
-
-form.filter td.filter_title span{
-    display: block;
-    width: 0.8em;
-    word-break: break-all;
-    margin-top: 0em;
-    line-height: 90%;
-    text-align: left;
-}
-form.filter td.filter_separator{
-    border-top: 0.2em solid #ffffff;
-}
-
-
-form.filter div#filter_apply{
-    text-align: center;
-    margin: 0.5em auto 1em auto;
-}
-
-form#filter_runeupgrade select#filter_slot{
-    height: 10em;
-}
-
-form#filter_runecraft table td select#filter_grind_stat, select#filter_gem_stat_from, select#filter_gem_stat_to{
-    height: 16em;
-}
-
-form#filter_runecraft select#filter_slot{
-    height: 10em;
-}

+ 48 - 296
public/css/fusion.css

@@ -1,22 +1,36 @@
-div.essence{
-    position: relative;
+section#fusions table{
+    border-collapse: collapse;
+    width: 100%;
+    display: block;
+    margin: 0.5em auto 1.5em auto;
+    border: 0.1em solid black;
+    background: var(--section-background-content);
+}
+section#fusions table td{
+    border-right: 0.1em solid #00000088;
+    border-left: 0.1em solid #00000088;
+    border-top: 0.2em solid #00000088;
+    border-bottom: 0.2em solid #00000088;
+    padding: 0;
+}
+section#fusions table td a{
     display: inline-block;
-    vertical-align: top;
-    border-style: solid;
-    border-width: 0.1em;
-    border-radius: 15%;
-    width: 2.5em;
-    height: 2.5em;
-    margin-bottom: 0.1em;
+    vertical-align: middle;
+}
+section#fusions table td div.essences{
+    display: inline-block;
+    width: 6.5em;
+    height: 6.5em;
+    vertical-align: middle;
 }
-div.essence img{
+section#fusions table td div.essence img{
     position: absolute;
     top: 0;
     left: 0;
     width: 2.5em;
     height: 2.5em;
 }
-div.essence span{
+section#fusions table td div.essence span{
     position: absolute;
     top: 1.4em;
     text-align: right;
@@ -25,303 +39,41 @@ div.essence span{
     font-weight: bold;
     text-shadow: 0 0 0.1em #000000, 0 0 0.1em #000000, 0 0 0.2em #000000, 0 0 0.2em #000000;
 }
-
-div.owned{
-    border: 0.1em solid #000000;
+section#fusions table td div.owned{
+    border-top: 0.1em solid #00000066;
     background-color: #555555;
-    border-radius: 1em;
-    padding: 0 0.3em;
-}
-
-@media screen and (max-width : 990px){
-    div.owned{
-        border: 0;
-        background-color:initial;
-        border-radius: 0;
-        padding: 0em;
-        font-size: 60%;
-        margin: -0.5em;
-    }
+    border-radius: 0.2em;
+    padding: 0 0.1em;
+    opacity: 0.7;
+    display: block;
+    height: 6.5em;
+    overflow: auto;
+    scrollbar-width: thin;
+    margin: 0;
 }
-
-div.owned span.owned{
+section#fusions table td div.owned span.owned{
     display: block;
     text-align: center;
     margin: 0.1em 0.3em;
     font-size: 90%;
     color: #ffffff;
 }
-@media screen and (max-width : 990px){
-    div.owned span.owned{
-        display: none;
-    }
-}
-
-div.owned div.monster_panel{
-    display: inline-block;
-    font-size: 60%;
-}
-@media screen and (max-width : 990px){
-    div.owned div.monster_panel{
-    }
-}
-
-div.f5{
-    display: block;
-}
-
-div.f5 > div.product{
-    display: inline-block;
-    font-size: 150%;
-    width: 10em;
-    vertical-align: middle;
-    background: linear-gradient(90deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.5) 100%);
-    border-left: 1em solid #ffffff;
-    border-top: 1em solid #ffffff;;
-    border-bottom: 1em solid #ffffff;
-    border-top-left-radius: 8em;
-    border-bottom-left-radius: 8em;
-    padding: 2em;
-}
-@media screen and (max-width : 990px){
-    div.f5 > div.product{
-        display: block;
-        width: 100%;
-        background: initial;
-        border-left:0;
-        border-top: 0;;
-        border-bottom: 0;
-        border-top-left-radius: 0;
-        border-bottom-left-radius: ;
-        padding: 0;
-    }
-}
-
-div.f5 > div.product > a > div.monster_panel{
-    display: inline-block;
-    vertical-align: middle;
-}
-
-div.f5 > div.product > div.owned{
-    display: inline-block;
-    vertical-align: middle;
-}
-
-div.f5 > div.ingredients{
-    display: inline-block;
-    vertical-align: middle;
-    border-left: 1em solid #ffffff;
-    border-top: 0.3em solid #ffffff;;
-    border-bottom: 0.3em solid #ffffff;
-    border-top-left-radius: 6em;
-    border-bottom-left-radius: 6em;
-    border-top-right-radius: 1em;
-    border-bottom-right-radius: 1em;
-    padding: 0.5em 0.5em 0.5em 0;
-}
-@media screen and (max-width : 990px){
-    div.f5 > div.ingredients{
-        display: block;
-        border-left:0;
-        border-top: 0;;
-        border-bottom: 0;
-        border-top-left-radius: 0;
-        border-bottom-left-radius: 0;
-        border-top-right-radius: 0;
-        border-bottom-right-radius: 0;
-        padding: 0;
-    }
-}
-
-div.f4{
-    display:block;
-}
-@media screen and (max-width : 990px){
-    div.f4{
-        display: inline-block;
-        vertical-align: top;
-        width: 22%;
-        border: 0.2em solid #000000;
-        background-color: #00000033;
-    }
-}
-
-div.f4 > div.product{
-    display: inline-block;
-    width: 20em;
-    vertical-align: middle;
-    border-left: 0.3em solid #ffffff;
-    border-top: 0.3em solid #ffffff;
-    border-bottom: 0.3em solid #ffffff;
-    border-top-left-radius: 4em;
-    border-bottom-left-radius: 4em;
-    background: linear-gradient(90deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.5) 100%);
-}
-@media screen and (max-width : 990px){
-    div.f4 > div.product{
-        display: block;
-        width: 100%;
-        background: initial;
-        border-left:0;
-        border-top: 0;
-        border-bottom: 0;
-        border-top-left-radius: 0;
-        border-bottom-left-radius: ;
-        padding: 0;
-    }
-}
-div.f4.extra > div.product{
-    display: block;
-    width: auto;
-    margin-top: 0.2em;
-    margin-bottom: 0.5em;
-}
-@media screen and (max-width : 990px){
-    div.4.extra > div.product{
-        display: block;
-        width: 100%;
-        background: initial;
-        border-left:0;
-        border-top: 0;
-        border-bottom: 0;
-        border-top-left-radius: 0;
-        border-bottom-left-radius: ;
-        padding: 0;
-    }
-}
-div.f4 > div.product > a > div.unawakened{
-    display: inline-block;
-    vertical-align: top;
-}
-@media screen and (max-width : 990px){
-    div.f4 > div.product > a > div.unawakened{
-        display: none;
-    }
-}
-div.f4.extra > div.product > a > div.unawakened{
-    vertical-align: middle;
-}
-@media screen and (max-width : 990px){
-    div.f4.extra > div.product > a > div.unawakened{
-        display: none;
-    }
-}
-
-div.f4 > div.product > div.essences{
-    display: inline-block;
-    width: 6em;
-    text-align: center;
-    vertical-align: top;
-}
-@media screen and (max-width : 990px){
-    div.f4 > div.product > div.essences{
-        display: none;
-    }
-}
-div.f4.extra > div.product > div.essences{
-    vertical-align: middle;
-    margin-left: 1em;
-}
-
-div.f4 > div.product > a > div.awakened{
-    display: inline-block;
-    vertical-align: top;
-}
-div.f4.extra > div.product > a > div.awakened{
-    vertical-align: middle;
-}
-div.f4 > div.product > div.owned{
-    display: inline-block;
-    vertical-align: top;
-}
-div.f4.extra > div.product > div.owned{
-    vertical-align: middle;
-    margin-left: 1em;
-}
-div.f4 > div.ingredients{
+section#fusions table td div.owned div.monster_panel{
     display: inline-block;
-    vertical-align: middle;
-    border-left: 0.5em solid #ffffff;
-    border-top: 0.15em solid #ffffff;;
-    border-bottom: 0.15em solid #ffffff;
-    border-top-left-radius: 2em;
-    border-bottom-left-radius: 2em;
-    padding: 0;
-    margin: 0.2em 0;
+    font-size: 50%;
 }
-@media screen and (max-width : 990px){
-    div.f4 > div.ingredients{
-        display: block;
-        width: 100%;
-        background: initial;
-        border-left:0;
-        border-top: 0;
-        border-bottom: 0;
-        border-top-left-radius: 0;
-        border-bottom-left-radius: ;
-        padding: 0;
-    }
+section#fusions table td.f5{
+    background-color: #00000066;
+    padding-top: 0.8em;
 }
-
-div.f3{
-    display: block;
-    width: 100%;
+section#fusions table td.f4{
     font-size: 60%;
-    border-left: 0.1em solid #ffffff;
-    border-top: 0.1em solid #ffffff;
-    border-bottom: 0.1em solid #ffffff;
-    border-top-left-radius: 2em;
-    border-bottom-left-radius: 2em;
-    background: linear-gradient(90deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.5) 100%);
-}
-
-@media screen and (max-width : 990px){
-    div.f3{
-        display: inline-block;
-        vertical-align: top;
-        width: 43%;
-        font-size: 45%;
-        border-left: 0;
-        border-top: 0;
-        border-bottom: 0;
-        border-top-left-radius: 0;
-        border-bottom-left-radius: 0;
-        background: initial;
-        padding: 0.1em;
-        background-color: #00000033;
-        border: 0.1em solid #000000;
-    }
-}
-
-div.f3 > div.product > a > div.unawakened{
-    display: inline-block;
-    vertical-align: middle;
+    width: 25%;
 }
-@media screen and (max-width : 990px){
-    div.f3 > div.product > a > div.unawakened{
-        display: none;
-    }
+section#fusions table td.f3{
+    font-size: 40%;
+    width: 6.25%;
 }
-
-
-div.f3 > div.product > div.essences{
-    display: inline-block;
-    width: 6em;
-    text-align: center;
-    vertical-align: middle;
-}
-@media screen and (max-width : 990px){
-    div.f3 > div.product > div.essences{
-        display: none;
-    }
-}
-
-div.f3 > div.product > a > div.awakened{
-    display: inline-block;
-    vertical-align: middle;
-}
-
-div.f3 > div.product > div.owned{
-    display: inline-block;
-    vertical-align: middle;
+section#fusions table td.f3.empty{
+    width: 25%;
 }

+ 4 - 4
public/css/guild.css

@@ -12,19 +12,19 @@ div#guild_details{
         font-size: 90%;
     }
 }
-div#guild_details span#guild_level{
+aside span#guild_level{
     font-size: 120%;
 }
-div#guild_details span#guild_experience{
+asidespan#guild_experience{
     font-style: italic;
     padding-left: 1em;
 }
-div#guild_details p#guild_comment{
+aside p#guild_comment{
     color: #00ff00;
     font-style: italic;
     margin: 0.5em 1em;
 }
-div#guild_details p#guild_notice{
+aside p#guild_notice{
     color: #ff44ab;
     font-style: italic;
     font-weight: bold;

+ 7 - 14
public/css/home.css

@@ -16,7 +16,7 @@ div.panel{
     }
 }
 
-article#profile div.profile_section{
+div.profile_section{
     border: 0.2em solid var(--ui-color-border);
 /*     max-width: 45%; */
     margin: 0.5em;
@@ -27,16 +27,9 @@ article#profile div.profile_section{
     text-align: center;
     background-color: #00000033;
 }
-@media screen and (max-width : 990px){
-    article#profile div.profile_section{
-        display: block;
-        margin: 0.5em auto;
-        max-width: 95%;
-        width: 95%;
-    }
-}
 
-article#profile div.profile_section h4{
+
+div.profile_section h4{
     margin: 0 -0.5em 0.5em -0.5em;
     border-top-left-radius: 0.5em;
     border-top-right-radius: 0.5em;
@@ -45,21 +38,21 @@ article#profile div.profile_section h4{
     background-color: #00000033;
 }
 
-article#profile div#player table{
+aside table#profile{
     border-collapse: collapse;
     margin: 0 auto;
 }
 
-article#profile div#player table td{
+aside table#profile td{
     border-top: 0.1em solid #00000077;
     border-bottom: 0.1em solid #00000077;
 }
 
-article#profile div#player table td.label{
+aside table#profile td.label{
     text-align: left;
     padding-right: 1.5em;
 }
-article#profile div#player table td.value{
+aside table#profile td.value{
     text-align: right;
 }
 

+ 82 - 127
public/css/monster.css

@@ -1,54 +1,57 @@
-section#monster{
-    max-width: 60%;
-    display: inline-block;
-    vertical-align: top;
-    margin: 0.2em;
-    position: relative;
-}
-
-@media screen and (max-width : 990px){
-    section#monster{
-        width: 90%;
-        max-width: 90%;
-        margin: 0.2em auto;
-        display: block;
-    }
-}
-
-section#monster article#profile div#monster_info{
-    display: inline-block;
-    vertical-align: top;
-    max-width: 10em;
+aside div#monster_info{
+    text-align: center;
 }
-
-section#monster article#profile div#monster_info div#monster_details{
+aside div#monster_info div#monster_details{
     display: block;
     font-size: 70%;
 }
-
-section#monster article#profile div#monster_info div#monster_details div#teams{
+@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: 1em;
+}
+@media only screen and (max-width: 788px){
+    aside div#monster_info div#monster_details div#teams{
+        margin: 0.2em;
+    }
+    aside div#monster_info div#monster_details div#teams ul{
+        margin: 0.2em;
+    }
 }
-
-section#monster article#profile div#monster_info div#monster_details div#teams h4{
+aside div#monster_info div#monster_details div#teams h4{
     margin: 0.2em auto;
 }
-
-section#monster article#profile div#monster_info div#exp{
+aside div#monster_info div#monster_details a#optimize{
+    display: block;
+    margin: auto 30%;
+}
+aside div#monster_info div#exp{
     border: 0.3em solid var(--ui-color-border);
     border-radius: 0.5em;
     height: 1em;
     background-color: #00000088;
     position: relative;
     font-size: 100%;
+    margin: auto 25%;
 }
-section#monster article#profile div#monster_info div#exp span#exp_bar{
+@media only screen and (max-width: 788px){
+    aside div#monster_info div#exp{
+        display: none;
+    }
+}
+aside div#monster_info div#exp span#exp_bar{
     height: 1em;
     border-radius: 0.4em;
     display: block;
     background-color: #cc0000;
 }
-section#monster article#profile div#monster_info div#exp span#exp_text{
+aside div#monster_info div#exp span#exp_text{
     display: block;
     text-align: center;
     position: absolute;
@@ -59,8 +62,11 @@ section#monster article#profile div#monster_info div#exp span#exp_text{
     font-size: 0.8em;
     text-shadow: 0 0 0.1em #000000, 0 0 0.1em #000000, 0 0 0.1em #000000, 0 0 0.1em #000000, 0 0 0.1em #000000;
 }
-
-section#monster article#profile table#stats{
+section#monster article#stats{
+    display: inline-block;
+    vertical-align: top;
+}
+section#monster article#stats table{
     font-size: 90%;
     vertical-align: top;
     display: inline-block;
@@ -70,47 +76,50 @@ section#monster article#profile table#stats{
     border-collapse: collapse;
     border-radius: 0.4em;
 }
-
-section#monster article#profile table#stats th{
+section#monster article#stats table th{
     font-weight: bold;
     background-color: #00000066;
 }
-
-section#monster article#profile table#stats td{
+section#monster article#stats table 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{
+section#monster article#stats table td span.percent{
     margin: 0 0 0 -0.7em;
     font-size: 80%;
 }
-
-section#monster article#profile table#stats td, th{
+section#monster article#stats table td, th{
     padding: 0.2em;
     border: 0.1em solid #000000;
 }
-
-section#monster article#profile table#stats td.extra{
+section#monster article#stats table td.extra{
     color: #aaaaff;
 }
-
-section#monster article#profile table#stats td.total{
+section#monster article#stats table td.total{
     color: #f2c920;
     font-weight: bold;
 }
-
-
-
-
-
-
-
-
-section#monster article#profile table#skills{
+section#monster article#artifacts{
+    display: inline-block;
+    vertical-align: top;
+}
+section#monster article#artifacts table{
+    display: block;
+}
+section#monster article#runes{
+    display: inline-block;
+    vertical-align: top;
+    width: 50em; /*Force two rows*/
+}
+@media only screen and (max-width: 788px){
+    section#monster article#runes{
+        width: 100%;
+    }
+}
+section#monster article#skills > table{
     display: block;
     font-size: 90%;
     border: 0.1em solid black;
@@ -122,17 +131,15 @@ section#monster article#profile table#skills{
     width: 90%;
 }
 @media screen and (max-width : 990px){
-    section#monster article#profile table#skills{
+    section#monster article#skills > table{
         width: 100%;
     }
 }
-
-section#monster article#profile table#skills th{
+section#monster article#skills > table th{
     font-weight: bold;
     background-color: #00000066;
 }
-
-section#monster article#profile table#skills > tbody >  tr > td{
+section#monster article#skills > table > tbody >  tr > td{
     vertical-align: top;
     padding: 0.2em 0.5em;
     border-right: 0.1em solid #00000088;
@@ -140,15 +147,13 @@ section#monster article#profile table#skills > tbody >  tr > td{
     border-top: 0.2em solid #00000088;
     border-bottom: 0.2em solid #00000088;
 }
-
-section#monster article#profile table#skills td.skill_img img{
+section#monster article#skills > table td.skill_img img{
     width: 4em;
     height: 4em;
     border: 0.15em solid var(--ui-color-border);
     border-radius: 0.4em;
 }
-
-section#monster article#profile table#skills span.skill_level{
+section#monster article#skills > table span.skill_level{
     font-size: 100%;
     top: 2.8em;
     display: block;
@@ -157,31 +162,25 @@ section#monster article#profile table#skills span.skill_level{
     text-align: right;
     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#monster article#profile table#skills span.skill_level.maxed{
+section#monster article#skills > table span.skill_level.maxed{
     color: #f2c920;
 }
-
-section#monster article#profile table#skills td.skill_text{
+section#monster article#skills > table td.skill_text{
     text-align: left;
 }
-
-section#monster article#profile table#skills td.skill_text h4{
+section#monster article#skills > table td.skill_text h4{
     text-shadow: 0 0 0.2em #000000, 0 0 0.2em #000000, 0 0 0.4em #000000;
     margin: 0 0 0.5em 0;
     display: block;
     font-weight: bold;
 }
-
-section#monster article#profile table#skills td.skill_text p{
+section#monster article#skills > table td.skill_text p{
     margin: 0 0 0 0;
 }
-
-section#monster article#profile table#skills td.skill_extra{
+section#monster article#skills > table td.skill_extra{
     text-align: center;
 }
-
-section#monster article#profile table#skills td.skill_text span.formula{
+section#monster article#skills > table td.skill_text span.formula{
     font-size: 80%;
     color: #cccccc;
     font-weight: bold;
@@ -189,77 +188,33 @@ section#monster article#profile table#skills td.skill_text span.formula{
     font-family: monospace;
     white-space: nowrap;
 }
-
-
-section#monster article#profile table#skills td.skill_text div.effects img{
+section#monster article#skills > table td.skill_text div.effects img{
     width: 1.6em;
     height: 1.6em;
     border: 0.1em solid #000000;
     border-radius: 0.5em;
 }
-
-section#monster article#profile table#skills td.skill_ups table{
+section#monster article#skills > table td.skill_ups table{
     font-size: 80%;
     font-family: monospace;
 }
-section#monster article#profile table#skills td.skill_ups table td{
+section#monster article#skills > table td.skill_ups table td{
     white-space: nowrap;
     color: #999999;
 }
-section#monster article#profile table#skills td.skill_ups td.aquired{
+section#monster article#skills > table td.skill_ups td.aquired{
     color: #efefef;
 }
-
-section#monster article#profile table#skills td.skill_ups table td.level{
+section#monster article#skills > table td.skill_ups table td.level{
     display: inline-block;
     text-align: left;
 }
-section#monster article#profile table#skills td.skill_ups table td.upgrade{
+section#monster article#skills > table td.skill_ups table td.upgrade{
     font-style: italic;
     text-align: left;
 }
-
-section#monster article#profile td#skill_averages{
+/*section#monster article#profile td#skill_averages{
     font-size: 90%;
     font-style: italic;
     border-top: 0.1em solid #cccccc;
-}
-
-section#runes{
-    max-width: 35%;
-    display: inline-block;
-    vertical-align: top;
-    position: relative;
-} 
-@media screen and (max-width : 990px){
-    section#runes{
-        width: 90%;
-        max-width: 90%;
-        margin: 2em auto auto auto;
-        display: block;
-    }
-}
-
-section#runes article#rune_averages{
-    margin: 2em auto 1em auto;
-    text-align: center;
-}
-@media screen and (max-width : 990px){
-    section#runes article{
-        display: inline-block;
-    }
-
-section#runes article#rune_averages table#table_averages{
-    margin: auto;
-    font-size: 80%;
-    border-collapse: collapse;
-}
-
-section#runes article#rune_averages table#table_averages td.title{
-    text-align: right;
-}
-section#runes article#rune_averages table#table_averages td.value{
-    text-align: right;
-    padding-left: 1em;
-    font-family: monospace;
-}
+}*/

+ 9 - 0
public/css/monster_info.css

@@ -1,3 +1,12 @@
+aside nav{
+    display: block;
+    text-align: center;
+}
+aside div.monster_panel{
+    display: inline-block;
+    font-size: 70%;
+}
+
 section h2 span.family{
     float: right;
 }

+ 40 - 18
public/css/monsters.css

@@ -1,10 +1,32 @@
-section.list div.monster{
+aside form.filter table td.label{
+    min-width: 5em;
+}
+aside form.filter table input#filter_name{
+    width: 10em;
+}
+aside form.filter table select#filter_effect{
+    font-size: 60%;
+    overflow-y: always;
+    scrollbar-width: thin;
+    width: 11em;
+}
+aside form.filter table select#filter_effect_option{
+    margin-left: 1em;
+}
+
+
+section#list{
+    display: block;
+    vertical-align: top;
+}
+
+section#list div.monster{
     display: inline-block;
     position: relative;
     font-size: 80%;
 }
 
-section.list div.monster div.monster_tooltip{
+section#list div.monster div.monster_tooltip{
     position: absolute;
     top: 0;
     left: 6em;
@@ -16,40 +38,40 @@ section.list div.monster div.monster_tooltip{
     padding: 0.5em;
 }
 
-section.list div.monster:hover div.monster_tooltip{
+section#list div.monster:hover div.monster_tooltip{
     display: block;
 }
 @media screen and (max-width : 990px){
-    section.list div.monster:hover div.monster_tooltip{
+    section#list div.monster:hover div.monster_tooltip{
         display: none;
     }
 }
 
-section.list div.monster div.monster_tooltip h4{
+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{
+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{
+section#list div.monster div.monster_tooltip table.stats th{
     font-weight: bold;
     border-bottom: 0.1em solid black;
     background-color: #150e00;
 }
 
-section.list div.monster div.monster_tooltip table.stats tr{
+section#list div.monster div.monster_tooltip table.stats tr{
     line-height: 0.8em;
 }
 
-section.list div.monster div.monster_tooltip table.stats td{
+section#list div.monster div.monster_tooltip table.stats td{
     border: 0.1em solid #00000055;
     border-bottom: 0.1em solid black;
     color: #cccccc;
@@ -59,26 +81,26 @@ section.list div.monster div.monster_tooltip table.stats td{
     min-width: 4.5em;
 }
 
-section.list div.monster div.monster_tooltip table.stats td span.percent{
+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{
+section#list div.monster div.monster_tooltip table.stats td.extra{
     color: #aaaaff;
 }
 
-section.list div.monster div.monster_tooltip table.stats td.total{
+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{
+section#list div.monster div.monster_tooltip div.skills{
     text-align: center;
 }
 
-section.list div.monster div.monster_tooltip div.skills div.skill{
+section#list div.monster div.monster_tooltip div.skills div.skill{
     display: inline-block;
     vertical-align: top;
     max-width: 22%;
@@ -88,13 +110,13 @@ section.list div.monster div.monster_tooltip div.skills div.skill{
     text-align: center;
 }
 
-section.list div.monster div.monster_tooltip div.skills div.skill img{
+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{
+section#list div.monster div.monster_tooltip div.skills div.skill span.skill_level{
     font-size: 130%;
     position: relative;
     bottom: 1.4em;
@@ -106,11 +128,11 @@ section.list div.monster div.monster_tooltip div.skills div.skill span.skill_lev
     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{
+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{
+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;

+ 17 - 11
public/css/optimizer.css

@@ -34,18 +34,18 @@ table#teams td.description{
 
 table#teams td.units{
     width: 12em;
+    text-align: center;
 }
 
 table#teams td.units hr.frontline{
     display: block;
     width: 9em;
-    margin: -0.6em 0 0.2em 0;
+    margin: 0 auto 0.2em auto;
     color: #666666;
 }
 
 table#teams td.units div.monster_panel{
     font-size: 25%;
-    margin-bottom: -2em;
 }
 
 table#teams td.units div.monster_panel img.leader{
@@ -98,22 +98,28 @@ div#unit_list table td.action input[type="button"]{
     padding: 0.1em;
 }
 
-section#monster article#profile div#monster_info{
-    display: inline-block;
-    vertical-align: top;
-    max-width: 10em;
+aside div#monster_info{
+    display: block;
+    text-align: center;
 }
-
-section#monster article#profile div#monster_info div#monster_details{
+aside div#monster_info div#monster_details{
     display: block;
+    margin: auto;
     font-size: 70%;
 }
-
-section#monster article#profile div#monster_info div#monster_details div#teams{
+@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;
 }
 
-section#monster article#profile div#monster_info div#monster_details div#teams h4{
+aside div#monster_info div#monster_details div#teams h4{
     margin: 0.2em auto;
 }
 

+ 7 - 0
public/css/profile.css

@@ -28,6 +28,13 @@ table#profile td.action{
 table#profile td input, span{
     width: 100%;
 }
+table#profile td#visibility div.help_tooltip p span{
+    display: block;
+    margin: 0 0 0 0.5em;
+}
+table#profile td#visibility div.help_tooltip p span:before{
+    content: "-";
+}
 
 input#edit_mail,
 input#edit_pass_current,

+ 77 - 52
public/css/report_runecraft.css

@@ -1,61 +1,86 @@
-section.content article{
-    text-align: left;
-    position: relative;
-}
-
-@media screen and (max-width : 990px){
-    section.content article{
-        width: 95%;
-        max-width: 95%;
-        margin: 0.2em auto;
-        display: block;
-    }
-}
-
-section.content article div.monster{
-    display: block;
-    font-size: 50%;
-    position: absolute;
+aside form.filter table td.header{
+    font-weight: bold;
+}
+aside form.filter table td.label{
+    padding-left: 1em;
+}
+aside form.filter table td input#filter_name{
+    width: 11em;
+}
+aside form.filter table td.slot select#filter_slot{
+    height: 1.5em;
+}
+aside form.filter table td.slot select#filter_slot option{
+    display: inline-block;
+    font-size: 90%;
+}
+aside form.filter table td.stats{
+    overflow: hidden;
+}
+aside form.filter table td.stats div{
+    box-shadow: var(--input-box-shadow);
+    display: inline-block;
+}
+aside form.filter table td.stats div select{
+    height: 3em;
+    box-shadow: none
+}
+aside form.filter table td.stats div select option{
+    font-size: 90%;
+}
+aside form.filter table td.stats div select:not(:first-child){
+    border-left: 0;
+    border-top-left-radius: 0;
+    border-bottom-left-radius: 0;
 }
-
-section.content article div.monster_runes{
+aside form.filter table td.stats div select:not(:last-child){
+    border-right: 0;
+    border-top-right-radius: 0;
+    border-bottom-right-radius: 0;
+}
+aside form.filter input[type='submit']{
+    margin: 1em auto;
     display: block;
-    vertical-align: top;
-    margin-left: 4em;
 }
-
-section.content article div.monster_runes > table.rune{
-    font-size: 80%;
-    max-width: 50%;
+section#results{
+    display: inline-block;
     vertical-align: top;
-    margin: 0 -0.5em 0.5em 0.5em;
 }
-@media screen and (max-width : 990px){
-    section.content article div.monster_runes > table.rune{max-width: 95%;}
+section#results table#results{
+    margin: auto;
+    border-collapse: collapse;
+    border: 0.2em solid #000000;
+    border-top: 0;
+    display: inline-block;
+    border-radius: 0.4em;
 }
-section.content article div.monster_runes > table.rune:before { content: '\A'; }
-
-section.content article div.monster_runes div.craft{
+section#results table#results td.header{
+    background-color: #00000066;
+    color: #ffffff;
+    border-top: 0.2em solid #000000;
+    font-weight: bold;
+    text-align: left;
+}
+section#results table#results td.header a{
     display: inline-block;
+    vertical-align: middle;
+    font-size: 40%;
+}
+section#results table#results td.header h4{
+    display: inline-block;
+    vertical-align: middle;
+    font-weight: bold;
+}
+section#results table#results td.rune{
+    vertical-align: top;
+    text-align: left;
+    border-bottom: 0.1em solid #00000088;
+}
+section#results table#results td.upgrades{
+    padding-top: 1em;
+    font-size: 70%;
     vertical-align: top;
-    max-width: 45%;
-    min-width: 35%;
-    padding: 1em 1em 1em 3em;
-    margin: 0 0 1em -2em;
-    font-size: 80%;
-    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0) 3%, rgba(255,255,255,0.3) 10%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0) 70%);
-    border-top-left-radius: 3em;
-    border-bottom-left-radius: 3em;
-}
-@media screen and (max-width : 990px){
-    section.content article div.monster_runes div.craft{
-        display: block;
-        max-width: 95%;
-        min-width: 95%;
-        padding: 0.5em;
-        margin: 0.5em;
-        font-size: 80%;
-        background: none;
-
-    }
+    text-align: left;
+    border-bottom: 0.1em solid #00000088;
+    max-width: 30em;
 }

+ 0 - 46
public/css/report_runeupgrade.css

@@ -1,46 +0,0 @@
-section.content article{
-    text-align: left;
-}
-
-section.content article div.monster{
-    display:inline-block;
-    vertical-align: top;
-    width: 10em;
-    max-width: 15%;
-}
-@media screen and (max-width : 990px){
-    section.content article div.monster{
-        display: block;
-        max-width: 100%;
-        width: initial;
-    }
-}
-
-section.content article div.monster_runes{
-    display:inline-block;
-    vertical-align: top;
-    max-width: 80%;
-}
-@media screen and (max-width : 990px){
-    section.content article div.monster_runes{
-        display: block;
-        max-width: 100%;
-    }
-}
-
-section.content article div.monster_runes > table.rune{
-    font-size: 90%;
-}
-
-section.content article div.monster_runes div.alternatives{
-    padding: 0.2em;
-    margin-top: -0.6em;
-    margin-left: 1.5em;
-    margin-bottom: 0.5em;
-    border-left: 0.1em solid #3c2929;;
-    border-bottom: 0.1em solid #3c2929;;
-    border-bottom-left-radius: 1em;
-    border-bottom-right-radius: 1em;
-    font-size: 90%;
-    background: linear-gradient(47deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.1) 60%, rgba(255,255,255,0) 80%);
-}

+ 57 - 58
public/css/report_skillup.css

@@ -1,50 +1,66 @@
-section.filters table{
+section#filters{
+    display: inline-block;
+    vertical-align: top;
+    text-align:center;
+}
+section#filters table{
+    margin: auto;
+    display: inline;
+    border-collapse: collapse;
     text-align: left;
 }
-section.filters table td{
-    text-align: left !important;
+section#filters table td.filter{
+    padding: 0.2em;
+    text-align: left;
+    color: #ffffff;
 }
-
-section.content{
+section#filters input[type='submit']{
+    margin: 1em auto;
     display: block;
+}
+section#results{
+    display: inline-block;
+    vertical-align: top;
+}
+section#results table#results{
+    margin: auto;
+    border-collapse: collapse;
+    border: 0.2em solid #000000;
+    border-top: 0;
+    display: inline-block;
+    border-radius: 0.4em;
+}
+section#results table#results td.header{
+    background-color: #00000066;
+    color: #ffffff;
+    border-top: 0.2em solid #000000;
+    font-weight: bold;
     text-align: left;
 }
-
-section.content div.monster div.profile{
+section#results table#results td.img{
     text-align: center;
-    display: inline-block;
     vertical-align: top;
     font-size: 65%;
     margin-bottom: -2em;
+    border-left: 0.1em solid #00000088;
+    border-right: 0.1em solid #00000088;
 }
-@media screen and (max-width : 990px){
-    section.content div.monster div.profile{
-        text-align: center;
-        width: 30%;
-    }
-}
-
-section.content div.monster div.skills{
+section#results table#results td.skill{
     text-align: left;
-    display: inline-block;
+    border-left: 0.1em solid #00000088;
+    border-right: 0.1em solid #00000088;
 }
-
-section.content div.monster div.skills div.skill{
-    display: inline-block;
-    vertical-align: top;
+section#results table#results td.skill{
     width: 5em;
-    margin: 0.5em;
+    padding: 0.2em;
     color: #ffffff;
-    text-align: center;
-    position: relative;
 }
-@media screen and (max-width : 990px){
-    section.content div.monster div.skills div.skill{
-        font-size: 80%;
-    }
+section#results table#results td.skill.empty{
+    width: 0;
+    border: 0;
+    padding: 0;
 }
-
-section.content div.monster div.skills div.skill img{
+section#results table#results td.skill img{
     width: 3em;
     height: 3em;
     border: 0.1em solid var(--ui-color-border);
@@ -52,7 +68,7 @@ section.content div.monster div.skills div.skill img{
     margin: auto;
     display: block;
 }
-section.content div.monster div.skills div.skill span.skill_level{
+section#results table#results td.skill span.skill_level{
     position: relative;
     display: block;
     top: -1.3em;
@@ -62,42 +78,25 @@ section.content div.monster div.skills div.skill span.skill_level{
     pointer-events: none;
     margin: auto;
 }
-
-section.content div.monster div.skills div.skill span.skill_level.maxed{
+section#results table#results td.skill span.skill_level.maxed{
     color: #f2c920;
 }
-
-section.content div.monster div.skills div.skill span.skill_name{
+section#results table#results td.skill span.skill_name{
     text-shadow: 0 0 0.2em #000000, 0 0 0.2em #000000, 0 0 0.4em #000000;
     top: 3.2em;
     display: block;
     margin-top: -1.3em;
     font-size: 80%;
     line-height: 0.9em;
+    text-align: center;
 }
-
-section.content div.monster table#skill_averages{
-    margin: auto auto auto 2em;
-    color: #ffffff;
-    display: inline-block;
-    vertical-align: top;
-    max-width: 30%;
-}
-@media screen and (max-width : 990px){
-    section.content div.monster table#skill_averages{
-        display: block;
-        margin: 0 auto auto auto;
-        font-size: 80%;
-        max-width: 90%;
-        text-align: left;
-        border-collapse: collapse;
-    }
-}
-
-section.content div.monster table#skill_averages td.title{
+section#results table#results td.label, section#results table#results td.value{
     text-align: right;
+    padding: 0 0.1em;
 }
-section.content div.monstertable#skill_averages td.value{
-    text-align: left;
-    padding-left: 1em;
+section#results table#results td.label{
+    font-size: 90%;
+}
+section#results table#results td.value{
+    font-family: monospace;
 }

+ 72 - 21
public/css/runes.css

@@ -1,42 +1,93 @@
-section.filters td.filter select#filter_type{
-    height: 27em;
-    overflow: hidden;
+aside form.filter table td.stats div{
+    display: inline-block;
+    box-shadow: var(--input-box-shadow);
+}
+aside form.filter table td.stats select{
+    height: 3em;
+    box-shadow: none;
+}
+aside form.filter table td.stats select:not(:first-child){
+    border-left: 0;
+    border-top-left-radius: 0;
+    border-bottom-left-radius: 0;
+}
+aside form.filter table td.stats select:not(:last-child){
+    border-right: 0;
+    border-top-right-radius: 0;
+    border-bottom-right-radius: 0;
+}
+aside form.filter table td.stats select option{
+    font-size: 90%;
+}
+aside form.filter table td.type div{
+    display: inline-block;
+    box-shadow: var(--input-box-shadow);
+}
+aside form.filter table td.type select{
+    height: 8.5em;
+    box-shadow: none;
 }
-section.filters td.filter select#filter_slot{
-    height: 8em;
-    overflow: hidden;
+aside form.filter table td.type select:not(:first-child){
+    border-left: 0;
+    border-top-left-radius: 0;
+    border-bottom-left-radius: 0;
 }
-section.filters td.filter select#filter_main_stat{
-    height: 14em;
-    overflow: hidden;
+aside form.filter table td.type select:not(:last-child){
+    border-right: 0;
+    border-top-right-radius: 0;
+    border-bottom-right-radius: 0;
+}
+aside form.filter table td.type select option{
+    font-size: 90%;
+}
+aside form.filter table td.slot select{
+    height: 1.5em;
+}
+aside form.filter table td.slot select option{
+    font-size: 90%;
+    display: inline-block;
+}
+aside form.filter input[type='submit']{
+    margin: 1em auto;
+    display: block;
+}
+section#runes > table{
+    margin: auto;
+    border-collapse: collapse;
+    border: 0.2em solid #000000;
+    border-top: 0;
+    display: inline-block;
+    border-radius: 0.4em;
 }
-section.filters td.filter select#filter_sub_stat{
-    height: 14em;
-    overflow: hidden;
+section#runes > table td.header{
+    background-color: #00000066;
+    color: #ffffff;
+    border-top: 0.2em solid #000000;
+    font-weight: bold;
+    text-align: left;
 }
-
-section h2 img, span{
+section#runes > table td.header img, span{
     display: inline-block;
     vertical-align: middle;
 }
-section h2 img{
+section#runes > table td.header img{
     height: 1.5em;
 }
-section h2 img.group_image_1{
+section#runes > table td.header img.group_image_1{
     transform: rotate(0deg);
 }
-section h2 img.group_image_2{
+section#runes > table td.header img.group_image_2{
     transform: rotate(57deg);
 }
-section h2 img.group_image_3{
+section#runes > table td.header img.group_image_3{
     transform: rotate(123deg);
 }
-section h2 img.group_image_4{
+section#runes > table td.header img.group_image_4{
     transform: rotate(180deg);
 }
-section h2 img.group_image_5{
+section#runes > table td.header img.group_image_5{
     transform: rotate(237deg);
 }
-section h2 img.group_image_6{
+section#runes > table td.header img.group_image_6{
     transform: rotate(303deg);
 }

+ 6 - 2
public/css/teams.css

@@ -53,18 +53,18 @@ table#teams td.team h4 span.stage{
 
 table#teams td.units{
     width: 12em;
+    text-align: center;
 }
 
 table#teams td.units hr.frontline{
     display: block;
     width: 9em;
-    margin: -0.6em 0 0.2em 0;
+    margin: 0 auto 0.2em auto;
     color: #666666;
 }
 
 table#teams td.units div.monster_panel{
     font-size: 25%;
-    margin-bottom: -2em;
 }
 
 table#teams td.units div.monster_panel img.leader{
@@ -76,6 +76,10 @@ table#teams td.units div.monster_panel img.leader{
     left: -0.7em;
 }
 
+table#teams td.score{
+    text-align: center;
+}
+
 table#teams td.action{
     text-align: center;
 }

+ 206 - 36
public/css/ui.css

@@ -1,4 +1,10 @@
 :root {
+    /**
+     * Width to switch to diferent layoouts.
+     */
+    --width-small: 600px; /*Use with max-*/
+    --width-medium: 768px;
+    --width-large: 1024px; /*Use with min-*/
     /**
      * Global elements
      */
@@ -23,17 +29,23 @@
     --nav-separator: 0.1em solid #ffffff44;
     --nav-shadow: 0 0 0 #ffffff;
     --nav-shadow-hover: 0 0 0.2em #ffffff;
+    /**
+     * Sidebar.
+     */
+    --sidebar-width: 22em;
+    --sidebar-background: #331100;
+    --sidebar-border: 0.13em solid var(--ui-color-border);
     /**
      * Sections.
      */
-    --section-border: 0.15em solid var(--ui-color-border);
+    --section-border: 0.13em solid var(--ui-color-border);
     --section-border-radius: 0.5em;
-    --section-padding: 0.5em;
-    --section-margin: 0.2em 2em 0.5em 2em;
-    --section-title-margin: -0.5em -0.5em 0.5em -0.5em;
+    --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-border-radius: 0.35em;
-    --section-title-padding: 0.2em 0 0.2em 2em;
+    --section-title-padding: 0.2em 0 0.2em 1em;
     --section-title-font-size: 100%;
     --section-title-font-weight: bold;
     --section-background-list: #331100;
@@ -124,10 +136,20 @@ html {height: 100%;}
 body{
     background-color: var(--global-background);
     color: var(--global-color);
-    height: 100%;
     padding: 0;
     margin: 0;
-    text-align: center;
+    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;
+}
+@media only screen and (max-width: 788px){
+    body{
+        display: initial;
+    }
 }
 a{
     color: var(--ui-color-a);
@@ -152,14 +174,24 @@ a:hover{
 }
 header{
     border-bottom: var(--header-border);
-    /*border-left: var(--header-border);
-    border-right: var(--header-border);*/
     border-bottom-right-radius: var(--header-border-radius);
     border-bottom-left-radius: var(--header-border-radius);
     margin: 0 0 1em 0;
     background-color: var(--header-background);
     text-align: left;
     position: relative;
+    grid-area: header;
+    position: sticky;
+    top: 0;
+    z-index: 1000;
+}
+@media only screen and (max-width: 788px){
+    header{
+        position: initial;
+        grid-area: none;
+        margin: 0;
+        height: 4.2em;
+    }
 }
 header div#logo{
     font-size: 70%;
@@ -184,10 +216,11 @@ header div#logo h1#logo_text span.small{
     font-size: 60%;
     margin-left: -0.5em;
 }
-@media screen and (max-width : 990px){
+@media screen and (max-width : 768px){
     header div#logo{
         position: absolute;
-        top: 1em;
+        top: 0em;
+        right: 0em;
     }
     header div#logo img#logo_img{
         max-width: 5em;
@@ -203,6 +236,16 @@ header nav#menu{
     display: inline-block;
     height: 2em;
 }
+@media only screen and (max-width: 788px){
+    header nav#menu{
+        display: block;
+        position: absolute;
+        left: 0em;
+        right: 7em;
+        top: 0em;
+        text-align: left;
+    }
+}
 header nav#menu a{
     font-size: 100%;
     font-weight: bold;
@@ -221,19 +264,14 @@ header nav#menu a{
     text-shadow: var(--nav-shadow);
 }
 header nav#menu a:last-of-type{border-right: var(--nav-separator)}
-
 header nav#menu a:hover{
     background-color: var(--nav-background-hover);
     color: var(--nav-color-hover);
     text-shadow: var(--nav-shadow-hover);
 }
-@media screen and (max-width : 990px){
-    header nav#menu{
-        height: initial;
-        display: block;
-        text-align: center;
-    }
+@media only screen and (max-width: 768px){
     header nav#menu a{
+        font-size: 80%;
         padding: 0.6em 0.2em;
         margin: 0em -0.2em;
         display: inline-block;
@@ -242,9 +280,6 @@ header nav#menu a:hover{
         border-bottom: var(--nav-separator);
         border-right: var(--nav-separator);
     }
-    header nav#menu a:hover{
-        text-shadow: 0 0 0 #000000;
-    }
 }
 header nav#profile{
     float: right;
@@ -253,11 +288,11 @@ header nav#profile{
     right: 0;
     top: 0em;
 }
-@media screen and (max-width : 990px){
+@media screen and (max-width : 768px){
     header nav#profile{
         margin-right: 0.5em;
         position: absolute;
-        top: 1em;
+        top: 2em;
         right: 0.5em;
     }
 }
@@ -283,18 +318,105 @@ header nav#profile a:hover{
     color: var(--nav-color-hover);
     text-shadow: var(--nav-shadow-hover);
 }
+
+aside{
+    grid-area: sidebar;
+    position: fixed;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    width: calc(var(--sidebar-width) - 1em);
+    overflow-y: hidden;
+    text-align: left;
+    border-right: var(--sidebar-border);
+    padding: 0.3em
+    margin: 0;
+    background: var(--sidebar-background);
+}
+@media only screen and (max-width: 788px){
+    aside{
+        grid-area: none;
+        position: relative;
+        width: 100%;
+        border-right: 0;
+        border-bottom: var(--sidebar-border);
+        top: initial;
+        bottom: initial;
+        left: initial;
+        overflow-y: initial;
+        margin-bottom: 2em;
+    }
+}
+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);
+    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: 3em;
+}
+@media only screen and (max-width: 788px){
+    aside h2{
+        margin: 0;
+        padding-top: 0.3em;
+    }
+}
+aside p{
+    font-style: italic;
+    margin: 0.5em 1.5em;
+}
+aside form.filter table{
+    margin: auto;
+    display: inline;
+    border-collapse: collapse;
+    text-align: left;
+}
+@media only screen and (max-width: 788px){
+    aside form.filter {
+        margin: auto;
+        display: block;
+        text-align: center;
+    }
+}
+aside form.filter input[type='submit']{
+    margin: 1em auto;
+    display: block;
+}
+main{
+    grid-area: content;
+    overflow-y: auto;
+}
+@media only screen and (max-width: 788px){
+    main{
+        grid-area: none;
+        overflow-y: initial;
+    }
+}
 footer{
     font-size: 80%;
     text-align: center;
     border-top: var(--header-border);
-    /*border-left: var(--header-border);
-    border-right: var(--header-border);*/
     border-top-right-radius: var(--header-border-radius);
     border-top-left-radius: var(--header-border-radius);
     margin: 2em 0 0 0;
     background-color: var(--header-background);
-    padding: 1em 2em 1em 2em;
-    position: relative;
+    padding: 0;
+    grid-area: footer;
+    position: sticky;
+    bottom: 0;
+    z-index: 1000;
+}
+@media only screen and (max-width: 788px){
+    footer{
+        margin: 2em 0 0 0;
+        grid-area: none;
+        position: relative;
+    }
 }
 footer table#footer_table{
     margin-left: auto;
@@ -746,7 +868,8 @@ div.monster_transformation_panel img.monster_transformation{
  * Rune table
  */
 table.rune{
-    width: 28em;
+    width: 21em;
+    height: 7.5em;
     border-collapse: collapse;
     display: inline-block;
     vertical-align: top;
@@ -802,19 +925,19 @@ table.rune td.stats table td.value{
     vertical-align: middle;
     white-space: nowrap;
 }
-table.rune td.stats table td.value span.grind{
+table.rune td.stats table td.grind{
     color: #ff7700;
     vertical-align: middle;
     font-size: 90%;
     font-weight: bold;
     margin-left: -0.4em;
+    position: relative
 }
-table.rune td.stats table td.value span.grind_{display: none;}
-table.rune td.stats table td.value img{
+table.rune td.stats table td.grind img{
     width: 1em;
     height: 1em;
-    margin: 0;
-    vertical-align: middle;
+    position: absolute;
+    top: 0.1em;
 }
 
 table.rune td.details{
@@ -842,7 +965,8 @@ table.rune td.details table.table_details span.quality{
     font-weight: bold;
     text-shadow: 0 0 0.1em #000000;
     padding: 0 0.3em;
-    width: 5em;
+    width: 3.5em;
+    text-align: center;
     height: 1em;
     font-size: 90%;
     display: inline-block;
@@ -866,7 +990,7 @@ table.rune td.details table.table_details span.quality.quality_legend{background
  * Artifact table
  */
 table.artifact{
-    width: 28em;
+    width: 24em;
     border-collapse: collapse;
     display: inline-block;
     vertical-align: top;
@@ -986,7 +1110,7 @@ div.craft_panel img.craft_base{
 div.craft_panel img.craft_icon{
     position: absolute;
     width: 1.5em;
-    height: 1.5em
+    height: 1.5em;
     top: 0.8em;
     left: 1.25em;
 }
@@ -1025,3 +1149,49 @@ div.craft_panel span.craft_amount{
     font-size: 90%;
     font-weight: bold;
     text-shadow: 0 0 0.2em #000000, 0 0 0.2em #000000, 0 0 0.2em #000000, 0 0 0.2em #000000, 0 0 0.2em #000000;
+}
+
+/* Help tooltips */
+div.help_tooltip{
+    display: inline-block;
+    width: 1em;
+    height: 1em;
+    color: var(--section-title-background);
+    background-color: var(--ui-color-border);
+    border: 0.1em solid var(--section-title-background);
+    border-radius: 50%;
+    font-family: monospace;
+    font-weight: bold;
+    vertical-align: bottom;
+    position: relative;
+    text-align: center;
+    cursor: pointer;
+}
+div.help_tooltip:after{
+    content: '?';
+}
+
+div.help_tooltip p{
+    font-size: 100%;
+    font-family: initial;
+    font-weight: initial;
+    border: var(--section-border);
+    color: #ffffff;
+    display: none;
+    position: absolute;
+    top: 0%;
+    left: -5em;
+    width: 10em;
+    border: var(--section-border);
+    border-radius: 0.8em;
+    background-color: var(--section-background-list);
+    padding: 0.4em;
+    text-align: left;
+    line-height: 95%;
+    filter: drop-shadow(0 0 0.5em #000000) drop-shadow(0 0 0.2em #000000) drop-shadow(0 0 0.1em #000000);
+    z-index: 999;
+}
+
+div.help_tooltip:hover p{
+    display: block;
+}

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov