From 38bd4ee26506ba97055f5420483666c7e8bd258d Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Tue, 30 Apr 2024 11:04:04 +0800 Subject: [PATCH] 1 --- webapp/controller/BagController.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/webapp/controller/BagController.class.php b/webapp/controller/BagController.class.php index db7ac210..eb66c160 100644 --- a/webapp/controller/BagController.class.php +++ b/webapp/controller/BagController.class.php @@ -376,6 +376,15 @@ class BagController extends BaseAuthedController { } private function openBattleBox($itemDb,$itemMeta,$itemNum){ + $costItems = mt\Item::getUseCostItems($itemMeta); + if (count($costItems) > 0){ + $lackItem = null; + if (!$this->_hasEnoughItems($costItems, $lackItem)) { + $this->_rspErr(3, $this->_getLackItemErrMsg($lackItem)); + return; + } + } + $lootMeta = mt\LootConfig::find($itemMeta['loot']); if ($lootMeta['isAffected']){ // $lucky = Hero::getAccountLucky(myself()->_getAddress()); @@ -393,6 +402,9 @@ class BagController extends BaseAuthedController { }else{ $items = \services\LootService::dropOutItem($itemMeta['loot']); } + if (count($costItems) > 0){ + $this->_decItems($costItems); + } $this->_decItems(array( array( 'item_id' => $itemMeta['id'],