Exemple #1
0
        public Abduction(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "ordinal": Ordinal = String.Intern(property.Value); break;

                case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;

                case "parent_eventcol": ParentCollection = world.GetEventCollection(Convert.ToInt32(property.Value)); break;

                case "subregion_id": Region = world.GetRegion(Convert.ToInt32(property.Value)); break;

                case "feature_layer_id": UndergroundRegion = world.GetUndergroundRegion(Convert.ToInt32(property.Value)); break;

                case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;

                case "attacking_enid": Attacker = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "defending_enid": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break;
                }
            }
        }
 private void ReadSiteOwner()
 {
     if (CurrentLine.Contains("Owner:"))
     {
         string entityName = CurrentLine.Substring(CurrentLine.IndexOf(":") + 2, CurrentLine.IndexOf(",") - CurrentLine.IndexOf(":") - 2);
         try
         {
             Owner = World.GetEntity(entityName);
         }
         catch (Exception ex)
         {
             Owner = World.EntitiesByName.FirstOrDefault(e => e.Name.Equals(entityName, StringComparison.OrdinalIgnoreCase) && e.Sites.Contains(Site));
             if (Owner == null)
             {
                 World.ParsingErrors.Report(ex.Message + ", Site Owner of " + Site.Name);
             }
         }
         if (Owner != null)
         {
             Owner.Race = Formatting.InitCaps(CurrentLine.Substring(CurrentLine.IndexOf(",") + 2, CurrentLine.Length - CurrentLine.IndexOf(",") - 2));
             if (string.IsNullOrWhiteSpace(Owner.Race))
             {
                 Owner.Race = "Unknown";
             }
         }
         ReadLine();
     }
 }
        public SiteConquered(List<Property> properties, World world)
            : base(properties, world)
        {
            Initialize();
            foreach (Property property in properties)
                switch (property.Name)
                {
                    case "ordinal": Ordinal = Convert.ToInt32(property.Value); break;
                    case "war_eventcol": ParentCollection = world.GetEventCollection(Convert.ToInt32(property.Value)); break;
                    case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;
                    case "attacking_enid": Attacker = world.GetEntity(Convert.ToInt32(property.Value)); break;
                    case "defending_enid": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break;
                }

            

            if (Collection.OfType<PlunderedSite>().Any()) ConquerType = SiteConqueredType.Pillaging;
            else if (Collection.OfType<DestroyedSite>().Any()) ConquerType = SiteConqueredType.Destruction;
            else if (Collection.OfType<NewSiteLeader>().Any() || Collection.OfType<SiteTakenOver>().Any()) ConquerType = SiteConqueredType.Conquest;
            else ConquerType = SiteConqueredType.Unknown;

            if (ConquerType == SiteConqueredType.Pillaging) Notable = false;

            Site.Warfare.Add(this);
            if (ParentCollection != null)
            {
                (ParentCollection as War).DeathCount += Collection.OfType<HFDied>().Count();

                if (Attacker == (ParentCollection as War).Attacker) 
                    (ParentCollection as War).AttackerVictories.Add(this);
                else 
                    (ParentCollection as War).DefenderVictories.Add(this);
            }

        }
Exemple #4
0
        public War(List <Property> properties, World world)
            : base(properties, world)
        {
            Initialize();
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "name": Name = Formatting.InitCaps(property.Value); break;

                case "aggressor_ent_id": Attacker = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "defender_ent_id": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break;
                }
            }
            Defender.Wars.Add(this);
            if (Defender.Parent != null)
            {
                Defender.Parent.Wars.Add(this);
            }
            Attacker.Wars.Add(this);
            if (Attacker.Parent != null)
            {
                Attacker.Parent.Wars.Add(this);
            }
            if (EndYear >= 0)
            {
                Length = EndYear - StartYear;
            }
            else if (world.Events.Count > 0)
            {
                Length = world.Events.Last().Year - StartYear;
            }
        }
