public void ReadPacket(PacketReader reader)
        {
            //TODO: Make
            var offset = 0x2A;
            File.WriteAllBytes("AvatarProfileResponsePacket dump", ((MemoryStream)reader.BaseStream).ToArray());
            Unknown1 = reader.ReadInt32();
            UserID1 = reader.ReadInt64();
            UserID2 = reader.ReadInt64();
            if (reader.ReadBoolean())
            {
                Clan = new Clan();
                Clan.ID = reader.ReadInt64();
                Clan.Name = reader.ReadString();
                Clan.Badge = reader.ReadInt32();
                reader.ReadInt32();
                Clan.Level = reader.ReadInt32();
                offset += 1;
            }
            if (Unknown2 = reader.ReadBoolean())
            {
                Unknown3 = reader.ReadInt64();
                offset += 1;
            }

            reader.Seek(offset, SeekOrigin.Current);
            Unknown4 = reader.ReadInt32();
            AllianceCastleLevel = reader.ReadInt32(); // -1 if not constructed
            AllianceCastleUnitCapacity = reader.ReadInt32();
            AllianceCastleUnitCount = reader.ReadInt32();
            TownHallLevel = reader.ReadInt32();
            Username = reader.ReadString();
            FacebookID = reader.ReadString();
            Level = reader.ReadInt32();
            Experience = reader.ReadInt32();
            Gems = reader.ReadInt32(); // they seemed randomized or scrambled for non local player
            Gems1 = reader.ReadInt32();
            Unknown5 = reader.ReadInt32();
            Unknown6 = reader.ReadInt32();
            Trophies = reader.ReadInt32();
            AttackWon = reader.ReadInt32();
            AttackLost = reader.ReadInt32(); // randomized
            DefenseWon = reader.ReadInt32();
            DefenseLost = reader.ReadInt32(); // randomized
        }
