Procházet zdrojové kódy

Inventory. Changes in the home page to show it.

Iñigo Valentin před 7 roky
rodič
revize
85e94087cd

+ 56 - 0
application/entity/Building.php

@@ -0,0 +1,56 @@
+<?php
+
+    require_once($path["entity"] . "Entity.php");
+    require_once($path["entity"] . "K_Building.php");
+
+
+    /**
+     * A Building.
+     *
+     * Represents an object from the table 'building'.
+     */
+    class Building extends Entity{
+
+        /**
+         * Owner identifier.
+         */
+        public $uid;
+
+        /**
+         * {@see K_Building}.
+         */
+        public $building;
+
+        /**
+         * I honestly don't know what the gin is.
+         */
+        public $gain;
+
+        /**
+         * Constructor.
+         *
+         * Searches the database and retrieves the information about the
+         * building, populating it and it's items.
+         *
+         * @param SQLite3 $db Connection to the database.
+         * @param int $id Building identifier.
+         */
+        public function __construct($db, $id){
+            global $path;
+            parent::__construct($db);
+            $s = "
+                SELECT
+                  uid,
+                  building,
+                  gain
+                FROM building
+                WHERE building = $id;
+            ";
+            $q = $this->db->query($s);
+            $r = $q->fetchArray(SQLITE3_ASSOC);
+            $this->uid = $r["uid"];
+            $this->building = new K_Building($this->db, $r["building"]);
+            $this->gain = $r["gain"];
+        }
+    }
+?>

+ 56 - 0
application/entity/Decoration.php

@@ -0,0 +1,56 @@
+<?php
+
+    require_once($path["entity"] . "Entity.php");
+    require_once($path["entity"] . "K_Decoration.php");
+
+
+    /**
+     * A Decoration.
+     *
+     * Represents an object from the table 'decoration'.
+     */
+    class Decoration extends Entity{
+
+        /**
+         * Owner identifier.
+         */
+        public $uid;
+
+        /**
+         * {@see K_Decoration}.
+         */
+        public $decoration;
+
+        /**
+         * I honestly don't know what the gin is.
+         */
+        public $level;
+
+        /**
+         * Constructor.
+         *
+         * Searches the database and retrieves the information about the
+         * decoration, populating it and it's items.
+         *
+         * @param SQLite3 $db Connection to the database.
+         * @param int $id Building identifier.
+         */
+        public function __construct($db, $id){
+            global $path;
+            parent::__construct($db);
+            $s = "
+                SELECT
+                  uid,
+                  decoration,
+                  level
+                FROM decoration
+                WHERE decoration = $id;
+            ";
+            $q = $this->db->query($s);
+            $r = $q->fetchArray(SQLITE3_ASSOC);
+            $this->uid = $r["uid"];
+            $this->decoration = new K_Decoration($this->db, $r["decoration"]);
+            $this->level = $r["level"];
+        }
+    }
+?>

+ 106 - 0
application/entity/Inventory.php

@@ -0,0 +1,106 @@
+<?php
+
+    require_once($path["entity"] . "Entity.php");
+    require_once($path["entity"] . "K_Unit.php");
+
+
+    /**
+     * An inventory item.
+     *
+     * Represents an object from the table 'inventory'.
+     */
+    class Inventory extends Entity{
+
+        /**
+         * Owner identifier.
+         */
+        public $uid;
+
+        /**
+         * Item identifier. If its a monster piece, a {@see K_Monster} entity.
+         */
+        public $id;
+
+        /**
+         * Item type name.
+         */
+        public $type;
+
+        /**
+         * Item type name.
+         */
+        public $ammount;
+
+        /**
+         * Indicates if the item are monster pieces.
+         */
+        public $is_monster_pices;
+
+        /**
+         * Constructor.
+         *
+         * Searches the database and retrieves the information about the
+         * building, populating it and it's items.
+         *
+         * @param SQLite3 $db Connection to the database.
+         * @param int $id Building identifier.
+         */
+        public function __construct($db, $id){
+            global $path;
+            global $INVENTORY_TYPE;
+            parent::__construct($db);
+            $s = "
+                SELECT
+                  inventory.id AS id,
+                  k_inventory.name AS name,
+                  k_inventory.description AS description,
+                  inventory.type AS type_ref,
+                  k_inventory_type.name AS type,
+                  inventory.amount AS amount
+                FROM
+                  inventory,
+                  k_inventory_type
+                LEFT JOIN k_inventory ON
+                   k_inventory.id = inventory.id
+                WHERE
+                  inventory.type = k_inventory_type.id AND
+                  inventory.id = $id;
+            ";
+            $q = $this->db->query($s);
+            $r = $q->fetchArray(SQLITE3_ASSOC);
+            $this->type = $r["type"];
+            $this->amount = $r["amount"];
+            if ($r["type"] == $INVENTORY_TYPE["GUILD_MONSTER_PIECE"] || $r["type"] == $INVENTORY_TYPE["MONSTER_PIECE"]){
+                $this->is_monster_pices = true;
+                $this->id = new K_Unit($this->db, $r["id"]);
+                $this->name = $this->id->title . " Pieces";
+                $this->description = $this->id->title . " Pieces";
+            }
+            else{
+                $this->is_monster_pices = false;
+                $this->id = $r["id"];
+                $this->name = $r["name"];
+                $this->description = $r["description"];
+            }
+        }
+
+        /**
+         * Gets the path to the item image. The image must be in the
+         * img/content/inventory/ directory, and its name must be the monster id,
+         * padded with '0' to 9 digites, and the extension must be '.png'.
+         *
+         * @return path to the image, or a path to a fixed unknown image if it
+         *         doesn't exist.
+         */
+        public function get_image(){
+            global $base_dir;
+            global $path;
+            if (file_exists($base_dir . "img/content/inventory/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png")){
+                return $path["img"]["content"] . "inventory/" . str_pad($this->id, 9, '0', STR_PAD_LEFT) . ".png";
+            }
+            else{
+                return $path["img"]["layout"] . "unknown.png";
+            }
+        }
+    }
+?>

