Пример #1
0
        public void Load(string xml)
        {
            bonuses = new List <ResPassiveBonusData>();
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif
            var parent = document.Element("passive_bonuses");
            bonuses.Add(new ResPassiveBonusData(Common.PassiveBonusType.Speed, parent.Element("speed")));
            bonuses.Add(new ResPassiveBonusData(Common.PassiveBonusType.DamageDron, parent.Element("damage_dron")));
            bonuses.Add(new ResPassiveBonusData(Common.PassiveBonusType.HealDron, parent.Element("heal_dron")));
            bonuses.Add(new ResPassiveBonusData(Common.PassiveBonusType.CritChance, parent.Element("crit_chance")));
            bonuses.Add(new ResPassiveBonusData(Common.PassiveBonusType.CritDamage, parent.Element("crit_damage")));
            bonuses.Add(new ResPassiveBonusData(Common.PassiveBonusType.Damage, parent.Element("damage")));
            bonuses.Add(new ResPassiveBonusData(Common.PassiveBonusType.Resist, parent.Element("resist")));
            bonuses.Add(new ResPassiveBonusData(Common.PassiveBonusType.MaxHP, parent.Element("max_hp")));
            bonuses.Add(new ResPassiveBonusData(Common.PassiveBonusType.MaxEnergy, parent.Element("max_energy")));
            bonuses.Add(new ResPassiveBonusData(Common.PassiveBonusType.ColoredLoot, parent.Element("colored_loot")));
            bonuses.Add(new ResPassiveBonusData(Common.PassiveBonusType.RestoreHPSpeed, parent.Element("restore_hp")));
            bonuses.Add(new ResPassiveBonusData(Common.PassiveBonusType.RestoreEnergy, parent.Element("restore_energy")));
            bonuses.Add(new ResPassiveBonusData(Common.PassiveBonusType.OptimalDistance, parent.Element("optimal_distance")));
            bonuses.Add(new ResPassiveBonusData(Common.PassiveBonusType.ChanceNotDropLootAtDeath, parent.Element("chance_dont_drop_loot")));
            bonuses.Add(new ResPassiveBonusData(Common.PassiveBonusType.ChanceCraftColoredModule, parent.Element("chance_craft_colored_module")));
        }
Пример #2
0
        public Dictionary <string, Dictionary <string, ResGameEventData> > LoadFile(string xml)
        {
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif

            return(document.Element("zones").Elements("zone").Select(zoneElement => {
                string zoneId = zoneElement.GetString("id");
                Dictionary <string, ResGameEventData> zoneGameEvents = zoneElement.Element("events").Elements("event").Select(eventElement => {
                    string eventId = eventElement.GetString("id");
                    float cooldown = eventElement.GetFloat("cooldown");
                    float radius = eventElement.GetFloat("radius");
                    string description = eventElement.GetString("description");
                    float[] position = eventElement.GetFloatArray("position");
                    return new ResGameEventData {
                        cooldown = cooldown,
                        descriptionId = description,
                        id = eventId,
                        position = position,
                        radius = radius
                    };
                }).ToDictionary(data => data.id, data => data);

                return new { ZoneId = zoneId, Events = zoneGameEvents };
            }).ToDictionary(data => data.ZoneId, data => data.Events));
        }
Пример #3
0
 private void LoadDocument(UPXDocument document)
 {
     maxCount = document.Element("slots").GetAttributeInt("max_count");
     prices   = document.Element("slots").Elements("slot").Select(slotElement => {
         return(new BankSlotPrice(slotElement));
     }).ToList();
 }
Пример #4
0
        public void LoadFromFile(string path)
        {
            UPXDocument document = new UPXDocument();

            document.LoadFromFile(path);
            LoadDocument(document);
        }
