Forráskód Böngészése

功能解锁,技能解锁接口完成

cyzhao 10 hónapja
szülő
commit
eb812fb879

+ 5 - 0
Gameserver/App/base/CmdCode.php

@@ -111,6 +111,11 @@ class CmdCode {
      * 读公告
      */
     const cmd_user_readAnnouncement = 6008;
+    
+    /**
+     * 重置功能解锁记录信息
+     */
+    const cmd_user_clearFunUnlockInfo = 6009;
 
     // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc="活动操作码 - 61xx">

+ 17 - 1
Gameserver/App/configs/GameConfig.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-07-23 15:41:07
+ // 日期: 2024-07-23 17:47:05
 ////////////////////
 
 namespace loyalsoft;
@@ -175,6 +175,22 @@ class GameConfig {
         return self::get_hash_item('errmsg', $itemid);
     }
     /**
+    * 技能表
+    * @return \skills
+    */
+    public static function skills()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'skills');
+    }
+    /**
+    * @return \sm_skills skills item数据 
+    */
+    public static function skills_getItem($itemid)
+    { 
+        return self::get_hash_item('skills', $itemid);
+    }
+    /**
     * 战斗: 波次表
     * @return \waves
     */

+ 17 - 1
Gameserver/App/model/Const/GameConfig.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-07-23 16:50:13
+ // 日期: 2024-07-23 17:47:05
 ////////////////////
 
 /**
@@ -173,6 +173,22 @@ class GameConfig {
         return self::get_hash_item('errmsg', $itemid);
     }
     /**
+    * 技能表
+    * @return \skills
+    */
+    public static function skills()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'skills');
+    }
+    /**
+    * @return \sm_skills skills item数据 
+    */
+    public static function skills_getItem($itemid)
+    { 
+        return self::get_hash_item('skills', $itemid);
+    }
+    /**
     * 战斗: 波次表
     * @return \waves
     */

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-07-23 16:47:41
+ // 日期: 2024-07-23 16:52:42
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-07-23 16:47:41
+ // 日期: 2024-07-23 16:52:42
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-07-19 18:05:47
+ // 日期: 2024-07-23 17:35:47
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-07-19 18:05:47
+ // 日期: 2024-07-23 17:35:47
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-07-23 14:51:26
+ // 日期: 2024-07-23 17:05:47
 ////////////////////
 
 

+ 88 - 7
Gameserver/App/model/Const/sm_skills.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2023-09-20 15:20:06
+ // 日期: 2024-07-23 17:35:47
 ////////////////////
 
 
