private string BuildRequirementText(Guid requirementId, string requirementComparison, double requirementValue) { string text; string tableName; RequirementModel reqModel; text = ""; //text = RequirementModel.GetNameFromId(requirementId) + " " + requirementComparison + " " + requirementValue.ToString(); reqModel = new RequirementModel(); reqModel.Initialize(requirementId); tableName = TableNamesModel.GetTableNameFromId(reqModel.TableNamesId); if (tableName == "Ability") { text = AbilityModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " " + requirementValue.ToString(); } else if (tableName == "Alignments") { text = "Alignment: " + requirementComparison + " " + AlignmentModel.GetNameFromID(reqModel.ApplytoId); } else if (tableName == "Attribute") { text = AttributeModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " " + requirementValue.ToString(); } else if (tableName == "Character") { text = "Character " + requirementComparison + " Level " + requirementValue.ToString(); } else if (tableName == "Class") { text = ClassModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " Level " + requirementValue.ToString(); } else if (tableName == "Enhancement") { text = "Enhnacement: " + EnhancementModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " Rank " + requirementValue.ToString(); } else if (tableName == "EnhancementSlot") { text = "Enhancement Slot: " + BuildSlotName(reqModel.ApplytoId) + " " + requirementComparison + " Rank " + requirementValue.ToString(); } else if (tableName == "Feat") { text = "Feat: " + FeatModel.GetNameFromId(reqModel.ApplytoId); } else if (tableName == "Race") { text = RaceModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " Level " + requirementValue.ToString(); } else if (tableName == "Skill") { text = SkillModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " " + requirementValue.ToString(); } else { //we should not reach here Debug.WriteLine("Error: No category exists for this requirement. RequirementPanel2: BuildRequirementText()"); } return(text); }
/// <summary> /// for a given selected record, show its data in the appropriate fields /// </summary> /// <param name="recordName">The name of the record to show</param> private void PopulateFields(string recordName) { int index; if (recordName == string.Empty) { ClearScreen(); DataHasChanged = false; return; } Model.Initialize(recordName); TomeNameInputBox.Text = Model.TomeName; TomeBonusInput.Value = Model.TomeBonus; MinimumLevelInputUpDown.Value = Model.MinLevel; TomeNameLabel.Text = Model.TomeLongName; if (Model.TomeType == "Ability") { TomeTypeAbilityRadioButton.Checked = true; index = AbilityNames.IndexOf(AbilityModel.GetNameFromId(Model.ModifiedID)); ModifierListBox.SetSelected(index, true); } else { TomeTypeSkillRadioButton.Checked = true; index = SkillNames.IndexOf(SkillModel.GetNameFromId(Model.ModifiedID)); ModifierListBox.SetSelected(index, true); } ModVersionLabel.Text = Model.LastUpdatedVersion; ModDateLabel.Text = Model.LastUpdatedDate.ToString(); RecordGUIDLabel.Text = Model.Id.ToString(); //make sure we haven't changed the data (Populating data from the database doesn't count as a change!) DataHasChanged = false; }
private string GetApplyToName(Guid requirementId) { string applyToName; string tableName; RequirementModel reqModel; EnhancementModel enhancementModel; reqModel = GetRequirementModel(requirementId); //tableName = "Class"; tableName = TableNamesModel.GetTableNameFromId(reqModel.TableNamesId); if (tableName == "Ability") { applyToName = AbilityModel.GetNameFromId(reqModel.ApplytoId); } else if (tableName == "Alignments") { applyToName = AlignmentModel.GetNameFromID(reqModel.ApplytoId); } else if (tableName == "Attribute") { applyToName = AttributeModel.GetNameFromId(reqModel.ApplytoId); } else if (tableName == "Character") { applyToName = "Level"; } else if (tableName == "Class") { applyToName = ClassModel.GetNameFromId(reqModel.ApplytoId); } else if (tableName == "Enhancement") { //"Pos " + model.DisplayOrder.ToString() + ":: " + model.Name) enhancementModel = new EnhancementModel(); enhancementModel.Initialize(reqModel.ApplytoId); applyToName = "Pos " + enhancementModel.DisplayOrder + ":: " + enhancementModel.Name; } else if (tableName == "EnhancementSlot") { applyToName = BuildSlotName(GetSlotModel(requirementId)); } else if (tableName == "Feat") { applyToName = FeatModel.GetNameFromId(reqModel.ApplytoId); } else if (tableName == "Race") { applyToName = RaceModel.GetNameFromId(reqModel.ApplytoId); } else if (tableName == "Skill") { applyToName = SkillModel.GetNameFromId(reqModel.ApplytoId); } else { applyToName = ""; } Debug.WriteLine("ApplyToName = " + applyToName); return(applyToName); }
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); }