Exemplo n.º 1
0
        void UndoSelf(Player p)
        {
            UndoDrawOpEntry[] entries = p.DrawOps.Items;
            if (entries.Length == 0)
            {
                Player.Message(p, "You have no draw operations to undo.");
                Player.Message(p, "Try using %T/undo [seconds] %Sinstead.");
                return;
            }

            for (int i = entries.Length - 1; i >= 0; i--)
            {
                UndoDrawOpEntry entry = entries[i];
                if (entry.DrawOpName == "UndoSelf")
                {
                    continue;
                }
                p.DrawOps.Remove(entry);

                UndoSelfDrawOp op = new UndoSelfDrawOp();
                op.who   = p;
                op.Start = entry.Start; op.End = entry.End;
                DrawOp.DoDrawOp(op, null, p, new Vec3S32[] { Vec3U16.MaxVal, Vec3U16.MaxVal });
                Player.Message(p, "Undo performed.");
                return;
            }

            Player.Message(p, "Unable to undo any draw operations, as all of the " +
                           "past 50 draw operations are %T/undo %Sor %T/undo [seconds].");
            Player.Message(p, "Try using %T/undo [seconds] %Sinstead.");
        }
Exemplo n.º 2
0
        protected void UndoOnlinePlayer(Player p, TimeSpan delta, Player who, Vec3S32[] marks)
        {
            if (p != null && p != who && !CheckUndoPerms(p, who.group))
            {
                return;
            }

            UndoOnlineDrawOp op;

            if (p == who)
            {
                op = new UndoSelfDrawOp();
            }
            else
            {
                op = new UndoOnlineDrawOp();
            }
            op.Start = DateTime.UtcNow.Subtract(delta);
            op.who   = who;
            DrawOp.DoDrawOp(op, null, p, marks);

            if (p == who)
            {
                Player.Message(p, "Undid your actions for the past &b" + delta.Shorten(true) + "%S.");
            }
            else
            {
                Player.SendChatFrom(who, who.ColoredName + "%S's actions for the past &b" + delta.Shorten(true) + " %Swere undone.", false);
            }
            Server.s.Log(who.name + "'s actions for the past " + delta.Shorten(true) + " were undone.");
        }
Exemplo n.º 3
0
        void UndoLastDrawOp(Player p)
        {
            UndoDrawOpEntry[] entries = p.DrawOps.Items;
            if (entries.Length == 0)
            {
                p.Message("You have no draw operations to undo.");
                p.Message("Try using %T/Undo [timespan] %Sinstead.");
                return;
            }

            for (int i = entries.Length - 1; i >= 0; i--)
            {
                UndoDrawOpEntry entry = entries[i];
                if (entry.DrawOpName == "UndoSelf")
                {
                    continue;
                }
                p.DrawOps.Remove(entry);

                UndoSelfDrawOp op = new UndoSelfDrawOp();
                op.who = p.name; op.ids = NameConverter.FindIds(p.name);

                op.Start = entry.Start; op.End = entry.End;
                DrawOpPerformer.Do(op, null, p, new Vec3S32[] { Vec3U16.MinVal, Vec3U16.MaxVal });
                p.Message("Undo performed.");
                return;
            }

            p.Message("Unable to undo any draw operations, as all of the " +
                      "past 50 draw operations are %T/Undo %Sor %T/Undo [timespan]");
            p.Message("Try using %T/Undo [timespan] %Sinstead");
        }
Exemplo n.º 4
0
        void UndoOnlinePlayer(Player p, long seconds, Player who)
        {
            if (p != null && p != who)
            {
                if (who.group.Permission > p.group.Permission)
                {
                    MessageTooHighRank(p, "undo", true); return;
                }
                if (!CheckAdditionalPerm(p))
                {
                    MessageNeedPerms(p, "can undo other players."); return;
                }
            }

            UndoOnlineDrawOp op;

            if (p == who)
            {
                op = new UndoSelfDrawOp();
            }
            else
            {
                op = new UndoOnlineDrawOp();
            }
            op.Start = DateTime.UtcNow.AddTicks(-seconds * TimeSpan.TicksPerSecond);
            op.who   = who;
            DrawOp.DoDrawOp(op, null, p, new [] { Vec3U16.MaxVal, Vec3U16.MaxVal });

            Level saveLevel = op.saveLevel;

            if (p == who)
            {
                Player.SendMessage(p, "Undid your actions for the past &b" + seconds + " %Sseconds.");
            }
            else
            {
                Player.SendChatFrom(who, who.ColoredName + "%S's actions for the past &b" + seconds + " seconds were undone.", false);
            }
            Server.s.Log(who.name + "'s actions for the past " + seconds + " seconds were undone.");
            if (saveLevel != null)
            {
                saveLevel.Save(true);
            }
        }
Exemplo n.º 5
0
        void UndoSelf(Player p, TimeSpan delta)
        {
            UndoDrawOp op = new UndoSelfDrawOp();

            op.Start = DateTime.UtcNow.Subtract(delta);
            op.who   = p.name; op.ids = NameConverter.FindIds(p.name);

            DrawOpPerformer.Do(op, null, p, new Vec3S32[] { Vec3U16.MinVal, Vec3U16.MaxVal });
            if (op.found)
            {
                p.Message("Undid your changes for the past &b{0}", delta.Shorten(true));
                Logger.Log(LogType.UserActivity, "{0} undid their own actions for the past {1}",
                           p.name, delta.Shorten(true));
            }
            else
            {
                p.Message("No changes found by you in the past &b{0}", delta.Shorten(true));
            }
        }