Пример #5
0
        public void Load(string xml)
        {
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif

            this.items = document.Element("items").Elements("item").Select(e => {
                string id = e.GetString("id");
                InventoryObjectType type = (InventoryObjectType)Enum.Parse(typeof(InventoryObjectType), e.GetString("type"));
                string name    = e.GetString("name");
                Hashtable data = new Hashtable();

                var dump = e.Element("inputs").Elements("input").Select(ie => {
                    string key     = ie.GetString("key");
                    string valType = ie.GetString("type");
                    string valStr  = ie.GetString("value");
                    object val     = CommonUtils.ParseValue(valStr, valType);
                    data.Add(key, val);
                    return(key);
                }).ToList();

                return(new ResMiscInventoryItemData(id, type, name, data));
            }).ToDictionary(obj => obj.Id(), obj => obj);
        }
Пример #6
0
        public static List <ResSkillData> LoadSkills(string text)
        {
#if UP
            UPXDocument document = new UPXDocument(text);
#else
            XDocument document = XDocument.Parse(text);
#endif
            return(document.Element("skills").Elements("skill").Select(e => {
                Hashtable inputs = new Hashtable();
                var dump = e.Element("inputs").Elements("input").Select(i =>
                {
                    inputs.Add(i.Attribute("key").Value, CommonUtils.ParseValue(i.Attribute("value").Value, i.Attribute("type").Value));
                    return i.Attribute("key").Value;
                }).ToList();
                return new ResSkillData
                {
                    cooldown = e.GetFloat("cooldown"),
                    description = e.GetString("description"),
                    durability = e.GetFloat("durability"),
                    energy = e.GetFloat("energy"),
                    id = int.Parse(e.GetString("id"), System.Globalization.NumberStyles.HexNumber),
                    name = e.GetString("name"),
                    type = (SkillType)Enum.Parse(typeof(SkillType), e.Attribute("type").Value),
                    inputs = inputs,
                    targetType = (SkillTargetType)Enum.Parse(typeof(SkillTargetType), e.GetString("target_type"))
                };
            }).ToList());
        }
Пример #7
0
        public void Load(string xml)
        {
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            var document = XDocument.Parse(xml);
#endif
            this.races = document.Element("races").Elements("race").Select(re => {
                Race raceId              = (Race)Enum.Parse(typeof(Race), re.GetString("id"));
                string raceNameId        = re.GetString("name");
                string raceDescriptionId = re.GetString("description");
                var raceWorkshops        = re.Element("workshops").Elements("workshop").Select(we => {
                    Workshop workshopId          = (Workshop)Enum.Parse(typeof(Workshop), we.GetString("id"));
                    string workshopNameId        = we.GetString("name");
                    string workshopDescriptionId = we.GetString("description");
                    return(new ClientRaceWorkshop {
                        Id = workshopId,
                        NameStringId = workshopNameId,
                        DescriptionStringId = workshopDescriptionId
                    });
                }).ToList();

                return(new ClientRace {
                    Id = raceId,
                    DescriptionStringId = raceDescriptionId,
                    NameStringId = raceNameId,
                    Workshops = raceWorkshops
                });
            }).ToDictionary(cr => cr.Id, cr => cr);
        }
Пример #8
0
        public UniXmlDocument(string text)
        {
#if UP
            document = new UPXDocument(text);
#else
            document = XDocument.Parse(text);
#endif
        }
Пример #9
0
        public void LoadText(string xml)
        {
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif
            Load(document.Element("bonuses"));
        }
Пример #10
0
        public void LoadFromXmlText(string xml)
        {
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif
            LoadFromDocument(document);
        }
Пример #11
0
 private void LoadFromDocument(UPXDocument document)
 {
     this.levelExpDictionary.Clear();
     this.levelCap           = document.Element("leveling").Attribute("level_cap").ToInt();
     this.levelExpDictionary = document.Element("leveling").Elements("data").Select(e =>
     {
         int level       = e.Attribute("level").ToInt();
         int expForLevel = e.Attribute("exp_for_level").ToInt();
         return(new { Level = level, ExpForLevel = expForLevel });
     }).ToDictionary(obj => obj.Level, obj => obj.ExpForLevel);
 }