+ 14 - 21
application/entity/K_Building.php

@@ -4,40 +4,35 @@
 
 
     /**
-     * Monster source.
+     * Building.
      *
-     * Represents an object from the table 'k_source'.
+     * Represents an object from the table 'k_building'.
      */
-    class K_Source extends Entity{
+    class K_Building extends Entity{
 
         /**
-         * Monster identifier.
+         * Building identifier.
          */
         public $id;
 
         /**
-         * Source name.
+         * Building name.
          */
         public $name;
 
         /**
-         * Source description.
+         * Building description.
          */
         public $description;
 
-        /**
-         * Indicates if the source is farmable.
-         */
-        public $farmable_source;
-
         /**
          * Constructor.
          *
          * Searches the database and retrieves the information about the
-         * monster, populating it and it's items.
+         * building, populating it and it's items.
          *
          * @param SQLite3 $db Connection to the database.
-         * @param int $id Monster identifier.
+         * @param int $id Building identifier.
          */
         public function __construct($db, $id){
             global $path;
@@ -46,9 +41,8 @@
               "SELECT " .
               "  id, " .
               "  name, " .
-              "  description, " .
-              "  farmable_source " .
-              "FROM k_source " .
+              "  description " .
+              "FROM k_building " .
               "WHERE id = $id; ";
             $q = $this->db->query($s);
             $r = $q->fetchArray(SQLITE3_ASSOC);
@@ -56,13 +50,12 @@
                 $this->id = $r["id"];
                 $this->name = $r["name"];
                 $this->description = $r["description"];
-                $this->farmable_source = $r["farmable_source"];
             }
         }
 
         /**
-         * Gets the pathto the monster image. The image must be in the
-         * img/content/monster/ directory, and its name must be the monster id,
+         * Gets the path to the building image. The image must be in the
+         * img/content/building/ directory, and its name must be the monster id,
          * padded with '0' to 4 digites, and the extension must be '.png'.
          *
          * @return path to the image, or a path to a fixed unknown image if it
@@ -71,8 +64,8 @@
         public function get_image(){
             global $base_dir;
             global $path;
-            if (file_exists($base_dir . "img/content/source/" . str_pad($this->id, 4, '0', STR_PAD_LEFT) . ".png")){
-                return $path["img"]["content"] . "source/" . str_pad($this->id, 4, '0', STR_PAD_LEFT) . ".png";
+            if (file_exists($base_dir . "img/content/building/" . str_pad($this->id, 4, '0', STR_PAD_LEFT) . ".png")){
+                return $path["img"]["content"] . "building/" . str_pad($this->id, 4, '0', STR_PAD_LEFT) . ".png";
             }
             else{
                 return $path["img"]["layout"] . "unknown.png";

+ 128 - 0
application/entity/K_Decoration.php

@@ -0,0 +1,128 @@
+<?php
+
+    require_once($path["entity"] . "Entity.php");
+
+
+    /**
+     * Decoration.
+     *
+     * Represents an object from the table 'k_decoration'.
+     */
+    class K_Decoration extends Entity{
+
+        /**
+         * Decoration identifier.
+         */
+        public $id;
+
+        /**
+         * Decoration name.
+         */
+        public $name;
+
+        /**
+         * Decoration description.
+         */
+        public $description;
+
+        /**
+         * Area of effect (if any).
+         */
+        public $area;
+
+        /**
+         * Affected stat (if any).
+         */
+        public $stat;
+
+        /**
+         * Affected element (if any).
+         */
+        public $element;
+
+        /**
+         * Max. level ().
+         */
+        public $max_level;
+
+        /**
+         * Effect bonus per level.
+         */
+        public $level_bonus = [];
+
+        /**
+         * Cost per level.
+         */
+        public $level_cost = [];
+
+        /**
+         * Constructor.
+         *
+         * Searches the database and retrieves the information about the
+         * decoration, populating it and it's items.
+         *
+         * @param SQLite3 $db Connection to the database.
+         * @param int $id Decoration identifier.
+         */
+        public function __construct($db, $id){
+            global $path;
+            parent::__construct($db);
+            $s = "
+                SELECT
+                  id,
+                  name,
+                  description,
+                  area,
+                  affected_stat,
+                  element,
+                  max_level
+                FROM k_decoration
+                WHERE id = $id;
+            ";
+            $q = $this->db->query($s);
+            $r = $q->fetchArray(SQLITE3_ASSOC);
+            if ($r){
+                $this->id = $r["id"];
+                $this->name = $r["name"];
+                $this->description = $r["description"];
+                $this->area = $r["area"];
+                $this->stat = $r["affected_stat"];
+                $this->element = $r["element"];
+                $this->max_level = $r["max_level"];
+                $s = "
+                    SELECT
+                      level,
+                      bonus,
+                      cost
+                    FROM k_decoration_level
+                    WHERE decoration = $id
+                ";
+                $q = $this->db->query($s);
+                while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                    $this->level_bonus[$r["level"]] = $r["bonus"];
+                    $this->level_cost[$r["level"]] = $r["cost"];
+                }
+            }
+        }
+
+        /**
+         * Gets the path to the building image. The image must be in the
+         * img/content/decoration/ directory, and its name must be the monster id,
+         * padded with '0' to 4 digites, and the extension must be '.png'.
+         *
+         * @return path to the image, or a path to a fixed unknown image if it
+         *         doesn't exist.
+         */
+        public function get_image(){
+            global $base_dir;
+            global $path;
+            if (file_exists($base_dir . "img/content/decoration/" . str_pad($this->id, 4, '0', STR_PAD_LEFT) . ".png")){
+                return $path["img"]["content"] . "decoration/" . str_pad($this->id, 4, '0', STR_PAD_LEFT) . ".png";
+            }
+            else{
+                return $path["img"]["layout"] . "unknown.png";
+            }
+        }
+
+    }
+?>

