예제 #1
0
파일: AFK.cs 프로젝트: jaryn-kubik/RazorEx
 private static void OnCompressedGump(PacketReader p, PacketHandlerEventArgs e)
 {
     p.MoveToData();
     uint sender = p.ReadUInt32();
     uint id = p.ReadUInt32();
     if (id == responseID)
         _responseSender = sender;
     if (id != compressedID)
         return;
     p.Seek(19, SeekOrigin.Begin);
     p.Seek(p.ReadInt32(), SeekOrigin.Current);
     int lines = p.ReadInt32(), cLen = p.ReadInt32(), dLen = p.ReadInt32();
     if (cLen < 5)
         return;
     byte[] buffer = new byte[dLen];
     ZLib.uncompress(buffer, ref dLen, p.CopyBytes(p.Position, cLen - 4), cLen - 4);
     string afk = string.Empty;
     for (int i = 0, pos = 0; i < lines; i++)
     {
         int strLen = (buffer[pos++] << 8) | buffer[pos++];
         string str = Encoding.BigEndianUnicode.GetString(buffer, pos, strLen * 2);
         int index = str.IndexOf('>');
         if (index != -1 && index < str.Length - 1)
             afk += str[index + 1].ToString().ToUpper().Normalize(NormalizationForm.FormD)[0];
         pos += strLen * 2;
     }
     afk = afk.Trim();
     if (afk.Length == 5 && _responseSender != 0)
     {
         /*ClientCommunication.SendToClient(new CloseGump(responseID));
         WorldEx.SendToServer(new GumpResponse(responseSender, responseID, 0x310, new int[0], new[] { new GumpTextEntry(0x310, afk) }));
         responseSender = 0;*/
         WorldEx.OverHeadMessage(afk);
     }
 }
예제 #2
0
파일: SOS.cs 프로젝트: jaryn-kubik/RazorEx
        private static void OnCompressedGump(PacketReader p, PacketHandlerEventArgs e)
        {
            p.Seek(7, SeekOrigin.Begin);
            if (p.ReadUInt32() != 0x1105B263)
                return;

            p.Seek(19, SeekOrigin.Begin);
            p.Seek(p.ReadInt32() + 4, SeekOrigin.Current);
            int cLen = p.ReadInt32(), dLen = p.ReadInt32();
            byte[] buffer = new byte[dLen];
            ZLib.uncompress(buffer, ref dLen, p.CopyBytes(p.Position, cLen - 4), cLen - 4);
            int strLen = (buffer[0] << 8) | buffer[1];
            string[] str = Encoding.BigEndianUnicode.GetString(buffer, 2, strLen * 2).Split(',');

            string[] lat = str[0].Split('°');
            int yLat = int.Parse(lat[0]);
            int yMins = int.Parse(lat[1].Split('\'')[0]);
            bool ySouth = lat[1][lat[1].Length - 1] == 'S';

            string[] lon = str[1].Split('°');
            int xLong = int.Parse(lon[0]);
            int xMins = int.Parse(lon[1].Split('\'')[0]);
            bool xEast = lon[1][lon[1].Length - 1] == 'E';

            const int xWidth = 5120;
            const int yHeight = 4096;
            const int xCenter = 1323;
            const int yCenter = 1624;

            double absLong = xLong + ((double)xMins / 60);
            double absLat = yLat + ((double)yMins / 60);

            if (!xEast)
                absLong = 360.0 - absLong;

            if (!ySouth)
                absLat = 360.0 - absLat;

            int x = xCenter + (int)((absLong * xWidth) / 360);
            int y = yCenter + (int)((absLat * yHeight) / 360);

            if (x < 0)
                x += xWidth;
            else if (x >= xWidth)
                x -= xWidth;

            if (y < 0)
                y += yHeight;
            else if (y >= yHeight)
                y -= yHeight;

            onGump(x, y);
        }
