浏览代码

言灵召唤功能, + 引导完成后切换言灵为普通言灵.

gwang 4 年之前
父节点
当前提交
613446d1fa

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

@@ -480,6 +480,12 @@ class CmdCode {
      * 利用言灵召唤书召唤言灵
      */
     const cmd_store_callyanling = 6419;
+
+    /**
+     * 言灵进阶
+     */
+    const cmd_store_yanling_upgrade = 6420;
+
 // </editor-fold>
     //
     // <editor-fold defaultstate="collapsed" desc="活动操作码 - 65xx">

+ 10 - 0
Gameserver/Amfphp/base/ErrCode.php

@@ -498,6 +498,16 @@ class ErrCode {
      * 言灵召唤书常量数据有误
      */
     const store_book_info = 3412;
+
+    /**
+     * 言灵进阶数据有问题
+     */
+    const store_yanlingGrade_cfg = 3413;
+
+    /**
+     * 言灵已经进阶至最高
+     */
+    const store_yanlingGrade_max = 3414;
 // </editor-fold>
     //  
     // <editor-fold defaultstate="collapsed" desc="   任务错误码 35xx系列   ">

+ 21 - 5
Gameserver/Amfphp/configs/GameConfig.php

@@ -6,7 +6,7 @@ namespace loyalsoft;
 // 由CodeGenerator创建。
 // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
 // author: gwang 
-// 日期: 2020-07-22 14:26:25
+// 日期: 2020-07-29 11:14:40
 ////////////////////
 
 /**
@@ -134,7 +134,7 @@ class GameConfig {
     }
 
     /**
-     * 
+     * [废弃]
      * @return \item
      */
     public static function item() {
@@ -150,7 +150,7 @@ class GameConfig {
     }
 
     /**
-     * 
+     * [废弃]
      * @return \itemlevel
      */
     public static function itemlevel() {
@@ -511,7 +511,7 @@ class GameConfig {
     }
 
     /**
-     * 
+     * [废弃]
      * @return \gate_carbon_content
      */
     public static function gate_carbon_content() {
@@ -719,7 +719,7 @@ class GameConfig {
     }
 
     /**
-     * 
+     * [废弃]
      * @return \gate_city
      */
     public static function gate_city() {
@@ -1248,6 +1248,22 @@ class GameConfig {
         return self::get_hash_item('item_yanlingbook', $itemid);
     }
 
+    /**
+     * 言灵进阶表
+     * @return \yanling_upgrade
+     */
+    public static function yanling_upgrade() {
+        static $a = null;
+        return self::initValue($a, 'yanling_upgrade');
+    }
+
+    /**
+     * @return \sm_yanling_upgrade yanling_upgrade item数据 
+     */
+    public static function yanling_upgrade_getItem($typeId, $grade) {
+        return self::get_hash_item('yanling_upgrade', $typeId)->$grade;
+    }
+
     /**
      * 当前版本(时间戳)
      * @return \ver

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_gate_carbon_content.php

@@ -9,7 +9,7 @@
 
 
 /**
- * Static Model gate_carbon_content 
+ * Static Model gate_carbon_content [废弃]
  */
 class sm_gate_carbon_content
 {

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_gate_city.php

@@ -9,7 +9,7 @@
 
 
 /**
- * Static Model gate_city 
+ * Static Model gate_city [废弃]
  */
 class sm_gate_city
 {

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_item.php

@@ -9,7 +9,7 @@
 
 
 /**
- * Static Model item 
+ * Static Model item [废弃]
  */
 class sm_item
 {

+ 1 - 2
Gameserver/Amfphp/model/Const/sm_item_base.php

@@ -4,7 +4,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2020-07-22 14:22:05
+ // 日期: 2020-07-22 16:23:35
 ////////////////////
 
 
@@ -84,7 +84,6 @@ class sm_item_base
     *   箱子
     *      YanlingBook =351,          // 言灵召唤书 
     *   
-    *      YanlingCallMaterials =361, // 言灵召唤/进阶材料
     *      //...合成素材等...
     *      YanLing = 401,            // 言灵 default(0) 
     */

+ 6 - 1
Gameserver/Amfphp/model/Const/sm_item_yanling.php

@@ -4,7 +4,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2020-07-22 13:55:34
+ // 日期: 2020-07-27 15:50:08
 ////////////////////
 
 
@@ -94,5 +94,10 @@ class sm_item_yanling
     */
     public $race;
 
+    /**
+    * @var Int32 职业倾向:1战士、2法师、3射手  
+    */
+    public $career;
+
 }
 

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_item_yanlingbook.php

@@ -4,7 +4,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2020-07-22 14:23:02
+ // 日期: 2020-07-22 16:13:09
 ////////////////////
 
 

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_itemlevel.php

@@ -9,7 +9,7 @@
 
 
 /**
- * Static Model itemlevel 
+ * Static Model itemlevel [废弃]
  */
 class sm_itemlevel
 {

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_task.php

@@ -4,7 +4,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2020-07-16 14:40:42
+ // 日期: 2020-07-24 11:21:34
 ////////////////////
 
 

+ 68 - 0
Gameserver/Amfphp/model/Const/sm_yanling_upgrade.php

@@ -0,0 +1,68 @@
+<?php
+
+////////////////////
+ // 由CodeGenerator创建。
+ // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
+ // author: gwang 
+ // 日期: 2020-07-29 08:50:21
+////////////////////
+
+
+/**
+ * Static Model yanling_upgrade 言灵进阶表
+ */
+class sm_yanling_upgrade
+{
+
+    /**
+    * @var Int32 言灵ID  
+    */
+    public $typeId;
+
+    /**
+    * @var Int32 等阶,(升阶用的)  
+    */
+    public $grade;
+
+    /**
+    * @var Int32 附加生命 default(0) 
+    */
+    public $hp;
+
+    /**
+    * @var Int32 暴击 default(0) 
+    */
+    public $crit;
+
+    /**
+    * @var Int32 物理攻击 default(0) 
+    */
+    public $phyAtk;
+
+    /**
+    * @var Int32 防御护甲 default(0) 
+    */
+    public $phyDef;
+
+    /**
+    * @var Int32 法术强度 default(0) 
+    */
+    public $fashuqiangdu;
+
+    /**
+    * @var Int32 魔法抗性 default(0) 
+    */
+    public $mofakangxing;
+
+    /**
+    * @var Int32 技能ID  default(0) 
+    */
+    public $skill_id;
+
+    /**
+    * @var String 进阶消耗的材料清单: itemId,num;itemId,num;....  
+    */
+    public $cost_materials;
+
+}
+

+ 34 - 9
Gameserver/Amfphp/process/StoreProc.php

@@ -58,11 +58,43 @@ class StoreProc {
                 return self::MergeYanlingBook($req);
             case CmdCode::cmd_store_callyanling:                                # 6419 利用言灵召唤书召唤言灵
                 return self::CallYanlingByBook($req);
+            case CmdCode::cmd_store_yanling_upgrade:                            # 6420 言灵进阶
+                return self::YanlingUpgrade($req);
             default:
                 Err(ErrCode::cmd_err);
         }
     }
 
+    /**
+     * [6420] 言灵进阶
+     * @param req $req
+     */
+    static function YanlingUpgrade($req) {
+        list($yanlingUid) = $req->paras;                                        # 参数 言灵uid(指定进阶的言灵实例id)
+        $user = $req->userInfo->game;
+        my_Assert(property_exists($user->store->yanling, $yanlingUid), "找不到这个言灵");
+        $yanlingObj = $user->store->yanling->$yanlingUid;
+        $yanlingMoId = $yanlingObj->typeId;
+        $curGrade = property_exists($yanlingObj, "grade") ? $yanlingObj->grade : 1; # 当前等阶
+        $toGrade = $curGrade + 1;                                               # 下一等阶
+        my_Assert($toGrade <= 5, ErrCode::store_yanlingGrade_max);              # 已经进阶到最高
+        $toGradeCfg = GameConfig::yanling_upgrade_getItem($yanlingMoId, $toGrade); # 下一阶配置
+        my_Assert(null != $toGradeCfg, ErrCode::err_const_no);                  # 找不到言灵进阶常量 
+        $costs = explode(';', $toGradeCfg->cost_materials);
+        my_Assert(count($costs) > 0, ErrCode::store_yanlingGrade_cfg);          # 言灵进阶数据有误
+        foreach ($costs as $c) {
+            list($itemId, $num) = explode(',', $c);                             # 解析材料
+            $err = self::removeItemFromStore($user->store, $itemId, $num);      # 扣除 材料
+            my_Assert(ErrCode::ok == $err, $err);                               # 防御扣除材料失败
+        }
+        $yanlingObj->grade = $toGrade;                                          # 修改进阶
+        $user->store->yanling->$yanlingUid = $yanlingObj;                       # 回写言灵数据 
+        UserProc::updateUserInfo();                                             # 回写玩家数据 
+        return Resp::ok(array(
+                    "store" => $req->userInfo->game->store, #                   # 目前来看只涉及到items变化
+        ));
+    }
+
     /**
      * [6418] 利用言灵召唤书碎片合成召唤书
      * @param req $req
@@ -87,11 +119,6 @@ class StoreProc {
      * @param req $req
      */
     static function CallYanlingByBook($req) {
-        // 参数: 言灵id
-        // 扣除并检查召唤书数量
-        // 扣除并检查消耗材料数量
-        // 添加言灵
-        // 返回 新的store->item数据
         list($bookId) = $req->paras;                                            # 参数 利用的言灵召唤书id
         $user = $req->userInfo->game;
         $bookIdCfg = GameConfig::item_yanlingbook_getItem($bookId);
@@ -101,13 +128,11 @@ class StoreProc {
         $costs = explode(';', $bookIdCfg->cost_materials);
         my_Assert(count($costs) > 0, ErrCode::store_book_info);                 # 召唤书数据有误
         foreach ($costs as $c) {
-            list($itemId, $num) = explode(',', $c);     # 消耗材料
+            list($itemId, $num) = explode(',', $c);                             # 解析材料
             $err = self::removeItemFromStore($user->store, $itemId, $num);      # 扣除 材料
             my_Assert(ErrCode::ok == $err, $err);                               # 防御扣除材料失败
         }
-//        var_dump($req->userInfo->game->store->items);
-        self::PutYanLingInStore($bookIdCfg->yanling_id, $req);                  # 添加言灵
-//        var_dump($req->userInfo->game->store->items);
+        self::PutYanLingInStore($bookIdCfg->yanling_id, $req);                  # 添加言灵 
         UserProc::updateUserInfo();                                             # 回写数据 
         return Resp::ok(array(
                     "store" => $req->userInfo->game->store, #                   # 目前来看只涉及到items变化

+ 15 - 2
Gameserver/Amfphp/process/UserProc.php

@@ -151,12 +151,25 @@ class UserProc {
             $NewbieGuide->guideStep = 0;
         }
         my_Assert($guideIndex >= $NewbieGuide->guideStep, ErrCode::user_settutorialscompletedfail_err);
+        if ($guideIndex == 1) {
+            $huid = 10001;
+            $pos = 1;
+            $newYanlingUid = 1;
+            $hero = $user->heros->collectHeros->$huid;
+            $oldYanlingUId = $hero->yanling->$pos->itemuid;
+
+            $hero->yanling->$pos->itemuid = $newYanlingUid;
+            $oyl = $user->store->yanling->$oldYanlingUId;
+            $user->store->yanling->$newYanlingUid->herouid = $huid;
+            unset($oyl->herouid);
+        }
         $NewbieGuide->guideStep = $guideIndex;
         $user->NewbieGuide = $NewbieGuide;
         $req->userInfo->game = $user;
         UserProc::updateUserInfo();                                             # 回写数据
-        return Resp::ok(array(#                                                 # 返回值
-                    'result' => "succeed"
+        return Resp::ok(array(
+                    "store" => $req->userInfo->game->store, #                   # 目前来看只涉及到items变化
+                    "heros" => $user->heros, #                                  # 英雄数据
         ));
     }
 

+ 1 - 0
Gameserver/nbproject/private/private.xml

@@ -15,6 +15,7 @@
             <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/process/HeroProc.php</file>
             <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/util/CLog.php</file>
             <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/process/StoreProc.php</file>
+            <file>file:/D:/local_svn/0_ylsj2019/ylsj2019Server/Gameserver/Amfphp/base/CmdCode.php</file>
         </group>
     </open-files>
 </project-private>