Probable fix. Replace both drop methods at PlayerInstance.
/**
* Drop item from inventory and send a Server->Client InventoryUpdate packet to the PlayerInstance.
* @param process : String Identifier of process triggering this action
* @param item : ItemInstance to be dropped
* @param reference : WorldObject Object referencing current action like NPC selling item or previous item in transformation
* @param sendMessage : boolean Specifies whether to send message to Client about this action
* @param protectItem the protect item
*/
public void dropItem(String process, ItemInstance item, WorldObject reference, boolean sendMessage, boolean protectItem)
{
if (_freight.getItemByObjectId(item.getObjectId()) != null)
{
// Send a Server->Client ActionFailed to the PlayerInstance in order to avoid that the client wait another packet
sendPacket(ActionFailed.STATIC_PACKET);
Util.handleIllegalPlayerAction(this, "Warning!! Character " + getName() + " of account " + getAccountName() + " tried to drop Freight Items", IllegalPlayerAction.PUNISH_KICK);
return;
}
final ItemInstance droppedItem = _inventory.dropItem(process, item, this, reference);
if (droppedItem == null)
{
if (sendMessage)
{
sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT_2);
}
return;
}
droppedItem.dropMe(this, (getX() + Rnd.get(50)) - 25, (getY() + Rnd.get(50)) - 25, getZ() + 20);
if ((Config.AUTODESTROY_ITEM_AFTER > 0) && Config.DESTROY_DROPPED_PLAYER_ITEM && !Config.LIST_PROTECTED_ITEMS.contains(droppedItem.getItemId()) && ((droppedItem.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM) || !droppedItem.isEquipable()))
{
ItemsAutoDestroy.getInstance().addItem(droppedItem);
}
if (Config.DESTROY_DROPPED_PLAYER_ITEM)
{
droppedItem.setProtected(droppedItem.isEquipable() && (!droppedItem.isEquipable() || !Config.DESTROY_EQUIPABLE_PLAYER_ITEM));
}
else
{
droppedItem.setProtected(true);
}
if (protectItem)
{
droppedItem.getDropProtection().protect(this);
}
// Send inventory update packet.
if (!Config.FORCE_INVENTORY_UPDATE)
{
final InventoryUpdate playerIU = new InventoryUpdate();
playerIU.addItem(droppedItem);
sendPacket(playerIU);
}
else
{
sendPacket(new ItemList(this, false));
}
// Update current load as well.
final StatusUpdate su = new StatusUpdate(getObjectId());
su.addAttribute(StatusUpdate.CUR_LOAD, getCurrentLoad());
sendPacket(su);
// Sends message to client if requested.
if (sendMessage)
{
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_DROPPED_S1);
sm.addItemName(droppedItem.getItemId());
sendPacket(sm);
}
}
/**
* Drop item from inventory by using its <b>objectID</b> and send a Server->Client InventoryUpdate packet to the PlayerInstance.
* @param process : String Identifier of process triggering this action
* @param objectId : int Item Instance identifier of the item to be dropped
* @param count : int Quantity of items to be dropped
* @param x : int coordinate for drop X
* @param y : int coordinate for drop Y
* @param z : int coordinate for drop Z
* @param reference : WorldObject Object referencing current action like NPC selling item or previous item in transformation
* @param sendMessage : boolean Specifies whether to send message to Client about this action
* @param protectItem the protect item
* @return ItemInstance corresponding to the new item or the updated item in inventory
*/
public ItemInstance dropItem(String process, int objectId, int count, int x, int y, int z, WorldObject reference, boolean sendMessage, boolean protectItem)
{
if (_freight.getItemByObjectId(objectId) != null)
{
// Send a Server->Client ActionFailed to the PlayerInstance in order to avoid that the client wait another packet
sendPacket(ActionFailed.STATIC_PACKET);
Util.handleIllegalPlayerAction(this, "Warning!! Character " + getName() + " of account " + getAccountName() + " tried to drop Freight Items", IllegalPlayerAction.PUNISH_KICK);
return null;
}
final ItemInstance inventoryItem = _inventory.getItemByObjectId(objectId);
final ItemInstance droppedItem = _inventory.dropItem(process, objectId, count, this, reference);
if (droppedItem == null)
{
if (sendMessage)
{
sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT_2);
}
return null;
}
droppedItem.dropMe(this, x, y, z);
if ((Config.AUTODESTROY_ITEM_AFTER > 0) && Config.DESTROY_DROPPED_PLAYER_ITEM && !Config.LIST_PROTECTED_ITEMS.contains(droppedItem.getItemId()) && ((droppedItem.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM) || !droppedItem.isEquipable()))
{
ItemsAutoDestroy.getInstance().addItem(droppedItem);
}
if (Config.DESTROY_DROPPED_PLAYER_ITEM)
{
droppedItem.setProtected(droppedItem.isEquipable() && (!droppedItem.isEquipable() || !Config.DESTROY_EQUIPABLE_PLAYER_ITEM));
}
else
{
droppedItem.setProtected(true);
}
if (protectItem)
{
droppedItem.getDropProtection().protect(this);
}
// Send inventory update packet.
if (!Config.FORCE_INVENTORY_UPDATE)
{
final InventoryUpdate playerIU = new InventoryUpdate();
playerIU.addItem(inventoryItem);
sendPacket(playerIU);
}
else
{
sendPacket(new ItemList(this, false));
}
// Update current load as well.
final StatusUpdate su = new StatusUpdate(getObjectId());
su.addAttribute(StatusUpdate.CUR_LOAD, getCurrentLoad());
sendPacket(su);
// Sends message to client if requested.
if (sendMessage)
{
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_DROPPED_S1);
sm.addItemName(droppedItem.getItemId());
sendPacket(sm);
}
return droppedItem;
}