瀏覽代碼

Merge branch 'dev' of http://ylsjtt.game7000.com:3000/YLSJ/jzhj2024server into dev

cyzhao 7 月之前
父節點
當前提交
7d568d8b40
共有 4 個文件被更改,包括 53 次插入27 次删除
  1. 13 10
      Gameserver/App/base/CmdCode.php
  2. 3 3
      Gameserver/App/base/Resp.php
  3. 35 12
      Gameserver/App/process/FightProc.php
  4. 2 2
      Gameserver/App/util/CRedisUtil.php

+ 13 - 10
Gameserver/App/base/CmdCode.php

@@ -15,9 +15,7 @@ class CmdCode {
      * 领取首付礼包
      */
     const cmd_pay_getfirstpaygift = 8802;
-    
     const cmd_pay_resetFirstRechargeUI_OpenTip = 8803;
-    
     const cmd_pay_accumulateRechargeRewardReceived = 8804;
 
 // <editor-fold defaultstate="collapsed" desc="移动支付">
@@ -68,7 +66,6 @@ class CmdCode {
      */
     const cmd_mpay_NewFirstRecharge = 8815;
 
-    
 //
 //
 // </editor-fold>
@@ -149,17 +146,17 @@ class CmdCode {
      * 元宝兑换抽奖券
      */
     const cmd_active_lottery_Tree_cashExchange = 6104;
-    
+
     /**
      * 抽奖宝箱奖励领取
      */
     const cmd_active_lotteryNumBox_RewardReceived = 6105;
-    
+
     /**
      * 兑换
      */
     const cmd_active_LotteryExchangeItem = 6106;
-    
+
     /**
      * 7日签到 累计天数宝箱奖励领取
      */
@@ -169,7 +166,7 @@ class CmdCode {
      * 限时贩售
      */
     const cmd_active_limitTsBuy = 6108;
-    
+
     /**
      * 6109 战令奖励领取
      */
@@ -273,16 +270,17 @@ class CmdCode {
      * 洗练
      */
     const store_gemXiLian = 6413;
-    
+
     /**
      * 安装装备
      */
     const store_equiped = 6414;
+
     /**
      * 卸下装备
      */
     const store_remove_equip = 6415;
-    
+
     /**
      * 购买装备的宝石槽
      */
@@ -299,7 +297,7 @@ class CmdCode {
      * 购买体力
      */
     const cmd_shop_BuyTili = 6502;
-    
+
     /**
      * 章节礼包 选中记录
      */
@@ -485,6 +483,11 @@ class CmdCode {
      * 排行榜一键升级
      */
     const fight_rank_ReceiveRankReward = 6824;
+
+    /**
+     * pvp-匹配一个对手数据
+     */
+    const fight_PVP_match = 6825;
 // </editor-fold>
 // <editor-fold defaultstate="collapsed" desc="系统操作码 - 69xx">
 

+ 3 - 3
Gameserver/App/base/Resp.php

@@ -3,7 +3,7 @@
 namespace loyalsoft;
 
 /**
- * Description of ResponseVo
+ * Description of Resp
  * 服务端消息应答实体
  * @author gwang
  */
@@ -60,7 +60,7 @@ class Resp extends Object_ext {
      * 产生服务端成功应答数据
      * @param Req $req
      * @param assoc Array $ret
-     * @return \ResponseVo
+     * @return \Resp
      */
     public static function ok($ret = null) {
         $resp = new Resp();
@@ -78,7 +78,7 @@ class Resp extends Object_ext {
      * @param Req $req
      * @param int $err
      * @param string $msg 【可选】附加信息
-     * @return \ResponseVo
+     * @return \Resp
      */
     public static function err($err, $msg = "") {
         $resp = new Resp();

+ 35 - 12
Gameserver/App/process/FightProc.php

@@ -63,11 +63,35 @@ class FightProc {
                 return self::BuySkillLockCount();
             case CmdCode::fight_rank_ReceiveRankReward:                         # 6824 排行奖励一键领取
                 return self::ReceiveRankReward();
+            case CmdCode::fight_PVP_match:                                      # 6825 PVP 匹配一个对手
+                return self::PvpMatchPlayer();
             default:
                 Err(ErrCode::cmd_err);
         }
     }
 
+    /**
+     * 6825 pvp 匹配一个对手
+     * @return Resp
+     */
+    static function PvpMatchPlayer() {
+        // 先从排行榜上随机取一个玩家的数据返回 -gwang 2024.10.30
+//        $uid = req()->uid;
+        $memKey = MemKey_GameRun::Rank_FightPower_Zone_zset(req()->zoneid);
+        $mem = gMem();
+        $length = $mem->zlen($memKey);
+        if ($length > glc()->Rank_FightPower_OnListRank) {
+            $length = glc()->Rank_FightPower_OnListRank;
+        }
+        $arr = $mem->zrange($memKey, 0, $length - 1);
+
+        $uid = $arr[array_rand($arr)];                                          # 这里是否应该去掉自己呢? 算了不用,自己打自己也是一种挑战
+
+        $pvpPlayer = UserProc::getUserGame(req()->zoneid, $uid);
+
+        return Resp::ok($pvpPlayer);
+    }
+
     /**
      * 6823 购买更多技能封印数量
      */
@@ -999,7 +1023,6 @@ class FightProc {
             if ($mo->funTypeId == 5 && $mo->id == Enum_SubFunType::Day7_Sign) {
                 ActiveProc::DailyResetDay7Task(true);
             }
-            
         }
     }
 
@@ -1012,15 +1035,15 @@ class FightProc {
             if ($mo->type == 3 && $mo->id == Enum_SubFunType::LimitTsSale && ctx()->privateState->nextDayLogin == 0 && now() >= $mo->startTs) {
                 ActiveProc::ResetLimitTsBuy();
             }
-            
-            if($mo->type == 3 && $mo->id == Enum_SubFunType::ActivePoint_BattlePass && ctx()->privateState->battlePass_activePoint_refersh_ts == 0 && now() >= $mo->startTs){
+
+            if ($mo->type == 3 && $mo->id == Enum_SubFunType::ActivePoint_BattlePass && ctx()->privateState->battlePass_activePoint_refersh_ts == 0 && now() >= $mo->startTs) {
                 ctx()->privateState->battlePass_activePoint_refersh_ts = TimeUtil::getNextDayTs($mo->startTs, $mo->ts);
                 ctx()->privateData(true)->battlePass_activePoint_cost_ts = 0;
                 ctx()->privateData(true)->battlePass_taskPoint = 0;
                 ActiveProc::ResetBattlePassReward(Enum_SubFunType::ActivePoint_BattlePass);
             }
-            if($mo->type == 3 && $mo->id == Enum_SubFunType::Tili_BattleBass && ctx()->privateState->battlePass_tili_refersh_ts == 0 && now() >= $mo->startTs){
-                ctx()->privateState->battlePass_tili_refersh_ts = TimeUtil::getNextDayTs($mo->startTs, $mo->ts);                              
+            if ($mo->type == 3 && $mo->id == Enum_SubFunType::Tili_BattleBass && ctx()->privateState->battlePass_tili_refersh_ts == 0 && now() >= $mo->startTs) {
+                ctx()->privateState->battlePass_tili_refersh_ts = TimeUtil::getNextDayTs($mo->startTs, $mo->ts);
                 ctx()->privateData(true)->battlePass_tili_cost_ts = 0;
                 ctx()->privateData(true)->battlePass_tili = 0;
                 ActiveProc::ResetBattlePassReward(Enum_SubFunType::Tili_BattleBass);
@@ -1668,20 +1691,20 @@ class FightProc {
 
         $heroBashAttack = $mo->attack;
         $heroBashHp = $mo->hp;
-        
+
         $attck = 0;
         $hp = 0;
         $equipDic = ctx()->store->equipLocation;
         foreach ($equipDic as $index => $ins_equip) {
             $ins_Equip = new Ins_Equip($ins_equip);
-            if($ins_Equip->mo()->position % 2 == 1){
-                $attck += GameConfig::equip_levelupgrade_getItem($ins_Equip->mo()->rarity,$ins_Equip->mo()->qual.$ins_Equip->mo()->position,$ins_Equip->level)->attckNum;
+            if ($ins_Equip->mo()->position % 2 == 1) {
+                $attck += GameConfig::equip_levelupgrade_getItem($ins_Equip->mo()->rarity, $ins_Equip->mo()->qual . $ins_Equip->mo()->position, $ins_Equip->level)->attckNum;
             } elseif ($ins_Equip->mo()->position % 2 == 0) {
-                $hp += GameConfig::equip_levelupgrade_getItem($ins_Equip->mo()->rarity,$ins_Equip->mo()->qual.$ins_Equip->mo()->position,$ins_Equip->level)->hpNum;
-            }            
+                $hp += GameConfig::equip_levelupgrade_getItem($ins_Equip->mo()->rarity, $ins_Equip->mo()->qual . $ins_Equip->mo()->position, $ins_Equip->level)->hpNum;
+            }
         }
-        
-        
+
+
 //        $equipDic = ctx()->store->equipPosition;
 //        $attck = 0;
 //        $hp = 0;

+ 2 - 2
Gameserver/App/util/CRedisUtil.php

@@ -717,8 +717,8 @@ Lua;
         try {
             $castoken = "stVer";
             $casVer = $dic->stVer;
-            CLog::err($dic->toString());
-            var_dump($dic->toString());
+//            CLog::err($dic->toString());
+//            var_dump($dic->toString());
             $ret = $this->redis->eval($script, 2, $key, $castoken, $casVer, $dic->toString());  # redis 执行lua脚本
 //            CLog::err($dic->toString());
             if (0 == $ret) {