コード例 #1
0
        private void sendChatMessage(Chat.ChatChannel chatchannel, List <BasePlayer> basePlayers, String message, BasePlayer inputUser)
        {
            LogChatFile("", message, inputUser.UserIDString, inputUser.displayName);

            foreach (BasePlayer basePlayer in BasePlayer.activePlayerList)
            {
                basePlayer.SendConsoleCommand("chat.add2", new object[] {
                    chatchannel,
                    inputUser.UserIDString,
                    message,
                    inputUser.displayName,
                    "#" + InfoUtils.GetUserNameColor(),
                    1f
                });

                /*
                 * basePlayer.SendConsoleCommand("chat.add", new object[] {
                 *          chatchannel,
                 *          inputUser,
                 *          message,
                 *          inputUser.displayName,
                 *          "#" + InfoUtils.GetUserNameColor()
                 *          //"<color=#" + InfoUtils.GetUserNameColor() + ">" + playerName + ": </color>" +
                 *          //"<color=#" + InfoUtils.GetUserMessageColor() + ">" + convertMessage + "</color>"
                 *      });
                 */
            }
        }
コード例 #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);
        }