Beispiel #1
0
        private void OnChat(ServerChatEventArgs e)
        {
            TSPlayer tSPlayer = TShock.Players[e.Who];

            if (!e.Text.StartsWith(TShock.Config.CommandSpecifier) && !tSPlayer.mute)
            {
                bool flag = false;
                for (int i = 0; i < LexiconPlugin.config.LexiconedGroups.Length; i++)
                {
                    if (LexiconPlugin.config.LexiconedGroups[i] == tSPlayer.Group.Name)
                    {
                        flag = true;
                    }
                }
                if ((tSPlayer.Group.HasPermission("wordreplacement.permalexiconify") && !tSPlayer.Group.HasPermission("*")) || LexiconPlugin.BeingLexiconed[tSPlayer.Index] || flag)
                {
                    e.Handled = true;
                    string text = LexiconClass.Lexiconify(e.Text);
                    if (!TShock.Config.EnableChatAboveHeads)
                    {
                        string text2 = string.Format(TShock.Config.ChatFormat, new object[]
                        {
                            tSPlayer.Group.Name,
                            tSPlayer.Group.Prefix,
                            tSPlayer.Name,
                            tSPlayer.Group.Suffix,
                            text
                        });
                        TShock.Utils.Broadcast(text2, tSPlayer.Group.R, tSPlayer.Group.G, tSPlayer.Group.B);
                    }
                    else
                    {
                        Player player = Main.player[e.Who];
                        string name   = player.name;
                        player.name = string.Format(TShock.Config.ChatAboveHeadsFormat, new object[]
                        {
                            tSPlayer.Group.Name,
                            tSPlayer.Group.Prefix,
                            tSPlayer.Name,
                            tSPlayer.Group.Suffix
                        });
                        NetMessage.SendData(4, -1, -1, player.name, e.Who, 0f, 0f, 0f, 0);
                        player.name = name;
                        string text2 = text;
                        NetMessage.SendData(25, -1, e.Who, text2, e.Who, (float)tSPlayer.Group.R, (float)tSPlayer.Group.G, (float)tSPlayer.Group.B, 0);
                        NetMessage.SendData(4, -1, -1, name, e.Who, 0f, 0f, 0f, 0);
                        string text3 = string.Format("<{0}> {1}", string.Format(TShock.Config.ChatAboveHeadsFormat, new object[]
                        {
                            tSPlayer.Group.Name,
                            tSPlayer.Group.Prefix,
                            tSPlayer.Name,
                            tSPlayer.Group.Suffix
                        }), text2);
                        tSPlayer.SendMessage(text3, tSPlayer.Group.R, tSPlayer.Group.G, tSPlayer.Group.B);
                        TSPlayer.Server.SendMessage(text3, tSPlayer.Group.R, tSPlayer.Group.G, tSPlayer.Group.B);
                        Log.Info(string.Format("Broadcast: {0}", text3));
                    }
                }
            }
        }