Example #1
0
 public void SelectRank(Rank rank) {
     Rank = rank;
     if (rank == null) {
         comboBox.SelectedIndex = -1;
         Visible = false;
     } else {
         comboBox.SelectedIndex = GetLimitIndex(rank, Permission);
         Visible = rank.Can(Permission);
     }
 }
Example #2
0
 public void SelectRank( Rank rank ) {
     Rank = rank;
     if( rank == null ) {
         comboBox.SelectedIndex = -1;
         Visible = false;
     } else {
         comboBox.SelectedIndex = rank.GetLimitIndex( Permission );
         Visible = rank.Can( Permission );
     }
 }
Example #3
0
        void SelectRank( Rank rank ) {
            if( rank == null ) {
                if( vRanks.SelectedIndex != -1 ) {
                    vRanks.ClearSelected();
                    return;
                }
                DisableRankOptions();
                return;
            }
            if( vRanks.SelectedIndex != rank.Index ) {
                vRanks.SelectedIndex = rank.Index;
                return;
            }
            selectedRank = rank;
            tRankName.Text = rank.Name;

            ApplyColor( bColorRank, ParseToIndex( rank.Color ) );

            tPrefix.Text = rank.Prefix;

            foreach( var box in permissionLimitBoxes.Values ) {
                box.SelectRank( rank );
            }

            xReserveSlot.Checked = rank.ReservedSlot;
            xKickIdle.Checked = rank.IdleKickTimer > 0;
            nKickIdle.Value = rank.IdleKickTimer;
            nKickIdle.Enabled = xKickIdle.Checked;
            xAntiGrief.Checked = (rank.AntiGriefBlocks > 0 && rank.AntiGriefSeconds > 0);
            nAntiGriefBlocks.Value = rank.AntiGriefBlocks;
            nAntiGriefBlocks.Enabled = xAntiGrief.Checked;
            nAntiGriefSeconds.Value = rank.AntiGriefSeconds;
            nAntiGriefSeconds.Enabled = xAntiGrief.Checked;
            xDrawLimit.Checked = (rank.DrawLimit > 0);
            nDrawLimit.Value = rank.DrawLimit;
            nCopyPasteSlots.Value = rank.CopySlots;
            nFillLimit.Value = rank.FillLimit;
            xAllowSecurityCircumvention.Checked = rank.AllowSecurityCircumvention;

            foreach( ListViewItem item in vPermissions.Items ) {
                item.Checked = rank.Permissions[item.Index];
                if( item.Checked ) {
                    item.Font = bold;
                } else {
                    item.Font = vPermissions.Font;
                }
            }

            foreach( ListViewItem item in vPermissions.Items ) {
                CheckPermissionConsistency( (Permission)item.Tag, item.Checked );
            }

            xDrawLimit.Enabled = rank.Can( Permission.Draw ) || rank.Can( Permission.CopyAndPaste );
            nDrawLimit.Enabled = xDrawLimit.Checked;
            xAllowSecurityCircumvention.Enabled = rank.Can( Permission.ManageWorlds ) || rank.Can( Permission.ManageZones );

            gRankOptions.Enabled = true;
            lPermissions.Enabled = true;
            vPermissions.Enabled = true;

            bDeleteRank.Enabled = true;
            bRaiseRank.Enabled = (selectedRank != RankManager.HighestRank);
            bLowerRank.Enabled = (selectedRank != RankManager.LowestRank);
        }