+ 73 - 1
application/helper/html.php

@@ -16,7 +16,7 @@
         elseif ($unit instanceof K_Unit){
             $k = $unit;
             $stars = $unit->base_stars;
-            $level = $false;
+            $level = false;
         }
         else{
             return "";
@@ -305,4 +305,76 @@
         return $html;
     }
 
+    /**
+     * Generates a building panel.
+     *
+     * @param unit Building/Decoration/K_Building/K_Decoration Entity to get the info from.
+     * @return string HTML content for a building panel. Empty on error.
+     */
+    function html_building_panel($building) {
+        global $path;
+        if ($building instanceof Building){
+            $level = false;
+            $title = $building->building->name;
+            $description = $building->building->description;
+            $img = $building->building->get_image();
+        }
+        elseif ($building instanceof K_Building){
+            $level = false;
+            $title = $building->name;
+            $description = $building->building->description;
+            $img = $building->get_image();
+        }
+        elseif ($building instanceof Decoration){
+            $level = $building->level;
+            $title = $building->decoration->name;
+            $description = $building->decoration->description;
+            $img = $building->decoration->get_image();
+        }
+        elseif ($building instanceof K_Decoration){
+            $level = false;
+            $title = $building->name;
+            $description = $building->building->description;
+            $img = $building->get_image();
+        }
+        else{
+            return "";
+        }
+        if (strlen($description) > 0){
+            $title .= ": " . $description;
+        }
+        $html = "";
+        $html = "<div class='building_panel'>\n";
+        $html .= "<img title='" . $title . "' class='building' src='" . $img . "'/>\n";
+        if ($level){
+            $html .= "<span class='level'>\n";
+            $html .= $level . "\n";
+            $html .= "</span>\n";
+        }
+        $html .= "</div>\n";
+        return $html;
+    }
+
+    /**
+     * Generates a item panel.
+     *
+     * @param item Inventory Entity to get the info from.
+     * @return string HTML content for a building panel. Empty on error.
+     */
+    function html_item_panel($item) {
+        global $path;
+        global $INVENTORY_TYPE;
+        if (!($item instanceof Inventory)){
+            return "";
+        }
+        $html = "";
+        $html = "<div class='item_panel'>\n";
+        $html .= "<img title='" . $item->name . "' class='item' src='" . $item->get_image() . "'/>\n";
+        $html .= "<span class='amount'>\n";
+        $html .= $item->amount . "\n";
+        $html .= "</span>\n";
+        $html .= "</div>\n";
+        return $html;
+    }
+
 ?>

+ 128 - 0
application/page/Home_Page.php

@@ -2,6 +2,9 @@
 
     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");
 
 
     /**
@@ -34,6 +37,11 @@
          */
         public $rep;
 
+        /**
+         * {@see Unit}s in Arena defense.
+         */
+        public $defense = [];
+
         /**
          * Currency
          */
@@ -58,6 +66,36 @@
             "costume_point" => 0,
         ];
 
