예제 #1
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (p.Game.Referee)
            {
                Chat.MessageFrom(p, "λNICK %Sis no longer a referee");
                OnPlayerActionEvent.Call(p, PlayerAction.UnReferee);
                p.Game.Referee = false;
            }
            else
            {
                Chat.MessageFrom(p, "λNICK %Sis now a referee");
                OnPlayerActionEvent.Call(p, PlayerAction.Referee);
                p.Game.Referee = true;
            }
            p.SetPrefix();

            if (p.Supports(CpeExt.InstantMOTD))
            {
                p.SendMapMotd();
            }
            else if (p.Supports(CpeExt.HackControl))
            {
                string motd = p.GetMotd();
                if (p.Game.Referee)
                {
                    motd += " +hax";
                }
                p.Send(Hacks.MakeHackControl(p, motd));
            }
        }
예제 #2
0
        internal static void ToggleAfk(Player p, string message, bool isAuto = false)
        {
            if (p.joker)
            {
                message = "";
            }
            p.AutoAfk    = false;
            p.IsAfk      = !p.IsAfk;
            p.afkMessage = p.IsAfk ? message : null;
            TabList.Update(p, true);

            var oldLastAction = p.LastAction;

            p.LastAction = DateTime.UtcNow;

            bool cantSend = p.muted || (Server.chatmod && !p.voice);

            if (p.IsAfk)
            {
                if (cantSend)
                {
                    p.Message("You are now marked as being AFK.");
                }
                else
                {
                    if (message == null || message.Trim() == "")
                    {
                        ShowMessage(p, "-λNICK%S- is AFK");
                    }
                    else
                    {
                        if (isAuto)
                        {
                            ShowMessage(p, "-λNICK%S- is AFK " + message);
                        }
                        else
                        {
                            ShowMessage(p, "-λNICK%S- is AFK: " + message);
                        }
                    }
                    p.CheckForMessageSpam();
                }
                p.AFKCooldown = DateTime.UtcNow.AddSeconds(2);
                OnPlayerActionEvent.Call(p, PlayerAction.AFK, null, cantSend);
            }
            else
            {
                if (cantSend)
                {
                    p.Message("You are no longer marked as being AFK.");
                }
                else
                {
                    TimeSpan idleTime = DateTime.UtcNow - oldLastAction;
                    ShowMessage(p, string.Format("-λNICK%S- is no longer AFK ({0})", idleTime.Shorten()));
                    p.CheckForMessageSpam();
                }
                OnPlayerActionEvent.Call(p, PlayerAction.UnAFK, null, cantSend);
            }
        }
예제 #3
0
        static bool GotoLevel(Player p, Level lvl)
        {
            if (p.level == lvl)
            {
                Player.Message(p, "You are already in {0}%S.", lvl.ColoredName); return(false);
            }
            if (!lvl.CanJoin(p))
            {
                return(false);
            }

            p.Loading = true;
            Entities.DespawnEntities(p);
            Level oldLevel = p.level;

            p.level = lvl;
            p.SendMap(oldLevel);

            Position pos = lvl.SpawnPos;
            byte     yaw = lvl.rotx, pitch = lvl.roty;

            OnPlayerSpawningEvent.Call(p, ref pos, ref yaw, ref pitch, false);
            Entities.SpawnEntities(p, pos, new Orientation(yaw, pitch));
            CheckGamesJoin(p, oldLevel);

            if (p.level.ShouldShowJoinMessage(oldLevel))
            {
                string msg = p.level.IsMuseum ? " %Swent to the " : " %Swent to ";
                Chat.MessageGlobal(p, p.ColoredName + msg + lvl.ColoredName, false, true);
                OnPlayerActionEvent.Call(p, PlayerAction.JoinWorld, lvl.name);
            }
            return(true);
        }
