Esempio n. 1
0
        public void SendEmote(String text)
        {
            if (!String.IsNullOrEmpty(text) && !this.Quarantined)
            {
                UserPool.AUsers.ForEachWhere(x => x.SendPacket(TCPOutbound.Emote(x, this.Name, text)),
                                             x => x.LoggedIn && x.Vroom == this.Vroom && !x.IgnoreList.Contains(this.Name) && !x.Quarantined);

                UserPool.WUsers.ForEachWhere(x => x.QueuePacket(ib0t.WebOutbound.EmoteTo(x, this.Name, text)),
                                             x => x.LoggedIn && x.Vroom == this.Vroom && !x.IgnoreList.Contains(this.Name) && !x.Quarantined);

                if (ServerCore.Linker.Busy && ServerCore.Linker.LoginPhase == LinkLeaf.LinkLogin.Ready)
                {
                    ServerCore.Linker.SendPacket(LinkLeaf.LeafOutbound.LeafEmoteText(ServerCore.Linker, this.Name, text));
                }
            }
        }
Esempio n. 2
0
        private static void Emote(AresClient client, TCPPacketReader packet)
        {
            if (!client.Captcha)
            {
                return;
            }

            String text = packet.ReadString(client);

            if (text.Length > 300)
            {
                text = text.Substring(0, 300);
            }

            Events.EmoteReceived(client, text);

            if (client.SocketConnected)
            {
                text = Events.EmoteSending(client, text);

                if (!String.IsNullOrEmpty(text) && client.SocketConnected && !client.Muzzled)
                {
                    if (client.Idled)
                    {
                        uint seconds_away = (uint)((Time.Now - client.IdleStart) / 1000);
                        IdleManager.Remove(client);
                        Events.Unidled(client, seconds_away);
                    }

                    if (client.SocketConnected)
                    {
                        if (text.StartsWith("idles"))
                        {
                            if (!IdleManager.CheckIfCanIdle(client))
                            {
                                return;
                            }
                            IdleManager.Add(client);
                            Events.Idled(client);
                        }

                        if (client.SocketConnected)
                        {
                            byte[]   js_style = null;
                            AresFont font     = (AresFont)client.Font;

                            if (font.Enabled)
                            {
                                font.IsEmote = true;
                                js_style     = TCPOutbound.Font(font);
                            }

                            UserPool.AUsers.ForEachWhere(x =>
                            {
                                if (x.SupportsHTML && x.Ares)
                                {
                                    if (js_style != null)
                                    {
                                        x.SendPacket(js_style);
                                    }
                                }

                                x.SendPacket(TCPOutbound.Emote(x, client.Name, text));
                            },
                                                         x => x.LoggedIn && x.Vroom == client.Vroom && !x.IgnoreList.Contains(client.Name) && !x.Quarantined);

                            UserPool.WUsers.ForEachWhere(x => x.QueuePacket(ib0t.WebOutbound.EmoteTo(x, client.Name, text)),
                                                         x => x.LoggedIn && x.Vroom == client.Vroom && !x.IgnoreList.Contains(client.Name) && !x.Quarantined);

                            if (ServerCore.Linker.Busy && ServerCore.Linker.LoginPhase == LinkLeaf.LinkLogin.Ready)
                            {
                                ServerCore.Linker.SendPacket(LinkLeaf.LeafOutbound.LeafEmoteText(ServerCore.Linker, client.Name, text));
                            }

                            Events.EmoteSent(client, text);
                        }
                    }
                }
            }
        }