示例#1
0
        public static void PrintCommandInfo(Player p, Command cmd)
        {
            ItemPerms perms = CommandPerms.Find(cmd.name);

            if (perms == null)
            {
                perms = new ItemPerms(cmd.defaultRank, null, null);
            }

            p.Message("Usable by: " + perms.Describe());
            PrintAliases(p, cmd);

            List <CommandExtraPerms> extraPerms = CommandExtraPerms.FindAll(cmd.name);

            if (cmd.ExtraPerms == null)
            {
                extraPerms.Clear();
            }
            if (extraPerms.Count == 0)
            {
                return;
            }

            p.Message("%TExtra permissions:");
            foreach (CommandExtraPerms extra in extraPerms)
            {
                p.Message("{0}) {1} {2}", extra.Num, extra.Describe(), extra.Desc);
            }
        }
示例#2
0
        static void ShowAltsTask(SchedulerTask task)
        {
            string name = (string)task.State;
            Player p    = PlayerInfo.FindExact(name);

            if (p == null || p.ip == "127.0.0.1" || p.Socket.Disconnected)
            {
                return;
            }

            List <string> alts = PlayerInfo.FindAccounts(p.ip);

            // in older versions it was possible for your name to appear multiple times in DB
            while (alts.CaselessRemove(p.name))
            {
            }
            if (alts.Count == 0)
            {
                return;
            }

            ItemPerms opchat  = Chat.OpchatPerms;
            string    altsMsg = "λNICK %Sis lately known as: " + alts.Join();

            Chat.MessageFrom(p, altsMsg,
                             (pl, obj) => pl.CanSee(p) && opchat.UsableBy(pl.Rank));

            //IRCBot.Say(temp, true); //Tells people in op channel on IRC
            altsMsg = altsMsg.Replace("λNICK", name);
            Logger.Log(LogType.UserActivity, altsMsg);
        }
示例#3
0
        public static void MessageStaff(Player p, string message,
                                        ItemPerms perms, string group)
        {
            if (message.Length == 0)
            {
                p.Message("No message to send."); return;
            }

            string chatMsg = "To " + group + " &f-λNICK&f- " + message;

            Chat.MessageChat(ChatScope.Perms, p, chatMsg, perms, null, true);
        }
示例#4
0
        public static bool CanEditAny(Player p)
        {
            if (LevelInfo.IsRealmOwner(p.level, p.name))
            {
                return(true);
            }
            ItemPerms perms = CommandExtraPerms.Find("Bot", 1) ?? new ItemPerms(LevelPermission.Operator);

            if (perms.UsableBy(p.Rank))
            {
                return(true);
            }
            return(false);
        }
示例#5
0
            public static bool CanEditAny(Player p)
            {
                if (LevelInfo.IsRealmOwner(p.name, p.level.name))
                {
                    return(true);
                }
                ItemPerms perms = CommandExtraPerms.Find("EffectSpawner", 1);

                perms = perms == null ? new ItemPerms(LevelPermission.Operator, null, null) : perms;
                if (perms.UsableBy(p.Rank))
                {
                    return(true);
                }
                return(false);
            }
示例#6
0
        public void DisplayInfo(Player p)
        {
            p.Message("Bot {0} &S({1}) has:", ColoredName, name);
            p.Message("  Owner: &f{0}", string.IsNullOrEmpty(Owner) ? "no one" : p.FormatNick(Owner));
            if (!String.IsNullOrEmpty(AIName))
            {
                p.Message("  AI: &f{0}", AIName);
            }
            if (hunt || kill)
            {
                p.Message("  Hunt: &f{0}&S, Kill: %f{1}", hunt, kill);
            }
            if (SkinName != name)
            {
                p.Message("  Skin: &f{0}", SkinName);
            }
            if (Model != "humanoid")
            {
                p.Message("  Model: &f{0}", Model);
            }
            if (!(ScaleX == 0 && ScaleY == 0 && ScaleZ == 0))
            {
                p.Message("  X scale: &a{0}&S, Y scale: &a{1}&S, Z scale: &a{2}",
                          ScaleX == 0 ? "none" : ScaleX.ToString(),
                          ScaleY == 0 ? "none" : ScaleY.ToString(),
                          ScaleZ == 0 ? "none" : ScaleZ.ToString()
                          );
            }

            if (String.IsNullOrEmpty(ClickedOnText))
            {
                return;
            }
            ItemPerms perms = CommandExtraPerms.Find("About", 1) ?? new ItemPerms(LevelPermission.AdvBuilder);

            if (!perms.UsableBy(p.Rank))
            {
                return;                          //don't show bot's ClickedOnText if player isn't allowed to see message block contents
            }
            p.Message("  Clicked-on text: {0}", ClickedOnText);
        }
示例#7
0
 protected void CopyTo(ItemPerms perms)
 {
     perms.MinRank    = MinRank;
     perms.Allowed    = Allowed == null ? null : new List <LevelPermission>(Allowed);
     perms.Disallowed = Disallowed == null ? null : new List <LevelPermission>(Disallowed);
 }