示例#1
0
        private void ModifierDialogClass_Load(object sender, EventArgs e)
        {
            //Lets fill our ComboBoxes that don't change
            FillcomboBonusType();
            FillcomboCategory();
            FillcomboModifierMethod();
            FillcomboStance();

            if (SelectedModifierType == 0)
            {
                radioPassive.Checked = true;
            }
            else
            {
                radioStance.Checked = true;
            }

            comboModifierMethod.SelectedItem = ModifierMethodModel.GetMethodNameFromId(SelectedModifierMethodId);
            if (isNewRecord == true)
            {
                comboCategory.SelectedIndex = -1;
                buttonOk.Enabled            = false;
            }
            else
            {
                comboCategory.SelectedItem = GetCategoryName(SelectedModifierId);
            }
            if (isNewRecord == false && SelectedStanceId != Guid.Empty)
            {
                comboStance.SelectedItem = StanceModel.GetStanceNameFromId(SelectedStanceId);
            }
        }
        private void EditModifierDialogClass_Load(object sender, EventArgs e)
        {
            string methodName;

            methodName = "";

            AllowEvents = false;
            //Fill our standard ComboBoxes
            FillModifierMethodComboBox();
            FillModifierComboBox();
            FillBonusTypeComboBox();
            FillRequirementComboBox();
            FillStanceComboBox();

            //Set values based on how dialog was opened (Add or Edit)
            if (NewFlag == true)
            {
                //Creating a new modifier
                StanceComboBox.Visible              = false;
                StanceLabel.Visible                 = false;
                PullFromComboBox.Visible            = false;
                PullFromLabel.Visible               = false;
                PassiveRadioButton.Checked          = true;
                ModifierMethodComboBox.SelectedItem = "Normal";
            }

            else
            {
                //editing an existing modifier
                if (SelectedModifierType == 0)
                {
                    PassiveRadioButton.Checked = true;
                }
                else
                {
                    StanceRadioButton.Checked   = true;
                    StanceComboBox.Visible      = true;
                    StanceLabel.Visible         = true;
                    StanceComboBox.SelectedItem = StanceModel.GetStanceNameFromId(SelectedStanceId).ToString();
                }
                methodName = ModifierMethodModel.GetMethodNameFromId(SelectedModifierMethodId).ToString();
                ModifierMethodComboBox.SelectedItem = methodName;
                if (methodName == "AbilityBonus" || methodName == "Attribute" || methodName == "AbilitySwap")
                {
                    FillPullFromComboBox();
                    PullFromComboBox.Visible = true;
                    PullFromLabel.Visible    = true;
                    if (methodName == "AbilityBonus" || methodName == "AbilitySwap")
                    {
                        PullFromComboBox.SelectedItem = AbilityModel.GetNameFromId(SelectedPullFromId).ToString();
                    }
                    if (methodName == "Attribute")
                    {
                        PullFromComboBox.SelectedItem = AttributeModel.GetNameFromId(SelectedPullFromId).ToString();
                    }
                }

                ModifierComboBox.SelectedItem    = ModifierModel.GetNameFromId(SelectedModifierId).ToString();
                BonusTypeCombo.SelectedItem      = BonusTypeModel.GetNameFromId(SelectedBonusTypeId).ToString();
                ModifierValueNumUpDown.Value     = (decimal)SelectedModifierValue;
                RequirementComboBox.SelectedItem = RequirementModel.GetNameFromId(SelectedRequirementId).ToString();
                ComparisonComboBox.SelectedItem  = SelectedComparison;
                RequirementValueNumUpDown.Value  = (decimal)SelectedRequirementValue;
            }
            OKButton.Enabled = false;
            AllowEvents      = true;
        }
示例#3
0
        private string GetModifierString(Guid methodId, double modifierValue, Guid modifierId, Guid bonusTypeId, Guid pullFromId)
        {
            string text = "";

            if (ModifierMethodModel.GetMethodNameFromId(methodId) == "Normal")
            {
                text = "+" + modifierValue;
                if (bonusTypeId == Guid.Empty)
                {
                    text += " bonus";
                }
                else
                {
                    text += " " + BonusTypeModel.GetNameFromId(bonusTypeId) + " bonus";
                }
                text += " to " + ModifierModel.GetNameFromId(modifierId);
                return(text);
            }

            if (ModifierMethodModel.GetMethodNameFromId(methodId) == "Repeater")
            {
                text = "+" + modifierValue;
                if (bonusTypeId == Guid.Empty)
                {
                    text += " bonus";
                }
                else
                {
                    text += " " + BonusTypeModel.GetNameFromId(bonusTypeId) + " bonus";
                }
                text += " to " + ModifierModel.GetNameFromId(modifierId);
                text += " for each ";
                return(text);
            }

            if (ModifierMethodModel.GetMethodNameFromId(methodId) == "AbilityBonus")
            {
                text  = "Apply up to +" + modifierValue + " of your ";
                text += AbilityModel.GetNameFromId(pullFromId) + " bonus to ";
                text += ModifierModel.GetNameFromId(modifierId);
                return(text);
            }

            if (ModifierMethodModel.GetMethodNameFromId(methodId) == "AbilitySwap")
            {
                text  = "Apply up to +" + modifierValue + " of your ";
                text += AbilityModel.GetNameFromId(pullFromId) + " to ";
                text += ModifierModel.GetNameFromId(modifierId) + " instead of your normal bonus";
                return(text);
            }

            if (ModifierMethodModel.GetMethodNameFromId(methodId) == "Attribute")
            {
                text  = "Apply up to +" + modifierValue + " of your ";
                text += AttributeModel.GetNameFromId(pullFromId) + " to ";
                text += ModifierModel.GetNameFromId(modifierId);
                return(text);
            }

            //We should not reach this point
            Debug.Write("ERROR: No value ModifierMethod was found. ModifierPanel2 : GetModifierString()");
            text = "Not a valid Modifier MethodType";
            return(text);
        }