소스 검색

fixed: 解锁技能API.

gwang 5 년 전
부모
커밋
885e5c9090

+ 32 - 28
Gameserver/Amfphp/model/User/UserHeroModel.php

@@ -116,39 +116,43 @@ class UserHeroModel extends Object_ext {
      *
      * 构造函数
      */
-    public function __construct() {
-        $this->level = 1;
-        $this->xp = 0;
-        $this->maxXp = 0;
-        $this->strengthLevel = 0;
-        $this->curBloodId = 0;
-        $this->curStar = 0;
-        $this->isLocked = false;
-        $this->curMainFavor = 'E';
-        $this->favors = ArrayInit();
-        $this->favors[] = 'E';
-        $this->grade = "D";
+    public function __construct($arg = null) {
+        if (null != $arg) {
+            parent::__construct($arg);
+        } else {
+            $this->level = 1;
+            $this->xp = 0;
+            $this->maxXp = 0;
+            $this->strengthLevel = 0;
+            $this->curBloodId = 0;
+            $this->curStar = 0;
+            $this->isLocked = false;
+            $this->curMainFavor = 'E';
+            $this->favors = ArrayInit();
+            $this->favors[] = 'E';
+            $this->grade = "D";
 //-----------初始化技能的默认数据
-        $temp = ObjectInit();
-        $temp->normalSkill = JsonUtil::decode('{"level":1}');
-        $temp->manuSkill1 = JsonUtil::decode('{"level":1}');
-        $temp->manuSkill2 = JsonUtil::decode('{"level":1}');
-        $temp->manuSkill3 = JsonUtil::decode('{"level":1}');
-        $temp->passiveSkill = JsonUtil::decode('{"level":1}');
-        $temp->captainSkill = JsonUtil::decode('{"level":1}');
-        $this->skills = $temp;
-        $this->subSkills = ObjectInit();
+            $temp = ObjectInit();
+            $temp->normalSkill = JsonUtil::decode('{"level":1}');
+            $temp->manuSkill1 = JsonUtil::decode('{"level":1}');
+            $temp->manuSkill2 = JsonUtil::decode('{"level":1}');
+            $temp->manuSkill3 = JsonUtil::decode('{"level":1}');
+            $temp->passiveSkill = JsonUtil::decode('{"level":1}');
+            $temp->captainSkill = JsonUtil::decode('{"level":1}');
+            $this->skills = $temp;
+            $this->subSkills = ObjectInit();
 
 //----初始化装备的默认数据
-        $this->equip = ObjectInit();
-        $tempEq = ObjectInit();
-        $tempEq->weapon = JsonUtil::decode('{"itemuid":0}');
-        $tempEq->armor = JsonUtil::decode('{"itemuid":0}');
-        $tempEq->ring = JsonUtil::decode('{"itemuid":0}');
+            $this->equip = ObjectInit();
+            $tempEq = ObjectInit();
+            $tempEq->weapon = JsonUtil::decode('{"itemuid":0}');
+            $tempEq->armor = JsonUtil::decode('{"itemuid":0}');
+            $tempEq->ring = JsonUtil::decode('{"itemuid":0}');
 
-        $this->equip = $tempEq;
+            $this->equip = $tempEq;
 // ------初始化言灵的默认数据
-        $this->yanling = JsonUtil::decode('{"1":{"itemuid":0},"2":{"itemuid":0},"3":{"itemuid":0}}');
+            $this->yanling = JsonUtil::decode('{"1":{"itemuid":0},"2":{"itemuid":0},"3":{"itemuid":0}}');
+        }
     }
 
     /**

+ 6 - 8
Gameserver/Amfphp/process/HeroProc.php

@@ -81,7 +81,7 @@ class HeroProc {
 #                                                                               # 2.判断英雄的该技能能否升级.... 
         $targetHero = new UserHeroModel($cHeros->$huid);                        # 直接类型识别
         $targteHeroSkills = $targetHero->subSkills;                             # 取出这个英雄的技能数据 
-        my_Assert(CommUtil::isPropertyExists($targteHeroSkills, $mainSkillId), "玩家数据存在问题");
+        my_default_Arr($targteHeroSkills->$mainSkillId);                        # 保护子技能数组数据结构
         my_Assert(!CommUtil::isInArray($targteHeroSkills->$mainSkillId, $subSkillId), "子技能已解锁"); # 子技能已经解锁
 //        if (!$targetHero->IsSkillUnlockAble($mainSkillId, $subSkillId)) {       # 3.判断技能是否处于待解锁状态
 //            return Resp::err(ErrCode::hero_upgradeSkill_maxLevel);
@@ -111,7 +111,7 @@ class HeroProc {
 #                                                                               # 2.判断英雄的该技能能否升级....
         $targetHero = new UserHeroModel($collectHeros->$huid);
         $targteHeroSkills = $targetHero->subSkills;                            # 取出这个英雄的技能数据 
-        my_Assert(CommUtil::isPropertyExists($targteHeroSkills, $mainSkillId), "玩家数据结构有问题.");     # 主技能Id.
+        my_default_Arr($targteHeroSkills->$mainSkillId);                       # 保护数据结构
         my_Assert(CommUtil::isInArray($targteHeroSkills->$mainSkillId, $subSkillId), "子技能id错误");     # 子技能id
 //        if (!$targetHero->IsSkillUpdateAble($mainSkillId, $subSkillId)) {       # 3.判断技能等级能否在继续升级了
 //            return Resp::err(ErrCode::hero_upgradeSkill_maxLevel);
@@ -168,9 +168,7 @@ class HeroProc {
         list($huid, $nextGrade) = $req->paras;                                  # 提取参数: 英雄的UID,下一阶
         $user = $req->userInfo->game;                                           # user引用
         $collectHeros = $user->heros->collectHeros;                             # 角色容器
-        if (!$collectHeros) {
-            $collectHeros = ObjectInit();
-        }
+        my_default_Obj($collectHeros);                                          # 保证不为null
         my_Assert(CommUtil::isPropertyExists($collectHeros, $huid), ErrCode::hero_no);  # 1.检查是否存在要升级的英雄
 //        isEditor() and $upHero = new UserHeroModel();
         $upHero = $collectHeros->$huid;
@@ -183,9 +181,9 @@ class HeroProc {
                 ErrCode::hero_segment_not_enough);                              # 碎片数量不足
         # 扣除碎片成功
         $upHero->grade = $nextGrade;                                            # 5.强化英雄进行成功升阶 
-        UserProc::updateUserInfo();                                         # 6.数据回存
+        UserProc::updateUserInfo();                                             # 6.数据回存
         $resp = Resp::ok($upHero);
-        SystemProc::insertHero_StageUp($req->zoneid, $req->uid, $user->name, #  插入系统广播
+        SystemProc::insertHero_StageUp($req->zoneid, $req->uid, $user->name, #  # 插入系统广播
                 GameConfig::hero_getItem($upHero->typeId)->name, $upHero->grade);
         return $resp;
     }
@@ -200,7 +198,7 @@ class HeroProc {
         $maxLevel = glc()->Hero_Upgrade_BasicMaxLevel;                          # 全局设置限制了当前英雄的最高等级
         $collectHeros = $user->heros->collectHeros;                             # 1. 检查是否存在要升级的英雄
         my_default_Obj($collectHeros);
-        my_Assert($costNumber >= 1, ErrCode::paras_err);                        # 参数合法性判断
+        my_Assert(is_int($costNumber) && $costNumber >= 1, ErrCode::paras_err); # 参数合法性判断
         my_Assert(CommUtil::isPropertyExists($collectHeros, $heroUID), ErrCode::hero_no); # 玩家拥有此英雄
 //        isEditor() and $targetHero = new UserHeroModel;                         # 智能感知辅助
         $targetHero = $collectHeros->$heroUID;

+ 5 - 8
Gameserver/Amfphp/process/PreProc.php

@@ -16,13 +16,9 @@ class PreProc {
      * @return int 返回操作结果,0:成功,其余为错误码
      */
     public static function tk($req) {
-        if (config::Inst()->isBaned($req->uid)) {                               # 检查封号
-            return ErrCode::err_server_updating;                                    # 针对这几个人封号
-        }
+        my_Assert(!config::Inst()->isBaned($req->uid), ErrCode::err_server_updating); # 检查封号
         $ret = self::checkVersion($req);                                        # 检查客户端版本
-        if ($ret != ErrCode::ok) {                                              # 客户端版本过低
-            return $ret;
-        }
+        my_Assert(ErrCode::ok == $ret, $ret);                                   # 客户端版本过低
         # 检查是否处于更新阶段,暂停对玩家请求的响应。
         if (GAME_ONLINE                                                         # 外网
                 && self::isUpdating()                                           # 更新
@@ -31,7 +27,8 @@ class PreProc {
         }
         $ssd = GameConfig::service_schedule_getItem(1);                         # 服务计划(固定只有1条)
         if (now() > $ssd->startts && now() < $ssd->endts) {                     # 在维护期间
-            $ret = ErrCode::err_server_maintaining;
+//            return ErrCode::err_server_maintaining;
+            Err(ErrCode::err_server_maintaining, $ssd->reason);
         }
 //        if (!GAME_ONLINE || config::Inst()->isTester($req->uid)) {                      # 内网不做token校验操作
         return ErrCode::ok;
@@ -89,7 +86,7 @@ class PreProc {
         }
 
         if ($ClientVerArr[0] == $ServerVerArr[0]                                # 主版本号相同
-                && $ClientVerArr[1] == $ServerVerArr[1]                         # 版本号相同
+                && $ClientVerArr[1] == $ServerVerArr[1]                         # 版本号相同
                 && $ClientVerArr[2] < $ServerVerArr[2] && #                     # 修订版本号不一致, 提示更新
                 ($req->cmd == CmdCode::cmd_user_getzonelist                     # 只在拉取分区列表的时候提示下得了.又不是强更
                 || $req->cmd == CmdCode::cmd_user_gameconstinfo)) {             # 或者是拉取常量信息也行

+ 1 - 1
Gameserver/Amfphp/process/UserProc.php

@@ -90,7 +90,7 @@ class UserProc {
                 $num = $arr[1];
                 StoreProc::PutOverlyingItemInStore($itemid, $num, $req);
             }
-            UserProc::updateUserInfo();                                     # 回存玩家数据
+            UserProc::updateUserInfo();                                         # 回存玩家数据
             return Resp::ok(array('store' => $req->userInfo->game->store));
         }
         return Resp::err(ErrCode::active_hasgetted);

+ 3 - 12
Gameserver/nbproject/private/private.xml

@@ -12,20 +12,11 @@
     </editor-bookmarks>
     <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
         <group>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/PayProc/MLogType.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/UserProc.php</file>
             <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/HeroProc.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/UserProc.php</file>
             <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/PreProc.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/config.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/PayProc/YuanBaoPayProc.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/util/CLog.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/configs/config_ios.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/service_call/cmemdata/kvflush.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/AutoLoad.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/util/DebugHelper.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/SystemProc.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/main.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/configs/config_and.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/configs/GameConfig.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/model/Const/globalsettings.php</file>
         </group>
     </open-files>
 </project-private>