+        /**
+         * List of {@see Building}s.
+         */
+        public $building = [];
+
+        /**
+         * List of {@see Decoration}s.
+         */
+        public $decoration = [];
+
+        /**
+         * List of Scrolls in {@see Inventory}s.
+         */
+        public $inventory_scroll = [];
+
+        /**
+         * List of rune crafting items in {@see Inventory}s.
+         */
+        public $inventory_craft_rune = [];
+
+        /**
+         * List of rune crafting items in {@see Inventory}s.
+         */
+        public $inventory_craft = [];
+
+        /**
+         * List of rune crafting items in {@see Inventory}s.
+         */
+        public $inventory_essence = [];
+
         /**
          * Constructor.
          *
@@ -69,6 +107,7 @@
         public function __construct($db){
             global $path;
             global $root;
+            global $INVENTORY_TYPE;
             parent::__construct($db);
             $this->view = $path["view"] . "home.php";
             // TODO:Filter by player?
@@ -125,6 +164,95 @@
                 $this->currency["social_point"] = $r["social_point"];
                 $this->currency["costume_point"] = $r["costume_point"];
             }
+            $s = "
+                SELECT unit
+                FROM defense
+                ORDER BY position;
+            ";
+            $q = $this->db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->defense, new Unit($db, $r["unit"], false));
+            }
+            $s = "
+                SELECT DISTINCT building
+                FROM building;
+            ";
+            $q = $this->db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->building, new Building($db, $r["building"]));
+            }
+            $s = "
+                SELECT decoration
+                FROM decoration;
+            ";
+            $q = $this->db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->decoration, new Decoration($db, $r["decoration"]));
+            }
+            $s = "
+                SELECT id
+                FROM inventory
+                WHERE
+                  type = " . $INVENTORY_TYPE["SCROLL"] . " AND
+                  amount > 0;
+            ";
+            $q = $this->db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->inventory_scroll, new Inventory($db, $r["id"]));
+            }
+            // Rune crafting items are marked as generic crafting.
+            $s = "
+                SELECT inventory.id
+                FROM
+                  inventory,
+                  k_inventory
+                WHERE
+                  inventory.id = k_inventory.id AND
+                  k_inventory.type = " . $INVENTORY_TYPE["RUNE_CRAFT"] . " AND
+                  amount > 0;
+            ";
+            $q = $this->db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->inventory_craft_rune, new Inventory($db, $r["id"]));
+            }
+            $s = "
+                SELECT inventory.id
+                FROM
+                  inventory,
+                  k_inventory
+                WHERE
+                  inventory.id = k_inventory.id AND
+                  k_inventory.type = " . $INVENTORY_TYPE["CRAFT_STUFF"] . " AND
+                  amount > 0;
+            ";
+            $q = $this->db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->inventory_craft, new Inventory($db, $r["id"]));
+            }
+            $s = "
+                SELECT inventory.id AS id
+                FROM
+                  inventory,
+                  k_inventory
+                WHERE
+                  k_inventory.id = inventory.id AND
+                  k_inventory.type = " . $INVENTORY_TYPE["ESSENCES"] . "
+                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 = $this->db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->inventory_essence, new Inventory($db, $r["id"]));
+            }
             $this->title = "SWDB";
             $this->description = "Summoners War DataBase";
             $this->canonical = $root;

+ 102 - 46
application/view/home.php

@@ -45,90 +45,146 @@
                 </h3>
                 <div id='info'>
 <?php
-                    //if (isset($page->rep)){
-                        if ($page->rep->unit->awakens_from == "" && $page->rep->unit->awakens_to == ""){
-                            // No to, no from, silver monster.
-                            $star_class ="star_silver";
-                            $mon_title = $page->rep->unit->element . " " . $page->rep->unit->name;
+                    if (isset($page->rep)){
+?>
+                        <div id='rep'>
+                            <h4>
+                                Rep. Monster:
+                            </h4>
+                            <div class='monster_panel'>
+                                <?=html_unit_panel($page->rep)?>
+                            </div> <!-- .monster_panel -->
+                        </div>
+<?php
+                    } // if (isset($page->rep))
+?>
+                    <div id='defense'>
+                        <h4>
+                            Arena defense:
+                        </h4>
+<?php
+                        foreach ($page->defense as $defense){
+?>
+                            <div class='monster_panel'>
+                                <?=html_unit_panel($defense)?>
+                            </div>
+<?php
+                        }
+?>
+                    </div>
+                    <div id='building'>
+                        <h4>
+                            Buildings:
+                        </h4>
+<?php
+                        foreach ($page->building as $building){
+?>
+                            <?=html_building_panel($building)?>
+<?php
+                        }
+?>
+                    </div>
+                    <div id='decoration'>
+                        <h4>
+                            Decorations:
+                        </h4>
+<?php
+                        foreach ($page->decoration as $decoration){
+?>
+                            <?=html_building_panel($decoration)?>
+<?php
                         }
-                        elseif ($page->rep->unit->awakens_from =! "" && $page->rep->unit->awakens_to == ""){
-                            // Already awakened
-                            if ($page->rep->unit->base_stars - $page->rep->unit->natural_stars == 1){
-                                // Normal awaken.
-                                $star_class ="star_purple";
-                            }
-                            else{
-                                // Second awaken.
-                                $star_class ="star_red";
-                            }
-                            $mon_title = $page->rep->unit->name;
+?>
+                    </div>
+                    <div class='inventory' id='inventory_scroll'>
+                        <h4>
+                            Scrolls:
+                        </h4>
+<?php
+                        foreach ($page->inventory_scroll as $item){
+?>
+                            <?=html_item_panel($item)?>
+<?php
                         }
-                        elseif ($page->rep->unit->awakens_to =! ""){
-                            // Awakeable.
-                            $star_class ="star_gold";
-                            $mon_title = $page->rep->unit->element . " " . $page->rep->unit->name;
+?>
+                    </div>
+                    <div class='inventory' id='inventory_craft_rune'>
+                        <h4>
+                            Rune crafting items:
+                        </h4>
+<?php
+                        foreach ($page->inventory_craft_rune as $item){
+?>
+                            <?=html_item_panel($item)?>
+<?php
                         }
 ?>
-
-                        <div class='monster_panel'>
-                            <span class='stars'>
+                    </div>
+                    <div class='inventory' id='inventory_craft'>
+                        <h4>
+                            Other crafting items:
+                        </h4>
 <?php
-                                for ($i = 0; $i < $page->rep->stars; $i ++){
+                        foreach ($page->inventory_craft as $item){
 ?>
-                                    <img class='star <?=$star_class?>' src='<?=$path["img"]["layout"] . "icon/star.png"?>'/>
+                            <?=html_item_panel($item)?>
 <?php
-                                }
+                        }
 ?>
-                            </span>
-                            <img title='<?=$mon_title?>' class='monster border_<?=$page->rep->unit->element_name?>' src='<?=$page->rep->unit->get_image()?>'/>
-                            <span class='level'>
-                                <?=$page->rep->level?>
-                            </span>
-                        </div> <!-- .monster_panel -->
+                    </div>
+                    <div class='inventory' id='inventory_essence'>
+                        <h4>
+                            Essences:
+                        </h4>
 <?php
-                   // } // if (isset($page->rep))
+                        foreach ($page->inventory_essence as $item){
+?>
+                            <?=html_item_panel($item)?>
+<?php
+                        }
 ?>
+                    </div>
                 </div>
                 <div id='currency'>
                     <ul>
                         <li>
-                            <img src='<?=$path["img"]["layout"]?>currency/energy.png'/>
+                            <img title='Energy' src='<?=$path["img"]["layout"]?>currency/energy.png'/>
                             <?=$page->currency["energy"]?> / <?=$page->currency["energy_max"]?>
                         </li>
                         <li>
-                            <img src='<?=$path["img"]["layout"]?>currency/arenaenergy.png'/>
+                            <img title='Arena Invitations' src='<?=$path["img"]["layout"]?>currency/arenaenergy.png'/>
                             <?=$page->currency["arena_energy"]?> / <?=$page->currency["arena_energy_max"]?>
                         </li>
                         <li>
-                            <img src='<?=$path["img"]["layout"]?>currency/dimensionenergy.png'/>
+                            <img title='Dimensional Energy' src='<?=$path["img"]["layout"]?>currency/dimensionenergy.png'/>
                             <?=$page->currency["dimension_energy"]?> / <?=$page->currency["dimension_energy_max"]?>
                         </li>
                         <li>
-                            <img src='<?=$path["img"]["layout"]?>currency/darkportalenergy.png'/>
+                            <img title='Dimensional Crystal' src='<?=$path["img"]["layout"]?>currency/darkportalenergy.png'/>
                             <?=$page->currency["darkportal_energy"]?> / <?=$page->currency["darkportal_energy_max"]?>
                         </li>
                         <li>
-                            <img src='<?=$path["img"]["layout"]?>currency/mana.png'/>
+                            <img title='Mana' src='<?=$path["img"]["layout"]?>currency/mana.png'/>
                             <?=$page->currency["mana"]?>
                         </li>
                         <li>
-                            <img src='<?=$path["img"]["layout"]?>currency/crystal.png'/>
+                            <img title='Crystal' src='<?=$path["img"]["layout"]?>currency/crystal.png'/>
                             <?=$page->currency["crystal"]?>
                         </li>
                         <li>
-                            <img src='<?=$path["img"]["layout"]?>currency/socialpoint.png'/>
+                            <img title='Social Points' src='<?=$path["img"]["layout"]?>currency/socialpoint.png'/>
                             <?=$page->currency["social_point"]?>
                         </li>
                         <li>
-                            <img src='<?=$path["img"]["layout"]?>currency/honor.png'/>
+                            <img title='Honor Points' src='<?=$path["img"]["layout"]?>currency/honor.png'/>
                             <?=$page->currency["honor_point"]?>
                         </li>
                         <li>
-                            <img src='<?=$path["img"]["layout"]?>currency/guildpoint.png'/>
+                            <img title='Guild Points' src='<?=$path["img"]["layout"]?>currency/guildpoint.png'/>
                             <?=$page->currency["guild_point"]?>
                         </li>
                         <li>
-                            <img src='<?=$path["img"]["layout"]?>currency/badge.png'/>
+                            <img title='Honor Medals' src='<?=$path["img"]["layout"]?>currency/badge.png'/>
                             <?=$page->currency["honor_medal"]?>
                         </li>
                         <li>
@@ -136,15 +192,15 @@
                             <?=$page->currency["honor_mark"]?>
                         </li>
                         <li>
-                            <img src='<?=$path["img"]["layout"]?>currency/ancientcoin.png'/>
+                            <img title='Ancient Coins' src='<?=$path["img"]["layout"]?>currency/ancientcoin.png'/>
                             <?=$page->currency["event_coin"]?>
                         </li>
                         <li>
-                            <img src='<?=$path["img"]["layout"]?>currency/ancientstone.png'/>
+                            <img title='Ancient Crystal' src='<?=$path["img"]["layout"]?>currency/ancientstone.png'/>
                             <?=$page->currency["ancient_stone"]?>
                         </li>
                         <li>
-                            <img src='<?=$path["img"]["layout"]?>currency/costumestone.png'/>
+                            <img title='Shapeshifting Stones' src='<?=$path["img"]["layout"]?>currency/costumestone.png'/>
                             <?=$page->currency["costume_point"]?>
                         </li>
                     </ul>

+ 71 - 58
data.sql

@@ -18,7 +18,7 @@ CREATE TABLE IF NOT EXISTS k_building(id INT, name TEXT, description TEXT);
 
 CREATE TABLE IF NOT EXISTS k_inventory_type(id INT, name TEXT, description TEXT);
 
-CREATE TABLE IF NOT EXISTS k_inventory(id INT, name TEXT, description TEXT);
+CREATE TABLE IF NOT EXISTS k_inventory(id INT, type INT, name TEXT, description TEXT);
 
 CREATE TABLE IF NOT EXISTS k_enhance(id INT, name TEXT, description TEXT);
 
@@ -361,63 +361,76 @@ INSERT INTO k_inventory_type VALUES(27, 'Rune Craft', '');
 INSERT INTO k_inventory_type VALUES(29, 'Craft Stuff', '');
 INSERT INTO k_inventory_type VALUES(61, 'Enhancing Monster', '');
 
-INSERT INTO k_inventory VALUES(11006, 'Essence of Magic (low)', '');
-INSERT INTO k_inventory VALUES(12006, 'Essence of Magic (mid)', '');
-INSERT INTO k_inventory VALUES(13006, 'Essence of Magic (high)', '');
-INSERT INTO k_inventory VALUES(11001, 'Essence of Water (low)', '');
-INSERT INTO k_inventory VALUES(12001, 'Essence of Water (mid)', '');
-INSERT INTO k_inventory VALUES(13001, 'Essence of Water (high)', '');
-INSERT INTO k_inventory VALUES(11002, 'Essence of Fire (low)', '');
-INSERT INTO k_inventory VALUES(12002, 'Essence of Fire (mid)', '');
-INSERT INTO k_inventory VALUES(13002, 'Essence of Fire (high)', '');
-INSERT INTO k_inventory VALUES(11003, 'Essence of Wind (low)', '');
-INSERT INTO k_inventory VALUES(12003, 'Essence of Wind (mid)', '');
-INSERT INTO k_inventory VALUES(13003, 'Essence of Wind (high)', '');
-INSERT INTO k_inventory VALUES(11004, 'Essence of Light (low)', '');
-INSERT INTO k_inventory VALUES(12004, 'Essence of Light (mid)', '');
-INSERT INTO k_inventory VALUES(13004, 'Essence of Light (high)', '');
-INSERT INTO k_inventory VALUES(11005, 'Essence of Dark (low)', '');
-INSERT INTO k_inventory VALUES(12005, 'Essence of Dark (mid)', '');
-INSERT INTO k_inventory VALUES(13005, 'Essence of Dark (high)', '');
-INSERT INTO k_inventory VALUES(1001, 'Wood', '');
-INSERT INTO k_inventory VALUES(1002, 'Leather', '');
-INSERT INTO k_inventory VALUES(1003, 'Rock', '');
-INSERT INTO k_inventory VALUES(1004, 'Ore', '');
-INSERT INTO k_inventory VALUES(1005, 'Mithril', '');
-INSERT INTO k_inventory VALUES(1006, 'Cloth', '');
-INSERT INTO k_inventory VALUES(2001, 'Rune Piece', '');
-INSERT INTO k_inventory VALUES(3001, 'Powder', '');
-INSERT INTO k_inventory VALUES(4001, 'Symbol of Harmony', '');
-INSERT INTO k_inventory VALUES(4002, 'Symbol of Transcendance', '');
-INSERT INTO k_inventory VALUES(4003, 'Symbol of Chaos', '');
-INSERT INTO k_inventory VALUES(5001, 'Crystal of Water', '');
-INSERT INTO k_inventory VALUES(5002, 'Crystal of Fire', '');
-INSERT INTO k_inventory VALUES(5003, 'Crystal of Wind', '');
-INSERT INTO k_inventory VALUES(5004, 'Crystal of Light', '');
-INSERT INTO k_inventory VALUES(5005, 'Crystal of Dark', '');
-INSERT INTO k_inventory VALUES(6001, 'Crystal of Magic', '');
-INSERT INTO k_inventory VALUES(7001, 'Crystal of Pure', '');
-
---    $ENHANCE_MONSTER = [
---        "WATER_ANGELMON" => 142110115,
---        "FIRE_ANGELMON" => 142120115,
---        "WIND_ANGELMON" => 142130115,
---        "LIGHT_ANGELMON" => 142140115,
---        "DARK_ANGELMON" => 142150115,
---        "WATER_KING_ANGELMON" => 182110115,
---        "FIRE_KING_ANGELMON" => 182120115,
---        "WIND_KING_ANGELMON" => 182130115,
---        "LIGHT_KING_ANGELMON" => 182140115,
---        "DARK_KING_ANGELMON" => 182150115,
---        "RAINBOWMON_2_20" => 143140220,
---        "RAINBOWMON_3_1" => 143140301,
---        "RAINBOWMON_3_25" => 143140325,
---        "RAINBOWMON_4_1" => 143140401,
---        "RAINBOWMON_4_30" => 143140430,
---        "RAINBOWMON_5_1" => 143140501,
---        "DEVILMON" => 151050101,
---        'SUPER_ANGELMON' => 217140115
---    ];
+INSERT INTO k_inventory VALUES(1, 9, 'Unknown Scroll', '');
+INSERT INTO k_inventory VALUES(2, 9, 'Social Points', '');
+INSERT INTO k_inventory VALUES(3, 9, 'Mystical Scroll', '');
+INSERT INTO k_inventory VALUES(4, 9, 'Mystical Summon', '');
+INSERT INTO k_inventory VALUES(5, 9, 'Fire Scroll', '');
+INSERT INTO k_inventory VALUES(6, 9, 'Water Scroll', '');
+INSERT INTO k_inventory VALUES(7, 9, 'Wind Scroll', '');
+INSERT INTO k_inventory VALUES(8, 9, 'Light and Dark Scroll', '');
+INSERT INTO k_inventory VALUES(9, 9, 'Legendary Scroll', '');
+INSERT INTO k_inventory VALUES(10, 9, 'Summon Stone', '');
+INSERT INTO k_inventory VALUES(11, 9, 'Light and Dark Summon', '');
+INSERT INTO k_inventory VALUES(12, 9, 'Legendary Summon Pieces', '');
+INSERT INTO k_inventory VALUES(13, 9, 'Transcendance Scroll', '');
+INSERT INTO k_inventory VALUES(14, 9, 'Legendary Water Scroll', '');
+INSERT INTO k_inventory VALUES(15, 9, 'Legendary Fire Scroll', '');
+INSERT INTO k_inventory VALUES(16, 9, 'Legendary Wind Scroll', '');
+INSERT INTO k_inventory VALUES(11006, 11, 'Essence of Magic (low)', '');
+INSERT INTO k_inventory VALUES(12006, 11, 'Essence of Magic (mid)', '');
+INSERT INTO k_inventory VALUES(13006, 11, 'Essence of Magic (high)', '');
+INSERT INTO k_inventory VALUES(11001, 11, 'Essence of Water (low)', '');
+INSERT INTO k_inventory VALUES(12001, 11, 'Essence of Water (mid)', '');
+INSERT INTO k_inventory VALUES(13001, 11, 'Essence of Water (high)', '');
+INSERT INTO k_inventory VALUES(11002, 11, 'Essence of Fire (low)', '');
+INSERT INTO k_inventory VALUES(12002, 11, 'Essence of Fire (mid)', '');
+INSERT INTO k_inventory VALUES(13002, 11, 'Essence of Fire (high)', '');
+INSERT INTO k_inventory VALUES(11003, 11, 'Essence of Wind (low)', '');
+INSERT INTO k_inventory VALUES(12003, 11, 'Essence of Wind (mid)', '');
+INSERT INTO k_inventory VALUES(13003, 11, 'Essence of Wind (high)', '');
+INSERT INTO k_inventory VALUES(11004, 11, 'Essence of Light (low)', '');
+INSERT INTO k_inventory VALUES(12004, 11, 'Essence of Light (mid)', '');
+INSERT INTO k_inventory VALUES(13004, 11, 'Essence of Light (high)', '');
+INSERT INTO k_inventory VALUES(11005, 11, 'Essence of Dark (low)', '');
+INSERT INTO k_inventory VALUES(12005, 11, 'Essence of Dark (mid)', '');
+INSERT INTO k_inventory VALUES(13005, 11, 'Essence of Dark (high)', '');
+INSERT INTO k_inventory VALUES(1001, 29, 'Wood', '');
+INSERT INTO k_inventory VALUES(1002, 29, 'Leather', '');
+INSERT INTO k_inventory VALUES(1003, 29, 'Rock', '');
+INSERT INTO k_inventory VALUES(1004, 29, 'Ore', '');
+INSERT INTO k_inventory VALUES(1005, 29, 'Mithril', '');
+INSERT INTO k_inventory VALUES(1006, 29, 'Cloth', '');
+INSERT INTO k_inventory VALUES(2001, 27, 'Rune Piece', '');
+INSERT INTO k_inventory VALUES(3001, 29, 'Powder', '');
+INSERT INTO k_inventory VALUES(4001, 27, 'Symbol of Harmony', '');
+INSERT INTO k_inventory VALUES(4002, 27, 'Symbol of Transcendance', '');
+INSERT INTO k_inventory VALUES(4003, 27, 'Symbol of Chaos', '');
+INSERT INTO k_inventory VALUES(5001, 29,  'Crystal of Water', '');
+INSERT INTO k_inventory VALUES(5002, 29, 'Crystal of Fire', '');
+INSERT INTO k_inventory VALUES(5003, 29, 'Crystal of Wind', '');
+INSERT INTO k_inventory VALUES(5004, 29, 'Crystal of Light', '');
+INSERT INTO k_inventory VALUES(5005, 29, 'Crystal of Dark', '');
+INSERT INTO k_inventory VALUES(6001, 29, 'Crystal of Magic', '');
+INSERT INTO k_inventory VALUES(7001, 29, 'Crystal of Pure', '');
+INSERT INTO k_inventory VALUES(142110115, 61, 'Water Angelmon', '');
+INSERT INTO k_inventory VALUES(142120115, 61, 'Fire Angelmon', '');
+INSERT INTO k_inventory VALUES(142130115, 61, 'Wind Angelmon', '');
+INSERT INTO k_inventory VALUES(142140115, 61, 'Light Angelmon', '');
+INSERT INTO k_inventory VALUES(142150115, 61, 'Dark Angelmon', '');
+INSERT INTO k_inventory VALUES(182110115, 61, 'Water King Angelmon', '');
+INSERT INTO k_inventory VALUES(182120115, 61, 'Fire King Angelmon', '');
+INSERT INTO k_inventory VALUES(182130115, 61, 'Wind King Angelmon', '');
+INSERT INTO k_inventory VALUES(182140115, 61, 'Light King Angelmon', '');
+INSERT INTO k_inventory VALUES(182150115, 61, 'Dark King Angelmon', '');
+INSERT INTO k_inventory VALUES(143140220, 61, 'Rainbowmon (2* MAX)', '');
+INSERT INTO k_inventory VALUES(143140301, 61, 'Rainbowmon (3*)', '');
+INSERT INTO k_inventory VALUES(143140325, 61, 'Rainbowmon (3* MAX)', '');
+INSERT INTO k_inventory VALUES(143140401, 61, 'Rainbowmon (4*)', '');
+INSERT INTO k_inventory VALUES(143140430, 61, 'Rainbowmon (4* MAX)', '');
+INSERT INTO k_inventory VALUES(143140501, 61, 'Rainbowmon (5*)', '');
+INSERT INTO k_inventory VALUES(151050101, 61, 'Devilmon', '');
+INSERT INTO k_inventory VALUES(217140115, 61, 'Super Angelmon', '');
 
 INSERT INTO k_rune_set VALUES(1, 'Energy', 2, '');
 INSERT INTO k_rune_set VALUES(2, 'Guard', 2, '');

+ 2 - 2
install_user.py

@@ -164,7 +164,7 @@ def parseBuildings(db, data):
     print("Parsing buildings...")
     uid = data["wizard_info"]["wizard_id"]
     for bui in data["building_list"]:
-        building = bui["wizard_id"]
+        building = bui["building_master_id"]
         gain = bui["gain_per_hour"]
         insert(db, "building", (uid, building, gain))
     db.commit()
@@ -237,7 +237,7 @@ def parseInventory(db, data):
     print("Parsing inventory...")
     uid = data["wizard_info"]["wizard_id"]
     for item in data["inventory_info"]:
-        id = item["wizard_id"]
+        id = item["item_master_id"]
         type = item["item_master_type"]
         # TODO: Master id?
         amount = item["item_quantity"]

+ 94 - 49
public/css/home.css

@@ -1,22 +1,14 @@
-article{
-    display: inline-block;
-    vertical-align: top;
-    width: 30%;
-    margin: 2%;
-    border: 0.2em solid #000000;
-    border-radius: 1em;
-    box-shadow: inset 0 0 0.5em #000000;
-    background-color: #ffffffaa;
-    padding: 2em 1.5em 1em 1.5em;
+article#profile{
+    width: 40%;
     text-align: left;
 }
-@media screen and (max-width : 990px){
-    article{
-        display: block;
-        width: 80%;
-        margin: 1em auto;
-        /*padding: 1em 1em 0.5em 1em;*/
-    }
+
+article#profile h4{
+    color: #ffffff;
+    font-weight: bold;
+    margin: 0.5em 1em 0em 0.5em;
+    display: inline;
+    vertical-align: middle;
 }
 
 article#profile div#currency ul li img{
