예제 #1
0
파일: Crew.cs 프로젝트: sortaloc/DriftCity
        // We're still missing ~209 bytes of data

        /// <summary>
        /// TODO: Missing: 293 Bytes!
        /// </summary>
        /// <param name="writer"></param>
        public void Serialize(BinaryWriterExt writer)
        {
            writer.Write(Id);
            writer.Write(MarkId);
            writer.WriteUnicodeStatic(Name, 13);
            writer.WriteUnicodeStatic(Description, 61);
            writer.WriteAsciiStatic(Url, 33);
            writer.Write(CreateDate);
            writer.Write(CloseDate);
            writer.Write(BanishDate);
            writer.WriteAsciiStatic(OwnChannel, 24);
            writer.WriteAsciiStatic(State, 2);
            writer.Write(Ranking);
            writer.Write(Point);
            writer.Write(ChannelWinCnt);
            writer.Write(MemberCnt);
            writer.Write(TotalExp);
            writer.Write(TotalMoney);
            writer.Write(Version);
            writer.Write(OwnerId);
            writer.Write(LeaderId);
            writer.WriteUnicodeStatic(OwnerName, 21);
            writer.WriteUnicodeStatic(LeaderName, 21);
            writer.Write(new byte[293]);
        }
예제 #2
0
 public void SerializeShort(BinaryWriterExt writer)
 {
     writer.WriteUnicodeStatic(Name, 21);
     writer.Write(Id);
     writer.Write((int)Avatar);
     writer.Write((int)Level);
     writer.Write(ActiveVehicleId);
     writer.Write(ActiveCar.CarType);
     writer.Write(ActiveCar.BaseColor);
     writer.Write(CreationDate);
     writer.Write(CrewId);
     if (Crew != null)
     {
         writer.Write(Crew.MarkId);
         writer.WriteUnicodeStatic(Crew.Name, 13);
         writer.Write((short)CrewRank);
     }
     else
     {
         writer.Write(0L);       // Is there a reason we send 0L here and not -1L?
         writer.WriteUnicodeStatic("", 13);
         writer.Write((short)0); // Crew rank
     }
     writer.Write(Guild);
 }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="writer"></param>
        public void Serialize(BinaryWriterExt writer)
        {
            writer.Write(Id);
            writer.WriteUnicodeStatic(Name, 21);
            writer.WriteUnicodeStatic(LastMessageFrom, 11);
            writer.Write(LastDate);
            writer.Write(Avatar);
            writer.Write(Level);

            writer.Write(ExperienceInfo);

            writer.Write(MitoMoney);
            if (Crew == null)
            {
                writer.Write(-1L);
                writer.Write(0L);
                writer.WriteUnicodeStatic("", 13);
                writer.Write(0);
            }
            else
            {
                writer.Write(Crew.Id);
                writer.Write(Crew.MarkId);
                writer.WriteUnicodeStatic(Crew.Name, 13);
                writer.Write(CrewRank);
            }

            writer.Write(PartyType); // possibly 65 when admin or cheatable
            writer.Write(PvpCount);
            writer.Write(PvpWinCount);
            writer.Write(PvpPoint);
            writer.Write(TeamPvpCount);
            writer.Write(TeamPvpWinCount);
            writer.Write(TeamPvpPoint);
            writer.Write(QuickCount);
            writer.Write(0);             // unknown
            writer.Write(0);             // unknown
            writer.Write(TotalDistance); // NOPE! TotalDistance says 62!
            writer.Write(Position);
            writer.Write(LastChannel);
            writer.Write(City);
            writer.Write(PosState);
            writer.Write(ActiveVehicleId);
            writer.Write(QuickSlot1);
            writer.Write(QuickSlot2);
            writer.Write(TeamJoinDate);
            writer.Write(TeamCloseDate);
            writer.Write(TeamLeaveDate);
            writer.Write(new byte[12]); // filler
            writer.Write(InventoryLevel);
            writer.Write(GarageLevel);
            writer.Write(new byte[42]); // filler
            writer.Write(Flags);
            writer.Write((int)Guild);
            //writer.Write(new byte[38]); // filler
            //writer.Write(GPTeam); // DCGP team
        }
