Пример #1
0
 // Constructor
 public Command(CommandGroup g, GroupEnum group, string name)
 {
     cmdGroup = g;
     accessGroup = group;
     strName = name;
     blnConsoleSupported = false;
 }
Пример #2
0
        Timer timer = new Timer(1000 * 1); //Every second

        #endregion Fields

        #region Constructors

        // Constructor
        public CmdJail(CommandGroup g, GroupEnum group, string name)
            : base(g, group, name)
        {
            blnConsoleSupported = false;
            timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
            timer.Enabled = true;
        }
Пример #3
0
        /// <summary>
        /// Gets a players rank
        /// </summary>
        /// <param name="name">The player name to get the rank for</param>
        /// <returns>The group that the player belongs to</returns>
        public static GroupEnum GetRank(string name)
        {
            GroupEnum g = GroupEnum.Guest;

            if (Properties.ServerAdministrator == name)
            {
                g = GroupEnum.Administrator;
            }
            else if (Server.banned.Contains(name))
            {
                g = GroupEnum.Banned;
            }
            else if (Server.builders.Contains(name))
            {
                g = GroupEnum.Builder;
            }
            else if (Server.advbuilders.Contains(name))
            {
                g = GroupEnum.AdvBuilder;
            }
            else if (Server.moderators.Contains(name))
            {
                g = GroupEnum.Moderator;
            }
            else if (Server.operators.Contains(name))
            {
                g = GroupEnum.Operator;
            }

            return(g);
        }
Пример #4
0
        private void BindGroups(GroupEnum groupEnum)
        {
            btnAddGroup.Text    = string.Format("Add {0}", groupEnum.ToString());
            btnDeleteGroup.Text = string.Format(" Delete selected {0}(s)", groupEnum.ToString().ToLower());
            lblGroupValue.Text  = string.Format("{0}", groupEnum.ToString());

            switch (groupEnum)
            {
            case GroupEnum.Product:
                chkListGroup.DataSource    = dtProduct;
                chkListGroup.DisplayMember = "ProductVal";
                chkListGroup.ValueMember   = "ProductId";
                break;

            case GroupEnum.Workflow:
                chkListGroup.DataSource    = dtWorkflow;
                chkListGroup.DisplayMember = "WorkflowVal";
                chkListGroup.ValueMember   = "WorkflowId";
                break;

            default:
                break;
            }

            groupMode = groupEnum;
            chkListGroup.ClearSelected();
            btnDeleteGroup.Enabled = chkListGroup.CheckedItems.Count > 0 ? true : false;
        }
Пример #5
0
 // Constructor
 public Command(CommandGroup g, GroupEnum group, string name)
 {
     cmdGroup            = g;
     accessGroup         = group;
     strName             = name;
     blnConsoleSupported = false;
 }
Пример #6
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Name     = binaryReader.ReadStringID();
     this.Group    = ((GroupEnum)(binaryReader.ReadInt16()));
     this.fieldpad = binaryReader.ReadBytes(2);
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(4));
     return(pointerQueue);
 }
Пример #7
0
 // Constructor
 public Group(string name, string color, GroupEnum g, bool chat, LevelPermission permission, Int32 _cuboidLimit)
 {
     blnChat       = chat;
     groupLevel    = g;
     lvlPermission = permission;
     strColor      = color;
     strName       = name;
     mCuboidLimit  = _cuboidLimit;
 }
Пример #8
0
 // Constructor
 public Group(string name, string color, GroupEnum g, bool chat, LevelPermission permission, Int32 _cuboidLimit)
 {
     blnChat = chat;
     groupLevel = g;
     lvlPermission = permission;
     strColor = color;
     strName = name;
     mCuboidLimit = _cuboidLimit;
 }
Пример #9
0
        /// <summary>
        /// 相关文章
        /// </summary>
        /// <param name="id">1资讯 2笔记 3资源</param>
        /// <param name="count">显示数目</param>
        /// <param name="articleId">文章id</param>
        /// <returns></returns>
        public ActionResult RelatedArticle(GroupEnum id = 0, int count = 6, int articleId = 0)
        {
            int tempid;

            ViewBag.ArticleList = ArticleService.PageLoad(a => (a.GroupType == id || id == 0) && a.Id != articleId && a.Status != ArticleStatusEnum.Delete, a => new { a.CreateTime, a.HitCount }, true, 1, 6, out tempid).Select(a => new Temp {
                Id = a.Id, Name = a.Title
            });
            return(View());
        }
