소스 검색

1. 补: 领取通关记录突破奖励的接口.

gwang 5 년 전
부모
커밋
e0154d9e09

+ 2 - 2
Gameserver/Amfphp/base/CmdCode.php

@@ -561,9 +561,9 @@ class CmdCode {
     const rank_passgate_getrank = 6605;
 
     /**
-     * 排行榜 - 查询玩家通关榜排名
+     * 排行榜 - 领取通关榜突破奖励
      */
-    const rank_passgate_userRanking = 6606;
+    const rank_passgate_drawReward = 6606;
     // 
     // </editor-fold>
     //

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

@@ -939,6 +939,10 @@ class ErrCode {
      */
     const rank_reward_hasgetted = 4102;
 
+    /**
+     * 排行榜 - 通关帮奖励解锁条件尚未达成
+     */
+    const rank_passsgate_unlocked = 4103;
 // </editor-fold>
 // 
 // ------------神兽碎片融合模块错误码---------

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

@@ -6,7 +6,7 @@ namespace loyalsoft;
 // 由CodeGenerator创建。
 // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
 // author: gwang 
-// 日期: 2020-04-07 09:34:16
+// 日期: 2020-04-15 16:47:51
 ////////////////////
 
 /**
@@ -1207,6 +1207,38 @@ class GameConfig {
         return self::get_hash_item('rankreward_fpower', $itemid);
     }
 
+    /**
+     * 合体技能
+     * @return \skill_cross
+     */
+    public static function skill_cross() {
+        static $a = null;
+        return self::initValue($a, 'skill_cross');
+    }
+
+    /**
+     * @return \sm_skill_cross skill_cross item数据 
+     */
+    public static function skill_cross_getItem($itemid) {
+        return self::get_hash_item('skill_cross', $itemid);
+    }
+
+    /**
+     * 通关榜突破奖励
+     * @return \rankreward_passgate
+     */
+    public static function rankreward_passgate() {
+        static $a = null;
+        return self::initValue($a, 'rankreward_passgate');
+    }
+
+    /**
+     * @return \sm_rankreward_passgate rankreward_passgate item数据 
+     */
+    public static function rankreward_passgate_getItem($itemid) {
+        return self::get_hash_item('rankreward_passgate', $itemid);
+    }
+
     /**
      * 当前版本(时间戳)
      * @return \ver

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

@@ -172,6 +172,12 @@ class PrivateStateModel extends Object_ext {
      */
     public $RankFpowerRewardRec = array();
 
+    /**
+     * 排行榜, 通关记录突破奖励领取记录
+     * @var type 
+     */
+    public $RankPassGateRewardRec = array();
+
 // <editor-fold defaultstate="collapsed" desc="    初始化    ">
 
     /**

+ 41 - 5
Gameserver/Amfphp/process/RankProc.php

@@ -24,18 +24,22 @@ class RankProc {
                 return self::DrawFpowerBreakThrougReward($req);
             case CmdCode::rank_fpower_getRanking:                               # 6603 查询玩家战斗力排名
                 return self::GetRankingOfUserFightPower($req);
+
             case CmdCode::rank_getTop1:                                         # 6604 查询top1信息
                 return self::RankGetAllTop1($req);
+
             case CmdCode::rank_passgate_getrank:                                # 6605 查询通关榜榜单信息
                 return self::GetPassgateRank($req);
+            case CmdCode::rank_passgate_drawReward:                             # 6606 领取通关榜突破奖励
+                return self::DrawPassgateReward($req);
 
             default:
                 return Resp::err(ErrCode::cmd_err);
         }
     }
 
-//
-// <editor-fold defaultstate="collapsed" desc="  战斗力榜  ">
+    //
+    //   <editor-fold defaultstate="collapsed" desc="  战斗力榜  ">
 
     /**
      * [6601]拉取战斗力榜单数据
@@ -71,8 +75,6 @@ class RankProc {
                     'ranking' => my_null_default($user_ranking, 100) + 1, #     # 修正下排名(zset中是从零开始的)
                     'score' => my_null_default($user_score, 0)
         ));
-//
-//        return Resp::ok(array('rankInfo' => $userInfos));                       # 返回值
     }
 
     /**
@@ -95,9 +97,11 @@ class RankProc {
         if (in_array($rewardCondition, $req->userInfo->game->privateState->RankFpowerRewardRec)) { # 检查是否已经领取过了
             return Resp::err(ErrCode::rank_reward_hasgetted);
         }
+        $req->userInfo->game->privateState->RankFpowerRewardRec[] = $rewardCondition; # 添加领取记录
 
         $rewardMo = GameConfig::rankreward_fpower_getItem($rewardCondition);    # 奖励mo
         StoreProc::AddMultiItemInStore($req, $rewardMo->reward, $req->userInfo->game); # 发放奖励字符串.
+        UserProc::updateUserInfo();                                             # 流程结束,回写玩家数据
         return Resp::ok(true);
     }
 
@@ -148,7 +152,37 @@ class RankProc {
     }
 
 // </editor-fold>
-//
+    //
+    // <editor-fold defaultstate="collapsed" desc="  通关帮  ">
+
+    /**
+     * [6606] 领取通关榜突破奖励
+     * @param req $req
+     */
+    static function DrawPassgateReward($req) {
+        $rewardCondition = $req->paras[0];                                      # 领取奖励的档次条件(战斗力数值)
+
+        $privateState = $req->userInfo->game->privateState;
+        $key = MemKey_GameRun::Game_Rank_passgate_zset($req->zoneid);           # redis key
+        $no1 = $req->mem->zrevrange($key, 0, 0, true);                          # 取第一名信息
+        $score = 0;
+        foreach ($no1 as $uid => $_score) {                                     # 
+            $score = $_score;                                                   # 状元的通关记录
+            break;
+        }
+        if ($score < $rewardCondition) {                                        # 不满足领取条件
+            return Resp::err(ErrCode::rank_passsgate_unlocked);
+        }
+        if (in_array($rewardCondition, $privateState->RankPassGateRewardRec)) { # 检查是否已经领取过了
+            return Resp::err(ErrCode::rank_reward_hasgetted);
+        }
+        $privateState->RankPassGateRewardRec[] = $rewardCondition;              # 添加领取记录
+
+        $rewardMo = GameConfig::rankreward_fpower_getItem($rewardCondition);    # 奖励mo
+        StoreProc::AddMultiItemInStore($req, $rewardMo->reward, $req->userInfo->game); # 发放奖励字符串.
+        UserProc::updateUserInfo();                                             # 流程结束,回写玩家数据
+        return Resp::ok(true);
+    }
 
     /**
      * [6605] 查询通关榜榜单信息
@@ -203,6 +237,8 @@ class RankProc {
         return Resp::ok($ret);                                                  # 返回  
     }
 
+    // </editor-fold>
+    // 
     // <editor-fold defaultstate="collapsed" desc="  辅助方法  ">
 
     /**

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

@@ -13,6 +13,12 @@
     <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
         <group>
             <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/RankProc.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/PreProc.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/ActiveProc.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/HeroProc.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/base/CmdCode.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/base/ErrCode.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/FightProc/PVPProc.php</file>
         </group>
     </open-files>
 </project-private>