cyzhao пре 8 месеци
родитељ
комит
83bdb99229

+ 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-09-13 11:23:39
+ // 日期: 2024-09-13 16:02:42
 ////////////////////
 
 /**

+ 9 - 4
Gameserver/App/model/Const/sm_fun_unlock.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-09-12 10:35:31
+ // 日期: 2024-09-13 16:03:11
 ////////////////////
 
 
@@ -41,7 +41,12 @@ class sm_fun_unlock
     /**
     * @var Int32 1:参与关卡;参数1:关卡ID  2通关关卡;参数1:关卡ID  
     */
-    public $unlockType;
+    public $unlockType1;
+
+    /**
+    * @var String 对应条件的关卡ID  
+    */
+    public $unlockParas1;
 
     /**
     * @var Int32 解锁条件2  
@@ -49,9 +54,9 @@ class sm_fun_unlock
     public $unlockType2;
 
     /**
-    * @var Int32 对应条件的关卡ID  
+    * @var String 用途未知!!请到数据库中添加字段注释。  
     */
-    public $unlockGateId;
+    public $unlockParas2;
 
     /**
     * @var Int32 在同一条件下功能的解锁顺序  

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-09-12 11:05:50
+ // 日期: 2024-09-13 11:54:56
 ////////////////////
 
 

+ 43 - 0
Gameserver/App/model/User/Enum_FunUnlockType.php

@@ -0,0 +1,43 @@
+<?php
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+namespace loyalsoft;
+
+/**
+ * Description of Enum_FunUnlockType
+ *
+ * @author c'y'zhao
+ */
+class Enum_FunUnlockType {
+    //put your code here
+    /*
+     * 参与关卡战斗
+     */
+    const battle_Gate = 1;
+    
+    /**
+     * 通关某关卡
+     */
+    const passBattle_Gate = 2;
+    
+    /*
+     * 初次得到宝石
+     */
+    const getGem = 3;
+    
+    /*
+     * 玩家等级要求
+     */
+    const userLv = 4;
+    
+    /*
+     * 主线挑战
+     */
+    const mainChallengeGate_State = 5;
+    
+}

+ 7 - 0
Gameserver/App/model/User/Info_PrivateState.php

