public EditModifierDialogClass()
        {
            InitializeComponent();

            this.NewFlag = true;
            this.SelectedModifierType     = 0;
            this.SelectedModifierMethodId = ModifierMethodModel.GetIdFromMethodName("Normal");
            this.SelectedModifierId       = Guid.Empty;
            this.SelectedBonusTypeId      = Guid.Empty;
            this.SelectedPullFromId       = Guid.Empty;
            this.SelectedRequirementId    = Guid.Empty;
            this.SelectedStanceId         = Guid.Empty;
            this.SelectedComparison       = "=";
            this.SelectedModifierValue    = 0;
            this.SelectedRequirementValue = 0;

            //Set our list/trackers to empty lists
            ModifierMethodNames = new List <string>();
            ModifierNames       = new List <string>();
            BonusTypeNames      = new List <string>();
            PullFromNames       = new List <string>();
            RequirementNames    = new List <string>();
            StanceNames         = new List <string>();



            AllowEvents = true;
        }
        private void ModifierMethodComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            string methodName;

            if (AllowEvents == false)
            {
                return;
            }

            methodName = ModifierMethodComboBox.SelectedItem.ToString();
            SelectedModifierMethodId = ModifierMethodModel.GetIdFromMethodName(methodName);
            if (methodName == "AbilityBonus" || methodName == "AbilitySwap" || methodName == "Attribute")
            {
                PullFromComboBox.Visible = true;
                PullFromLabel.Visible    = true;
                FillPullFromComboBox();
                PullFromComboBox.SelectedIndex = 0;
            }
            else
            {
                PullFromComboBox.Visible = false;
                PullFromLabel.Visible    = false;
            }
            CheckToEnableOkButton();
        }
Example #3
0
        public ModifierDialogClass(bool recordIsNew, Guid modifierId, Guid requirementId, Guid modifierMethodId, Guid bonusTypeId, Guid pullFromId,
                                   Guid stanceId, byte modifierType = 0, double modifierValue = 0, string requirementComparison = "", double requirementValue = 0)
        {
            InitializeComponent();
            DefaultWidth  = 551;
            DefaultHeight = 358;

            //lets set our member variables
            isNewRecord          = recordIsNew;
            SelectedModifierType = modifierType;
            SelectedModifierId   = modifierId;
            if (modifierMethodId == Guid.Empty)
            {
                SelectedModifierId = ModifierMethodModel.GetIdFromMethodName("Normal");
            }
            else
            {
                SelectedModifierMethodId = modifierMethodId;
            }
            SelectedBonusTypeId      = bonusTypeId;
            SelectedPullFromId       = pullFromId;
            SelectedModifierValue    = modifierValue;
            SelectedRequirementId    = requirementId;
            SelectedComparison       = requirementComparison;
            SelectedRequirementValue = requirementValue;
            SelectedStanceId         = stanceId;

            //Set our Lists to Empty
            CategoryNames       = new List <string>();
            ModifierMethodNames = new List <string>();
            ModifierNames       = new List <string>();
            BonusTypeNames      = new List <string>();
            PullFromNames       = new List <string>();
            StanceNames         = new List <string>();
        }
Example #4
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 FillModifierMethodComboBox()
 {
     ModifierMethodNames.Clear();
     ModifierMethodNames = ModifierMethodModel.GetNames();
     ModifierMethodComboBox.Items.Clear();
     foreach (string name in ModifierMethodNames)
     {
         ModifierMethodComboBox.Items.Add(name);
     }
 }
Example #6
0
 private void FillcomboModifierMethod()
 {
     ModifierMethodNames.Clear();
     ModifierMethodNames = ModifierMethodModel.GetNames();
     comboModifierMethod.Items.Clear();
     foreach (string name in ModifierMethodNames)
     {
         comboModifierMethod.Items.Add(name);
     }
 }
        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;
        }
        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);
        }