public RemoveHfSiteLink(List <Property> properties, World world) : base(properties, world) { foreach (Property property in properties) { switch (property.Name) { case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; case "structure": StructureId = Convert.ToInt32(property.Value); break; case "civ": Civ = world.GetEntity(Convert.ToInt32(property.Value)); break; case "histfig": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; case "link_type": switch (property.Value) { case "lair": LinkType = SiteLinkType.Lair; break; case "hangout": LinkType = SiteLinkType.Hangout; break; case "home_site_building": LinkType = SiteLinkType.HomeSiteBuilding; break; case "home_site_underground": LinkType = SiteLinkType.HomeSiteUnderground; break; case "home_structure": LinkType = SiteLinkType.HomeStructure; break; case "seat_of_power": LinkType = SiteLinkType.SeatOfPower; break; case "occupation": LinkType = SiteLinkType.Occupation; break; case "home_site_realization_building": LinkType = SiteLinkType.HomeSiteRealizationBuilding; break; case "home_site_abstract_building": LinkType = SiteLinkType.HomeSiteAbstractBuilding; break; default: property.Known = false; break; } break; case "site": if (Site == null) { Site = world.GetSite(Convert.ToInt32(property.Value)); } else { property.Known = true; } break; } } if (Site != null) { Structure = Site.Structures.FirstOrDefault(structure => structure.Id == StructureId); } HistoricalFigure.AddEvent(this); Civ.AddEvent(this); Site.AddEvent(this); Structure.AddEvent(this); }
} // TODO // legends_plus.xml public CreateEntityPosition(List <Property> properties, World world) : base(properties, world) { foreach (Property property in properties) { switch (property.Name) { case "histfig": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; case "civ": Civ = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_civ": SiteCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; case "position": Position = property.Value; break; case "reason": Reason = Convert.ToInt32(property.Value); break; } } HistoricalFigure.AddEvent(this); Civ.AddEvent(this); if (SiteCiv != Civ) { SiteCiv.AddEvent(this); } }
public SiteRetired(List <Property> properties, World world) : base(properties, world) { foreach (Property property in properties) { switch (property.Name) { case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; case "civ_id": Civ = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_civ_id": SiteEntity = world.GetEntity(Convert.ToInt32(property.Value)); break; case "first": First = property.Value; break; } } Site.OwnerHistory.Last().EndYear = Year; Site.OwnerHistory.Last().EndCause = "retired"; if (SiteEntity != null) { SiteEntity.SiteHistory.Last(s => s.Site == Site).EndYear = Year; SiteEntity.SiteHistory.Last(s => s.Site == Site).EndCause = "retired"; } Civ.SiteHistory.Last(s => s.Site == Site).EndYear = Year; Civ.SiteHistory.Last(s => s.Site == Site).EndCause = "retired"; Site.AddEvent(this); Civ.AddEvent(this); SiteEntity.AddEvent(this); world.AddPlayerRelatedDwarfObjects(SiteEntity); world.AddPlayerRelatedDwarfObjects(Site); }
public OccasionEvent(List <Property> properties, World world) : base(properties, world) { foreach (Property property in properties) { switch (property.Name) { case "civ_id": Civ = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_id": Site = world.GetSite(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 "occasion_id": OccasionId = Convert.ToInt32(property.Value); break; case "schedule_id": ScheduleId = Convert.ToInt32(property.Value); break; } } if (Civ != null && Civ.Occassions.Any()) { EntityOccasion = Civ.Occassions.ElementAt(OccasionId); if (EntityOccasion != null) { Schedule = EntityOccasion.Schedules.ElementAt(ScheduleId); // DEBUG //if (Schedule.Reference != -1 && Schedule.Type == ScheduleType.Storytelling) //{ // WorldEvent worldEvent = World.GetEvent(Schedule.Reference) as WorldEvent; // if (!(worldEvent is IFeatured)) // { // world.ParsingErrors.Report("Unknown Occasion Feature - worldEvent.Type: " + worldEvent.Type); // } //} } } Civ.AddEvent(this); Site.AddEvent(this); Region.AddEvent(this); UndergroundRegion.AddEvent(this); }
public CreateEntityPosition(List <Property> properties, World world) : base(properties, world) { foreach (Property property in properties) { switch (property.Name) { case "histfig": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; case "civ": Civ = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_civ": SiteCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; case "position": Position = property.Value; break; case "reason": switch (property.Value) { case "0": case "force_of_argument": Reason = ReasonForCreatingEntity.ForceOfArgument; break; case "1": case "threat_of_violence": Reason = ReasonForCreatingEntity.ThreatOfViolence; break; case "2": case "collaboration": Reason = ReasonForCreatingEntity.Collaboration; break; case "3": case "wave_of_popular_support": Reason = ReasonForCreatingEntity.WaveOfPopularSupport; break; case "4": case "as_a_matter_of_course": Reason = ReasonForCreatingEntity.AsAMatterOfCourse; break; } break; } } HistoricalFigure.AddEvent(this); Civ.AddEvent(this); if (SiteCiv != Civ) { SiteCiv.AddEvent(this); } }
public InsurrectionStarted(List <Property> properties, World world) : base(properties, world) { ActualStart = false; foreach (Property property in properties) { switch (property.Name) { case "target_civ_id": Civ = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; case "outcome": switch (property.Value) { case "leadership overthrown": Outcome = InsurrectionOutcome.LeadershipOverthrown; break; case "population gone": Outcome = InsurrectionOutcome.PopulationGone; break; default: Outcome = InsurrectionOutcome.Unknown; _unknownOutcome = property.Value; world.ParsingErrors.Report("Unknown Insurrection Outcome: " + _unknownOutcome); break; } break; } } Civ.AddEvent(this); Site.AddEvent(this); }
public CreatedSite(List <Property> properties, World world) : base(properties, world) { foreach (Property property in properties) { switch (property.Name) { case "civ_id": Civ = world.GetEntity(Convert.ToInt32(property.Value)); break; case "resident_civ_id": ResidentCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_civ_id": SiteEntity = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; case "builder_hfid": Builder = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; } } if (SiteEntity != null) { SiteEntity.Parent = Civ; Site.OwnerHistory.Add(new OwnerPeriod(Site, SiteEntity, Year, "founded")); } else if (Civ != null) { Site.OwnerHistory.Add(new OwnerPeriod(Site, Civ, Year, "founded")); } else if (Builder != null) { Site.OwnerHistory.Add(new OwnerPeriod(Site, Builder, Year, "constructed")); } Site.AddEvent(this); SiteEntity.AddEvent(this); Civ.AddEvent(this); Builder.AddEvent(this); }
public WrittenContentComposed(List <Property> properties, World world) : base(properties, world) { foreach (Property property in properties) { switch (property.Name) { case "civ_id": Civ = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; case "hist_figure_id": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; case "wc_id": WrittenContentId = property.Value; break; case "reason": Reason = property.Value; break; case "reason_id": ReasonId = Convert.ToInt32(property.Value); break; case "circumstance": Circumstance = property.Value; break; case "circumstance_id": CircumstanceId = Convert.ToInt32(property.Value); break; case "subregion_id": Region = world.GetRegion(Convert.ToInt32(property.Value)); break; } } Civ.AddEvent(this); Site.AddEvent(this); Region.AddEvent(this); HistoricalFigure.AddEvent(this); if (Reason == "glorify hf") { GlorifiedHf = world.GetHistoricalFigure(ReasonId); GlorifiedHf.AddEvent(this); } if (Circumstance == "pray to hf" || Circumstance == "dream about hf") { CircumstanceHf = world.GetHistoricalFigure(CircumstanceId); if (GlorifiedHf != null && GlorifiedHf != CircumstanceHf) { CircumstanceHf.AddEvent(this); } } }
public CreatedStructure(List <Property> properties, World world) : base(properties, world) { foreach (Property property in properties) { switch (property.Name) { case "structure_id": StructureId = Convert.ToInt32(property.Value); break; case "civ_id": Civ = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_civ_id": SiteEntity = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; case "builder_hfid": Builder = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; case "structure": StructureId = Convert.ToInt32(property.Value); break; case "site": if (Site == null) { Site = world.GetSite(Convert.ToInt32(property.Value)); } else { property.Known = true; } break; case "civ": if (Civ == null) { Civ = world.GetEntity(Convert.ToInt32(property.Value)); } else { property.Known = true; } break; case "site_civ": if (SiteEntity == null) { SiteEntity = world.GetEntity(Convert.ToInt32(property.Value)); } else { property.Known = true; } break; case "builder_hf": if (Builder == null) { Builder = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); } else { property.Known = true; } break; case "rebuilt": property.Known = true; Rebuilt = true; break; } } if (Site != null) { Structure = Site.Structures.FirstOrDefault(structure => structure.Id == StructureId); } Civ.AddEvent(this); SiteEntity.AddEvent(this); Site.AddEvent(this); Builder.AddEvent(this); Structure.AddEvent(this); }