浏览代码

合并开始挑战接口

王刚 1 年之前
父节点
当前提交
3202a6ae11
共有 3 个文件被更改,包括 23 次插入4 次删除
  1. 1 1
      Gameserver/App/model/User/Ins_GateInfo.php
  2. 17 3
      Gameserver/App/process/FightProc.php
  3. 5 0
      Gameserver/App/test.php

+ 1 - 1
Gameserver/App/model/User/Ins_GateInfo.php

@@ -57,7 +57,7 @@ class Ins_GateInfo {
     /**
      * 从gateId中提取关卡类型
      * @param type $gateId
-     * @return int 1 主线剧情, 2 主线挑战
+     * @return int 1 主线剧情, 2 主线挑战, 9 爬塔挑战
      */
     public static function GateTypeFromId($gateId) {
         return Ints::Slice($gateId, 0, 1);

+ 17 - 3
Gameserver/App/process/FightProc.php

@@ -128,14 +128,27 @@ class FightProc {
     }
 
     /**
-     * 6808 主线关卡: 开始挑战 (扣除体力)
+     * 6808 开始挑战 (主线关卡:扣除体力, 挑战关卡: 增加次数)
      */
     private static function StartFight() {
         list($gateId) = req()->paras;
         my_Assert($gateId > 0, ErrCode::paras_err);
         $mo = GameConfig::gate_getItem($gateId);
         my_Assert(null != $mo, ErrCode::err_const_no);
-        my_Assert(ctx()->base()->Consume_tili($mo->cost_tili), ErrCode::notenough_tili);
+
+        if (Ints::Slice($gateId, 0, 1) == 9) {                                  # 爬塔模式
+            list($layerNum) = req()->paras;
+            if ($layerNum != ctx()->gates()->TowerGateInfo()->CurLayer) {       # 起始层数校验
+                Err(ErrCode::tower_layerNum);
+            }
+            if (ctx()->gates()->TowerGateInfo()->TodayChanNum > glc()->tower_daily_chanceNum) { # 剩余次数校验
+                Err(ErrCode::tower_timeNo);
+            }
+            ctx()->gates()->TowerGateInfo()->TodayChanNum++;                        # 增加次数
+        } else {                                                                # 主线剧情
+            my_Assert(ctx()->base()->Consume_tili($mo->cost_tili), ErrCode::notenough_tili);
+        }
+        UserProc::updateUserInfo();
         return Resp::ok(array("tili" => ctx()->baseInfo->tili, "tili_ts" => ctx()->baseInfo->tili_ts));
     }
 
@@ -365,8 +378,9 @@ class FightProc {
     }
 
     /**
-     * 6805 挑战关卡: 开始挑战(扣除次数)
+     * 6805
      * @return type
+     * @deprecated since version 2024年5月17日
      */
     public static function ChallengeGateStartFight() {
         list($layerNum) = req()->paras;

+ 5 - 0
Gameserver/App/test.php

@@ -28,3 +28,8 @@ use \loyalsoft\pay\OrderNotice;
 $item = GameConfig::shop_cash_getItem(1);
 var_dump($item);
 var_dump(Ints::Slice(123456789, 5, 2));
+$arr = [1, 2, 3, 4, 5, 6];
+
+for ($i = 0; $i < 30; $i++) {
+    var_dump(json_encode(json_decode(json_encode($arr))));
+}