if (player == null) return;
L2PcInstance target = L2PcInstance.load(_objectID);
PcFreight freight = target.getFreight();
getClient().getActiveChar().setActiveWarehouse(freight);
target.deleteMe();
ItemContainer warehouse = player.getActiveWarehouse();
if (warehouse == null) return;
L2FolkInstance manager = player.getLastFolkNPC();
if ((manager == null || !player.isInsideRadius(manager, L2NpcInstance.INTERACTION_DISTANCE, false, false)) && !player.isGM()) return;
if (warehouse instanceof PcFreight && Config.GM_DISABLE_TRANSACTION && player.getAccessLevel() >= Config.GM_TRANSACTION_MIN && player.getAccessLevel() <= Config.GM_TRANSACTION_MAX)
{
player.sendMessage("Transactions are disable for your Access Level");
return;
}
// Alt game - Karma punishment
if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE && player.getKarma() > 0) return;
// Freight price from config or normal price per item slot (30)
int fee = _count * Config.ALT_GAME_FREIGHT_PRICE;
int currentAdena = player.getAdena();
int slots = 0;
for (Item i : _items)
{
int objectId = i.id;
int count = i.count;
// Check validity of requested item
L2ItemInstance item = player.checkItemManipulation(objectId, count, "deposit");
if (item == null)
{
_log.warning("Error depositing a warehouse object for char "+player.getName()+" (validity check)");
i.id = 0;
i.count = 0;
continue;
}
if (!item.isTradeable() || item.getItemType() == L2EtcItemType.QUEST) return;
// Calculate needed adena and slots
if (item.getItemId() == 57) currentAdena -= count;
if (!item.isStackable()) slots += count;
else if (warehouse.getItemByItemId(item.getItemId()) == null) slots++;
}
// Item Max Limit Check
if (!warehouse.validateCapacity(slots))
{
sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED));
return;
}