王刚 1 жил өмнө
parent
commit
5eacdd534b

+ 30 - 31
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,41 +266,45 @@ 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;
 

+ 107 - 132
Gameserver/App/process/FightProc.php

@@ -1,4 +1,5 @@
 <?php
+
 namespace loyalsoft;
 
 /**
@@ -14,29 +15,33 @@ 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();
             default:
                 Err(ErrCode::cmd_err);
         }
     }
-    
+
+    /**
+     * 6807 扫荡
+     * @return type
+     */
     public static function FightSweep() {
-        //list($gateId) = req()->paras;        
+        //list($gateId) = req()->paras;
         my_Assert(ctx()->gates->UnlockedGatesMaxId != 0, ErrCode::user_Gate_NoSweep);
         $mo = GameConfig::gate_getItem(ctx()->gates->UnlockedGatesMaxId);
         $costTili = glc()->sweep_cost_tili;
@@ -47,79 +52,79 @@ class FightProc {
         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[1]; 
+            $itemId = $arr[1];
             $per = $arr[2];
-            
+
             $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 +136,7 @@ class FightProc {
     }
 
     /**
-     * 6807 巡逻奖励领取 废弃
+     * [废弃] 6807 巡逻奖励领取
      * @return type
      */
     public static function XunluoPrizeReceived() {
@@ -294,7 +299,7 @@ class FightProc {
     }
 
     /**
-     * 剧情回存
+     * 6806 剧情回存
      * @return type
      */
     public static function PlotSav() {
@@ -311,40 +316,12 @@ class FightProc {
     }
 
     /**
-     * 6805 进化解锁
+     * 6805 挑战关卡: 开始挑战(扣除次数)
      * @return type
      */
-    public static function EvolveUnlock() {
+    public static function ChallengeGateStartFight() {
         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;
-                }
-            }
-
-            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);
-            }
-            ctx()->gates->evolveMaxId_right = $id;
-//             my_Assert(ctx()->baseInfo->gold>=$mo->needGold_unlock, ErrCode::notenough_gold_msg);
-        }
-
-     
         UserProc::updateUserInfo();
         $ret = array(
             'store' => ctx()->store,
@@ -354,7 +331,7 @@ class FightProc {
     }
 
     /**
-     * 6804 挑战奖励领取
+     * 6804 挑战关卡: 奖励领取
      * @return type
      */
     public static function GateChallengePriceReviced() {
@@ -385,7 +362,7 @@ class FightProc {
     }
 
     /**
-     * 关卡选择
+     * 6803 关卡选择
      * @return type
      */
     public static function SelectGate() {
@@ -401,63 +378,7 @@ class FightProc {
     }
 
     /**
-     * [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::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);
-
-
-        UserProc::updateUserInfo();
-        $ret = array(
-            'gates' => ctx()->gates,
-            'store' => ctx()->store,
-        );
-        return Resp::ok($ret);
-    }
-
-    /**
-     * 章节宝箱的领取
+     * 6802 章节宝箱的领取
      * @return type
      */
     public static function PassGateTsPrizeReceive() {
@@ -503,10 +424,64 @@ class FightProc {
         if ($tag) {
             my_Assert($mask > $gateInfo->FirstReward, ErrCode::user_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::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);
+
+
         UserProc::updateUserInfo();
         $ret = array(
             'gates' => ctx()->gates,