You know that sometimes, when a player drops an item, it stays on the floor unable to be picked up again. Even more, when you try to pick it up you get "bugged" and have to target yourself to be able to walk again.
Ok, today I've began to study a case of bugged dropped item (a Triton Pole ^^) and I've found out a lot of useful information about it, just sniffing my pickup packet and using L2World.getInstance().findObject().
The object is not null, and it is instance of l2iteminstance... but!! It has itemLocation = INVENTORY, owner = 27XXXXXX and lastChange != REMOVED. Something happened during its drop, and my first suspicious is Inventory.dropItem() because here is where all these variables are set:
Code: Select all
synchronized (item) { if (!_items.contains(item)) return null; removeItem(item); item.setOwnerId(process, 0, actor, reference); item.setLocation(ItemLocation.VOID); item.setLastChange(L2ItemInstance.REMOVED); item.updateDatabase(); refreshWeight(); }
Here my temp fix patch:
Code: Select all
### Eclipse Workspace Patch 1.0#P L2_GameServerIndex: java/com.l2jserver/gameserver/ai/L2CharacterAI.java===================================================================--- java/com.l2jserver/gameserver/ai/L2CharacterAI.java (revision 209)+++ java/com.l2jserver/gameserver/ai/L2CharacterAI.java (working copy)@@ -502,7 +502,23 @@ clientStopAutoAttack(); if (object instanceof L2ItemInstance && ((L2ItemInstance)object).getLocation() != ItemLocation.VOID)- return;+ {+ if (_actor.getKnownList().knowsObject(object))+ {+ //TODO: Temp fix for bugged items on the floor.+ _log.warning("A bugged item has just been picked up!" ++ " Its owner id was " + ((L2ItemInstance)object).getOwnerId() + + " and its item id is " + ((L2ItemInstance)object).getObjectId() + ".");+ + ((L2ItemInstance)object).setOwnerId("Bugged item pick up", 0, (L2PcInstance)_actor, null);+ ((L2ItemInstance)object).setLocation(ItemLocation.VOID);+ ((L2ItemInstance)object).setLastChange(L2ItemInstance.REMOVED);++ ((L2ItemInstance)object).updateDatabase();+ }+ else+ return;+ } // Set the Intention of this AbstractAI to AI_INTENTION_PICK_UP changeIntention(AI_INTENTION_PICK_UP, object, null);
Thank you ^^