This commit is contained in:
hujiabin 2024-04-30 11:04:04 +08:00
parent 71bd866466
commit 38bd4ee265

View File

@ -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'],