Explorar o código

Merge branch 'master' into Optimizer

Iñigo Valentin %!s(int64=5) %!d(string=hai) anos
pai
achega
33f660d6cb
Modificáronse 100 ficheiros con 19983 adicións e 23880 borrados
  1. 3 0
      application/API/v2/API_Controller.php
  2. 283 0
      application/API/v2/bin/update_logbook.py
  3. 30 0
      application/API/v2/bin/upload_profile.py
  4. 77 0
      application/API/v2/update_logbook.php
  5. 108 2
      application/Constant.php
  6. 5 0
      application/Controller.php
  7. 45 0
      application/action/delete_team.php
  8. 2 2
      application/action/new_team.php
  9. 2 1
      application/config.php
  10. 2 2
      application/entity/K_Area.php
  11. 18 2
      application/entity/K_Unit.php
  12. 429 0
      application/entity/Player.php
  13. 146 0
      application/entity/Record.php
  14. 257 43
      application/entity/Unit.php
  15. 88 2
      application/helper/HTML_Helper.php
  16. 6 263
      application/page/Home_Page.php
  17. 0 71
      application/page/Monster_Page.php
  18. 5 74
      application/page/Monsters_Page.php
  19. 31 9
      application/page/Report_Skillup_Page.php
  20. BIN=BIN
      application/sw.sqlite
  21. 14 14
      application/view/guild.php
  22. 422 177
      application/view/home.php
  23. 4 4
      application/view/inc/filter_monsters.php
  24. 123 41
      application/view/monster.php
  25. 110 35
      application/view/monsters.php
  26. 1 1
      application/view/runs.php
  27. 51 0
      application/view/teams.php
  28. 17492 23090
      install_data/install_base.sql
  29. 34 0
      install_data/install_data.sql
  30. 0 4
      public/css/fusion.css
  31. 149 39
      public/css/home.css
  32. 8 1
      public/css/monster.css
  33. 11 0
      public/css/monsters.css
  34. 17 0
      public/css/teams.css
  35. 10 3
      public/css/ui.css
  36. BIN=BIN
      public/img/icon/edit.png
  37. 0 0
      public/img/rank/0901.png
  38. 0 0
      public/img/rank/1001.png
  39. 0 0
      public/img/rank/1002.png
  40. 0 0
      public/img/rank/1003.png
  41. 0 0
      public/img/rank/2001.png
  42. 0 0
      public/img/rank/2002.png
  43. 0 0
      public/img/rank/2003.png
  44. 0 0
      public/img/rank/3001.png
  45. 0 0
      public/img/rank/3002.png
  46. 0 0
      public/img/rank/3003.png
  47. 0 0
      public/img/rank/4001.png
  48. 0 0
      public/img/rank/4002.png
  49. 0 0
      public/img/rank/4003.png
  50. 0 0
      public/img/rank/5001.png
  51. BIN=BIN
      public/img/skill/00003217.png
  52. BIN=BIN
      public/img/skill/00003218.png
  53. BIN=BIN
      public/img/skill/00013716.png
  54. BIN=BIN
      public/img/skill/00013901.png
  55. BIN=BIN
      public/img/skill/00013902.png
  56. BIN=BIN
      public/img/skill/00013903.png
  57. BIN=BIN
      public/img/skill/00013904.png
  58. BIN=BIN
      public/img/skill/00013905.png
  59. BIN=BIN
      public/img/skill/00013906.png
  60. BIN=BIN
      public/img/skill/00013907.png
  61. BIN=BIN
      public/img/skill/00013908.png
  62. BIN=BIN
      public/img/skill/00013909.png
  63. BIN=BIN
      public/img/skill/00013910.png
  64. BIN=BIN
      public/img/skill/00013911.png
  65. BIN=BIN
      public/img/skill/00013912.png
  66. BIN=BIN
      public/img/skill/00013913.png
  67. BIN=BIN
      public/img/skill/00013914.png
  68. BIN=BIN
      public/img/skill/00013915.png
  69. BIN=BIN
      public/img/skill/00013916.png
  70. BIN=BIN
      public/img/skill/00013917.png
  71. BIN=BIN
      public/img/skill/00013918.png
  72. BIN=BIN
      public/img/skill/00013919.png
  73. BIN=BIN
      public/img/skill/00014002.png
  74. BIN=BIN
      public/img/skill/00014007.png
  75. BIN=BIN
      public/img/skill/00014012.png
  76. BIN=BIN
      public/img/skill/00014101.png
  77. BIN=BIN
      public/img/skill/00014102.png
  78. BIN=BIN
      public/img/skill/00014103.png
  79. BIN=BIN
      public/img/skill/00014104.png
  80. BIN=BIN
      public/img/skill/00014105.png
  81. BIN=BIN
      public/img/skill/00014106.png
  82. BIN=BIN
      public/img/skill/00014107.png
  83. BIN=BIN
      public/img/skill/00014108.png
  84. BIN=BIN
      public/img/skill/00014109.png
  85. BIN=BIN
      public/img/skill/00014110.png
  86. BIN=BIN
      public/img/skill/00014111.png
  87. BIN=BIN
      public/img/skill/00014112.png
  88. BIN=BIN
      public/img/skill/00014113.png
  89. BIN=BIN
      public/img/skill/00014114.png
  90. BIN=BIN
      public/img/skill/00014115.png
  91. BIN=BIN
      public/img/skill/00014116.png
  92. BIN=BIN
      public/img/skill/00014201.png
  93. BIN=BIN
      public/img/skill/00014202.png
  94. BIN=BIN
      public/img/skill/00014203.png
  95. BIN=BIN
      public/img/skill/00014204.png
  96. BIN=BIN
      public/img/skill/00014205.png
  97. BIN=BIN
      public/img/skill/00014206.png
  98. BIN=BIN
      public/img/skill/00014207.png
  99. BIN=BIN
      public/img/skill/00014208.png
  100. BIN=BIN
      public/img/skill/00014209.png

+ 3 - 0
application/API/v2/API_Controller.php

@@ -56,6 +56,9 @@
                     case "upload_run_rift":
                         require_once(__DIR__ . "/upload_run_rift.php");
                         break;
+                    case "update_logbook":
+                        require_once(__DIR__ . "/update_logbook.php");
+                        break;
                     case "units":
                         require_once(__DIR__ . "/units.php");
                         break;

+ 283 - 0
application/API/v2/bin/update_logbook.py

@@ -0,0 +1,283 @@
+#!/usr/bin/python3
+
+import sqlite3
+import json
+import sys
+import os
+
+
+"""
+Reads the API KEY, that must be passed as first command line argument.
+
+:returns: Recovered API KEY.
+:raises Exception: Th KEY couldn't be red.
+"""
+def readKey():
+    try:
+        #print(sys.argv[0])
+        key = sys.argv[1]
+        return key
+    except Exception as e:
+        print("Error parsing API KEY: " + str(e))
+        raise
+
+"""
+Reads the JSON data, that must be passed as second command line argument.
+
+:returns: Recovered data, in JSON format.
+:raises Exception: The data couldn't be red or converted to JSON.
+"""
+def readData():
+    try:
+        data = json.loads(sys.argv[2])
+        return data
+    except Exception as e:
+        print("Error parsing data: " + str(e))
+        raise
+
+"""
+Verifies that the API key matches the player data and that it exists in th DB.
+
+:param db: Connection to the database.
+:returns: Connection to the database.
+:param data: Data in json format.
+:param key: API KEY.
+:returns: True if key and player match, False otherwise.
+:raises IntegrityError: The queryes couldn't bre executed.
+"""
+def verifyKey(db, data, key):
+    print('Verifying KEY...')
+    status = False
+    try:
+        uid = data["lobby_wizard_log"]["wizard_id"]
+        cursor = db.cursor()
+        cursor.execute('SELECT count(uid) AS c FROM player WHERE uid = ? AND api_key = ?;', (uid, key))
+        if cursor.fetchone()[0] == 1:
+            status = True
+        cursor.close()
+    except sqlite3.IntegrityError as e:
+        print("Error executing statement: " + str(e))
+        raise
+    return status
+
+"""
+Opens the database file and deletes from the user tables
+
+:param name: The path to the sqlite database.
+:returns: Connection to the database.
+:raises IntegrityError: The queryes couldn't bre executed.
+:raises IOError: The sqlite file couldn't be created.
+"""
+def openDatabase():
+    kdb = os.path.dirname(os.path.realpath(sys.argv[0])) + '/../../../sw.sqlite'
+    udb = os.path.dirname(os.path.realpath(sys.argv[0])) + '/../../../../data/sw.sqlite'
+    print('Configuring database...')
+    try:
+        db = sqlite3.connect(kdb)
+        cursor = db.cursor()
+        cursor.execute('attach "' + udb + '" as data;')
+        cursor.close()
+        return db
+    except sqlite3.IntegrityError as e:
+        print("Error executing statement: " + str(e))
+        raise
+    except IOError as e:
+        print("I/O Error creating database " + name + ": " + str(e))
+        raise
+
+"""
+Inserts a row into the database.
+
+:param db: Connection to the database.
+:param table: Name of the table to insert into.
+:param values: List of values to insert.
+:raises IntegrityError: The insert query was unsuccesfull.
+"""
+def insert(db, table, values):
+    cursor = db.cursor()
+    placeholders = ''
+    for x in range(0, len(values)):
+        placeholders = placeholders + '?, '
+    placeholders = placeholders[:len(placeholders) - 2]
+    query = 'INSERT INTO ' + table + ' VALUES (' + placeholders + ')'
+    try:
+        cursor.execute(query, values)
+    except sqlite3.IntegrityError as e:
+        print('Error Inserting into ' + table + ' with values (' + str(values) + '): ' + str(e))
+        raise
+    cursor.close;
+
+"""
+Parses run data (tables run, run_party, run_drop_rune, run_drop_runecraft,
+run_drop_item, run_drop_unit, run_drop_sd, run_drop_unit_pieces,
+run_drop_shapeshifting).
+
+:param db: Sqlite database connection.
+:param data: JSON data.
+"""
+def parseData(db, data):
+
+    cursor = db.cursor()
+
+    # Page 1: Cairos non-elemental, rift raid, rift dungeon.
+    if (data["lobby_wizard_log"]["page_no"] == 1):
+        print("Parsing logbook data...")
+        
+        uid = data["lobby_wizard_log"]["wizard_id"]
+        joined = data["lobby_wizard_log"]["account_create_timestamp"]
+        top_rank_arena = data["lobby_wizard_log"]["pvp_best_rating_id"]
+        top_rank_world_arena = data["lobby_wizard_log"]["rtpvp_rank_best_rating_id"]
+        top_rank_special_league = data["lobby_wizard_log"]["rtpvp_contest_best_rating_id"]
+        top_rank_gw = data["lobby_wizard_log"]["guildwar_best_rating_id"]
+        top_rank_siege = data["lobby_wizard_log"]["guildsiege_best_rating_id"]
+        top_rank_wboss = data["lobby_wizard_log"]["world_boss_best_rank_id"]
+        top_rank_toan = data["lobby_wizard_log"]["trial_tower_normal_best_floor"]
+        top_rank_toah = data["lobby_wizard_log"]["trial_tower_hard_best_floor"]
+        cursor.execute("""
+            UPDATE player SET 
+              joined = ?,
+              top_rank_arena = ?,
+              top_rank_world_arena = ?,
+              top_rank_special_league = ?,
+              top_rank_gw = ?,
+              top_rank_siege = ?,
+              top_rank_wboss = ?,
+              top_rank_toan = ?,
+              top_rank_toah = ?
+            WHERE uid = ?;
+            """,
+            (
+                joined,
+                top_rank_arena,
+                top_rank_world_arena,
+                top_rank_special_league,
+                top_rank_gw,
+                top_rank_siege,
+                top_rank_wboss,
+                top_rank_toan,
+                top_rank_toah,
+                uid,
+            )
+        )
+
+        # Loop Cairos records
+        for record in data["lobby_wizard_log"]["dungeon_best_clear_info_list"]:
+            area_type = 2 # Cairos Dungeons
+            area = record["dungeon_id"]
+            stage = record["stage_id"]
+            time = record["clear_time"]
+            score = 0 # No scores in Cairos
+            rank = None # No rank in Cairos
+            cursor.execute("DELETE FROM record_party WHERE uid = ? AND area_type = ? AND area = ?;", (uid, area_type, area))
+            cursor.execute("DELETE FROM record WHERE uid = ? AND area_type = ? AND area = ?;", (uid, area_type, area))
+            insert(db, "record", (uid, area_type, area, stage, time, score, rank))
+            for party in record["my_unit_deck_list"]:
+                unit_id = party["unit_id"]
+                unit_master_id = party["unit_master_id"]
+                leader = party["leader"]
+                front = 0 # No frontline in Cairos
+                insert(db, "record_party", (uid, area_type, area, unit_id, unit_master_id, leader, front))
+
+        # Rift Raid record
+        if data["lobby_wizard_log"]["raid_best_clear_info_list"][0]:
+            area_type = 4
+            stage = data["lobby_wizard_log"]["raid_best_clear_info_list"][0]["stage_id"]
+            area = stage
+            time = data["lobby_wizard_log"]["raid_best_clear_info_list"][0]["clear_time"]
+            score = 0 # No scores in Rift Raid
+            rank = None # No rank in Rift Raid
+            cursor.execute("DELETE FROM record_party WHERE uid = ? AND area_type = ? AND area = ?;", (uid, area_type, area))
+            cursor.execute("DELETE FROM record WHERE uid = ? AND area_type = ? AND area = ?;", (uid, area_type, area))
+            insert(db, "record", (uid, area_type, area, stage, time, score, rank))
+            for party in data["lobby_wizard_log"]["raid_best_clear_info_list"][0]["my_unit_deck_list"]:
+                unit_id = party["unit_id"]
+                unit_master_id = party["unit_master_id"]
+                leader = party["leader"]
+                if party["slot_index"] <= 4:
+                    front = 1
+                else:
+                    front = 0
+                insert(db, "record_party", (uid, area_type, area, unit_id, unit_master_id, leader, front))
+
+        # Loop Rift Dungeon records
+        for record in data["lobby_wizard_log"]["rift_dungeon_best_clear_info_list"]:
+            area_type = 3 # Rift Elemental Dungeons
+            area = record["rift_dungeon_id"]
+            stage = 0 # No stage in Rift Dungeons
+            time = 0 # No time in Rift Dungeons
+            score = record["clear_damage"]
+            raw_rank = raw_rank = record["clear_rating"]
+            if raw_rank == 2:
+                rank = "D"
+            elif raw_rank == 3:
+                rank = "C"
+            elif raw_rank == 4:
+                rank = "B-"
+            elif raw_rank == 5:
+                rank = "B"
+            elif raw_rank == 6:
+                rank = "B+"
+            elif raw_rank == 7:
+                rank = "A-"
+            elif raw_rank == 8:
+                rank = "A"
+            elif raw_rank == 9:
+                rank = "A+"
+            elif raw_rank == 90:
+                rank = "S"
+            elif raw_rank == 11:
+                rank = "SS"
+            elif raw_rank == 12:
+                rank = "SSS"
+            else:
+                rank = None
+            cursor.execute("DELETE FROM record_party WHERE uid = ? AND area_type = ? AND area = ?;", (uid, area_type, area))
+            cursor.execute("DELETE FROM record WHERE uid = ? AND area_type = ? AND area = ?;", (uid, area_type, area))
+            insert(db, "record", (uid, area_type, area, stage, time, score, rank))
+            for party in record["my_unit_deck_list"]:
+                unit_id = party["unit_id"]
+                unit_master_id = party["unit_master_id"]
+                leader = party["leader"]
+                if party["slot_index"] <= 4:
+                    front = 1
+                else:
+                    front = 0
+                insert(db, "record_party", (uid, area_type, area, unit_id, unit_master_id, leader, front))
+        db.commit()
+
+    # Page 2: Cairos non-elemental, rift raid, rift dungeon.
+    elif (data["lobby_wizard_log"]["page_no"] == 2):
+        uid = data["lobby_wizard_log"]["wizard_id"]
+        # Loop Cairos records
+        for record in data["lobby_wizard_log"]["dungeon_best_clear_info_list"]:
+            area_type = 2 # Cairos Dungeons
+            area = record["dungeon_id"]
+            stage = record["stage_id"]
+            time = record["clear_time"]
+            score = 0 # No scores in Cairos
+            rank = None # No rank in Cairos
+            cursor.execute("DELETE FROM record_party WHERE uid = ? AND area_type = ? AND area = ?;", (uid, area_type, area))
+            cursor.execute("DELETE FROM record WHERE uid = ? AND area_type = ? AND area = ?;", (uid, area_type, area))
+            insert(db, "record", (uid, area_type, area, stage, time, score, rank))
+            for party in record["my_unit_deck_list"]:
+                unit_id = party["unit_id"]
+                unit_master_id = party["unit_master_id"]
+                leader = party["leader"]
+                front = 0 # No frontline in Cairos
+                insert(db, "record_party", (uid, area_type, area, unit_id, unit_master_id, leader, front))
+        db.commit()
+
+"""
+Begin script
+"""
+data = readData()
+key = readKey()
+db = openDatabase()
+if verifyKey(db, data, key) == False:
+    print("Invalid API KEY...")
+    sys.exit(-1)
+else:
+    parseData(db, data)
+sys.exit(0)
+
+