예제 #4
0
        public override byte[] GetBytes()
        {
            using (var ms = new MemoryStream())
            {
                using (var bs = new BinaryWriterExt(ms))
                {
                    bs.Write(Areas.Length);
                    foreach (var area in Areas)
                    {
                        bs.Write(area.AreaId);
                        bs.Write(area.CurrentPlayers);
                        bs.Write(area.MaxPlayers);
                        bs.Write(area.ChannelState);
                        bs.Write(area.Tax);
                        bs.Write(area.TeamId);
                        bs.Write(area.TeamMarkId);
                        bs.WriteUnicodeStatic(area.TeamName, 13);
                        bs.Write(area.Ranking);
                        bs.Write(area.Point);
                        bs.Write(area.WinCount);
                        bs.Write(area.MemberCount);
                        bs.Write(area.OwnerId);
                        bs.WriteUnicodeStatic(area.OwnerName, 21);
                        bs.Write(area.TotalExp);
                        bs.Write((long)0); // ??????
                    }
                }
                return(ms.ToArray());
            }

            /*
             * var ack = new Packet(Packets.AreaListAck);
             * ack.Writer.Write((uint) 10);
             * for (var k = 0; k < 10; ++k)
             * {
             *  ack.Writer.Write(k); // AreaId
             *  ack.Writer.Write(0); // Current?
             *  ack.Writer.Write(100); // Max?
             *  ack.Writer.Write(1); // ChannelState
             *  ack.Writer.Write((float) 0); // Tax?
             *
             *  ack.Writer.Write((long) 0); // teamID?
             *  ack.Writer.Write((long) 0); // teamMarkID
             *  ack.Writer.WriteUnicodeStatic("Staff", 13); // TeamName
             *  ack.Writer.Write((uint) 0); // Ranking
             *  ack.Writer.Write((uint) 0); // Point
             *  ack.Writer.Write((uint) 0); // WinCnt
             *  ack.Writer.Write(20); // Membercnt
             *  ack.Writer.Write((long) 1); // OwnerId
             *  ack.Writer.WriteUnicodeStatic("Administrator", 21); // OwnerName
             *  ack.Writer.Write((long) 0); // TotalExp
             *  ack.Writer.Write((long) 0); // ????????
             * }
             */
        }
예제 #5
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var bs = new BinaryWriterExt(ms))
         {
             bs.WriteUnicodeStatic(MessageType, 10);
             bs.WriteUnicodeStatic(SenderCharacterName, 18);
             bs.WriteUnicode(Message);
         }
         return(ms.ToArray());
     }
 }
예제 #6
0
파일: Crew.cs 프로젝트: sortaloc/DriftCity
 public void SerializeShort(BinaryWriterExt writer)
 {
     writer.Write(Id);
     writer.Write(MarkId);
     writer.WriteUnicodeStatic(Name, 14);
     writer.Write((ushort)0); // NLevel?
 }
예제 #7
0
        /*
         * struct XiPlayerInfo
         * {
         * wchar_t Cname[13];
         * unsigned __int16 Serial;
         * unsigned __int16 Age;
         * __unaligned __declspec(align(1)) __int64 Cid;
         * unsigned __int16 Level;
         * unsigned int Exp;
         * __unaligned __declspec(align(1)) __int64 TeamId;
         * __unaligned __declspec(align(1)) __int64 TeamMarkId;
         * wchar_t TeamName[14];
         * unsigned __int16 TeamNLevel;
         * XiVisualItem VisualItem;
         * float UseTime;
         * };
         */

        /// <summary>
        /// 216 length but 150 bytes used!
        /// Leaked files has 156 bytes :/
        /// </summary>
        /// <param name="writer"></param>
        public void Serialize(BinaryWriterExt writer)
        {
            writer.WriteUnicodeStatic(Character.Name, 13, true); // 26
            writer.Write(Serial);                                // 2
            writer.Write(Age);                                   // 2

            writer.Write(Character.Id);                          // 8
            writer.Write(Character.Level);                       // 2
            writer.Write(Character.ExperienceInfo.BaseExp);      // 4

            //writer.Write(Character.TeamId); // 8
            if (Character.Crew == null)
            {
                new Crew().SerializeShort(writer);
            }
            else
            {
                Character.Crew.SerializeShort(writer);

                /*
                 * writer.Write(Character.Team.MarkId); // 8
                 * writer.WriteUnicodeStatic(Character.Team.Name, 14, true);
                 * writer.Write(TeamNLevel); // 2
                 */
            }
            writer.Write(VisualItem); // 50?
            writer.Write(UseTime);    // 4

            writer.Write(new byte[60]);

            //writer.Write(new byte[186]);
        }
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var bs = new BinaryWriterExt(ms))
         {
             bs.WriteUnicodeStatic(CharacterName, 21);
         }
         return(ms.ToArray());
     }
 }
