// Token: 0x060021FB RID: 8699 RVA: 0x000B83A8 File Offset: 0x000B67A8
        public void rebuildState()
        {
            if (this.items == null)
            {
                return;
            }
            SteamPacker.openWrite(0);
            SteamPacker.write(this.owner, this.group, this.items.getItemCount());
            for (byte b = 0; b < this.items.getItemCount(); b += 1)
            {
                ItemJar item = this.items.getItem(b);
                SteamPacker.write(item.x, item.y, item.rot, item.item.id, item.item.amount, item.item.quality, item.item.state);
            }
            if (this.isDisplay)
            {
                SteamPacker.write(this.displaySkin);
                SteamPacker.write(this.displayMythic);
                SteamPacker.write((!string.IsNullOrEmpty(this.displayTags)) ? this.displayTags : string.Empty);
                SteamPacker.write((!string.IsNullOrEmpty(this.displayDynamicProps)) ? this.displayDynamicProps : string.Empty);
                SteamPacker.write(this.rot_comp);
            }
            int size;

            byte[] state = SteamPacker.closeWrite(out size);
            BarricadeManager.updateState(base.transform, state, size);
        }
Example #2
0
        public void receive(CSteamID steamID, byte[] packet, int offset, int size)
        {
            if (SteamChannel.onTriggerReceive != null)
            {
                SteamChannel.onTriggerReceive(this, steamID, packet, offset, size);
            }
            if (size < 2)
            {
                return;
            }
            int num = (int)packet[offset + 1];

            if (num < 0 || num >= this.calls.Length)
            {
                return;
            }
            ESteamPacket esteamPacket = (ESteamPacket)packet[offset];

            if (esteamPacket == ESteamPacket.UPDATE_VOICE && size < 5)
            {
                return;
            }
            if (esteamPacket == ESteamPacket.UPDATE_UNRELIABLE_CHUNK_BUFFER || esteamPacket == ESteamPacket.UPDATE_RELIABLE_CHUNK_BUFFER)
            {
                SteamPacker.openRead(offset + 2, packet);
                this.calls[num].method.Invoke(this.calls[num].component, new object[]
                {
                    steamID
                });
                SteamPacker.closeRead();
            }
            else if (this.calls[num].types.Length > 0)
            {
                if (esteamPacket == ESteamPacket.UPDATE_VOICE)
                {
                    SteamChannel.voice[0] = steamID;
                    SteamChannel.voice[1] = packet;
                    SteamChannel.voice[2] = (int)BitConverter.ToUInt16(packet, offset + 2);
                    this.calls[num].method.Invoke(this.calls[num].component, SteamChannel.voice);
                }
                else
                {
                    object[] objects = SteamPacker.getObjects(steamID, offset, 2, packet, this.calls[num].types);
                    if (objects != null)
                    {
                        this.calls[num].method.Invoke(this.calls[num].component, objects);
                    }
                }
            }
            else
            {
                this.calls[num].method.Invoke(this.calls[num].component, null);
            }
        }
 public override void updateState(Asset asset, byte[] state)
 {
     this.gunLargeTransform = base.transform.FindChildRecursive("Gun_Large");
     this.gunSmallTransform = base.transform.FindChildRecursive("Gun_Small");
     this.meleeTransform    = base.transform.FindChildRecursive("Melee");
     this.itemTransform     = base.transform.FindChildRecursive("Item");
     this.isLocked          = ((ItemBarricadeAsset)asset).isLocked;
     this._isDisplay        = ((ItemStorageAsset)asset).isDisplay;
     if (Provider.isServer)
     {
         SteamPacker.openRead(0, state);
         this._owner = (CSteamID)SteamPacker.read(Types.STEAM_ID_TYPE);
         this._group = (CSteamID)SteamPacker.read(Types.STEAM_ID_TYPE);
         this._items = new Items(PlayerInventory.STORAGE);
         this.items.resize(((ItemStorageAsset)asset).storage_x, ((ItemStorageAsset)asset).storage_y);
         byte b = (byte)SteamPacker.read(Types.BYTE_TYPE);
         for (byte b2 = 0; b2 < b; b2 += 1)
         {
             if (BarricadeManager.version > 7)
             {
                 object[]  array     = SteamPacker.read(Types.BYTE_TYPE, Types.BYTE_TYPE, Types.BYTE_TYPE, Types.UINT16_TYPE, Types.BYTE_TYPE, Types.BYTE_TYPE, Types.BYTE_ARRAY_TYPE);
                 ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, (ushort)array[3]);
                 if (itemAsset != null)
                 {
                     this.items.loadItem((byte)array[0], (byte)array[1], (byte)array[2], new Item((ushort)array[3], (byte)array[4], (byte)array[5], (byte[])array[6]));
                 }
             }
             else
             {
                 object[]  array2     = SteamPacker.read(Types.BYTE_TYPE, Types.BYTE_TYPE, Types.UINT16_TYPE, Types.BYTE_TYPE, Types.BYTE_TYPE, Types.BYTE_ARRAY_TYPE);
                 ItemAsset itemAsset2 = (ItemAsset)Assets.find(EAssetType.ITEM, (ushort)array2[2]);
                 if (itemAsset2 != null)
                 {
                     this.items.loadItem((byte)array2[0], (byte)array2[1], 0, new Item((ushort)array2[2], (byte)array2[3], (byte)array2[4], (byte[])array2[5]));
                 }
             }
         }
         if (this.isDisplay)
         {
             this.displaySkin   = (ushort)SteamPacker.read(Types.UINT16_TYPE);
             this.displayMythic = (ushort)SteamPacker.read(Types.UINT16_TYPE);
             if (BarricadeManager.version > 8)
             {
                 this.applyRotation((byte)SteamPacker.read(Types.BYTE_TYPE));
             }
             else
             {
                 this.applyRotation(0);
             }
         }
         this.items.onStateUpdated = new StateUpdated(this.onStateUpdated);
         SteamPacker.closeRead();
         if (this.isDisplay)
         {
             this.updateDisplay();
             this.refreshDisplay();
         }
     }
     else
     {
         Block block = new Block(state);
         this._owner = new CSteamID((ulong)block.read(Types.UINT64_TYPE));
         this._group = new CSteamID((ulong)block.read(Types.UINT64_TYPE));
         if (state.Length > 16)
         {
             object[] array3 = block.read(Types.UINT16_TYPE, Types.BYTE_TYPE, Types.BYTE_ARRAY_TYPE, Types.UINT16_TYPE, Types.UINT16_TYPE, Types.BYTE_TYPE);
             this.applyRotation((byte)array3[5]);
             this.setDisplay((ushort)array3[0], (byte)array3[1], (byte[])array3[2], (ushort)array3[3], (ushort)array3[4]);
         }
     }
 }