Exemple #5
0
        public Theft(List<Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
                switch (property.Name)
                {
                    case "ordinal": Ordinal = String.Intern(property.Value); break;
                    case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;
                    case "parent_eventcol": ParentCollection = world.GetEventCollection(Convert.ToInt32(property.Value)); break;
                    case "subregion_id": Region = world.GetRegion(Convert.ToInt32(property.Value)); break;
                    case "feature_layer_id": UndergroundRegion = world.GetUndergroundRegion(Convert.ToInt32(property.Value)); break;
                    case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;
                    case "attacking_enid": Attacker = world.GetEntity(Convert.ToInt32(property.Value)); break;
                    case "defending_enid": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break;
                }

            foreach (ItemStolen theft in Collection.OfType<ItemStolen>())
            {
                theft.Site = Site;
                Site.AddEvent(theft);
                Site.Events = Site.Events.OrderBy(ev => ev.ID).ToList();
                if (Attacker.SiteHistory.Count == 1)
                {
                    theft.ReturnSite = Attacker.SiteHistory.First().Site;
                    theft.ReturnSite.AddEvent(theft);
                    theft.ReturnSite.Events = theft.ReturnSite.Events.OrderBy(ev => ev.ID).ToList();
                }

            }
        }
        public SiteConquered(List <Property> properties, World world)
            : base(properties, world)
        {
            Initialize();
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "ordinal": Ordinal = Convert.ToInt32(property.Value); break;

                case "war_eventcol": ParentCollection = world.GetEventCollection(Convert.ToInt32(property.Value)); break;

                case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;

                case "attacking_enid": Attacker = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "defending_enid": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break;
                }
            }



            if (Collection.OfType <PlunderedSite>().Any())
            {
                ConquerType = SiteConqueredType.Pillaging;
            }
            else if (Collection.OfType <DestroyedSite>().Any())
            {
                ConquerType = SiteConqueredType.Destruction;
            }
            else if (Collection.OfType <NewSiteLeader>().Any() || Collection.OfType <SiteTakenOver>().Any())
            {
                ConquerType = SiteConqueredType.Conquest;
            }
            else
            {
                ConquerType = SiteConqueredType.Unknown;
            }

            if (ConquerType == SiteConqueredType.Pillaging)
            {
                Notable = false;
            }

            Site.Warfare.Add(this);
            if (ParentCollection != null)
            {
                (ParentCollection as War).DeathCount += Collection.OfType <HFDied>().Count();

                if (Attacker == (ParentCollection as War).Attacker)
                {
                    (ParentCollection as War).AttackerVictories.Add(this);
                }
                else
                {
                    (ParentCollection as War).DefenderVictories.Add(this);
                }
            }
        }
 public EntityEntityLink(List<Property> properties, World world)
 {
     Type = EntityEntityLinkType.Unknown;
     foreach (Property property in properties)
     {
         switch (property.Name)
         {
             case "type":
                 switch (property.Value)
                 {
                     case "CHILD":
                         Type = EntityEntityLinkType.Child;
                         break;
                     case "PARENT":
                         Type = EntityEntityLinkType.Parent;
                         break;
                     default:
                         world.ParsingErrors.Report("Unknown Entity Entity Link Type: " + property.Value);
                         break;
                 }
                 break;
             case "target":
                 Target = world.GetEntity(Convert.ToInt32(property.Value));
                 break;
             case "strength":
                 Strength = Convert.ToInt32(property.Value);
                 break;
         }
     }
 }
Exemple #8
0
        public Identity(List <Property> properties, World world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "id": Id = Convert.ToInt32(property.Value); break;

                case "name": Name = Formatting.InitCaps(property.Value.Replace("'", "`")); break;

                case "nemesis_id":
                case "histfig_id":
                    HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value));
                    break;

                case "birth_year": BirthYear = Convert.ToInt32(property.Value); break;

                case "birth_second": BirthSeconds72 = Convert.ToInt32(property.Value); break;

                case "entity_id": Entity = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "race": Race = world.GetCreatureInfo(property.Value); break;

                case "caste": Caste = string.Intern(Formatting.InitCaps(property.Value.ToLower().Replace('_', ' '))); break;

                case "profession": Profession = string.Intern(Formatting.InitCaps(property.Value.ToLower().Replace('_', ' '))); break;
                }
            }

            HistoricalFigure?.Identities.Add(this);
        }
        public EntityEntityLink(List <Property> properties, World world)
        {
            Type = EntityEntityLinkType.Unknown;
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "type":
                    switch (property.Value)
                    {
                    case "CHILD":
                        Type = EntityEntityLinkType.Child;
                        break;

                    case "PARENT":
                        Type = EntityEntityLinkType.Parent;
                        break;

                    default:
                        world.ParsingErrors.Report("Unknown Entity Entity Link Type: " + property.Value);
                        break;
                    }
                    break;

                case "target":
                    Target = world.GetEntity(Convert.ToInt32(property.Value));
                    break;

                case "strength":
                    Strength = Convert.ToInt32(property.Value);
                    break;
                }
            }
        }
