private string GetSlotName(EnhancementSlotModel model)
        {
            string name;
            Guid   enhancementId;

            name = "";
            if (model.UseEnhancementInfo == true)
            {
                //Retrieve the Name of the First enhancement for this slot
                enhancementId = EnhancementModel.GetIdFromSlotIdandDisplayOrder(model.Id, 0);
                name          = EnhancementModel.GetNameFromId(enhancementId);
            }
            else
            {
                name = model.Name;
            }

            return(name);
        }
        private Guid GetEnhancementId()
        {
            Guid   slotId;
            Guid   enhancementId;
            string enhancementName;
            string indexString;
            int    startLoc = 0;
            int    index    = -1;
            string tempName;

            slotId          = GetSlotId();
            enhancementName = comboApplyTo.SelectedItem.ToString();
            tempName        = enhancementName.Remove(0, 4);
            startLoc        = tempName.IndexOf(":: ");
            indexString     = tempName.Remove(startLoc);
            index           = Int32.Parse(indexString);
            enhancementId   = EnhancementModel.GetIdFromSlotIdandDisplayOrder(slotId, (byte)index);
            return(enhancementId);
        }
        private string BuildSlotName(Guid slotId)
        {
            string slotName;
            EnhancementSlotModel slotModel;

            slotName  = "";
            slotModel = new EnhancementSlotModel();
            slotModel.Initialize(slotId);

            if (slotModel.UseEnhancementInfo == true)
            {
                slotName = EnhancementModel.GetNameFromId(EnhancementModel.GetIdFromSlotIdandDisplayOrder(slotModel.Id, 0));
            }
            else
            {
                slotName = slotModel.Name;
            }

            return(slotName);
        }
Example #4
0
        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;
        }