浏览代码

抽奖bug

cyzhao 8 月之前
父节点
当前提交
6934c06376
共有 2 个文件被更改,包括 45 次插入43 次删除
  1. 4 1
      Gameserver/App/process/ActiveProc.php
  2. 41 42
      Gameserver/App/process/FightProc.php

+ 4 - 1
Gameserver/App/process/ActiveProc.php

@@ -80,9 +80,12 @@ class ActiveProc {
     public static function lotteryNumBox_RewardReceived() {
         list($id) = req()->paras;
         
+        $mo = GameConfig::activity_lotterynum_accumulate_getItem($id);
+        my_Assert($mo != null,ErrCode::err_const_no);
         my_Assert(ctx()->privateState->lotteryNum >= $id,ErrCode::active_lotteryNumNotEnough);
-        my_Assert(!StlUtil::dictHasProperty(ctx()->privateState->lotteryNumRewardReceived, $id),ErrCode::active_hasgetted);
+        my_Assert(!in_array($id,ctx()->privateState->lotteryNumRewardReceived),ErrCode::active_hasgetted);
         
+        StoreProc::AddMultiItemInStore($mo->reward);
         ctx()->privateState->lotteryNumRewardReceived[] = $id;
         
         UserProc::updateUserInfo();

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

@@ -128,7 +128,7 @@ class FightProc {
         $gateInfo = ctx()->gates->GateList->$gateId;
         my_Assert($gateInfo->pass, ErrCode::gate_GateNoUnlock);                 # 通关后解锁难度1
         my_Assert($gateInfo->tz_state + 1 >= $index, ErrCode::gate_GateNoUnlock); # 通关上一难度解锁当前难度
-        
+
         FightProc::funUnlock_mainChallengeGate_State(true, $gateId, $index);
         $gateInfo->tz_state = $index;
 
@@ -137,9 +137,9 @@ class FightProc {
         TaskProc::OnKillleaderNumMonster($killBossNum);
         UserProc::updateUserInfo();
         return Resp::ok(array("task" => ctx()->task,
-            'funUnlockRecord' => ctx()->privateState->funUnlockRecord,
-            'funUnlockRecord_2' => ctx()->privateState->funUnlockRecord_2,
-            ));
+                    'funUnlockRecord' => ctx()->privateState->funUnlockRecord,
+                    'funUnlockRecord_2' => ctx()->privateState->funUnlockRecord_2,
+        ));
     }
 
     /**
@@ -584,11 +584,11 @@ class FightProc {
         if ($tag) {
             my_Assert(!in_array($mask, $gateInfo->FirstReward), ErrCode::gate_GatePriceHasReceive);
             $gateInfo->FirstReward[] = $mask;
-            
+
             $pStr = explode(';', $prize);
             foreach ($pStr as $val) {
                 $arr = explode(',', $val);
-                if(GameConfig::item_getItem($arr[0]) == 201 || GameConfig::item_getItem($arr[0]) == 701){
+                if (GameConfig::item_getItem($arr[0]) == 201 || GameConfig::item_getItem($arr[0]) == 701) {
                     FightProc::funUnlock_Gem();
                     break;
                 }
@@ -597,7 +597,7 @@ class FightProc {
         }
         ctx()->gates->GateList->$gateId = $gateInfo;
         TaskProc::OnReceiveGateBoxReward();
-        
+
         UserProc::updateUserInfo();
         $ret = array(
             'gates' => ctx()->gates,
@@ -669,7 +669,7 @@ class FightProc {
         $waveMo = GameConfig::waveItem_getItem($gateId, $finalLayer);
         my_Assert(null != $waveMo, ErrCode::err_const_no);
         $oldLevel = ctx()->baseInfo->level;
-        StoreProc::AddMultiItemInStore('4,' . $waveMo->rewardExp);      
+        StoreProc::AddMultiItemInStore('4,' . $waveMo->rewardExp);
         //ctx()->base()->Add_Exp($waveMo->rewardExp);                             # 指挥官经验
         $newLevel = ctx()->baseInfo->level;
         if ($oldLevel != $newLevel) {
@@ -697,7 +697,7 @@ class FightProc {
         # 宝石奖励: 数量min-max;品质:权重,品质:权重...
         if (strlen($waveMo->rewardGem) > 0) {
             self::funUnlock_Gem();
-            
+
             list($gs_num, $gs_props) = explode(';', $waveMo->rewardGem);
             list($gem_min, $gem_max) = explode('-', $gs_num);                   # 宝石数量
             $gem_n = rand($gem_min, $gem_max);
@@ -748,7 +748,7 @@ class FightProc {
             'oldLevel' => $oldLevel,
             'newLevel' => $newLevel,
             'funUnlockRecord' => ctx()->privateState->funUnlockRecord,
-            'funUnlockRecord_2'=> ctx()->privateState->funUnlockRecord_2,
+            'funUnlockRecord_2' => ctx()->privateState->funUnlockRecord_2,
             'skillUnlockRecord' => ctx()->privateState->skillUnlockRecord,
             'heros' => ctx()->heros,
             'subFunStartTs' => ctx()->privateState->subFunStartTs,
@@ -856,17 +856,17 @@ class FightProc {
     static function funUnlock_Gem() {
         $dic = GameConfig::fun_unlock();
         foreach ($dic as $id => $mo) {
-            if ($mo->unlockTip == 1) {//$mo->unlockGateId == $gateId
-                $tag = false;                            
-                if($mo->unlockType1 != null && $mo->unlockType1 == Enum_FunUnlockType::getGem && ctx()->store->gemStore == null){
-                    $tag = true;                   
+            $tag = false;
+            if ($mo->unlockTip == 1) {//$mo->unlockGateId == $gateId               
+                if ($mo->unlockType1 != null && $mo->unlockType1 == Enum_FunUnlockType::getGem && ctx()->store->gemStore == null) {
+                    $tag = true;
                 }
-                
-                if($mo->unlockType2 != null && $mo->unlockType2 == Enum_FunUnlockType::getGem && ctx()->store->gemStore == null){
+
+                if ($mo->unlockType2 != null && $mo->unlockType2 == Enum_FunUnlockType::getGem && ctx()->store->gemStore == null) {
                     $tag = true;
-                }                                                        
+                }
             }
-            
+
             if ($tag && !in_array($id, ctx()->privateState->funUnlockRecord_2)) {
                 ctx()->privateState->funUnlockRecord[] = $id;
                 ctx()->privateState->funUnlockRecord_2[] = $id;
@@ -880,59 +880,58 @@ class FightProc {
     static function funUnlock_userLv($level) {
         $dic = GameConfig::fun_unlock();
         foreach ($dic as $id => $mo) {
-            if ($mo->unlockTip == 1) {//$mo->unlockGateId == $gateId
-                $tag = false;                            
-                if($mo->unlockType1 != null && $mo->unlockType1 == Enum_FunUnlockType::userLv && $mo->unlockParas1 == $level){
-                    $tag = true;                   
+            $tag = false;
+            if ($mo->unlockTip == 1) {//$mo->unlockGateId == $gateId               
+                if ($mo->unlockType1 != null && $mo->unlockType1 == Enum_FunUnlockType::userLv && $mo->unlockParas1 == $level) {
+                    $tag = true;
                 }
-                
-                if($mo->unlockType2 != null && $mo->unlockType2 == Enum_FunUnlockType::userLv && $mo->unlockParas2 == $level){
+
+                if ($mo->unlockType2 != null && $mo->unlockType2 == Enum_FunUnlockType::userLv && $mo->unlockParas2 == $level) {
                     $tag = true;
-                }                                                        
+                }
             }
-            
             if ($tag && !in_array($id, ctx()->privateState->funUnlockRecord_2)) {
                 ctx()->privateState->funUnlockRecord[] = $id;
                 ctx()->privateState->funUnlockRecord_2[] = $id;
             }
         }
     }
-    
+
     /**
      *  主线挑战 功能解锁
      */
-    static function funUnlock_mainChallengeGate_State($result,$gateId,$state) {
+    static function funUnlock_mainChallengeGate_State($result, $gateId, $state) {
         $dic = GameConfig::fun_unlock();
         foreach ($dic as $id => $mo) {
-            if ($mo->unlockTip == 1) {//$mo->unlockGateId == $gateId
-                $tag = false;                            
-                if($mo->unlockType1 != null && $result = true && $mo->unlockType1 == Enum_FunUnlockType::mainChallengeGate_State){
-                    $str = explode(',', $mo->unlockParas1);     
+            $tag = false;
+            if ($mo->unlockTip == 1) {//$mo->unlockGateId == $gateId              
+                if ($mo->unlockType1 != null && $result = true && $mo->unlockType1 == Enum_FunUnlockType::mainChallengeGate_State) {
+                    $str = explode(',', $mo->unlockParas1);
                     $uGateId = $str[0];
                     $gateState = $str[1];
-                    
-                    if($uGateId == $gateId && StlUtil::dictHasProperty(ctx()->gates->GateList, $gateId) && ctx()->gates->GateList->$gateId->tz_state == $gateState-1){
+
+                    if ($uGateId == $gateId && StlUtil::dictHasProperty(ctx()->gates->GateList, $gateId) && ctx()->gates->GateList->$gateId->tz_state == $gateState - 1) {
                         $tag = true;
-                    }                                                       
+                    }
                 }
-                
-                if($mo->unlockType2 != null &&$result = true && $mo->unlockType2 == Enum_FunUnlockType::mainChallengeGate_State){
+
+                if ($mo->unlockType2 != null && $result = true && $mo->unlockType2 == Enum_FunUnlockType::mainChallengeGate_State) {
                     $str = explode(',', $mo->unlockParas2);
                     $uGateId = $str[0];
                     $gateState = $str[1];
-                    if($uGateId == $gateId && StlUtil::dictHasProperty(ctx()->gates->GateList, $gateId) && ctx()->gates->GateList->$gateId->tz_state == $gateState-1){
+                    if ($uGateId == $gateId && StlUtil::dictHasProperty(ctx()->gates->GateList, $gateId) && ctx()->gates->GateList->$gateId->tz_state == $gateState - 1) {
                         $tag = true;
-                    }                   
-                }                                                        
+                    }
+                }
             }
-            
+
             if ($tag && !in_array($id, ctx()->privateState->funUnlockRecord_2)) {
                 ctx()->privateState->funUnlockRecord[] = $id;
                 ctx()->privateState->funUnlockRecord_2[] = $id;
             }
         }
     }
-    
+
     /**
      * 检测次级功能解锁的
      * @param type $resultType