Эх сурвалжийг харах

扫荡随机bug修复,邮件返回值修改

cyzhao 1 жил өмнө
parent
commit
d7adeeaa71

+ 9 - 3
Gameserver/App/process/EmailProc.php

@@ -159,6 +159,9 @@ class EmailProc {
         if ($mail->sender_name == '系统') {
             //TaskProc::OnDrawSysMail($mail->sender_uid);
         }
+        
+        $reward = implode(';', StoreProc::$reward);
+        
         self::logMailDrawed(array($mailId), $uid, $zoneid);                     # 更新数据库中邮件的领取记录
         UserProc::updateUserInfo();
         return Resp::ok(array(#                                                 # 同步数据
@@ -166,7 +169,8 @@ class EmailProc {
                     'hero' => ctx()->heros,
                     'baseInfo' => ctx()->base(),
                     'num' => 1,
-                    'reward' => $mail->appendix
+                    //'reward' => $mail->appendix
+                    'reward' => $reward,
         ));
     }
 
@@ -210,14 +214,16 @@ class EmailProc {
             self::updateMails($zoneid, $uid, $asocMails);                       # 批量更新邮件
             self::logMailDrawed($rewardEmailIds, $uid, $zoneid);                # 更新数据库中邮件的领取记录
         }
-        $reward = implode(';', $arr);                                           # 拼接下奖励字符串
+        //$reward = implode(';', $arr);                                           # 拼接下奖励字符串
+        $reward = implode(';', StoreProc::$reward);
+        
         UserProc::updateUserInfo();
         return Resp::ok(array(#                                                 # 同步数据
                     'baseInfo' => ctx()->base(),
                     'store' => ctx()->store,
                     'hero' => ctx()->heros,
                     'num' => $n,
-                    'reward' => $reward
+                    'reward' => $reward,                  
         ));
     }
 

+ 42 - 187
Gameserver/App/process/FightProc.php

