浏览代码

Scenario, Arena and Dimeensional Rift loggers added. Some changes to the runs view to handle new data. SWEX plugin updated to log these runs.

Iñigo Valentin 5 年之前
父节点
当前提交
9c85cdcba3

+ 512 - 1
application/API/v3/run/POST.php

@@ -166,6 +166,496 @@
         return $efficiency;
     }
 
+    /**
+     * Parses the JSONs relateds to an Arena run and saves the data.
+     *
+     * @param SQLiteConn $db Database connection.
+     * @param int $uid Player UID.
+     * @param int $id Run ID.
+     * @param JSON[] $json List of received JSONs.
+     */
+    function log_arena_run($db, $id, $uid, $json){
+        // Only the result request and response JSONs are needed:
+        $response = $json["result_res"];
+
+        // Prepare the "run" insert.
+        $statement = $db->prepare("
+          INSERT INTO run (
+            uid,
+            id,
+            dtime,
+            area_type,
+            area,
+            stage,
+            difficulty,
+            win,
+            time,
+            mana,
+            energy,
+            crystal,
+            guild_points,
+            honor_points,
+            helper,
+            score,
+            rank
+          ) VALUES (
+            :uid,
+            :id,
+            :dtime,
+            :area_type,
+            :area,
+            :stage,
+            :difficulty,
+            :win,
+            :time,
+            :mana,
+            :energy,
+            :crystal,
+            :guild_points,
+            :honor_points,
+            :helper,
+            :score,
+            :rank
+          );
+        ");
+
+        // Bind data and insert
+        $statement->bindValue(":uid", $uid);
+        $statement->bindValue(":id", $id);
+        $statement->bindValue(":dtime", $response->{"tvaluelocal"});
+        $statement->bindValue(":area_type", AREA_TYPE_ID::ARENA);
+        $statement->bindValue(":area", AREA_TYPE_ID::ARENA);
+        $statement->bindValue(":stage", null);
+        $statement->bindValue(":difficulty", null);
+        $statement->bindValue(":win", $response->{"win_lose"});
+        $statement->bindValue(":time", 1);
+        if (array_key_exists("mana", $response->{"reward"})){
+            $statement->bindValue(":mana", $response->{"reward"}->{"mana"});
+        }
+        else{
+            $statement->bindValue(":mana", 0);
+        }
+        if (array_key_exists("energy", $response->{"reward"})){
+            $statement->bindValue(":energy", $response->{"reward"}->{"energy"});
+        }
+        else{
+            $statement->bindValue(":energy", 0);
+        }
+        if (array_key_exists("crystal", $response->{"reward"})){
+            $statement->bindValue(":crystal", $response->{"reward"}->{"crystal"});
+        }
+        else{
+            $statement->bindValue(":crystal", 0);
+        }
+        $statement->bindValue(":guild_points", 0);
+        if (array_key_exists("honor_point", $response->{"reward"})){
+            $statement->bindValue(":honor_points", $response->{"reward"}->{"honor_point"});
+        }
+        else{
+            $statement->bindValue(":honor_points", 0);
+        }
+        $statement->bindValue(":helper", 0);
+        $statement->bindValue(":score", null);
+        $statement->bindValue(":rank", null);
+        $statement->execute();
+
+        // Parse party
+        $leader = 1;
+        foreach ($response->{"unit_list"} as $unit){
+            $statement = $db->prepare("
+              INSERT INTO run_party 
+                (run, unit, k_unit, leader, front)
+              VALUES
+                (:run, :unit, :k_unit, :leader, :front);"
+            );
+            $statement->bindValue(":run", $id);
+            $statement->bindValue(":unit", $unit->{"unit_id"});
+            $statement->bindValue(":k_unit", $unit->{"unit_master_id"});
+            $statement->bindValue(":leader", $leader);
+            $leader = 0;
+            $statement->bindValue(":front", 0);
+            $statement->execute();
+        }
+
+        // Return success
+        return "201 Created.";
+    }
+
+    /**
+     * Parses the JSONs relateds to a Dimensional Rift run and saves the data.
+     *
+     * @param SQLiteConn $db Database connection.
+     * @param int $uid Player UID.
+     * @param int $id Run ID.
+     * @param JSON[] $json List of received JSONs.
+     */
+    function log_dark_portal_run($db, $id, $uid, $json){
+        // Only the result request and response JSONs are needed:
+        $response = $json["result_res"];
+
+        // Prepare the "run" insert.
+        $statement = $db->prepare("
+          INSERT INTO run (
+            uid,
+            id,
+            dtime,
+            area_type,
+            area,
+            stage,
+            difficulty,
+            win,
+            time,
+            mana,
+            energy,
+            crystal,
+            guild_points,
+            honor_points,
+            helper,
+            score,
+            rank
+          ) VALUES (
+            :uid,
+            :id,
+            :dtime,
+            :area_type,
+            :area,
+            :stage,
+            :difficulty,
+            :win,
+            :time,
+            :mana,
+            :energy,
+            :crystal,
+            :guild_points,
+            :honor_points,
+            :helper,
+            :score,
+            :rank
+          );
+        ");
+
+        // Bind data and insert
+        $statement->bindValue(":uid", $uid);
+        $statement->bindValue(":id", $id);
+        $statement->bindValue(":dtime", $response->{"tvaluelocal"});
+        $statement->bindValue(":area_type", AREA_TYPE_ID::DIMENSIONAL_RIFT);
+        // The area is the region the portal is open in.
+        $statement->bindValue(":area", $response->{"region_id"});
+        $statement->bindValue(":stage", null);
+        $statement->bindValue(":difficulty", $response->{"difficulty"});
+        $statement->bindValue(":win", $response->{"win_lose"});
+        $statement->bindValue(":time", 1);
+        if (array_key_exists("mana", $response->{"reward"})){
+            $statement->bindValue(":mana", $response->{"reward"}->{"mana"});
+        }
+        else{
+            $statement->bindValue(":mana", 0);
+        }
+        if (array_key_exists("energy", $response->{"reward"})){
+            $statement->bindValue(":energy", $response->{"reward"}->{"energy"});
+        }
+        else{
+            $statement->bindValue(":energy", 0);
+        }
+        if (array_key_exists("crystal", $response->{"reward"})){
+            $statement->bindValue(":crystal", $response->{"reward"}->{"crystal"});
+        }
+        else{
+            $statement->bindValue(":crystal", 0);
+        }
+        $statement->bindValue(":guild_points", 0);
+        $statement->bindValue(":honor_points", 0);
+        $statement->bindValue(":helper", 0);
+        $statement->bindValue(":score", null);
+        $statement->bindValue(":rank", null);
+        $statement->execute();
+
+        // Parse party
+        $leader = 1;
+        foreach ($response->{"unit_list"} as $unit){
+            $statement = $db->prepare("
+              INSERT INTO run_party 
+                (run, unit, k_unit, leader, front)
+              VALUES
+                (:run, :unit, :k_unit, :leader, :front);"
+            );
+            $statement->bindValue(":run", $id);
+            $statement->bindValue(":unit", $unit->{"unit_id"});
+            $statement->bindValue(":k_unit", $unit->{"unit_master_id"});
+            $statement->bindValue(":leader", $leader);
+            $leader = 0;
+            $statement->bindValue(":front", 0);
+            $statement->execute();
+        }
+
+        // Return success
+        return "201 Created.";
+    }
+
+    /**
+     * Parses the JSONs relateds to a scenario run and saves the data.
+     *
+     * @param SQLiteConn $db Database connection.
+     * @param int $uid Player UID.
+     * @param int $id Run ID.
+     * @param JSON[] $json List of received JSONs.
+     */
+    function log_scenario_run($db, $id, $uid, $json){
+        // Only the result request and response JSONs are needed:
+        $response = $json["result_res"];
+
+        if ($json["start_res"] === null){
+            return ("400 Start response is required to parse scenario runs.");
+        }
+        $request = $json["start_res"];
+
+        // Prepare the "run" insert.
+        $statement = $db->prepare("
+          INSERT INTO run (
+            uid,
+            id,
+            dtime,
+            area_type,
+            area,
+            stage,
+            difficulty,
+            win,
+            time,
+            mana,
+            energy,
+            crystal,
+            guild_points,
+            honor_points,
+            helper,
+            score,
+            rank
+          ) VALUES (
+            :uid,
+            :id,
+            :dtime,
+            :area_type,
+            :area,
+            :stage,
+            :difficulty,
+            :win,
+            :time,
+            :mana,
+            :energy,
+            :crystal,
+            :guild_points,
+            :honor_points,
+            :helper,
+            :score,
+            :rank
+          );
+        ");
+
+        // Bind data and insert
+        $statement->bindValue(":uid", $uid);
+        $statement->bindValue(":id", $id);
+        $statement->bindValue(":dtime", $response->{"tvaluelocal"});
+        $statement->bindValue(":area_type", AREA_TYPE_ID::SCENARIO);
+        $statement->bindValue(":area", $response->{"scenario_info"}->{"region_id"});
+        $statement->bindValue(":stage", $response->{"scenario_info"}->{"stage_no"});
+        $statement->bindValue(":difficulty", $response->{"scenario_info"}->{"difficulty"});
+        $statement->bindValue(":win", $response->{"win_lose"});
+        $statement->bindValue(":time", $response->{"clear_time"}->{"current_time"});
+        if (array_key_exists("mana", $response->{"reward"})){
+            $statement->bindValue(":mana", $response->{"reward"}->{"mana"});
+        }
+        else{
+            $statement->bindValue(":mana", 0);
+        }
+        if (array_key_exists("energy", $response->{"reward"})){
+            $statement->bindValue(":energy", $response->{"reward"}->{"energy"});
+        }
+        else{
+            $statement->bindValue(":energy", 0);
+        }
+        if (array_key_exists("crystal", $response->{"reward"})){
+            $statement->bindValue(":crystal", $response->{"reward"}->{"crystal"});
+        }
+        else{
+            $statement->bindValue(":crystal", 0);
+        }
+        $statement->bindValue(":guild_points", 0);
+        $statement->bindValue(":honor_points", 0);
+        if (array_key_exists("helper_unit_list", $request) && sizeof($request->{"helper_unit_list"}) > 0){
+            $statement->bindValue(":helper", 1);
+        }
+        else{
+            $statement->bindValue(":helper", 0);
+        }
+        $statement->bindValue(":score", null);
+        $statement->bindValue(":rank", null);
+        $statement->execute();
+
+        // Parse various types of reward
+        if (array_key_exists("crate", $response->{"reward"})){
+            $crate = $response->{"reward"}->{"crate"};
+            if (array_key_exists("unit_info", $crate)){
+                $item = $crate->{"unit_info"};
+                $statement = $db->prepare("INSERT INTO run_drop_unit (run, unit) VALUES (:run, :unit);");
+                $statement->bindValue(":run", $id);
+                $statement->bindValue(":unit", $unit->{"unit_master_id"});
+                $statement->execute();
+            }
+            if (array_key_exists("craft_stuff", $crate)){
+                $item = $crate->{"craft_stuff"};
+                $statement = $db->prepare("INSERT INTO run_drop_item (run, item, amount) VALUES (:run, :item, :amount);");
+                $statement->bindValue(":run", $id);
+                $statement->bindValue(":item", $item->{"item_master_id"});
+                $statement->bindValue(":amount", $item->{"item_quantity"});
+                $statement->execute();
+            }
+            if (array_key_exists("random_scroll", $crate)){
+                $item = $crate->{"random_scroll"};
+                $statement = $db->prepare("INSERT INTO run_drop_item (run, item, amount) VALUES (:run, :item, :amount);");
+                $statement->bindValue(":run", $id);
+                $statement->bindValue(":item", $item->{"item_master_id"});
+                $statement->bindValue(":amount", $item->{"item_quantity"});
+                $statement->execute();
+            }
+            if (array_key_exists("rune", $crate)){
+                $rune = $crate->{"rune"};
+                $statement = $db->prepare("
+                    INSERT INTO run_drop_rune (
+                    run,
+                    id,
+                    type,
+                    slot,
+                    stars,
+                    ancient,
+                    quality,
+                    value,
+                    efficiency,
+                    max_efficiency,
+                    main_stat,
+                    main_stat_value,
+                    innate_stat,
+                    innate_stat_value,
+                    substat_1,
+                    substat_1_value,
+                    substat_2,
+                    substat_2_value,
+                    substat_3,
+                    substat_3_value,
+                    substat_4,
+                    substat_4_value
+                    ) VALUES (
+                    :run,
+                    :id,
+                    :type,
+                    :slot,
+                    :stars,
+                    :ancient,
+                    :quality,
+                    :value,
+                    :efficiency,
+                    :max_efficiency,
+                    :main_stat,
+                    :main_stat_value,
+                    :innate_stat,
+                    :innate_stat_value,
+                    :substat_1,
+                    :substat_1_value,
+                    :substat_2,
+                    :substat_2_value,
+                    :substat_3,
+                    :substat_3_value,
+                    :substat_4,
+                    :substat_4_value
+                    );
+                ");
+                $statement->bindValue(":run", $id);
+                $statement->bindValue(":id", $rune->{"rune_id"});
+                $statement->bindValue(":type", $rune->{"set_id"});
+                $statement->bindValue(":slot", $rune->{"slot_no"});
+                $statement->bindValue(":value", $rune->{"sell_value"});
+                if ($rune->{"class"} > 10){
+                    // Ancient rune
+                    $statement->bindValue(":ancient", 1);
+                    $statement->bindValue(":stars", intval($rune->{"class"}) - 10);
+                    $statement->bindValue(":quality", intval($rune->{"rank"}) - 10);
+                }
+                else{
+                    // Non Ancient rune
+                    $statement->bindValue(":ancient", 0);
+                    $statement->bindValue(":stars", $rune->{"class"});
+                    $statement->bindValue(":quality", $rune->{"rank"});
+                }
+                $efficiency = calculate_efficiency($rune);
+                $max_efficiency = calculate_maximum_efficiency($rune);
+                $statement->bindValue(":efficiency", $efficiency);
+                $statement->bindValue(":max_efficiency", $max_efficiency);
+                $statement->bindValue(":main_stat", $rune->{"pri_eff"}[0]);
+                $statement->bindValue(":main_stat_value", $rune->{"pri_eff"}[1]);
+                if ($rune->{"prefix_eff"}[0] > 0){
+                    $statement->bindValue(":innate_stat", $rune->{"prefix_eff"}[0]);
+                    $statement->bindValue(":innate_stat_value", $rune->{"prefix_eff"}[1]);
+                }
+                else{
+                    $statement->bindValue(":innate_stat", null);
+                    $statement->bindValue(":innate_stat_value", 0);
+                }
+                if (sizeof($rune->{"sec_eff"}) > 0){
+                    $statement->bindValue(":substat_1", $rune->{"sec_eff"}[0][0]);
+                    $statement->bindValue(":substat_1_value", $rune->{"sec_eff"}[0][1]);
+                }
+                else{
+                    $statement->bindValue(":substat_1", null);
+                    $statement->bindValue(":substat_1_value", 0);
+                }
+                if (sizeof($rune->{"sec_eff"}) > 1){
+                    $statement->bindValue(":substat_2", $rune->{"sec_eff"}[1][0]);
+                    $statement->bindValue(":substat_2_value", $rune->{"sec_eff"}[1][1]);
+                }
+                else{
+                    $statement->bindValue(":substat_2", null);
+                    $statement->bindValue(":substat_2_value", 0);
+                }
+                if (sizeof($rune->{"sec_eff"}) > 2){
+                    $statement->bindValue(":substat_3", $rune->{"sec_eff"}[2][0]);
+                    $statement->bindValue(":substat_3_value", $rune->{"sec_eff"}[2][1]);
+                }
+                else{
+                    $statement->bindValue(":substat_3", null);
+                    $statement->bindValue(":substat_3_value", 0);
+                }
+                if (sizeof($rune->{"sec_eff"}) > 3){
+                    $statement->bindValue(":substat_4", $rune->{"sec_eff"}[3][0]);
+                    $statement->bindValue(":substat_4_value", $rune->{"sec_eff"}[3][1]);
+                }
+                else{
+                    $statement->bindValue(":substat_4", null);
+                    $statement->bindValue(":substat_4_value", 0);
+                }
+                $statement->execute();
+            }
+        }
+
+        // Parse party
+        $leader = 1;
+        foreach ($response->{"unit_list"} as $unit){
+            $statement = $db->prepare("
+              INSERT INTO run_party 
+                (run, unit, k_unit, leader, front)
+              VALUES
+                (:run, :unit, :k_unit, :leader, :front);"
+            );
+            $statement->bindValue(":run", $id);
+            $statement->bindValue(":unit", $unit->{"unit_id"});
+            $statement->bindValue(":k_unit", $unit->{"unit_master_id"});
+            $statement->bindValue(":leader", $leader);
+            $leader = 0;
+            $statement->bindValue(":front", 0);
+            $statement->execute();
+        }
+
+        // Return success
+        return "201 Created.";
+    }
+
     /**
      * Parses the JSONs relateds to a cairos run and saves the data.
      *
@@ -198,6 +688,7 @@
             energy,
             crystal,
             guild_points,
+            honor_points,
             helper,
             score,
             rank
@@ -215,6 +706,7 @@
             :energy,
             :crystal,
             :guild_points,
+            :honor_points,
             :helper,
             :score,
             :rank
@@ -240,6 +732,7 @@
         $statement->bindValue(":energy", 0);
         $statement->bindValue(":crystal", 0);
         $statement->bindValue(":guild_points", 0);
+        $statement->bindValue(":honor_points", 0);
         $statement->bindValue(":helper", 0);
         $statement->bindValue(":score", null);
         $statement->bindValue(":rank", null);
@@ -352,6 +845,7 @@
             energy,
             crystal,
             guild_points,
+            honor_points,
             helper,
             score,
             rank
@@ -369,6 +863,7 @@
             :energy,
             :crystal,
             :guild_points,
+            :honor_points,
             :helper,
             :score,
             :rank
@@ -404,6 +899,7 @@
             $statement->bindValue(":crystal", 0);
         }
         $statement->bindValue(":guild_points", 0);
+        $statement->bindValue(":honor_points", 0);
         $statement->bindValue(":helper", 0); // TODO Where is this information??
         $statement->bindValue(":score", null);
         $statement->bindValue(":rank", null);
@@ -600,6 +1096,7 @@
             energy,
             crystal,
             guild_points,
+            honor_points,
             helper,
             score,
             rank
@@ -617,6 +1114,7 @@
             :energy,
             :crystal,
             :guild_points,
+            :honor_points,
             :helper,
             :score,
             :rank
@@ -650,6 +1148,7 @@
             $statement->bindValue(":crystal", 0);
         }
         $statement->bindValue(":guild_points", 0);
+        $statement->bindValue(":honor_points", 0);
         $statement->bindValue(":helper", 0); // TODO Where is this information??
         $statement->bindValue(":score", null);
         $statement->bindValue(":rank", null);
@@ -898,7 +1397,10 @@
         $accepted_commands = [
             "BattleDungeonResult_V2", // Dungeon Run
             "BattleDimensionHoleDungeonResult_v2", // Dimension Hole Run
-            "BattleRiftOfWorldsRaidResult" // Rift Raid Run
+            "BattleRiftOfWorldsRaidResult", // Rift Raid Run
+            "BattleScenarioResult", // Scenario Run
+            "BattleArenaResult", // Arena Run
+            "BattleDarkPortalResult" // Dimensinal Rift Run
         ];
         if (!in_array($command, $accepted_commands)){
             header("HTTP/1.1 405 Command not implemented.");
@@ -939,6 +1441,15 @@
             case "BattleRiftOfWorldsRaidResult":
                 $result = log_rift_raid_run($db, $id, $uid, $json);
                 break;
+            case "BattleScenarioResult":
+                $result = log_scenario_run($db, $id, $uid, $json);
+                break;
+            case "BattleArenaResult":
+                $result = log_arena_run($db, $id, $uid, $json);
+                break;
+            case "BattleDarkPortalResult":
+                $result = log_dark_portal_run($db, $id, $uid, $json);
+                break;
         }
 
         // Process result

+ 18 - 1
application/entity/K_Area.php

@@ -73,6 +73,18 @@
                 $this->type = AREA_TYPE_ID::CAIROS_DUNGEON;
                 $this->name = "Hall of Heroes";
             }
+            else{
+                $s = "
+                  SELECT name
+                  FROM k_area_type
+                  WHERE id = '$type'
+                ";
+                $q = $db->query($s);
+                $r = $q->fetchArray(SQLITE3_ASSOC);
+                if ($r){
+                    $this->name = HTML::e($r["name"]);
+                }
+            }
         }
 
         /**
@@ -91,9 +103,14 @@
             elseif ($this->type == AREA_TYPE_ID::RIFT_RAID){
                 return APPLICATION::img("UNIT", 44007);
             }
+            elseif ($this->type == AREA_TYPE_ID::ARENA){
+                return APPLICATION::img("AREA", "ARENA");
+            }
+            elseif ($this->type == AREA_TYPE_ID::DIMENSIONAL_RIFT){
+                return APPLICATION::img("CURRENCY", "darkportalenergy");
+            }
             elseif (
                 $this->type == AREA_TYPE_ID::SCENARIO ||
-                $this->type == AREA_TYPE_ID::ARENA ||
                 $this->type == AREA_TYPE_ID::GUILD_WAR ||
                 $this->type == AREA_TYPE_ID::GUILD_SIEGE ||
                 $this->type == AREA_TYPE_ID::WORLD_BOSS ||

+ 17 - 3
application/entity/Run.php

@@ -72,17 +72,27 @@
         /**
          * @var int Reward mana.
          */
-        public $mana;
+        public $mana = 0;
 
         /**
          * @var int Reward energy.
          */
-        public $energy;
+        public $energy = 0;
 
         /**
          * @var int Reward crystal.
          */
-        public $crystal;
+        public $crystal = 0;
+
+        /**
+         * @var int Reward Honor Points (Arena).
+         */
+        public $honor_points = 0;
+
+        /**
+         * @var int Reward Guild Points.
+         */
+        public $guild_points = 0;
 
         /**
          * @var bool Indicates if a frind/mentor helped.
@@ -181,6 +191,8 @@
                   mana,
                   energy,
                   crystal,
+                  honor_points,
+                  guild_points,
                   helper,
                   score,
                   rank
@@ -200,6 +212,8 @@
             $this->mana = $r["mana"];
             $this->energy = $r["energy"];
             $this->crystal = $r["crystal"];
+            $this->honor_points = $r["honor_points"];
+            $this->guild_points = $r["guild_points"];
             $this->helper = $r["helper"];
             $this->score = $r["score"];
             $this->rank = $r["rank"];

二进制
application/sw.sqlite


+ 31 - 10
application/view/runs.php

@@ -300,7 +300,10 @@
 ?>
                                             <span class='difficulty'>
 <?php
-                                                if ($run->area->type == AREA_TYPE_ID::TARTARUS_LABYRINTH){
+                                                if (
+                                                  $run->area->type == AREA_TYPE_ID::TARTARUS_LABYRINTH ||
+                                                  $run->area->type == AREA_TYPE_ID::DIMENSIONAL_RIFT
+                                                ){
                                                     $difficulty = $run->difficulty;
                                                 }
                                                 else{
@@ -330,7 +333,7 @@
                                         $enable_save = false;
 ?>
                                         <div class='monster_panel helper'>
-                                            <img class='monster' title='Friend/Menstor' src='<?=URL::IMG["CURRENCY"]?>socialpoint.png'/>
+                                            <img class='monster' title='Friend/Mentor' src='<?=URL::IMG["CURRENCY"]?>socialpoint.png'/>
                                         </div>
 <?php
                                     }
@@ -390,15 +393,17 @@
                                     }
                                     else{
                                         if ($run->win == 1){
-                                            $s = floor($run->time / 1000);
-                                            $m = floor($s / 60);
-                                            $s = floor($s % 60);
-                                            $ms = ($run-> time - (1000 * 60 * $m) - (1000 * 60 * $s) / 100);
-                                            $s = str_pad($s, 2, '0', STR_PAD_LEFT);
-                                            $ms = str_pad($ms, 2, '0', STR_PAD_LEFT);
+                                            if ($run->time > 1){
+                                                $s = floor($run->time / 1000);
+                                                $m = floor($s / 60);
+                                                $s = floor($s % 60);
+                                                $ms = ($run-> time - (1000 * 60 * $m) - (1000 * 60 * $s) / 100);
+                                                $s = str_pad($s, 2, '0', STR_PAD_LEFT);
+                                                $ms = str_pad($ms, 2, '0', STR_PAD_LEFT);
 ?>
-                                            <?=$m?>:<?=$s?><span class='ms'>.<?=$ms?></span>
+                                                <?=$m?>:<?=$s?><span class='ms'>.<?=$ms?></span>
 <?php
+                                            }
                                         }
                                         else{
 ?>
@@ -432,6 +437,22 @@
                                             <img class='item' title='Crystal' src='<?=URL::IMG["CURRENCY"]?>crystal.png'/>
                                             <span class='item'><?=$run->crystal?></span>
                                         </div>
+<?php
+                                    }
+                                    if ($run->honor_points > 0){
+?>
+                                        <div class='item'>
+                                            <img class='item' title='Honor Points' src='<?=URL::IMG["CURRENCY"]?>honor.png'/>
+                                            <span class='item'><?=$run->honor_points?></span>
+                                        </div>
+<?php
+                                    }
+                                    if ($run->guild_points > 0){
+?>
+                                        <div class='item'>
+                                            <img class='item' title='Guild Points' src='<?=URL::IMG["CURRENCY"]?>guildpoint.png'/>
+                                            <span class='item'><?=$run->guild_points?></span>
+                                        </div>
 <?php
                                     }
                                     foreach ($run->unit as $unit){
@@ -485,7 +506,7 @@
                                     foreach ($run->enchantment as $enchantment){
 ?>
                                         <div class='item item_enchantment'>
-                                            <img class='item' title='Enchantment' src='<?=URL::IMG["RUNE"]?>base.png'/>
+                                            <img class='item' title='Enchantment' src='<?=URL::IMG["GRIND"]?>grind.png'/>
                                             <?=HTML::enchantment_panel($enchantment)?>
                                         </div>
 <?php

+ 2 - 0
install_data/install_data.sql

@@ -286,6 +286,8 @@ CREATE TABLE run(
     mana INT NOT NULL CHECK(mana >= 0),
     energy INT NOT NULL CHECK(energy >= 0),
     crystal INT NOT NULL CHECK(crystal >= 0),
+    guild_points NOT NULL CHECK(guild_points >= 0),
+    honor_points NOT NULL CHECK(honor_points >= 0),
     helper INT NOT NULL CHECK(helper IN (0, 1)),
     score INT,
     rank TEXT

+ 1 - 0
public/css/runs.css

@@ -136,6 +136,7 @@ table#runs td.reward div.item span.item{
     width: 2.6em;
     text-align: right;
     text-shadow: 0 0 0.3em #000, 0 0 0.3em #000, 0 0 0.3em #000, 0 0 0.2em #000, 0 0 0.1em #000, 0 0 0.1em #000;
+    pointer-events: none;
 }
 
 table#runs td.reward div.item_rune table.rune{

+ 23 - 4
swex-plugin/swdb.js

@@ -104,7 +104,7 @@ module.exports = {
                 //command = "update_logbook";
                 //success = "Logbook updated succesfully!";
                 break;
-            // Battle runs
+            // Cairos Dungeon run
             case 'BattleDungeonResult_V2':
                 apiCommand = "run/";
                 method = "POST";
@@ -112,6 +112,7 @@ module.exports = {
                 params['result_response'] = JSON.stringify(res);
                 params['result_request'] = JSON.stringify(req);
                 break;
+            // Dimension Hole run
             case 'BattleDimensionHoleDungeonResult_v2':
                 apiCommand = "run/";
                 method = "POST";
@@ -119,6 +120,7 @@ module.exports = {
                 params['result_response'] = JSON.stringify(res);
                 params['result_request'] = JSON.stringify(req);
                 break;
+            // Rift raid run
             case 'BattleRiftOfWorldsRaidResult':
                 apiCommand = "run/";
                 method = "POST";
@@ -126,10 +128,27 @@ module.exports = {
                 params['result_response'] = JSON.stringify(res);
                 params['start_response'] = JSON.stringify(this.eventStartRes);
                 break;
+            // Scenario run
             case 'BattleScenarioResult':
-                //command = "log_run_scenario";
-                //success = "Scenario run logged sucesfully!"
-                start = true;
+                apiCommand = "run/";
+                method = "POST";
+                success = "Scenario run logged sucesfully!"
+                params['result_response'] = JSON.stringify(res);
+                params['start_response'] = JSON.stringify(this.eventStartRes);
+                break;
+            // Arena run
+            case 'BattleArenaResult':
+                apiCommand = "run/";
+                method = "POST";
+                success = "Arena run logged sucesfully!"
+                params['result_response'] = JSON.stringify(res);
+                break;
+            // Dimensional Rift run
+            case 'BattleDarkPortalResult':
+                apiCommand = "run/";
+                method = "POST";
+                success = "Dimensional Rift run logged sucesfully!"
+                params['result_response'] = JSON.stringify(res);
                 break;
             case 'BattleTrialTowerResult_v2':
                 //command = "log_run_toa";