L2JMobius

C6 No item drop at Karma

G-hamsteR · 14 · 6185

Online G-hamsteR

  • Viscount
  • *****
    • Posts: 335
Hello,

While dying with Karma, the player receives the message "You have dropped %item%", but the item is destroyed and not dropped on the floor.


Offline Minzee

  • Baron
  • *****
    • Posts: 276
Maybe that item is not dropable so it is destryed ;) read item info ;) Event item or what it was?


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16118

Online G-hamsteR

  • Viscount
  • *****
    • Posts: 335
I used //setkarma 10000 to a player, then //kill. Items get destroyed, but do not get dropped. Many items got destroyed, so the problem is not with particular items. Weapons, scrolls, crystals, armors etc


Online G-hamsteR

  • Viscount
  • *****
    • Posts: 335
It even drops items like The Lord's Crown. Also, sometimes if the item is equipped, it is still shown on the inventory but you can't click on it. For example, I was wearing the Lord's Crown when it dropped and I needed to restart in order for it to disappear from my inventory.

Edit: Other players still see my Lord's Crown before my restart.


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16118
My problem is that I am not able to drop any items.
No messages.


Offline Minzee

  • Baron
  • *****
    • Posts: 276
Maybe problem is in configs?  ???

# Allow players to drop items on the ground.
AllowDiscardItem = True

# Delete dropped reward items from world after a specified amount of seconds. Disabled = 0.
AutoDestroyDroppedItemAfter = 0

# Just delete the stuff that fell out of players
# WARNING: only works when AutoDestroyDroppedItemAfter> 0
DestroyPlayerDroppedItem = False


Online G-hamsteR

  • Viscount
  • *****
    • Posts: 335
I am having exactly these configs.

Maybe problem is in configs?  ???

# Allow players to drop items on the ground.
AllowDiscardItem = True

# Delete dropped reward items from world after a specified amount of seconds. Disabled = 0.
AutoDestroyDroppedItemAfter = 0

# Just delete the stuff that fell out of players
# WARNING: only works when AutoDestroyDroppedItemAfter> 0
DestroyPlayerDroppedItem = False


Online G-hamsteR

  • Viscount
  • *****
    • Posts: 335
Just to be sure, GMs don't drop items by configs. You are trying it on a non-GM character, right?

My problem is that I am not able to drop any items.
No messages.



Online Mobius

  • Distinguished King
  • *****
    • Posts: 16118
Try replacing
Code: [Select]
dropItem("DieDrop", itemDrop, killer, true, !isKarmaDrop);with
Code: [Select]
dropItem("DieDrop", itemDrop.getObjectId(), itemDrop.getCount(), (getClientX() + Rnd.get(50)) - 25, (getClientY() + Rnd.get(50)) - 25, getClientZ() + 20, this, true, !isKarmaDrop);


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16118
Probable fix. Replace both drop methods at PlayerInstance.
Code: [Select]
/**
* 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;
}


Online G-hamsteR

  • Viscount
  • *****
    • Posts: 335
This fixed the problem. I didn't make the changes mentioned in your previous reply. Thank you!


Probable fix. Replace both drop methods at PlayerInstance.
Code: [Select]
/**
* 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;
}