浏览代码

言灵替换

cyzhao 4 年之前
父节点
当前提交
3e08a8da1b
共有 3 个文件被更改,包括 37 次插入2 次删除
  1. 5 0
      Gameserver/Amfphp/base/CmdCode.php
  2. 28 1
      Gameserver/Amfphp/process/HeroProc.php
  3. 4 1
      Gameserver/Amfphp/process/StoreProc.php

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

@@ -485,6 +485,11 @@ class CmdCode {
      * 突破
      */
     const cmd_hero_tupo = 6328;
+    
+    /**
+     * 
+     */
+    const cmd_hero_YanLingReplace = 6329;
 // </editor-fold>
     //
     // <editor-fold defaultstate="collapsed" desc="仓库操作码 - 64xx">

+ 28 - 1
Gameserver/Amfphp/process/HeroProc.php

@@ -16,7 +16,7 @@ class HeroProc {
         switch (req()->cmd) {
             case CmdCode::cmd_hero_levelup:                                     #  [6301] 英雄升级
                 return HeroProc::HeroLevelUpCostExpItem();
-            case CmdCode::cmd_hero_tupo:                                        #  [6301] 英雄升级
+            case CmdCode::cmd_hero_tupo:                                        #  [6328] 英雄突破
                 return HeroProc::tupo();
 
             // <editor-fold defaultstate="collapsed" desc="过时 接口">
@@ -67,6 +67,8 @@ class HeroProc {
                 return HeroProc::StrengthenStar();
             case CmdCode::cmd_hero_YanlinUpLevel:                               #  [6327] 升级
                 return HeroProc::YanlinUpLevel();
+            case CmdCode::cmd_hero_YanLingReplace:                              #  [6329] 言灵替换
+                return HeroProc::YanLingReplace();
 // </editor-fold>
             default:                                                            #  err: 未知的命令码
                 return Resp::err(ErrCode::cmd_err);
@@ -304,6 +306,31 @@ class HeroProc {
         );
         return Resp::ok($ret);
     }
+    
+    /**
+     * 武器替换
+     * @return type
+     */
+    static function YanLingReplace() {
+        list($uid ,$replaceId) = req()->paras;                                  # 参数 言灵uid(指定进阶的言灵实例id)
+        $user = req()->userInfo->game;
+        $yanling = $user->store->yanling;
+        my_Assert(property_exists($yanling, $uid), "找不到这个言灵");
+        my_Assert(property_exists($yanling, $replaceId), "找不到这个言灵");
+        
+        
+        $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变化
+        ));
+    }
 
 // </editor-fold>
 //

+ 4 - 1
Gameserver/Amfphp/process/StoreProc.php

@@ -210,7 +210,10 @@ class StoreProc {
                     'gold' => $user->baseInfo->gold,
         ));
     }
-
+    /**
+     * 武器替换
+     * @return type
+     */
     static function weaponReplace() {
         list($uid ,$replaceId) = req()->paras;                                  # 参数 言灵uid(指定进阶的言灵实例id)
         $user = req()->userInfo->game;