cyzhao 1 year ago
parent
commit
e94ed95d9d

+ 6 - 1
Gameserver/App/base/ErrCode.php

@@ -350,10 +350,15 @@ class ErrCode {
      */
     const user_Gate_GatePriceHasReceive = 3203;
     
+    /**
+     * 不能扫荡
+     */
+    const user_Gate_NoSweep = 3204;
+    
     /**
      * 今日扫荡已达最大次数
      */
-    const user_Gate_sweepMaxNum_limit = 3204;
+    const user_Gate_SweepMaxNum_limit = 3205;
 // </editor-fold>
 //
     

+ 1 - 1
Gameserver/App/model/Const/GameConfig.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-05-08 16:00:26
+ // 日期: 2024-05-08 17:28:30
 ////////////////////
 
 /**

+ 9 - 24
Gameserver/App/model/Const/sm_gate.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-05-08 15:48:00
+ // 日期: 2024-05-08 17:28:11
 ////////////////////
 
 
@@ -112,39 +112,24 @@ class sm_gate
     public $unlockGateId;
 
     /**
-    * @var Int32 巡逻每小时产生金币【废弃】  
+    * @var String 扫荡额外金币  
     */
-    public $gold_xunluo;
+    public $sweep_gold;
 
     /**
-    * @var Int32 巡逻每小时产生经验【废弃】  
+    * @var String 扫荡得到的图纸  
     */
-    public $exp_xunluo;
+    public $sweep_tuzhi;
 
     /**
-    * @var String 产生精华道具时间(单位)分钟;例:开始分钟数,结束分钟数,两者间隔时间分钟数-道具ItemId,num;开始分钟数,结束分钟数,两者间隔时间分钟数-道具ItemId,num【废弃】  
+    * @var String 扫荡得到的宝石  
     */
-    public $xunluo_item_ts;
+    public $sweep_gem;
 
     /**
-    * @var String 产生装备的时间信息(单位)分钟【废弃】  
+    * @var String 扫荡得到的启灵材料 没有不需要填  
     */
-    public $xunluo_equip_ts;
-
-    /**
-    * @var String 产生图纸的时间信息(单位)分钟【废弃】  
-    */
-    public $xunluo_tuzhi_ts;
-
-    /**
-    * @var String 快速巡逻奖励信息【废弃】  
-    */
-    public $xueluo_quick_reward;
-
-    /**
-    * @var Int32 快速巡逻每日可领取次数限制【废弃】  
-    */
-    public $xueluo_quick_num;
+    public $sweep_qiling;
 
     /**
     * @var String 章节磁条Id  

+ 1 - 1
Gameserver/App/model/Const/sm_predicate.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-05-08 11:43:45
+ // 日期: 2024-05-08 16:32:56
 ////////////////////
 
 

+ 71 - 6
Gameserver/App/process/FightProc.php

@@ -26,7 +26,7 @@ class FightProc {
                 return FightProc::EvolveUnlock();
             case CmdCode::cmd_fight_plotSav:                                    # 6806 剧情回存
                 return FightProc::PlotSav();
-            case CmdCode::cmd_fight_sweep:                                      #6807 
+            case CmdCode::cmd_fight_sweep:                                      #6807 扫荡
                 return FightProc::FightSweep();
             case CmdCode::fight_startFight:                                     # 6808 开始挑战
                 return self::StartFight();
@@ -36,22 +36,87 @@ class FightProc {
     }
     
     public static function FightSweep() {
-        //list($gateId) = req()->paras;
-        
-        $costTili = GameConfig::gate_getItem(ctx()->gates->UnlockedGatesMaxId)->sweep_cost_tili;
+        //list($gateId) = req()->paras;        
+        my_Assert(ctx()->gates->UnlockedGatesMaxId != 0, ErrCode::user_Gate_NoSweep);
+        $mo = GameConfig::gate_getItem(ctx()->gates->UnlockedGatesMaxId);
+        $costTili = $mo->sweep_cost_tili;
         my_Assert(ctx()->baseInfo->tili >= $costTili, ErrCode::notenough_tili);
-        $max = GameConfig::gate_getItem(ctx()->gates->UnlockedGatesMaxId)->sweepNum;
-        my_Assert(ctx()->gates->fightSweepNum < $max, ErrCode::user_Gate_sweepMaxNum_limit);
+        $max = $mo->sweepNum;
+        my_Assert(ctx()->gates->fightSweepNum < $max, ErrCode::user_Gate_SweepMaxNum_limit);
         ctx()->gates->fightSweepNum += 1;
         
+        $prizeArr = array();
+        $prizeArr[] = $mo->reward_win;
+        if($mo->sweep_gold != null){
+            $goodsStr = self::sweepRandReward($mo->sweep_gold);
+            $prizeArr[] = $goodsStr;
+            StoreProc::AddMultiItemInStore($goodsStr);
+        }
+        
+        if($mo->sweep_tuzhi != null){
+            $goodsStr = self::sweepRandReward($mo->sweep_tuzhi);
+            $prizeArr[] = $goodsStr;
+            StoreProc::AddMultiItemInStore($goodsStr);
+        }
+        
+        if($mo->sweep_gem != null){
+            $goodsStr = self::sweepRandReward($mo->sweep_gem);
+            $list = explode(',', $goodsStr);
+            $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]);                    
+                    break;
+                }
+            }                      
+        }
+        
+        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,
             'store' => ctx()->store,
         );
         return Resp::ok($ret);
     }
+    
+    static function sweepRandReward($rewardStr) {
+        $ctxArr = explode(';', $rewardStr);
+        $randNum = rand(1,100);
+        $start = 0;
+        $end = 0;
+        
+        $res = "";
+        foreach ($ctxArr as $str) {
+            $arr = explode(',', $str);
+            $itemId = $arr[1]; 
+            $per = $arr[2];
+            
+            $end += $per;
+            if($randNum >= $start && $randNum < $end){
+                $numArr = explode('-', $arr[0]);
+                $n = rand($numArr[0],$numArr[1]);
+                $res = $itemId.','.$n;
+                break;
+            }
+            $start = $end;
+            
+            
+        }
+        
+        return $res;
+    }
 
     /**
      * 6808 开始挑战 (扣除体力)