Exemple #10
0
        public BeastAttack(List<Property> properties, World world)
            : base(properties, world)
        {
            Initialize();

            foreach (Property property in properties)
                switch (property.Name)
                {
                    case "ordinal": Ordinal = Convert.ToInt32(property.Value); break;
                    case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;
                    case "parent_eventcol": ParentCollection = world.GetEventCollection(Convert.ToInt32(property.Value)); break;
                    case "subregion_id": Region = world.GetRegion(Convert.ToInt32(property.Value)); break;
                    case "feature_layer_id": UndergroundRegion = world.GetUndergroundRegion(Convert.ToInt32(property.Value)); break;
                    case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;
                    case "defending_enid": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break;
                }

            Site.BeastAttacks.Add(this);

            //--------Attacking Beast is calculated after parsing event collections in ParseXML()
            //--------So that it can also look at eventsList from duel sub collections to calculate the Beast

            //-------Fill in some missing event details with details from collection
            //-------Filled in after parsing event collections in ParseXML()
        }
Exemple #11
0
 public Abduction(List<Property> properties, World world)
     : base(properties, world)
 {
     foreach (Property property in properties)
         switch (property.Name)
         {
             case "ordinal": Ordinal = String.Intern(property.Value); break;
             case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;
             case "parent_eventcol": ParentCollection = world.GetEventCollection(Convert.ToInt32(property.Value)); break;
             case "subregion_id": Region = world.GetRegion(Convert.ToInt32(property.Value)); break;
             case "feature_layer_id": UndergroundRegion = world.GetUndergroundRegion(Convert.ToInt32(property.Value)); break;
             case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;
             case "attacking_enid": Attacker = world.GetEntity(Convert.ToInt32(property.Value)); break;
             case "defending_enid": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break;
         }
 }
Exemple #12
0
        public BeastAttack(List <Property> properties, World world)
            : base(properties, world)
        {
            Initialize();

            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "ordinal": Ordinal = Convert.ToInt32(property.Value); break;

                case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;

                case "parent_eventcol": ParentEventCol = world.GetEventCollection(Convert.ToInt32(property.Value)); break;

                case "subregion_id": Region = world.GetRegion(Convert.ToInt32(property.Value)); break;

                case "feature_layer_id": UndergroundRegion = world.GetUndergroundRegion(Convert.ToInt32(property.Value)); break;

                case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;

                case "defending_enid": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break;
                }
            }

            Site.BeastAttacks.Add(this);

            //--------Attacking Beast is calculated after parsing event collections in ParseXML()
            //--------So that it can also look at eventsList from duel sub collections to calculate the Beast

            //-------Fill in some missing event details with details from collection
            //-------Filled in after parsing event collections in ParseXML()
        }
        private void ReadSiteOwner()
        {
            if (CurrentLine.Contains("Owner:"))
            {
                string entityName = CurrentLine.Substring(CurrentLine.IndexOf(":") + 2, CurrentLine.IndexOf(",") - CurrentLine.IndexOf(":") - 2);
                try
                {
                    Owner      = World.GetEntity(entityName);
                    Owner.Race = Formatting.InitCaps(CurrentLine.Substring(CurrentLine.IndexOf(",") + 2, CurrentLine.Length - CurrentLine.IndexOf(",") - 2));
                }
                catch (Exception e)
                {
                    World.ParsingErrors.Report(e.Message + ", Site Owner of " + Site.Name);
                }

                ReadLine();
            }
        }
Exemple #14
0
        public EntityLink(List <Property> properties, World world)
        {
            Strength  = 0;
            StartYear = -1;
            EndYear   = -1;
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "entity_id":
                    int id = Convert.ToInt32(property.Value);
                    Entity = world.GetEntity(id);
                    break;

                case "position_profile_id": PositionId = Convert.ToInt32(property.Value); break;

                case "start_year":
                    StartYear = Convert.ToInt32(property.Value);
                    Type      = EntityLinkType.Position;
                    break;

                case "end_year":
                    EndYear = Convert.ToInt32(property.Value);
                    Type    = EntityLinkType.FormerPosition;
                    break;

                case "link_strength": Strength = Convert.ToInt32(property.Value); break;

                case "link_type":
                    EntityLinkType linkType;
                    if (!Enum.TryParse(Formatting.InitCaps(property.Value), out linkType))
                    {
                        switch (property.Value)
                        {
                        case "former member": Type = EntityLinkType.FormerMember; break;

                        case "former prisoner": Type = EntityLinkType.FormerPrisoner; break;

                        case "former slave": Type = EntityLinkType.FormerSlave; break;

                        default:
                            Type = EntityLinkType.Unknown;
                            world.ParsingErrors.Report("Unknown Entity Link Type: " + property.Value);
                            break;
                        }
                    }
                    else
                    {
                        Type = linkType;
                    }
                    break;
                }
            }
        }