예제 #3
0
 private static void OnHuedEffect(PacketReader p, PacketHandlerEventArgs args)
 {
     byte type = p.ReadByte();
     Serial src = p.ReadUInt32();
     Serial dest = p.ReadUInt32();
     ItemID itemID = p.ReadUInt16();
     p.Seek(10, SeekOrigin.Current);
     byte speed = p.ReadByte();
     byte count = p.ReadByte();
     p.ReadUInt32();
     uint hue = p.ReadUInt32();
     uint mode = p.ReadUInt32();
     Handle(huedEffect, args, type, src, dest, itemID, speed, count, hue, mode);
 }
        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
        }
예제 #5
0
        private static void CreateCharacter( PacketReader p, PacketHandlerEventArgs args )
        {
            p.Seek( 1+4+4+1, SeekOrigin.Begin ); // skip begining crap
            World.OrigPlayerName = p.ReadStringSafe( 30 );

            PlayCharTime = DateTime.Now;

            if ( Engine.MainWindow != null )
                Engine.MainWindow.UpdateControlLocks();
        }
예제 #6
0
        private static void Skills( PacketReader p, PacketHandlerEventArgs args )
        {
            if ( World.Player == null || World.Player.Skills == null || Engine.MainWindow == null )
                return;

            byte type = p.ReadByte();

            switch ( type )
            {
                case 0x02://list (with caps, 3.0.8 and up)
                {
                    int i;
                    while ( (i = p.ReadUInt16()) > 0 )
                    {
                        if ( i>0 && i <= Skill.Count )
                        {
                            Skill skill = World.Player.Skills[i-1];

                            if ( skill == null )
                                continue;

                            skill.FixedValue = p.ReadUInt16();
                            skill.FixedBase = p.ReadUInt16();
                            skill.Lock = (LockType)p.ReadByte();
                            skill.FixedCap = p.ReadUInt16();
                            if ( !World.Player.SkillsSent )
                                skill.Delta = 0;
                            ClientCommunication.PostSkillUpdate( i-1, skill.FixedBase );
                        }
                        else
                        {
                            p.Seek( 7, SeekOrigin.Current );
                        }
                    }

                    World.Player.SkillsSent = true;
                    Engine.MainWindow.RedrawSkills();
                    break;
                }

                case 0x00: // list (without caps, older clients)
                {
                    int i;
                    while ( (i = p.ReadUInt16()) > 0 )
                    {
                        if ( i>0 && i <= Skill.Count )
                        {
                            Skill skill = World.Player.Skills[i-1];

                            if ( skill == null )
                                continue;

                            skill.FixedValue = p.ReadUInt16();
                            skill.FixedBase = p.ReadUInt16();
                            skill.Lock = (LockType)p.ReadByte();
                            skill.FixedCap = 100;//p.ReadUInt16();
                            if ( !World.Player.SkillsSent )
                                skill.Delta = 0;

                            ClientCommunication.PostSkillUpdate( i-1, skill.FixedBase );
                        }
                        else
                        {
                            p.Seek( 5, SeekOrigin.Current );
                        }
                    }

                    World.Player.SkillsSent = true;
                    Engine.MainWindow.RedrawSkills();
                    break;
                }

                case 0xDF: //change (with cap, new clients)
                {
                    int i = p.ReadUInt16();

                    if ( i >= 0 && i < Skill.Count )
                    {
                        Skill skill = World.Player.Skills[i];

                        if ( skill == null )
                            break;

                        ushort old = skill.FixedBase;
                        skill.FixedValue = p.ReadUInt16();
                        skill.FixedBase = p.ReadUInt16();
                        skill.Lock = (LockType)p.ReadByte();
                        skill.FixedCap = p.ReadUInt16();
                        Engine.MainWindow.UpdateSkill( skill );

                        if ( Config.GetBool( "DisplaySkillChanges" ) && skill.FixedBase != old )
                            World.Player.SendMessage( MsgLevel.Force, LocString.SkillChanged, (SkillName)i, skill.Delta > 0 ? "+" : "", skill.Delta, skill.Value, skill.FixedBase - old > 0 ? "+" : "", ((double)( skill.FixedBase - old )) / 10.0 );
                        ClientCommunication.PostSkillUpdate( i, skill.FixedBase );
                    }
                    break;
                }

                case 0xFF: //change (without cap, older clients)
                {
                    int i = p.ReadUInt16();

                    if ( i >= 0 && i < Skill.Count )
                    {
                        Skill skill = World.Player.Skills[i];

                        if ( skill == null )
                            break;

                        ushort old = skill.FixedBase;
                        skill.FixedValue = p.ReadUInt16();
                        skill.FixedBase = p.ReadUInt16();
                        skill.Lock = (LockType)p.ReadByte();
                        skill.FixedCap = 100;
                        Engine.MainWindow.UpdateSkill( skill );
                        if ( Config.GetBool( "DisplaySkillChanges" ) && skill.FixedBase != old )
                            World.Player.SendMessage( MsgLevel.Force, LocString.SkillChanged, (SkillName)i, skill.Delta > 0 ? "+" : "", skill.Delta, skill.Value, ((double)( skill.FixedBase - old )) / 10.0, skill.FixedBase - old > 0 ? "+" : "" );
                        ClientCommunication.PostSkillUpdate( i, skill.FixedBase );
                    }
                    break;
                }
            }
        }
예제 #7
0
 private static void TargetResponse(PacketReader p, PacketHandlerEventArgs args)
 {
     p.Seek(7, SeekOrigin.Begin);
     args.Block = items.ContainsKey(p.ReadUInt32());
 }
예제 #8
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)
        {
            var offset = 0x2A;
            LastVisit = TimeSpan.FromSeconds(reader.ReadInt32());
            Unknown1 = reader.ReadInt32();
            Timestamp = DateTimeConverter.FromUnixTimestamp(reader.ReadInt32());
            Unknown2 = reader.ReadInt32();
            UserID = reader.ReadInt64();
            ShieldDuration = TimeSpan.FromSeconds(reader.ReadInt32());
            Unknown3 = reader.ReadInt32();
            Unknown4 = reader.ReadInt32();
            Compressed = reader.ReadBoolean();
            Home = new Village();
            Home.Read(reader);

            Avatar = new Avatar();
            // Seems like a whole object
            Unknown6 = reader.ReadInt32();
            UserID1 = reader.ReadInt64();
            UserID2 = reader.ReadInt64();
            Avatar.ID = UserID1;

            switch (reader.ReadByte())
            {
                case 0:
                    break;

                case 1:
                    Avatar.Clan = new Clan();
                    Avatar.Clan.ID = reader.ReadInt64();
                    Avatar.Clan.Name = reader.ReadString();
                    Avatar.Clan.Badge = reader.ReadInt32();
                    reader.ReadInt32();
                    Avatar.Clan.Level = reader.ReadInt32();
                    offset += 1;
                    break;

                case 2: // clanless but clan castle built?
                    var lel = reader.ReadInt64();
                    break;
            }

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

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

            reader.Seek(offset, SeekOrigin.Current);
            Unknown11 = reader.ReadInt32();
            AllianceCastleLevel = reader.ReadInt32(); // -1 if not constructed
            AllianceCastleUnitCapacity = reader.ReadInt32();
            AllianceCastleUnitCount = reader.ReadInt32();
            Avatar.TownHallLevel = reader.ReadInt32();
            Avatar.Username = reader.ReadString();
            FacebookID = reader.ReadString();
            Avatar.Level = reader.ReadInt32();
            Avatar.Experience = reader.ReadInt32();
            Avatar.Gems = reader.ReadInt32();
            Gems1 = reader.ReadInt32();
            Unknown14 = reader.ReadInt32();
            Unknown15 = reader.ReadInt32();
            Avatar.Trophies = reader.ReadInt32();
            Avatar.AttacksWon = reader.ReadInt32();
            Avatar.AttacksLost = reader.ReadInt32();
            Avatar.DefencesWon = reader.ReadInt32();
            Avatar.DefencesLost = reader.ReadInt32();
            Unknown16 = reader.ReadInt32();
            Unknown17 = reader.ReadInt32();
            Unknown18 = reader.ReadInt32();
            if (Unknown19 = reader.ReadBoolean())
                Unknown20 = reader.ReadInt64();
            Unknown21 = reader.ReadByte();
            Unknown22 = reader.ReadInt32();
            Unknown23 = reader.ReadInt32();
            Unknown24 = reader.ReadInt32();
            Unknown25 = reader.ReadInt32();

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

            var count2 = reader.ReadInt32();
            for (int i = 0; i < count2; i++)
            {
                var id = reader.ReadInt32(); // resource id from resources.csv
                var amount = reader.ReadInt32();
            }

            var count3 = reader.ReadInt32();
            for (int i = 0; i < count3; i++)
            {
                var id = reader.ReadInt32(); // unit id from characters.csv
                var amount = reader.ReadInt32();
            }

            var count4 = reader.ReadInt32();
            for (int i = 0; i < count4; i++)
            {
                var id = reader.ReadInt32(); // spell id from spells.csv
                var amount = reader.ReadInt32();
            }

            var count5 = reader.ReadInt32();
            for (int i = 0; i < count5; i++)
            {
                var id = reader.ReadInt32(); // unit id from characters.csv
                var level = reader.ReadInt32();
            }

            var count6 = reader.ReadInt32();
            for (int i = 0; i < count6; i++)
            {
                var id = reader.ReadInt32(); // spell id from spells.csv
                var level = reader.ReadInt32();
            }

            var count7 = reader.ReadInt32();
            for (int i = 0; i < count7; i++)
            {
                var id = reader.ReadInt32(); // hero id from heros.csv
                var level = reader.ReadInt32();
            }

            var count8 = reader.ReadInt32();
            for (int i = 0; i < count8; i++)
            {
                var id = reader.ReadInt32(); // hero id from heros.csv
                var health = reader.ReadInt32();
            }

            var count9 = reader.ReadInt32();
            for (int i = 0; i < count9; i++)
            {
                var id = reader.ReadInt32(); // hero id from heros.csv
                var state = reader.ReadInt32();
            }

            var count10 = reader.ReadInt32();
            for (int i = 0; i < count10; i++)
            {
                var id = reader.ReadInt32(); // unit id from characters.csv
                var amount = reader.ReadInt32();
                var level = reader.ReadInt32();
            }

            var count11 = reader.ReadInt32();
            for (int i = 0; i < count11; i++)
            {
                var id = reader.ReadInt32(); // mission id from missions.csv
            }

            var count12 = reader.ReadInt32();
            for (int i = 0; i < count12; i++)
            {
                var id = reader.ReadInt32(); // achievement id from achievements.csv
            }

            var count13 = reader.ReadInt32();
            for (int i = 0; i < count13; i++)
            {
                var id = reader.ReadInt32(); // achievement id from achievements.csv
                var progress = reader.ReadInt32();
            }

            var count14 = reader.ReadInt32();
            for (int i = 0; i < count14; i++)
            {
                var id = reader.ReadInt32(); // npc id from npcs.csv
                var stars = reader.ReadInt32();
            }

            var count15 = reader.ReadInt32();
            for (int i = 0; i < count15; i++)
            {
                var id = reader.ReadInt32(); // npc id from npcs.csv
                var gold = reader.ReadInt32();
            }

            var count16 = reader.ReadInt32();
            for (int i = 0; i < count16; i++)
            {
                var id = reader.ReadInt32(); // npc id from npcs.csv
                var elixir = reader.ReadInt32();
            }

            Unknown26 = reader.ReadInt32();
            Unknown27 = reader.ReadInt32();
            Unknown28 = reader.ReadInt32();
        }
예제 #10
0
 private static void OnGumpResponse(PacketReader p, PacketHandlerEventArgs e)
 {
     p.Seek(7, SeekOrigin.Begin);
     if (p.ReadUInt32() != 0x0322B295)
         return;
     uint button = p.ReadUInt32();
     if (button > 400 && button < 410)
         IsAuberon = true;
     else
         IsAuberon = false;
 }
예제 #11
0
        private static void Skills( PacketReader p )
        {
            if ( World.Player == null )
                return;

            byte type = p.ReadByte();

            switch ( type )
            {
                case 0x02://list (with caps, 3.0.8 and up)
                {
                    int i;
                    while ( (i = p.ReadUInt16()) > 0 )
                    {
                        if ( i>0 && i <= Skill.Count )
                        {
                            Skill skill = World.Player.Skills[i-1];

                            skill.FixedValue = p.ReadUInt16();
                            skill.FixedBase = p.ReadUInt16();
                            skill.Lock = (LockType)p.ReadByte();
                            skill.FixedCap = p.ReadUInt16();
                        }
                        else
                        {
                            p.Seek( 7, SeekOrigin.Current );
                        }
                    }
                    break;
                }

                case 0xDF://change (with cap, new clients)
                {
                    int i = p.ReadUInt16();

                    if ( i >= 0 && i < Skill.Count )
                    {
                        Skill skill = World.Player.Skills[i];

                        skill.FixedValue = p.ReadUInt16();
                        skill.FixedBase = p.ReadUInt16();
                        skill.Lock = (LockType)p.ReadByte();
                        skill.FixedCap = p.ReadUInt16();
                    }
                    break;
                }

                case 0x00: // list (without caps, older clients)
                {
                    int i;
                    while ( (i = p.ReadUInt16()) > 0 )
                    {
                        if ( i>0 && i <= Skill.Count )
                        {
                            Skill skill = World.Player.Skills[i-1];

                            skill.FixedValue = p.ReadUInt16();
                            skill.FixedBase = p.ReadUInt16();
                            skill.Lock = (LockType)p.ReadByte();
                            skill.FixedCap = 100;//p.ReadUInt16();
                        }
                        else
                        {
                            p.Seek( 5, SeekOrigin.Current );
                        }
                    }
                    break;
                }

                case 0xFF://change (without cap, older clients)
                {
                    int i = p.ReadUInt16();

                    if ( i >= 0 && i < Skill.Count )
                    {
                        Skill skill = World.Player.Skills[i];

                        skill.FixedValue = p.ReadUInt16();
                        skill.FixedBase = p.ReadUInt16();
                        skill.Lock = (LockType)p.ReadByte();
                        skill.FixedCap = 100;
                    }
                    break;
                }
            }
        }
