Przeglądaj źródła

启灵解锁顺序加校验

cyzhao 10 miesięcy temu
rodzic
commit
847f71af18

+ 1 - 1
Gameserver/App/model/Const/GameConfig.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-07-18 10:22:25
+ // 日期: 2024-07-19 14:23:51
 ////////////////////
 
 /**

+ 1 - 1
Gameserver/App/model/Const/sm_gate.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-07-01 10:12:42
+ // 日期: 2024-07-19 11:05:47
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_gate_unlock.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-07-01 10:12:42
+ // 日期: 2024-07-19 11:05:47
 ////////////////////
 
 

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

@@ -63,19 +63,26 @@ class FightProc {
      * @return type
      */
     public static function EvolveUnlock() {
-        list($type, $id) = req()->paras;
+        list($type, $id) = req()->paras;//$id废弃 因为玩家可能不安顺序点
 
         if ($type == 1) {
-            $mo = GameConfig::evolve_getItem($id);
-            my_Assert($mo != null, ErrCode::err_const_no);
+            $nextId = ctx()->gates->evolveMaxId_left+1;                      
+            my_Assert($id == $nextId, ErrCode::err_const_no);
+            
+            $mo = GameConfig::evolve_getItem($nextId);                     
+            my_Assert($mo != null, ErrCode::err_const_no);           
             my_Assert(ctx()->baseInfo->level >= $mo->level, ErrCode::evolve_canotUnlock_levelLimit);
             my_Assert(ctx()->baseInfo->gold >= $mo->needGold_unlock, ErrCode::notenough_gold_msg);
+            
             ctx()->baseInfo->Consume_Gold($mo->needGold_unlock);
-            ctx()->gates->evolveMaxId_left = $id;
+            ctx()->gates->evolveMaxId_left = $nextId;
         } else {
+            $nextId = ctx()->gates->evolveMaxId_right + 1;
+            my_Assert($id == $nextId, ErrCode::err_const_no);
+            
             $dic = GameConfig::evolve();
             foreach ($dic as $key => $value) {
-                if ($value->specificEvolveId == $id) {
+                if ($value->specificEvolveId == $nextId) {
                     $mo = $value;
                 }
             }

+ 16 - 0
Gameserver/App/process/StoreProc.php

@@ -682,9 +682,20 @@ class StoreProc {
         $up_Gold = 0;
         $up_needItem = 0;
         $up_lv = 0;
+        
+        $noUp_gold = false;
+        $noUp_item = false;
         for ($i = $lv; $i <= $maxLv; $i++) {
             $up_Gold += GameConfig::equip_levelupgrade_getItem($i)->needGold;
             $up_needItem += GameConfig::equip_levelupgrade_getItem($i)->needItemNum;
+                        
+            if ($user->baseInfo->gold >= $up_Gold) {             
+                $noUp_gold = true;
+            }
+            if ($itemNum_store >= $up_needItem) {                          
+                $noUp_item = true;      
+            }
+                              
             if ($user->baseInfo->gold >= $up_Gold && $itemNum_store >= $up_needItem) {
                 $need_gold = $up_Gold;
                 $need_item = $up_needItem;
@@ -695,6 +706,11 @@ class StoreProc {
             break;
         }
 
+        if($up_lv == 0){
+            my_Assert($noUp_gold, ErrCode::notenough_cash_msg);
+            my_Assert($noUp_item, ErrCode::notenough_item);           
+        }
+            
         $user->baseInfo->gold -= $need_gold;
         $user->store->removeItem($tuzhiId, $need_item);
         if($up_lv >0){