Esempio n. 1
0
        public void AddRow(string careerName)
        {
            try
            {
                string[]      lowerTiers      = Career.GetLowerTiers(careerName);
                List <string> lowerTiersToAdd = new List <string>();

                if (lowerTiers.Length > 0)
                {
                    foreach (string lowerCareer in lowerTiers)
                    {
                        bool contains = false;
                        foreach (CareerRowViewModel row in CareerRows)
                        {
                            if (row.Name == lowerCareer)
                            {
                                contains = true;
                            }
                        }
                        if (!contains)
                        {
                            lowerTiersToAdd.Add(lowerCareer);
                        }
                    }
                    if (lowerTiersToAdd.Count > 0)
                    {
                        if (messageService.YesNoBox("Add lower tier careers?", "Add Lower Tiers"))
                        {
                            foreach (string career in lowerTiersToAdd)
                            {
                                CareerRowViewModel lowerRow = new CareerRowViewModel(Career.GetCareerList().Find(c => c.Name == career), id);
                                lowerRow.RowChanged      += CareerEdit;
                                lowerRow.AdvanceSelection = AdvanceLevel.Complete;
                                CareerRows.Add(lowerRow);
                                RowIDs.Add(id);
                                id++;

                                lowerRow.ManualUpdate(RowAction.Add);
                            }
                        }
                    }
                }

                CareerRowViewModel newDGRow = new CareerRowViewModel(Career.GetCareerList().Find(c => c.Name == careerName), id);
                newDGRow.RowChanged += CareerEdit;
                CareerRows.Add(newDGRow);
                RowIDs.Add(id);
                id++;
            }

            catch (Exception e)
            {
                messageService.ShowNotification(e.Message);
            }
        }
Esempio n. 2
0
        public CareerAdvancement(Character owner, Career careerToAdd, AdvanceLevel advancement = AdvanceLevel.None, bool skillFocus = true, bool talentFocus = true)
        {
            Owner          = owner;
            CareerTemplate = careerToAdd;
            for (Characteristics i = 0; i < (Characteristics)10; i++)
            {
                CharacteristicAdvances.Add(i, 0);
            }

            Advancement = advancement;

            AdvanceCharacteristics();
            AdvanceSkills(skillFocus);
            AdvanceTalents(talentFocus);
        }
Esempio n. 3
0
        public MainWindow()
        {
            InitializeComponent();

            CareerJsonReader.read = true;
            TalentReader.read     = true;

            this.DataContext = new WindowViewModel();

            foreach (Career career in Career.GetCareerList())
            {
                foreach (string talent in career.CareerTalents)
                {
                    if (Talent.TalentList.Find(t => t.Name == Talent.GenericName(talent)) == null)
                    {
                        System.Diagnostics.Debug.WriteLine(talent + " not found");
                    }
                }
            }
        }
Esempio n. 4
0
        static CareerJsonReader()
        {
            Assembly     assembly = Assembly.GetExecutingAssembly();
            StreamReader sr       = new StreamReader(assembly.GetManifestResourceStream("WFRP_NPC_Creator.Data.careers.json"));

            ClassList = JsonConvert.DeserializeObject(sr.ReadToEnd());
            sr.Close();


            CareerClass currentClass;
            CareerPath  currentPath;
            Career      currentTier;

            foreach (dynamic CareerClass in ClassList.Classes)
            {
                currentClass = new CareerClass(CareerClass.Name);
                foreach (dynamic career in CareerClass.First)
                {
                    currentPath = new CareerPath(career.Name);

                    int           tierCounter = 1;
                    List <string> skillList   = new List <string>();
                    List <string> trappings   = new List <string>();
                    foreach (dynamic tier in career.Value["Tiers"])
                    {
                        try
                        {
                            string            name       = tier["Name"];
                            List <string>     talentList = new List <string>();
                            Characteristics   c          = Characteristics.WS;
                            Characteristics[] characteristicAvailable = new Characteristics[tierCounter + 2];
                            int counter = 0;
                            foreach (dynamic characteristic in career.Value["Attributes"])
                            {
                                if (characteristic.Value != 0 && characteristic.Value <= tierCounter)
                                {
                                    characteristicAvailable[counter] = c;
                                    counter++;
                                }
                                c++;
                            }

                            foreach (dynamic skill in tier["Skills"])
                            {
                                skillList.Add(skill.Value);
                            }

                            foreach (dynamic talent in tier["Talents"])
                            {
                                talentList.Add(talent.Value);
                            }

                            foreach (dynamic trapping in tier["Trappings"])
                            {
                                trappings.Add(trapping.Value);
                            }
                            currentTier = new Career(name, tierCounter, characteristicAvailable, skillList.ToArray(), talentList.ToArray(), trappings.ToArray());
                            currentPath.AddTier(currentTier);
                            tierCounter++;
                        }
                        catch (Exception e)
                        {
                        }
                    }
                    currentClass.AddCareerPath(currentPath);
                }
                Career.ClassList.Add(currentClass);
            }
        }
Esempio n. 5
0
 public void AddTier(Career tier)
 {
     Tiers.Add(tier);
 }
Esempio n. 6
0
 public virtual void AddCareer(string name, AdvanceLevel advancement = AdvanceLevel.None)
 {
     Careers.Add(new CareerAdvancement(this, Career.GetCareerList().Find(c => c.Name == name), advancement));
 }