예제 #9
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var bs = new BinaryWriterExt(ms))
         {
             bs.Write(Availability ? 1 : 0);
             bs.WriteUnicodeStatic(TeamName, 12);
         }
         return(ms.ToArray());
     }
 }
예제 #10
0
        public override byte[] GetBytes()
        {
            using (var ms = new MemoryStream())
            {
                using (var bs = new BinaryWriterExt(ms))
                {
                    bs.WriteUnicodeStatic(ChannelName, 10);
                    bs.WriteUnicodeStatic(CharacterName, 16);
                    bs.Write(Serial);
                    bs.Write(SessionAge);
                }
                return(ms.ToArray());
            }

            /*
             * ack.Writer.WriteUnicodeStatic("speeding", 10); // ChannelName
             * ack.Writer.WriteUnicodeStatic("charName", 16); // CharName
             *
             * ack.Writer.Write((ushort) 123); // Serial
             * ack.Writer.Write((ushort) 123); // Session Age
             */
        }
예제 #11
0
        public string PlateString; // 9

        public void Serialize(BinaryWriterExt writer)
        {
            writer.Write(Neon);
            writer.Write(Plate);
            writer.Write(Decal);
            writer.Write(DecalColor);
            writer.Write(AeroBumper);
            writer.Write(AeroIntercooler);
            writer.Write(AeroSet);
            writer.Write(MufflerFlame);
            writer.Write(Wheel);
            writer.Write(Spoiler);
            foreach (short r in Reserve)
            {
                writer.Write(r);
            }
            writer.WriteUnicodeStatic(PlateString, 9);
        }
예제 #12
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var bs = new BinaryWriterExt(ms))
         {
             bs.Write(Ticket);
             bs.Write(Result);
             bs.Write(Time);
             bs.Write(new byte[64]); // Filler. Unused? ("STicket") <-- 78 ?!
             bs.Write(ServerListId);
             bs.Write(ServerCount);
             for (var i = 0; i < Servers.Length; i++)
             {
                 bs.WriteUnicodeStatic(Servers[i].ServerName, 32); // 32
                 bs.Write(Servers[i].ServerId);
                 bs.Write(Servers[i].PlayerCount);
                 bs.Write(Servers[i].MaxPlayers);
                 bs.Write(Servers[i].ServerState);
                 bs.Write(Servers[i].GameTime);
                 bs.Write(Servers[i].LobbyTime);
                 bs.Write(Servers[i].Area1Time);
                 bs.Write(Servers[i].Area2Time);
                 bs.Write(Servers[i].RankingUpdateTime);
                 bs.Write(Servers[i].GameServerIp);
                 bs.Write(Servers[i].LobbyServerIp);
                 bs.Write(Servers[i].AreaServer1Ip);
                 bs.Write(Servers[i].AreaServer2Ip);
                 bs.Write(Servers[i].RankingServerIp);
                 bs.Write(Servers[i].GameServerPort);
                 bs.Write(Servers[i].LobbyServerPort);
                 bs.Write(Servers[i].AreaServerPort);
                 bs.Write(Servers[i].AreaServer2Port);
                 bs.Write(Servers[i].AreaServerUdpPort);
                 bs.Write(Servers[i].AreaServer2UdpPort);
                 bs.Write(Servers[i].RankingServerPort);
             }
         }
         return(ms.ToArray());
     }
 }
예제 #13
0
        public override byte[] GetBytes()
        {
            using (var ms = new MemoryStream())
            {
                using (var bs = new BinaryWriterExt(ms))
                {
                    bs.Write(VehicleSerial); // Serial?
                    bs.Write(StartPos);

                    bs.Write(EndPos);

                    bs.Write(Type);          // Type?
                    bs.Write(CourseId);      // CourseId

                    bs.Write(FirstHuvLevel); // HUV first level
                    bs.Write(FirstHuvId);    // HUV first Id
                    bs.WriteUnicodeStatic(PosName, 100);
                }
                return(ms.ToArray());
            }
        }
