cyzhao преди 4 години
родител
ревизия
f576141415

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

@@ -471,6 +471,11 @@ class CmdCode {
      * 升星
      */
     const cmd_hero_StrengthenStar = 6326;
+    
+    /**
+     * 升级
+     */
+    const cmd_hero_YanlinUpLevel = 6327;
 // </editor-fold>
     //
     // <editor-fold defaultstate="collapsed" desc="仓库操作码 - 64xx">

+ 17 - 1
Gameserver/Amfphp/configs/GameConfig.php

@@ -4,7 +4,7 @@ namespace loyalsoft;
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-03-03 13:52:53
+ // 日期: 2021-03-16 14:49:13
 ////////////////////
 
 /**
@@ -471,6 +471,22 @@ class GameConfig {
         return self::get_hash_item('hero_levelexp_costitem', $itemid);
     }
     /**
+    * 言灵等级
+    * @return \yanlingLeve
+    */
+    public static function yanlingLeve()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'yanlingLeve');
+    }
+    /**
+    * @return \sm_yanlingLeve yanlingLeve item数据 
+    */
+    public static function yanlingLeve_getItem($itemid)
+    { 
+        return self::get_hash_item('yanlingLeve', $itemid);
+    }
+    /**
     * 圣哲学院表
     * @return \college
     */

+ 1 - 0
Gameserver/Amfphp/configs/GameConstants.php

@@ -82,6 +82,7 @@ define('META_FriendShipPoit_ItemId', 4);
 define("META_PVPCOIN_ITEMID", 5);                                               # PVP竞技币物品id
 define("META_ActivePoint_ITEMID", 6);                                           # 每日任务活跃点物品id
 define("META_YUANBAOITEMID", 7);                                                # 元宝物品ID
+define("META_RESPOINT_ITEMID",8);                                               #资源点
 //                                                            TODO: config the c-s offset data
 define("OFFSET_TIMESPAN", -3);                                                  # 服务端相对于客户端的偏移时间戳
 define("OFFSET_MSGTIME", 30);                                                   # 客户端服务端时间戳偏移最大误差

+ 18 - 2
Gameserver/Amfphp/model/Const/GameConfig.php

@@ -1,10 +1,10 @@
 <?php
-
+namespace loyalsoft;
 ////////////////////
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-03-15 11:40:49
+ // 日期: 2021-03-16 14:49:13
 ////////////////////
 
 /**
@@ -471,6 +471,22 @@ class GameConfig {
         return self::get_hash_item('hero_levelexp_costitem', $itemid);
     }
     /**
+    * 言灵等级
+    * @return \yanlingLeve
+    */
+    public static function yanlingLeve()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'yanlingLeve');
+    }
+    /**
+    * @return \sm_yanlingLeve yanlingLeve item数据 
+    */
+    public static function yanlingLeve_getItem($itemid)
+    { 
+        return self::get_hash_item('yanlingLeve', $itemid);
+    }
+    /**
     * 圣哲学院表
     * @return \college
     */

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

@@ -4,7 +4,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-03-12 13:52:27
+ // 日期: 2021-03-15 12:04:49
 ////////////////////
 
 

+ 33 - 0
Gameserver/Amfphp/model/Const/sm_yanlingLeve.php

@@ -0,0 +1,33 @@
+<?php
+
+////////////////////
+ // 由CodeGenerator创建。
+ // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
+ // author: gwang 
+ // 日期: 2021-03-16 13:47:58
+////////////////////
+
+
+/**
+ * Static Model yanlingLeve 言灵等级
+ */
+class sm_yanlingLeve
+{
+
+    /**
+    * @var Int32 等级 default(0) 
+    */
+    public $id;
+
+    /**
+    * @var String 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $cost;
+
+    /**
+    * @var String 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $etc;
+
+}
+

+ 26 - 0
Gameserver/Amfphp/model/User/Data_UserGame.php

@@ -220,6 +220,22 @@ class Data_UserGame extends HashSaver {
         }
         return false;
     }
+    
+    /**
+     * 扣除资源点
+     * @param type $user
+     * @param type $amt
+     * @return boolean
+     */
+    static public function Consume_ResPoint($user, $amt) {
+        if ($amt > 0 && isset($user) && isset($user->resPoint)) {
+            if ($user->resPoint - $amt >= 0) {
+                $user->resPoint -= $amt;
+                return true;
+            }
+        }
+        return false;
+    }
 
     /**
      * 扣除玩家友情点
@@ -336,6 +352,16 @@ class Data_UserGame extends HashSaver {
         my_Assert($amt >= 0, "体力amt小于0");
         ActiveProc::ChangeTili($amt);
     }
+    /**
+     * 增加资源点
+     * @param type $user
+     * @param type $amt
+     */
+    static function Add_resPoint(&$user, $amt) {
+        my_Assert($user, "参数null");
+        my_Assert($amt >= 0, "参数为负");
+        $user->resPoint += $amt;
+    }
 
 // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc="私有方法">

+ 6 - 0
Gameserver/Amfphp/model/User/Info_UserBase.php

@@ -100,6 +100,12 @@ class Info_UserBase {
      * @var int 游戏内赠送游戏币总额
      */
     public $gift_cash = 0;  //
+    
+    /**
+     * 言灵等级消耗的资源点
+     * @var type
+     */
+    public $resPoint = 0;  
 
     public function initialize() {
         my_Assert(GameConfig::primordial_data(), "找不到账号初始化数据");         # 防御

+ 0 - 7
Gameserver/Amfphp/model/User/Ins_YanLin.php

@@ -44,13 +44,6 @@ class Ins_YanLin {
      */
     public $level = 1;
     
-    /**
-     * 当前升级经验
-     * @var type
-     */
-    public $curLevelExp = 0;
-
-
     public function __construct($args=null) {      
         parent::__construct($args);       
     }

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

@@ -959,7 +959,7 @@ class HeroProc {
     }
 
     /**
-     * 升星
+     * 言灵升星
      * @param req $req
      * @return type
      */
@@ -1013,6 +1013,39 @@ class HeroProc {
     }
 
 
+    /**
+     * 言灵升级
+     * @param req $req
+     */
+    static function YanlinUpLevel($req) {
+        list($yanlingUid,$type) = $req->paras;
+        $store = $req->userInfo->game->store;
+        if(!StlUtil::dictHasProperty($store->yanling,$yanlingUid)){
+            return Resp::err(ErrCode::hero_yanling_notfound);
+        }
+        $curlv = $store->yanling->$yanlingUid->level;
+        $maxLv = $curlv + $type;
+       
+        for ($index = $curlv; $index < $maxLv; $index++) {
+            $mo = GameConfig::yanlingLeve_getItem($index); 
+            $costList = explode(';', $mo->cost);             
+            foreach ($costList as $item) {
+                $list = explode(',', $item);
+                if($list[0] == META_GOLD_ITEMID){//扣金币
+                    Data_UserGame::Consume_Gold($req->userInfo->game->baseInfo, $list[1]);
+                } elseif ($list[0] == META_RESPOINT_ITEMID) {//扣除资源点
+                    Data_UserGame::Consume_ResPoint($req->userInfo->game->baseInfo,  $list[1]);
+                }
+            }                            
+            
+        }
+        
+        $store->yanling->$yanlingUid->level += $type;
+        $req->userInfo->game->store = $store;   
+        
+        UserProc::updateUserInfo();   
+        return Resp::ok(array('store' => $req->userInfo->game->store,'gold'=>$req->userInfo->game->baseInfo->gold,'resPoint'=>$req->userInfo->game->baseInfo->resPoint));
+    }
 //
 // <editor-fold defaultstate="collapsed" desc="计算战队战斗力, for pvp back matchers, -wg 2017.07.13">