Пример #12
0
        public void Load(string xml)
        {
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif
            consumables = document.Element("items").Elements("item").Select(itemElement => {
                var cons = new ResConsumableInfo(itemElement);
                return(cons);
            }).ToDictionary(c => c.id, c => c);
        }
Пример #13
0
        public void Load(string basePath)
        {
            string fullPath = Path.Combine(basePath, "Data/fractions.xml");

#if UP
            UPXDocument document = new UPXDocument();
            document.LoadFromFile(fullPath);
#else
            XDocument document = XDocument.Load(fullPath);
#endif
            LoadFromDocument(document);
        }
Пример #14
0
        public void Load(string xml)
        {
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif
            stats = document.Element("stats").Elements("workshop").Select(e => {
                WorkshopStatData stat = new WorkshopStatData(e);
                return(stat);
            }).ToDictionary(s => s.workshop, s => s);
        }
Пример #15
0
        public void Load(string xml)
        {
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif
            m_Items = document.Element("items").Elements("item").Select(itemElement => {
                InapItem item = new InapItem(itemElement);
                return(item);
            }).ToDictionary(item => item.id, item => item);
        }
Пример #16
0
        public void Load(string xmlText)
        {
            mConnections.Clear();
#if UP
            UPXDocument document = new UPXDocument(xmlText);
#else
            XDocument document = XDocument.Parse(xmlText);
#endif
            mConnections = document.Element("subzones").Elements("subzone").Select(element => {
                return(new SubZoneWorldConnection(element));
            }).ToDictionary(s => s.subZone, s => s);
        }
Пример #17
0
        public void Load(string xml)
        {
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif
            prefabs = document.Element("prefabs").Elements("prefab").Select(prefabElement => {
                string id   = prefabElement.GetString("id");
                string path = prefabElement.GetString("path");
                return(new { id = id, path = path });
            }).ToDictionary(obj => obj.id, obj => obj.path);
        }
Пример #18
0
        public void Load(string xml)
        {
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif

            m_Items = document.Element("game_inaps").Elements("game_inap").Select(inapElement => {
                InapObject inapObject = new InapObject(inapElement);
                return(inapObject);
            }).ToDictionary(inapObject => inapObject.id, inapObject => inapObject);
        }
Пример #19
0
        public void Load(string xml)
        {
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif
            schemes = document.Element("schemes").Elements("scheme").Select(e => {
                Workshop w  = (Workshop)Enum.Parse(typeof(Workshop), e.GetString("workshop"));
                string icon = e.GetString("icon");
                return(new ResSchemeData(w, icon));
            }).ToDictionary(s => s.Workshop, s => s);
        }
Пример #20
0
        public void Load(string xml)
        {
            mAsteroids.Clear();
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif
            mAsteroids = document.Element("asteroids").Elements("asteroid").Select(e => {
                AsteroidData data = new AsteroidData(e);
                return(data);
            }).ToDictionary(d => d.ID, d => d);
        }
Пример #21
0
        public void Load(string xml)
        {
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif

            petUpgrades = new PetUpgradeTable();
            petUpgrades.Load(document.Element("pets").Element("upgrades"));

            masteryUpgrades = new PetMasteryUpgradeTable();
            masteryUpgrades.Load(document.Element("pets").Element("mastery_upgrades"));
        }
Пример #22
0
        public void Load(string xml)
        {
#if UP
            UPXDocument document = new UPXDocument(xml);
            tips = document.Element("tips").Elements("tip").Select(e => {
                return(new TipInfo(e));
            }).ToList();
#else
            XDocument document = XDocument.Parse(xml);
            tips = document.Element("tips").Elements("tip").Select(e => {
                return(new TipInfo(e));
            }).ToList();
#endif
        }