Example #4
0
        void SelectRank( Rank rank ) {
            if( rank == null ) {
                if( vRanks.SelectedIndex != -1 ) {
                    vRanks.ClearSelected();
                    return;
                }
                DisableRankOptions();
                return;
            }
            if( vRanks.SelectedIndex != rank.Index ) {
                vRanks.SelectedIndex = rank.Index;
                return;
            }
            selectedRank = rank;
            tRankName.Text = rank.Name;

            ApplyColor( bColorRank, fCraft.Color.ParseToIndex( rank.Color ) );

            tPrefix.Text = rank.Prefix;

            cKickLimit.SelectedIndex = rank.GetLimitIndex( Permission.Kick );
            cBanLimit.SelectedIndex = rank.GetLimitIndex( Permission.Ban );
            cPromoteLimit.SelectedIndex = rank.GetLimitIndex( Permission.Promote );
            cDemoteLimit.SelectedIndex = rank.GetLimitIndex( Permission.Demote );
            cMaxHideFrom.SelectedIndex = rank.GetLimitIndex( Permission.Hide );
            cFreezeLimit.SelectedIndex = rank.GetLimitIndex( Permission.Freeze );
            cMuteLimit.SelectedIndex = rank.GetLimitIndex( Permission.Mute );
            cBringLimit.SelectedIndex = rank.GetLimitIndex( Permission.Bring );

            xReserveSlot.Checked = rank.ReservedSlot;
            xKickIdle.Checked = rank.IdleKickTimer > 0;
            nKickIdle.Value = rank.IdleKickTimer;
            nKickIdle.Enabled = xKickIdle.Checked;
            xAntiGrief.Checked = ( rank.AntiGriefBlocks > 0 && rank.AntiGriefSeconds > 0 );
            nAntiGriefBlocks.Value = rank.AntiGriefBlocks;
            nAntiGriefBlocks.Enabled = xAntiGrief.Checked;
            nAntiGriefSeconds.Value = rank.AntiGriefSeconds;
            nAntiGriefSeconds.Enabled = xAntiGrief.Checked;
            xDrawLimit.Checked = ( rank.DrawLimit > 0 );
            nDrawLimit.Value = rank.DrawLimit;
            xAllowSecurityCircumvention.Checked = rank.AllowSecurityCircumvention;

            foreach( ListViewItem item in vPermissions.Items ) {
                item.Checked = rank.Permissions[item.Index];
                if( item.Checked ) {
                    item.Font = bold;
                } else {
                    item.Font = vPermissions.Font;
                }
            }

            cKickLimit.Enabled = rank.Can( Permission.Kick );
            cBanLimit.Enabled = rank.Can( Permission.Ban );
            cPromoteLimit.Enabled = rank.Can( Permission.Promote );
            cDemoteLimit.Enabled = rank.Can( Permission.Demote );
            cMaxHideFrom.Enabled = rank.Can( Permission.Hide );
            cFreezeLimit.Enabled = rank.Can( Permission.Freeze );
            cMuteLimit.Enabled = rank.Can( Permission.Mute );
            cBringLimit.Enabled = rank.Can( Permission.Bring );

            xDrawLimit.Enabled = rank.Can( Permission.Draw ) || rank.Can( Permission.CopyAndPaste );
            nDrawLimit.Enabled = xDrawLimit.Checked;
            xAllowSecurityCircumvention.Enabled = rank.Can( Permission.ManageWorlds ) || rank.Can( Permission.ManageZones );

            gRankOptions.Enabled = true;
            lPermissions.Enabled = true;
            vPermissions.Enabled = true;

            bDeleteRank.Enabled = true;
            bRaiseRank.Enabled = ( selectedRank != RankManager.HighestRank );
            bLowerRank.Enabled = ( selectedRank != RankManager.LowestRank );
        }
Example #5
0
        static MenuState ShowRankDetails()
        {
            Refresh("Rank List > Rank {0} ({1} of {2})",
                    currentRank.Name, currentRank.Index + 1, RankManager.Ranks.Count);

            TextMenu menu = new TextMenu();

            TextOption optionName = menu.AddOption(1, "Name: \"" + currentRank.Name + "\"");

            TextOption optionColor = menu.AddOption(2, "Color: " + Color.GetName(currentRank.Color));

            optionColor.ForeColor = Color.ToConsoleColor(currentRank.Color);

            TextOption optionPrefix = menu.AddOption(3, "Prefix: \"" + currentRank.Prefix + "\"");

            TextOption optionHasReservedSlot = menu.AddOption(4, "HasReservedSlot: " + currentRank.HasReservedSlot);

            TextOption optionAllowSecurityCircumvention = menu.AddOption(5,
                                                                         "AllowSecurityCircumvention: " +
                                                                         currentRank.AllowSecurityCircumvention);

            TextOption optionIdleKickTimer = menu.AddOption(6, "IdleKickTimer: " + currentRank.IdleKickTimer);

            TextOption optionDrawLimit        = menu.AddOption(7, "DrawLimit: " + currentRank.DrawLimit);
            TextOption optionFillLimit        = menu.AddOption(8, "FillLimit: " + currentRank.FillLimit);
            TextOption optionCopySlots        = menu.AddOption(9, "CopySlots: " + currentRank.CopySlots);
            TextOption optionAntiGriefBlocks  = menu.AddOption(10, "AntiGriefBlocks: " + currentRank.AntiGriefBlocks);
            TextOption optionAntiGriefSeconds = menu.AddOption(11, "AntiGriefSeconds: " + currentRank.AntiGriefSeconds);

            menu.Column = Column.Right;

            TextOption optionBack = menu.AddOption("B", "Back to rank list");

            menu.AddSpacer();
            TextOption optionPermissions      = menu.AddOption("P", "Permissions");
            TextOption optionPermissionLimits = null;

            if (LimitedPermissions.Any(perm => currentRank.Can(perm)))
            {
                optionPermissionLimits = menu.AddOption("L", "Permission limits");
            }

            menu.AddSpacer();
            TextOption optionNextUp = null, optionNextDown = null;

            if (currentRank.NextRankUp != null)
            {
                optionNextUp = menu.AddOption("U", "Go to next rank up", currentRank.NextRankUp);
            }
            if (currentRank.NextRankDown != null)
            {
                optionNextDown = menu.AddOption("D", "Go to next rank down", currentRank.NextRankDown);
            }

            TextOption choice = menu.Show();

            if (choice == optionBack)
            {
                return(MenuState.Ranks);
            }
            else if (choice == optionPermissions)
            {
                return(MenuState.Permissions);
            }
            else if (choice == optionPermissionLimits)
            {
                return(MenuState.PermissionLimits);
            }
            else if (choice == optionNextDown || choice == optionNextUp)
            {
                currentRank = (Rank)choice.Tag;
            }

            return(MenuState.RankDetails);
        }