コード例 #1
0
        private object OnBetterChat(Dictionary <string, object> data)
        {
            String inMessage      = (String)data["Message"];
            String convertMessage = "";

            IPlayer player = (IPlayer)data["Player"];

            BasePlayer basePlayer = BasePlayer.FindByID(ulong.Parse(player.Id));

            convertMessage = "KR".Equals(InfoUtils.GetUserMode(basePlayer, User[basePlayer.UserIDString])) ? StringUtils.getConvertKor(inMessage) : inMessage;


            LogChatFile("ConvertKor_Chat", convertMessage, player.Id, player.Name);

            Chat.ChatChannel chatChannel = (Chat.ChatChannel)data["ChatChannel"];

            if (chatChannel == 0)
            {
                LogChatFile("ConvertKor_Chat", convertMessage, player.Id, player.Name);
            }
            else
            {
                TeamLogChatFile("ConvertKor_Team", convertMessage, player.Id, player.Name);
            }
            data["Message"] = this.getChangeForbiddenWord(convertMessage, basePlayer, chatChannel);

            return(data);
        }
コード例 #2
0
        object OnPlayerChat(ConsoleSystem.Arg arg, Chat.ChatChannel chatchannel)
        {
            BasePlayer inputChatBasePlayer = arg.Connection.player as BasePlayer;
            String     playerName          = arg.Connection.username;
            String     message             = arg.GetString(0);
            String     convertMessage      = "KR".Equals(InfoUtils.GetUserMode(inputChatBasePlayer, User[inputChatBasePlayer.UserIDString])) ? StringUtils.getConvertKor(message) : message;

            // 콘솔로그
            Puts(playerName + ": " + convertMessage);

            // 욕설 변환
            convertMessage = this.getChangeForbiddenWord(convertMessage, inputChatBasePlayer, chatchannel);

            if (!isUsePlugin("BetterChat"))
            {
                if (chatchannel == Chat.ChatChannel.Team)
                {
                    List <Connection> sendUserList      = new List <Connection>();
                    RelationshipManager.PlayerTeam team = inputChatBasePlayer.Team;
                    if (null == team || team.members.Count < 1)
                    {
                        return(true);
                    }
                    foreach (ulong teamUserId in team.members)
                    {
                        Connection inUser = BasePlayer.FindByID(teamUserId).Connection;
                        if (null != inUser)
                        {
                            sendUserList.Add(inUser);
                        }
                    }
                    // 메시지 전송
                    if (sendUserList.Count > 0)
                    {
                        ConsoleNetwork.SendClientCommand(sendUserList, "chat.add2", new object[] { chatchannel, inputChatBasePlayer.UserIDString, convertMessage, "[TEAM] " + inputChatBasePlayer.displayName, "#" + InfoUtils.GetUserNameColor() });
                    }
                }
                else
                {
                    List <Connection> sendUserList = new List <Connection>();
                    foreach (BasePlayer basePlayer in BasePlayer.activePlayerList)
                    {
                        sendUserList.Add(basePlayer.Connection);
                    }
                    // 메시지 전송
                    if (sendUserList.Count > 0)
                    {
                        ConsoleNetwork.SendClientCommand(sendUserList, "chat.add2", new object[] { chatchannel, inputChatBasePlayer.UserIDString, convertMessage, inputChatBasePlayer.displayName, "#" + InfoUtils.GetUserNameColor() });
                    }
                }

                return(false);
            }

            return(null);
        }