Пример #10
0
        /// <summary>
        /// Changes the given players rank
        /// </summary>
        /// <param name="name">The name of the player</param>
        /// <param name="g">The players new rank</param>
        public static void ChangeRank(string name, GroupEnum g)
        {
            if (Server.operators.Contains(name))
            {
                Server.operators.Remove(name);
            }
            if (Server.moderators.Contains(name))
            {
                Server.moderators.Remove(name);
            }
            if (Server.advbuilders.Contains(name))
            {
                Server.advbuilders.Remove(name);
            }
            if (Server.builders.Contains(name))
            {
                Server.builders.Remove(name);
            }

            // Debug Message

            switch (g)
            {
            case GroupEnum.Banned:
                Server.banned.Add(name);
                break;

            case GroupEnum.Guest:
                break;

            case GroupEnum.Builder:
                Server.builders.Add(name);
                break;

            case GroupEnum.AdvBuilder:
                Server.advbuilders.Add(name);
                break;

            case GroupEnum.Moderator:
                Server.moderators.Add(name);
                break;

            case GroupEnum.Operator:
                Server.operators.Add(name);
                break;
            }

            if (Player.IsOnline(name))
            {
                Player target = Player.Find(name);
                Player.GlobalDie(target, false);
                Player.GlobalSpawn(target, target.pos[0], target.pos[1], target.pos[2], target.rot[0], target.rot[1], false);
            }
        }
Пример #11
0
 /// <summary>
 /// 左へ移動します。
 /// </summary>
 public void MoveLeft(int groupCount)
 {
     if (groupCount == 2 || group == GroupEnum.Left)
     {
         group = GroupEnum.Left;
     }
     else
     {
         group = (GroupEnum)(group - 1);
     }
     ChangeColor(groupCount);
 }
Пример #12
0
 /// <summary>
 /// 右へ移動します。
 /// </summary>
 public void MoveRight(int groupCount)
 {
     if (groupCount == 2 || group == GroupEnum.Right)
     {
         group = GroupEnum.Right;
     }
     else
     {
         group = (GroupEnum)(group + 1);
     }
     ChangeColor(groupCount);
 }
Пример #13
0
        // Find a group by GroupEnum type
        public static Group Find(GroupEnum g)
        {
            Group group = null;

            foreach (Group gr in GroupList)
            {
                if (gr.groupLevel == g)
                {
                    group = gr;
                    break;
                }
            }
            return(group);
        }
Пример #14
0
        /// <summary>
        /// Changes a players rank
        /// </summary>
        /// <param name="p">The player object to change</param>
        /// <param name="g">The rank to change the player to</param>
        public static void ChangeRank(Player p, GroupEnum g)
        {
            bool blnResendMap = ((p.checkOp() && g <= GroupEnum.Moderator) || (!p.checkOp() && g >= GroupEnum.Moderator));

            p.group = Group.Find(g);
            p.ClearActions();
            ChangeRank(p.name, g);

            if (blnResendMap)
            {
                p.ChangeLevel(p.level);
            }
            else
            {
                GlobalDie(p, false);
                GlobalRespawn(p);
            }
        }
Пример #15
0
 // Constructor
 public CmdKick(CommandGroup g, GroupEnum group, string name)
     : base(g, group, name)
 {
     blnConsoleSupported = true; /* By default no console support*/
 }
Пример #16
0
 // Constructor
 public CmdResetBot(CommandGroup g, GroupEnum group, string name) : base(g, group, name)
 {
     blnConsoleSupported = true;                                                                                       /* By default no console support*/
 }
Пример #17
0
 // Constructor
 public CmdReplace(CommandGroup g, GroupEnum group, string name)
     : base(g, group, name)
 {
     blnConsoleSupported = false; /* By default no console support*/
 }
Пример #18
0
 // Find a group by GroupEnum type
 public static Group Find(GroupEnum g)
 {
     Group group = null;
     foreach (Group gr in GroupList)
     {
         if (gr.groupLevel == g)
         {
             group = gr;
             break;
         }
     }
     return group;
 }