@@ -224,6 +224,13 @@ class Info_PrivateState extends Object_ext {
      */
     #[ArrayType]
     public $funUnlockRecord = array();
+    
+    /**
+     * 解锁的功能记录 不做删除
+     * @var array()
+     */
+    #[ArrayType]
+    public $funUnlockRecord_2 = array();
 
     /**
      * 解锁的技能记录

+ 2 - 0
Gameserver/App/model/User/Info_UserBase.php

@@ -278,6 +278,8 @@ class Info_UserBase extends Object_ext {
             if ($this->level < glc()->Game_MaxPlayerLevel) {                    # 如果未到达最大等级
                 StoreProc::AddMultiItemInStore(GameConfig::player_level_getItem($this->level)->reward, Enum_StoreSourceType::AddExp);
                 $this->level++;
+                FightProc::funUnlock_userLv($this->level);
+                
                 $this->xp -= $cfgLVs->$nextLevel->xp_need;
                 $curLevel = $this->level;
                 $nextLevel = $curLevel + 1;

+ 35 - 18
Gameserver/App/process/EmailProc.php

@@ -28,6 +28,7 @@ class enum_Mail_Type extends Enum {
      * 商城邮件
      */
     const ShopMail = 9;
+
 }
 
 /**
@@ -77,23 +78,23 @@ class EmailProc {
     }
 
 // <editor-fold defaultstate="collapsed" desc="   API   ">
-    
+
     public static function IsExistRedTip() {
         $mail = self::getMailQueue(req()->zoneid, req()->uid);
-        
+
         $tag = 0;
         foreach ($mail as $index => $item) {
-            if($item->readts == 0){
+            if ($item->readts == 0) {
                 $tag = 1;
                 break;
             }
-            
-            if($item->appendix != null && $item->drawedts == 0){
+
+            if ($item->appendix != null && $item->drawedts == 0) {
                 $tag = 1;
                 break;
             }
         }
-        
+
         ctx()->privateState->redTip_Mail = $tag;
         return $tag;
     }
@@ -154,10 +155,10 @@ class EmailProc {
         $mail->readts = now();
         self::updateMail($zoneid, $uid, $mail);                                 # 更新邮件数据
         self::logMailReaded(array($mailId), $uid, $zoneid);                     # 更新数据库中邮件的read记录
-        
+
         $tag = self::IsExistRedTip();
-        
-        return Resp::ok(array("redTip"=>$tag));
+
+        return Resp::ok(array("redTip" => $tag));
     }
 
     /**
@@ -174,6 +175,12 @@ class EmailProc {
         my_Assert($mail->readts > 0, ErrCode::err_innerfault);                  # 未打开的不可能调用领取接口
         my_Assert($mail->isExistReward(), ErrCode::email_no_appendix);          # 先判断邮件,是否存在有效的奖励物品
         my_Assert($mail->drawedts <= 0, ErrCode::email_appendix_drawed);        # 邮件不可重复领取
+        $prize = explode(',', $mail->appendix);
+        $itemMo = GameConfig::item_getItem($prize[0]);
+        if ($itemMo->itemType == 201) {
+            FightProc::funUnlock_Gem();
+        }
+
         $err = StoreProc::AddMultiItemInStore($mail->appendix, 4);              # 发放奖励
 
         my_Assert(ErrCode::ok == $err, $err);                                   # 发奖成功
@@ -182,12 +189,12 @@ class EmailProc {
         if ($mail->sender_name == '系统') {
             //TaskProc::OnDrawSysMail($mail->sender_uid);
         }
-        
+
         $reward = implode(';', StoreProc::$reward);
         $reward_Gem = implode(',', StoreProc::$reward_Gem);
-        
+
         self::logMailDrawed(array($mailId), $uid, $zoneid);                     # 更新数据库中邮件的领取记录
-        
+
         $tag = self::IsExistRedTip();
         UserProc::updateUserInfo();
         return Resp::ok(array(#                                                 # 同步数据
@@ -198,7 +205,9 @@ class EmailProc {
                     //'reward' => $mail->appendix
                     'reward' => $reward,
                     'reward_Gem' => $reward_Gem,
-                    'redTip'=>$tag,                  
+                    'redTip' => $tag,
+                    'funUnlockRecord' => ctx()->privateState->funUnlockRecord,
+                    'funUnlockRecord_2' => ctx()->privateState->funUnlockRecord_2,
         ));
     }
 
@@ -219,6 +228,12 @@ class EmailProc {
                 if ($m->drawedts > 0) {                                         # 已领取邮件跳过
                     continue;
                 }
+                $prize = explode(',', $m->appendix);
+                $itemMo = GameConfig::item_getItem($prize[0]);
+                if ($itemMo->itemType == 201) {
+                    FightProc::funUnlock_Gem();
+                }
+
                 $err = StoreProc::AddMultiItemInStore($m->appendix, 4);
                 my_Assert(ErrCode::ok == $err, $err);                           # 发奖成功
                 $m->drawedts = now();                                           # 更新下领取时间戳
@@ -244,9 +259,9 @@ class EmailProc {
         }
         //$reward = implode(';', $arr);                                           # 拼接下奖励字符串
         $reward = implode(';', StoreProc::$reward);
-        $reward_Gem = implode(',', StoreProc::$reward_Gem);
+        $reward_Gem = implode(',', StoreProc::$reward_Gem);       
         $tag = self::IsExistRedTip();
-        
+
         UserProc::updateUserInfo();
         return Resp::ok(array(#                                                 # 同步数据
                     'baseInfo' => ctx()->base(),
@@ -255,7 +270,9 @@ class EmailProc {
                     'num' => $n,
                     'reward' => $reward,
                     'reward_Gem' => $reward_Gem,
-                    'redTip'=>$tag,                   
+                    'redTip' => $tag,
+                    'funUnlockRecord' => ctx()->privateState->funUnlockRecord,
+                    'funUnlockRecord_2' => ctx()->privateState->funUnlockRecord_2,
         ));
     }
 
@@ -281,7 +298,7 @@ class EmailProc {
             self::delMail($zoneid, $uid, $m->mailId);                           # 规则: 附件领取后就可以删除邮件
             $n++;
         }
-            
+
         return Resp::ok(array('num' => $n,));                                    # 返回删除数量
     }
 
@@ -581,7 +598,7 @@ class EmailProc {
                 "资源月卡每日奖励!", $reward);
         self::InsertMail($zoneid, $uid, $mail);
     }
-    
+
     /**
      * 激活码邮件
      * @param type $zoneid

+ 169 - 7
Gameserver/App/process/FightProc.php

@@ -128,13 +128,18 @@ 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;
 
         TaskProc::OnPassMainChallengeGate_X_Num($gateId, $index);
         TaskProc::OnKillCommonNumMonster($killMonsterNum);
         TaskProc::OnKillleaderNumMonster($killBossNum);
         UserProc::updateUserInfo();
-        return Resp::ok(array("task" => ctx()->task,));
+        return Resp::ok(array("task" => ctx()->task,
+            'funUnlockRecord' => ctx()->privateState->funUnlockRecord,
+            'funUnlockRecord_2' => ctx()->privateState->funUnlockRecord_2,
+            ));
     }
 
     /**
@@ -579,6 +584,15 @@ 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){
+                    FightProc::funUnlock_Gem();
+                    break;
+                }
+            }
             StoreProc::AddMultiItemInStore($prize);
         }
         ctx()->gates->GateList->$gateId = $gateInfo;
@@ -592,6 +606,8 @@ class FightProc {
             'cash' => ctx()->baseInfo->cash,
             'reward' => StoreProc::$reward,
             'reward_Gem' => StoreProc::$reward_Gem,
+            'funUnlockRecord' => ctx()->privateState->funUnlockRecord,
+            'funUnlockRecord_2' => ctx()->privateState->funUnlockRecord_2,
         );
         return Resp::ok($ret);
     }
@@ -614,7 +630,7 @@ class FightProc {
             $gateInfo->MaxSeconds = $curTs;
         }
 
-        self::funUnlock($resultType, $gateId); //备注:这个接口的位置不能动 里面有关卡第一次胜利解锁的功能提示校验
+        self::funUnlock_Gate($resultType, $gateId); //备注:这个接口的位置不能动 里面有关卡第一次胜利解锁的功能提示校验
         self::subFunUnlock($resultType, $gateId);
         if ($resultType) {                                                      # 胜利
             self::skillUnlock_gate($resultType, $gateId); //备注 这个接口位置不能动
@@ -652,7 +668,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) {
@@ -679,6 +695,8 @@ 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);
@@ -729,13 +747,16 @@ class FightProc {
             'oldLevel' => $oldLevel,
             'newLevel' => $newLevel,
             'funUnlockRecord' => ctx()->privateState->funUnlockRecord,
+            'funUnlockRecord_2'=> ctx()->privateState->funUnlockRecord_2,
             'skillUnlockRecord' => ctx()->privateState->skillUnlockRecord,
             'heros' => ctx()->heros,
-            'subFunStartTs'=> ctx()->privateState->subFunStartTs,
+            'subFunStartTs' => ctx()->privateState->subFunStartTs,
         );
         return Resp::ok($ret);
     }
 
+// <editor-fold defaultstate="collapsed" desc="功能解锁">   
+
     /**
      * 检测功能解锁的
      * @param type $resultType
@@ -745,10 +766,10 @@ class FightProc {
     static function funUnlock($resultType, $gateId) {
         $dic = GameConfig::fun_unlock();
         foreach ($dic as $id => $mo) {
-            if ($mo->unlockTip == 1 && $mo->unlockGateId == $gateId) {
+            if ($mo->unlockTip == 1 && $mo->unlockParas1 == $gateId) {
                 $tag = false;
                 //1:参与战斗结束即可  2战斗胜利  3某场战斗参加N次数才行
-                switch ($mo->unlockType) {
+                switch ($mo->unlockType1) {
                     case 1:
                         if (ctx()->gates->GateList->$gateId->fightNum == 0) {
                             $tag = true;
@@ -765,12 +786,152 @@ class FightProc {
                 }
 
                 if ($tag) {
-                    ctx()->privateState->funUnlockRecord[] = $id;               
+                    ctx()->privateState->funUnlockRecord[] = $id;
+                }
+            }
+        }
+    }
+
+    /**
+     * 检测功能解锁的 关卡
+     * @param type $resultType
+     * @param type $gateId
+     * @return type
+     */
+    static function funUnlock_Gate($resultType, $gateId) {
+        $dic = GameConfig::fun_unlock();
+        foreach ($dic as $id => $mo) {
+            if ($mo->unlockTip == 1) {//$mo->unlockGateId == $gateId              
+                $tag = false;
+                if ($mo->unlockType1 != null) {
+                    //1:参与战斗结束即可  2战斗胜利  3某场战斗参加N次数才行
+                    switch ($mo->unlockType1) {
+                        case Enum_FunUnlockType::battle_Gate:
+                            if ($mo->unlockParas1 == $gateId && ctx()->gates->GateList->$gateId->fightNum == 0) {
+                                $tag = true;
+                            }
+                            break;
+                        case Enum_FunUnlockType::passBattle_Gate:
+                            if ($resultType == true && $mo->unlockParas1 == $gateId && ctx()->gates->GateList->$gateId->pass == 0) {
+                                $tag = true;
+                            }
+
+                            break;
+                        default:
+                            break;
+                    }
+                }
+
+                if ($mo->unlockType2 != null) {
+                    //1:参与战斗结束即可  2战斗胜利  3某场战斗参加N次数才行
+                    switch ($mo->unlockType2) {
+                        case Enum_FunUnlockType::battle_Gate:
+                            if ($mo->unlockParas2 == $gateId && ctx()->gates->GateList->$gateId->fightNum == 0) {
+                                $tag = true;
+                            }
+                            break;
+                        case Enum_FunUnlockType::passBattle_Gate:
+                            if ($resultType == true && $mo->unlockParas2 == $gateId && ctx()->gates->GateList->$gateId->pass == 0) {
+                                $tag = true;
+                            }
+
+                            break;
+                        default:
+                            break;
+                    }
+                }
+
+                if ($tag && !in_array($id, ctx()->privateState->funUnlockRecord_2)) {
+                    ctx()->privateState->funUnlockRecord[] = $id;
+                    ctx()->privateState->funUnlockRecord_2[] = $id;
+                }
+            }
+        }
+    }
+
+    /**
+     *  初次得到宝石 功能解锁
+     */
+    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;                   
                 }
