private void AddNewRequirementRecord() { RequirementModel reqModel; string tableName; string applyToName; reqModel = new RequirementModel(); tableName = comboCategory.SelectedItem.ToString(); applyToName = comboApplyTo.SelectedItem.ToString(); reqModel.TableNamesId = TableNamesModel.GetIdFromTableName(tableName); if (tableName == "Ability") { reqModel.ApplytoId = AbilityModel.GetIdFromName(applyToName); } else if (tableName == "Alignments") { reqModel.ApplytoId = AlignmentModel.GetIdFromName(applyToName); } else if (tableName == "Attribute") { reqModel.ApplytoId = AttributeModel.GetIdFromName(applyToName); } else if (tableName == "Class") { reqModel.ApplytoId = ClassModel.GetIdFromName(applyToName); } else if (tableName == "Enhancement") { reqModel.ApplytoId = GetEnhancementId(); } else if (tableName == "EnhancementSlot") { reqModel.ApplytoId = GetSlotId(); } else if (tableName == "Feat") { reqModel.ApplytoId = FeatModel.GetIdFromName(applyToName); } else if (tableName == "Race") { reqModel.ApplytoId = RaceModel.GetIdFromName(applyToName); } else if (tableName == "Skill") { reqModel.ApplytoId = SkillModel.GetIdFromName(applyToName); } else { Debug.WriteLine("Error: CategoryName isn't listed :: RequirementDialogClass: AddNewRequirement"); } reqModel.Save(); SelectedRequirementId = reqModel.Id; }
private Guid GetApplyToId() { Guid applyToId; string tableName; applyToId = Guid.Empty; tableName = comboCategory.SelectedItem.ToString(); if (tableName == "Ability") { applyToId = AbilityModel.GetIdFromName(comboApplyTo.SelectedItem.ToString()); } if (tableName == "Alignments") { applyToId = AlignmentModel.GetIdFromName(comboApplyTo.SelectedItem.ToString()); } if (tableName == "Attribute") { applyToId = AttributeModel.GetIdFromName(comboApplyTo.SelectedItem.ToString()); } if (tableName == "Character") { applyToId = Guid.Empty; } if (tableName == "Class") { applyToId = ClassModel.GetIdFromName(comboApplyTo.SelectedItem.ToString()); } if (tableName == "Enhancement") { applyToId = GetEnhancementId(); } if (tableName == "EnhancementSlot") { applyToId = GetSlotId(); } if (tableName == "Feat") { applyToId = FeatModel.GetIdFromName(comboApplyTo.SelectedItem.ToString()); } if (tableName == "Race") { applyToId = RaceModel.GetIdFromName(comboApplyTo.SelectedItem.ToString()); } if (tableName == "Skill") { applyToId = SkillModel.GetIdFromName(comboApplyTo.SelectedItem.ToString()); } return(applyToId); }
private void OnModifierListBoxSelectedValueChanged(object sender, System.EventArgs e) { string modifiedName; modifiedName = ModifierListBox.Items[ModifierListBox.SelectedIndex].ToString(); if (TomeTypeAbilityRadioButton.Checked == true) { Model.ModifiedID = AbilityModel.GetIdFromName(modifiedName); } else { Model.ModifiedID = SkillModel.GetIdFromName(modifiedName); } SetTomeLongName(); DataHasChanged = true; }
private void AddModifierRecord() { ModifierModel model; string categoryName; string applyToName; categoryName = CategoryComboBox.SelectedItem.ToString(); applyToName = ApplyToComboBox.SelectedItem.ToString(); model = new ModifierModel(); model.Initialize(Guid.Empty); model.TableNamesId = TableNamesModel.GetIdFromTableName(categoryName); if (categoryName == "Ability") { model.ApplyToId = AbilityModel.GetIdFromName(applyToName); } else if (categoryName == "Attribute") { model.ApplyToId = AttributeModel.GetIdFromName(applyToName); } else if (categoryName == "Feat") { model.ApplyToId = AttributeModel.GetIdFromName(applyToName); } else if (categoryName == "Save") { model.ApplyToId = AttributeModel.GetIdFromName(applyToName); } else if (categoryName == "Skill") { model.ApplyToId = AttributeModel.GetIdFromName(applyToName); } else if (categoryName == "Spell") { model.ApplyToId = AttributeModel.GetIdFromName(applyToName); } else { Debug.WriteLine("Error: No category exists for the one selected. NewModifierDialogClass: AddModifierRecord()"); return; } model.Name = NameTextBox.Text; model.Save(); NewModifierId = model.Id; }
private Guid GetApplyToId() { Guid applyToId; string tableName; applyToId = Guid.Empty; tableName = comboCategory.SelectedItem.ToString(); if (tableName == "Ability") { applyToId = AbilityModel.GetIdFromName(comboModifier.SelectedItem.ToString()); } else if (tableName == "Attribute") { applyToId = AttributeModel.GetIdFromName(comboModifier.SelectedItem.ToString()); } else if (tableName == "Feat") { applyToId = FeatModel.GetIdFromName(comboModifier.SelectedItem.ToString()); } else if (tableName == "Save") { applyToId = SaveModel.GetIdFromName(comboModifier.SelectedItem.ToString()); } else if (tableName == "Skill") { applyToId = SkillModel.GetIdFromName(comboModifier.SelectedItem.ToString()); } else if (tableName == "Spell") { applyToId = SpellModel.GetIdFromName(comboModifier.SelectedItem.ToString()); } else { //We should never reach this, if so, we need to add a category of fix one. Debug.WriteLine("Error: no category exists for the selected. ModifierDialogClass::GetApplyToId()"); return(applyToId); } return(applyToId); }
private void PullFromComboBox_SelectedIndexChanged(object sender, EventArgs e) { string methodName; if (AllowEvents == false) { return; } methodName = ModifierMethodComboBox.SelectedItem.ToString(); if (methodName == "AbilityBonus" || methodName == "AbilitySwap") { SelectedPullFromId = AbilityModel.GetIdFromName(PullFromComboBox.SelectedItem.ToString()); } else { SelectedPullFromId = AttributeModel.GetIdFromName(PullFromComboBox.SelectedItem.ToString()); } CheckToEnableOkButton(); }
private void AddNewRequirementRecord() { RequirementModel model; string categoryName; string applyToName; string treeName; Guid treeId; Guid slotId; Guid enhancementId; treeName = ""; model = new RequirementModel(); categoryName = CategoryComboBox.SelectedItem.ToString(); applyToName = ApplyToComboBox.SelectedItem.ToString(); if (categoryName == "Enhancement" || categoryName == "EnhancementSlot") { treeName = TreeComboBox.SelectedItem.ToString(); } model.Initialize(Guid.Empty); model.TableNamesId = TableNamesModel.GetIdFromTableName(categoryName); if (categoryName == "Ability") { model.ApplytoId = AbilityModel.GetIdFromName(applyToName); } if (categoryName == "Attribute") { model.ApplytoId = AttributeModel.GetIdFromName(applyToName); } if (categoryName == "Class") { model.ApplytoId = ClassModel.GetIdFromName(applyToName); } if (categoryName == "Enhancement") { treeId = EnhancementTreeModel.GetIdFromTreeName(treeName); slotId = EnhancementSlotModel.GetIdFromTreeIdandSlotIndex(treeId, GetSlotIndex(SlotComboBox.SelectedItem.ToString())); enhancementId = EnhancementModel.GetIdFromSlotIdandDisplayOrder(slotId, GetDisplayOrder(ApplyToComboBox.SelectedItem.ToString())); model.ApplytoId = enhancementId; } if (categoryName == "EnhancementSlot") { treeId = EnhancementTreeModel.GetIdFromTreeName(treeName); slotId = EnhancementSlotModel.GetIdFromTreeIdandSlotIndex(treeId, GetSlotIndex(ApplyToComboBox.SelectedItem.ToString())); model.ApplytoId = slotId; } if (categoryName == "Feat") { model.ApplytoId = FeatModel.GetIdFromName(applyToName); } if (categoryName == "Race") { model.ApplytoId = RaceModel.GetIdFromName(applyToName); } if (categoryName == "Skill") { model.ApplytoId = SkillModel.GetIdFromName(applyToName); } model.Name = NameTextBox.Text; model.Save(); NewRequirementId = model.Id; }
private void TomeUpDownValueChanged(object sender, EventArgs e) { NumericUpDownWithBlank control; string controlName; CharacterAbilityClass.Abilities ability; int tomeBonus; int minLevel = 0; if (AllowChange == true) { control = (NumericUpDownWithBlank)sender; controlName = control.Name; //determine the ability changed ability = CharacterAbilityClass.Abilities.Strength; if (controlName.Contains("Str")) { ability = CharacterAbilityClass.Abilities.Strength; } if (controlName.Contains("Dex")) { ability = CharacterAbilityClass.Abilities.Dexterity; } if (controlName.Contains("Con")) { ability = CharacterAbilityClass.Abilities.Constitution; } if (controlName.Contains("Int")) { ability = CharacterAbilityClass.Abilities.Intelligence; } if (controlName.Contains("Wis")) { ability = CharacterAbilityClass.Abilities.Wisdom; } if (controlName.Contains("Cha")) { ability = CharacterAbilityClass.Abilities.Charisma; } //determine the level of the tome tomeBonus = (int)control.Value; Guid AbilityID = AbilityModel.GetIdFromName(ability.ToString()); int AbilityMax = TomeModel.GetMaxBonus(AbilityID); if (tomeBonus != 0) { minLevel = TomeModel.GetMinLevel(AbilityID, tomeBonus); } if (control.Blank == true) { CharacterManagerClass.CharacterManager.CharacterAbility.SetPriorLifeTomeBonus(ability, tomeBonus, 0); } else { CharacterManagerClass.CharacterManager.CharacterAbility.SetPriorLifeTomeBonus(ability, tomeBonus, minLevel); } for (int i = tomeBonus + 1; i < AbilityMax + 1; ++i) { CharacterManagerClass.CharacterManager.CharacterAbility.SetPriorLifeTomeBonus(ability, i, 0); } //inform other screens UIManagerClass.UIManager.ScreenMessenger.NotifyChange(UIManagerClass.ChildScreen.PastLifeEditScreen, ScreenMessengerClass.ChangeList.AbilityChange); } }
public void SetAbilityUpDown(NumericUpDownWithBlank control) { string controlName; CharacterAbilityClass.Abilities ability; if (AllowChange == true) { controlName = control.Name; //determine the ability changed ability = CharacterAbilityClass.Abilities.Strength; if (controlName.Contains("Str")) { ability = CharacterAbilityClass.Abilities.Strength; } if (controlName.Contains("Dex")) { ability = CharacterAbilityClass.Abilities.Dexterity; } if (controlName.Contains("Con")) { ability = CharacterAbilityClass.Abilities.Constitution; } if (controlName.Contains("Int")) { ability = CharacterAbilityClass.Abilities.Intelligence; } if (controlName.Contains("Wis")) { ability = CharacterAbilityClass.Abilities.Wisdom; } if (controlName.Contains("Cha")) { ability = CharacterAbilityClass.Abilities.Charisma; } int MaxAbility = TomeModel.GetMaxBonus(AbilityModel.GetIdFromName(ability.ToString())); control.Maximum = MaxAbility; int maxValue; int CurrentValue; int CurrentBonus; CurrentValue = 0; maxValue = 0; CurrentBonus = 0; for (int i = 0; i < MaxAbility; ++i) { CurrentValue = CharacterManagerClass.CharacterManager.CharacterAbility.PriorLifeTome[(int)ability, i]; if (CurrentValue > maxValue) { maxValue = CurrentValue; CurrentBonus = i + 1; } } if (maxValue != 0) { control.Blank = false; control.Value = CurrentBonus; } else { control.Blank = true; } } }