Exemple #1
0
        public EC_War(XDocument xdoc, World world)
            : base(xdoc, world)
        {
            foreach (var element in xdoc.Root.Elements())
            {
                var val = element.Value;
                int valI;
                int.TryParse(val, out valI);

                switch (element.Name.LocalName)
                {
                case "id":
                case "start_year":
                case "start_seconds72":
                case "end_year":
                case "end_seconds72":
                case "event":
                case "type":
                    break;

                case "eventcol":
                    if (EventColIDs == null)
                    {
                        EventColIDs = new List <int>();
                    }
                    EventColIDs.Add(valI);
                    break;

                case "name":
                    Name = val.ToTitleCase();
                    break;

                case "aggressor_ent_id":
                    AggressorEntId = valI;
                    break;

                case "defender_ent_id":
                    DefenderEntId = valI;
                    break;

                default:
                    DFXMLParser.UnexpectedXmlElement(xdoc.Root.Name.LocalName + "\t" + Types[Type], element, xdoc.Root.ToString());
                    break;
                }
            }
        }
Exemple #2
0
        public EC_Battle(XDocument xdoc, World world)
            : base(xdoc, world)
        {
            foreach (var element in xdoc.Root.Elements())
            {
                var val = element.Value;
                int valI;
                int.TryParse(val, out valI);

                switch (element.Name.LocalName)
                {
                case "id":
                case "start_year":
                case "start_seconds72":
                case "end_year":
                case "end_seconds72":
                case "event":
                case "type":
                    break;

                case "subregion_id":
                    if (valI != -1)
                    {
                        SubregionId = valI;
                    }
                    break;

                case "feature_layer_id":
                    if (valI != -1)
                    {
                        FeatureLayerId = valI;
                    }
                    break;

                case "site_id":
                    if (valI != -1)
                    {
                        SiteId = valI;
                    }
                    break;

                case "coords":
                    Coords = new Point(Convert.ToInt32(val.Split(',')[0]), Convert.ToInt32(val.Split(',')[1]));
                    break;

                case "eventcol":
                    if (EventColIDs == null)
                    {
                        EventColIDs = new List <int>();
                    }
                    EventColIDs.Add(valI);
                    break;

                case "name":
                    Name = val.ToTitleCase();
                    break;

                case "attacking_hfid":
                    if (AttackingHfid == null)
                    {
                        AttackingHfid = new List <int>();
                    }
                    AttackingHfid.Add(valI);
                    break;

                case "defending_hfid":
                    if (DefendingHfid == null)
                    {
                        DefendingHfid = new List <int>();
                    }
                    DefendingHfid.Add(valI);
                    break;

                case "war_eventcol":
                    WarEventColId = valI;
                    break;

                case "noncom_hfid":
                    if (NonComHfid == null)
                    {
                        NonComHfid = new List <int>();
                    }
                    NonComHfid.Add(valI);
                    break;

                case "attacking_squad_race":
                    if (AttackingSquadRace == null)
                    {
                        AttackingSquadRace = new List <string>();
                    }
                    AttackingSquadRace.Add(val);
                    break;

                case "attacking_squad_entity_pop":
                    if (AttackingSquadEntityPop == null)
                    {
                        AttackingSquadEntityPop = new List <int>();
                    }
                    AttackingSquadEntityPop.Add(valI);
                    break;

                case "attacking_squad_number":
                    if (AttackingSquadNumber == null)
                    {
                        AttackingSquadNumber = new List <int>();
                    }
                    AttackingSquadNumber.Add(valI);
                    break;

                case "attacking_squad_deaths":
                    if (AttackingSquadDeaths == null)
                    {
                        AttackingSquadDeaths = new List <int>();
                    }
                    AttackingSquadDeaths.Add(valI);
                    break;

                case "attacking_squad_site":
                    if (AttackingSquadSite == null)
                    {
                        AttackingSquadSite = new List <int>();
                    }
                    AttackingSquadSite.Add(valI);
                    break;

                case "defending_squad_race":
                    if (DefendingSquadRace == null)
                    {
                        DefendingSquadRace = new List <string>();
                    }
                    DefendingSquadRace.Add(val);
                    break;

                case "defending_squad_entity_pop":
                    if (DefendingSquadEntityPop == null)
                    {
                        DefendingSquadEntityPop = new List <int>();
                    }
                    DefendingSquadEntityPop.Add(valI);
                    break;

                case "defending_squad_number":
                    if (DefendingSquadNumber == null)
                    {
                        DefendingSquadNumber = new List <int>();
                    }
                    DefendingSquadNumber.Add(valI);
                    break;

                case "defending_squad_deaths":
                    if (DefendingSquadDeaths == null)
                    {
                        DefendingSquadDeaths = new List <int>();
                    }
                    DefendingSquadDeaths.Add(valI);
                    break;

                case "defending_squad_site":
                    if (DefendingSquadSite == null)
                    {
                        DefendingSquadSite = new List <int>();
                    }
                    DefendingSquadSite.Add(valI);
                    break;

                case "outcome":
                    Outcome = val;
                    break;

                default:
                    DFXMLParser.UnexpectedXmlElement(xdoc.Root.Name.LocalName + "\t" + Types[Type], element, xdoc.Root.ToString());
                    break;
                }
            }
        }