|
@@ -3454,7 +3454,7 @@ public final class L2PcInstance extends L2Playable
|
|
|
|
|
|
// If over capacity, drop the item
|
|
|
if (!isGM() && !_inventory.validateCapacity(0, item.isQuestItem()) && newitem.isDropable() && (!newitem.isStackable() || newitem.getLastChange() != L2ItemInstance.MODIFIED))
|
|
|
- dropItem("InvDrop", newitem, null, true);
|
|
|
+ dropItem("InvDrop", newitem, null, true, true);
|
|
|
|
|
|
// Cursed Weapon
|
|
|
else if(CursedWeaponsManager.getInstance().isCursed(newitem.getItemId()))
|
|
@@ -3859,9 +3859,10 @@ public final class L2PcInstance extends L2Playable
|
|
|
* @param item : L2ItemInstance to be dropped
|
|
|
* @param reference : L2Object 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: whether or not dropped item must be protected temporary against other players
|
|
|
* @return boolean informing if the action was successfull
|
|
|
*/
|
|
|
- public boolean dropItem(String process, L2ItemInstance item, L2Object reference, boolean sendMessage)
|
|
|
+ public boolean dropItem(String process, L2ItemInstance item, L2Object reference, boolean sendMessage, boolean protectItem)
|
|
|
{
|
|
|
item = _inventory.dropItem(process, item, this, reference);
|
|
|
|
|
@@ -3875,19 +3876,27 @@ public final class L2PcInstance extends L2Playable
|
|
|
|
|
|
item.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(item.getItemId()))
|
|
|
- {
|
|
|
- if ( (item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM) || !item.isEquipable())
|
|
|
+ if (Config.AUTODESTROY_ITEM_AFTER > 0
|
|
|
+ && Config.DESTROY_DROPPED_PLAYER_ITEM
|
|
|
+ && !Config.LIST_PROTECTED_ITEMS.contains(item.getItemId())) {
|
|
|
+ if ((item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM)
|
|
|
+ || !item.isEquipable())
|
|
|
ItemsAutoDestroy.getInstance().addItem(item);
|
|
|
}
|
|
|
- if (Config.DESTROY_DROPPED_PLAYER_ITEM){
|
|
|
- if (!item.isEquipable() || (item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM ))
|
|
|
+
|
|
|
+ // protection against auto destroy dropped item
|
|
|
+ if (Config.DESTROY_DROPPED_PLAYER_ITEM) {
|
|
|
+ if (!item.isEquipable()
|
|
|
+ || (item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM))
|
|
|
item.setProtected(false);
|
|
|
else
|
|
|
item.setProtected(true);
|
|
|
- }
|
|
|
- else
|
|
|
+ } else
|
|
|
item.setProtected(true);
|
|
|
+
|
|
|
+ // retail drop protection
|
|
|
+ if (protectItem)
|
|
|
+ item.getDropProtection().protect(this);
|
|
|
|
|
|
// Send inventory update packet
|
|
|
if (!Config.FORCE_INVENTORY_UPDATE)
|
|
@@ -3914,6 +3923,11 @@ public final class L2PcInstance extends L2Playable
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ public boolean dropItem(String process, L2ItemInstance item, L2Object reference, boolean sendMessage)
|
|
|
+ {
|
|
|
+ return dropItem(process, item, reference, sendMessage, false);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Drop item from inventory by using its <B>objectID</B> and send a Server->Client InventoryUpdate packet to the L2PcInstance.
|
|
|
* @param process : String Identifier of process triggering this action
|
|
@@ -3926,7 +3940,7 @@ public final class L2PcInstance extends L2Playable
|
|
|
* @param sendMessage : boolean Specifies whether to send message to Client about this action
|
|
|
* @return L2ItemInstance corresponding to the new item or the updated item in inventory
|
|
|
*/
|
|
|
- public L2ItemInstance dropItem(String process, int objectId, long count, int x, int y, int z, L2Object reference, boolean sendMessage)
|
|
|
+ public L2ItemInstance dropItem(String process, int objectId, long count, int x, int y, int z, L2Object reference, boolean sendMessage, boolean protectItem)
|
|
|
{
|
|
|
L2ItemInstance invitem = _inventory.getItemByObjectId(objectId);
|
|
|
L2ItemInstance item = _inventory.dropItem(process, objectId, count, this, reference);
|
|
@@ -3955,6 +3969,10 @@ public final class L2PcInstance extends L2Playable
|
|
|
else
|
|
|
item.setProtected(true);
|
|
|
|
|
|
+ // retail drop protection
|
|
|
+ if (protectItem)
|
|
|
+ item.getDropProtection().protect(this);
|
|
|
+
|
|
|
// Send inventory update packet
|
|
|
if (!Config.FORCE_INVENTORY_UPDATE)
|
|
|
{
|
|
@@ -4652,6 +4670,15 @@ public final class L2PcInstance extends L2Playable
|
|
|
sendPacket(ActionFailed.STATIC_PACKET);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ if (!target.getDropProtection().tryPickUp(this))
|
|
|
+ {
|
|
|
+ sendPacket(ActionFailed.STATIC_PACKET);
|
|
|
+ SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.FAILED_TO_PICKUP_S1);
|
|
|
+ smsg.addItemName(target);
|
|
|
+ sendPacket(smsg);
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
if ( ((isInParty() && getParty().getLootDistribution() == L2Party.ITEM_LOOTER) || !isInParty()) && !_inventory.validateCapacity(target))
|
|
|
{
|