@@ -14,7 +14,7 @@ class sm_skills
 {
 
     /**
-    * @var Int32 用途未知!!请到数据库中添加字段注释。  
+    * @var Int32 索引id  
     */
     public $id;
 
@@ -28,6 +28,11 @@ class sm_skills
     */
     public $next;
 
+    /**
+    * @var Int32 该技能是否会突破,默认1:突破 0:不突破 default(1) 
+    */
+    public $isTupo;
+
     /**
     * @var Int32 同一种技能的类别区分(1~6星是同一个id) default(0) 
     */
@@ -38,6 +43,11 @@ class sm_skills
     */
     public $starLv;
 
+    /**
+    * @var Int32 超武等级 default(99) 
+    */
+    public $supperLv;
+
     /**
     * @var String 技能名称  
     */
@@ -49,7 +59,7 @@ class sm_skills
     public $icon;
 
     /**
-    * @var Int32 类型:主动还是被动1:主动;2:被动;3:金币鸡腿技能 default(0) 
+    * @var Int32 类型:主动还是被动1:主动;2:被动;3:金币鸡腿技能; 4:条件触发 default(0) 
     */
     public $skillType;
 
@@ -64,7 +74,7 @@ class sm_skills
     public $desc;
 
     /**
-    * @var String 用途未知!!请到数据库中添加字段注释。  
+    * @var String 额外字段  
     */
     public $etc;
 
@@ -79,10 +89,15 @@ class sm_skills
     public $bullet_num;
 
     /**
-    * @var Single 子弹体积(倍率)  
+    * @var Single 子弹体积(倍率) default(0) 
     */
     public $bullet_size;
 
+    /**
+    * @var Single 子弹初始化速度 default(1) 
+    */
+    public $prime_bullet_speed;
+
     /**
     * @var Single 子弹飞行速度修正(倍率)  
     */
@@ -132,7 +147,7 @@ class sm_skills
     public $aim_type;
 
     /**
-    * @var Single 攻击距离或范围(倍率值)  
+    * @var Single 【废弃】攻击距离或范围(倍率值)  
     */
     public $aim_para;
 
@@ -142,7 +157,8 @@ class sm_skills
     public $coolTime;
 
     /**
-    * @var Int32 buffid: 灼烧/流血、减速或麻痹等  
+    * @var String buffid: 灼烧/流血、减速或麻痹等(支持冒号、逗号分割,最多4个)(例: 8341:100,9527:60,...)
+    *    
     */
     public $buffId;
 
@@ -161,5 +177,70 @@ class sm_skills
     */
     public $immediate_hp;
 
+    /**
+    * @var Int32 解锁(成就Id,0无需解锁) 2023.11.20  
+    */
+    public $unlock_acc_id;
+
+    /**
+    * @var Int32 稀有度(影响三选一出现几率) 2023.11.20  
+    */
+    public $rarety;
+
+    /**
+    * @var Int32 是否穿墙 0 不穿,1 穿(默认)2023.11.20 default(1) 
+    */
+    public $can_passwall;
+
+    /**
+    * @var Int32 冷却计算开始时机:0 在技能开始, 1 在技能结束(子弹持续时间之后) default(0) 
+    */
+    public $intervalDependsOnDuration;
+
+    /**
+    * @var Single 碰撞盒延迟时间(单位:秒)2023.11.20 default(0) 
+    */
+    public $hitBoxDelay;
+
+    /**
+    * @var String 增益(生效)(逗号分割)列表 2023.11.20
+    *  0 无(不生效)
+    *  1 攻击力
+    *  2 冷却时间
+    *  3 攻击范围
+    *  4 子弹速度
+    *  5 持续时间
+    *  6 子弹数量
+    *  7 伤害次数
+    *  8 击退距离
+    *    
+    */
+    public $buffEffectTabel;
+
+    /**
+    * @var Int32 攻击范围词条对技能生效类型: 1 影响攻击范围 2 影响子弹体积 3 同时影响攻击范围和子弹体积
+    *   default(1) 
+    */
+    public $atkRangeBuffEffectType;
+
+    /**
+    * @var Int32 额外释放技能id(冰锥术会释放冰风暴) default(0) 
+    */
+    public $extraSkillId;
+
+    /**
+    * @var Int32 (释放额外技能需要)释放普通技能n次触发特殊技能 default(0) 
+    */
+    public $emit_number;
+
+    /**
+    * @var String 技能解锁条件
+    *  类型1:通关指定关卡解锁技能;例如通关第一关:1:1(类型+第X关)
+    *  类型2:解锁指定人物解锁技能:例如解锁孙悟空:2:1001(类型+角色唯一ID)
+    *  类型3:玩家失败次数解锁技能:例如玩家失败一次解锁技能3:1(类型+累计失败次数)
+    *  类型4:不解锁技能 4:9999  
+    */
+    public $unlock_acc_id_new;
+
 }
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-07-23 16:27:56
+ // 日期: 2024-07-23 17:08:02
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-07-23 16:27:56
+ // 日期: 2024-07-23 17:08:02
 ////////////////////
 
 

+ 117 - 25
Gameserver/App/process/FightProc.php