+ 30 - 0
application/API/v2/bin/upload_profile.py

@@ -107,6 +107,7 @@ def clearData(db, data):
         cursor.execute('PRAGMA foreign_keys = OFF;')
         cursor.execute('DELETE FROM scenario WHERE uid = ?', [uid])
         cursor.execute('DELETE FROM defense WHERE uid = ?', [uid])
+        cursor.execute('DELETE FROM gw_defense WHERE uid = ?', [uid])
         cursor.execute('DELETE FROM unit_skill WHERE unit IN (SELECT id FROM unit WHERE uid = ?)', [uid])
         cursor.execute('DELETE FROM unit WHERE uid = ?', [uid])
         cursor.execute('DELETE FROM rune WHERE uid = ?', [uid])
@@ -296,6 +297,30 @@ def parseDefense(db, data):
         insert(db, "defense", (uid, unit, position))
     db.commit()
 
+"""
+Parses guild war defense units (table gw_defense).
+
+:param db: Sqlite database connection.
+:param data: Data in json format.
+"""
+def parseGWDefense(db, data):
+    print("Parsing guild war defense...")
+    uid = data["wizard_info"]["wizard_id"]
+    if data["guildwar_defense_unit_list"][0]:
+        position = 1
+        for defense in data["guildwar_defense_unit_list"][0]:
+            unit = defense["unit_id"]
+            insert(db, "gw_defense", (uid, unit, position))
+            position = position + 1
+    if data["guildwar_defense_unit_list"][1]:
+        position = 4
+        for defense in data["guildwar_defense_unit_list"][1]:
+            unit = defense["unit_id"]
+            insert(db, "gw_defense", (uid, unit, position))
+            position = position + 1
+        
+    db.commit()
+
 """
 Parses buildings (table building).
 
@@ -1248,6 +1273,11 @@ else:
     except Exception as e:
         print("Error parsing defense data: " + str(e))
         sys.exit(400)
+    try:
+        parseGWDefense(db, data)
+    except Exception as e:
+        print("Error parsing guild war defense data: " + str(e))
+        sys.exit(400)
     try:
         parseBuildings(db, data)
     except Exception as e:

+ 77 - 0
application/API/v2/update_logbook.php

@@ -0,0 +1,77 @@
+<?php
+    /**
+     * Logbook logger script.
+     *
+     * Exposes an API to update the logbook for player data and records.
+     * Reads post data and calls the update_logbook.py script.
+     * Mandatory POST parameters are:
+     *  - data: Received JSON file after a run.
+     *  - key: User API key.
+     *
+     * @category API
+     */
+
+    global $db;
+
+    try{
+        // Check data
+        $data = filter_input(INPUT_POST, 'response');
+        if ($data == null || $data == false){
+            http_response_code(400);
+            return 400;
+        }
+        // Check API key.
+        $key = filter_input(INPUT_POST, 'key');
+        if ($key == null || $key == false){
+            http_response_code(401);
+            return 401;
+        }
+        // Check data format.
+        $json = json_decode($data);
+        if ($json === null){
+            http_response_code(400);
+            return 400;
+        }
+        // Authenticate
+        $uid = $json->{"lobby_wizard_log"}->{"wizard_id"};
+        $s = "SELECT COUNT(uid) AS c FROM player WHERE uid = $uid AND api_key = '$key';";
+        if (1 != $db->query($s)->fetchArray(SQLITE3_ASSOC)["c"]){
+            http_response_code(401);
+            return 401;
+        }
+
+        // Run scenario run parser script
+        $cmd = __DIR__ . "/bin/update_logbook.py " . $key . " " . escapeshellarg($data);;
+        $out = [];
+        $ret = 0;
+        try{
+            exec($cmd, $out, $ret);
+        }
+        catch(Exception $e) {
+            error_log("Error running scenario run script '$cmd': " . $e->getMessage());
+            http_response_code(500);
+            return 500;
+        }
+
+        if ($ret != 200){
+            try{
+                http_response_code($ret);
+                return $ret;
+            }
+            catch(Exception $e) {
+                error_log("Dungeon run script '$cmd' returned an unexpected value $ret: " . $e->getMessage());
+                http_response_code(500);
+                return 500;
+            }
+        }
+
+        // At this point, status code should be 200
+        http_response_code($ret);
+        return $ret;
+    }
+    catch(Exception $e) {
+        error_log("Unknown error parsing scenario run: " . $e->getMessage());
+        http_response_code(500);
+        return 500;
+    }
+?>

+ 108 - 2
application/Constant.php

@@ -500,7 +500,7 @@
         /**
          * Steel Fortress
          */
-        const STEEL_FORTRESS = 9602; // TODO: Find out
+        const STEEL_FORTRESS = 9501;
 
         /**
          * Hall of Light.
@@ -3053,6 +3053,112 @@
         const LEGEND = 1;
     };
 
+    /**
+     * Arena rank constant.
+     *
+     * @category Data
+     */
+    final class ARENA_RANK_ID{
+
+        /**
+         * Beginer.
+         */
+        const BEGINER = 901;
+
+        /**
+         * Challenger 1.
+         */
+        const CHALLENGER_1 = 1001;
+
+        /**
+         * Challenger 2.
+         */
+        const CHALLENGER_2 = 1002;
+
+        /**
+         * Challenger 3.
+         */
+        const CHALLENGER_3 = 1003;
+
+        /**
+         * Fighter 1.
+         */
+        const FIGHTER_1 = 2001;
+
+        /**
+         * Fighter 2.
+         */
+        const FIGHTER_2 = 2002;
+
+        /**
+         * Fighter 3.
+         */
+        const FIGHTER_3 = 2003;
+
+        /**
+         * Conqueror 1.
+         */
+        const CONQUEROR_1 = 3001;
+
+        /**
+         * Conqueror 2.
+         */
+        const CONQUEROR_2 = 3002;
+
+        /**
+         * Conqueror 3.
+         */
+        const CONQUEROR_3 = 3003;
+
+        /**
+         * Guardian 1.
+         */
+        const GUARDIAN_1 = 4001;
+
+        /**
+         * Guardian 2.
+         */
+        const GUARDIAN_2 = 4002;
+
+        /**
+         * Guardian 3.
+         */
+        const GUARDIAN_3 = 40003;
+
+        /**
+         * Legend.
+         */
+        const LEGEND = 5001;
+    }
+
+    /**
+     * World Boss rank constant.
+     *
+     * @category Data
+     */
+    final class WORLD_BOSS_RANK_ID{
+
+        /**
+         * Beginer.
+         */
+        const RANK = [
+            0 => "F",
+            1 => "D",
+            2 => "C",
+            3 => "B-",
+            4 => "B",
+            5 => "B+",
+            6 => "A-",
+            7 => "A",
+            8 => "A+",
+            9 => "S",
+            10 => "SS",
+            11 => "SSS"
+        ];
+
+        
+    }
+
     /**
      * Default filter values;
      * 
@@ -3081,7 +3187,7 @@
          * Default values for the monster filters.
          */
         const MONSTER = [
-            "ELEMENT" => 0,
+            "ELEMENT" => -1,
             "NAME" => "",
             "MIN_STARS" => 1,
             "MAX_STARS" => 6,

+ 5 - 0
application/Controller.php

@@ -110,6 +110,11 @@
                         action();
                         return;
                         break;
+                    case "DELETE_TEAM":
+                        require_once(PATH::ACTION . "delete_team.php");
+                        action();
+                        return;
+                        break;
                     case "SAVE_RUN_TEAM":
                         require_once(PATH::ACTION . "save_run_team.php");
                         action();

+ 45 - 0
application/action/delete_team.php

@@ -0,0 +1,45 @@
+<?php
+
+    /**
+     * File for the team creation action.
+     *
+     * Implements an action function to be called from the {@see Controller}.
+     * 
+     * @category Action
+     */
+
+    /**
+     * Logs the user out and redirects to the login page.
+     *
+     * 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.
+     * 
+     * @return int 0 on success, negative values on error.
+     * @category Action
+     * @global resource Database connection.
+     */
+    function action(){
+
+        global $db;
+
+        $player = filter_input(INPUT_POST, 'uid');
+        $id = filter_input(INPUT_POST, 'id');
+        $statement = $db->prepare('DELETE FROM team WHERE uid = :uid AND id = :id;');
+        $statement->bindValue(':uid', $player);
+        $statement->bindValue(':id', $id);
+        $res = $statement->execute();
+        $statement = $db->prepare('DELETE FROM team_unit WHERE team = :id;');
+        $statement->bindValue(':uid', $player);
+        $statement->bindValue(':id', $id);
+        $res = $statement->execute();
+        return 0;
+    }
+?>

+ 2 - 2
application/action/new_team.php

@@ -68,10 +68,10 @@
                 if ($stage < 0){
                     return -35;
                 }
-                if ($stage > 12 && ($stage == DUNGEON_ID::GIANTS_KEEP || $stage == DUNGEON_ID::DRAGONS_LAIR || $stage == DUNGEON_ID::NECROPOLIS)){
+                if ($stage > 12 && (DUNGEON_ID::GIANTS_KEEP == $area || DUNGEON_ID::DRAGONS_LAIR == $area || DUNGEON_ID::NECROPOLIS == $area)){
                     return -35;
                 }
-                if ($stage > 10 && $stage =! DUNGEON_ID::GIANTS_KEEP && $stage =! DUNGEON_ID::DRAGONS_LAIR && $stage != DUNGEON_ID::NECROPOLIS){
+                if ($stage > 10 && ($area != DUNGEON_ID::GIANTS_KEEP && $area != DUNGEON_ID::DRAGONS_LAIR && $area != DUNGEON_ID::NECROPOLIS)){
                     return -35;
                 }
                 $difficulty = null;

+ 2 - 1
application/config.php

@@ -26,7 +26,7 @@
          *
          * Can be any string, not just numbers.
          */
-        const VERSION = "3.0.0";
+        const VERSION = "3.1.0";
     }
 
     /**
@@ -60,6 +60,7 @@
             "ICON" => BASE_URL . "img/icon/",
             "LOGO" => BASE_URL . "img/logo/",
             "CURRENCY" => BASE_URL . "img/currency/",
+            "RANK" => BASE_URL . "img/rank/",
             "UNIT" => BASE_URL . "img/unit/",
             "AREA" => BASE_URL . "img/area/",
             "SKILL" => BASE_URL . "img/skill/",

+ 2 - 2
application/entity/K_Area.php

@@ -110,10 +110,10 @@
                         return APPLICATION::img("UNIT", 62105);
                         break;
                     case DUNGEON_ID::STEEL_FORTRESS:
-                        return APPLICATION::img("UNIT", 62105); // TODO: Correct image.
+                        return APPLICATION::img("UNIT", 62403);
                         break;
                     case DUNGEON_ID::PUNISHERS_CRYPT:
-                        return APPLICATION::img("UNIT", 62105); // TODO: Correct image.
+                        return APPLICATION::img("UNIT", 62604);
                         break;
                     case DUNGEON_ID::HALL_OF_WATER:
                         return APPLICATION::img("UNIT", 60101);

+ 18 - 2
application/entity/K_Unit.php

@@ -348,9 +348,25 @@
                 $this->load_sources();
                 $this->load_transformation();
             }
-            // No to, no from. Silver unit.
+            // Guess monster name
             if ($this->awakens_from == "" && $this->awakens_to == ""){
-                $this->title = $this->element_name . " " . $this->name;
+                // No to, no from. Silver unit.
+                if ($this->base_stars >= 4){
+                    // SFV Collab event units, always awakened.
+                    $this->title = $this->name;
+                }
+                elseif($this->archetype == ARCHETYPE_ID::MATERIAL && $this->element == ELEMENT_ID::LIGHT){
+                    // Rainbowmon, always awakened
+                    $this->title = $this->name;
+                }
+                elseif($this->archetype == ARCHETYPE_ID::MATERIAL && $this->element == ELEMENT_ID::DARK){
+                    // Devilmon, always unawakened, but dont include element
+                    $this->title = $this->name;
+                }
+                else{
+                    // Unawakeable monster
+                    $this->title = $this->element_name . " " . $this->name;
+                }
             }
             // Awakened
             elseif ($this->awakens_from != ""){

+ 429 - 0
application/entity/Player.php

@@ -0,0 +1,429 @@
+<?php
+    /**
+     * Player entity file.
+     *
+     * Creates the entity and makes it available.
+     *
+     * @category Entity
+     */
+
+    /**
+     * Require dependent entities if not present.
+     */
+    require_once(PATH::ENTITY . "Entity.php");
+    require_once(PATH::ENTITY . "Unit.php");
+    require_once(PATH::ENTITY . "Building.php");
+    require_once(PATH::ENTITY . "Decoration.php");
+    require_once(PATH::ENTITY . "Inventory.php");
+    require_once(PATH::ENTITY . "Record.php");
+
+    /**
+     * A Unit.
+     *
+     * Represents an object from the table 'unit'.
+     *
+     * @category Entity
+     */
+    class Player extends Entity{
+
+        /**
+         * @var int Player ID.
+         */
+        public $uid;
+
+        /**
+         * @var int Player level.
+         */
+        public $level;
+
+        /**
+         * @var string Player name.
+         */
+        public $name;
+
+        /**
+         * @var string Player country (XX).
+         */
+        public $country;
+
+        /**
+         * @var int Total experience.
+         */
+        public $experience;
+
+        /**
+         * @var Unit Representative Unit.
+         */
+        public $rep;
+
+        /**
+         * @var int Timestamp of player registration.
+         */
+        public $joined = 0;
+
+        /**
+         * @var int Top rank in arena.
+         */
+        public $top_rank_arena = 0;
+
+        /**
+         * @var int Top rank in world arena.
+         */
+        public $top_rank_world_arena = 0;
+
+        /**
+         * @var int Top rank in special league.
+         */
+        public $top_rank_special_league = 0;
+
+        /**
+         * @var int Top rank in guild war.
+         */
+        public $top_rank_gw = 0;
+
+        /**
+         * @var int Top rank in guild siege.
+         */
+        public $top_rank_siege = 0;
+
+        /**
+         * @var int Top rank in World Boss.
+         */
+        public $top_rank_wboss = 0;
+
+        /**
+         * @var int Top rank in TOA normal.
+         */
+        public $top_rank_toan = 0;
+
+        /**
+         * @var int Top rank in TOA HARD.
+         */
+        public $top_rank_toah = 0;
+
+        /**
+         * @var \Unit[] Units in Arena defense.
+         */
+        public $defense = [];
+
+        /**
+         * @var \Unit[] Units in Arena defense.
+         */
+        public $gw_defense = [[], []];
+
+        /**
+         * @var int[] Currency.
+         */
+        public $currency = [
+            "mana" => 0,
+            "crystal" => 0,
+            "energy" => 0,
+            "energy_max" => 0,
+            "arena_energy" => 0,
+            "arena_energy_max" => 0,
+            "darkportal_energy" => 0,
+            "darkportal_energy_max" => 0,
+            "dimension_energy" => 0,
+            "dimension_energy_max" => 0,
+            "honor_point" => 0,
+            "guild_point" => 0,
+            "honor_medal" => 0,
+            "honor_mark" => 0,
+            "event_coin" => 0,
+            "social_point" => 0,
+            "ancient_stone" => 0,
+            "costume_point" => 0,
+        ];
+
+        /**
+         * @var \Building[] List of Buildings.
+         */
+        public $building = [];
+
+        /**
+         * @var \Decoration[] List of Decorations.
+         */
+        public $decoration = [];
+
+        /**
+         * @var \Inventory[] List of Scrolls in Inventory.
+         */
+        public $inventory_scroll = [];
+
+        /**
+         * @var \Inventory[] List of rune crafting items in Inventory.
+         */
+        public $inventory_craft_rune = [];
+
+        /**
+         * @var \Inventory[] List of rune crafting items in Inventory.
+         */
+        public $inventory_craft = [];
+
+        /**
+         * @var \Inventory[] List of rune crafting items in Inventory.
+         */
+        public $inventory_essence = [];
+
+        /**
+         * @var \Record[] Player record runs.
+         */
+        public $record = [];
+
+
+        /**
+         * Constructor.
+         *
+         * Searches the database and retrieves the information about the
+         * player, populating it and it's items.
+         *
+         * @param int $id Monster identifier.
+         * @param bool $complete If false, query only monster and k_monster.
+         * @global int Player ID.
+         * @global resource Database connection.
+         */
+        public function __construct($id, $complete = true){
+            global $UID;
+            global $db;
+            $s = "
+              SELECT
+                uid,
+                name,
+                level,
+                country,
+                experience,
+                rep,
+                mana,
+                crystal,
+                energy,
+                energy_max,
+                arena_energy,
+                arena_energy_max,
+                darkportal_energy,
+                darkportal_energy_max,
+                dimension_energy,
+                dimension_energy_max,
+                honor_point,
+                guild_point,
+                honor_medal,
+                honor_mark,
+                event_coin,
+                social_point,
+                costume_point,
+                joined,
+                top_rank_arena,
+                top_rank_world_arena,
+                top_rank_special_league,
+                top_rank_gw,
+                top_rank_siege,
+                top_rank_wboss,
+                top_rank_toan,
+                top_rank_toah
+              FROM player
+              WHERE uid = '$UID';
+            ";
+            $q = $db->query($s);
+            $r = $q->fetchArray(SQLITE3_ASSOC);
+            if ($r){
+                $this->uid = $r["uid"];
+                $this->name = $r["name"];
+                $this->level = $r["level"];
+                $this->country = $r["country"];
+                $this->experience = $r["experience"];
+                if (strlen($r["rep"]) > 0){
+                    $this->rep = new Unit($r["rep"]);
+                }
+                $this->currency["mana"] = $r["mana"];
+                $this->currency["crystal"] = $r["crystal"];
+                $this->currency["energy"] = $r["energy"];
+                $this->currency["energy_max"] = $r["energy_max"];
+                $this->currency["arena_energy"] = $r["arena_energy"];
+                $this->currency["arena_energy_max"] = $r["arena_energy_max"];
+                $this->currency["darkportal_energy"] = $r["darkportal_energy"];
+                $this->currency["darkportal_energy_max"] = $r["darkportal_energy_max"];
+                $this->currency["dimension_energy"] = $r["dimension_energy"];
+                $this->currency["dimension_energy_max"] = $r["dimension_energy_max"];
+                $this->currency["honor_point"] = $r["honor_point"];
+                $this->currency["guild_point"] = $r["guild_point"];
+                $this->currency["honor_medal"] = $r["honor_medal"];
+                $this->currency["honor_mark"] = $r["honor_mark"];
+                $this->currency["event_coin"] = $r["event_coin"];
+                $this->currency["social_point"] = $r["social_point"];
+                $this->currency["costume_point"] = $r["costume_point"];
+                $this->joined = $r["joined"];
+                $this->top_rank_arena = $r["top_rank_arena"];
+                $this->top_rank_world_arena = $r["top_rank_world_arena"];
+                $this->top_rank_special_league = $r["top_rank_special_league"];
+                $this->top_rank_gw = $r["top_rank_gw"];
+                $this->top_rank_siege = $r["top_rank_siege"];
+                $this->top_rank_wboss = $r["top_rank_wboss"];
+                $this->top_rank_toan = $r["top_rank_toan"];
+                $this->top_rank_toah = $r["top_rank_toah"];
+            }
+            $s = "
+                SELECT unit
+                FROM defense
+                WHERE uid = '$UID'
+                ORDER BY position;
+            ";
+            $q = $db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->defense, new Unit($r["unit"], false));
+            }
+            $s = "
+                SELECT
+                  unit,
+                  position
+                FROM gw_defense
+                WHERE uid = '$UID'
+                ORDER BY position;
+            ";
+            $q = $db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                if ($r["position"] <= 3){
+                    array_push($this->gw_defense[0], new Unit($r["unit"], false));
+                }
+                else{
+                    array_push($this->gw_defense[1], new Unit($r["unit"], false));
+                }
+            }
+            $s = "
+                SELECT
+                  building.id,
+                  min(building)
+                FROM
+                  building,
+                  k_building
+                WHERE
+                  uid = '$UID' AND
+                  building.building = k_building.id 
+                GROUP BY building.building;
+            ";
+            $q = $db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->building, new Building($r["id"]));
+            }
+            $s = "
+                SELECT id
+                FROM decoration
+                WHERE uid = '$UID';
+            ";
+            $q = $db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->decoration, new Decoration($r["id"]));
+            }
+            $s = "
+                SELECT
+                  id,
+                  type
+                FROM inventory
+                WHERE
+                  uid = '$UID' AND
+                  type = " . INVENTORY_TYPE_ID::SCROLL . " AND
+                  amount > 0
+                ORDER BY inventory.type;
+            ";
+            $q = $db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->inventory_scroll, new Inventory($r["id"], $r["type"]));
+            }
+            // Rune crafting items are marked as generic crafting.
+            $s = "
+                SELECT
+                  inventory.id AS id,
+                  inventory.type AS type
+                FROM
+                  inventory
+                WHERE
+                  inventory.uid = '$UID' AND
+                  inventory.type = " . INVENTORY_TYPE_ID::RUNE_CRAFT . " AND
+                  amount > 0
+                ORDER BY inventory.id;
+            ";
+            $q = $db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->inventory_craft_rune, new Inventory($r["id"], $r["type"]));
+            }
+            $s = "
+                SELECT
+                  inventory.id AS id,
+                  inventory.type AS type
+                FROM
+                  inventory
+                WHERE
+                  inventory.uid = '$UID' AND
+                  inventory.type = " . INVENTORY_TYPE_ID::CRAFT_STUFF . " AND
+                  amount > 0
+                ORDER BY inventory.id;
+            ";
+            $q = $db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->inventory_craft, new Inventory($r["id"], $r["type"]));
+            }
+            $s = "
+                SELECT
+                  inventory.id AS id,
+                  inventory.type AS type
+                FROM
+                  inventory,
+                  k_inventory
+                WHERE
+                  inventory.id = k_inventory.id AND
+                  inventory.type = k_inventory.type AND
+                  inventory.uid = '$UID' AND
+                  inventory.type = " . INVENTORY_TYPE_ID::ESSENCES . " AND
+                  amount > 0
+                ORDER BY
+                  upper(name) NOT LIKE '%MAGIC%',
+                  upper(name) NOT LIKE '%FIRE%',
+                  upper(name) NOT LIKE '%WATER%',
+                  upper(name) NOT LIKE '%WIND%',
+                  upper(name) NOT LIKE '%LIGHT%',
+                  upper(name) NOT LIKE '%DARK%',
+                  upper(name) NOT LIKE '%LOW%',
+                  upper(name) NOT LIKE '%MID%',
+                  upper(name) NOT LIKE '%HIGH%'
+                ;
+            ";
+            $q = $db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->inventory_essence, new Inventory($r["id"], $r["type"]));
+            }
+            $s = "
+                SELECT
+                  uid,
+                  area_type,
+                  area
+                FROM record
+                WHERE uid = '$UID'
+                ORDER BY
+                  CASE
+
+                    WHEN (area_type = 2 AND area = 8001) THEN  1 -- Giant's Keep
+                    WHEN (area_type = 2 AND area = 9001) THEN  2 -- Dragon's Lair
+                    WHEN (area_type = 2 AND area = 6001) THEN  3 -- Necropolis
+                    WHEN (area_type = 2 AND area = 9501) THEN  4 -- Steel Fortress
+                    WHEN (area_type = 2 AND area = 9502) THEN  5 -- Punisher's Crypt
+                    WHEN (area_type = 4)                 THEN  6 -- Rift of Worlds
+                    WHEN (area_type = 3 AND area = 1001) THEN  7 -- Rift Dungeon - Ice Beast
+                    WHEN (area_type = 3 AND area = 2001) THEN  8 -- Rift Dungeon - Fire Beast
+                    WHEN (area_type = 3 AND area = 3001) THEN  9 -- Rift Dungeon - Wind Beast
+                    WHEN (area_type = 3 AND area = 4001) THEN 10 -- Rift Dungeon - Light Beast
+                    WHEN (area_type = 3 AND area = 5001) THEN 11 -- Rift Dungeon - Dark Beast
+                    WHEN (area_type = 2 AND area = 5001) THEN 12 -- Hall of Magic
+                    WHEN (area_type = 2 AND area = 3001) THEN 13 -- Hall of Water
+                    WHEN (area_type = 2 AND area = 2001) THEN 14 -- Hall of Fire
+                    WHEN (area_type = 2 AND area = 4001) THEN 15 -- Hall of Wind
+                    WHEN (area_type = 2 AND area = 7001) THEN 16 -- Hall of Light
+                    WHEN (area_type = 2 AND area = 1001) THEN 17 -- Hall of Dark
+                    ELSE area 
+                    END ASC
+            ";
+            $q = $db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->record, new Record($r["uid"], $r["area_type"], $r["area"]));
+            }
+        }
+
+    }
+?>

+ 146 - 0
application/entity/Record.php

@@ -0,0 +1,146 @@
+<?php
+    /**
+     * Record run entity file.
+     *
+     * Creates the entity and makes it available.
+     *
+     * @category Entity
+     */
+
+    /**
+     * Require dependent entities if not present.
+     */
+    require_once(PATH::ENTITY . "Entity.php");
+    require_once(PATH::ENTITY . "Unit.php");
+    require_once(PATH::ENTITY . "K_Unit.php");
+    require_once(PATH::ENTITY . "K_Area.php");
+
+
+    /**
+     * A record run.
+     *
+     * Represents an object from the table 'record'.
+     *
+     * @category Entity
+     */
+    class Record extends Entity{
+
+        /**
+         * @var int Player identifier.
+         */
+        public $uid;
+
+        /**
+         * @var K_Area Area.
+         */
+        public $area;
+
+        /**
+         * @var int Stage.
+         */
+        public $stage;
+
+        /**
+         * @var int Clear time, milliseconds.
+         */
+        public $time;
+
+        /**
+         * @var int Score in battles that are rated (WB, rift dungeons...).
+         */
+        public $score;
+
+        /**
+         * @var String Rank in battles that are rated (WB, rift dungeons...).
+         */
+        public $rank;
+
+        /**
+         * @var \Unit[]|\K_Unit[] Uits used.
+         * If the unit is still owned, it will be a instance of Unit.
+         * If not, it will be a instance of K_Unit.
+         */
+        public $party = [];
+
+        /**
+         * @var int ID of the leader unit.
+         */
+        public $leader;
+
+        /**
+         * @var int[] List of IDs of the frontline units.
+         */
+        public $frontline = [];
+
+        /**
+         * Constructor.
+         *
+         * Searches the database and retrieves the information about the
+         * run, populating it and it's items.
+         *
+         * @param int $id Run identifier.
+         * @global resource Database connection.
+         */
+        public function __construct($uid, $area_type, $area){
+
+            global $db;
+
+            $s = "
+                SELECT
+                  uid,
+                  area_type,
+                  area,
+                  stage,
+                  time,
+                  score,
+                  rank
+                FROM record
+                WHERE
+                  uid = $uid AND
+                  area_type = $area_type AND
+                  area = $area;
+            ";
+            error_log($s);
+            $q = $db->query($s);
+            $r = $q->fetchArray(SQLITE3_ASSOC);
+            $this->uid = $r["uid"];
+            $this->area = new K_Area($r["area"], $r["area_type"]);
+            $this->stage = $r["stage"];
+            $this->time = $r["time"];
+            $this->score = $r["score"];
+            $this->rank = $r["rank"];
+            $s = "
+                SELECT
+                  unit,
+                  k_unit,
+                  (SELECT count(id) FROM unit WHERE unit.id = record_party.unit) AS owned,
+                  leader,
+                  front
+                FROM record_party
+                WHERE
+                  uid = $uid AND
+                  area_type = $area_type AND
+                  area = $area
+                ORDER BY 
+                  front DESC,
+                  leader DESC;
+            ";
+            $q = $db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                if ($r["owned"] > 0){
+                    array_push($this->party, new Unit($r["unit"], false));
+                }
+                else{
+                    array_push($this->party, new K_Unit($r["k_unit"], false));
+                }
+                if ($r["leader"] == 1){
+                    $this->leader = $r["unit"];
+                }
+                if ($r["front"] == 1){
+                    array_push($this->frontline, $r["unit"]);
+                }
+            }
+        }
+
+    }
+?>

+ 257 - 43
application/entity/Unit.php

@@ -176,6 +176,136 @@
          */
         public $rune_accuracy = 0;
 
+        /**
+         * @var int Unit artifact HP stat.
+         */
+        public $artifact_hp = 0;
+
+        /**
+         * @var int Unit artifact ATK stat.
+         */
+        public $artifact_attack = 0;
+
+        /**
+         * @var int Unit artifact DEF stat.
+         */
+        public $artifact_defense = 0;
+
+        /**
+         * @var int Unit artifact SPD stat.
+         */
+        public $artifact_speed = 0;
+
+        /**
+         * @var int Unit artifact CRR stat.
+         */
+        public $artifact_crit_rate = 0;
+
+        /**
+         * @var int Unit artifact CRD stat.
+         */
+        public $artifact_crit_damage = 0;
+
+        /**
+         * @var int Unit artifact RES stat.
+         */
+        public $artifact_resistance = 0;
+
+        /**
+         * @var int Unit artifact ACC stat.
+         */
+        public $artifact_accuracy = 0;
+
+        /**
+         * @var int Unit building HP stat.
+         */
+        public $building_hp = 0;
+
+        /**
+         * @var int Unit building ATK stat.
+         */
+        public $building_attack = 0;
+
+        /**
+         * @var int Unit building DEF stat.
+         */
+        public $building_defense = 0;
+
+        /**
+         * @var int Unit building SPD stat.
+         */
+        public $building_speed = 0;
+
+        /**
+         * @var int Unit building CRR stat.
+         */
+        public $building_crit_rate = 0;
+
+        /**
+         * @var int Unit building CRD stat.
+         */
+        public $building_crit_damage = 0;
+
+        /**
+         * @var int Unit building RES stat.
+         */
+        public $building_resistance = 0;
+
+        /**
+         * @var int Unit building ACC stat.
+         */
+        public $building_accuracy = 0;
+
+        /**
+         * @var int Unit total HP stat.
+         */
+        public $total_hp = 0;
+
+        /**
+         * @var int Unit total ATK stat.
+         */
+        public $total_attack = 0;
+
+        /**
+         * @var int Unit total DEF stat.
+         */
+        public $total_defense = 0;
+
+        /**
+         * @var int Unit total SPD stat.
+         */
+        public $total_speed = 0;
+
+        /**
+         * @var int Unit total CRR stat.
+         */
+        public $total_crit_rate = 0;
+
+        /**
+         * @var int Unit total CRD stat.
+         */
+        public $total_crit_damage = 0;
+
+        /**
+         * @var int Unit total RES stat.
+         */
+        public $total_resistance = 0;
+
+        /**
+         * @var int Unit total ACC stat.
+         */
+        public $total_accuracy = 0;
+
+        /**
+         * @var int Unit effective HP
+         */
+        public $effective_hp = 0;
+
+        /**
+         * @var int Unit effective damage
+         */
+        public $effective_dmg = 0;
+
         /**
          * @var float Average rune efficiency.
          */
@@ -301,8 +431,7 @@
                 $this->create_time = date_create($r["create_time"]);
                 $this->homunculus_name = $r["homunculus_name"];
                 if ($complete){
-                    $this->load_runes();
-                    $this->load_artifacts();
+                    $this->load_stats();
                     $this->load_teams();
                     $this->check_storage();
                     $this->lock = $r["lock"];
@@ -370,42 +499,20 @@
             }
         }
 
+
         /**
-         * Loads the {@see teams} array, with the teams the unit is on.
+         * Calculates the stats gained from runes, artifacts and buildings.
+         * Calculates the totalls and the effective stats.
          *
-         * @global int Player ID.
+         * @gobal int User ID.
          * @global resource Database connection.
          */
-        public function load_teams(){
+        public function load_stats(){
+
             global $UID;
             global $db;
-            $this->teams = [];
-            $s = "
-              SELECT DISTINCT team.id AS id
-              FROM
-                team,
-                team_unit
-              WHERE
-                team.uid = '$UID' AND
-                team.id = team_unit.team AND
-                team_unit.unit = '" . $this->id . "';
-            ";
-            $q = $db->query($s);
-            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
-                array_push($this->teams, new Team($r["id"], false));
-            }
-        }
 
-        /**
-         * Loads the information about the equiped runes. 
-         * It is autoatically called at construction time if the
-         * $complete parameter is true (by default). No point in calling it
-         * twice.
-         *
-         * @global resource Database connection.
-         */
-        public function load_runes(){
-            global $db;
+            // Runes
             $this->rune = [];
             $s =
               "SELECT id " .
@@ -426,18 +533,8 @@
             $this->rune_attack = ceil($this->rune_attack);
             $this->rune_defense = ceil($this->rune_defense);
             $this->rune_hp = ceil($this->rune_hp);
-        }
 
-        /**
-         * Loads the information about the equiped artifacts. 
-         * It is autoatically called at construction time if the
-         * $complete parameter is true (by default). No point in calling it
-         * twice.
-         *
-         * @global resource Database connection.
-         */
-        public function load_artifacts(){
-            global $db;
+            // Artifacts
             $s =
               "SELECT id " .
               "FROM artifact " .
@@ -451,10 +548,127 @@
                 else{
                     $this->artifact_element = $artifact;
                 }
-                $this->sum_rune_stat($artifact->main_stat, $artifact->main_stat_value);
+                switch($artifact->main_stat){
+                    case ARTIFACT_STAT_ID::ATK:
+                        $this->artifact_attack += $artifact->main_stat_value;
+                        break;
+                    case ARTIFACT_STAT_ID::DEF:
+                        $this->artifact_defense += $artifact->main_stat_value;
+                        break;
+                    case ARTIFACT_STAT_ID::HP:
+                        $this->artifact_hp += $artifact->main_stat_value;
+                        break;
+                }
+            }
+
+            // Buildings
+            $s = "
+              SELECT
+                affected_stat,
+                bonus,
+                element
+              FROM
+                k_decoration,
+                k_decoration_level,
+                decoration
+              WHERE
+                decoration.uid = '$UID' AND
+                k_decoration.id = decoration.decoration AND
+                decoration.decoration = k_decoration_level.decoration AND
+                decoration.level = k_decoration_level.level AND
+                area = " . EFFECT_AREA_ID::GENERAL . " AND
+                affected_stat IN (" . STAT_ID::ATK . ", " . STAT_ID::DEF . ", " . STAT_ID::HP . ", " . STAT_ID::SPD . ", " . STAT_ID::CRIT_DMG . ");
+            ";
+            $q = $db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                switch($r["affected_stat"]){
+                    case STAT_ID::DEF:
+                        $this->building_defense += ($this->defense * $r["bonus"] / 100);
+                        break;
+                    case STAT_ID::HP:
+                        $this->building_hp += ($this->hp * $r["bonus"] / 100);
+                        break;
+                    case STAT_ID::SPD:
+                        $this->building_speed += ($this->speed * $r["bonus"] / 100);
+                        break;
+                    case STAT_ID::CRIT_DMG:
+                        $this->building_crit_damage += $r["bonus"];
+                        break;
+                    case STAT_ID::ATK:
+                        if(strlen($r["element"]) > 0 && $r["element"] == $this->unit->element){
+                            $this->building_attack += ($this->attack * $r["bonus"] / 100);
+                        }
+                        else{
+                            $this->building_attack += ($this->attack * $r["bonus"] / 100);
+                        }
+                        break;
+                }
             }
+            $this->building_attack = ceil($this->building_attack);
+            $this->building_defense = ceil($this->building_defense);
+            $this->building_hp = ceil($this->building_hp);
+            $this->building_speed = ceil($this->building_speed);
+            $this->building_crit_damage = ceil($this->building_crit_damage);
+
+            // Totals
+            $this->total_hp = $this->hp + $this->rune_hp + $this->building_hp + $this->artifact_hp;
+            $this->total_attack = $this->attack + $this->rune_attack + $this->building_attack + $this->artifact_attack;
+            $this->total_defense = $this->defense + $this->rune_defense + $this->building_defense + $this->artifact_defense;
+            $this->total_speed = $this->speed + $this->rune_speed + $this->building_speed;
+            $this->total_crit_rate = $this->crit_rate + $this->rune_crit_rate + $this->building_crit_rate;
+            $this->total_crit_damage = $this->crit_damage + $this->rune_crit_damage + $this->building_crit_damage;
+            $this->total_accuracy = $this->accuracy + $this->rune_accuracy + $this->building_accuracy;
+            $this->total_resistance = $this->resistance + $this->rune_resistance + $this->building_resistance;
+            
+            // Effective stats
+            $ehp = 0;
+            $edmg = 0;
+            
+            // Calculate effective_hp
+            $hp = $this->total_hp;
+            $def = $this->total_defense;
+            $ehp = ceil(((($def * 3.5) + 1140) * $hp) / 1000);
+            $this->effective_hp = $ehp;
+
+            // Calculate effective_dmg
+            $atk = $this->total_attack;
+            $crr = $this->total_crit_rate;
+            if ($crr > 100){
+                $crr = 100;
+            }
+            $crd = $this->total_crit_damage;
+            $edmg = ceil(($atk * (100 - $crr) / 100) + (($atk + ($atk * $crd / 100)) * $crr / 100));
+            $this->effective_dmg = $edmg;
         }
 
+
+        /**
+         * Loads the {@see teams} array, with the teams the unit is on.
+         *
+         * @global int Player ID.
+         * @global resource Database connection.
+         */
+        public function load_teams(){
+            global $UID;
+            global $db;
+            $this->teams = [];
+            $s = "
+              SELECT DISTINCT team.id AS id
+              FROM
+                team,
+                team_unit
+              WHERE
+                team.uid = '$UID' AND
+                team.id = team_unit.team AND
+                team_unit.unit = '" . $this->id . "';
+            ";
+            $q = $db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->teams, new Team($r["id"], false));
+            }
+        }
+
+
         /**
          * Calculates the stat increase by a rune property.
          * 

+ 88 - 2
application/helper/HTML_Helper.php

@@ -73,8 +73,23 @@
             }
             $html = "";
             if ($k->awakens_from == "" && $k->awakens_to == ""){
-                // No to, no from, silver monster.
-                $star_class ="star_silver";
+                // No to, no from
+                if ($k->base_stars >= 4){
+                    // SFV Collab event units, always awakened.
+                    $star_class = "star_purple";
+                }
+                elseif($k->archetype == ARCHETYPE_ID::MATERIAL && $k->element == ELEMENT_ID::LIGHT){
+                    // Rainbowmon, always awakened
+                    $star_class = "star_purple";
+                }
+                elseif($k->archetype == ARCHETYPE_ID::MATERIAL && $k->element == ELEMENT_ID::DARK){
+                    // Devilmon, always unawakened
+                    $star_class = "star_silver";
+                }
+                else{
+                    // Unawakeable monster
+                    $star_class = "star_silver";
+                }
             }
             elseif ($k->awakens_from != ""){
                 // Already awakened
@@ -653,6 +668,77 @@
             $html .= "</div>\n";
             return $html;
         }
+
+        /**
+         * Generates an arena rank icon image.
+         *
+         * @param int $d Arena rank id.
+         * @return string HTML content for the image.
+         */
+        public static function arena_rank_icon($id) {
+            switch ($id){
+                case ARENA_RANK_ID::BEGINER:
+                    $src = URL::IMG["RANK"] . "0901.png";
+                    $tit = "Beginer";
+                    break;
+                case ARENA_RANK_ID::CHALLENGER_1:
+                    $src = URL::IMG["RANK"] . "1001.png";
+                    $tit = "Challenger 1";
+                    break;
+                case ARENA_RANK_ID::CHALLENGER_2:
+                    $src = URL::IMG["RANK"] . "1002.png";
+                    $tit = "Challenger 2";
+                    break;
+                case ARENA_RANK_ID::CHALLENGER_3:
+                    $src = URL::IMG["RANK"] . "1003.png";
+                    $tit = "Challenger 3";
+                    break;
+                case ARENA_RANK_ID::FIGHTER_1:
+                    $src = URL::IMG["RANK"] . "2001.png";
+                    $tit = "Fighter 1";
+                    break;
+                case ARENA_RANK_ID::FIGHTER_2:
+                    $src = URL::IMG["RANK"] . "2002.png";
+                    $tit = "Fighter 2";
+                    break;
+                case ARENA_RANK_ID::FIGHTER_3:
+                    $src = URL::IMG["RANK"] . "2003.png";
+                    $tit = "Fighter 3";
+                    break;
+                case ARENA_RANK_ID::CONQUEROR_1:
+                    $src = URL::IMG["RANK"] . "3001.png";
+                    $tit = "Conqueror 1";
+                    break;
+                case ARENA_RANK_ID::CONQUEROR_2:
+                    $src = URL::IMG["RANK"] . "3002.png";
+                    $tit = "Conqueror 2";
+                    break;
+                case ARENA_RANK_ID::CONQUEROR_3:
+                    $src = URL::IMG["RANK"] . "3003.png";
+                    $tit = "Conqueror 3";
+                    break;
+                case ARENA_RANK_ID::GUARDIAN_1:
+                    $src = URL::IMG["RANK"] . "4001.png";
+                    $tit = "Guardian 1";
+                    break;
+                case ARENA_RANK_ID::GUARDIAN_2:
+                    $src = URL::IMG["RANK"] . "4002.png";
+                    $tit = "Guardian 2";
+                    break;
+                case ARENA_RANK_ID::GUARDIAN_3:
+                    $src = URL::IMG["RANK"] . "4003.png";
+                    $tit = "Guardian 3";
+                    break;
+                case ARENA_RANK_ID::LEGEND:
+                    $src = URL::IMG["RANK"] . "5001.png";
+                    $tit = "Legend";
+                default:
+                    $src = URL::IMG["RANK"] . $id . ".png";
+            }
+            $html = "<img alt='$tit' title='$tit' src='$src'/>";
+            return $html;
+        }
+
     }
 
 ?>

+ 6 - 263
application/page/Home_Page.php

@@ -11,10 +11,7 @@
      * Require dependent files if not present.
      */
     require_once(PATH::PAGE . "Page.php");
-    require_once(PATH::ENTITY . "Unit.php");
-    require_once(PATH::ENTITY . "Building.php");
-    require_once(PATH::ENTITY . "Decoration.php");
-    require_once(PATH::ENTITY . "Inventory.php");
+    require_once(PATH::ENTITY . "Player.php");
 
 
     /**
@@ -25,93 +22,9 @@
     class Home_Page extends Page{
 
         /**
-         * @var int Player ID.
+         * @var Player Player instance.
          */
-        public $uid;
-
-        /**
-         * @var int Player level.
-         */
-        public $level;
-
-        /**
-         * @var string Player name.
-         */
-        public $name;
-
-        /**
-         * @var string Player country (XX).
-         */
-        public $country;
-
-        /**
-         * @var int Total experience.
-         */
-        public $experience;
-
-        /**
-         * @var Unit Representative Unit.
-         */
-        public $rep;
-
-        /**
-         * @var \Unit[] Unitss in Arena defense.
-         */
-        public $defense = [];
-
-        /**
-         * @var int[] Currency.
-         */
-        public $currency = [
-            "mana" => 0,
-            "crystal" => 0,
-            "energy" => 0,
-            "energy_max" => 0,
-            "arena_energy" => 0,
-            "arena_energy_max" => 0,
-            "darkportal_energy" => 0,
-            "darkportal_energy_max" => 0,
-            "dimension_energy" => 0,
-            "dimension_energy_max" => 0,
-            "honor_point" => 0,
-            "guild_point" => 0,
-            "honor_medal" => 0,
-            "honor_mark" => 0,
-            "event_coin" => 0,
-            "social_point" => 0,
-            "ancient_stone" => 0,
-            "costume_point" => 0,
-        ];
-
-        /**
-         * @var \Building[] List of Buildings.
-         */
-        public $building = [];
-
-        /**
-         * @var \Decoration[] List of Decorations.
-         */
-        public $decoration = [];
-
-        /**
-         * @var \Inventory[] List of Scrolls in Inventory.
-         */
-        public $inventory_scroll = [];
-
-        /**
-         * @var \Inventory[] List of rune crafting items in Inventory.
-         */
-        public $inventory_craft_rune = [];
-
-        /**
-         * @var \Inventory[] List of rune crafting items in Inventory.
-         */
-        public $inventory_craft = [];
-
-        /**
-         * @var \Inventory[] List of rune crafting items in Inventory.
-         */
-        public $inventory_essence = [];
+        public $player;
 
         /**
          * Constructor.
@@ -119,183 +32,13 @@
          * Retrieves the data and initializes the variables.
          *
          * @global int Player ID.
-         * @global resource Connection to the database.
          */
         public function __construct(){
             global $UID;
-            global $db;
             $this->view = PATH::VIEW . "home.php";
-            $s = "
-              SELECT
-                uid,
-                name,
-                level,
-                country,
-                experience,
-                rep,
-                mana,
-                crystal,
-                energy,
-                energy_max,
-                arena_energy,
-                arena_energy_max,
-                darkportal_energy,
-                darkportal_energy_max,
-                dimension_energy,
-                dimension_energy_max,
-                honor_point,
-                guild_point,
-                honor_medal,
-                honor_mark,
-                event_coin,
-                social_point,
-                costume_point
-              FROM player
-              WHERE uid = '$UID';
-            ";
-            $q = $db->query($s);
-            $r = $q->fetchArray(SQLITE3_ASSOC);
-            if ($r){
-                $this->uid = $r["uid"];
-                $this->name = $r["name"];
-                $this->level = $r["level"];
-                $this->country = $r["country"];
-                $this->experience = $r["experience"];
-                if (strlen($r["rep"]) > 0){
-                    $this->rep = new Unit($r["rep"]);
-                }
-                $this->currency["mana"] = $r["mana"];
-                $this->currency["crystal"] = $r["crystal"];
-                $this->currency["energy"] = $r["energy"];
-                $this->currency["energy_max"] = $r["energy_max"];
-                $this->currency["arena_energy"] = $r["arena_energy"];
-                $this->currency["arena_energy_max"] = $r["arena_energy_max"];
-                $this->currency["darkportal_energy"] = $r["darkportal_energy"];
-                $this->currency["darkportal_energy_max"] = $r["darkportal_energy_max"];
-                $this->currency["dimension_energy"] = $r["dimension_energy"];
-                $this->currency["dimension_energy_max"] = $r["dimension_energy_max"];
-                $this->currency["honor_point"] = $r["honor_point"];
-                $this->currency["guild_point"] = $r["guild_point"];
-                $this->currency["honor_medal"] = $r["honor_medal"];
-                $this->currency["honor_mark"] = $r["honor_mark"];
-                $this->currency["event_coin"] = $r["event_coin"];
-                $this->currency["social_point"] = $r["social_point"];
-                $this->currency["costume_point"] = $r["costume_point"];
-            }
-            $s = "
-                SELECT unit
-                FROM defense
-                WHERE uid = '$UID'
-                ORDER BY position;
-            ";
-            $q = $db->query($s);
-            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
-                array_push($this->defense, new Unit($r["unit"], false));
-            }
-            $s = "
-                SELECT
-                  building.id,
-                  min(building)
-                FROM
-                  building,
-                  k_building
-                WHERE
-                  uid = '$UID' AND
-                  building.building = k_building.id 
-                GROUP BY building.building;
-            ";
-            $q = $db->query($s);
-            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
-                array_push($this->building, new Building($r["id"]));
-            }
-            $s = "
-                SELECT id
-                FROM decoration
-                WHERE uid = '$UID';
-            ";
-            $q = $db->query($s);
-            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
-                array_push($this->decoration, new Decoration($r["id"]));
-            }
-            $s = "
-                SELECT
-                  id,
-                  type
-                FROM inventory
-                WHERE
-                  uid = '$UID' AND
-                  type = " . INVENTORY_TYPE_ID::SCROLL . " AND
-                  amount > 0
-                ORDER BY inventory.type;
-            ";
-            $q = $db->query($s);
-            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
-                array_push($this->inventory_scroll, new Inventory($r["id"], $r["type"]));
-            }
-            // Rune crafting items are marked as generic crafting.
-            $s = "
-                SELECT
-                  inventory.id AS id,
-                  inventory.type AS type
-                FROM
-                  inventory
-                WHERE
-                  inventory.uid = '$UID' AND
-                  inventory.type = " . INVENTORY_TYPE_ID::RUNE_CRAFT . " AND
-                  amount > 0
-                ORDER BY inventory.id;
-            ";
-            $q = $db->query($s);
-            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
-                array_push($this->inventory_craft_rune, new Inventory($r["id"], $r["type"]));
-            }
-            $s = "
-                SELECT
-                  inventory.id AS id,
-                  inventory.type AS type
-                FROM
-                  inventory
-                WHERE
-                  inventory.uid = '$UID' AND
-                  inventory.type = " . INVENTORY_TYPE_ID::CRAFT_STUFF . " AND
-                  amount > 0
-                ORDER BY inventory.id;
-            ";
-            $q = $db->query($s);
-            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
-                array_push($this->inventory_craft, new Inventory($r["id"], $r["type"]));
-            }
-            $s = "
-                SELECT
-                  inventory.id AS id,
-                  inventory.type AS type
-                FROM
-                  inventory,
-                  k_inventory
-                WHERE
-                  inventory.id = k_inventory.id AND
-                  inventory.type = k_inventory.type AND
-                  inventory.uid = '$UID' AND
-                  inventory.type = " . INVENTORY_TYPE_ID::ESSENCES . " AND
-                  amount > 0
-                ORDER BY
-                  upper(name) NOT LIKE '%MAGIC%',
-                  upper(name) NOT LIKE '%FIRE%',
-                  upper(name) NOT LIKE '%WATER%',
-                  upper(name) NOT LIKE '%WIND%',
-                  upper(name) NOT LIKE '%LIGHT%',
-                  upper(name) NOT LIKE '%DARK%',
-                  upper(name) NOT LIKE '%LOW%',
-                  upper(name) NOT LIKE '%MID%',
-                  upper(name) NOT LIKE '%HIGH%'
-                ;
-            ";
-            $q = $db->query($s);
-            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
-                array_push($this->inventory_essence, new Inventory($r["id"], $r["type"]));
-            }
-            $this->title = "SWDB";
-            $this->description = "Summoners War DataBase";
+            $this->player = new Player($UID);
+            $this->title = $this->player->name . " - SWDB";
+            $this->description = $this->player->name . " - Summoners War DataBase";
             $this->canonical = URL::BASE;
         }
     }

+ 0 - 71
application/page/Monster_Page.php

@@ -25,23 +25,6 @@
          */
         public $unit;
 
-        /**
-         * @var mixed[] Stats gained by building.
-         */
-        public $building_stats = [
-            "atk" => 0,
-            "def" => 0,
-            "hp" => 0,
-            "spd" => 0,
-            "crd" => 0,
-            "elm" => [
-                1 => 0,
-                2 => 0,
-                3 => 0,
-                4 => 0,
-                5 => 0
-            ]
-        ];
 
         /**
          * Constructor.
@@ -54,65 +37,11 @@
         public function __construct($id){
             global $db;
             $this->view = PATH::VIEW . "monster.php";
-            $this->calculate_buildings();
             $this->unit = new Unit($id);
             $this->title = $this->unit->unit->name ." - SWDB";
             $this->description = "Owned " . $this->unit->unit->name;
             $this->canonical = URL::BASE . "monster/" . $id;
         }
 
-        /**
-         * Calculates the stats gained from bulding upgrades and populates the
-         * $building_stats array.
-         *
-         * @gobal int User ID.
-         * @global resource Database connection.
-         */
-        private function calculate_buildings(){
-            global $UID;
-            global $db;
-            $s = "
-              SELECT
-                affected_stat,
-                bonus,
-                element
-              FROM
-                k_decoration,
-                k_decoration_level,
-                decoration
-              WHERE
-                decoration.uid = '$UID' AND
-                k_decoration.id = decoration.decoration AND
-                decoration.decoration = k_decoration_level.decoration AND
-                decoration.level = k_decoration_level.level AND
-                area = " . EFFECT_AREA_ID::GENERAL . " AND
-                affected_stat IN (" . STAT_ID::ATK . ", " . STAT_ID::DEF . ", " . STAT_ID::HP . ", " . STAT_ID::SPD . ", " . STAT_ID::CRIT_DMG . ");
-            ";
-            $q = $db->query($s);
-            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
-                switch($r["affected_stat"]){
-                    case STAT_ID::DEF:
-                        $this->building_stats["def"] += $r["bonus"];
-                        break;
-                    case STAT_ID::HP:
-                        $this->building_stats["hp"] += $r["bonus"];
-                        break;
-                    case STAT_ID::SPD:
-                        $this->building_stats["spd"] += $r["bonus"];
-                        break;
-                    case STAT_ID::CRIT_DMG:
-                        $this->building_stats["crd"] += $r["bonus"];
-                        break;
-                    case STAT_ID::ATK:
-                        if(strlen($r["element"]) > 0){
-                            $this->building_stats["elm"][$r["element"]] += $r["bonus"];
-                        }
-                        else{
-                            $this->building_stats["atk"] += $r["bonus"];
-                        }
-                        break;
-                }
-            }
-        }
     }
 ?>

+ 5 - 74
application/page/Monsters_Page.php

@@ -25,24 +25,6 @@
          */
         public $monsters = [];
 
-        /**
-         * @var mixed[] Stats gained by buildings.
-         */
-        public $building_stats = [
-            "atk" => 0,
-            "def" => 0,
-            "hp" => 0,
-            "spd" => 0,
-            "crd" => 0,
-            "elm" => [
-                1 => 0,
-                2 => 0,
-                3 => 0,
-                4 => 0,
-                5 => 0,
-            ]
-        ];
-
         /**
          * Constructor.
          *
@@ -54,7 +36,6 @@
             global $db;
             $this->view = PATH::VIEW . "monsters.php";
             $this->parse_filters();
-            $this->calculate_buildings();
             $s_mon = $this->build_query();
             $q_mon = $db->query($s_mon);
             while ($r_mon = $q_mon->fetchArray(SQLITE3_ASSOC)){
@@ -86,6 +67,9 @@
             if (isset($_GET["in_storage"]) && $_GET["in_storage"] == "on"){
                 $this->filters["IN_STORAGE"] = true;
             }
+            else{
+                $this->filters["IN_STORAGE"] = false;
+            }
             if (isset($_GET["without_runes"]) && $_GET["without_runes"] == "on"){
                 $this->filters["WITHOUT_RUNES"] = true;
             }
@@ -119,8 +103,8 @@
             if ($this->filters["NAME"] != ""){
                 $s = $s . " AND unit IN (SELECT id FROM k_unit WHERE upper(name) LIKE '%" . strtoupper($this->filters["NAME"]) . "%') ";
             }
-            if ($this->filters["IN_STORAGE"]){
-                $s = $s . " AND building = " . BUILDING_ID::MONSTER_STORAGE;
+            if (!$this->filters["IN_STORAGE"]){
+                $s = $s . " AND building NOT IN (SELECT id FROM building WHERE building = " . BUILDING_ID::MONSTER_STORAGE . ") ";
             }
             if (!$this->filters["WITHOUT_RUNES"]){
                 $s = $s . " AND unit.id IN (SELECT DISTINCT assigned_to FROM rune) ";
@@ -138,58 +122,5 @@
             return $s;
         }
 
-        /**
-         * Calculates the stats gained from bulding upgrades and populates the
-         * $building_stats array.
-         *
-         * @global int Player ID.
-         * @global resource Database connection.
-         */
-        private function calculate_buildings(){
-            global $UID;
-            global $db;
-            $s = "
-              SELECT
-                affected_stat,
-                bonus,
-                element
-              FROM
-                k_decoration,
-                k_decoration_level,
-                decoration
-              WHERE
-                decoration.uid = '$UID' AND
-                k_decoration.id = decoration.decoration AND
-                decoration.decoration = k_decoration_level.decoration AND
-                decoration.level = k_decoration_level.level AND
-                area = " . EFFECT_AREA_ID::GENERAL . " AND
-                affected_stat IN (" . STAT_ID::ATK . ", " . STAT_ID::DEF . ", " . STAT_ID::HP . ", " . STAT_ID::SPD . ", " . STAT_ID::CRIT_DMG . ");
-            ";
-            $q = $db->query($s);
-            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
-                switch($r["affected_stat"]){
-                    case STAT_ID::DEF:
-                        $this->building_stats["def"] += $r["bonus"];
-                        break;
-                    case STAT_ID::HP:
-                        $this->building_stats["hp"] += $r["bonus"];
-                        break;
-                    case STAT_ID::SPD:
-                        $this->building_stats["spd"] += $r["bonus"];
-                        break;
-                    case STAT_ID::CRIT_DMG:
-                        $this->building_stats["crd"] += $r["bonus"];
-                        break;
-                    case STAT_ID::ATK:
-                        if(strlen($r["element"]) > 0){
-                            $this->building_stats["elm"][$r["element"]] += $r["bonus"];
-                        }
-                        else{
-                            $this->building_stats["atk"] += $r["bonus"];
-                        }
-                        break;
-                }
-            }
-        }
     }
 ?>

+ 31 - 9
application/page/Report_Skillup_Page.php

@@ -111,10 +111,35 @@
               WHERE
                 unit.uid = '$UID' AND
                 unit.unit = k_unit.id AND
-                unit_skill.unit = unit.id AND
-                --unit_skill.skill = k_unit_skill.skill AND
-                k_unit.id = k_unit_skill.unit AND
-                k_skill.id = k_unit_skill.skill AND
+                unit_skill.unit = unit.id AND ";
+            if (!$this->filters["HOMUNCULUS"]){
+                $s .= "
+                  k_unit.homunculus <> 1 AND 
+                  unit_skill.skill = k_unit_skill.skill AND
+                  k_unit.id = k_unit_skill.unit AND
+                  k_skill.id = k_unit_skill.skill AND
+                  ";
+              }
+              else{
+                $s .= "
+                  (
+                    (
+                      k_unit.homunculus <> 1 AND 
+                      unit_skill.skill = k_unit_skill.skill AND
+                      k_unit.id = k_unit_skill.unit AND
+                      k_skill.id = k_unit_skill.skill
+                    ) OR
+                    (
+                      unit.homunculus = 1 AND 
+                      unit.unit = k_unit.id AND
+                      unit_skill.unit = unit.id AND
+                      unit_skill.skill = k_skill.id AND
+                      unit.id = unit_skill.unit
+                    )
+                  ) AND
+                  ";
+              }
+              $s .= "
                 k_skill.max_level > 1 AND
                 unit.stars >= " . $this->filters["MIN_STARS"] . " AND
                 unit.stars <= " . $this->filters["MAX_STARS"]
@@ -152,9 +177,6 @@
                     $s = $s . " AND k_unit.id <> 23015 AND k_unit.id <> 23005 ";
                 }
             }
-            if (!$this->filters["HOMUNCULUS"]){
-                $s = $s . " AND k_unit.homunculus <> 1 ";
-            }
             $s = $s .
               "GROUP BY unit.id ";
             if (!$this->filters["MAXED"]){
@@ -162,11 +184,11 @@
             }
             $s = $s . "
               ORDER BY
-                CAST(ponderated_lvl AS FLOAT) / CAST(ponderated_max_lvl AS FLOAT),
+                CAST(ponderated_lvl * 100 AS FLOAT) / CAST(ponderated_max_lvl * 100 AS FLOAT),
                 unit.stars DESC,
                 unit.level DESC,
                 CAST(lvl AS FLOAT) / CAST(max_lvl AS FLOAT),
-                max_lvl - lvl DESC;
+                max_lvl - lvl DESC
             ";
             return $s;
         }

BIN=BIN
application/sw.sqlite


+ 14 - 14
application/view/guild.php

@@ -161,59 +161,59 @@
                             <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["ICON"] . "rank_beg.png";
+                                    $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["ICON"] . "rank_cha1.png";
+                                    $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["ICON"] . "rank_cha2.png";
+                                    $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["ICON"] . "rank_cha3.png";
+                                    $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["ICON"] . "rank_fig1.png";
+                                    $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["ICON"] . "rank_fig2.png";
+                                    $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["ICON"] . "rank_fig3.png";
+                                    $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["ICON"] . "rank_con1.png";
+                                    $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["ICON"] . "rank_con2.png";
+                                    $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["ICON"] . "rank_con3.png";
+                                    $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["ICON"] . "rank_gua1.png";
+                                    $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["ICON"] . "rank_gua2.png";
+                                    $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["ICON"] . "rank_gua3.png";
+                                    $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["ICON"] . "rank_leg.png";
+                                    $src = URL::IMG["RANK"] . "5001.png";
                                     $tit = "Legend";
                                 }
 ?>

+ 422 - 177
application/view/home.php

@@ -48,234 +48,479 @@
                 </span>
             </h2>
             <article id='profile'>
-                <h3>
-                    <span id='user_name'>
-                        <?=$page->name?>
-                    </span>
-                    <span id='user_level'>
-                        Lv. <?=$page->level?>
-                        <span id='user_exp'>
-                            (exp: <?=$page->experience?>)
-                        </span>
-                    </span>
-                </h3>
-<?php
-                if (isset($page->rep)){
-?>
-                    <div id='rep' class='profile_section'>
+                <div class='panel' id='panel_left'>
+                    <div id='player' class='profile_section'>
                         <h4>
-                            Rep. Monster
+                            <?=$page->player->name?>
                         </h4>
-                        <div class='monster_panel'>
-                            <?=HTML::unit_panel($page->rep)?>
-                        </div> <!-- .monster_panel -->
+                        <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
-                } // if (isset($page->rep))
+                            $first = true;
+                            foreach ($page->player->defense as $defense){
 ?>
-                <div id='defense' class='profile_section'>
-                    <h4>
-                        Arena defense
-                    </h4>
+                                <div class='monster_panel'>
+                                    <?=HTML::unit_panel($defense)?>
+                                </div>
 <?php
-                    $first = true;
-                    foreach ($page->defense as $defense){
+                                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>
+<?php
+                                }
+                                $first = false;
+                            }
 ?>
-                        <div class='monster_panel'>
-                            <?=HTML::unit_panel($defense)?>
                         </div>
+                        <div id='placements_gw'>
+                            <h5>
+                                Guild War defense:
+                            </h5>
 <?php
-                        if ($first && isset($defense->unit->leader_skill) && ($defense->unit->leader_skill->area == $EFFECT_AREA["GENERAL"] || $defense->unit->leader_skill->area == $EFFECT_AREA["ARENA"])){
+                            $first = true;
+                            foreach ($page->player->gw_defense[0] as $defense){
 ?>
-                            <div class='skill'>
-                                <img class='skill_img' title='<?=$defense->unit->leader_skill->create_description()?>' src='<?=$defense->unit->leader_skill->get_image()?>'/>
-                            </div>
+                                <div class='monster_panel'>
+                                    <?=HTML::unit_panel($defense)?>
+                                </div>
 <?php
-                        }
-                        $first = false;
-                    }
+                                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>
+<?php
+                                }
+                                $first = false;
+                            }
+?>
+                            <hr/>
+                        <?php
+                            $first = true;
+                            foreach ($page->player->gw_defense[1] as $defense){
 ?>
-                </div>
-                <div id='building' class='profile_section'>
-                    <h4>
-                        Buildings
-                    </h4>
+                                <div class='monster_panel'>
+                                    <?=HTML::unit_panel($defense)?>
+                                </div>
 <?php
-                    $half = sizeof($page->building) / 2;
-                    $i = 0;
-                    foreach ($page->building as $building){
-                        if ($i == $half){
+                                if ($first && isset($defense->unit->leader_skill) && ($defense->unit->leader_skill->area == $EFFECT_AREA["GENERAL"] || $defense->unit->leader_skill->area == $EFFECT_AREA["ARENA"])){
 ?>
-                            <br class='desktop'/>
+                                    <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;
+                            }
 ?>
-                        <?=HTML::building_panel($building)?>
+                        </div>
+                    </div>
+                    <div id='building' class='profile_section'>
+                        <h4>
+                            Buildings
+                        </h4>
 <?php
-                        $i ++;
-                    }$i ++;
+                        // Buildings
+                        $half = sizeof($page->player->building) / 2;
+                        $i = 0;
+                        foreach ($page->player->building as $building){
+                            if ($i == $half){
 ?>
-                </div>
-                <div id='decoration' class='profile_section'>
-                    <h4>
-                        Decorations
-                    </h4>
+                                <br class='desktop'/>
 <?php
-                    $half = sizeof($page->decoration) / 2;
-                    $i = 0;
-                    foreach ($page->decoration as $decoration){
-                        if ($i == $half){
+                            }
 ?>
-                            <br class='desktop'/>
+                            <?=HTML::building_panel($building)?>
 <?php
+                            $i ++;
                         }
 ?>
-                        <?=HTML::building_panel($decoration)?>
+                        <br/>
 <?php
-                        $i ++;
-                    }
+                        // Decorations
+                        $half = sizeof($page->player->decoration) / 2;
+                        $i = 0;
+                        foreach ($page->player->decoration as $decoration){
+                            if ($i == $half){
 ?>
-                </div>
-                <div class='inventory profile_section' id='inventory_scroll'>
-                    <h4>
-                        Scrolls
-                    </h4>
+                                <br class='desktop'/>
 <?php
-                    $half = sizeof($page->building) / 2;
-                    $i = 0;
-                    foreach ($page->inventory_scroll as $item){
-                        if ($half > 6 && $i == $half){
+                            }
 ?>
-                            <br class='desktop'/>
+                            <?=HTML::building_panel($decoration)?>
 <?php
+                            $i ++;
                         }
 ?>
-                        <?=HTML::item_panel($item)?>
+                    </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 ++;
-                    }
+                            $i ++;
+                        }
 ?>
-                </div>
-                <div class='inventory profile_section' id='inventory_craft_rune'>
-                    <h4>
-                        Rune crafting items
-                    </h4>
+                        <br/>
 <?php
-                    $prev = 0;
-                    foreach ($page->inventory_craft_rune as $item){
-                        if ($prev != 0 && $prev + 2000 < $item->id){
+                        // Rune craft materials
+                        $prev = 0;
+                        foreach ($page->player->inventory_craft_rune as $item){
 ?>
-                            <br class='desktop'/>
+                            <?=HTML::item_panel($item)?>
 <?php
+                            $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){
 ?>
-                </div>
-                <div class='inventory profile_section' id='inventory_craft'>
-                    <h4>
-                        Other crafting items
-                    </h4>
+                                <br class='desktop'/>
 <?php
-                    $prev = 0;
-                    foreach ($page->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){
 ?>
-                </div>
-                <div class='inventory profile_section' id='inventory_essence'>
-                    <h4>
-                        Essences
-                    </h4>
+                                <br class='desktop'/>
 <?php
-                    $prev = "";
-                    foreach ($page->inventory_essence as $item){
-                        if ($prev != "" && $prev != preg_split('/\s+/', $item->name)[2]){
+                            }
 ?>
-                            <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];
-                    }
-?>
-                </div>
-                <div id='currency' class='profile_section'>
-                    <h4>
-                        Currency
-                    </h4>
-                    <ul>
-                        <li>
-                            <img title='Energy' src='<?=URL::IMG["CURRENCY"]?>energy.png'/>
-                            <?=$page->currency["energy"]?> / <?=$page->currency["energy_max"]?>
-                        </li>
-                        <li>
-                            <img title='Arena Invitations' src='<?=URL::IMG["CURRENCY"]?>arenaenergy.png'/>
-                            <?=$page->currency["arena_energy"]?> / <?=$page->currency["arena_energy_max"]?>
-                        </li>
-                        <li>
-                            <img title='Dimensional Energy' src='<?=URL::IMG["CURRENCY"]?>dimensionenergy.png'/>
-                            <?=$page->currency["dimension_energy"]?> / <?=$page->currency["dimension_energy_max"]?>
-                        </li>
-                        <li>
-                            <img title='Dimensional Crystal' src='<?=URL::IMG["CURRENCY"]?>darkportalenergy.png'/>
-                            <?=$page->currency["darkportal_energy"]?> / <?=$page->currency["darkportal_energy_max"]?>
-                        </li>
-                        <li>
-                            <img title='Mana' src='<?=URL::IMG["CURRENCY"]?>mana.png'/>
-                            <?=$page->currency["mana"]?>
-                        </li>
-                        <li>
-                            <img title='Crystal' src='<?=URL::IMG["CURRENCY"]?>crystal.png'/>
-                            <?=$page->currency["crystal"]?>
-                        </li>
-                        <li>
-                            <img title='Social Points' src='<?=URL::IMG["CURRENCY"]?>socialpoint.png'/>
-                            <?=$page->currency["social_point"]?>
-                        </li>
-                        <li>
-                            <img title='Honor Points' src='<?=URL::IMG["CURRENCY"]?>honor.png'/>
-                            <?=$page->currency["honor_point"]?>
-                        </li>
-                        <li>
-                            <img title='Guild Points' src='<?=URL::IMG["CURRENCY"]?>guildpoint.png'/>
-                            <?=$page->currency["guild_point"]?>
-                        </li>
-                        <li>
-                            <img title='Honor Medals' src='<?=URL::IMG["CURRENCY"]?>badge.png'/>
-                            <?=$page->currency["honor_medal"]?>
-                        </li>
-                        <li>
-                            <img src='<?=URL::IMG["CURRENCY"]?>mark.png'/>
-                            <?=$page->currency["honor_mark"]?>
-                        </li>
-                        <li>
-                            <img title='Ancient Coins' src='<?=URL::IMG["CURRENCY"]?>ancientcoin.png'/>
-                            <?=$page->currency["event_coin"]?>
-                        </li>
-                        <li>
-                            <img title='Ancient Crystal' src='<?=URL::IMG["CURRENCY"]?>ancientstone.png'/>
-                            <?=$page->currency["ancient_stone"]?>
-                        </li>
-                        <li>
-                            <img title='Shapeshifting Stones' src='<?=URL::IMG["CURRENCY"]?>costumestone.png'/>
-                            <?=$page->currency["costume_point"]?>
-                        </li>
-                    </ul>
-                </div>
+                    </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){
+?>
+                                    <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){
+?>
+                                                <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>
+<?php
+                                            }
+?>
+                                        </td>
+<?php
+                                        $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?>'>
+<?php
+                                            $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'/>
+<?php
+                                                }
+                                                if ($party instanceof K_Unit){
+                                                    $enable_save = false;
+                                                    $disabled = "disabled";
+                                                }
+                                                else{
+                                                    $disabled = "";
+                                                }
+                                                if ($disabled == ""){
+?>
+                                                    <a target='_blank' href='/<?=$UID?>>/monster/<?=$party->id?>'>
+<?php
+                                                }
+?>
+                                                <div class='monster_panel <?=$disabled?>'>
+                                                    <?=HTML::unit_panel($party)?>
+<?php
+                                                        if ($party->id == $record->leader){
+?>
+                                                            <img alt='Leader' class='leader' src='<?=URL::IMG["ICON"]?>leader.png'/>
+<?php
+                                                        }
+?>
+                                                </div>
+<?php
+                                                if ($disabled == ""){
+?>
+                                                    </a>
+<?php
+                                                }
+                                                $prev_front = $front;
+                                            }
+?>
+                                        </td>
+                                    </tr>
+                                
+<?php
+                                }
+?>
+                            </table>
+                        </div>
+                    </div>
+                </div> <!-- #panel_right -->
             </article>
         </section>
 <?php

+ 4 - 4
application/view/inc/filter_monsters.php

@@ -16,15 +16,15 @@
                 <span>Element:</span>
 <?php
                 $selected = Array("", "", "", "", "");
-                $selected[$filters["ELEMENT"]] = "selected";
+                $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]?>>Rare</option>
-                    <option value='<?=ELEMENT_ID::LIGHT?>' <?=$selected[3]?>>Hero</option>
-                    <option value='<?=ELEMENT_ID::DARK?>' <?=$selected[4]?>>Legend</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'>

+ 123 - 41
application/view/monster.php

@@ -69,7 +69,8 @@
 ?>
                     <div id='monster_details'>
                         <div id='exp'>
-                            <span id='exp_bar' style='width:<?=$exp_pct?>%;'>
+                            <span id='exp_bar' style='width:<?=$exp_pct?>
+                            <span class='percent'>%</span>;'>
                             </span>
                             <span id='exp_text'>
                                 <?=$exp_txt?>
@@ -102,16 +103,6 @@
 ?>
                     </div>
                 </div>
-<?php
-                $building_attack = floor(($page->unit->attack * $page->building_stats["atk"] / 100) + ($page->unit->attack * $page->building_stats["elm"][$page->unit->unit->element] / 100));
-                $building_defense = floor($page->building_stats["def"] * $page->unit->defense / 100);
-                $building_hp = floor($page->building_stats["hp"] * $page->unit->hp / 100);
-                $building_speed = $page->building_stats["spd"];
-                $building_crit_rate = 0;
-                $building_crit_damage = $page->building_stats["crd"];
-                $building_accuracy = 0;
-                $building_resistance = 0;
-?>
                 <table id='stats'>
                     <tr>
                         <th>
@@ -123,6 +114,9 @@
                         <th>
                             Runes
                         </th>
+                        <th>
+                            Artifacts
+                        </th>
                         <th>
                             Buildings
                         </th>
@@ -136,15 +130,23 @@
                         </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'>
-                            +<?=$building_attack?>
+                            +<?=$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->attack + $page->unit->rune_attack + $building_attack?>
+                            <?=$page->unit->total_attack?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                     </tr>
                     <tr>
@@ -153,15 +155,23 @@
                         </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'>
-                            +<?=$building_defense?>
+                            +<?=$page->unit->building_defense?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                         <td class='total'>
-                            <?=$page->unit->defense + $page->unit->rune_defense + $building_defense?>
+                            <?=$page->unit->total_defense?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                     </tr>
                     <tr>
@@ -170,15 +180,23 @@
                         </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'>
-                            +<?=$building_hp?>
+                            +<?=$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->hp + $page->unit->rune_hp + $building_hp?>
+                            <?=$page->unit->total_hp?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                     </tr>
                     <tr>
@@ -187,15 +205,23 @@
                         </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'>
-                            +<?=$building_speed?>
+                            +<?=$page->unit->building_speed?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                         <td class='total'>
-                            <?=$page->unit->speed + $page->unit->rune_speed + $building_speed?>
+                            <?=$page->unit->total_speed?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                     </tr>
                     <tr>
@@ -203,16 +229,24 @@
                             CRR
                         </th>
                         <td class='base'>
-                            <?=$page->unit->crit_rate?>%
+                            <?=$page->unit->crit_rate?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='extra'>
-                            +<?=$page->unit->rune_crit_rate?>%
+                            +<?=$page->unit->rune_crit_rate?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='extra'>
-                            +<?=$building_crit_rate?>%
+                            +<?=$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->crit_rate + $page->unit->rune_crit_rate + $building_crit_rate?>%
+                            <?=$page->unit->total_crit_rate?>
+                            <span class='percent'>%</span>
                         </td>
                     </tr>
                     <tr>
@@ -220,16 +254,24 @@
                             CRD
                         </th>
                         <td class='base'>
-                            <?=$page->unit->crit_damage?>%
+                            <?=$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->rune_crit_damage?>%
+                            +<?=$page->unit->artifact_crit_damage?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='extra'>
-                            +<?=$building_crit_damage?>%
+                            +<?=$page->unit->building_crit_damage?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='total'>
-                            <?=$page->unit->crit_damage + $page->unit->rune_crit_damage + $building_crit_damage?>%
+                            <?=$page->unit->total_crit_damage?>
+                            <span class='percent'>%</span>
                         </td>
                     </tr>
                     <tr>
@@ -237,16 +279,24 @@
                             ACC
                         </th>
                         <td class='base'>
-                            <?=$page->unit->accuracy?>%
+                            <?=$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->rune_accuracy?>%
+                            +<?=$page->unit->artifact_accuracy?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='extra'>
-                            +<?=$building_accuracy?>%
+                            +<?=$page->unit->building_accuracy?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='total'>
-                            <?=$page->unit->accuracy + $page->unit->rune_accuracy + $building_accuracy?>%
+                            <?=$page->unit->total_accuracy?>
+                            <span class='percent'>%</span>
                         </td>
                     </tr>
                     <tr>
@@ -254,16 +304,42 @@
                             RES
                         </th>
                         <td class='base'>
-                            <?=$page->unit->resistance?>%
+                            <?=$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->rune_resistance?>%
+                            +<?=$page->unit->artifact_resistance?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='extra'>
-                            +<?=$building_resistance?>%
+                            +<?=$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->resistance + $page->unit->rune_resistance + $building_resistance?>%
+                            <?=$page->unit->effective_dmg?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                     </tr>
                 </table>
@@ -286,7 +362,8 @@
                             <td class='skill'>
                                 <img class='skill_img' src='<?=$page->unit->unit->leader_skill->get_image()?>'/>
                                 <span class='skill_level'>
-                                    &nbsp;
+                                    
+                            <span class='percent'>&nbsp;</span>
                                 </span>
                             </td>
 <?php
@@ -434,9 +511,11 @@
                     </tr>
                     <tr>
                         <td colspan='<?=$colspan?>' id='skill_averages'>
-                            Absolute skill-ups: <?=number_format($absolute_level * 100 / $absolute_max_level, 2)?>%
+                            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)?>%
+                            Ponderated skill-ups: <?=number_format($ponderated_level * 100 / $ponderated_max_level, 2)?>
+                            <span class='percent'>%</span>
                         </td>
                     </tr>
                 </table>
@@ -516,7 +595,8 @@
                             Avg. efficiency:
                         </td>
                         <td class='value'>
-                            <?=number_format($total_efficiency / $total_runes, 2)?>%
+                            <?=number_format($total_efficiency / $total_runes, 2)?>
+                            <span class='percent'>%</span>
                         </td>
                     </tr>
                     <tr>
@@ -524,7 +604,8 @@
                             Avg. max. efficiency:
                         </td>
                         <td class='value'>
-                            <?=number_format($total_max_efficiency / $total_runes, 2)?>%
+                            <?=number_format($total_max_efficiency / $total_runes, 2)?>
+                            <span class='percent'>%</span>
                         </td>
                     </tr>
                     <tr>
@@ -532,7 +613,8 @@
                             Avg. reached efficiency:
                         </td>
                         <td class='value'>
-                            <?=number_format($total_reached_efficiency / $total_runes, 2)?>%
+                            <?=number_format($total_reached_efficiency / $total_runes, 2)?>
+                            <span class='percent'>%</span>
                         </td>
                     </tr>
                 </table>

+ 110 - 35
application/view/monsters.php

@@ -92,16 +92,6 @@
                             <h4>
                                 <?=$mon->title?>
                             </h4>
-<?php
-                            $building_attack = floor(($mon->attack * $page->building_stats["atk"] / 100) + ($mon->attack * $page->building_stats["elm"][$mon->unit->element] / 100));
-                            $building_defense = floor($page->building_stats["def"] * $mon->defense / 100);
-                            $building_hp = floor($page->building_stats["hp"] * $mon->hp / 100);
-                            $building_speed = $page->building_stats["spd"];
-                            $building_crit_rate = 0;
-                            $building_crit_damage = $page->building_stats["crd"];
-                            $building_accuracy = 0;
-                            $building_resistance = 0;
-?>
                             <table class='stats'>
                                 <tr>
                                     <th>
@@ -114,7 +104,10 @@
                                         Runes
                                     </th>
                                     <th>
-                                        Buildings
+                                        Artif.
+                                    </th>
+                                    <th>
+                                        Bldg.
                                     </th>
                                     <th>
                                         Total
@@ -126,15 +119,23 @@
                                     </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'>
-                                        +<?=$building_attack?>
+                                        +<?=$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->attack + $mon->rune_attack + $building_attack?>
+                                        <?=$mon->total_attack?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                 </tr>
                                 <tr>
@@ -143,15 +144,23 @@
                                     </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'>
-                                        +<?=$building_defense?>
+                                        +<?=$mon->building_defense?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                     <td class='total'>
-                                        <?=$mon->defense + $mon->rune_defense + $building_defense?>
+                                        <?=$mon->total_defense?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                 </tr>
                                 <tr>
@@ -160,15 +169,23 @@
                                     </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'>
-                                        +<?=$building_hp?>
+                                        +<?=$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->hp + $mon->rune_hp + $building_hp?>
+                                        <?=$mon->total_hp?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                 </tr>
                                 <tr>
@@ -177,15 +194,23 @@
                                     </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'>
-                                        +<?=$building_speed?>
+                                        +<?=$mon->building_speed?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                     <td class='total'>
-                                        <?=$mon->speed + $mon->rune_speed + $building_speed?>
+                                        <?=$mon->total_speed?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                 </tr>
                                 <tr>
@@ -193,16 +218,24 @@
                                         CRR
                                     </th>
                                     <td class='base'>
-                                        <?=$mon->crit_rate?>%
+                                        <?=$mon->crit_rate?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$mon->rune_crit_rate?>%
+                                        +<?=$mon->rune_crit_rate?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$building_crit_rate?>%
+                                        +<?=$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->crit_rate + $mon->rune_crit_rate + $building_crit_rate?>%
+                                        <?=$mon->total_crit_rate?>
+                                        <span class='percent'>%</span>
                                     </td>
                                 </tr>
                                 <tr>
@@ -210,16 +243,24 @@
                                         CRD
                                     </th>
                                     <td class='base'>
-                                        <?=$mon->crit_damage?>%
+                                        <?=$mon->crit_damage?>
+                                        <span class='percent'>%</span>
+                                    </td>
+                                    <td class='extra'>
+                                        +<?=$mon->rune_crit_damage?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$mon->rune_crit_damage?>%
+                                        +<?=$mon->artifact_crit_damage?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$building_crit_damage?>%
+                                        +<?=$mon->building_crit_damage?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='total'>
-                                        <?=$mon->crit_damage + $mon->rune_crit_damage + $building_crit_damage?>%
+                                        <?=$mon->total_crit_damage?>
+                                        <span class='percent'>%</span>
                                     </td>
                                 </tr>
                                 <tr>
@@ -227,16 +268,24 @@
                                         ACC
                                     </th>
                                     <td class='base'>
-                                        <?=$mon->accuracy?>%
+                                        <?=$mon->accuracy?>
+                                        <span class='percent'>%</span>
+                                    </td>
+                                    <td class='extra'>
+                                        +<?=$mon->rune_accuracy?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$mon->rune_accuracy?>%
+                                        +<?=$mon->artifact_accuracy?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$building_accuracy?>%
+                                        +<?=$mon->building_accuracy?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='total'>
-                                        <?=$mon->accuracy + $mon->rune_accuracy + $building_accuracy?>%
+                                        <?=$mon->total_accuracy?>
+                                        <span class='percent'>%</span>
                                     </td>
                                 </tr>
                                 <tr>
@@ -244,16 +293,42 @@
                                         RES
                                     </th>
                                     <td class='base'>
-                                        <?=$mon->resistance?>%
+                                        <?=$mon->resistance?>
+                                        <span class='percent'>%</span>
+                                    </td>
+                                    <td class='extra'>
+                                        +<?=$mon->rune_resistance?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$mon->rune_resistance?>%
+                                        +<?=$mon->artifact_resistance?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$building_resistance?>%
+                                        +<?=$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->resistance + $mon->rune_resistance + $building_resistance?>%
+                                        <?=$mon->effective_dmg?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                 </tr>
                             </table>

+ 1 - 1
application/view/runs.php

@@ -219,7 +219,7 @@
 ?>
                                 <?=date_format($date, "Y/m/d H:i:s")?>
                             </td>
-                            <td class='team'>
+                            <td class='team <?=$class_frontline?>'>
 <?php
                                 if ($run->helper == 1){
                                     $enable_save = false;

+ 51 - 0
application/view/teams.php

@@ -78,6 +78,9 @@
                 }
             }
 
+            /**
+             * Parses the form data and generates the request to save a team.
+             */
             function saveTeam(){
                 if (selected_units > max_units){
                     alert('Too many units selected.');
@@ -193,6 +196,42 @@
                 xhttp.send(request);
 
             }
+            
+            /**
+             * Generates the request to delete a team.
+             *
+             * @param id Team id.
+             */
+            function deleteTeam(id){
+                if (!confirm("Permanently delete team?")){
+                    return
+                }
+                var request = 'uid=<?=$UID?>&id=' + id;
+                var xhttp = new XMLHttpRequest();
+                xhttp.onreadystatechange = function() {
+                    if (this.readyState == 4){ 
+                        if (this.status == 200){
+                            location.reload(); 
+                        }
+                        else{
+                            showError('Error deleting team. HTTP status ' + this.status)
+                        }
+                    }
+                };
+                xhttp.open("POST", "/action/delete_team/", true);
+                xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+                xhttp.send(request);
+            }
+
+            /**
+             * GOpens the team edit for with the selected team.
+             *
+             * @param id Team id.
+             */
+            function editTeam(id){
+                // TODO
+                alert("Function not implemented yet. Please delete the team and recreate it.");
+            }
 
             /**
              * Searches a unit with the pattern entered in the 'new_unit_id'
@@ -682,6 +721,9 @@
                         <th>
                             Units
                         </th>
+                        <th>
+                            Actions
+                        </th>
                     </tr>
 <?php
                     $odd = "odd";
@@ -733,6 +775,15 @@
                                 }
 ?>
                             </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 == ""){

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 17492 - 23090
install_data/install_base.sql


+ 34 - 0
install_data/install_data.sql

@@ -30,8 +30,36 @@ CREATE TABLE player(
     event_coin INT NOT NULL CHECK (event_coin >= 0),
     storage_slots INT NOT NULL CHECK (storage_slots >= 0),
     island INT NOT NULL CHECK (island >= 0),
+    joined TIMESTAMP,
+    top_rank_arena INT DEFAULT 0,
+    top_rank_world_arena INT DEFAULT 0,
+    top_rank_special_league INT DEFAULT 0,
+    top_rank_gw INT DEFAULT 0,
+    top_rank_siege INT DEFAULT 0,
+    top_rank_wboss INT DEFAULT 0,
+    top_rank_toan INT DEFAULT 0,
+    top_rank_toah INT DEFAULT 0,
     public INT NOT NULL DEFAULT 0 CHECK(public IN (0, 1))
 );
+CREATE TABLE record(
+    uid INT NOT NULL REFERENCES player(id),
+    area_type INT NOT NULL REFERENCES k_area_type,
+    area INT NOT NULL REFERENCES k_area,
+    stage INT CHECK(stage >= 0),
+    time INT,
+    score INT,
+    rank TEXT,
+    PRIMARY KEY (uid, area_type, area)
+);
+CREATE TABLE record_party(
+    uid INT NOT NULL REFERENCES player(id),
+    area_type INT NOT NULL REFERENCES k_area_type,
+    area INT NOT NULL REFERENCES k_area,
+    unit INT NOT NULL REFERENCES unit(id),
+    k_unit INT NOT NULL REFERENCES k_unit(id),
+    leader INT NOT NULL DEFAULT 0,
+    front INT NOT NULL DEFAULT 0
+);
 CREATE TABLE scenario(
     uid INT NOT NULL REFERENCES player(id),
     region INT NOT NULL REFERENCES k_area(id),
@@ -46,6 +74,12 @@ CREATE TABLE defense(
     position INT NOT NULL CHECK(position BETWEEN 1 AND 4),
     PRIMARY KEY (uid, unit)
 );
+CREATE TABLE gw_defense(
+    uid INT NOT NULL REFERENCES player(id),
+    unit INT NOT NULL REFERENCES unit(id),
+    position INT NOT NULL CHECK(position BETWEEN 1 AND 6),
+    PRIMARY KEY (uid, unit)
+);
 CREATE TABLE unit(
     uid INT NOT NULL REFERENCES player(id),
     id INT PRIMARY KEY NOT NULL,

+ 0 - 4
public/css/fusion.css

@@ -60,11 +60,9 @@ div.owned span.owned{
 div.owned div.monster_panel{
     display: inline-block;
     font-size: 60%;
-    margin: -0.2em;
 }
 @media screen and (max-width : 990px){
     div.owned div.monster_panel{
-        margin: -0.2em -0.2em -2em -0.2em;
     }
 }
 
@@ -194,7 +192,6 @@ div.f4.extra > div.product{
 div.f4 > div.product > a > div.unawakened{
     display: inline-block;
     vertical-align: top;
-    width: 6em;
 }
 @media screen and (max-width : 990px){
     div.f4 > div.product > a > div.unawakened{
@@ -229,7 +226,6 @@ div.f4.extra > div.product > div.essences{
 div.f4 > div.product > a > div.awakened{
     display: inline-block;
     vertical-align: top;
-    width: 6em;
 }
 div.f4.extra > div.product > a > div.awakened{
     vertical-align: middle;

+ 149 - 39
public/css/home.css

@@ -2,28 +2,21 @@ article#profile{
     text-align: center;
 }
 
-article#profile h3 span#user_name{
-    font-size: 160%;
-    font-weight: bold;
-    display: block;
-}
-
-article#profile h3 span#user_level{
-    font-size: 100%;
-}
-
-article#profile h3 span#user_level span#user_exp{
-    font-style: italic;
-    font-weight: normal;
+div.panel{
+    width: 49%;
+    margin: 0;
+    padding: 0;
+    display: inline-block;
+    vertical-align: top;
 }
 
 article#profile div.profile_section{
     border: 0.2em solid var(--ui-color-border);
-    max-width: 45%;
+/*     max-width: 45%; */
     margin: 0.5em;
     padding: 0 0.5em 0.5em 0.5em;
     border-radius: 0.5em;
-    display: inline-block;
+    display: block;
     vertical-align: top;
     text-align: center;
     background-color: #00000033;
@@ -46,31 +39,47 @@ article#profile div.profile_section h4{
     background-color: #00000033;
 }
 
-article#profile div#rep div.monster_panel{
-    font-size: 50%;
-    margin: 0.2em;
+article#profile div#player table{
+    border-collapse: collapse;
+    margin: 0 auto;
 }
-@media screen and (max-width : 990px){
-    article#profile div#rep div.monster_panel{font-size: 70%;}
+
+article#profile div#player table td{
+    border-top: 0.1em solid #00000077;
+    border-bottom: 0.1em solid #00000077;
 }
 
-article#profile div#defense{
-    position: relative;
+article#profile div#player table td.label{
+    text-align: left;
+    padding-right: 1.5em;
+}
+article#profile div#player table td.value{
+    text-align: right;
+}
+
+article#profile div#placements h5{
+    font-weight: bold;
+    margin-top: 0.5em;
+    margin-bottom: 0.3em;
 }
 
-article#profile div#defense div.monster_panel{
-    font-size: 50%;
+article#profile div#placements div#placements_rep div.monster_panel{
+    font-size: 45%;
     margin: 0.2em;
 }
 
-article#profile div#defense div.skill{
-    position: absolute;
-    left: 0.2em;
-    top: 4em;
+article#profile div#placements div#placements_arena div.monster_panel{
+    font-size: 35%;
+    margin: 0.15em;
 }
-article#profile div#defense div.skill img{
-    width: 1.5em;
-    height: 1.5em;
+
+article#profile div#placements div#placements_gw div.monster_panel{
+    font-size: 40%;
+    margin: 0.2em;
+}
+article#profile div#placements div#placements_gw hr{
+    width: 12em;
+    margin: 0.1em auto;
 }
 
 article#profile div#building div.building_panel{
@@ -91,7 +100,7 @@ article#profile div#building div.building_panel img.building, img.decoration{
     border-radius: 15%;
 }
 
-article#profile div#decoration div.building_panel{
+article#profile div#building div.building_panel{
     display: inline-block;
     width: 2em;
     height: 2em;
@@ -101,7 +110,7 @@ article#profile div#decoration div.building_panel{
     vertical-align: middle;
 }
 
-article#profile div#decoration div.building_panel img.building, img.decoration{
+article#profile div#building div.building_panel img.building, img.decoration{
     width: 2em;
     height: 2em;
     border-style: solid;
@@ -109,7 +118,7 @@ article#profile div#decoration div.building_panel img.building, img.decoration{
     border-radius: 15%;
 }
 
-article#profile div#decoration div.building_panel span.level{
+article#profile div#building div.building_panel span.level{
     position: relative;
     bottom: 1.6em;
     font-weight: bold;
@@ -155,17 +164,118 @@ article#profile div.inventory div.item_panel span.amount{
     pointer-events: none;
 }
 
-article#profile div#currency{
-    text-align: left;
-}
 
-article#profile div#currency ul{
+article#profile div#inventory ul{
     column-count: 2;
+    text-align: left;
+    margin: 0.5em auto;
 }
 
 
-article#profile div#currency ul li img{
+article#profile div#inventory ul li img{
     height: 1.2em;
     width: 1.2em;
     vertical-align: middle;
 }
+
+article#profile div#records div.record table#rank_records{
+    border-collapse: collapse;
+    margin: 0 auto;
+}
+
+article#profile div#records div.record table#rank_records td{
+    border-top: 0.1em solid #00000077;
+    border-bottom: 0.1em solid #00000077;
+}
+
+article#profile div#records div.record table#rank_records td.label{
+    text-align: left;
+    padding-right: 1.5em;
+}
+article#profile div#records div.record table#rank_records td.value{
+    text-align: center;
+}
+article#profile div#records div.record table#rank_records td.value.rank img{
+    width: 1.5em;
+    height: 1.5em;
+}
+article#profile div#records div.record table#rank_records td.value.wboss{
+    font-size: 110%;
+    color: #ff6633;
+    text-shadow: 0 0 0.1em #000, 0 0 0.1em #000, 0 0 0.1em #000, 0 0 0.1em #000, 0 0 0.1em #000, 0 0 0.2em #ff0, 0 0 0.2em #ff0, 0 0 0.2em #ff0, 0 0 0.2em #ff0;
+    font-style: italic;
+}
+
+article#profile div#records div.record table#rank_records td.value.toa{
+    font-size: 110%;
+    font-weight: bold;
+}
+
+article#profile div#records div.record table#battle_records{
+    border-collapse: collapse;
+    margin: 0 auto;
+}
+
+article#profile div#records div.record table#battle_records td{
+    border-top: 0.1em solid #00000077;
+    border-bottom: 0.1em solid #00000077;
+}
+article#profile div#records div.record table#battle_records td.record_dungeon img{
+    width: 2em;
+    height: 2em;
+    border: 0.2em solid #555555;
+    border-radius: 0.5em;
+    background-color: #777777;
+}
+
+article#profile div#records div.record table#battle_records td.record_party{
+    font-size: 30%;
+    width: 45em;
+}
+
+article#profile div#records div.record table#battle_records td.record_party.frontlines{
+    font-size: 25%;
+}
+
+article#profile div#records div.record table#battle_records td.record_party hr{
+    width: 33em;
+}
+
+article#profile div#records div.record table#battle_records td.record_info{
+    text-align: left;
+}
+
+article#profile div#records div.record table#battle_records td.record_info span.title{
+    font-weight: bold;
+    font-size: 75%;
+}
+
+article#profile div#records div.record table#battle_records td.record_info span.title{
+    font-weight: bold;
+    font-size: 110%;
+    display: block;
+    margin: 0.1em;
+}
+
+article#profile div#records div.record table#battle_records td.record_info span.time{
+    font-size: 90%;
+    font-style: italic;
+}
+article#profile div#records div.record table#battle_records td.record_info span.time span.ms{
+    font-size: 70%;
+}
+
+article#profile div#records div.record table#battle_records td.record_info span.rank{
+    display: inline-block;
+    vertical-align: bottom;
+    font-size: 100%;
+    color: #ff6633;
+    text-shadow: 0 0 0.1em #000, 0 0 0.1em #000, 0 0 0.1em #000, 0 0 0.1em #000, 0 0 0.1em #000, 0 0 0.2em #ff0, 0 0 0.2em #ff0, 0 0 0.2em #ff0, 0 0 0.2em #ff0;
+    font-style: italic;
+}
+article#profile div#records div.record table#battle_records td.record_info span.score{
+    font-size: 90%;
+    font-style: italic;
+}
+
+

+ 8 - 1
public/css/monster.css

@@ -24,7 +24,6 @@ section#monster article#profile div#monster_info{
 section#monster article#profile div#monster_info div#monster_details{
     display: block;
     font-size: 70%;
-    margin-top: -3em;
 }
 
 section#monster article#profile div#monster_info div#monster_details div#teams{
@@ -77,6 +76,14 @@ section#monster article#profile table#stats th{
 section#monster article#profile table#stats td{
     font-weight: bold;
     background-color: #ffffff33;
+    text-align: right;
+    font-family: monospace;
+    font-size: 120%;
+}
+
+section#monster article#profile table#stats td span.percent{
+    margin: 0 0 0 -0.7em;
+    font-size: 80%;
 }
 
 section#monster article#profile table#stats td, th{

+ 11 - 0
public/css/monsters.css

@@ -50,8 +50,18 @@ section.list div.monster div.monster_tooltip table.stats tr{
 }
 
 section.list div.monster div.monster_tooltip table.stats td{
+    border: 0.1em solid #00000055;
     border-bottom: 0.1em solid black;
     color: #cccccc;
+    text-align: right;
+    font-family: monospace;
+    font-size: 120%;
+    min-width: 4.5em;
+}
+
+section.list div.monster div.monster_tooltip table.stats td span.percent{
+    margin: 0 0 0 -0.7em;
+    font-size: 80%;
 }
 
 section.list div.monster div.monster_tooltip table.stats td.extra{
@@ -61,6 +71,7 @@ section.list div.monster div.monster_tooltip table.stats td.extra{
 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{

+ 17 - 0
public/css/teams.css

@@ -74,6 +74,23 @@ table#teams td.units div.monster_panel img.leader{
     left: -0.7em;
 }
 
+table#teams td.action{
+    text-align: center;
+}
+table#teams td.action a{
+    display: inline-block;
+    width: 1.5em;
+    height: 1.5em;
+}
+
+table#teams td.action a img{
+    display: inline-block;
+    width: 1em;
+    margin-top: 0.25em;
+    margin-left: 0.25em;
+    height: 1em;
+}
+
 section#new_team{
     z-index: 1;
     display: none;

+ 10 - 3
public/css/ui.css

@@ -298,9 +298,9 @@ footer table#footer_table td{
 }
 input, select, a.a_button, textarea{
     font-size: 100%;
+    
     text-transform: capitalize;
     font-variant: small-caps;
-    cursor: pointer;
     color: var(--input-color);
     font-weight: var(--input-font-weight);
     padding: var(--input-padding);
@@ -310,6 +310,14 @@ input, select, a.a_button, textarea{
     text-shadow: var(--input-text-shadow);
     box-shadow: var(--input-box-shadow);
 }
+a.a_button, input[type=button]{
+    cursor: pointer;
+}
+input[type=text], textarea{
+    text-transform: initial;
+    font-variant: initial;
+}
+
 input[type=button], input[type=submit]{padding: var(--input-button-padding);}
 input[type=text], input[type=number], input[type=date], input[type=password], select{font-size: 80%;}
 input[type=number]{width: 3em;}
@@ -579,6 +587,7 @@ div.monster_panel{
     margin: 0.5em;
     position: relative;
     border-radius: 15%;
+    overflow: hidden;
 }
 
 @media screen and (max-width : 990px){
@@ -654,7 +663,6 @@ div.monster_panel span.badges{
     bottom: 0.6em;
     left: 0.1em;
     z-index: 1;
-    pointer-events: none;
     display: block;
     transform: rotate(180deg);
 }
@@ -662,7 +670,6 @@ div.monster_panel span.badges{
 div.monster_panel span.badges img{
     width: 1em;
     height: 1em;
-    /* filter: drop-shadow(0 0 0.3em #ffffff) drop-shadow(0 0 0.1em #ffffff); */
     border-radius: 50%;
     border: 0.15em solid #000000;
     background-color: #ffffff;

BIN=BIN
public/img/icon/edit.png


+ 0 - 0
public/img/icon/rank_beg.png → public/img/rank/0901.png


+ 0 - 0
public/img/icon/rank_cha1.png → public/img/rank/1001.png


+ 0 - 0
public/img/icon/rank_cha2.png → public/img/rank/1002.png


+ 0 - 0
public/img/icon/rank_cha3.png → public/img/rank/1003.png


+ 0 - 0
public/img/icon/rank_fig1.png → public/img/rank/2001.png


+ 0 - 0
public/img/icon/rank_fig2.png → public/img/rank/2002.png


+ 0 - 0
public/img/icon/rank_fig3.png → public/img/rank/2003.png


+ 0 - 0
public/img/icon/rank_con1.png → public/img/rank/3001.png


+ 0 - 0
public/img/icon/rank_con2.png → public/img/rank/3002.png


+ 0 - 0
public/img/icon/rank_con3.png → public/img/rank/3003.png


+ 0 - 0
public/img/icon/rank_gua1.png → public/img/rank/4001.png


+ 0 - 0
public/img/icon/rank_gua2.png → public/img/rank/4002.png


+ 0 - 0
public/img/icon/rank_gua3.png → public/img/rank/4003.png


+ 0 - 0
public/img/icon/rank_leg.png → public/img/rank/5001.png


BIN=BIN
public/img/skill/00003217.png


BIN=BIN
public/img/skill/00003218.png


BIN=BIN
public/img/skill/00013716.png


BIN=BIN
public/img/skill/00013901.png


BIN=BIN
public/img/skill/00013902.png


BIN=BIN
public/img/skill/00013903.png


BIN=BIN
public/img/skill/00013904.png


BIN=BIN
public/img/skill/00013905.png


BIN=BIN
public/img/skill/00013906.png


BIN=BIN
public/img/skill/00013907.png


BIN=BIN
public/img/skill/00013908.png


BIN=BIN
public/img/skill/00013909.png


BIN=BIN
public/img/skill/00013910.png


BIN=BIN
public/img/skill/00013911.png


BIN=BIN
public/img/skill/00013912.png


BIN=BIN
public/img/skill/00013913.png


BIN=BIN
public/img/skill/00013914.png


BIN=BIN
public/img/skill/00013915.png


BIN=BIN
public/img/skill/00013916.png


BIN=BIN
public/img/skill/00013917.png


BIN=BIN
public/img/skill/00013918.png


BIN=BIN
public/img/skill/00013919.png


BIN=BIN
public/img/skill/00014002.png


BIN=BIN
public/img/skill/00014007.png


BIN=BIN
public/img/skill/00014012.png


BIN=BIN
public/img/skill/00014101.png


BIN=BIN
public/img/skill/00014102.png


BIN=BIN
public/img/skill/00014103.png


BIN=BIN
public/img/skill/00014104.png


BIN=BIN
public/img/skill/00014105.png


BIN=BIN
public/img/skill/00014106.png


BIN=BIN
public/img/skill/00014107.png


BIN=BIN
public/img/skill/00014108.png


BIN=BIN
public/img/skill/00014109.png


BIN=BIN
public/img/skill/00014110.png


BIN=BIN
public/img/skill/00014111.png


BIN=BIN
public/img/skill/00014112.png


BIN=BIN
public/img/skill/00014113.png


BIN=BIN
public/img/skill/00014114.png


BIN=BIN
public/img/skill/00014115.png


BIN=BIN
public/img/skill/00014116.png


BIN=BIN
public/img/skill/00014201.png


BIN=BIN
public/img/skill/00014202.png


BIN=BIN
public/img/skill/00014203.png


BIN=BIN
public/img/skill/00014204.png


BIN=BIN
public/img/skill/00014205.png


BIN=BIN
public/img/skill/00014206.png


BIN=BIN
public/img/skill/00014207.png


BIN=BIN
public/img/skill/00014208.png


BIN=BIN
public/img/skill/00014209.png


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio