Quellcode durchsuchen

抽宝箱10连抽改为花费10个钥匙

cyzhao vor 10 Monaten
Ursprung
Commit
75ecee4085

+ 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-19 14:23:51
+ // 日期: 2024-07-19 15:03:23
 ////////////////////
 
 /**

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-07-17 17:28:14
+ // 日期: 2024-07-19 14:35:47
 ////////////////////
 
 

+ 5 - 0
Gameserver/App/model/Const/sm_shop_box.php

@@ -58,6 +58,11 @@ class sm_shop_box
     */
     public $cost_one_yaoshi;
 
+    /**
+    * @var String 买10次花费的钥匙数量  
+    */
+    public $cost_ten_yaoshi;
+
     /**
     * @var String X次必出某品阶宝石 例子:次数,必出的宝石品阶  
     */

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-07-17 18:36:04
+ // 日期: 2024-07-19 14:37:48
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-07-17 18:36:04
+ // 日期: 2024-07-19 14:37:48
 ////////////////////
 
 

+ 13 - 6
Gameserver/App/process/ShopProc.php

@@ -169,19 +169,26 @@ class ShopProc {
                 my_Assert($mo != null, ErrCode::err_const_no);
                 
                 if ($buyNum == 1) {
-                    $cost = $mo->cost_one;
+                   
                     $yaoshiArr = explode(',', $mo->cost_one_yaoshi);
                     $itemId = $yaoshiArr[0];
-                    if (StlUtil::dictHasProperty(ctx()->store->items, $itemId) && ctx()->store->items[$itemId] >= $yaoshiArr[1]) {
+                    if (StlUtil::dictHasProperty(ctx()->store->items, $itemId) && ctx()->store->items->$itemId >= $yaoshiArr[1]) {
                         ctx()->store->removeItem($itemId, $yaoshiArr[1]);
                     } else {
+                        $cost = $mo->cost_one;
                         my_Assert($user->baseInfo->cash >= $cost, ErrCode::notenough_cash_msg);
                         $user->baseInfo->Consume_Cash($cost);
                     }
-                } elseif ($buyNum == 10) {
-                    $cost = $mo->cost_ten;
-                    my_Assert($user->baseInfo->cash >= $cost, ErrCode::notenough_cash_msg);
-                    $user->baseInfo->Consume_Cash($cost);
+                } elseif ($buyNum == 10) {                                      
+                    $yaoshiArr = explode(',', $mo->cost_ten_yaoshi);
+                    $itemId = $yaoshiArr[0];
+                    if (StlUtil::dictHasProperty(ctx()->store->items, $itemId) && ctx()->store->items->$itemId >= $yaoshiArr[1]) {
+                        ctx()->store->removeItem($itemId, $yaoshiArr[1]);
+                    } else {
+                        $cost = $mo->cost_ten;
+                        my_Assert($user->baseInfo->cash >= $cost, ErrCode::notenough_cash_msg);
+                        $user->baseInfo->Consume_Cash($cost);
+                    }                  
                 }
                 
                 if ($mo->type == 1) {