瀏覽代碼

言灵替换修改

cyzhao 4 年之前
父節點
當前提交
4359d9c4ee
共有 1 個文件被更改,包括 23 次插入10 次删除
  1. 23 10
      Gameserver/Amfphp/process/HeroProc.php

+ 23 - 10
Gameserver/Amfphp/process/HeroProc.php

@@ -60,7 +60,7 @@ class HeroProc {
             case CmdCode::cmd_hero_saveHeroTeamConfig:                          #  [6315] 保存玩家战队数据
                 return HeroProc::SaveHeroTeamConfig();
 
-            // <editor-fold defaultstate="collapsed" desc="   英雄升级 cyzhao  ">
+            // <editor-fold defaultstate="collapsed" desc="          ------------- 英雄升级 cyzhao  ">
 
 
             case CmdCode::cmd_hero_StrengthenStar:                              #  [6326] 升星cmd_hero_YanlinUpLevel
@@ -312,23 +312,36 @@ class HeroProc {
      * @return type
      */
     static function YanLingReplace() {
-        list($uid ,$replaceId) = req()->paras;                                  # 参数 言灵uid(指定进阶的言灵实例id)
+        list($heroId, $yanlingRank, $heroReplaceId, $yanlingReplaceRank) = req()->paras;                                  # 参数 言灵uid(指定进阶的言灵实例id)
         $user = req()->userInfo->game;
-        $yanling = $user->store->yanling;        
-        my_Assert(property_exists($yanling, $uid), "找不到这个言灵");
-        my_Assert(property_exists($yanling, $replaceId), "找不到这个言灵");
         
+        $collectHeros = $user->heros->collectHeros;
+        my_Assert(StlUtil::dictHasProperty($collectHeros, $heroId) && StlUtil::dictHasProperty($collectHeros, $heroReplaceId) , "找不到这个唤灵师");
+        
+        $yanling = $collectHeros->$heroId->yanling; 
+        $yanlingReplace = $collectHeros->$heroReplaceId->yanling; 
+        my_Assert($yanling->$yanlingRank->itemuid != 0 && $yanlingReplace->$yanlingReplaceRank->itemuid != 0, "找不到这个言灵");
+        
+        $itemuid = $yanling->$yanlingRank->itemuid;
+        $replaceItemuid = $yanlingReplace->$yanlingReplaceRank->itemuid;
+        
+        $user->store->yanling->$itemuid->herouid = $heroReplaceId;        
+        $user->store->yanling->$replaceItemuid->herouid = $heroId;
+        
+        $yanling->$yanlingRank->itemuid = $replaceItemuid;
+        $yanlingReplace->$yanlingReplaceRank->itemuid = $itemuid;
+               
+        $collectHeros->$heroId->yanling = $yanling;
+        $collectHeros->$heroReplaceId->yanling = $yanlingReplace;
+        $user->heros->collectHeros = $collectHeros;               
+        $user->store->yanling = $yanling;
         
-        $herouid = $yanling->$uid->herouid;
-        $herouid_replace = $yanling->$replaceId->herouid;
-        $yanling->$replaceId->herouid = $herouid;
-        $yanling->$uid->herouid = $herouid_replace;
-        $user->store->equipment = $yanling;
         req()->userInfo->game = $user;
         
         UserProc::updateUserInfo();                                             # 回写玩家数据 
         return Resp::ok(array(
                     "store" => $user->store, #                                  # 目前来看只涉及到items变化
+                    "hero"=> $user->heros,
         ));
     }