예제 #12
0
        private static void MobileStatus( PacketReader p )
        {
            Serial serial = p.ReadUInt32();
            Mobile m = World.FindMobile( serial );
            if ( m == null )
                World.AddMobile( m = new Mobile( serial ) );

            m.Name = p.ReadString( 30 );

            m.Hits = p.ReadUInt16();
            m.HitsMax = p.ReadUInt16();

            p.ReadBoolean();//CanBeRenamed

            byte type = p.ReadByte();

            if ( m == World.Player && type != 0x00 )
            {
                PlayerData player = (PlayerData)m;

                player.Female = p.ReadBoolean();

                player.Str = p.ReadUInt16();
                player.Dex = p.ReadUInt16();
                player.Int = p.ReadUInt16();

                player.Stam = p.ReadUInt16();
                player.StamMax = p.ReadUInt16();
                player.Mana = p.ReadUInt16();
                player.ManaMax = p.ReadUInt16();

                player.Gold = p.ReadUInt32();
                player.AR = p.ReadUInt16(); // ar / physical resist
                player.Weight = p.ReadUInt16();

                if ( type == 0x03 || type == 0x04 )
                {
                    player.StatCap = p.ReadUInt16();
                    player.Followers = p.ReadByte();
                    player.FollowersMax = p.ReadByte();

                    if ( type == 0x04 )
                    {
                        /*m_Stream.Write( (short) beheld.FireResistance ); // Fire
                        m_Stream.Write( (short) beheld.ColdResistance ); // Cold
                        m_Stream.Write( (short) beheld.PoisonResistance ); // Poison
                        m_Stream.Write( (short) beheld.EnergyResistance ); // Energy
                        m_Stream.Write( (short) 0 ); // Luck
                        m_Stream.Write( (short) 0 ); // Damage min
                        m_Stream.Write( (short) 0 ); // Damage max*/
                        p.Seek( 14, SeekOrigin.Current );
                        player.Tithe = p.ReadInt32();
                    }
                }
            }
        }
        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...
        }