Explorar o código

扫荡配置改到waves表

cyzhao hai 1 ano
pai
achega
560b4edc70
Modificáronse 1 ficheiros con 47 adicións e 21 borrados
  1. 47 21
      Gameserver/App/process/FightProc.php

+ 47 - 21
Gameserver/App/process/FightProc.php

@@ -60,8 +60,10 @@ class FightProc {
      */
      */
     public static function FightSweep() {
     public static function FightSweep() {
         //list($gateId) = req()->paras;
         //list($gateId) = req()->paras;
-        my_Assert(ctx()->gates->UnlockedGatesMaxId != 0, ErrCode::gate_NoSweep);
-        $mo = GameConfig::gate_getItem(ctx()->gates->UnlockedGatesMaxId);
+        
+        $passGateId = ctx()->gates->maxPassGateId();
+        my_Assert($passGateId != 0, ErrCode::gate_NoSweep);
+        //$mo = GameConfig::gate_getItem(ctx()->gates->UnlockedGatesMaxId);
         $costTili = glc()->sweep_cost_tili;
         $costTili = glc()->sweep_cost_tili;
         my_Assert(ctx()->baseInfo->tili >= $costTili, ErrCode::notenough_tili);
         my_Assert(ctx()->baseInfo->tili >= $costTili, ErrCode::notenough_tili);
         $max = glc()->sweepMaxNum;
         $max = glc()->sweepMaxNum;
@@ -69,21 +71,39 @@ class FightProc {
         ctx()->gates->fightSweepNum += 1;
         ctx()->gates->fightSweepNum += 1;
         ctx()->baseInfo->Consume_tili($costTili);
         ctx()->baseInfo->Consume_tili($costTili);
         $prizeArr = array();
         $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);
+        
+        $wavesArr = GameConfig::waves_getItemArray($passGateId);
+        $count = count($wavesArr);
+        $wavesMo = $wavesArr[$count-1];
+        
+        ctx()->baseInfo->Add_Gold($wavesMo->rewardGold); 
+        $gold = $wavesMo->rewardGold;
+        $prizeArr[] = "1,".$gold;
+           
+        $exp = $wavesMo->rewardExp;
+        $prizeArr[] = "1,".$exp;
+        ctx()->baseInfo->Add_Exp($exp);
+        if ($wavesMo->rewardTuZhi != null) {
+            $tuzhi = explode('-', $wavesMo->rewardTuZhi);
+            $n = rand($tuzhi[0],$tuzhi[1]);
+            
+            $tuzhiArr = array();
+            $item = GameConfig::item();
+            foreach ($item as $id => $mo) {
+                if($mo->itemType == 100){
+                    $tuzhiArr[] = $id;
+                }
+            }
+            
+            $index = rand(0,count($tuzhiArr)-1);                      
+            $goodsStr = $tuzhiArr[$index].','.$n;
+            
             $prizeArr[] = $goodsStr;
             $prizeArr[] = $goodsStr;
             StoreProc::AddMultiItemInStore($goodsStr);
             StoreProc::AddMultiItemInStore($goodsStr);
         }
         }
 
 
-        if ($mo->sweep_gem != null) {
-            $goodsStr = self::sweepRandReward($mo->sweep_gem);
+        if ($wavesMo->rewardGem != null) {
+            $goodsStr = self::sweepRandReward($wavesMo->rewardGem);
             $list = explode(',', $goodsStr);
             $list = explode(',', $goodsStr);
             $posId = rand(1, 6);
             $posId = rand(1, 6);
             $qual = $list[0];
             $qual = $list[0];
@@ -98,12 +118,7 @@ class FightProc {
             }
             }
         }
         }
 
 
-        if ($mo->sweep_qiling != null) {
-            $goodsStr = self::sweepRandReward($mo->sweep_qiling);
-            $prizeArr[] = $goodsStr;
-            StoreProc::AddMultiItemInStore($goodsStr);
-        }
-
+       
         UserProc::updateUserInfo();
         UserProc::updateUserInfo();
         $ret = array(
         $ret = array(
             'tili' => ctx()->baseInfo->tili,
             'tili' => ctx()->baseInfo->tili,
@@ -120,12 +135,23 @@ class FightProc {
         $numArr = explode('-', $ctxArr[0]);
         $numArr = explode('-', $ctxArr[0]);
         $num = rand($numArr[0], $numArr[1]);
         $num = rand($numArr[0], $numArr[1]);
 
 
-        $randNum = rand(1, 100);
+      
+        $rand = 0;
+        $itemArr = explode(',', $ctxArr[1]);
+        foreach ($itemArr as $value) {
+            $arr = explode(':', $value);
+            $itemId = $arr[0];
+            $per = $arr[1];
+            
+            $rand+=$per;
+        }
+        
+        $randNum = rand(1, $rand);
         $start = 0;
         $start = 0;
         $end = 0;
         $end = 0;
 
 
         $res = "";
         $res = "";
-        $itemArr = explode(',', $ctxArr[1]);
+        
         foreach ($itemArr as $str) {
         foreach ($itemArr as $str) {
             $arr = explode(':', $str);
             $arr = explode(':', $str);
             $itemId = $arr[0];
             $itemId = $arr[0];