예제 #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);
        }
예제 #3
0
        private void PopulateFields(string featName)
        {
            List <FeatFeatTypeModel> featTypeModels;
            List <FeatTargetModel>   featTargetModels;

            Model = new FeatModel();
            Model.Initialize(featName);

            featTypeModels   = FeatFeatTypeModel.GetAllByFeatId(Model.Id);
            featTargetModels = FeatTargetModel.GetAllByFeatId(Model.Id);

            //set our Database values for Error checkign unique values.
            DatabaseName = Model.Name;

            //set the main control values
            NameInputBox.Text = Model.Name;
            CategoryFeatComboBox.SelectedItem = FeatCategoryModel.GetNameFromId(Model.FeatCategoryId);
            ParentFeatCheckBox.Checked        = Model.IsParentFeat;
            MultiplesCheckBox.Checked         = Model.Multiple;
            ParentFeatComboBox.SelectedItem   = FeatModel.GetNameFromId(Model.ParentFeat);
            StanceComboBox.SelectedItem       = StanceModel.GetStanceNameFromId(Model.StanceId);
            IconFileNameInputBox.Text         = Model.ImageFileName;
            FeatIcon = new IconClass("Feats\\" + Model.ImageFileName);
            FeatIcon.SetLocation(this.Width, this.Height, FeatIconLocation);
            DurationTextBox.Text = Model.Duration;

            //System tracking labels
            RecordGUIDLabel.Text = Model.Id.ToString();
            ModDateLabel.Text    = Model.LastUpdatedDate.ToString();
            ModVersionLabel.Text = Model.LastUpdatedVersion;

            //DescriptionWebBrowser control
            DescriptionHtmlEditor.Text = Model.Description;

            //Set the FeatTypes
            //clear previous values if any.
            FeatTypesSelected = new List <FeatTypeSelection>();
            foreach (int i in FeatTypesCheckedListBox.CheckedIndices)
            {
                FeatTypesCheckedListBox.SetItemChecked(i, false);
            }

            if (featTypeModels != null)
            {
                foreach (FeatFeatTypeModel ftmodel in featTypeModels)
                {
                    FeatTypesSelected.Add(new FeatTypeSelection());
                    FeatTypesSelected[FeatTypesSelected.Count - 1].Model        = ftmodel;
                    FeatTypesSelected[FeatTypesSelected.Count - 1].DeleteRecord = false;
                    FeatTypesCheckedListBox.SetItemChecked(FeatTypesCheckedListBox.FindStringExact(FeatTypeModel.GetNameFromId(ftmodel.FeatTypeId)), true);
                }
            }

            //Set the FeatTargets, clear previous values if any.
            FeatTargetsSelected = new List <FeatTargetSelection>();
            foreach (int i in FeatTargetsCheckedListBox.CheckedIndices)
            {
                FeatTargetsCheckedListBox.SetItemChecked(i, false);
            }

            if (featTargetModels != null)
            {
                foreach (FeatTargetModel ftmodel in featTargetModels)
                {
                    FeatTargetsSelected.Add(new FeatTargetSelection());
                    FeatTargetsSelected[FeatTargetsSelected.Count - 1].Model        = ftmodel;
                    FeatTargetsSelected[FeatTargetsSelected.Count - 1].DeleteRecord = false;
                    FeatTargetsCheckedListBox.SetItemChecked(FeatTargetsCheckedListBox.FindStringExact(TargetModel.GetNameFromId(ftmodel.TargetId)), true);
                }
            }

            //Set the the requirements panel
            FeatRequirementsRP2.Clear();
            FeatRequirementsRP2.RecordId = Model.Id;
            FeatRequirementsRP2.Initialize();

            //Set the modifiers panel
            MP2Modifiers.Clear();
            MP2Modifiers.RecordId = Model.Id;
            MP2Modifiers.Initialize();

            //Invalidate the screen to update graphics
            Invalidate();
        }
