示例#1
0
        public static byte[] Avatar()
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteBytes(cb0t.Avatar.Data);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_AVATAR));
        }
示例#2
0
        public static byte[] RegisterCommand(String text, CryptoService c)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteString(text, c, false);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_AUTHREGISTER));
        }
示例#3
0
        public static byte[] Command(String text, CryptoService c)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteString(Helpers.FormatAresColorCodes(text), c, false);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_COMMAND));
        }
示例#4
0
        public static byte[] OnlineStatus(bool away, CryptoService c)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteString("cb0t_online_status", c);
            packet.WriteByte((byte)(away ? 3 : 1));
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_CUSTOM_DATA_ALL));
        }
示例#5
0
        public static byte[] Ignore(String name, bool ignore, CryptoService c)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteByte((byte)(ignore ? 1 : 0));
            packet.WriteString(name, c);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_IGNORELIST));
        }
示例#6
0
        public static byte[] Writing(bool writing, CryptoService c)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteString("cb0t_writing", c);
            packet.WriteByte((byte)(writing ? 2 : 1));
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_CUSTOM_DATA_ALL));
        }
示例#7
0
        public static byte[] CustomCbotData(String ident, byte[] data, CryptoService c)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteString("cb3_custom_" + ident, c);
            packet.WriteBytes(data);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_CUSTOM_DATA_ALL));
        }
示例#8
0
        public static byte[] Private(String name, String text, CryptoService c)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteString(name, c);
            packet.WriteString(Helpers.FormatAresColorCodes(text), c, false);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_PVT));
        }
示例#9
0
        public static byte[] Browse(String target, ushort ident, CryptoService c)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteUInt16(ident);
            packet.WriteByte(0);
            packet.WriteString(target, c);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_BROWSE));
        }
示例#10
0
        public static byte[] CustomPM(String target, String text, CryptoService c)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteString("cb0t_pm_msg", c);
            packet.WriteString(target, c);
            packet.WriteBytes(PMCrypto.SoftEncrypt(target, Encoding.UTF8.GetBytes(Helpers.FormatAresColorCodes(text))));
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_CUSTOM_DATA));
        }
示例#11
0
        public static byte[] NudgeReject(String target, CryptoService c)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteString("cb0t_nudge", c);
            packet.WriteString(target, c);
            packet.WriteBytes(new byte[] { 78, 65, 61, 61 });
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_CUSTOM_DATA));
        }
示例#12
0
        public static byte[] PMScribbleLast(String target, byte[] data, CryptoService c)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteString("cb0t_scribble_last", c);
            packet.WriteString(target, c);
            packet.WriteBytes(data);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_CUSTOM_DATA));
        }
示例#13
0
        public static byte[] ManualLag(String name, ulong time, CryptoService c)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteString("cb0t_latency_mcheck", c);
            packet.WriteString(name, c);
            packet.WriteUInt64(time);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_CUSTOM_DATA));
        }
示例#14
0
        public static byte[] ScribbleRoomChunk(byte[] data)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteBytes(data);
            byte[] buf = packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_SCRIBBLEROOM_CHUNK);
            packet = new TCPPacketWriter();
            packet.WriteBytes(buf);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_ADVANCED_FEATURES_PROTOCOL));
        }
示例#15
0
        public static byte[] BlockCustomNames(bool block)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteByte((byte)(block ? 1 : 0));
            byte[] buf = packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_BLOCK_CUSTOMNAMES);
            packet = new TCPPacketWriter();
            packet.WriteBytes(buf);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_ADVANCED_FEATURES_PROTOCOL));
        }
示例#16
0
        public static byte[] EnableClips()
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteByte((byte)(Settings.GetReg <bool>("vc_public", true) ? 1 : 0));
            packet.WriteByte((byte)(Settings.GetReg <bool>("vc_private", true) ? 1 : 0));
            byte[] buf = packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_VC_SUPPORTED);
            packet = new TCPPacketWriter();
            packet.WriteBytes(buf);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_ADVANCED_FEATURES_PROTOCOL));
        }
示例#17
0
        public static byte[] VoiceChunk(uint ident, byte[] data)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteUInt32(ident);
            packet.WriteBytes(data);
            byte[] buf = packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_VC_CHUNK);
            packet = new TCPPacketWriter();
            packet.WriteBytes(buf);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_ADVANCED_FEATURES_PROTOCOL));
        }
示例#18
0
        public static byte[] Nudge(String myName, String target, CryptoService c)
        {
            byte[] temp = Encoding.UTF8.GetBytes("0" + myName);
            temp = Hashlink.e67(temp, 0x5d0);
            temp = Encoding.Default.GetBytes(Convert.ToBase64String(temp));
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteString("cb0t_nudge", c);
            packet.WriteString(target, c);
            packet.WriteBytes(temp);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_CUSTOM_DATA));
        }
示例#19
0
        public static byte[] ScribbleRoomFirst(uint size, ushort chunks, byte[] data)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteUInt32(size);
            packet.WriteUInt16(chunks);
            packet.WriteBytes(data);
            byte[] buf = packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_SCRIBBLEROOM_FIRST);
            packet = new TCPPacketWriter();
            packet.WriteBytes(buf);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_ADVANCED_FEATURES_PROTOCOL));
        }
示例#20
0
        public static byte[] VoiceToChunk(String target, uint ident, byte[] data, CryptoService c)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteString(target, c);
            packet.WriteUInt32(ident);
            packet.WriteBytes(data);
            byte[] buf = packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_VC_CHUNK_TO);
            packet = new TCPPacketWriter();
            packet.WriteBytes(buf);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_ADVANCED_FEATURES_PROTOCOL));
        }
