示例#1
0
        /// <summary> Attempts to change the logout message of the target player </summary>
        /// <remarks> Not allowed when players who cannot speak (e.g. muted) </remarks>
        public static bool SetLogoutMessage(Player p, string target, string message)
        {
            if (message.Length == 0)
            {
                p.Message("Logout message of {0} &Swas removed", p.FormatNick(target));
            }
            else
            {
                // Don't allow changing while muted
                if (!p.CheckCanSpeak("change logout messages"))
                {
                    return(false);
                }

                p.Message("Logout message of {0} &Swas changed to: {1}",
                          p.FormatNick(target), message);
            }

            PlayerDB.SetLogoutMessage(target, message);
            return(true);
        }
示例#2
0
        /// <summary> Attempts to change the nickname of the target player </summary>
        /// <remarks> Not allowed when players who cannot speak (e.g. muted) </remarks>
        public static bool SetNick(Player p, string target, string nick)
        {
            if (Colors.Strip(nick).Length >= 30)
            {
                p.Message("Nick must be under 30 letters.");
                return(false);
            }
            Player who = PlayerInfo.FindExact(target);

            if (nick.Length == 0)
            {
                MessageAction(p, target, who, "λACTOR &Sremoved λTARGET nick");
                nick = Server.ToRawUsername(target);
            }
            else
            {
                if (!p.CheckCanSpeak("change nicks"))
                {
                    return(false);
                }

                // TODO: select color from database?
                string color = who != null ? who.color : Group.GroupIn(target).Color;
                MessageAction(p, target, who, "λACTOR &Schanged λTARGET nick to " + color + nick);
            }

            if (who != null)
            {
                who.DisplayName = nick;
            }
            if (who != null)
            {
                TabList.Update(who, true);
            }
            PlayerDB.SetNick(target, nick);
            return(true);
        }