예제 #4
0
        public override void Use(Player p, string message)
        {
            if (message.Length == 0)
            {
                Help(p); return;
            }
            bool stealth = false;

            if (message[0] == '#')
            {
                message = message.Remove(0, 1).Trim();
                stealth = true;
                Logger.Log(LogType.UserActivity, "Stealth joker attempted");
            }

            Player who = PlayerInfo.FindMatches(p, message);

            if (who == null)
            {
                return;
            }
            if (p != null && who.Rank > p.Rank)
            {
                MessageTooHighRank(p, "joker", true); return;
            }

            if (!who.joker)
            {
                if (stealth)
                {
                    Chat.MessageOps(who.ColoredName + " %Sis now STEALTH jokered.");
                }
                else
                {
                    Chat.MessageGlobal(who, who.ColoredName + " %Sis now a &aJ&bo&ck&5e&9r%S.", false);
                }
                OnPlayerActionEvent.Call(p, PlayerAction.Joker, null, stealth);
            }
            else
            {
                if (stealth)
                {
                    Chat.MessageOps(who.ColoredName + " %Sis now STEALTH unjokered.");
                }
                else
                {
                    Chat.MessageGlobal(who, who.ColoredName + " %Sis no longer a &aJ&bo&ck&5e&9r%S.", false);
                }
                OnPlayerActionEvent.Call(p, PlayerAction.Unjoker, null, stealth);
            }
            who.joker = !who.joker;
        }
예제 #5
0
 public override void Use(Player p, string message)
 {
     if (p.Game.Referee)
     {
         Chat.MessageGlobal(p, p.ColoredName + " %Sis no longer a referee", false);
         OnPlayerActionEvent.Call(p, PlayerAction.UnReferee);
         p.Game.Referee = false;
     }
     else
     {
         Chat.MessageGlobal(p, p.ColoredName + " %Sis now a referee", false);
         OnPlayerActionEvent.Call(p, PlayerAction.Referee);
         p.Game.Referee = true;
     }
 }
예제 #6
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0)
            {
                p.Message("You"); return;
            }
            if (p.joker)
            {
                p.Message("Cannot use /me while jokered."); return;
            }

            string msg = p.color + "*" + Colors.Strip(p.DisplayName) + " " + message;

            if (TryMessage(p, msg))
            {
                OnPlayerActionEvent.Call(p, PlayerAction.Me, message);
            }
        }
예제 #7
0
        internal static void ToggleAfk(Player p, string message)
        {
            if (p.joker)
            {
                message = "";
            }
            p.AutoAfk    = false;
            p.IsAfk      = !p.IsAfk;
            p.afkMessage = p.IsAfk ? message : null;
            TabList.Update(p, true);
            p.LastAction = DateTime.UtcNow;

            bool cantSend = p.muted || (Server.chatmod && !p.voice);

            if (p.IsAfk)
            {
                if (cantSend)
                {
                    Player.Message(p, "You are now marked as being AFK.");
                }
                else
                {
                    ShowMessage(p, "-" + p.ColoredName + "%S- is AFK " + message);
                    p.CheckForMessageSpam();
                }
                p.AFKCooldown = DateTime.UtcNow.AddSeconds(2);
                OnPlayerActionEvent.Call(p, PlayerAction.AFK, message);
            }
            else
            {
                if (cantSend)
                {
                    Player.Message(p, "You are no longer marked as being AFK.");
                }
                else
                {
                    ShowMessage(p, "-" + p.ColoredName + "%S- is no longer AFK");
                    p.CheckForMessageSpam();
                }
                OnPlayerActionEvent.Call(p, PlayerAction.UnAFK, message);
            }
        }
예제 #8
0
        internal static void ToggleAfk(Player p, string message)
        {
            if (p.joker)
            {
                message = "";
            }
            p.AutoAfk    = false;
            p.IsAfk      = !p.IsAfk;
            p.afkMessage = p.IsAfk ? message : null;
            TabList.Update(p, true);
            p.LastAction = DateTime.UtcNow;

            bool cantSend = !p.CanSpeak();

            if (p.IsAfk)
            {
                if (cantSend)
                {
                    p.Message("You are now marked as being AFK.");
                }
                else
                {
                    ShowMessage(p, "-λNICK%S- is AFK " + message);
                    p.CheckForMessageSpam();
                }
                p.AFKCooldown = DateTime.UtcNow.AddSeconds(2);
                OnPlayerActionEvent.Call(p, PlayerAction.AFK, null, cantSend);
            }
            else
            {
                if (cantSend)
                {
                    p.Message("You are no longer marked as being AFK.");
                }
                else
                {
                    ShowMessage(p, "-λNICK%S- is no longer AFK");
                    p.CheckForMessageSpam();
                }
                OnPlayerActionEvent.Call(p, PlayerAction.UnAFK, null, cantSend);
            }
        }
