Пример #1
0
        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 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);
        }