@@ -25,41 +17,94 @@ article#profile div#currency ul li img{
     vertical-align: middle;
 }
 
-article h3{
-    margin: -1em -0.75em 0.5em -0.75em;
-    border-bottom: 0.1em solid #f2c920;
-    background-color: #00000044;
-    color: #ffffff;
-    text-align: left;
-    border-top-left-radius: 0.25em;
-    border-top-right-radius: 0.25em;
-    padding: 0.15em 0 0.15em 2em;
-    font-size: 200%;
-    font-weight: bold;
+article#profile div#rep div.monster_panel{
+    font-size: 50%;
+    margin: 0;
+    vertical-align: middle;
 }
-@media screen and (max-width : 990px){
-    article h3{
-        padding: 0.15em 0 0.15em 1em;
-    }
+
+article#profile div#defense div.monster_panel{
+    font-size: 35%;
+    margin: 0;
+    vertical-align: middle;
 }
-article h3 a{
-    color: #ffffff;
-    text-shadow: 0 0 0.1em #000000;
-    transition: all .3s ease-in-out;
+
+/**
+ * Monster panel
+ */
+article#profile div.building_panel{
+    display: inline-block;
+    width: 2em;
+    height: 2em;
+    margin: 0.2em 0em;
+    position: relative;
+    border-radius: 15%;
+    vertical-align: middle;
 }
