cyzhao 4 years ago
parent
commit
4668b36697

+ 9 - 0
Gameserver/Amfphp/model/User/Enum_EventType.php

@@ -105,4 +105,13 @@ class Enum_EventType {
      */
     const WeaponTuPo = 'WeaponTuPo';
     
+    /**
+     * 言灵升级
+     */
+    const YanLingLvUp = 'YanLingLvUp';
+    
+    /**
+     * 言灵升级
+     */
+    const YanLingTuPo = 'YanLingTuPo';
 }

+ 18 - 0
Gameserver/Amfphp/process/EventProc/NormalEventProc.php

@@ -177,4 +177,22 @@ class NormalEventProc {
         Resp::AddEvent(Enum_EventType::WeaponTuPo, $arg1, $arg2);
     }
     
+    /**
+     * 升级-言灵
+     * @param type $arg1 唤灵师uid
+     * @param type $arg2 最新等级
+     */
+    public static function OnYanLingLvlUp($arg1, $arg2) {
+        Resp::AddEvent(Enum_EventType::YanLingLvUp, $arg1, $arg2);
+    }
+    
+    /**
+     * 突破-言灵
+     * @param type $arg1
+     * @param type $arg2
+     */
+    public static function OnYanLingLvTuPo($arg1, $arg2) {
+        Resp::AddEvent(Enum_EventType::YanLingTuPo, $arg1, $arg2);
+    }
+    
 }

+ 105 - 0
Gameserver/Amfphp/process/HeroProc.php

@@ -721,6 +721,111 @@ class HeroProc {
         UserProc::updateUserInfo();
         return Resp::ok(array('store' => req()->userInfo->game->store,));
     }