Пример #19
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            int number = message.Split(' ').Length;

            if (number > 2)
            {
            }

            if (number == 2) // Change the players rank
            {
                // Seperate message string
                int    pos        = message.IndexOf(' ');
                string tempName   = message.Substring(0, pos).ToLower();
                string newRankmsg = message.Substring(pos + 1).ToLower();

                Player    target    = Player.Find(tempName);
                bool      validRank = true;
                GroupEnum rank      = GroupEnum.Null;

                // Ensure we catch a valid rank
                switch (newRankmsg)
                {
                case "operator":
                case "op":
                    rank = GroupEnum.Operator;
                    break;

                case "moderator":
                case "mod":
                    rank = GroupEnum.Moderator;
                    break;

                case "advbuilder":
                case "adv":
                    rank = GroupEnum.AdvBuilder;
                    break;

                case "builder":
                    rank = GroupEnum.Builder;
                    break;

                case "guest":
                    rank = GroupEnum.Guest;
                    break;

                default:
                    validRank = false;
                    break;
                }
                // Make sure the rank is valid
                if (validRank)
                {
                    // Validate target players name
                    if (Player.ValidName(tempName))
                    {
                        // Can't set your own rank
                        if (p.name != tempName)
                        {
                            // Player must be a lower rank than yourself
                            if (p.Rank > Player.GetRank(tempName))
                            {
                                // Cannot set a banned player's rank
                                if (Player.GetRank(tempName) != GroupEnum.Banned)
                                {
                                    if (rank < p.Rank)
                                    {
                                        if (target != null)
                                        {
                                            Player.GlobalMessage("[Server]: " + target.color + target.name + "&e is now a " + Group.Find(rank).Color + Group.Find(rank).Name);
                                            Player.ChangeRank(target, rank);

                                            target.SendMessage("You are now ranked " + target.group.Color + target.group.Name + "&e, type /help for your new set of commands.");
                                        }
                                        else
                                        {
                                            Player.GlobalMessage("[Server]: " + tempName + " &f(offline)&e is now a " + Group.Find(rank).Color + Group.Find(rank).Name);
                                            Player.ChangeRank(tempName, rank);
                                        }
                                        Logger.Log(tempName + " was set to " + rank + " by " + p.name);
                                    }
                                    else
                                    {
                                        p.SendMessage("You cannot set someone to the same or higher rank than you!");
                                    }
                                }
                                else
                                {
                                    p.SendMessage("You must unban this player before you can change his rank!");
                                }
                            }
                            else
                            {
                                p.SendMessage("You cannot change the rank of someone who is higher rank than you!");
                            }
                        }
                        else
                        {
                            p.SendMessage("You cannot change your own rank");
                        }
                    }
                    else
                    {
                        p.SendMessage("Invalid name \"" + message + "\".");
                    }
                }
                else
                {
                    p.SendMessage("The rank \"" + newRankmsg + "\" is invalid!");
                }
            }
            else if (message != "") // Return the players current rank
            {
                if (Player.ValidName(message))
                {
                    Group rank = MCSharp.Group.Find(Player.GetRank(message));
                    p.SendMessage(message + "'s rank is: " + rank.Color + rank.Name);
                }
            }
            else // Return usage
            {
                Help(p);
            }
        }
Пример #20
0
 // Constructor
 public CmdPermissionVisit(CommandGroup g, GroupEnum group, string name) : base(g, group, name)
 {
     blnConsoleSupported = false;                                                                                              /* By default no console support*/
 }
Пример #21
0
 // Constructor
 public CmdFollow(CommandGroup g, GroupEnum group, string name)
     : base(g, group, name)
 {
     fTimer.Elapsed += new ElapsedEventHandler(fTimer_Elapsed);
     fTimer.Enabled = true;
 }
Пример #22
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="ErrorError" /> class.
        /// </summary>
        /// <param name="code">code (required).</param>
        /// <param name="data">Additional data..</param>
        /// <param name="description">Human readable description of the error. (required).</param>
        /// <param name="group">The source of the error. (required).</param>
        public ErrorError(ErrorCode code = default, object data = default, string description = default, GroupEnum group = default)
        {
            this.Code        = code;
            this.Description = description ?? throw new InvalidDataException("description is a required property for ErrorError and cannot be null");

            this.Group = group;
            this.Data  = data;
        }
