diff --git a/Assets/Scripts/Entities/SyncBases/Inventory.cs b/Assets/Scripts/Entities/SyncBases/Inventory.cs index 369fb7d..34e0dc7 100644 --- a/Assets/Scripts/Entities/SyncBases/Inventory.cs +++ b/Assets/Scripts/Entities/SyncBases/Inventory.cs @@ -80,8 +80,16 @@ namespace Cyber.Entities.SyncBases { Drive.AddItem(ItemDB.Singleton.Get(id)); } + bool ReceivedSlots = reader.ReadBoolean(); + if (!ReceivedSlots) { + Equipped.ClearAllEquipped(); + return; + } + byte[] Slots = reader.ReadBytesAndSize(); + Debug.Log(Slots); + byte[][] EquippedIdsBytes = new byte[4][]; EquippedIdsBytes[0] = reader.ReadBytesAndSize(); EquippedIdsBytes[1] = reader.ReadBytesAndSize(); @@ -106,12 +114,20 @@ namespace Cyber.Entities.SyncBases { IDs[i] = Items[i].ID; } byte[][] ByteArray = NetworkHelper.SerializeIntArray(IDs); + writer.WriteBytesFull(ByteArray[0]); writer.WriteBytesFull(ByteArray[1]); writer.WriteBytesFull(ByteArray[2]); writer.WriteBytesFull(ByteArray[3]); var slotList = new List(Equipped.GetEquippedDict().Keys).ConvertAll(x => (byte) x); + + if (slotList.Count > 0) { + writer.Write(true); + } else { + writer.Write(false); + } + slotList.Sort((a, b) => { return b - a; });