Example #4
0
 public object[] read(Type type_0, Type type_1, Type type_2, Type type_3)
 {
     return(SteamPacker.read(type_0, type_1, type_2, type_3));
 }
Example #5
0
 public void getPacket(ESteamPacket type, int index, out int size, out byte[] packet, params object[] arguments)
 {
     packet    = SteamPacker.getBytes(2, out size, arguments);
     packet[0] = (byte)type;
     packet[1] = (byte)index;
 }
Example #6
0
 public void getPacket(ESteamPacket type, int index, out int size, out byte[] packet)
 {
     packet    = SteamPacker.closeWrite(out size);
     packet[0] = (byte)type;
     packet[1] = (byte)index;
 }
Example #7
0
 public object read(Type type)
 {
     return(SteamPacker.read(type));
 }
Example #8
0
 public void openWrite()
 {
     SteamPacker.openWrite(2);
 }
Example #9
0
 public void write(object object_0, object object_1, object object_2, object object_3, object object_4, object object_5, object object_6)
 {
     SteamPacker.write(object_0, object_1, object_2, object_3, object_4, object_5, object_6);
 }
Example #10
0
 public void write(params object[] objects)
 {
     SteamPacker.write(objects);
 }
Example #11
0
 public void write(object object_0, object object_1, object object_2, object object_3)
 {
     SteamPacker.write(object_0, object_1, object_2, object_3);
 }
Example #12
0
 public void write(object object_0, object object_1)
 {
     SteamPacker.write(object_0, object_1);
 }
Example #13
0
 public void write(object objects)
 {
     SteamPacker.write(objects);
 }
Example #14
0
 public object[] read(params Type[] types)
 {
     return(SteamPacker.read(types));
 }
Example #15
0
 public object[] read(Type type_0, Type type_1, Type type_2, Type type_3, Type type_4, Type type_5, Type type_6)
 {
     return(SteamPacker.read(type_0, type_1, type_2, type_3, type_4, type_5, type_6));
 }