Exemple #1
0
 public void Nudge(String sender)
 {
     byte[] buf = Encoding.UTF8.GetBytes("0" + sender);
     buf = Crypto.e67(buf, 1488);
     buf = Encoding.Default.GetBytes(Convert.ToBase64String(buf));
     this.SendPacket(TCPOutbound.CustomData(this, sender, "cb0t_nudge", buf));
 }
Exemple #2
0
        private static void CustomDataAll(AresClient client, TCPPacketReader packet)
        {
            if (client.Quarantined || !client.Captcha)
            {
                return;
            }

            String ident = packet.ReadString(client);

            byte[] data = packet;

            if (ident.Contains("scribble"))
            {
                return;
            }

            if (ident.Contains("cb0t_writing") && client.Muzzled)
            {
                return;
            }

            UserPool.AUsers.ForEachWhere(x => x.SendPacket(TCPOutbound.CustomData(x, client.Name, ident, data)),
                                         x => x.LoggedIn && x.Vroom == client.Vroom && x.CustomClient && !x.Quarantined && x.ID != client.ID && !x.IgnoreList.Contains(client.Name));

            if (ServerCore.Linker.Busy && ServerCore.Linker.LoginPhase == LinkLeaf.LinkLogin.Ready)
            {
                ServerCore.Linker.SendPacket(LinkLeaf.LeafOutbound.LeafCustomDataAll(ServerCore.Linker, client.Vroom, client.Name, ident, data));
            }
        }
Exemple #3
0
        public void Scribble(String sender, byte[] img, int height)
        {
            List <byte> b = new List <byte>(img);

            if (b.Count <= 4000)
            {
                this.SendPacket(TCPOutbound.CustomData(this, sender, "cb0t_scribble_once", img));
            }
            else
            {
                List <byte[]> p = new List <byte[]>();

                while (b.Count > 4000)
                {
                    p.Add(b.GetRange(0, 4000).ToArray());
                    b.RemoveRange(0, 4000);
                }

                if (b.Count > 0)
                {
                    p.Add(b.ToArray());
                }

                for (int i = 0; i < p.Count; i++)
                {
                    if (i == 0)
                    {
                        this.SendPacket(TCPOutbound.CustomData(this, sender, "cb0t_scribble_first", p[i]));
                    }
                    else if (i == (p.Count - 1))
                    {
                        this.SendPacket(TCPOutbound.CustomData(this, sender, "cb0t_scribble_last", p[i]));
                    }
                    else
                    {
                        this.SendPacket(TCPOutbound.CustomData(this, sender, "cb0t_scribble_chunk", p[i]));
                    }
                }
            }
        }
Exemple #4
0
        private static void CustomData(AresClient client, TCPPacketReader packet)
        {
            if (client.Quarantined || !client.Captcha)
            {
                return;
            }

            String ident = packet.ReadString(client);
            String name  = packet.ReadString(client);

            byte[]     data   = packet;
            AresClient target = UserPool.AUsers.Find(x => x.Name == name && x.LoggedIn && x.CustomClient);

            if (ident == "cb0t_pm_msg")
            {
                if (target != null)
                {
                    if (target.IgnoreList.Contains(client.Name) || client.Muzzled)
                    {
                        client.SendPacket(TCPOutbound.IsIgnoringYou(client, name));
                    }
                    else
                    {
                        if (target.Cloaked)
                        {
                            client.SendPacket(TCPOutbound.OfflineUser(client, name));
                            return;
                        }

                        PMEventArgs args = new PMEventArgs {
                            Cancel = false, Text = "          "
                        };
                        Events.PrivateSending(client, target, args);

                        if (!args.Cancel && client.SocketConnected)
                        {
                            target.SendPacket(TCPOutbound.CustomData(target, client.Name, ident, data));
                            Events.PrivateSent(client, target, args.Text);
                        }
                    }
                }
                else
                {
                    client.SendPacket(TCPOutbound.OfflineUser(client, name));
                }
            }
            else if (ident == "cb0t_scribble_once" && target != null)
            {
                if (!Events.CanPrivateMessage(client, target) || !Events.CanScribble(client, true))
                {
                    return;
                }

                PMEventArgs args = new PMEventArgs {
                    Cancel = false, Text = "", IsScribble = true
                };
                Events.PrivateSending(client, target, args);

                if (args.Cancel || !client.SocketConnected)
                {
                    return;
                }

                if (target.IgnoreList.Contains(client.Name))
                {
                    return;
                }

                target.SendPacket(TCPOutbound.CustomData(target, client.Name, ident, data));
                Events.PrivateSent(client, target, args.Text);
            }
            else
            {
                if (target != null)
                {
                    if (!target.IgnoreList.Contains(client.Name))
                    {
                        target.SendPacket(TCPOutbound.CustomData(target, client.Name, ident, data));
                    }
                }
                else if (ServerCore.Linker.Busy && ServerCore.Linker.LoginPhase == LinkLeaf.LinkLogin.Ready)
                {
                    IClient linked = ServerCore.Linker.FindUser(x => x.Name == name && x.CustomClient);

                    if (linked != null)
                    {
                        ServerCore.Linker.SendPacket(LinkLeaf.LeafOutbound.LeafCustomDataTo(ServerCore.Linker,
                                                                                            linked.IUser.Link.Ident,
                                                                                            client.Name, linked.Name,
                                                                                            ident, data));
                    }
                }
            }
        }