浏览代码

fix: 字符串分隔api

王刚 1 年之前
父节点
当前提交
0a4073afb6
共有 2 个文件被更改,包括 17 次插入18 次删除
  1. 4 4
      Gameserver/App/model/User/Info_Gates.php
  2. 13 14
      Gameserver/App/process/FightProc.php

+ 4 - 4
Gameserver/App/model/User/Info_Gates.php

@@ -162,7 +162,7 @@ class Info_Gates extends Object_ext {
             }
         }
         if (!StlUtil::dictHasProperty($this->GateList, $nextId)) {
-            $this->CurrentGateId = $nextId;
+//            $this->CurrentGateId = $nextId;                                   # 不再自动推到下一关, -2024.5.31
             $this->UnlockedGatesMaxId = $nextId;
             $gate = new Ins_GateInfo();
             $gate->GateId = $nextId;
@@ -191,15 +191,15 @@ class Info_Gates extends Object_ext {
             }
         }
     }
-    
+
     /**
-     * 最大通关id 
+     * 最大通关id
      */
     public function maxPassGateId($gateId) {
         $maxIndex = 0;
         $maxGateId = 0;
         foreach ($this->GateList as $gateId => $Ins_GateInfo) {
-            if($Ins_GateInfo->pass > 0 && $Ins_GateInfo->GateMapTypeFromId($gateId) > $maxIndex){
+            if ($Ins_GateInfo->pass > 0 && $Ins_GateInfo->GateMapTypeFromId($gateId) > $maxIndex) {
                 $maxIndex = $Ins_GateInfo->GateMapTypeFromId($gateId);
                 $maxGateId = $gateId;
             }

+ 13 - 14
Gameserver/App/process/FightProc.php

@@ -544,11 +544,10 @@ class FightProc {
             if (ctx()->gates->GateList->$gateId->pass == 0) {
                 ctx()->gates->GateList->$gateId->pass = 1;
                 TaskProc::Day7TaskReset($gateId);                               # 刷新七日任务
-                $maxGateId= ctx()->gates->maxPassGateId();
-                if($maxGateId > 0){
+                $maxGateId = ctx()->gates->maxPassGateId();
+                if ($maxGateId > 0) {
                     self::Ranking_MainGateIndex($maxGateId);
                 }
-                
             }
             TaskProc::OnPassGate_X($gateId);                                    # 刷新任务进度: 通关第X关
 
@@ -572,7 +571,7 @@ class FightProc {
         ctx()->base()->Add_Gold($waveMo->rewardGold);                           # 金币奖励
         # 图纸奖励: 数量min-max, 部位随机
         if (strlen($waveMo->rewardTuZhi) > 0 && str_contains($waveMo->rewardTuZhi, '-')) {
-            list($tz_min, $tz_max) = str_split($waveMo->rewardTuZhi);           # 图纸数量
+            list($tz_min, $tz_max) = explode($waveMo->rewardTuZhi, '-');        # 图纸数量
             $tz_n = rand($tz_min, $tz_max);
             # 图纸部位数据源 1001, 1002, 1003, 1004, 1005, 1006
             for ($i = 0; $i < $tz_n; $i++) {
@@ -583,14 +582,14 @@ class FightProc {
         }
         # 宝石奖励: 数量min-max;品质:权重,品质:权重...
         if (strlen($waveMo->rewardGem) > 0) {
-            list($gs_num, $gs_props) = str_split($waveMo->rewardGem, ';');
-            list($gem_min, $gem_max) = str_split($gs_num);                      # 宝石数量
+            list($gs_num, $gs_props) = explode($waveMo->rewardGem, ';');
+            list($gem_min, $gem_max) = explode($gs_num, '-');                   # 宝石数量
             $gem_n = rand($gem_min, $gem_max);
-            $arr = str_split($gs_props, ",");
+            $arr = explode($gs_props, ",");
             $pool = array();
             $n = 0;
             foreach ($arr as $str) {
-                list($qual, $props) = str_split($str, ':');
+                list($qual, $props) = explode($str, ':');
                 $pool[] = array('q' => $qual, 'p' => $props);
                 $n += $props;
             }
@@ -703,10 +702,10 @@ class FightProc {
      */
     public static function Ranking_MainGateIndex($maxGateIndex) {
         $memKey = MemKey_GameRun::Rank_MainGateIndex_Zone_zset(req()->zoneid);
-        $mem = gMem();    
-        
-        $uid = req()->uid;      
-        $arr = array();                   
+        $mem = gMem();
+
+        $uid = req()->uid;
+        $arr = array();
         $arr["$uid"] = $maxGateIndex;
         $mem->zadd($memKey, $arr);
 
@@ -851,13 +850,13 @@ class FightProc {
 
         $memKey = MemKey_GameRun::RankReward_FightPower_Zone_hash(req()->zoneid);
         foreach ($rewards as $fightPower => $mo) {
-            if ($power >= $fightPower && !gMem()->hexists($memKey, $fightPower)) {               
+            if ($power >= $fightPower && !gMem()->hexists($memKey, $fightPower)) {
                 $ins_rank = new Ins_rank();
                 $ins_rank->uid = req()->uid;
                 $ins_rank->name = ctx()->baseInfo->name;
                 $ins_rank->headImg = ctx()->baseInfo->headImg;
                 $ins_rank->score = $fightPower;
-                gMem()->hset($memKey, $fightPower,$ins_rank);
+                gMem()->hset($memKey, $fightPower, $ins_rank);
             }
         }
     }