private Guid GetSlotId() { Guid treeId; Guid slotId; string slotName; string slotIndexString; int startLoc = 0; int index = -1; string tempName; slotName = ""; treeId = EnhancementTreeModel.GetIdFromTreeName(comboTree.SelectedItem.ToString()); if (comboCategory.SelectedItem.ToString() == "EnhancementSlot") { slotName = comboApplyTo.SelectedItem.ToString(); } if (comboCategory.SelectedItem.ToString() == "Enhancement") { slotName = comboSlot.SelectedItem.ToString(); } tempName = slotName.Remove(0, 5); startLoc = tempName.IndexOf(":: "); slotIndexString = tempName.Remove(startLoc); index = Int32.Parse(slotIndexString); slotId = EnhancementSlotModel.GetIdFromTreeIdandSlotIndex(treeId, index); return(slotId); }
private void GrabData(string treeName) { //TreeModel Data TreeModel = new EnhancementTreeModel(); if (treeName != "_New Enhancement Tree_") { TreeModel.Initialize(treeName); } //SlotModels Data and associated trackers SlotModels = new List <EnhancementSlotModel>(); SlotChanged = new List <bool>(); SlotDeleted = new List <bool>(); for (int i = 0; i < 31; i++) { SlotModels.Add(new EnhancementSlotModel()); SlotModels[i].Initialize(EnhancementSlotModel.GetIdFromTreeIdandSlotIndex(TreeModel.Id, i)); SlotChanged.Add(false); SlotDeleted.Add(false); } }
private void SlotComboBox_SelectedIndexChanged(object sender, EventArgs e) { List <EnhancementModel> enhancementModels; Guid slotId; Guid treeId; if (e.ToString() != "") { treeId = EnhancementTreeModel.GetIdFromTreeName(TreeComboBox.SelectedItem.ToString()); slotId = EnhancementSlotModel.GetIdFromTreeIdandSlotIndex(treeId, GetSlotIndex(SlotComboBox.SelectedItem.ToString())); //lets pull the enhancement data for the selected slot enhancementModels = EnhancementModel.GetAll(slotId); ApplyToComboBox.Items.Clear(); foreach (EnhancementModel model in enhancementModels) { ApplyToComboBox.Items.Add("Pos " + model.DisplayOrder.ToString() + ": " + model.Name); } UpdateNameField(); } }
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; }