This commit is contained in:
aozhiwei 2021-04-07 20:04:10 +08:00
parent 7557bebd68
commit 8af871ed18

View File

@ -687,20 +687,49 @@ void Player::LootInteraction(Loot* entity)
add_num = std::min(entity->count, add_num); add_num = std::min(entity->count, add_num);
AddInventory(item_meta->i->_inventory_slot(), add_num); AddInventory(item_meta->i->_inventory_slot(), add_num);
if (item_meta->i->_inventory_slot() == 5 || switch (item_meta->i->_inventory_slot()) {
item_meta->i->_inventory_slot() == 6) { case IS_FRAG:
Weapon* weapon = &weapons[3 + (item_meta->i->_inventory_slot() - 5)]; case IS_SMOKE:
weapon->weapon_id = entity->item_id; {
weapon->weapon_lv = 1; Weapon* weapon = &weapons[3 + (item_meta->i->_inventory_slot() - IS_FRAG)];
weapon->ammo += entity->count; weapon->weapon_id = entity->item_id;
weapon->meta = item_meta; weapon->weapon_lv = 1;
weapon->Recalc(); weapon->ammo += entity->count;
DecInventory(item_meta->i->_inventory_slot(), add_num); weapon->meta = item_meta;
} weapon->Recalc();
if (item_meta->i->_inventory_slot() > 12) { DecInventory(item_meta->i->_inventory_slot(), add_num);
if (item_meta->i->_inventory_slot() - 12 > curr_scope_idx) {
curr_scope_idx = item_meta->i->_inventory_slot() - 12;
} }
break;
case IS_1XSCOPE:
case IS_2XSCOPE:
case IS_4XSCOPE:
case IS_8XSCOPE:
case IS_15XSCOPE:
{
if (item_meta->i->_inventory_slot() - IS_1XSCOPE > curr_scope_idx) {
curr_scope_idx = item_meta->i->_inventory_slot() - IS_1XSCOPE;
}
}
break;
case IS_POSION_GAS_BOMB:
case IS_MOLOTOR_COCKTAIL:
case IS_TRAP:
case IS_MINE:
{
Weapon* weapon = &weapons[5 + (item_meta->i->_inventory_slot() - IS_POSION_GAS_BOMB)];
weapon->weapon_id = entity->item_id;
weapon->weapon_lv = 1;
weapon->ammo += entity->count;
weapon->meta = item_meta;
weapon->Recalc();
DecInventory(item_meta->i->_inventory_slot(), add_num);
}
break;
default:
{
abort();
}
break;
} }
if (add_num < entity->count) { if (add_num < entity->count) {
//刷新数量 //刷新数量