Exemple #1
0
        static void LogAction(ModAction e, Player target, string action)
        {
            if (e.Announce)
            {
                // TODO: Chat.MessageFrom if target is online?
                Player who = PlayerInfo.FindExact(e.Target);
                // TODO: who.SharesChatWith
                Chat.Message(ChatScope.Global, e.FormatMessage(e.TargetName, action),
                             null, null, true);
            }
            else
            {
                Chat.MessageOps(e.FormatMessage(e.TargetName, action));
            }

            action = Colors.Strip(action);
            string suffix = "";

            if (e.Duration.Ticks != 0)
            {
                suffix = " &Sfor " + e.Duration.Shorten();
            }

            Logger.Log(LogType.UserActivity, "{0} was {1} by {2}",
                       e.Target, action, e.Actor.name + suffix);
        }
        static void LogAction(ModAction e, Player who, string action)
        {
            if (e.Announce)
            {
                if (who != null)
                {
                    Chat.MessageGlobal(who, e.FormatMessage(e.TargetName, action), false);
                }
                else
                {
                    Chat.MessageGlobal(e.FormatMessage(e.TargetName, action));
                }
            }
            else
            {
                Chat.MessageOps(e.FormatMessage(e.TargetName, action));
            }

            action = Colors.Strip(action);
            string suffix = "";

            if (e.Duration.Ticks != 0)
            {
                suffix = " %Sfor " + e.Duration.Shorten();
            }

            Logger.Log(LogType.UserActivity, "{0} was {1} by {2}",
                       e.Target, action, e.ActorName + suffix);
        }
Exemple #3
0
        static void LogIPAction(ModAction e, string type)
        {
            ItemPerms perms = CommandExtraPerms.Find("WhoIs", 1);

            Chat.Message(ChatScope.Global, e.FormatMessage("An IP", type), perms,
                         FilterNotItemPerms, true);
            Chat.Message(ChatScope.Global, e.FormatMessage(e.Target, type), perms,
                         Chat.FilterPerms, true);
        }
        static void DoUnbanIP(ModAction e)
        {
            LevelPermission perm = CommandExtraPerms.MinPerm("whois");

            Chat.MessageWhere(e.FormatMessage("An IP", "&8IP unbanned"), pl => pl.Rank < perm);
            Chat.MessageWhere(e.FormatMessage(e.TargetName, "&8IP unbanned"), pl => pl.Rank >= perm);

            Logger.Log(LogType.UserActivity, "IP-UNBANNED: {0} by {1}.", e.Target, e.ActorName);
            Server.bannedIP.Remove(e.Target);
            Server.bannedIP.Save();
        }
Exemple #5
0
        void HandleModerationAction(ModAction e)
        {
            if (!Server.IRC.Enabled || !e.Announce)
            {
                return;
            }

            switch (e.Type)
            {
            case ModActionType.Warned:
                Bot.Say(e.FormatMessage(e.TargetName, "&ewarned")); break;

            case ModActionType.Ban:
                Bot.Say(e.FormatMessage(e.TargetName, "&8banned")); break;

            case ModActionType.Unban:
                Bot.Say(e.FormatMessage(e.TargetName, "&8unbanned")); break;

            case ModActionType.BanIP:
                Bot.Say(e.FormatMessage(e.TargetName, "&8IP banned"), true);
                Bot.Say(e.FormatMessage("An IP", "&8IP banned")); break;

            case ModActionType.UnbanIP:
                Bot.Say(e.FormatMessage(e.TargetName, "&8IP unbanned"), true);
                Bot.Say(e.FormatMessage("An IP", "&8IP unbanned")); break;

            case ModActionType.Rank:
                Bot.Say(e.FormatMessage(e.TargetName, GetRankAction(e))); break;
            }
        }
Exemple #6
0
        void ModAction(ModAction e)
        {
            if (!e.Announce)
            {
                return;
            }
            string message = config.DisconnectPrefix + e.FormatMessage(e.Target, GetActionType(e.Type));

            SendMessage(Colors.Strip(message));
        }