public Entity(List <Property> properties, World world) : base(properties, world) { Name = ""; Race = "Unknown"; Parent = null; Worshipped = new List <HistoricalFigure>(); LeaderTypes = new List <string>(); Leaders = new List <List <HistoricalFigure> >(); Groups = new List <Entity>(); SiteHistory = new List <OwnerPeriod>(); SiteLinks = new List <EntitySiteLink>(); EntityLinks = new List <EntityEntityLink>(); Wars = new List <War>(); Populations = new List <Population>(); foreach (Property property in properties) { switch (property.Name) { case "name": Name = Formatting.InitCaps(property.Value); break; case "race": var race = property.Value.Replace("_", " ").Replace("man", "Men"); Race = Formatting.InitCaps(race); break; case "type": switch (property.Value) { case "civilization": Type = EntityType.Civilization; break; case "religion": Type = EntityType.Religion; break; case "sitegovernment": Type = EntityType.SiteGovernment; break; case "nomadicgroup": Type = EntityType.NomadicGroup; break; case "outcast": Type = EntityType.Outcast; break; case "migratinggroup": Type = EntityType.MigratingGroup; break; default: Type = EntityType.Unknown; world.ParsingErrors.Report("Unknown Entity Type: " + property.Value); break; } break; case "child": property.Known = true; break; case "site_link": SiteLinks.Add(new EntitySiteLink(property.SubProperties, world)); break; case "entity_link": property.Known = true; foreach (Property subProperty in property.SubProperties) { subProperty.Known = true; } world.AddEntityEntityLink(this, property); break; case "worship_id": property.Known = true; break; } } }
public Entity(List <Property> properties, World world) : base(properties, world) { Name = ""; Race = "Unknown"; Type = EntityType.Unknown; Parent = null; Worshipped = new List <HistoricalFigure>(); LeaderTypes = new List <string>(); Leaders = new List <List <HistoricalFigure> >(); Groups = new List <Entity>(); SiteHistory = new List <OwnerPeriod>(); SiteLinks = new List <EntitySiteLink>(); EntityLinks = new List <EntityEntityLink>(); Wars = new List <War>(); Populations = new List <Population>(); EntityPositions = new List <EntityPosition>(); EntityPositionAssignments = new List <EntityPositionAssignment>(); Claims = new List <Location>(); Occassions = new List <EntityOccasion>(); foreach (Property property in properties) { switch (property.Name) { case "name": Name = Formatting.InitCaps(property.Value); break; case "race": Race = Formatting.MakePopulationPlural(Formatting.FormatRace(property.Value)); break; case "type": switch (property.Value) { case "civilization": Type = EntityType.Civilization; break; case "religion": Type = EntityType.Religion; break; case "sitegovernment": Type = EntityType.SiteGovernment; break; case "nomadicgroup": Type = EntityType.NomadicGroup; break; case "outcast": Type = EntityType.Outcast; break; case "migratinggroup": Type = EntityType.MigratingGroup; break; case "performancetroupe": Type = EntityType.PerformanceTroupe; break; default: Type = EntityType.Unknown; property.Known = false; break; } break; case "child": property.Known = true; break; case "site_link": property.Known = true; if (property.SubProperties != null) { SiteLinks.Add(new EntitySiteLink(property.SubProperties, world)); } break; case "entity_link": property.Known = true; if (property.SubProperties != null) { foreach (Property subProperty in property.SubProperties) { subProperty.Known = true; } } world.AddEntityEntityLink(this, property); break; case "worship_id": property.Known = true; break; case "claims": string[] coordinateStrings = property.Value.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); foreach (var coordinateString in coordinateStrings) { string[] xYCoordinates = coordinateString.Split(','); if (xYCoordinates.Length == 2) { int x = Convert.ToInt32(xYCoordinates[0]); int y = Convert.ToInt32(xYCoordinates[1]); Claims.Add(new Location(x, y)); } } break; case "entity_position": property.Known = true; if (property.SubProperties != null) { EntityPositions.Add(new EntityPosition(property.SubProperties, world)); } break; case "entity_position_assignment": property.Known = true; if (property.SubProperties != null) { EntityPositionAssignments.Add(new EntityPositionAssignment(property.SubProperties, world)); } break; case "histfig_id": property.Known = true; // historical figure == last known entitymember? break; case "occasion": property.Known = true; if (property.SubProperties != null) { Occassions.Add(new EntityOccasion(property.SubProperties, world, this)); } break; } } }
public Entity(List<Property> properties, World world) : base(properties, world) { Name = ""; Race = "Unknown"; Type = EntityType.Unknown; Parent = null; Worshipped = new List<HistoricalFigure>(); LeaderTypes = new List<string>(); Leaders = new List<List<HistoricalFigure>>(); Groups = new List<Entity>(); SiteHistory = new List<OwnerPeriod>(); SiteLinks = new List<EntitySiteLink>(); EntityLinks = new List<EntityEntityLink>(); Wars = new List<War>(); Populations = new List<Population>(); foreach (Property property in properties) { switch (property.Name) { case "name": Name = Formatting.InitCaps(property.Value); break; case "race": Race = Formatting.MakePopulationPlural(Formatting.FormatRace(property.Value)); break; case "type": switch (property.Value) { case "civilization": Type = EntityType.Civilization; break; case "religion": Type = EntityType.Religion; break; case "sitegovernment": Type = EntityType.SiteGovernment; break; case "nomadicgroup": Type = EntityType.NomadicGroup; break; case "outcast": Type = EntityType.Outcast; break; case "migratinggroup": Type = EntityType.MigratingGroup; break; case "performancetroupe": Type = EntityType.PerformanceTroupe; break; default: Type = EntityType.Unknown; world.ParsingErrors.Report("Unknown Entity Type: " + property.Value); break; } break; case "child": property.Known = true; break; case "site_link": SiteLinks.Add(new EntitySiteLink(property.SubProperties, world)); break; case "entity_link": property.Known = true; foreach (Property subProperty in property.SubProperties) { subProperty.Known = true; } world.AddEntityEntityLink(this, property); break; case "worship_id": property.Known = true; break; } } }