Ver Fonte

宝箱一键领取

cyzhao há 3 semanas atrás
pai
commit
7eb5c82515
2 ficheiros alterados com 97 adições e 39 exclusões
  1. 6 1
      Gameserver/App/base/CmdCode.php
  2. 91 38
      Gameserver/App/process/FightProc.php

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

@@ -548,7 +548,7 @@ class CmdCode {
     /**
      * 章节宝箱的领取
      */
-    const fight_PassGateTsPrizeReceive = 6802;
+    const fight_passGateTsPrizeReceive = 6802;
 
     /**
      * 主线关卡: 选择
@@ -692,6 +692,11 @@ class CmdCode {
      */
     const fight_WorldBoss_settle = 6830;
     
+    /**
+     * 章节宝箱的领取
+     */
+    const fight_allGateBoxReceive = 6831;
+    
 // </editor-fold>
 // <editor-fold defaultstate="collapsed" desc="系统操作码 - 69xx">
 

+ 91 - 38
Gameserver/App/process/FightProc.php

@@ -17,8 +17,11 @@ class FightProc {
         switch ($req->cmd) {
             case CmdCode::fight_settle:                                         # 6801 主线战斗结算
                 return FightProc::Settle();
-            case CmdCode::fight_PassGateTsPrizeReceive:                         # 6802 章节宝箱的领取
+            case CmdCode::fight_passGateTsPrizeReceive:                         # 6802 章节宝箱的领取
                 return FightProc::PassGateTsPrizeReceive();
+            case CmdCode::fight_allGateBoxReceive:                              # 6831 章节宝箱的一键领取
+                return FightProc::AllGateBoxReceive();
+
             case CmdCode::fight_selectGate:                                     # 6803 主线剧情关卡选择
                 return FightProc::SelectGate();
             case CmdCode::fight_gateChallengeRewards:                           # 6804 挑战关卡: 领取奖励
@@ -605,6 +608,58 @@ class FightProc {
         return Resp::ok($ret);
     }
 
+    /**
+     * 6831 关卡宝箱一键领取
+     * @return type
+     */
+    public static function AllGateBoxReceive() {
+        list() = req()->paras;
+
+        $dic = ctx()->gates->GateList;
+        foreach ($dic as $gateId => $item) {
+            $ins_gateInfo = new Ins_GateInfo($item);
+            $gateMo = GameConfig::gate_getItem($ins_gateInfo->GateId);
+            $ts1 = $gateMo->first_ts1 * 60;
+            if ($ins_gateInfo->MaxSeconds >= $ts1 && !in_array(1, $ins_gateInfo->FirstReward)) {
+                $ins_gateInfo->FirstReward[] = 1;
+                GuideProc::HeroChange_Guide_Trigger($gateId, 1);
+                StoreProc::AddMultiItemInStore($gateMo->first_reward1);
+            }
+            
+            $ts2 = $gateMo->first_ts1 * 60;
+            if ($ins_gateInfo->MaxSeconds >= $ts2 && !in_array(2, $ins_gateInfo->FirstReward)) {
+                $ins_gateInfo->FirstReward[] = 2;
+                GuideProc::HeroChange_Guide_Trigger($gateId, 2);
+                StoreProc::AddMultiItemInStore($gateMo->first_reward2);
+            }
+                      
+            if ($ins_gateInfo->pass > 0 && !in_array(3, $ins_gateInfo->FirstReward)) {
+                $ins_gateInfo->FirstReward[] = 3;
+                GuideProc::HeroChange_Guide_Trigger($gateId, 3);
+                StoreProc::AddMultiItemInStore($gateMo->first_reward3);
+            }
+           ctx()->gates->GateList->$gateId = $ins_gateInfo;
+        }
+
+
+        UserProc::updateUserInfo();
+        $ret = array(
+            'gates' => ctx()->gates,
+            'store' => ctx()->store,
+            'task' => ctx()->task,
+            'gold' => ctx()->baseInfo->gold,
+            'cash' => ctx()->baseInfo->cash,
+            'reward' => StoreProc::$reward,
+            'reward_Gem' => StoreProc::$reward_Gem,
+            'reward_equip' => StoreProc::$reward_equip,
+            'heros' => ctx()->heros,
+            'funUnlockRecord' => ctx()->privateState->funUnlockRecord,
+            'funUnlockRecord_2' => ctx()->privateState->funUnlockRecord_2,
+            'funUnlockRecord_3' => ctx()->privateState->funUnlockRecord_3,
+        );
+        return Resp::ok($ret);
+    }
+
     /**
      * 6802 章节宝箱的领取
      * @return type
@@ -1730,18 +1785,18 @@ class FightProc {
                 break;
             }
         }
-        
+
         self::DeleteWorldBossRankInvalidUser($uid2);
     }
-    
+
     /*
      * 删除世界boss排行榜内注销账号的玩家
      */
 
-    public static function DeleteWorldBossRankInvalidUser($uid2) {        
+    public static function DeleteWorldBossRankInvalidUser($uid2) {
         $rankKey = self::GetWorldBoss_DamageMemKey();
         $score = gMem()->zscore($rankKey, $uid2);
-        if($score > 0){
+        if ($score > 0) {
             gMem()->zrem($rankKey, $uid2);
         }
     }
@@ -1930,19 +1985,19 @@ class FightProc {
     public static function settleRankReward_worldBoss() {
         echo '----开始发放世界boss的排行奖励-----';
         $dic = GameConfig::worldboss_rankreward();
-        if ($dic == null) {           
+        if ($dic == null) {
             return;
         }
 
-        $turnNum = self::GetCurTurnNum();             
+        $turnNum = self::GetCurTurnNum();
         $turnnumMo = GameConfig::worldboss_turnnum_getItem($turnNum);
         $orderId = $turnnumMo->orderId;
-        $gateMo = GameConfig::gate_getItem($turnnumMo->gateId);     
-        if ($gateMo == null) {             
+        $gateMo = GameConfig::gate_getItem($turnnumMo->gateId);
+        if ($gateMo == null) {
             return;
         }
-        $name = $gateMo->gateName;     
-               
+        $name = $gateMo->gateName;
+
         $memKey = self::GetWorldBoss_DamageMemKey();
         $index = 0;
         foreach ($dic as $id => $mo) {
@@ -1954,8 +2009,8 @@ class FightProc {
 
             foreach ($list as $uid => $score) {
                 $index += 1;
-                self::settleDamageReward_worldBoss($name,$orderId, $uid, $score);
-                EmailProc::SendWorldBossRewardMail(req()->zoneid, $uid, $mo->reward, $index,$name);
+                self::settleDamageReward_worldBoss($name, $orderId, $uid, $score);
+                EmailProc::SendWorldBossRewardMail(req()->zoneid, $uid, $mo->reward, $index, $name);
             }
         }
 
@@ -1966,48 +2021,46 @@ class FightProc {
 //        }
     }
 
-    public static function settleDamageReward_worldBoss($name,$orderId, $uid, $demageVal) {
+    public static function settleDamageReward_worldBoss($name, $orderId, $uid, $demageVal) {
         $demageList = GameConfig::worldboss_demagereward_getItemArray($orderId);
-        $strkey = MemKey_User::Info_hash(req()->zoneid, $uid);     
-        if(!gMem()->exists($strkey)){
+        $strkey = MemKey_User::Info_hash(req()->zoneid, $uid);
+        if (!gMem()->exists($strkey)) {
             return;
         }
-        
-        $userInfo = UserProc::getUserGame(req()->zoneid, $uid);               
+
+        $userInfo = UserProc::getUserGame(req()->zoneid, $uid);
         $worldBoss_received = $userInfo->privateState->worldBoss_received;
         $dic = new \stdClass();
         foreach ($demageList as $dMo) {
             if ($demageVal >= $dMo->demageValId && !in_array($dMo->demageValId, $worldBoss_received)) {
-                if($dMo->reward != null){
+                if ($dMo->reward != null) {
                     $list = explode(';', $dMo->reward);
                     foreach ($list as $value) {
                         $arr = explode(',', $value);
                         $rewardId = $arr[0];
                         $rewardNum = $arr[1];
-                        if(StlUtil::dictHasProperty($dic, $rewardId)){
+                        if (StlUtil::dictHasProperty($dic, $rewardId)) {
                             $dic->$rewardId += $rewardNum;
                         } else {
                             $dic->$rewardId = $rewardNum;
                         }
                     }
                 }
-                
-                
             }
         }
-        
+
         $str = '';
         foreach ($dic as $k => $val) {
-            $s = $k.','.$val;
-            if($str == ''){
+            $s = $k . ',' . $val;
+            if ($str == '') {
                 $str = $s;
             } else {
-                $str = $str.';'.$s; 
-            }           
+                $str = $str . ';' . $s;
+            }
         }
-       
-        if($str != null){
-            EmailProc::SendWorldBossDamageRewardMail(req()->zoneid, $uid,$str,$name);
+
+        if ($str != null) {
+            EmailProc::SendWorldBossDamageRewardMail(req()->zoneid, $uid, $str, $name);
         }
     }
 
@@ -2125,8 +2178,8 @@ class FightProc {
         $mem = gMem();
 
         $uid = req()->uid;
-        $val = gMem()->zscore($memKey, $uid);        
-        if ($damageVal > $val) {                       
+        $val = gMem()->zscore($memKey, $uid);
+        if ($damageVal > $val) {
             $arr = array();
             $arr["$uid"] = self::createScore($damageVal);
             $mem->zadd($memKey, $arr);
@@ -2272,7 +2325,7 @@ class FightProc {
         //校验每个轮次最后10分钟, 不能战斗
         my_Assert(FightProc::isFunUnlock(25), ErrCode::active_funUnlock);
         $tag = true;
-        
+
         $curDay = TimeUtil::totalDays();
         $turnNum = self::GetCurTurnNum();
         $turnnumMo = GameConfig::worldboss_turnnum_getItem($turnNum);
@@ -2282,18 +2335,18 @@ class FightProc {
                 $tag = false;
             }
         }
-       
-        if(ctx()->privateState->worldBoss_turnNum == 0){
+
+        if (ctx()->privateState->worldBoss_turnNum == 0) {
             ctx()->privateState->worldBoss_turnNum = $turnNum;
         }
-        
+
         if (ctx()->privateState->worldBoss_turnNum != $turnNum) {
             ctx()->privateState->worldBoss_turnNum = $turnNum;
             ctx()->privateState->worldBoss_received = array();
             $tag = false;
         }
-       
-        if ($tag) {        
+
+        if ($tag) {
             self::Ranking_DamageVal($damageNum);
         }