static ArmorWeaponChart()
        {
            try
            {
                _Chart = XmlListLoader <ArmorWeaponChart> .Load("ArmorWeaponChart.xml");

                _TotalWeights = new Dictionary <string, int>();

                foreach (ArmorWeaponChart chart in _Chart)
                {
                    int weight = int.Parse(chart._Weight);

                    if (!_TotalWeights.ContainsKey(chart._Type))
                    {
                        _TotalWeights[chart._Type] = weight;
                    }
                    else
                    {
                        _TotalWeights[chart.Type] = _TotalWeights[chart.Type] + weight;
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                throw;
            }
        }
Beispiel #2
0
        public static void LoadFeats()
        {
            List <Feat> set = XmlListLoader <Feat> .Load("Feats.xml");

            featMap    = new Dictionary <string, Feat>();
            altFeatMap = new Dictionary <string, string>();
            types      = new SortedDictionary <String, String>();

            foreach (Feat feat in set)
            {
                bool   changed;
                string commaName = CMStringUtilities.DecommaText(feat.Name, out changed);

                if (changed)
                {
                    feat.AltName = feat.Name;
                    feat.Name    = commaName;
                    altFeatMap.Add(feat.AltName, feat.Name);
                }

                featMap[feat.Name] = feat;



                //add to types list
                foreach (string type in feat.Types)
                {
                    types[type] = type;
                }

                if (feat.Types.Count == 0)
                {
                    Debug.WriteLine(feat.Name);
                }

                feats = new ObservableCollection <Feat>();
                foreach (Feat f in Feat.FeatMap.Values)
                {
                    feats.Add(f);
                }
            }
            if (DBSettings.UseDB)
            {
                _FeatsDB = new DBLoader <Feat>("feats.db");

                foreach (Feat f in _FeatsDB.Items)
                {
                    feats.Add(f);

                    if (!FeatMap.ContainsKey(f.Name))
                    {
                        FeatMap[f.Name] = f;
                    }
                }
            }

            _FeatsLoaded = true;
        }
Beispiel #3
0
        private static void LoadRecentConditions()
        {
            _RecentCondtions = XmlListLoader <FavoriteCondition> .Load("RecentConditions.xml", true);

            if (_RecentCondtions == null)
            {
                _RecentCondtions = new List <FavoriteCondition>();
            }
        }
Beispiel #4
0
        private static void LoadCustomConditions()
        {
            _CustomConditions = XmlListLoader <Condition> .Load("CustomConditions.xml", true);

            if (_CustomConditions == null)
            {
                _CustomConditions = new List <Condition>();
            }
        }
Beispiel #5
0
        public static void LoadConditions()
        {
            _Conditions = XmlListLoader <Condition> .Load("Condition.xml");

            LoadSpellConditions();
#if !MONO
            LoadMonsterConditions();
#endif
            LoadCustomConditions();
            LoadFavoriteConditions();
            LoadRecentConditions();
        }
Beispiel #6
0
        static void LoadWeapons()
        {
            FileStream fs = null;

            try
            {
                List <Weapon> set = XmlListLoader <Weapon> .Load("Weapons.xml");


                weapons             = new Dictionary <string, Weapon>(new InsensitiveEqualityCompararer());
                weaponsPlural       = new Dictionary <string, Weapon>(new InsensitiveEqualityCompararer());
                weaponsOriginalName = new Dictionary <string, Weapon>(new InsensitiveEqualityCompararer());
                weaponsAltName      = new Dictionary <string, Weapon>(new InsensitiveEqualityCompararer());

                foreach (Weapon weapon in set)
                {
                    Regex reg = new Regex("([-\\. \\p{L}]+), ([-\\. \\p{L}]+)");

                    Match m = reg.Match(weapon.Name);

                    if (m.Success)
                    {
                        weapon.OriginalName = weapon.Name;
                        weapon.Name         = m.Groups[2].Value + " " + m.Groups[1].Value;
                        weaponsOriginalName.Add(weapon.OriginalName, weapon);
                    }

                    weapons[weapon.Name] = weapon;

                    if (weapon.Plural != null && weapon.Plural.Length > 0)
                    {
                        weaponsPlural[weapon.Plural] = weapon;
                    }

                    if (weapon.AltName != null && weapon.AltName.Length > 0)
                    {
                        weaponsAltName[weapon.AltName] = weapon;
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
            finally
            {
                if (fs != null)
                {
                    fs.Close();
                }
            }
        }
Beispiel #7
0
        private static void LoadFavoriteConditions()
        {
            List <FavoriteCondition> list = XmlListLoader <FavoriteCondition> .Load("FavoriteConditions.xml", true);

            if (list != null)
            {
                _FavoriteConditions = list;
            }
            else
            {
                _FavoriteConditions = new List <FavoriteCondition>();

                //add default entries;
                _FavoriteConditions.Add(new FavoriteCondition(ByName("Flat-Footed")));
                _FavoriteConditions.Add(new FavoriteCondition(ByName("Grappled")));
                _FavoriteConditions.Add(new FavoriteCondition(ByName("Pinned")));
                _FavoriteConditions.Add(new FavoriteCondition(ByName("Prone")));
            }
        }
Beispiel #8
0
        public static void LoadRules()
        {
            if (!_RulesLoaded)
            {
                List <Rule> set = XmlListLoader <Rule> .Load("RuleShort.xml");


                types    = new SortedDictionary <string, string>();
                subtypes = new Dictionary <string, SortedDictionary <string, string> >();
                ruleList = new List <Rule>();

                foreach (Condition c in Condition.Conditions)
                {
                    if (c.Text != null)
                    {
                        Rule r = new Rule();
                        r.Name    = c.Name;
                        r.Type    = "Condition";
                        r.Source  = "PFRPG Core";
                        r.Details = c.Text;
                        set.Add(r);
                    }
                }

                foreach (Rule rule in set)
                {
                    ruleList.Add(rule);

                    types[rule.Type] = rule.Type;

                    if (rule.Subtype != null && rule.Subtype.Length > 0)
                    {
                        if (!subtypes.ContainsKey(rule.Type))
                        {
                            subtypes[rule.Type] = new SortedDictionary <string, string>();
                        }
                        subtypes[rule.Type][rule.Subtype] = rule.Subtype;
                    }
                }

                _RulesLoaded = true;
            }
        }
Beispiel #9
0
        public static void SaveFavoriteConditions()
        {
            List <FavoriteCondition> list = new List <FavoriteCondition>(FavoriteConditions);

            XmlListLoader <FavoriteCondition> .Save(list, "FavoriteConditions.xml", true);
        }
Beispiel #10
0
 public static void SaveRecentConditions()
 {
     XmlListLoader <FavoriteCondition> .Save(_RecentCondtions, "RecentConditions.xml", true);
 }
Beispiel #11
0
 public static void SaveCustomConditions()
 {
     XmlListLoader <Condition> .Save(_CustomConditions, "CustomConditions.xml", true);
 }
Beispiel #12
0
 static SpecificItemChart()
 {
     _Chart = XmlListLoader <SpecificItemChart> .Load("SpecificItemChart.xml");
 }
Beispiel #13
0
 static Equipment()
 {
     _Equipment = XmlListLoader <Equipment> .Load("Equipment.xml");
 }
 static void Load()
 {
     abilities = XmlListLoader <WeaponSpecialAbility> .Load("WeaponSpecialAbility.xml");
 }
 static ArmorWeaponSpecialChart()
 {
     _Chart = XmlListLoader <ArmorWeaponSpecialChart> .Load("ArmorWeaponSpecialChart.xml");
 }