Пример #23
0
        Timer timer = new Timer(1000 * 1);  //Every second

        // Constructor
        public CmdJail(CommandGroup g, GroupEnum group, string name) : base(g, group, name)
        {
            blnConsoleSupported = false;
            timer.Elapsed      += new ElapsedEventHandler(timer_Elapsed);
            timer.Enabled       = true;
        }
Пример #24
0
 private void LoadFormStartupData(GroupEnum groupEnum)
 {
     txtGroupValue.Text = string.Empty;
     BindGroups(groupEnum);
 }
Пример #25
0
 // Returns true if a group has access to the command
 public bool CanUse(GroupEnum g)
 {
     return(g >= accessGroup);
 }
Пример #26
0
 // Constructor
 public CmdFollow(CommandGroup g, GroupEnum group, string name) : base(g, group, name)
 {
     fTimer.Elapsed += new ElapsedEventHandler(fTimer_Elapsed);
     fTimer.Enabled  = true;
 }
Пример #27
0
        /// <summary>
        /// Changes the given players rank
        /// </summary>
        /// <param name="name">The name of the player</param>
        /// <param name="g">The players new rank</param>
        public static void ChangeRank(string name, GroupEnum g)
        {
            if (Server.operators.Contains(name)) { Server.operators.Remove(name); }
            if (Server.moderators.Contains(name)) { Server.moderators.Remove(name); }
            if (Server.advbuilders.Contains(name)) { Server.advbuilders.Remove(name); }
            if (Server.builders.Contains(name)) { Server.builders.Remove(name); }

            // Debug Message

            switch (g)
            {
                case GroupEnum.Banned:
                    Server.banned.Add(name);
                    break;
                case GroupEnum.Guest:
                    break;
                case GroupEnum.Builder:
                    Server.builders.Add(name);
                    break;
                case GroupEnum.AdvBuilder:
                    Server.advbuilders.Add(name);
                    break;
                case GroupEnum.Moderator:
                    Server.moderators.Add(name);
                    break;
                case GroupEnum.Operator:
                    Server.operators.Add(name);
                    break;
            }

            if (Player.IsOnline(name))
            {
                Player target = Player.Find(name);
                Player.GlobalDie(target, false);
                Player.GlobalSpawn(target, target.pos[0], target.pos[1], target.pos[2], target.rot[0], target.rot[1], false);
            }
        }
Пример #28
0
        /// <summary>
        /// Changes a players rank
        /// </summary>
        /// <param name="p">The player object to change</param>
        /// <param name="g">The rank to change the player to</param>
        public static void ChangeRank(Player p, GroupEnum g)
        {
            bool blnResendMap = ((p.checkOp() && g <= GroupEnum.Moderator) || (!p.checkOp() && g >= GroupEnum.Moderator));
            p.group = Group.Find(g);
            p.ClearActions();
            ChangeRank(p.name, g);

            if (blnResendMap)
            {
                p.ChangeLevel(p.level);
            }
            else
            {
                GlobalDie(p, false);
                GlobalRespawn(p);
            }
        }
 // Constructor
 public CmdPermissionBuild(CommandGroup g, GroupEnum group, string name)
     : base(g, group, name)
 {
     blnConsoleSupported = false; /* By default no console support*/
 }
Пример #30
0
 // Returns true if a group has access to the command
 public bool CanUse(GroupEnum g)
 {
     return (g >= accessGroup);
 }
Пример #31
0
 // Constructor
 public CmdSendLevel(CommandGroup g, GroupEnum group, string name) : base(g, group, name)
 {
     blnConsoleSupported = false;                                                                                        /* By default no console support*/
 }
Пример #32
0
 /// <summary>
 /// 相关文章
 /// </summary>
 /// <param name="id">1资讯 2笔记 3资源</param>
 /// <param name="count">显示数目</param>
 /// <param name="articleId">文章id</param>
 /// <returns></returns>
 public ActionResult RelatedArticle(GroupEnum id = 0, int count = 6, int articleId = 0)
 {
     int tempid;
     ViewBag.ArticleList = ArticleService.PageLoad(a => (a.GroupType == id || id == 0) && a.Id != articleId && a.Status != ArticleStatusEnum.Delete, a => new { a.CreateTime, a.HitCount }, true, 1, 6, out tempid).Select(a => new Temp { Id = a.Id, Name = a.Title });
     return View();
 }