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);
        }
        private RequirementModel GetRequirementModel(Guid requirementId)
        {
            RequirementModel requirementModel;

            requirementModel = new RequirementModel();
            requirementModel.Initialize(requirementId);

            return(requirementModel);
        }
        private string GetCategoryName(Guid requirementId)
        {
            string           name = "";
            RequirementModel model;

            model = new RequirementModel();
            model.Initialize(requirementId);
            name = TableNamesModel.GetTableNameFromId(model.TableNamesId);

            return(name);
        }
        //TODO: Maybe we can get rid of this, can't find any code that calls for it?
        private string GetRequirementTextString(int index)
        {
            string text;
            string value;

            Guid             requirementId;
            RequirementModel requirementModel;

            value            = "";
            requirementId    = Guid.Empty;
            requirementModel = new RequirementModel();

            switch (MainScreenType)
            {
            case ScreenType.Destiny:
            {
                break;
            }

            case ScreenType.Enhancement:
            {
                requirementId = EnhancementRequirementModels[index].RequirementId;
                value         = EnhancementRequirementModels[index].RequirementValue.ToString();
                break;
            }

            case ScreenType.Feat:
            {
                requirementId = FeatRequirementModels[index].RequirementId;
                value         = FeatRequirementModels[index].Value.ToString();
                break;
            }
            }

            requirementModel.Initialize(requirementId);

            text = requirementModel.Name + ": " + value;
            return(text);
        }
Exemple #5
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;
        }