Exemple #15
0
 public War(List<Property> properties, World world)
     : base(properties, world)
 {
     Initialize();
     foreach (Property property in properties)
         switch (property.Name)
         {
             case "name": Name = Formatting.InitCaps(property.Value); break;
             case "aggressor_ent_id": Attacker = world.GetEntity(Convert.ToInt32(property.Value)); break;
             case "defender_ent_id": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break;
         }
     Defender.Wars.Add(this);
     if (Defender.Parent != null)
         Defender.Parent.Wars.Add(this);
     Attacker.Wars.Add(this);
     if (Attacker.Parent != null)
         Attacker.Parent.Wars.Add(this);
     if (EndYear >= 0)
         Length = EndYear - StartYear;
     else if (world.Events.Count > 0)
         Length = world.Events.Last().Year - StartYear;
 }
 public EntityReputation(List<Property> properties, World world)
 {
     foreach (Property property in properties)
     {
         switch (property.Name)
         {
             case "entity_id": Entity = world.GetEntity(Convert.ToInt32(property.Value)); break;
             case "unsolved_murders": UnsolvedMurders = Convert.ToInt32(property.Value); break;
             case "first_ageless_year": FirstSuspectedAgelessYear = Convert.ToInt32(property.Value); break;
             case "first_ageless_season_count": FirstSuspectedAglessSeason = Formatting.TimeCountToSeason(Convert.ToInt32(property.Value)); break;
         }
     }
 }
Exemple #17
0
 public void Resolve(World world)
 {
     Inhabitants = new List <HistoricalFigure>();
     if (InhabitantIDs.Any())
     {
         foreach (int inhabitantId in InhabitantIDs)
         {
             Inhabitants.Add(world.GetHistoricalFigure(inhabitantId));
         }
     }
     if (DeityId != -1)
     {
         Deity = world.GetHistoricalFigure(DeityId);
     }
     if (ReligionId != -1)
     {
         Religion = world.GetEntity(ReligionId);
     }
     if (EntityId != -1)
     {
         Entity = world.GetEntity(EntityId);
     }
     if (Deity != null && Religion != null)
     {
         if (!Religion.Worshipped.Contains(Deity))
         {
             Religion.Worshipped.Add(Deity);
             Deity.DedicatedStructures.Add(this);
         }
     }
     CopiedArtifacts = new List <Artifact>();
     if (CopiedArtifactIds.Any())
     {
         foreach (int copiedArtifactId in CopiedArtifactIds)
         {
             CopiedArtifacts.Add(world.GetArtifact(copiedArtifactId));
         }
     }
 }
Exemple #18
0
        public Theft(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "ordinal": Ordinal = String.Intern(property.Value); break;

                case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;

                case "parent_eventcol": ParentCollection = world.GetEventCollection(Convert.ToInt32(property.Value)); break;

                case "subregion_id": Region = world.GetRegion(Convert.ToInt32(property.Value)); break;

                case "feature_layer_id": UndergroundRegion = world.GetUndergroundRegion(Convert.ToInt32(property.Value)); break;

                case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;

                case "attacking_enid": Attacker = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "defending_enid": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break;
                }
            }

            foreach (ItemStolen theft in Collection.OfType <ItemStolen>())
            {
                theft.Site = Site;
                Site.AddEvent(theft);
                Site.Events = Site.Events.OrderBy(ev => ev.ID).ToList();
                if (Attacker.SiteHistory.Count == 1)
                {
                    theft.ReturnSite = Attacker.SiteHistory.First().Site;
                    theft.ReturnSite.AddEvent(theft);
                    theft.ReturnSite.Events = theft.ReturnSite.Events.OrderBy(ev => ev.ID).ToList();
                }
            }
        }