@@ -63,23 +63,23 @@ class FightProc {
      * @return type
      */
     public static function EvolveUnlock() {
-        list($type, $id) = req()->paras;//$id废弃 因为玩家可能不安顺序点
+        list($type, $id) = req()->paras; //$id废弃 因为玩家可能不安顺序点
 
         if ($type == 1) {
-            $nextId = ctx()->gates->evolveMaxId_left+1;                      
+            $nextId = ctx()->gates->evolveMaxId_left + 1;
             my_Assert($id == $nextId, ErrCode::err_const_no);
-            
-            $mo = GameConfig::evolve_getItem($nextId);                     
-            my_Assert($mo != null, ErrCode::err_const_no);           
+
+            $mo = GameConfig::evolve_getItem($nextId);
+            my_Assert($mo != null, ErrCode::err_const_no);
             my_Assert(ctx()->baseInfo->level >= $mo->level, ErrCode::evolve_canotUnlock_levelLimit);
             my_Assert(ctx()->baseInfo->gold >= $mo->needGold_unlock, ErrCode::notenough_gold_msg);
-            
+
             ctx()->baseInfo->Consume_Gold($mo->needGold_unlock);
             ctx()->gates->evolveMaxId_left = $nextId;
         } else {
             $nextId = ctx()->gates->evolveMaxId_right + 1;
             my_Assert($id == $nextId, ErrCode::err_const_no);
-            
+
             $dic = GameConfig::evolve();
             foreach ($dic as $key => $value) {
                 if ($value->specificEvolveId == $nextId) {
@@ -185,8 +185,8 @@ class FightProc {
 
         UserProc::updateUserInfo();
         $ret = array(
-            'gold'=> ctx()->baseInfo->gold,
-            'cash'=> ctx()->baseInfo->cash,
+            'gold' => ctx()->baseInfo->gold,
+            'cash' => ctx()->baseInfo->cash,
             'tili' => ctx()->baseInfo->tili,
             'tili_ts' => ctx()->baseInfo->tili_ts,
             'xp' => ctx()->baseInfo->xp,
@@ -271,7 +271,7 @@ class FightProc {
             ctx()->gates()->TowerGateInfo()->TodayChanNum--;                    # 增加次数
         } else {                                                                # 主线剧情                       
             my_Assert(ctx()->base()->Consume_tili($mo->cost_tili), ErrCode::notenough_tili);
-        }           
+        }
         UserProc::updateUserInfo();
         return Resp::ok(array("tili" => ctx()->baseInfo->tili, "tili_ts" => ctx()->baseInfo->tili_ts));
     }
@@ -507,9 +507,11 @@ class FightProc {
         if ($curTs >= $ts) {
             $gateInfo->MaxSeconds = $curTs;
         }
-        
-        self::funUnlock($resultType, $gateId);//备注:这个接口的位置不能动 里面有关卡第一次胜利解锁的功能提示校验
+
+        self::funUnlock($resultType, $gateId); //备注:这个接口的位置不能动 里面有关卡第一次胜利解锁的功能提示校验
         if ($resultType) {                                                      # 胜利
+            self::skillUnlock_gate($resultType, $gateId);//备注 这个接口位置不能动
+            
             if (ctx()->gates->GateList->$gateId->pass == 0) {
                 ctx()->gates->GateList->$gateId->pass = 1;
                 TaskProc::Day7TaskReset($gateId);                               # 刷新七日任务
@@ -531,6 +533,7 @@ class FightProc {
 //            StoreProc::AddMultiItemInStore($gateMo->reward_win);                # 发放胜利奖励(2024.5.30 过期)
         } else {
             ctx()->gates->GateList->$gateId->fightNum_fail += 1;
+            self::skillUnlock_fightNum($resultType);//这个接口位置不能动
         }
 //        else {                                                                # 失败
 ////            StoreProc::AddMultiItemInStore($gateMo->reward_fail);               # 发放失败奖励(2024.5.30 过期)
@@ -593,7 +596,7 @@ class FightProc {
         }
 
         ctx()->gates->GateList->$gateId->fightNum += 1;
-        
+
         TaskProc::OnFightNumMainGate();
         TaskProc::OnKillCommonNumMonster($killMonsterNum);
         TaskProc::OnKillleaderNumMonster($killBossNum);
@@ -611,46 +614,135 @@ class FightProc {
             'reward_Gem' => StoreProc::$reward_Gem,
             'oldLevel' => $oldLevel,
             'newLevel' => $newLevel,
-            'funUnlockRecord'=> ctx()->privateState->funUnlockRecord,
-            'skillUnlockRecord'=> ctx()->privateState->skillUnlockRecord,
+            'funUnlockRecord' => ctx()->privateState->funUnlockRecord,
+            'skillUnlockRecord' => ctx()->privateState->skillUnlockRecord,
         );
         return Resp::ok($ret);
     }
-    
+
     /**
      * 检测功能解锁的
      * @param type $resultType
      * @param type $gateId
      * @return type
      */
-    static function funUnlock($resultType,$gateId) {
-        $dic = GameConfig::fun_unlock();                  
+    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->unlockGateId == $gateId) {
                 $tag = false;
                 //1:参与战斗结束即可  2战斗胜利  3某场战斗参加N次数才行
                 switch ($mo->unlockType) {
                     case 1:
-                        if(ctx()->gates->GateList->$gateId->fightNum == 0){
+                        if (ctx()->gates->GateList->$gateId->fightNum == 0) {
                             $tag = true;
                         }
                         break;
                     case 2:
-                        if($resultType == true && ctx()->gates->GateList->$gateId->pass == 0){
+                        if ($resultType == true && ctx()->gates->GateList->$gateId->pass == 0) {
                             $tag = true;
                         }
 
                         break;
                     default:
                         break;
-                }                              
-                
-                if($tag){
+                }
+
+                if ($tag) {
                     ctx()->privateState->funUnlockRecord[] = $id;
                 }
             }
         }
-                      
+    }
+
+    /**
+     * 检测技能解锁的 1 关卡解锁,游玩到一定关卡解锁技能
+     * @param type $resultType
+     * @param type $gateId
+     * @return type
+     */
+    static function skillUnlock_gate($resultType, $gateId) {
+        $dic = GameConfig::skills();
+        foreach ($dic as $id => $mo) {
+            if ($mo->unlock_acc_id_new == null) {
+                continue;
+            }          
+            $strList = explode(':', $mo->unlock_acc_id_new);
+            $unlockType = $strList[0];
+            $unlockId = $strList[1];
+                        
+            if($unlockType == 1 && $unlockId == $gateId && $resultType == true && ctx()->gates->GateList->$gateId->pass == 0 && !in_array($mo->typeId, ctx()->privateState->skillUnlockRecord)){
+                ctx()->privateState->skillUnlockRecord[] = $mo->typeId;
+            }
+        }
+    }
+    
+    /**
+     * 检测技能解锁的 2://皮肤解锁,获取到人物解锁后对应皮肤技能
+     * @param type $resultType
+     * @param type $gateId
+     * @return type
+     */
+    static function skillUnlock_heroUnlock($heroId) {
+        $dic = GameConfig::skills();
+        foreach ($dic as $id => $mo) {
+            if ($mo->unlock_acc_id_new == null) {
+                continue;
+            }           
+                        
+            $strList = explode(':', $mo->unlock_acc_id_new);
+            $unlockType = $strList[0];
+            $unlockId = $strList[1];               
+            
+            if($unlockType != 2){
+                continue;
+            }
+            
+            $heroMo = GameConfig::hero_getItem($heroId);
+            $heroTypeId = $heroMo->typeID;
+            $isUnlock =  ctx()->heros->Dic->$heroId->isUnlock;
+            
+            if($unlockId == $heroTypeId && $isUnlock == 0 && !in_array($mo->typeId, ctx()->privateState->skillUnlockRecord)){
+                ctx()->privateState->skillUnlockRecord[] = $mo->typeId;
+            }
+        }
+    }
+    
+    /**
+     * 检测技能解锁的  3://玩家失败X次后解锁   
+     * @param type $resultType
+     * @param type $gateId
+     * @return type
+     */
+    static function skillUnlock_fightNum($resultType) {
+        if(!$resultType){
+            return;
+        }
+        
+        $GateList = ctx()->gates->GateList;
+        $num = 0;
+        foreach ($GateList as $gateId => $Ins_GateInfo) {
+            $num += $Ins_GateInfo->fightNum_fail;
+        }
+        
+        $dic = GameConfig::skills();        
+        foreach ($dic as $id => $mo) {
+            if ($mo->unlock_acc_id_new == null) {
+                continue;
+            }
+            
+            $strList = explode(':', $mo->unlock_acc_id_new);
+            $unlockType = $strList[0];
+            $unlockId = $strList[1];
+            
+            if($unlockType != 3){
+                continue;
+            }
+                        
+            if($num == $unlockId && !in_array($mo->typeId, ctx()->privateState->skillUnlockRecord)){
+                ctx()->privateState->skillUnlockRecord[] = $mo->typeId;
+            }
+        }
     }
 
 // <editor-fold defaultstate="collapsed" desc="排行榜">

+ 2 - 0
Gameserver/App/process/HeroProc.php

@@ -115,6 +115,8 @@ class HeroProc {
         
         ctx()->store->removeItem($itemId, $itemNum);
         
+        FightProc::skillUnlock_heroUnlock($heroId);//这个接口位置不能动
+        
         ctx()->heros->Dic->$heroId->isUnlock = 1;//解锁
         ctx()->heros->Dic->$heroId->isNewHeadImgTip = 1;                   
         

+ 19 - 0
Gameserver/App/process/UserProc.php

@@ -36,10 +36,29 @@ class UserProc {
                 return UserProc::removeNewHeadImgTip();
             case CmdCode::cmd_user_readAnnouncement:                            # 6008 读公告记录 
                 return UserProc::readAnnouncement();
+            case CmdCode::cmd_user_clearFunUnlockInfo:                          # 6009 重置功能解锁记录信息
+                return UserProc::clearFunUnlockInfo();
             default:
                 Err(ErrCode::cmd_err);
         }
     }
+    
+    /**
+     * 6009 重置功能解锁记录信息
+     */
+    public static function clearFunUnlockInfo() {
+        list($type,$id) = req()->paras;
+
+        if($type == 1 && in_array($id,ctx()->privateState->funUnlockRecord)){
+            StlUtil::arrayRemove(ctx()->privateState->funUnlockRecord,$id);  
+        } elseif ($type == 2 && in_array($id,ctx()->privateState->skillUnlockRecord)) {
+            StlUtil::arrayRemove(ctx()->privateState->skillUnlockRecord,$id);  
+        }
+
+        UserProc::updateUserInfo();
+
+        return Resp::ok(array());
+    }
 
     /**
      * 6008 读公告记录