コード例 #1
0
        internal static void Delete(Player p, string target, CommandData data)
        {
            string line = Server.tempRanks.FindData(target);

            if (line == null)
            {
                p.Message("{0} &Whas not been assigned a temp rank.", p.FormatNick(target));
                return;
            }

            string[] parts   = line.SplitSpaces();
            Group    curRank = PlayerInfo.GetGroup(target);

            Group oldRank = Group.Find(parts[4 - 1]); // -1 because data, not whole line

            if (oldRank == null)
            {
                return;
            }

            string reason = "temp rank unassigned";

            if (!CmdSetRank.CanChangeRank(target, curRank, oldRank, p, data, ref reason))
            {
                return;
            }

            ModAction action = new ModAction(target, p, ModActionType.Rank, reason);

            action.Metadata    = oldRank;
            action.targetGroup = curRank;
            OnModActionEvent.Call(action);
        }
コード例 #2
0
        static void Delete(Player p, string target)
        {
            string line = Server.tempRanks.FindData(target);

            if (line == null)
            {
                Player.Message(p, "{0}&c has not been assigned a temp rank.",
                               PlayerInfo.GetColoredName(p, target));
                return;
            }

            string[] parts   = line.SplitSpaces();
            Player   who     = PlayerInfo.FindExact(target);
            Group    curRank = who != null ? who.group : Group.GroupIn(target);

            Group oldRank = Group.Find(parts[4 - 1]); // -1 because data, not whole line

            if (oldRank == null)
            {
                return;
            }

            string reason = "temp rank unassigned";

            if (!CmdSetRank.CanChangeRank(target, curRank, oldRank, who, p, ref reason))
            {
                return;
            }

            ModAction action = new ModAction(target, p, ModActionType.Rank, reason);

            action.Metadata    = oldRank;
            action.targetGroup = curRank;
            OnModActionEvent.Call(action);
        }
コード例 #3
0
        static void Assign(Player p, string[] args, CommandData data)
        {
            string target = PlayerInfo.FindMatchesPreferOnline(p, args[0]);

            if (target == null)
            {
                return;
            }

            Group newRank = Matcher.FindRanks(p, args[1]);

            if (newRank == null)
            {
                return;
            }
            TimeSpan duration = TimeSpan.Zero;

            if (!CommandParser.GetTimespan(p, args[2], ref duration, "temp rank for", "h"))
            {
                return;
            }

            if (Server.tempRanks.Contains(target))
            {
                p.Message("&WThe player already has a temporary rank assigned!"); return;
            }

            if (p.name.CaselessEq(target))
            {
                p.Message("&WYou cannot assign yourself a temporary rank."); return;
            }

            Group  curRank = PlayerInfo.GetGroup(target);
            string reason  = args.Length > 3 ? args[3] : "assigning temp rank";

            if (!CmdSetRank.CanChangeRank(target, curRank, newRank, p, data, ref reason))
            {
                return;
            }

            ModAction action = new ModAction(target, p, ModActionType.Rank, reason, duration);

            action.targetGroup = curRank;
            action.Metadata    = newRank;
            OnModActionEvent.Call(action);
        }