Skip to content

Commit e45d787

Browse files
committed
Optimise UpdateSlot to only send update packet
1 parent e8815f1 commit e45d787

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/common/Edelstein.Common.Gameplay/Entities/Inventories/Modifiers/ModifyInventoryContext.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,17 @@ public void UpdateSlot(short slot)
121121
{
122122
var item = this[slot];
123123
if (item == null) return;
124-
RemoveSlot(slot);
125-
SetSlot(slot, item);
124+
125+
Operations.Enqueue(new StructuredModifyInventoryOperation
126+
{
127+
Type = ModifyInventoryOperationType.Add,
128+
Info = new StructuredModifyInventoryOperationInfoAdd
129+
{
130+
Item = item.ToStructured(),
131+
Inventory = type,
132+
Slot = slot
133+
}
134+
});
126135
}
127136

128137
public override short Add(ItemSlotBase item)

0 commit comments

Comments
 (0)