Additional InventoryUpdate when creating more than one non-stackable item.
This commit is contained in:
@ -3710,7 +3710,6 @@ public class Player extends Playable
|
||||
{
|
||||
playerIU.addRemovedItem(oldItem);
|
||||
}
|
||||
|
||||
sendInventoryUpdate(playerIU);
|
||||
}
|
||||
else
|
||||
@ -3733,7 +3732,6 @@ public class Player extends Playable
|
||||
{
|
||||
playerIU.addNewItem(newItem);
|
||||
}
|
||||
|
||||
targetPlayer.sendPacket(playerIU);
|
||||
}
|
||||
else
|
||||
|
@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
|
||||
|
||||
/**
|
||||
* @author Advi
|
||||
@ -243,6 +244,7 @@ public abstract class ItemContainer
|
||||
}
|
||||
else // If item hasn't be found in inventory, create new one
|
||||
{
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
final ItemTemplate template = ItemTable.getInstance().getTemplate(itemId);
|
||||
@ -260,12 +262,24 @@ public abstract class ItemContainer
|
||||
// Add item in inventory
|
||||
addItem(item);
|
||||
|
||||
// Add additional items to InventoryUpdate.
|
||||
if ((count > 1) && (i < (count - 1)))
|
||||
{
|
||||
iu.addNewItem(item);
|
||||
}
|
||||
|
||||
// If stackable, end loop as entire count is included in 1 instance of item
|
||||
if (template.isStackable() || !Config.MULTIPLE_ITEM_DROP)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If additional items where created send InventoryUpdate.
|
||||
if ((count > 1) && (item != null) && !item.isStackable() && (item.getItemLocation() == ItemLocation.INVENTORY))
|
||||
{
|
||||
actor.sendInventoryUpdate(iu);
|
||||
}
|
||||
}
|
||||
|
||||
refreshWeight();
|
||||
|
@ -51,6 +51,7 @@ import org.l2jmobius.gameserver.model.skill.SkillConditionScope;
|
||||
import org.l2jmobius.gameserver.model.variables.ItemVariables;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.limitshop.ExBloodyCoinCount;
|
||||
|
||||
public class PlayerInventory extends Inventory
|
||||
{
|
||||
@ -480,34 +481,40 @@ public class PlayerInventory extends Inventory
|
||||
{
|
||||
_beautyTickets = item;
|
||||
}
|
||||
}
|
||||
|
||||
if ((item != null) && (actor != null))
|
||||
{
|
||||
// Send inventory update packet
|
||||
if (update)
|
||||
|
||||
if (actor != null)
|
||||
{
|
||||
if (!Config.FORCE_INVENTORY_UPDATE)
|
||||
// Send inventory update packet
|
||||
if (update)
|
||||
{
|
||||
final InventoryUpdate playerIU = new InventoryUpdate();
|
||||
if (item.isStackable() && (item.getCount() > count))
|
||||
if (!Config.FORCE_INVENTORY_UPDATE)
|
||||
{
|
||||
playerIU.addModifiedItem(item);
|
||||
final InventoryUpdate playerIU = new InventoryUpdate();
|
||||
if (item.isStackable() && (item.getCount() > count))
|
||||
{
|
||||
playerIU.addModifiedItem(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerIU.addNewItem(item);
|
||||
}
|
||||
actor.sendInventoryUpdate(playerIU);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerIU.addNewItem(item);
|
||||
actor.sendItemList();
|
||||
}
|
||||
|
||||
// Einhasad coin UI update.
|
||||
if (item.getId() == Inventory.EINHASAD_COIN_ID)
|
||||
{
|
||||
actor.sendPacket(new ExBloodyCoinCount(actor));
|
||||
}
|
||||
actor.sendInventoryUpdate(playerIU);
|
||||
}
|
||||
else
|
||||
{
|
||||
actor.sendItemList();
|
||||
}
|
||||
|
||||
// Notify to scripts
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemAdd(actor, item), actor, item.getTemplate());
|
||||
}
|
||||
|
||||
// Notify to scripts
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemAdd(actor, item), actor, item.getTemplate());
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
Reference in New Issue
Block a user