示例#21
0
        public static byte[] PersonalMessage(String text, CryptoService c)
        {
            TCPPacketWriter packet = new TCPPacketWriter();
            String          str    = text;

            if (str.Length > 100)
            {
                str = str.Substring(0, 100);
            }

            packet.WriteString(Helpers.FormatAresColorCodes(str), c, false);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_PERSONAL_MESSAGE));
        }
示例#22
0
        public static byte[] Login()
        {
            String          str;
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteGuid(Settings.Guid);
            packet.WriteUInt16(0);
            packet.WriteByte((byte)Settings.GetReg <int>("crypto", 250));
            packet.WriteUInt16(Settings.Port);
            packet.WriteIP("0.0.0.0");
            packet.WriteUInt16(65535);
            packet.WriteUInt32(0);
            packet.WriteString(Settings.GetReg <String>("username", String.Empty), true);
            packet.WriteString(Settings.APP_NAME + " " + Settings.APP_VERSION, true);
            packet.WriteIP(Settings.LocalIP);
            packet.WriteIP(Settings.LocalIP);
            packet.WriteByte(7);
            packet.WriteBytes(new byte[] { 0, 0, 0 });
            packet.WriteByte((byte)Settings.GetReg <int>("user_age", 0));
            packet.WriteByte((byte)Settings.GetReg <int>("user_gender", 0));
            packet.WriteByte((byte)Settings.GetReg <int>("user_country", 0));
            str = Settings.GetReg <String>("user_region", String.Empty);

            if (str.Length > 30)
            {
                str = str.Substring(0, 30);
            }

            packet.WriteString(str);
            ClientFeatures features = (ClientFeatures)0;

            if (Settings.GetReg <bool>("vc_public", true))
            {
                features |= ClientFeatures.CLIENT_SUPPORTS_OPUS_VC;
                features |= ClientFeatures.CLIENT_SUPPORTS_VC;
            }

            if (Settings.GetReg <bool>("vc_private", true))
            {
                features |= ClientFeatures.CLIENT_SUPPORTS_OPUS_PM_VC;
                features |= ClientFeatures.CLIENT_SUPPORTS_PM_VC;
            }

            if (Settings.CanHTML)
            {
                features |= ClientFeatures.CLIENT_SUPPORTS_HTML;
            }

            packet.WriteByte((byte)features);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_LOGIN));
        }
示例#23
0
        public static byte[] VoiceFirst(uint ident, byte len, byte compresses, uint size, byte[] data)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteUInt32(ident);
            packet.WriteByte(len);
            packet.WriteByte(compresses);
            packet.WriteUInt32(size);
            packet.WriteBytes(data);
            byte[] buf = packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_VC_FIRST);
            packet = new TCPPacketWriter();
            packet.WriteBytes(buf);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_ADVANCED_FEATURES_PROTOCOL));
        }
示例#24
0
        public static byte[] SecureAdminLogin(String password, uint cookie, IPAddress ip)
        {
            byte[] result;

            using (SHA1 sha1 = SHA1.Create())
            {
                List <byte> list = new List <byte>();
                list.AddRange(BitConverter.GetBytes(cookie));
                list.AddRange(ip.GetAddressBytes());
                list.AddRange(sha1.ComputeHash(Encoding.UTF8.GetBytes(password)));
                TCPPacketWriter packet = new TCPPacketWriter();
                packet.WriteBytes(sha1.ComputeHash(list.ToArray()));
                result = packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_AUTOLOGIN);
            }

            return(result);
        }
示例#25
0
        public static byte[] Font(bool new_sbot, CryptoService c)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteByte((byte)Settings.GetReg <int>("user_font_size", 10));
            packet.WriteString(Settings.GetReg <String>("user_font", "Tahoma"), c);
            packet.WriteByte(Helpers.HTMLColorToAresColor("#" + Settings.GetReg <String>("name_color", "000000")));
            packet.WriteByte(Helpers.HTMLColorToAresColor("#" + Settings.GetReg <String>("text_color", "0000FF")));

            if (new_sbot)
            {
                packet.WriteString("#" + Settings.GetReg <String>("name_color", "000000"), c);
                packet.WriteString("#" + Settings.GetReg <String>("text_color", "0000FF"), c);
            }

            byte[] buf = packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_CUSTOM_FONT);
            packet = new TCPPacketWriter();
            packet.WriteBytes(buf);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_ADVANCED_FEATURES_PROTOCOL));
        }
示例#26
0
        public static byte[] Update(CryptoService c)
        {
            String          str;
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteUInt16(0);
            packet.WriteByte(7);
            packet.WriteIP("0.0.0.0");
            packet.WriteUInt16(65535);
            packet.WriteIP(Settings.LocalIP);
            packet.WriteByte((byte)Settings.GetReg <int>("user_age", 0));
            packet.WriteByte((byte)Settings.GetReg <int>("user_gender", 0));
            packet.WriteByte((byte)Settings.GetReg <int>("user_country", 0));
            str = Settings.GetReg <String>("user_region", String.Empty);

            if (str.Length > 30)
            {
                str = str.Substring(0, 30);
            }

            packet.WriteString(str, c);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_UPDATE_STATUS));
        }
示例#27
0
        public static byte[] ClearAvatar()
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_AVATAR));
        }