예제 #9
0
        void HandleEnter(Player p)
        {
            if (p == null)
            {
                Player.Message(p, "Console cannot enter the review queue."); return;
            }
            if (DateTime.UtcNow < p.NextReviewTime)
            {
                Player.Message(p, "You have to wait " + ServerConfig.ReviewCooldown + " seconds everytime you use this command");
                return;
            }

            foreach (string name in Server.reviewlist)
            {
                if (!name.CaselessEq(p.name))
                {
                    continue;
                }
                Player.Message(p, "You already entered the review queue!"); return;
            }

            bool opsOn = false;

            Player[]        players  = PlayerInfo.Online.Items;
            LevelPermission nextPerm = CommandExtraPerms.MinPerm(this.name, 2);

            foreach (Player pl in players)
            {
                if (pl.Rank >= nextPerm && Entities.CanSee(p, pl))
                {
                    opsOn = true; break;
                }
            }

            Server.reviewlist.Add(p.name);
            int pos = Server.reviewlist.IndexOf(p.name);

            if (pos > 1)
            {
                Player.Message(p, "You entered the &creview %Squeue. You have &c" + pos + " %Speople in front of you in the queue");
            }
            if (pos == 1)
            {
                Player.Message(p, "You entered the &creview %Squeue. There is &c1 %Sperson in front of you in the queue");
            }
            if (pos == 0)
            {
                Player.Message(p, "You entered the &creview %Squeue. You are &cfirst %Sin line!");
            }

            string msg = opsOn ?
                         "The Online staff have been notified. Someone should be with you shortly." :
                         "There are currently no staff online. Staff will be notified when they join the server.";

            Player.Message(p, msg);

            string start = pos > 0 ? "There are now &c" + (pos + 1) + " %Speople" : "There is now &c1 %Sperson";

            Chat.MessageWhere(p.ColoredName + " %Sentered the review queue", pl => pl.Rank >= nextPerm);
            Chat.MessageWhere(start + " waiting for a &creview!", pl => pl.Rank >= nextPerm);
            p.NextReviewTime = DateTime.UtcNow.AddSeconds(ServerConfig.ReviewCooldown);
            OnPlayerActionEvent.Call(p, PlayerAction.Review, null, true);
        }
예제 #10
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length > 0 && p.possess.Length > 0)
            {
                p.Message("Stop your current possession first."); return;
            }
            bool silent = false;

            if (message.CaselessEq("silent"))
            {
                if (!CheckExtraPerm(p, data, 1))
                {
                    return;
                }
                silent = true;
            }

            Command adminchat = Command.Find("AdminChat");
            Command opchat    = Command.Find("OpChat");

            Entities.GlobalDespawn(p, false);

            p.hidden = !p.hidden;
            if (p.hidden)
            {
                p.hideRank = data.Rank;
                AnnounceOps(p, "To Ops -λNICK&S- is now &finvisible");

                if (!silent)
                {
                    string leaveMsg = "&c- λFULL &S" + PlayerDB.GetLogoutMessage(p);
                    Chat.MessageFrom(ChatScope.All, p, leaveMsg, null, null, true);
                }

                if (!p.opchat)
                {
                    opchat.Use(p, "", data);
                }
                Server.hidden.Add(p.name);
                OnPlayerActionEvent.Call(p, PlayerAction.Hide);
            }
            else
            {
                AnnounceOps(p, "To Ops -λNICK&S- is now &fvisible");
                p.hideRank = LevelPermission.Banned;

                if (!silent)
                {
                    string joinMsg = "&a+ λFULL &S" + PlayerDB.GetLoginMessage(p);
                    Chat.MessageFrom(ChatScope.All, p, joinMsg, null, null, true);
                }

                if (p.opchat)
                {
                    opchat.Use(p, "", data);
                }
                if (p.adminchat)
                {
                    adminchat.Use(p, "", data);
                }
                Server.hidden.Remove(p.name);
                OnPlayerActionEvent.Call(p, PlayerAction.Unhide);
            }

            Entities.GlobalSpawn(p, false);
            TabList.Add(p, p, Entities.SelfID);
            Server.hidden.Save(false);
        }