@@ -81,9 +81,10 @@ class FightProc {
         ctx()->baseInfo->Add_Gold($wavesMo->rewardGold);
         $gold = $wavesMo->rewardGold;
         $prizeArr[] = "1," . $gold;
+        ctx()->baseInfo->Add_Gold($gold);
 
         $exp = $wavesMo->rewardExp;
-        $prizeArr[] = "1," . $exp;
+        $prizeArr[] = "4," . $exp;
         ctx()->baseInfo->Add_Exp($exp);
         if ($wavesMo->rewardTuZhi != null) {
             $tuzhi = explode('-', $wavesMo->rewardTuZhi);
@@ -106,16 +107,18 @@ class FightProc {
 
         if ($wavesMo->rewardGem != null) {
             $goodsStr = self::sweepRandReward($wavesMo->rewardGem);
-            $list = explode(',', $goodsStr);
-            $posId = rand(1, 6);
-            $qual = $list[0];
+            $str = explode(';', $goodsStr);
             $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;
+            foreach ($str as $value) {
+                $list = explode(',', $value);
+                $posId = rand(1, 6);
+                $qual = $list[0];
+                foreach ($dic as $key => $gemMo) {
+                    if ($gemMo->qual == $qual && $gemMo->position == $posId) {
+                        $prizeArr[] = $gemMo->typeId . ',' . $list[1];
+                        StoreProc::PutGemInStore($gemMo->typeId, $list[1]);
+                        break;
+                    }
                 }
             }
         }
@@ -136,7 +139,7 @@ class FightProc {
         $ctxArr = explode(';', $rewardStr);
         $numArr = explode('-', $ctxArr[0]);
         $num = rand($numArr[0], $numArr[1]);
-        
+
         $rand = 0;
         $itemArr = explode(',', $ctxArr[1]);
         foreach ($itemArr as $value) {
@@ -147,26 +150,36 @@ class FightProc {
             $rand += $per;
         }
 
-        $randNum = rand(1, $rand);
-        $start = 0;
-        $end = 0;
-
         $res = "";
+        for ($i = 0; $i < $num; $i++) {
+            $start = 0;
+            $end = 0;
+            $randNum = rand(1, $rand);
+            $id = 0;
+            foreach ($itemArr as $str) {
+                $arr = explode(':', $str);
+                $itemId = $arr[0];
+                $per = $arr[1];
+
+                $end += $per;
+                if ($randNum > $start && $randNum <= $end) {
+                    $id = $itemId;
+                    break;
+                }
+                $start = $end;
+            }
 
-        foreach ($itemArr as $str) {
-            $arr = explode(':', $str);
-            $itemId = $arr[0];
-            $per = $arr[1];
-
-            $end += $per;
-            if ($randNum >= $start && $randNum < $end) {
-                $res = $itemId;
-                break;
+            if ($id != 0) {
+                $str = $id . ',1';
+                if ($res == "") {
+                    $res = $str;
+                } else {
+                    $res = $res . ';' . $str;
+                }
             }
-            $start = $end;
         }
 
-        return $res . ',' . $num;
+        return $res;
     }
 
     /**
@@ -194,164 +207,6 @@ class FightProc {
         return Resp::ok(array("tili" => ctx()->baseInfo->tili, "tili_ts" => ctx()->baseInfo->tili_ts));
     }
 
-    /**
-     * [废弃] 6807 巡逻奖励领取
-     * @return type
-     */
-    public static function XunluoPrizeReceived() {
-        list($type) = req()->paras;
-
-        $gateId = ctx()->gates->UnlockedGatesMaxId;
-        $gateMo = GameConfig::gate_getItem($gateId);
-        my_Assert($gateMo != null, ErrCode::err_const_no);
-
-        if ($type == 1) {//巡逻
-            $curTs = now();
-            $startTs = ctx()->gates->xunluo_StartTs;
-            $ts = $curTs - $startTs;
-            $ts2 = intval($ts / 60); //总的分钟数
-
-            $fenzhong = intval($ts2 / 10); //有几个10分钟
-            $gold = 0;
-            $exp = 0;
-            $price = "";
-            if ($fenzhong > 0) {
-                $gold = intval($gateMo->gold_xunluo / 6 * $fenzhong);
-                $exp = intval($gateMo->exp_xunluo / 6 * $fenzhong);
-                $price = "1," . $gold . ';' . "4," . $exp;
-            }
-
-            $itemStr = explode(';', $gateMo->xunluo_item_ts);
-            $itemId = 0;
-            $itemNum = 0;
-
-            $tempTs = 0;
-            foreach ($itemStr as $s) {
-                $arr = explode('-', $s);
-                $tsItemArr = explode(',', $arr[0]);
-                $sTs = $tsItemArr[0]; //开始时间
-                $eTs = $tsItemArr[1]; //终止时间
-                $produceTs = $tsItemArr[2]; //间隔
-                while (true) {
-                    $tempTs += $produceTs;
-                    if ($tempTs <= $eTs && $tempTs <= $ts2) {
-                        $sList = explode(',', $arr[1]);
-                        $itemId = $sList[0];
-                        $itemNum += $sList[1];
-                    }
-
-                    if ($tempTs >= $ts2) {
-                        break;
-                    }
-
-                    if ($tempTs >= $eTs) {
-                        $tempTs = $eTs;
-                        break;
-                    }
-                }
-
-                if ($tempTs >= $ts2) {
-                    break;
-                }
-            }
-            if ($itemNum > 0) {
-                $price = $price . ";" . $itemId . ',' . $itemNum;
-            }
-
-            //---------------------------
-            $tuzhiStr = explode(';', $gateMo->xunluo_tuzhi_ts);
-            $tuzhiId = 0;
-            $tuzhiNum = 0;
-
-            $tempTs2 = 0;
-            foreach ($tuzhiStr as $s) {
-                $arr = explode('-', $s);
-                $tsItemArr = explode(',', $arr[0]);
-                $sTs = $tsItemArr[0]; //开始时间
-                $eTs = $tsItemArr[1]; //终止时间
-                $produceTs = $tsItemArr[2]; //间隔
-
-                while (true) {
-                    $tempTs2 += $produceTs;
-                    if ($tempTs2 <= $eTs && $tempTs2 <= $ts2) {
-                        $sList = explode(',', $arr[1]);
-                        $tuzhiId = $sList[0];
-                        $tuzhiNum += $sList[1];
-                    }
-
-                    if ($tempTs2 >= $ts2) {
-                        break;
-                    }
-
-                    if ($tempTs2 >= $eTs) {
-                        $tempTs2 = $eTs;
-                        break;
-                    }
-                }
-
-                if ($tempTs2 >= $ts2) {
-                    break;
-                }
-            }
-            if ($tuzhiNum > 0) {
-                $price = $price . ";" . $tuzhiId . ',' . $tuzhiNum;
-            }
-
-            //---------------------
-            $equipStr = explode(';', $gateMo->xunluo_equip_ts);
-            $equipId = 0;
-            $equipNum = 0;
-
-            $tempTs3 = 0;
-            foreach ($equipStr as $s) {
-                $arr = explode('-', $s);
-                $tsItemArr = explode(',', $arr[0]);
-                $sTs = $tsItemArr[0]; //开始时间
-                $eTs = $tsItemArr[1]; //终止时间
-                $produceTs = $tsItemArr[2]; //间隔
-
-                while (true) {
-                    $tempTs3 += $produceTs;
-                    if ($tempTs3 <= $eTs && $tempTs3 <= $ts2) {
-                        $sList = explode(',', $arr[1]);
-                        $equipId = $sList[0];
-                        $equipNum += $sList[1];
-                    }
-
-                    if ($tempTs3 >= $ts2) {
-                        break;
-                    }
-
-                    if ($tempTs3 >= $eTs) {
-                        $tempTs3 = $eTs;
-                        break;
-                    }
-                }
-
-                if ($tempTs3 >= $ts2) {
-                    break;
-                }
-            }
-            if ($equipNum > 0) {
-                $price = $price . ";" . $equipId . ',' . $equipNum;
-            }
-            StoreProc::AddMultiItemInStore($price);
-            ctx()->gates->xunluo_StartTs = now();
-        } else {//快速巡逻
-            my_Assert(ctx()->gates->xunluo_quick_buyRecord < $gateMo->xueluo_quick_num, ErrCode::err_const_no);
-            ctx()->gates->xunluo_quick_buyRecord += 1;
-            ctx()->baseInfo->Consume_tili(15);
-            StoreProc::AddMultiItemInStore($gateMo->xueluo_quick_reward);
-        }
-
-        UserProc::updateUserInfo();
-        $ret = array(
-            'tili' => ctx()->baseInfo->tili,
-            'gates' => ctx()->gates,
-        );
-        return Resp::ok($ret);
-    }
-
     public static function FightDailyClear() {
         //ctx()->gates->xunluo_quick_buyRecord = 0;
         ctx()->gates->fightSweepNum = 0;
@@ -543,7 +398,7 @@ class FightProc {
         }
 
         if ($tag) {
-            my_Assert(!in_array($mask,$gateInfo->FirstReward), ErrCode::gate_GatePriceHasReceive);
+            my_Assert(!in_array($mask, $gateInfo->FirstReward), ErrCode::gate_GatePriceHasReceive);
             $gateInfo->FirstReward[] = $mask;
             StoreProc::AddMultiItemInStore($prize);
         }
@@ -555,7 +410,7 @@ class FightProc {
             'store' => ctx()->store,
             'task' => ctx()->task,
             'gold' => ctx()->baseInfo->gold,
-            'reward'=> StoreProc::$reward,
+            'reward' => StoreProc::$reward,
         );
         return Resp::ok($ret);
     }
@@ -1089,7 +944,7 @@ class FightProc {
         UserProc::updateUserInfo();
         $ret = array(
             'isExistFinishReward' => $isExistFinishReward,
-            'type'=>$type,
+            'type' => $type,
         );
         return Resp::ok($ret);
     }