Exemple #19
0
        private bool ReadCiv()
        {
            string civName = CurrentLine.Substring(0, CurrentLine.IndexOf(","));

            try
            {
                CurrentCiv = World.GetEntity(civName);
            }
            catch (Exception e)
            {
                Log.AppendLine(e.Message + ", Civ");
                ReadLine();
                return(false);
            }
            CurrentCiv.Race = Formatting.InitCaps(CurrentLine.Substring(CurrentLine.IndexOf(",") + 2, CurrentLine.Length - CurrentLine.IndexOf(",") - 2).ToLower());
            foreach (Entity group in CurrentCiv.Groups)
            {
                group.Race = CurrentCiv.Race;
            }
            CurrentCiv.IsCiv = true;
            ReadLine();
            return(true);
        }
Exemple #20
0
        public SiteLink(List <Property> properties, World world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "link_type":
                    switch (property.Value)
                    {
                    case "lair": Type = SiteLinkType.Lair; break;

                    case "hangout": Type = SiteLinkType.Hangout; break;

                    case "home site building": Type = SiteLinkType.HomeSiteBuilding; break;

                    case "home site underground": Type = SiteLinkType.HomeSiteUnderground; break;

                    case "home structure": Type = SiteLinkType.HomeStructure; break;

                    case "seat of power": Type = SiteLinkType.SeatOfPower; break;

                    case "occupation": Type = SiteLinkType.Occupation; break;

                    default:
                        Type = SiteLinkType.Unknown;
                        world.ParsingErrors.Report("Unknown Site Link Type: " + property.Value);
                        break;
                    }
                    break;

                case "site_id":
                    Site = world.GetSite(Convert.ToInt32(property.Value));
                    break;

                case "sub_id":
                    SubID = Convert.ToInt32(property.Value);
                    break;

                case "entity_id":
                    Entity = world.GetEntity(Convert.ToInt32(property.Value));
                    break;

                case "occupation_id":
                    OccupationID = Convert.ToInt32(property.Value);
                    break;
                }
            }
        }
Exemple #21
0
        public EntityReputation(List <Property> properties, World world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "entity_id": Entity = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "unsolved_murders": UnsolvedMurders = Convert.ToInt32(property.Value); break;

                case "first_ageless_year": FirstSuspectedAgelessYear = Convert.ToInt32(property.Value); break;

                case "first_ageless_season_count": FirstSuspectedAglessSeason = Formatting.TimeCountToSeason(Convert.ToInt32(property.Value)); break;
                }
            }
        }
Exemple #22
0
 public void Resolve(World world, HistoricalFigure historicalFigure)
 {
     Entity = world.GetEntity(EntityId);
     if (Entity != null)
     {
         foreach (var honorId in HonorIds)
         {
             var honor = Entity.Honors.FirstOrDefault(h => h.Id == honorId);
             if (honor != null)
             {
                 honor.HonoredHfs.Add(historicalFigure);
                 Honors.Add(honor);
             }
         }
     }
 }
Exemple #23
0
        public SiteLink(List <Property> properties, World world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "link_type":
                    switch (property.Value)
                    {
                    case "lair": Type = SiteLinkType.Lair; break;

                    case "hangout": Type = SiteLinkType.Hangout; break;

                    case "home_site_building": Type = SiteLinkType.HomeSiteBuilding; break;

                    case "home_site_underground": Type = SiteLinkType.HomeSiteUnderground; break;

                    case "home_structure": Type = SiteLinkType.HomeStructure; break;

                    case "seat_of_power": Type = SiteLinkType.SeatOfPower; break;

                    case "occupation": Type = SiteLinkType.Occupation; break;

                    default:
                        property.Known = false;
                        break;
                    }
                    break;

                case "site_id":
                    Site = world.GetSite(Convert.ToInt32(property.Value));
                    break;

                case "sub_id":
                    SubId = Convert.ToInt32(property.Value);
                    break;

                case "entity_id":
                    Entity = world.GetEntity(Convert.ToInt32(property.Value));
                    break;

                case "occupation_id":
                    OccupationId = Convert.ToInt32(property.Value);
                    break;
                }
            }
        }
 public EntityPopulation(List<Property> properties, World world)
     : base(properties, world)
 {
     foreach (Property property in properties)
     {
         switch (property.Name)
         {
             case "race":
                 var raceCount = property.Value.Split(':');
                 Race = raceCount[0];
                 Count = Convert.ToInt32(raceCount[1]);
                 break;
             case "civ_id":
                 Entity = world.GetEntity(property.ValueAsInt());
                 break;
         }
     }
 }