Ejemplo n.º 2
0
        public void ReadPacket(PacketReader reader)
        {
            LastVisit = TimeSpan.FromSeconds(reader.ReadInt32());

            //Unknown1 = reader.ReadInt();
            reader.Seek(4, SeekOrigin.Current);

            TimeStamp = reader.ReadInt64();
            UserID = reader.ReadInt64();
            ShieldDuration = TimeSpan.FromSeconds(reader.ReadInt32());

            //Unknown2 = reader.ReadLong();
            reader.Seek(8, SeekOrigin.Current);
            Compressed = reader.ReadBoolean();
            Home = new Village();
            Home.ReadFromPacketReader(reader);

            //Unknown4 = reader.ReadInt();
            reader.Seek(4, SeekOrigin.Current);

            //UserID2 = reader.ReadLong();
            //UserID3 = reader.ReadLong();
            reader.Seek(16, SeekOrigin.Current);

            if ((HasClan = reader.ReadBoolean()))
            {
                Clan = new Clan()
                {
                    ID = reader.ReadInt64(),
                    Name = reader.ReadString(),
                    Badge = reader.ReadInt32(),
                };
                Level = reader.ReadInt32(); // member status?
                Level = reader.ReadInt32();
            }

            if (reader.ReadBoolean())
                reader.Seek(8, SeekOrigin.Current);
            if (reader.ReadBoolean())
                reader.Seek(8, SeekOrigin.Current);

            //Unknown5 = (byte)reader.ReadByte();
            //Unknown6 = reader.ReadInt();
            //Unknown7 = reader.ReadLong();
            //Unknown8 = reader.ReadLong();
            reader.Seek(4, SeekOrigin.Current);

            AllianceCastleLevel = reader.ReadInt32();
            AllianceCastleCapacity = reader.ReadInt32();
            AllianceCastleUsed = reader.ReadInt32();
            TownHallLevel = reader.ReadInt32();
            Username = reader.ReadString();
            FacebookID = reader.ReadInt32();
            Level = reader.ReadInt32();
            Experience = reader.ReadInt32();
            Gems = reader.ReadInt32();
            //Gems1 = reader.ReadInt();

            //Unknown9 = reader.ReadLong();
            reader.Seek(12, SeekOrigin.Current);

            TrophiesCount = reader.ReadInt32();
            AttackWon = reader.ReadInt32();
            AttackLost = reader.ReadInt32();
            DefenceWon = reader.ReadInt32();
            DefenceLost = reader.ReadInt32();

            reader.Seek(21, SeekOrigin.Current);

            HasName = reader.ReadBoolean();

            reader.Seek(16, SeekOrigin.Current);
        }
        public void ReadPacket(PacketReader reader)
        {
            Unknown1 = reader.ReadInt32();
            Unknown2 = reader.ReadInt32();
            UserID = reader.ReadInt64();
            Shield = TimeSpan.FromSeconds(reader.ReadInt32());
            Unknown3 = reader.ReadInt32();
            Unknown4 = reader.ReadInt32();
            Compressed = reader.ReadBoolean();
            Home = new Village();
            Home.Read(reader);
            Unknown5 = reader.ReadInt32();

            UserID1 = reader.ReadInt64();
            UserID2 = reader.ReadInt64();

            var offset = 0x2A;
            bool isClan = reader.ReadBoolean();
            if (isClan)
            {
                Clan = new Clan();
                Clan.ID = reader.ReadInt64();
                Clan.Name = reader.ReadString();
                Clan.Badge = reader.ReadInt32();
                Unknown6 = reader.ReadInt32();
                Clan.Level = reader.ReadInt32();
                offset += 1;
            }

            bool Unknown7 = reader.ReadBoolean();
            if (Unknown7)
                Unknown8 = reader.ReadInt64();

            bool Unknown9 = reader.ReadBoolean();
            if (Unknown9)
                Unknown10 = reader.ReadInt64();

            reader.Seek(offset, SeekOrigin.Current);
            Unknown11 = reader.ReadInt32();
            Unknown12 = reader.ReadInt32();
            Unknown13 = reader.ReadInt32();

            ClanUnits = reader.ReadInt32();
            TownHall = reader.ReadInt32();
            Username = reader.ReadString();
            FacebookID = reader.ReadString();
            Stars = reader.ReadInt32();
            Points = reader.ReadInt32();

            Unknown14 = reader.ReadInt32();
            Unknown15 = reader.ReadInt32();
            Unknown16 = reader.ReadInt32();
            Unknown17 = reader.ReadInt32();

            Trophies = reader.ReadInt32();
            AttacksWon = reader.ReadInt32();
            Unknown18 = reader.ReadInt32();
            DefenseWon = reader.ReadInt32();
            Unknown19 = reader.ReadInt32();

            Unknown20 = reader.ReadInt32();
            Unknown21 = reader.ReadInt32();
            Unknown22 = reader.ReadInt32();

            bool Unknown23 = reader.ReadBoolean();
            if (Unknown23)
                Unknown24 = reader.ReadInt64();

            Unknown25 = reader.ReadByte();
            Unknown26 = reader.ReadInt32();
            Unknown27 = reader.ReadInt32();
            Unknown28 = reader.ReadInt32();
            Unknown29 = reader.ReadInt32();

            var count = reader.ReadInt32(); //storage
            for (int i = 0; i < count; i++)
            {
                var id = reader.ReadInt32();
                var capacity = reader.ReadInt32();
            }

            count = reader.ReadInt32(); //resources
            for (int i = 0; i < count; i++)
            {
                var id = reader.ReadInt32();
                var capacity = reader.ReadInt32();
            }

            count = reader.ReadInt32(); //units
            for (int i = 0; i < count; i++)
            {
                var id = reader.ReadInt32();
                var capacity = reader.ReadInt32();
            }

            count = reader.ReadInt32(); //spells
            for (int i = 0; i < count; i++)
            {
                var id = reader.ReadInt32();
                var capacity = reader.ReadInt32();
            }

            count = reader.ReadInt32(); //unit_upgrades
            for (int i = 0; i < count; i++)
            {
                var id = reader.ReadInt32();
                var capacity = reader.ReadInt32();
            }

            count = reader.ReadInt32(); //spell_upgrades
            for (int i = 0; i < count; i++)
            {
                var id = reader.ReadInt32();
                var capacity = reader.ReadInt32();
            }

            count = reader.ReadInt32(); //hero_upgrades
            for (int i = 0; i < count; i++)
            {
                var id = reader.ReadInt32();
                var capacity = reader.ReadInt32();
            }

            count = reader.ReadInt32(); //hero_health
            for (int i = 0; i < count; i++)
            {
                var id = reader.ReadInt32();
                var capacity = reader.ReadInt32();
            }

            count = reader.ReadInt32(); //hero_state
            for (int i = 0; i < count; i++)
            {
                var id = reader.ReadInt32();
                var capacity = reader.ReadInt32();
            }

            count = reader.ReadInt32(); //alliance_units
            for (int i = 0; i < count; i++)
            {
                var id = reader.ReadInt32();
                var capacity = reader.ReadInt32();
                var level = reader.ReadInt32();
            }

            // more (needed?) values...
        }