예제 #4
0
        private void PopulateFields(string raceName)
        {
            string   controlName;
            TextBox  skillPointsBox;
            ComboBox bonusFeatChoiceBox;

            ModelofRace = new RaceModel();
            ModelofRace.Initialize(raceName);
            //set our Original values for error checking unique values.
            DatabaseName         = ModelofRace.Name;
            DatabaseAbbreviation = ModelofRace.Abbreviation;

            //Set the Main Control Values
            NameInputBox.Text                  = ModelofRace.Name;
            AbbreviationInputBox.Text          = ModelofRace.Abbreviation;
            PastLifeFeatCombo.SelectedItem     = FeatModel.GetNameFromId(ModelofRace.PastLifeFeatId);
            StartingClassComboBox.SelectedItem = ClassModel.GetNameFromId(ModelofRace.StartingClassId);
            IconicCheckBox.Checked             = ModelofRace.Iconic;

            DescriptionWebBrowser.Navigate("about:blank");
            DescriptionWebBrowser.Document.OpenNew(false);
            DescriptionWebBrowser.Document.Write(ModelofRace.Description);
            DescriptionWebBrowser.Refresh();
            MaleIconNameInputBox.Text   = ModelofRace.MaleImageFileName;
            FemaleIconNameInputBox.Text = ModelofRace.FemaleImageFileName;
            MaleIcon = new IconClass(ModelofRace.MaleImageFileName);
            MaleIcon.SetLocation(this.Width, this.Height, MaleIconLocation);
            FemaleIcon = new IconClass(ModelofRace.FemaleImageFileName);
            FemaleIcon.SetLocation(this.Width, this.Height, FemaleIconLocation);
            //Starting Stat Boxes
            StrengthMinimumBox.SelectedItem     = ModelofRace.StrengthMinimum.ToString();
            StrengthMaximumBox.SelectedItem     = ModelofRace.StrengthMaximum.ToString();
            DexterityMinimumBox.SelectedItem    = ModelofRace.DexterityMinimum.ToString();
            DexterityMaximumBox.SelectedItem    = ModelofRace.DexterityMaximum.ToString();
            ConstitutionMinimumBox.SelectedItem = ModelofRace.ConstitutionMinimum.ToString();
            ConstitutionMaximumBox.SelectedItem = ModelofRace.ConstitutionMaximum.ToString();
            IntelligenceMinimumBox.SelectedItem = ModelofRace.IntelligenceMinimum.ToString();
            IntelligenceMaximumBox.SelectedItem = ModelofRace.IntelligenceMaximum.ToString();
            WisdomMinimumBox.SelectedItem       = ModelofRace.WisdomMinimum.ToString();
            WisdomMaximumBox.SelectedItem       = ModelofRace.WisdomMaximum.ToString();
            CharismaMinimumBox.SelectedItem     = ModelofRace.CharismaMinimum.ToString();
            CharismaMaximumBox.SelectedItem     = ModelofRace.CharismaMaximum.ToString();
            //System Boxes
            GuidLabel.Text               = ModelofRace.Id.ToString();
            LastUpdatedDateLabel.Text    = ModelofRace.LastUpdatedDate.ToString();
            LastUpdatedVersionLabel.Text = ModelofRace.LastUpdatedVersion;

            //LevelDetails Information
            ModelofRaceDetail = RaceLevelDetailModel.GetAll(ModelofRace.Id);
            if (ModelofRaceDetail == null)
            {
                //no detail records exist for this race, so we need to create them
                ModelofRaceDetail = new List <RaceLevelDetailModel>();
                for (int i = 0; i < Constant.NumHeroicLevels; i++)
                {
                    ModelofRaceDetail.Add(new RaceLevelDetailModel());
                    ModelofRaceDetail[i].Level = i + 1;
                }
                NewRecord = true;
            }
            //now lets fill in our Level Detail Controls
            for (int i = 0; i < Constant.NumHeroicLevels; i++)
            {
                controlName         = "SkillPointsInputBox" + (i + 1);
                skillPointsBox      = (TextBox)this.LevelDetailsPanel.Controls[controlName];
                skillPointsBox.Text = ModelofRaceDetail[i].BonusSkillPoints.ToString();

                controlName        = "BonusFeatChoiceCombo" + (i + 1);
                bonusFeatChoiceBox = (ComboBox)this.LevelDetailsPanel.Controls[controlName];
                bonusFeatChoiceBox.SelectedItem = FeatTypeModel.GetNameFromId(ModelofRaceDetail[i].FeatTypeId);
            }
        }