Exemplo n.º 1
0
 public EntityAction(BinaryReader reader)
 {
     item    = new Part.Item(reader);
     chunkX  = reader.ReadInt32();
     chunkY  = reader.ReadInt32();
     index   = reader.ReadInt32();
     unknown = reader.ReadInt32();
     type    = reader.ReadByte();
     reader.ReadBytes(3); //pad
 }
Exemplo n.º 2
0
        public EntityUpdate(BinaryReader reader)
        {
            byte[] uncompressed = Zlib.Decompress(reader.ReadBytes(reader.ReadInt32()));

            MemoryStream stream = new MemoryStream(uncompressed);
            BinaryReader r      = new BinaryReader(stream);

            guid = r.ReadInt64();
            var bitfield = r.ReadInt64();

            if (Tools.GetBit(bitfield, 0))
            {
                position = new LongVector(r);
            }
            if (Tools.GetBit(bitfield, 1))
            {
                rotation = new FloatVector(r);
            }
            if (Tools.GetBit(bitfield, 2))
            {
                velocity = new FloatVector(r);
            }
            if (Tools.GetBit(bitfield, 3))
            {
                acceleration = new FloatVector(r);
            }
            if (Tools.GetBit(bitfield, 4))
            {
                extraVel = new FloatVector(r);
            }
            if (Tools.GetBit(bitfield, 5))
            {
                viewportPitch = r.ReadSingle();
            }
            if (Tools.GetBit(bitfield, 6))
            {
                physicsFlags = r.ReadInt32();
            }
            if (Tools.GetBit(bitfield, 7))
            {
                hostility = r.ReadByte();
            }
            if (Tools.GetBit(bitfield, 8))
            {
                entityType = r.ReadInt32();
            }
            if (Tools.GetBit(bitfield, 9))
            {
                mode = r.ReadByte();
            }
            if (Tools.GetBit(bitfield, 10))
            {
                modeTimer = r.ReadInt32();
            }
            if (Tools.GetBit(bitfield, 11))
            {
                combo = r.ReadInt32();
            }
            if (Tools.GetBit(bitfield, 12))
            {
                lastHitTime = r.ReadInt32();
            }
            if (Tools.GetBit(bitfield, 13))
            {
                appearance = new Part.Appearance(r);
            }
            if (Tools.GetBit(bitfield, 14))
            {
                entityFlags = r.ReadInt16();
            }
            if (Tools.GetBit(bitfield, 15))
            {
                roll = r.ReadInt32();
            }
            if (Tools.GetBit(bitfield, 16))
            {
                stun = r.ReadInt32();
            }
            if (Tools.GetBit(bitfield, 17))
            {
                slow = r.ReadInt32();
            }
            if (Tools.GetBit(bitfield, 18))
            {
                ice = r.ReadInt32();
            }
            if (Tools.GetBit(bitfield, 19))
            {
                wind = r.ReadInt32();
            }
            if (Tools.GetBit(bitfield, 20))
            {
                showPatchTime = r.ReadInt32();
            }
            if (Tools.GetBit(bitfield, 21))
            {
                entityClass = r.ReadByte();
            }
            if (Tools.GetBit(bitfield, 22))
            {
                specialization = r.ReadByte();
            }
            if (Tools.GetBit(bitfield, 23))
            {
                charge = r.ReadSingle();
            }
            if (Tools.GetBit(bitfield, 24))
            {
                unused24 = new FloatVector(r);
            }
            if (Tools.GetBit(bitfield, 25))
            {
                unused25 = new FloatVector(r);
            }
            if (Tools.GetBit(bitfield, 26))
            {
                rayHit = new FloatVector(r);
            }
            if (Tools.GetBit(bitfield, 27))
            {
                HP = r.ReadSingle();
            }
            if (Tools.GetBit(bitfield, 28))
            {
                MP = r.ReadSingle();
            }
            if (Tools.GetBit(bitfield, 29))
            {
                block = r.ReadSingle();
            }
            if (Tools.GetBit(bitfield, 30))
            {
                multipliers = new Part.Multipliers(r);
            }
            if (Tools.GetBit(bitfield, 31))
            {
                unused31 = r.ReadByte();
            }
            if (Tools.GetBit(bitfield, 32))
            {
                unused32 = r.ReadByte();
            }
            if (Tools.GetBit(bitfield, 33))
            {
                level = r.ReadInt32();
            }
            if (Tools.GetBit(bitfield, 34))
            {
                XP = r.ReadInt32();
            }
            if (Tools.GetBit(bitfield, 35))
            {
                parentOwner = r.ReadInt64();
            }
            if (Tools.GetBit(bitfield, 36))
            {
                unused36 = r.ReadInt64();
            }
            if (Tools.GetBit(bitfield, 37))
            {
                powerBase = r.ReadByte();
            }
            if (Tools.GetBit(bitfield, 38))
            {
                unused38 = r.ReadInt32();
            }
            if (Tools.GetBit(bitfield, 39))
            {
                unused39 = new IntVector(r);
            }
            if (Tools.GetBit(bitfield, 40))
            {
                spawnPos = new LongVector(r);
            }
            if (Tools.GetBit(bitfield, 41))
            {
                unused41 = new IntVector(r);
            }
            if (Tools.GetBit(bitfield, 42))
            {
                unused42 = r.ReadByte();
            }
            if (Tools.GetBit(bitfield, 43))
            {
                consumable = new Part.Item(r);
            }
            if (Tools.GetBit(bitfield, 44))
            {
                equipment = new Part.Item[13];
                for (int i = 0; i < 13; i++)
                {
                    equipment[i] = new Part.Item(r);
                }
            }
            if (Tools.GetBit(bitfield, 45))
            {
                name = new string(r.ReadChars(16));
                name = name.Substring(0, name.IndexOf("\0"));
            }
            if (Tools.GetBit(bitfield, 46))
            {
                skillDistribution = new Part.SkillDistribution(r);
            }
            if (Tools.GetBit(bitfield, 47))
            {
                manaCubes = r.ReadInt32();
            }
        }