+    
+    static function StrengthenStar_new() {
+        list($uid) = req()->paras;                                              # 参数 言灵uid(指定进阶的言灵实例id)
+        $user = req()->userInfo->game;
+        $yanling = $user->store->yanling;
+        my_Assert(CommUtil::isPropertyExists($yanling, $uid), ErrCode::store_weapon_err); # 玩家拥有此英雄
+        
+        $typeId = $yanling->$uid->typeId;
+        $curStar = $yanling->$uid->starLv;
+        my_Assert($curStar < 5, ErrCode::hero_yanling_canotTupo);
+        
+        $mo = GameConfig::yanlingextra_level_getItem($typeId, $curStar+1);
+        my_Assert($mo != null, ErrCode::err_const_no);
+        
+        my_Assert($yanling->$uid->level >= $mo->starlimitLv, ErrCode::hero_yanling_canotTupo);
+        my_Assert($user->baseInfo->level >= $mo->userlvLimit, ErrCode::hero_yanling_canotTupo);
+        my_Assert($user->baseInfo->gold >= $mo->gold , ErrCode::notenough_gold_msg); 
+     
+        $costItemsList = explode(';',$mo->costItems);   
+        foreach ($costItemsList as $value) {
+            $list = explode(',', $value);
+            StoreProc::removeItemFromStore($user->store, $list[0], $list[1]);             
+        }
+      
+        $user->baseInfo->gold -= $mo->gold;
+        $yanling->$uid->starLv += 1;
+        
+        NormalEventProc::OnYanLingLvTuPo($uid, $yanling->$uid->starLv);         # 广播英雄升级事件
+        
+        $user->store->yanling = $yanling;
+        req()->userInfo->game = $user;
+        
+        UserProc::updateUserInfo();                                             # 回写玩家数据 
+        return Resp::ok(array(
+                    "store" => $user->store, #                                  # 目前来看只涉及到items变化
+                    'gold' => $user->baseInfo->gold,
+        ));
+    }
+    /**
+     * 言灵升级
+     * @return type
+     */
+    static function YanlinUpLevel_new() {
+        list($uid,$yanlingList, $items) = req()->paras;                                        # 参数 言灵uid(指定进阶的言灵实例id)
+        $user = req()->userInfo->game;
+        $yanling =  $user->store->yanling;
+          
+        my_Assert(CommUtil::isPropertyExists($yanling, $uid), ErrCode::store_weapon_err); # 玩家拥有此英雄
+        $myPacketItems = $user->store->items;
+        //消耗材料道具
+        $total = 0;
+        $totalGold = 0;
+        foreach ($items as $costItemId => $costNumber) {       
+            my_Assert(CommUtil::isPropertyExists($myPacketItems,$costItemId), ErrCode::store_itemnotenough); # 
+            my_Assert($myPacketItems->$costItemId >= $costNumber, ErrCode::store_itemnotenough);# 检查道具的数量,在背包中是否充足
+            $mo = GameConfig::item_stones_getItem($costItemId);
+            my_Assert($mo != null, ErrCode::err_const_no);
+            
+            StoreProc::removeItemFromStore($user->store, $costItemId, $costNumber);                      
+            $total += $mo->baseExp*$costNumber;          
+            $totalGold += $mo->costGold*$costNumber;
+        }
+        
+        $yanlingExp = 0;
+        //消耗武器        
+        foreach ($yanlingList as $yanlingId) {
+            my_Assert(CommUtil::isPropertyExists($yanling, $yanlingId), ErrCode::store_weapon_err); # 玩家拥有此英雄             
+            $mo = GameConfig::item_yanling_getItem($yanling->$yanlingId->typeId);           
+            $baseExp = $mo->baseExp;            
+            $yanlingExp += $baseExp + $yanling->$yanlingId->curStarExp *0.75;
+            $totalGold += $mo->costGold;
+            StlUtil::dictRemove($user->store->yanling, $yanlingId);  
+        }
+        my_Assert($user->baseInfo->gold >= $totalGold, ErrCode::notenough_gold_msg);
+        
+        $equipVo = new Ins_YanLin($yanling->$uid);
+        //$equipVo = new Ins_Weapon($equipment->$uid);      
+        $initLevel = $equipVo->level;
+               
+        $equipVo->curStarExp += $total+(int)$wuqiExp;     
+        $curlevel = self::Upgrade($equipVo->exp, GameConfig::item_base_getItem($equipVo->typeId)->quality);      
+        $curStar = $equipVo->starLv ; #当前星级
+        $equipVo->level = $curlevel; 
+        if ($curStar < 5) {
+            $starlimitLv = GameConfig::yanlingextra_level_getItem($equipVo->typeId, $curStar + 1)->starlimitLv;
+            if ($starlimitLv < $curlevel) {
+                $equipVo->level = $starlimitLv;                
+                $equipVo->curStarExp = GameConfig::yanlingLevel_type_getItem(GameConfig::item_base_getItem($equipVo->typeId)->quality,$starlimitLv)->requiredExp;
+            }
+        }
+            
+        $user->store->yanling->$uid = $equipVo;        
+        $user->baseInfo->gold -= $totalGold;
+        req()->userInfo->game = $user;
+        req()->userInfo->game->store->items = $myPacketItems;                    # 更新背包数据
+        if ($equipVo->level != $initLevel) {
+            NormalEventProc::OnYanLingLvlUp($uid, $equipVo->level);         # 广播英雄升级事件
+        }     
+        
+        UserProc::updateUserInfo();                                             # 回写玩家数据 
+        return Resp::ok(array(
+                    "store" => $user->store, #                                  # 目前来看只涉及到items变化
+                    'gold' => $user->baseInfo->gold,
+        ));
+    }
 
     /** 6327
      * 言灵升级  2021.4(cyzhao)

+ 2 - 2
Gameserver/Amfphp/process/StoreProc.php

@@ -74,7 +74,7 @@ class StoreProc {
         list($uid,$wuqiList, $items) = req()->paras;                                        # 参数 言灵uid(指定进阶的言灵实例id)
         $user = req()->userInfo->game;
         $equipment =  $user->store->equipment;
-          
+        
         my_Assert(CommUtil::isPropertyExists($equipment, $uid), ErrCode::store_weapon_err); # 玩家拥有此英雄
         $myPacketItems = $user->store->items;
         //消耗材料道具
@@ -97,7 +97,7 @@ class StoreProc {
             my_Assert(CommUtil::isPropertyExists($equipment, $wuqiId), ErrCode::store_weapon_err); # 玩家拥有此英雄             
             $mo = GameConfig::item_weapon_getItem($equipment->$wuqiId->typeId);           
             $baseExp = $mo->baseExp;
-            $needExp = GameConfig::weapon_levelexp_getItem(GameConfig::item_base_getItem($equipment->$wuqiId->typeId)->quality,$equipment->$wuqiId->level)->needExp;
+            //$needExp = GameConfig::weapon_levelexp_getItem(GameConfig::item_base_getItem($equipment->$wuqiId->typeId)->quality,$equipment->$wuqiId->level)->needExp;
             $wuqiExp += $baseExp + $equipment->$wuqiId->exp*0.75;
             $totalGold += $mo->costGold;
             StlUtil::dictRemove($user->store->equipment, $wuqiId);