Pārlūkot izejas kodu

等级奖励入库屏蔽和进化接口

cyzhao 10 mēneši atpakaļ
vecāks
revīzija
632760e241

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

@@ -372,6 +372,11 @@ class CmdCode {
      * 是否存在未领取的荣誉榜奖励
      */
     const fight_rank_IsExistRankReward = 6817;
+    
+    /**
+     * 启灵进化解锁新的能力点
+     */
+    const fight_evolveUnlock = 6818;
 
     // </editor-fold>
     

+ 4 - 0
Gameserver/App/base/ErrCode.php

@@ -394,6 +394,10 @@ class ErrCode {
      */
     const rankReward_HasReceive = 3214;
 
+    /**
+     * 没有达到解锁等级
+     */
+    const evolve_canotUnlock_levelLimit = 3215;
 // </editor-fold>
 //
 //   // <editor-fold defaultstate="collapsed" desc="    store 3300    ">

+ 1 - 1
Gameserver/App/model/User/Info_UserBase.php

@@ -270,7 +270,7 @@ class Info_UserBase extends Object_ext {
         $nextLevel = $curLevel + 1;
         while ($this->xp >= $cfgLVs->$nextLevel->xp_need) {                     # 超过升级所需经验
             if ($this->level < glc()->Game_MaxPlayerLevel) {                    # 如果未到达最大等级
-                StoreProc::AddMultiItemInStore(GameConfig::player_level_getItem($this->level)->reward);
+                //StoreProc::AddMultiItemInStore(GameConfig::player_level_getItem($this->level)->reward);
                 $this->level++;               
                 $this->xp -= $cfgLVs->$nextLevel->xp_need;
                 $curLevel = $this->level;

+ 47 - 0
Gameserver/App/process/FightProc.php

@@ -51,10 +51,57 @@ class FightProc {
                 return self::ReceiveRankReward_FightPower();
             case CmdCode::fight_rank_IsExistRankReward:                         # 6817 是否存在未领取的荣誉榜奖励
                 return self::IsExistRankReward();
+            case CmdCode::fight_evolveUnlock:                                   # 6818 启灵解锁
+                return self::EvolveUnlock();
             default:
                 Err(ErrCode::cmd_err);
         }
     }
+    
+    /**
+     * 6805 进化解锁
+     * @return type
+     */
+    public static function EvolveUnlock() {
+        list($type, $id) = req()->paras;
+        
+        if ($type == 1) {
+            $mo = GameConfig::evolve_getItem($id);
+            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 = $id;
+            
+        } else {
+            $dic = GameConfig::evolve();
+            foreach ($dic as $key => $value) {
+                if ($value->specificEvolveId == $id) {
+                    $mo = $value;
+                }
+            }
+
+            my_Assert(ctx()->baseInfo->level >= $mo->level, ErrCode::evolve_canotUnlock_levelLimit);
+            my_Assert($mo != null, ErrCode::err_const_no);
+            if ($mo->specificEvolveCost != null) {
+                $cost = explode(',', $mo->specificEvolveCost);
+                $costId = $cost[0];
+                $costNum = $cost[1];
+                my_Assert(StlUtil::dictHasProperty(ctx()->store->items, $costId) && ctx()->store->items->$costId >= $costNum, ErrCode::notenough_item);
+                ctx()->store->removeItem($costId, $costNum);
+            }
+            ctx()->gates->evolveMaxId_right = $id;
+        }
+     
+        UserProc::updateUserInfo();
+        $ret = array(
+            'gold'=> ctx()->baseInfo->gold,
+            'items' => ctx()->store->items,
+            'evolveMaxId_right' => ctx()->gates->evolveMaxId_right,
+            'evolveMaxId_left' => ctx()->gates->evolveMaxId_left,
+        );
+        return Resp::ok($ret);
+    }
 
     /**
      * 6807 扫荡