Beispiel #1
0
        void SelectClass(PlayerClass pc)
        {
            if (pc == null)
            {
                DisableClassOptions();
                return;
            }
            selectedClass   = pc;
            tClassName.Text = pc.name;
            nRank.Value     = pc.rank;

            ApplyColor(bColorClass, fCraft.Color.ParseToIndex(pc.color));

            tPrefix.Text                = pc.prefix;
            cKickLimit.SelectedIndex    = pc.GetMaxKickIndex();
            cBanLimit.SelectedIndex     = pc.GetMaxBanIndex();
            cPromoteLimit.SelectedIndex = pc.GetMaxPromoteIndex();
            cDemoteLimit.SelectedIndex  = pc.GetMaxDemoteIndex();
            xReserveSlot.Checked        = pc.reservedSlot;
            xIdleKick.Checked           = pc.idleKickTimer > 0;
            nKickIdle.Value             = pc.idleKickTimer;
            nKickIdle.Enabled           = xIdleKick.Checked;
            xKickOn.Checked             = pc.spamKickThreshold > 0;
            nKickOn.Value               = pc.spamKickThreshold;
            nKickOn.Enabled             = xKickOn.Checked;
            xBanOn.Checked              = pc.spamBanThreshold > 0;
            nBanOn.Value                = pc.spamBanThreshold;
            nBanOn.Enabled              = xBanOn.Checked;

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

            cKickLimit.Enabled    = pc.Can(Permissions.Kick);
            cBanLimit.Enabled     = pc.Can(Permissions.Ban);
            cPromoteLimit.Enabled = pc.Can(Permissions.Promote);
            cDemoteLimit.Enabled  = pc.Can(Permissions.Demote);

            gClassOptions.Enabled = true;
            lPermissions.Enabled  = true;
            vPermissions.Enabled  = true;
        }