Additional InventoryUpdate when creating more than one non-stackable item.
This commit is contained in:
		| @@ -3598,7 +3598,6 @@ public class Player extends Playable | ||||
| 			{ | ||||
| 				playerIU.addRemovedItem(oldItem); | ||||
| 			} | ||||
| 			 | ||||
| 			sendInventoryUpdate(playerIU); | ||||
| 		} | ||||
| 		else | ||||
| @@ -3621,7 +3620,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(); | ||||
|   | ||||
| @@ -507,34 +507,34 @@ 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(); | ||||
| 					} | ||||
| 					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
	 MobiusDevelopment
					MobiusDevelopment