Exemple #25
0
 public EntityLink(List<Property> properties, World world)
 {
     Strength = 0;
     StartYear = -1;
     EndYear = -1;
     foreach (Property property in properties)
     {
         switch (property.Name)
         {
             case "entity_id":
                 int id = Convert.ToInt32(property.Value);
                 Entity = world.GetEntity(id);
                 break;
             case "position_profile_id": PositionID = Convert.ToInt32(property.Value); break;
             case "start_year":
                 StartYear = Convert.ToInt32(property.Value);
                 Type = EntityLinkType.Position;
                 break;
             case "end_year":
                 EndYear = Convert.ToInt32(property.Value);
                 Type = EntityLinkType.FormerPosition;
                 break;
             case "link_strength": Strength = Convert.ToInt32(property.Value); break;
             case "link_type":
                 EntityLinkType linkType = EntityLinkType.Unknown;
                 if (!Enum.TryParse(Formatting.InitCaps(property.Value), out linkType))
                 {
                     switch (property.Value)
                     {
                         case "former member": Type = EntityLinkType.FormerMember; break;
                         case "former prisoner": Type = EntityLinkType.FormerPrisoner; break;
                         case "former slave": Type = EntityLinkType.FormerSlave; break;
                         default:
                             Type = EntityLinkType.Unknown;
                             world.ParsingErrors.Report("Unknown Entity Link Type: " + property.Value);
                             break;
                     }
                 }
                 else
                     Type = linkType;
                 break;
         }
     }
 }
        public EntityPopulation(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "race":
                    var raceCount = property.Value.Split(':');
                    Race  = raceCount[0];
                    Count = Convert.ToInt32(raceCount[1]);
                    break;

                case "civ_id":
                    Entity = world.GetEntity(property.ValueAsInt());
                    break;
                }
            }
        }
 public EntityReputation(List<Property> properties, World world)
 {
     foreach (Property property in properties)
     {
         switch (property.Name)
         {
             case "entity_id": Entity = world.GetEntity(Convert.ToInt32(property.Value)); break;
             case "unsolved_murders": UnsolvedMurders = Convert.ToInt32(property.Value); break;
             case "first_ageless_year": FirstSuspectedAgelessYear = Convert.ToInt32(property.Value); break;
             case "first_ageless_season_count": FirstSuspectedAgelessSeason = Formatting.TimeCountToSeason(Convert.ToInt32(property.Value)); break;
             case "rep_enemy_fighter": Reputations.Add(ReputationType.EnemyFighter, Convert.ToInt32(property.Value)); break;
             case "rep_trade_partner": Reputations.Add(ReputationType.TradePartner, Convert.ToInt32(property.Value)); break;
             case "rep_killer": Reputations.Add(ReputationType.Killer, Convert.ToInt32(property.Value)); break;
             case "rep_poet": Reputations.Add(ReputationType.Poet, Convert.ToInt32(property.Value)); break;
             case "rep_bard": Reputations.Add(ReputationType.Bard, Convert.ToInt32(property.Value)); break;
             case "rep_storyteller": Reputations.Add(ReputationType.Storyteller, Convert.ToInt32(property.Value)); break;
             case "rep_dancer": Reputations.Add(ReputationType.Dancer, Convert.ToInt32(property.Value)); break;
         }
     }
 }
Exemple #28
0
 public SiteLink(List<Property> properties, World world)
 {
     foreach (Property property in properties)
     {
         switch (property.Name)
         {
             case "link_type":
                 switch(property.Value)
                 {
                     case "lair": Type = SiteLinkType.Lair; break;
                     case "home site building": Type = SiteLinkType.HomeSiteBuilding; break;
                     case "home site underground": Type = SiteLinkType.HomeSiteUnderground; break;
                     case "home structure": Type = SiteLinkType.HomeStructure; break;
                     case "seat of power": Type = SiteLinkType.SeatOfPower; break;
                     default:
                         Type = SiteLinkType.Unknown;
                         world.ParsingErrors.Report("Unknown Site Link Type: " + property.Value);
                         break;
                 }
                 break;
             case "site_id":
                 Site = world.GetSite(Convert.ToInt32(property.Value));
                 break;
             case "sub_id":
                 SubID = Convert.ToInt32(property.Value);
                 break;
             case "entity_id":
                 Entity = world.GetEntity(Convert.ToInt32(property.Value));
                 break;
         }
     }
 }