+                
+                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;
             }
         }
     }
 
+    /**
+     *  玩家等级要求 功能解锁
+     */
+    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;                   
+                }
+                
+                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) {
+        $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);     
+                    $uGateId = $str[0];
+                    $gateState = $str[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){
+                    $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){
+                        $tag = true;
+                    }                   
+                }                                                        
+            }
+            
+            if ($tag && !in_array($id, ctx()->privateState->funUnlockRecord_2)) {
+                ctx()->privateState->funUnlockRecord[] = $id;
+                ctx()->privateState->funUnlockRecord_2[] = $id;
+            }
+        }
+    }
+    
     /**
      * 检测次级功能解锁的
      * @param type $resultType
@@ -812,6 +973,7 @@ class FightProc {
         }
     }
 
+// </editor-fold>
 // <editor-fold defaultstate="collapsed" desc="技能解锁">
 
     /**

+ 2 - 1
Gameserver/App/process/ShopProc.php

@@ -270,7 +270,8 @@ class ShopProc {
         }
         TaskProc::OnOpenNumBrightBox($typeId, $buyNum);
         TaskProc::OnOpenNumAnyBox($buyNum);
-
+        FightProc::funUnlock_Gem();
+        
         $perList = explode(';', $mo->percent);
         $allNum = 0;
         foreach ($perList as $key => $value) {