예제 #14
0
        public override int ExpectedSize() => (120 * (Characters.Length - 1)) + 194; // 194 => 74 + 120!!

        public override byte[] GetBytes()
        {
            using (var ms = new MemoryStream())
            {
                using (var bs = new BinaryWriterExt(ms))
                {
                    bs.Write(Permissions);
                    //bs.Write(CharacterCount);
                    bs.Write(Characters.Length);
                    bs.WriteUnicodeStatic(Username, 18);
                    bs.Write((long)0);
                    bs.Write((long)0);
                    bs.Write((long)0);
                    bs.Write(0);
                    // --- 74 --- //

                    foreach (var character in Characters)
                    {
                        character.SerializeShort(bs);
                    }
                }
                return(ms.ToArray());
            }
        }
예제 #15
0
        // TODO: Serious logic mistake here. Telling the client to wait for another batch of friends, but never sending this
        public override byte[] GetBytes()
        {
            using (var ms = new MemoryStream())
            {
                using (var bs = new BinaryWriterExt(ms))
                {
                    var totalFriends = FriendList.Length;
                    if (totalFriends > 12)
                    {
                        var pktNum = totalFriends / 12 + 1; // Send maximum 12 friends per batch.
                        for (uint pktIdx = 0; pktIdx < pktNum; ++pktIdx)
                        {
                            uint sendItemCnt = 12;
                            if (pktIdx + 1 >= pktNum)
                            {
                                sendItemCnt = (uint)totalFriends - 12 * pktIdx;
                            }

                            bs.Write(sendItemCnt);
                            if (pktIdx < pktNum)
                            {
                                bs.Write(262145); // Send client that more packets coming after this one.
                            }
                            else
                            {
                                bs.Write(0x40000);
                            }
                            // Fill friends list
                            foreach (var friend in FriendList)
                            {
                                bs.WriteUnicodeStatic(friend.CharacterName, 21);
                                bs.WriteUnicodeStatic(friend.CrewName, 13);
                                bs.Write(friend.CharacterId);
                                bs.Write(friend.CrewId);
                                bs.Write(friend.CrewMarkId);
                                bs.Write(friend.State);

                                bs.Write(friend.Serial);
                                bs.Write(friend.LocationType);
                                bs.Write(friend.ChannelId);
                                bs.Write(friend.LocationId);
                                bs.Write(friend.Level);
                                bs.Write(friend.CurCarGrade);
                                bs.Write(friend.Serial);
                            }
                        }
                    }
                    else
                    {
                        bs.Write(totalFriends);
                        bs.Write(0x40000);
                        // Fill friends list
                        foreach (var friend in FriendList)
                        {
                            bs.WriteUnicodeStatic(friend.CharacterName, 21);
                            bs.WriteUnicodeStatic(friend.CrewName, 13);
                            bs.Write(friend.CharacterId);
                            bs.Write(friend.CrewId);
                            bs.Write(friend.CrewMarkId);
                            bs.Write(friend.State);

                            bs.Write(friend.Serial);
                            bs.Write(friend.LocationType);
                            bs.Write(friend.ChannelId);
                            bs.Write(friend.LocationId);
                            bs.Write(friend.Level);
                            bs.Write(friend.CurCarGrade);
                            bs.Write(friend.Serial);
                        }
                    }
                }
                return(ms.ToArray());
            }

            /*ack.Writer.Write(1); // Friendlist size
             * ack.Writer.Write(0x40000); // or 262145 //ListUpdate
             *
             * // Friend / XiStrFriend
             * ack.Writer.WriteUnicodeStatic("TESTING", 21); // Name
             * ack.Writer.WriteUnicodeStatic("Staff", 13); // Team Name
             * ack.Writer.Write(1L); // Cid
             * ack.Writer.Write(1L); // TeamId
             * ack.Writer.Write(1L); // TeamMarkId
             * ack.Writer.Write(0); // State (0 = Blocked?)
             *
             * // StrLocation
             * ack.Writer.Write((uint)0); // Serial
             * ack.Writer.Write('A'); // LocType
             * ack.Writer.Write('A'); // ChId
             * ack.Writer.Write((ushort)1); // LocId
             *
             * ack.Writer.Write((ushort)1); // Level
             * ack.Writer.Write((ushort)1); // CurCarGrade
             * ack.Writer.Write((uint)0); // Serial
             *
             * client.Send(ack);*/
        }