From e45d787bb4bdd51d05d3022176e5ecad5aa401a3 Mon Sep 17 00:00:00 2001 From: Kaioru Date: Tue, 1 Oct 2024 17:47:00 +0800 Subject: [PATCH] Optimise UpdateSlot to only send update packet --- .../Inventories/Modifiers/ModifyInventoryContext.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/common/Edelstein.Common.Gameplay/Entities/Inventories/Modifiers/ModifyInventoryContext.cs b/src/common/Edelstein.Common.Gameplay/Entities/Inventories/Modifiers/ModifyInventoryContext.cs index 857e25e5c..82c174829 100644 --- a/src/common/Edelstein.Common.Gameplay/Entities/Inventories/Modifiers/ModifyInventoryContext.cs +++ b/src/common/Edelstein.Common.Gameplay/Entities/Inventories/Modifiers/ModifyInventoryContext.cs @@ -121,8 +121,17 @@ public void UpdateSlot(short slot) { var item = this[slot]; if (item == null) return; - RemoveSlot(slot); - SetSlot(slot, item); + + Operations.Enqueue(new StructuredModifyInventoryOperation + { + Type = ModifyInventoryOperationType.Add, + Info = new StructuredModifyInventoryOperationInfoAdd + { + Item = item.ToStructured(), + Inventory = type, + Slot = slot + } + }); } public override short Add(ItemSlotBase item)