Пример #23
0
        public void Load(string xml)
        {
            m_CraftResources = new Dictionary <string, CraftResourceData>();
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif
            var dump = document.Element("resources").Elements("res").Select(element => {
                CraftResourceData data = new CraftResourceData(element);
                m_CraftResources.Add(data.id, data);
                return(data);
            }).ToList();
        }
Пример #24
0
        public static Dictionary <string, string> LoadStrings(string xml)
        {
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif
            return(document.Element("strings").Elements("string").Select(e =>
            {
                string key = e.Attribute("key").Value;
                string content = e.Value;
                return new KeyValuePair <string, string>(key, content);
            }).ToDictionary(kv => kv.Key, kv => kv.Value));
        }
Пример #25
0
        private void LoadFromDocument(UPXDocument document)
        {
            relations = new Dictionary <FractionType, Dictionary <FractionType, FractionRelation> >();

            relations = document.Element("fractions").Elements("fraction").Select(e => {
                var relations = e.Element("relations").Elements("relation").Select(e2 => {
                    FractionType toFraction = (FractionType)Enum.Parse(typeof(FractionType), e2.GetString("to"));
                    FractionRelation rel    = (FractionRelation)Enum.Parse(typeof(FractionRelation), e2.GetString("value"));
                    return(new { FRACTION = toFraction, RELATION = rel });
                }).ToDictionary(obj => obj.FRACTION, obj => obj.RELATION);

                FractionType sourceFraction = (FractionType)Enum.Parse(typeof(FractionType), e.GetString("name"));
                return(new { SOURCEFRACTION = sourceFraction, SOURCERELATIONS = relations });
            }).ToDictionary(obj => obj.SOURCEFRACTION, obj => obj.SOURCERELATIONS);
        }
Пример #26
0
        public void Load(string xml)
        {
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif
            nebulaElements = new Dictionary <string, NebulaElementData>();

            var dumpList = document.Element("nebula_elements").Elements("element").Select(element => {
                NebulaElementData data = new NebulaElementData(element);
                nebulaElements.Add(data.id, data);
                return(data);
            }).ToList();
        }
Пример #27
0
        public void Load(string xml)
        {
            sections.Clear();
#if UP
            UPXDocument document = new UPXDocument(xml);
            sections = document.Element("help").Elements("section").Select(e => {
                return(new HelpSection(e));
            }).ToList();
#else
            XDocument document = XDocument.Parse(xml);
            sections = document.Element("help").Elements("section").Select(e => {
                return(new HelpSection(e));
            }).ToList();
#endif
        }
Пример #28
0
        public void Load(string xml)
        {
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif
            var locations = document.Element("zones").Elements("zone").Select(ze => {
                return(Location.Parse(ze));
            }).ToList();
            foreach (var loc in locations)
            {
                mLocations.Add(loc.id, loc);
            }
        }
Пример #29
0
        public void Load(string xml)
        {
#if UP
            UPXDocument document = new UPXDocument(xml);
#else
            XDocument document = XDocument.Parse(xml);
#endif
            this.zones = document.Element("zones").Elements("zone").Select(e =>
            {
                string id          = e.Attribute("id").Value;
                string scene       = e.Attribute("scene").Value;
                string displayName = e.Attribute("display_name").Value;
                bool isAvailable   = e.GetBool("available", false);
                return(new ResZoneInfo(id, scene, displayName, isAvailable));
            }).ToDictionary(z => z.Id(), z => z);
        }
Пример #30
0
        public static Dictionary <string, ResTooltipData> LoadTooltips(string text)
        {
#if UP
            UPXDocument document = new UPXDocument(text);
#else
            XDocument document = XDocument.Parse(text);
#endif
            return(document.Element("tooltips").Elements("tooltip").Select(e =>
            {
                string id = e.GetString("id");
                string tooltipText = e.Value;
                return new ResTooltipData {
                    Id = id, Text = tooltipText
                };
            }).ToDictionary(t => t.Id, t => t));
        }