Beispiel #1
0
 public S2CSyncAllPlayers(byte count) : base(249)
 {
     this.count = count;
     unk1       = new byte[]
     {
         00,
         99, 00,
         200, 00,
         100, 00,
         10, 00,
         16
     };
     name     = ByteUtils.ToByteArray("Night2", 16);
     pos      = new SunVector(-53f, -32f, -23f).GetBytes();
     slotCode = BitConverter.GetBytes((ushort)0);
     unk2     = BitConverter.GetBytes(0x14880500);
     unk3     = new byte[]
     {
         0, 0, 0, 0,
         1,
         42,
         70,
         3,
         0, 0, 0, 0, 0
     };
 }
Beispiel #2
0
            public C2SAskLogin(ByteBuffer buffer, Connection connection, sbyte[] key = null) : base(3, connection)
            {
                key = new sbyte[] { 00, 00, 00, 00 };
                //TODO implement dynamic key;
                _unk1 = buffer.ReadBlock(4);
                //get username without trailing zeros
                var uname = buffer.ReadBlock(50);

                for (int i = 0; i < uname.Length; i++)
                {
                    if (uname[i] == 0)
                    {
                        byte[] help = new byte[i];
                        Array.Copy(uname, help, i);
                        Username = Encoding.ASCII.GetString(help);
                        break;
                    }
                }

                _unk2        = buffer.ReadBlock(1);
                _encPassword = buffer.ReadBlock(16);
                var decPWBytes = TEA.passwordDecodeSBytes(ByteUtils.ToSbytes(_encPassword), key);

                DecPassword = Encoding.ASCII.GetString(ByteUtils.ToByteArray(decPWBytes));
                _unk3       = buffer.ReadBlock(8);
            }
Beispiel #3
0
            public byte[] getBytes()
            {
                var         nameBytes = ByteUtils.ToByteArray(name, 32);
                List <byte> packet    = new List <byte>();

                packet.AddRange(nameBytes);
                packet.Add(00);
                packet.Add((byte)serverNr);
                packet.Add(00);
                packet.Add(00);
                return(packet.ToArray());
            }
Beispiel #4
0
            public byte[] getBytes()
            {
                var         nameBytes = ByteUtils.ToByteArray(name, 32);
                List <byte> packet    = new List <byte>();

                packet.AddRange(nameBytes);
                packet.Add(00); // unk
                packet.Add((byte)belongToServerNr);
                packet.Add((byte)channelNr);
                packet.Add(01); //unk cant be 00
                packet.Add(00); //separator always 00
                return(packet.ToArray());
            }
Beispiel #5
0
 public CharacterInfo(Character character)
 {
     slot       = (byte)character.Slot;
     size       = 16;
     charName   = ByteUtils.ToByteArray(character.CharName, 16);
     heightCode = (byte)character.HeightCode;
     faceCode   = (byte)character.FaceCode;
     hairCode   = (byte)character.HairCode;
     classCode  = (byte)character.ClassCode;
     level      = ByteUtils.ToByteArray(character.Level, 2);
     region     = ByteUtils.ToByteArray(character.CharacterPosition.Region, 4);
     //position = new SunVector(character.CharacterPosition.LocationX,character.CharacterPosition.LocationY,character.CharacterPosition.LocationZ);
     posX        = ByteUtils.ToByteArray((short)character.CharacterPosition.LocationX, 2);
     posY        = ByteUtils.ToByteArray((short)character.CharacterPosition.LocationY, 2);
     posZ        = ByteUtils.ToByteArray((short)character.CharacterPosition.LocationZ, 2);
     equipNumber = 0;
     equipInfo   = new EquipInfo(character.Inventory.EquipItem).ToBytes();
     unk1        = 1;
     unk2        = ByteUtils.ToByteArray("", 32);
     unk3        = ByteUtils.ToByteArray("", 3);
     unk4        = ByteUtils.ToByteArray("", 4);
 }
Beispiel #6
0
 public CharacterInfo(int slot, int size, string charName, byte heightCode, byte faceCode, byte hairCode,
                      byte classCode, byte[] level, byte[] region, byte[] posX, byte[] posY,
                      byte[] posZ, byte iEquipNumber, byte[] equipInfo)
 {
     this.slot       = (byte)slot;
     this.size       = 0x10;
     this.charName   = ByteUtils.ToByteArray(charName, 16);
     this.heightCode = heightCode;
     this.faceCode   = faceCode;
     this.hairCode   = hairCode;
     this.classCode  = classCode;
     this.level      = level;
     this.region     = region;
     this.posX       = posX;
     this.posY       = posY;
     this.posZ       = posZ;
     //this.position = new SunVector(BitConverter.ToInt16(posX,0), BitConverter.ToInt16(posY, 0), BitConverter.ToInt16(posZ, 0));
     this.equipNumber = 0;
     this.equipInfo   = equipInfo;
     unk1             = 0;
     unk2             = ByteUtils.ToByteArray("", 32);
     unk3             = ByteUtils.ToByteArray("", 3);
     unk4             = ByteUtils.ToByteArray("", 4);
 }
 public S2CAnsWorldPrepare(string worldServerIp, int worldServerPort) : base(21)
 {
     ip   = ByteUtils.ToByteArray(worldServerIp, 32);
     port = ByteUtils.ToByteArray(worldServerPort, 5);
 }
Beispiel #8
0
 public S2CAnsServerSelect2(int userID, string agentIPAddress, int agentPort) : base(26)
 {
     //this.userID = ByteUtils.ToByteArray(userID, 4);
     this.agentIPAddress = ByteUtils.ToByteArray(agentIPAddress, 32);
     this.agentPort      = ByteUtils.ToByteArray(agentPort, 5);
 }