Browse Source

解决冲突

cyzhao 1 year ago
parent
commit
be9d3af9db

+ 36 - 32
Gameserver/App/base/CmdCode.php

@@ -91,7 +91,6 @@ class CmdCode {
      *  走完片头后给值 1
      */
     const cmd_user_setAnimation = 6004;
-    
     const cmd_user_readAnnouncement = 6005;
     // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc="活动操作码 - 61xx">
@@ -100,7 +99,7 @@ class CmdCode {
      * 7日奖励领取
      */
     const active_day7_drawreward = 6101;
-    
+
     /**
      * 7日累充奖励领取
      */
@@ -118,25 +117,23 @@ class CmdCode {
      * [6202] 任务 - 领取任务奖励
      */
     const cmd_task_getReward = 6202;
-   
+
     /**
      * 领取成就奖励
      */
     const cmd_task_getAchieveReward = 6203;
-    
+
     /**
      * 领取活动任务奖励
      */
     const cmd_task_receiveActiveTaskReward = 6204;
-    
+
     /**
      * 领取活跃点宝箱奖励
      */
     const cmd_task_receiveActivePointBoxReward = 6205;
-    
-     // </editor-fold>
-    //     
-    
+    // </editor-fold>
+    //
     // <editor-fold defaultstate="collapsed" desc="背包操作码 - 64xx">
 
     const cmd_store_put = 6401;
@@ -167,22 +164,22 @@ class CmdCode {
      * 合成
      */
     const store_gemCompose = 6406;
-    
+
     /**
      * 消耗体力
      */
     const store_comsumeTili = 6407;
-    
+
     /**
      * 切换装备分页
      */
     const store_switchEquipPag = 6408;
-    
+
     /**
      * 宝石开锁解锁
      */
     const store_gemLockState = 6409;
-          
+
     /**
      * 移除装备可以升级的提示
      */
@@ -209,7 +206,7 @@ class CmdCode {
      * 商城购买东西
      */
     const cmd_shop_BuyGift = 6501;
-    
+
     /**
      * 购买体力
      */
@@ -227,19 +224,17 @@ class CmdCode {
      * 解锁英雄
      */
     const hero_unlock = 6602;
-    
+
     /**
      * 购买角色
      */
     const hero_buy = 6603;
-    
     //
 // </editor-fold>
- 
     // <editor-fold defaultstate="collapsed" desc="邮件操作码 - 67xx">
 
     const cmd_email_questEmailList = 6701;
-    
+
     /**
      * [6702]读取/打开一封邮件
      */
@@ -271,44 +266,53 @@ class CmdCode {
     const cmd_mail_sendTestItems = 6707;
     // </editor-fold>
     //
-    
-    
-    
     // <editor-fold defaultstate="collapsed" desc="战斗操作码 - 68xx">
 
-    const cmd_fight_settle = 6801;
+    /**
+     * 主线剧情: 奖励结算
+     */
+    const fight_settle = 6801;
 
     /**
      * 章节宝箱的领取
      */
-    const cmd_fight_PassGateTsPrizeReceive = 6802;
+    const fight_PassGateTsPrizeReceive = 6802;
+
+    /**
+     * 主线关卡: 选择
+     */
+    const fight_selectGate = 6803;
 
     /**
-     * 关卡选择
+     * 挑战关卡: 领取奖励
      */
-    const cmd_fight_selectGate = 6803;
-    const cmd_fight_gateChallengePriceReviced = 6804;
+    const fight_gateChallengePriceReviced = 6804;
 
     /**
-     * 进化解锁
+     * 挑战关卡: 开始挑战
      */
-    const cmd_fight_evolveUnlock = 6805;
+    const fihgt_towerStart = 6805;
 
     /**
-     *
+     * 主线剧情关卡: 回存(剧情已播放)记录
      */
-    const cmd_fight_plotSav = 6806;
+    const fight_plotSav = 6806;
 
     /**
      * 巡逻
      */
-    const cmd_fight_sweep = 6807;
+    const fight_sweep = 6807;
 
     /**
-     * 开始挑战
+     * 主线关卡: 开始挑战
      */
     const fight_startFight = 6808;
 
+    /**
+     * 挑战关卡: 刷新初始技能
+     */
+    const fight_tower_RefreshSkills = 6809;
+
     // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc="    反射方法    ">
 

+ 41 - 47
Gameserver/App/base/ErrCode.php

@@ -269,9 +269,9 @@ class ErrCode {
      * 资源点不足
      */
     const notenough_resPoint = 3048;
-    
+
     /**
-     * 
+     *
      */
     const notenough_item = 3049;
 // </editor-fold>
@@ -332,124 +332,118 @@ class ErrCode {
      * 没有这种奖励类型
      */
     const user_reward_typeno = 3031;
-
 // </editor-fold>
 //
+//   // <editor-fold defaultstate="collapsed" desc="    关卡     ">
 
-//   // <editor-fold defaultstate="collapsed" desc="    关卡     ">    
+    const gate_NoUserGateInfo = 3201;
 
-    const user_Gate_NoUserGateInfo = 3201;  
-    
     /**
-     * 
+     *
      */
-    const user_Gate_GateNoUnlock = 3202;
-    
+    const gate_GateNoUnlock = 3202;
+
     /**
      * 奖励已经被领取
      */
-    const user_Gate_GatePriceHasReceive = 3203;
-    
+    const gate_GatePriceHasReceive = 3203;
+
     /**
      * 不能扫荡
      */
-    const user_Gate_NoSweep = 3204;
-    
+    const gate_NoSweep = 3204;
+
     /**
      * 今日扫荡已达最大次数
      */
-    const user_Gate_SweepMaxNum_limit = 3205;
+    const gate_SweepMaxNum_limit = 3205;
+
+    /**
+     * 挑战关卡: 今日挑战次数已用完
+     */
+    const tower_timeNo = 3210;
+
+    /**
+     * 挑战关卡: 今日技能免费刷新次数已经用完
+     */
+    const tower_refreshNo = 3211;
+
 // </editor-fold>
 //
-    
-//   // <editor-fold defaultstate="collapsed" desc="    store 3300    ">    
+//   // <editor-fold defaultstate="collapsed" desc="    store 3300    ">
 
     /**
      * 不存在该装备
      */
     const user_store_NoEquip = 3301;
-    
+
     /**
      * 背包
      */
     const user_store_NoItem = 3302;
-    
+
     /**
      * 宝石不能被镶嵌
      */
     const user_store_GemCanotSet = 3303;
-    
+
     /**
      * 不存在可以替换的宝石
      */
     const user_store_NoExistGemReplace = 3304;
-    
+
     /**
      * 同一件装备无法镶嵌多个技能相同的宝石
      */
-    const user_store_SameGemCanotEquip= 3305;
-    
+    const user_store_SameGemCanotEquip = 3305;
+
     /**
      * 前端给的宝石存在不能合成的宝石
      */
     const user_store_GemCanotCompose = 3306;
-    
     const user_store_NotExistGem = 3307;
-    
     const user_store_GemNotXilian = 3308;
 // </editor-fold>
 //
-    
-    
-//   // <editor-fold defaultstate="collapsed" desc="    shop 3400    ">    
+//   // <editor-fold defaultstate="collapsed" desc="    shop 3400    ">
 
     const user_shop_NotRepeatBuy = 3401;
-    
     const user_shop_LimitNum = 3402;
-    
+
     /**
      * 活动过期
      */
     const user_shop_activeExpire = 3403;
-    
     const user_shop_FreeNumLimit = 3404;
-    
     const user_shop_buyTiliNumLimit = 3405;
     const user_shop_GuanggaoGetTiliNumLimit = 3406;
 // </editor-fold>
 //
-    
-//   // <editor-fold defaultstate="collapsed" desc="    active 3500    ">    
+//   // <editor-fold defaultstate="collapsed" desc="    active 3500    ">
 
     /**
      * 奖励已经领过
      */
     const active_hasgetted = 3501;
-    
+
     /**
      * 无效的时间内不能领取奖励
      */
     const active_day7_expired = 3502;
-    
+
 // </editor-fold>
-//    
-    
-//   // <editor-fold defaultstate="collapsed" desc="    task 3600    ">    
+//
+//   // <editor-fold defaultstate="collapsed" desc="    task 3600    ">
 
     /**
      * 任务不存在
      */
     const task_NoExist = 3601;
-    
-    const task_CanotPriceReviced= 3602;
-    
-    const task_PriceRepeatReviced= 3603;
-       
-// </editor-fold>
-//  
-    
-    
+    const task_CanotPriceReviced = 3602;
+    const task_PriceRepeatReviced = 3603;
 
+// </editor-fold>
+//
 // <editor-fold defaultstate="collapsed" desc="    反射方法    ">
 
     /**

+ 1 - 1
Gameserver/App/main.php

@@ -91,7 +91,7 @@ function gMongo() {
 
 /**
  * 简化提取全局变量的写法
- * @return \globalsettings
+ * @return \sm_globalsettings
  */
 function glc() {
     return GameConfig::globalsettings();

+ 1 - 1
Gameserver/App/model/User/Info_Gates.php

@@ -133,7 +133,7 @@ class Info_Gates extends Object_ext {
      */
     public function CurGateInfo() {
         $gateId = $this->CurrentGateId;
-        my_Assert(StlUtil::dictHasProperty($this->GateList, $gateId), ErrCode::user_Gate_NoUserGateInfo);
+        my_Assert(StlUtil::dictHasProperty($this->GateList, $gateId), ErrCode::gate_NoUserGateInfo);
         $gateInfo = ctx()->gates->GateList->$gateId;
         return $gateInfo;
     }

+ 14 - 9
Gameserver/App/model/User/Ins_TowerGateInfo.php

@@ -1,5 +1,4 @@
 <?php
- 
 
 namespace loyalsoft;
 
@@ -8,13 +7,19 @@ namespace loyalsoft;
  * @author gwang
  */
 class Ins_TowerGateInfo {
-   /**
-    * @var int 当前层数
-    */
-   public $CurLayer = 0;
 
-   /**
-    * @var type 当天挑战次数
-    */
-   public $TodayChanNum = 0;
+    /**
+     * @var int 当前层数
+     */
+    public $CurLayer = 0;
+
+    /**
+     * @var int 当天挑战次数
+     */
+    public $TodayChanNum = 0;
+
+    /**
+     * @var int 当天刷新技能次数
+     */
+    public $RefreshSkillTimes = 0;
 }

+ 157 - 156
Gameserver/App/process/FightProc.php

@@ -1,4 +1,5 @@
 <?php
+
 namespace loyalsoft;
 
 /**
@@ -14,112 +15,118 @@ class FightProc {
      */
     public static function procMain($req) {
         switch ($req->cmd) {
-            case CmdCode::cmd_fight_settle:                                     # 6801 战斗结算
+            case CmdCode::fight_settle:                                         # 6801 主线战斗结算
                 return FightProc::Settle();
-            case CmdCode::cmd_fight_PassGateTsPrizeReceive:                     # 6802 章节宝箱的领取
+            case CmdCode::fight_PassGateTsPrizeReceive:                         # 6802 章节宝箱的领取
                 return FightProc::PassGateTsPrizeReceive();
-            case CmdCode::cmd_fight_selectGate:                                 # 6803 关卡选择
+            case CmdCode::fight_selectGate:                                     # 6803 主线剧情关卡选择
                 return FightProc::SelectGate();
-            case CmdCode::cmd_fight_gateChallengePriceReviced:                  # 6804 挑战奖励
+            case CmdCode::fight_gateChallengePriceReviced:                      # 6804 挑战关卡: 领取奖励
                 return FightProc::GateChallengePriceReviced();
-            case CmdCode::cmd_fight_evolveUnlock:                               # 6805 进化解锁
-                return FightProc::EvolveUnlock();
-            case CmdCode::cmd_fight_plotSav:                                    # 6806 剧情回存
+            case CmdCode::fihgt_towerStart:                                     # 6805 挑战关卡: 开始挑战
+                return FightProc::ChallengeGateStartFight();
+            case CmdCode::fight_plotSav:                                        # 6806 主线剧情(已播放)回存
                 return FightProc::PlotSav();
-            case CmdCode::cmd_fight_sweep:                                      #6807 扫荡
+            case CmdCode::fight_sweep:                                          # 6807 主线扫荡
                 return FightProc::FightSweep();
-            case CmdCode::fight_startFight:                                     # 6808 开始挑战
+            case CmdCode::fight_startFight:                                     # 6808 主线剧情关卡开始挑战
                 return self::StartFight();
+            case CmdCode::fight_tower_RefreshSkills:                            # 6809 挑战关卡: 刷新初始技能
+                return self::TowerRefreshSkills();
             default:
                 Err(ErrCode::cmd_err);
         }
     }
-    
+
+    /**
+     * 6807 扫荡
+     * @return type
+     */
     public static function FightSweep() {
-        //list($gateId) = req()->paras;        
-        my_Assert(ctx()->gates->UnlockedGatesMaxId != 0, ErrCode::user_Gate_NoSweep);
+        //list($gateId) = req()->paras;
+        my_Assert(ctx()->gates->UnlockedGatesMaxId != 0, ErrCode::gate_NoSweep);
         $mo = GameConfig::gate_getItem(ctx()->gates->UnlockedGatesMaxId);
         $costTili = glc()->sweep_cost_tili;
         my_Assert(ctx()->baseInfo->tili >= $costTili, ErrCode::notenough_tili);
         $max = glc()->sweepMaxNum;
-        my_Assert(ctx()->gates->fightSweepNum < $max, ErrCode::user_Gate_SweepMaxNum_limit);
+        my_Assert(ctx()->gates->fightSweepNum < $max, ErrCode::gate_SweepMaxNum_limit);
         ctx()->gates->fightSweepNum += 1;
         ctx()->baseInfo->Consume_tili($costTili);
         $prizeArr = array();
         $prizeArr[] = $mo->reward_win;
-        if($mo->sweep_gold != null){
+        if ($mo->sweep_gold != null) {
             $goodsStr = self::sweepRandReward($mo->sweep_gold);
             $prizeArr[] = $goodsStr;
             StoreProc::AddMultiItemInStore($goodsStr);
         }
-        
-        if($mo->sweep_tuzhi != null){
+
+        if ($mo->sweep_tuzhi != null) {
             $goodsStr = self::sweepRandReward($mo->sweep_tuzhi);
             $prizeArr[] = $goodsStr;
             StoreProc::AddMultiItemInStore($goodsStr);
         }
-        
-        if($mo->sweep_gem != null){
+
+        if ($mo->sweep_gem != null) {
             $goodsStr = self::sweepRandReward($mo->sweep_gem);
             $list = explode(',', $goodsStr);
-            $posId = rand(1,6);
+            $posId = rand(1, 6);
             $qual = $list[0];
             $dic = GameConfig::gem();
-            
+
             foreach ($dic as $key => $gemMo) {
-                if($gemMo->qual == $qual && $gemMo->position == $posId){
-                    $prizeArr[] = $gemMo->typeId.','.$list[1];               
-                    StoreProc::PutGemInStore($gemMo->typeId, $list[1]);                    
+                if ($gemMo->qual == $qual && $gemMo->position == $posId) {
+                    $prizeArr[] = $gemMo->typeId . ',' . $list[1];
+                    StoreProc::PutGemInStore($gemMo->typeId, $list[1]);
                     break;
                 }
-            }                      
+            }
         }
-        
-        if($mo->sweep_qiling != null){
+
+        if ($mo->sweep_qiling != null) {
             $goodsStr = self::sweepRandReward($mo->sweep_qiling);
             $prizeArr[] = $goodsStr;
             StoreProc::AddMultiItemInStore($goodsStr);
         }
-        
+
         UserProc::updateUserInfo();
         $ret = array(
             'tili' => ctx()->baseInfo->tili,
-            'fightSweepNum'=>ctx()->gates->fightSweepNum,
-            'prizeArr'=> $prizeArr,
+            'fightSweepNum' => ctx()->gates->fightSweepNum,
+            'prizeArr' => $prizeArr,
             'store' => ctx()->store,
         );
         return Resp::ok($ret);
     }
-    
+
     static function sweepRandReward($rewardStr) {
         $ctxArr = explode(';', $rewardStr);
         $numArr = explode('-', $ctxArr[0]);
-        $num = rand($numArr[0],$numArr[1]);
-                      
-        $randNum = rand(1,100);
+        $num = rand($numArr[0], $numArr[1]);
+
+        $randNum = rand(1, 100);
         $start = 0;
         $end = 0;
-        
+
         $res = "";
-        $itemArr = explode(',', $ctxArr[1]);             
+        $itemArr = explode(',', $ctxArr[1]);
         foreach ($itemArr as $str) {
             $arr = explode(':', $str);
             $itemId = $arr[0]; 
             $per = $arr[1];
-            
+                                
             $end += $per;
-            if($randNum >= $start && $randNum < $end){             
+            if ($randNum >= $start && $randNum < $end) {
                 $res = $itemId;
                 break;
             }
-            $start = $end;                     
+            $start = $end;
         }
-        
-        return $res.','.$num;
+
+        return $res . ',' . $num;
     }
 
     /**
-     * 6808 开始挑战 (扣除体力)
+     * 6808 主线关卡: 开始挑战 (扣除体力)
      */
     private static function StartFight() {
         list($gateId) = req()->paras;
@@ -131,7 +138,7 @@ class FightProc {
     }
 
     /**
-     * 6807 巡逻奖励领取 废弃
+     * [废弃] 6807 巡逻奖励领取
      * @return type
      */
     public static function XunluoPrizeReceived() {
@@ -294,7 +301,7 @@ class FightProc {
     }
 
     /**
-     * 剧情回存
+     * 6806 剧情回存
      * @return type
      */
     public static function PlotSav() {
@@ -311,153 +318,93 @@ class FightProc {
     }
 
     /**
-     * 6805 进化解锁
-     * @return type
+     * 6809 挑战关卡: 刷新初始技能(扣除免费次数/cost)
      */
-    public static function EvolveUnlock() {
-        list($type, $id) = req()->paras;
-
-        if ($type == 1) {
-            $mo = GameConfig::evolve_getItem($id);
-            my_Assert($mo != null, ErrCode::err_const_no);
-
-            my_Assert(ctx()->baseInfo->gold >= $mo->needGold_unlock, ErrCode::notenough_gold_msg);
-            ctx()->baseInfo->Consume_Gold($mo->needGold_unlock);
-            ctx()->gates->evolveMaxId_left = $id;
-            
-        } else {
-            $dic = GameConfig::evolve();
-            foreach ($dic as $key => $value) {
-                if ($value->specificEvolveId == $id) {
-                    $mo = $value;
-                }
+    public static function TowerRefreshSkills() {
+        list($isFree) = req()->paras;                                           # 参数解析
+        if ($isFree) {
+            if (ctx()->gates()->TowerGateInfo()->RefreshSkillTimes < glc()->tower_daily_refreshChanceNum) {
+                ctx()->gates()->TowerGateInfo()->RefreshSkillTimes++;
+                UserProc::updateUserInfo();
+                return Resp::ok();
+            } else {
+                return Resp::err(ErrCode::tower_refreshNo);
             }
-
-            my_Assert($mo != null, ErrCode::err_const_no);
-            if ($mo->specificEvolveCost != null) {
-                $cost = explode(',', $mo->specificEvolveCost);
-                $costId = $cost[0];
-                $costNum = $cost[1];
-                my_Assert(StlUtil::dictHasProperty(ctx()->store->items, $costId) && ctx()->store->items->$costId >= $costNum, ErrCode::notenough_item);
+        } else {
+            list($type, $num) = explode(':', glc()->tower_refreshCost);         # 二级货币类型(1:金币,2:元宝):数量
+            if ($type == 1) {                                                   # 金币
+                my_Assert(ctx()->base()->Consume_Gold($num), ErrCode::notenough_gold_msg);
+            } else if ($type == 2) {                                            # 元宝
+                my_Assert(ctx()->base()->Consume_Cash($num), ErrCode::notenough_cash_msg);
+            } else {
+                return Resp::err(ErrCode::err_const_no, "检查刷新扣费配置信息!");
             }
-            ctx()->gates->evolveMaxId_right = $id;
-//             my_Assert(ctx()->baseInfo->gold>=$mo->needGold_unlock, ErrCode::notenough_gold_msg);
+            return Resp::ok();
         }
-
-     
-        UserProc::updateUserInfo();
-        $ret = array(
-            'store' => ctx()->store,
-            'gates' => ctx()->gates,
-        );
-        return Resp::ok($ret);
     }
 
     /**
-     * 6804 挑战奖励领取
+     * 6805 挑战关卡: 开始挑战(扣除次数)
      * @return type
      */
-    public static function GateChallengePriceReviced() {
-        list($zhangjieId, $gateId) = req()->paras;
-
-        $gateMo = GameConfig::gate_getItem($gateId);
-        my_Assert($gateMo != null, ErrCode::err_const_no);
-
-        if (!StlUtil::dictHasProperty(ctx()->gates->GatesChallengeRecord, $zhangjieId)) {
-            ctx()->gates->GatesChallengeRecord->$zhangjieId = array();
+    public static function ChallengeGateStartFight() {
+        if (ctx()->gates()->TowerGateInfo()->TodayChanNum > glc()->tower_daily_chanceNum) {
+            return Resp::err(ErrCode::tower_timeNo);
         }
-
-        my_Assert(!in_array($gateId, ctx()->gates->GatesChallengeRecord->$zhangjieId), ErrCode::user_Gate_GatePriceHasReceive);
-        my_Assert(in_array($gateMo->challengeUnlockId, ctx()->gates->GatesChallengeRecord->$zhangjieId), ErrCode::user_Gate_GateNoUnlock);
-
-        ctx()->gates->GatesChallengeRecord->$zhangjieId[] = $gateId;
-
-        StoreProc::AddMultiItemInStore($gateMo->reward_win);
-
-        ctx()->gates->CurrentGateId = $gateId;
-
+        ctx()->gates()->TowerGateInfo()->TodayChanNum++;
         UserProc::updateUserInfo();
-        $ret = array(
-            'store' => ctx()->store,
-            'gates' => ctx()->gates,
-        );
-        return Resp::ok($ret);
+        return Resp::ok();
     }
 
     /**
-     * 关卡选择
+     * 6804 挑战关卡: 奖励领取
      * @return type
      */
-    public static function SelectGate() {
-        list($gateId) = req()->paras;
-
-        ctx()->gates->CurrentGateId = $gateId;
+    public static function GateChallengePriceReviced() {
+//        list($zhangjieId, $gateId) = req()->paras;
+//
+//        $gateMo = GameConfig::gate_getItem($gateId);
+//        my_Assert($gateMo != null, ErrCode::err_const_no);
+//
+//        if (!StlUtil::dictHasProperty(ctx()->gates->GatesChallengeRecord, $zhangjieId)) {
+//            ctx()->gates->GatesChallengeRecord->$zhangjieId = array();
+//        }
+//
+//        my_Assert(!in_array($gateId, ctx()->gates->GatesChallengeRecord->$zhangjieId), ErrCode::gate_GatePriceHasReceive);
+//        my_Assert(in_array($gateMo->challengeUnlockId, ctx()->gates->GatesChallengeRecord->$zhangjieId), ErrCode::gate_GateNoUnlock);
+//
+//        ctx()->gates->GatesChallengeRecord->$zhangjieId[] = $gateId;
+//
+//        StoreProc::AddMultiItemInStore($gateMo->reward_win);
+//
+//        ctx()->gates->CurrentGateId = $gateId;
 
         UserProc::updateUserInfo();
         $ret = array(
+            'store' => ctx()->store,
             'gates' => ctx()->gates,
         );
         return Resp::ok($ret);
     }
 
     /**
-     * [6801]关卡战斗结算
+     * 6803 关卡选择
      * @return type
      */
-    public static function Settle() {
-        list($resultType, $gateId, $gold, $curTs, $pickups) = req()->paras;
-        $gateMo = GameConfig::gate_getItem($gateId);
-        my_Assert($gateMo != null, ErrCode::err_const_no);              
-        my_Assert(StlUtil::dictHasProperty(ctx()->gates->GateList, $gateId), ErrCode::user_Gate_NoUserGateInfo);
-        $gateInfo = ctx()->gates->GateList->$gateId;
-        $ts = $gateInfo->MaxSeconds;
-        if ($curTs >= $ts) {
-            $gateInfo->MaxSeconds = $curTs;
-        }
-        if ($resultType) {                                                      # 胜利
-            if (ctx()->gates->GateList->$gateId->pass == 0) {
-                ctx()->gates->GateList->$gateId->pass = 1;                                             
-            }
-            StoreProc::AddMultiItemInStore($gateMo->reward_win);
-            if(Ins_GateInfo::GateTypeFromId($gateId) == Enum_GateType::MainStoryGate){
-                ctx()->gates->UnlockNextPlotGate();    
-                $dic = GameConfig::gate();
-                $index = 0;                                                   # 挑战关卡解锁逻辑. -gwang 2024年4月15日    
-                foreach ($dic as $id => $item) {
-                    if(Ins_GateInfo::GateTypeFromId($id) == Enum_GateType::MainChallengeGate
-                            && $item->challengeGateId == $gateId){
-                        $index += 1;
-                        $gate = new Ins_GateInfo();
-                        $gate->GateId = $id;                                             
-                        ctx()->gates->GateList->$id = $gate;
-                    }                    
-                    if($index >= 3){
-                        break;
-                    }
-                }                
-            } else {
-                
-            }
-            
-        } else {                                                                # 失败
-            StoreProc::AddMultiItemInStore($gateMo->reward_fail);
-        }
-
-        StoreProc::AddMultiItemInStore($pickups);                               # 战场拾取道具
-        ctx()->baseInfo->Add_Gold($gold);
-        //ctx()->baseInfo->Add_Exp($exp);
+    public static function SelectGate() {
+        list($gateId) = req()->paras;
 
+        ctx()->gates->CurrentGateId = $gateId;
 
         UserProc::updateUserInfo();
         $ret = array(
             'gates' => ctx()->gates,
-            'store' => ctx()->store,
         );
         return Resp::ok($ret);
     }
 
     /**
-     * 章节宝箱的领取
+     * 6802 章节宝箱的领取
      * @return type
      */
     public static function PassGateTsPrizeReceive() {
@@ -466,7 +413,7 @@ class FightProc {
         $gateMo = GameConfig::gate_getItem($gateId);
         my_Assert($gateMo != null, ErrCode::err_const_no);
 
-        my_Assert(StlUtil::dictHasProperty(ctx()->gates->GateList, $gateId), ErrCode::user_Gate_NoUserGateInfo);
+        my_Assert(StlUtil::dictHasProperty(ctx()->gates->GateList, $gateId), ErrCode::gate_NoUserGateInfo);
         $gateInfo = ctx()->gates->GateList->$gateId;
 
         $tag = false;
@@ -501,12 +448,66 @@ class FightProc {
         }
 
         if ($tag) {
-            my_Assert($mask > $gateInfo->FirstReward, ErrCode::user_Gate_GatePriceHasReceive);
+            my_Assert($mask > $gateInfo->FirstReward, ErrCode::gate_GatePriceHasReceive);
             $gateInfo->FirstReward = $mask;
-            StoreProc::AddMultiItemInStore($prize);           
+            StoreProc::AddMultiItemInStore($prize);
         }
         ctx()->gates->GateList->$gateId = $gateInfo;
 
+        UserProc::updateUserInfo();
+        $ret = array(
+            'gates' => ctx()->gates,
+            'store' => ctx()->store,
+        );
+        return Resp::ok($ret);
+    }
+
+    /**
+     * [6801]关卡战斗结算
+     * @return type
+     */
+    public static function Settle() {
+        list($resultType, $gateId, $gold, $curTs, $pickups) = req()->paras;
+        $gateMo = GameConfig::gate_getItem($gateId);
+        my_Assert($gateMo != null, ErrCode::err_const_no);
+        my_Assert(StlUtil::dictHasProperty(ctx()->gates->GateList, $gateId), ErrCode::gate_NoUserGateInfo);
+        $gateInfo = ctx()->gates->GateList->$gateId;
+        $ts = $gateInfo->MaxSeconds;
+        if ($curTs >= $ts) {
+            $gateInfo->MaxSeconds = $curTs;
+        }
+        if ($resultType) {                                                      # 胜利
+            if (ctx()->gates->GateList->$gateId->pass == 0) {
+                ctx()->gates->GateList->$gateId->pass = 1;
+            }
+            StoreProc::AddMultiItemInStore($gateMo->reward_win);
+            if (Ins_GateInfo::GateTypeFromId($gateId) == Enum_GateType::MainStoryGate) {
+                ctx()->gates->UnlockNextPlotGate();
+                $dic = GameConfig::gate();
+                $index = 0;                                                   # 挑战关卡解锁逻辑. -gwang 2024年4月15日
+                foreach ($dic as $id => $item) {
+                    if (Ins_GateInfo::GateTypeFromId($id) == Enum_GateType::MainChallengeGate && $item->challengeGateId == $gateId) {
+                        $index += 1;
+                        $gate = new Ins_GateInfo();
+                        $gate->GateId = $id;
+                        ctx()->gates->GateList->$id = $gate;
+                    }
+                    if ($index >= 3) {
+                        break;
+                    }
+                }
+            } else {
+
+            }
+        } else {                                                                # 失败
+            StoreProc::AddMultiItemInStore($gateMo->reward_fail);
+        }
+
+        StoreProc::AddMultiItemInStore($pickups);                               # 战场拾取道具
+        ctx()->baseInfo->Add_Gold($gold);
+        //ctx()->baseInfo->Add_Exp($exp);
+
+
         UserProc::updateUserInfo();
         $ret = array(
             'gates' => ctx()->gates,