-article h3 a:hover{
-    color: #444444;
-    text-shadow: 0 0 0.1em #ffffff;
+
+article#profile div#building h4, div#decoration h4{
+    display: block;
 }
-@media screen and (max-width : 990px){
-    article h3 a{
-        text-shadow: 0 0 0;
-    }
-    article h3 a:hover{
-        color: #fffff;
-        text-shadow: 0 0 0;
-    }
+
+article#profile div.building_panel img.building{
+    width: 2em;
+    height: 2em;
+    border-style: solid;
+    border-width: 0.1em;
+    border-radius: 15%;
 }
-article p{
-    margin: 0;
+
+article#profile div.building_panel span.level{
+    position: relative;
+    bottom: 1.6em;
+    font-weight: bold;
+    color: #000;
+    text-shadow: 0 0 0.1em #fff, 0 0 0.2em #fff, 0 0 0.4em #fff, 0 0 0.4em #fff;
+    font-size: 100%;
+    left: 0.4em;
+    bottom: 2.8em;
+    z-index: 1;
+    font-size: 50%;
+}
+
+article#profile div.building_panel span.level::before {
+  content: "Lv. ";
+}
+
+
+
+
+article#profile div.item_panel{
+    display: inline-block;
+    width: 2em;
+    height: 2em;
+    margin: 0.2em 0em;
+    position: relative;
+    border-radius: 15%;
+    vertical-align: middle;
+}
+
+article#profile div#building h4, div#decoration h4{
+    display: block;
 }
+
+article#profile div.item_panel img.item{
+    width: 2em;
+    height: 2em;
+    border-style: solid;
+    border-width: 0.1em;
+    border-radius: 15%;
+}
+
+article#profile div.item_panel span.amount{
+    position: relative;
+    bottom: 1.6em;
+    font-weight: bold;
+    color: #000;
+    text-shadow: 0 0 0.1em #fff, 0 0 0.2em #fff, 0 0 0.4em #fff, 0 0 0.4em #fff;
+    font-size: 100%;
+    left: 0.4em;
+    bottom: 2.8em;
+    z-index: 1;
+    font-size: 50%;
+}

binární
public/img/layout/essence/Fire_High.png


binární
public/img/layout/essence/Light_High.png


binární
public/img/layout/essence/Water_High.png


binární
public/img/layout/essence/Wind_High.png