public override string Print(bool link = true, DwarfObject pov = null) { string eventString = GetYearTime(); if (Builder != null) { eventString += Builder.ToLink(link, pov, this); eventString += " constructed "; eventString += Site.ToLink(link, pov, this); if (ResidentCiv != null) { eventString += " for "; eventString += ResidentCiv.ToLink(link, pov, this); } } else { if (SiteEntity != null) { eventString += SiteEntity.ToLink(link, pov, this) + " of "; } eventString += Civ.ToLink(link, pov, this); eventString += " founded "; eventString += Site.ToLink(link, pov, this); } eventString += PrintParentCollection(link, pov); eventString += "."; return(eventString); }
internal override string ToTimelineString() { string timelinestring = base.ToTimelineString(); return(string.Format("{0} Remove HF Link from {1}", timelinestring, Civ.ToString())); }
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 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); }
public override string Print(bool link = true, DwarfObject pov = null) { string eventString = GetYearTime(); if (ActualStart) { eventString += "an insurrection against " + Civ.ToLink(link, pov, this) + " began in " + Site.ToLink(link, pov, this); } else { eventString += "the insurrection in " + Site.ToLink(link, pov, this); switch (Outcome) { case InsurrectionOutcome.LeadershipOverthrown: eventString += " concluded with " + Civ.ToLink(link, pov, this) + " overthrown"; break; case InsurrectionOutcome.PopulationGone: eventString += " ended with the disappearance of the rebelling population"; break; default: eventString += " against " + Civ.ToLink(link, pov, this) + " concluded with (" + _unknownOutcome + ")"; break; } } eventString += PrintParentCollection(link, pov); eventString += "."; return(eventString); }
} // 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); } }
internal override string ToTimelineString() { string timelinestring = base.ToTimelineString(); return(string.Format("{0} {1} founded {2}.", timelinestring, Civ.ToString(), Site.AltName)); }
public override string Print(bool link = true, DwarfObject pov = null) { string eventString = GetYearTime(); if (Builder != null) { eventString += Builder != null?Builder.ToLink(link, pov) : "UNKNOWN HISTORICAL FIGURE"; eventString += ", thrust a spire of slade up from the underworld, naming it "; eventString += Structure != null?Structure.ToLink(link, pov) : "UNKNOWN STRUCTURE"; eventString += ", and established a gateway between worlds in "; eventString += Site != null?Site.ToLink(link, pov) : "UNKNOWN SITE"; } else { if (SiteEntity != null) { eventString += SiteEntity.ToLink(link, pov); eventString += " of "; } eventString += Civ != null?Civ.ToLink(link, pov) : "UNKNOWN CIV"; eventString += " constructed "; eventString += Structure != null?Structure.ToLink(link, pov) : "UNKNOWN STRUCTURE"; eventString += " in "; eventString += Site != null?Site.ToLink(link, pov) : "UNKNOWN SITE"; } eventString += PrintParentCollection(link, pov); eventString += "."; return(eventString); }
public override string Print(bool link = true, DwarfObject pov = null) { string eventString = GetYearTime(); eventString += Civ != null?Civ.ToLink(link, pov, this) : "UNKNOWN CIV"; eventString += " held a "; if (Schedule != null) { if (!string.IsNullOrWhiteSpace(Schedule.ItemType) || !string.IsNullOrWhiteSpace(Schedule.ItemSubType)) { eventString += !string.IsNullOrWhiteSpace(Schedule.ItemSubType) ? Schedule.ItemSubType : Schedule.ItemType; eventString += " "; } } eventString += Schedule?.Type.GetDescription().ToLower() ?? OccasionType.ToString().ToLower(); if (ReferencedArtForm != null) { eventString += " of "; eventString += ReferencedArtForm.ToLink(link, pov, this); } else if (Schedule != null && Schedule.Type == ScheduleType.Storytelling && Schedule.Reference != -1) { WorldEvent worldEvent = World.GetEvent(Schedule.Reference); if (worldEvent is IFeatured featured) { eventString += " of "; eventString += featured.PrintFeature(); } } eventString += " in "; eventString += Site != null?Site.ToLink(link, pov, this) : "UNKNOWN SITE"; eventString += " as part of "; eventString += EntityOccasion != null?EntityOccasion.ToLink(link, pov, this) : "UNKNOWN OCCASION"; eventString += "."; if (Schedule != null) { switch (Schedule.Type) { case ScheduleType.Procession: Structure startStructure = Site.Structures.FirstOrDefault(s => s.Id == Schedule.Reference); Structure endStructure = Site.Structures.FirstOrDefault(s => s.Id == Schedule.Reference2); if (startStructure != null || endStructure != null) { eventString += " It started at "; eventString += startStructure != null?startStructure.ToLink(link, pov, this) : "UNKNOWN STRUCTURE"; eventString += " and ended at "; eventString += endStructure != null?endStructure.ToLink(link, pov, this) : "UNKNOWN STRUCTURE"; eventString += "."; } break; } } return(eventString); }
internal override string ToTimelineString() { string timelinestring = base.ToTimelineString(); return(string.Format("{0} {1} built road from {2} to {3}.", timelinestring, Civ.ToString(), Site1.ToString(), Site2.ToString())); }
public override string LegendsDescription() { string timestring = base.LegendsDescription(); return(string.Format("{0} {1} became {2} of {3}.", timestring, HF == null ? "UNKNOWN" : HF.ToString(), LinkType == null ? "UNKNOWN" : LinkType, Civ.ToString())); }
public override string LegendsDescription() { string timestring = base.LegendsDescription(); return(string.Format("{0} {1} {2} ceased to be the {3} of {4}.", timestring, "UNKNOWN", "", "UNKNOWN", Civ.ToString())); }
public override string LegendsDescription() { string timestring = base.LegendsDescription(); return(string.Format("{0} {1} of {2} finished contruction of {3} connecting {4} and {5}.", timestring, SiteCiv.ToString(), Civ.ToString(), "CONSTRUCTION " + WC.ToString(), Site1.ToString(), Site2.ToString())); }
public override string LegendsDescription() { string timestring = base.LegendsDescription(); return(string.Format("{0} {1} of {2} abandoned the settlement of {3}.", timestring, SiteCiv.ToString(), Civ.ToString(), Site.AltName)); }
public override string LegendsDescription() { string timestring = base.LegendsDescription(); return(string.Format("{0} {1} razed {2} in {3}.", timestring, Civ.ToString(), "Structure " + StructureID.ToString(), Site.AltName)); }
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 void CanGetEraEnumForAstPosition(int astPosition, int expectedEra) { Civ testCiv = new Civ { AstStone = 5, AstEarlyBronze = 8, AstLateBronze = 11, AstEarlyIron = 14 }; int actualEra = (int)testCiv.GetEraEnumForAstPosition(astPosition); Assert.Equal(expectedEra, actualEra); }
public void CanGetEraNameForAstPosition(int astPosition, string expectedEra) { Civ testCiv = new Civ { AstStone = 5, AstEarlyBronze = 8, AstLateBronze = 11, AstEarlyIron = 14 }; string actualEra = testCiv.GetEraNameForAstPosition(astPosition); Assert.Equal(expectedEra, actualEra); }
public override string Print(bool link = true, DwarfObject pov = null) { string eventString = GetYearTime(); if (HistoricalFigure != null) { eventString += HistoricalFigure.ToLink(link, pov); } else { eventString += "UNKNOWN HISTORICAL FIGURE"; } switch (LinkType) { case SiteLinkType.HomeSiteAbstractBuilding: case SiteLinkType.HomeSiteRealizationBuilding: eventString += " moved out of "; break; case SiteLinkType.Hangout: eventString += " stopped ruling from "; break; case SiteLinkType.SeatOfPower: eventString += " stopped working from "; break; case SiteLinkType.Occupation: eventString += " stopped working at "; break; default: eventString += " UNKNOWN LINKTYPE (" + LinkType + ") "; break; } if (Structure != null) { eventString += Structure.ToLink(link, pov); } else { eventString += "UNKNOWN STRUCTURE"; } if (Civ != null) { eventString += " of " + Civ.ToLink(link, pov); } if (Site != null) { eventString += " in " + Site.ToLink(link, pov); } eventString += PrintParentCollection(link, pov); eventString += "."; return(eventString); }
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 override string LegendsDescription() { string timestring = base.LegendsDescription(); if (SiteCiv == null) { return(string.Format("{0} {1} founded {2}.", timestring, Civ.ToString(), Site.AltName)); } else { return(string.Format("{0} {1} of {2} founded {3}.", timestring, SiteCiv.ToString(), Civ.ToString(), Site.AltName)); } }
protected override void OnStart(string[] args) { if (args.Length == 1) { Settings.Default.settings = args[0].Substring(1); Settings.Default.Save(); MessageBox.Show("The config path has been set.", "BCRPDB Server", MessageBoxButtons.OK, MessageBoxIcon.Information); Environment.Exit(0); } if (string.IsNullOrWhiteSpace(Settings.Default.settings)) { MessageBox.Show("The config path is invalid. View the readme and make sure your save paths are correct.", "BCRPDB Server", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(0); } cfg = new Config(Settings.Default.settings); log = new Log(cfg.Log, cfg.Aliases); list = new TcpListener(IPAddress.Parse(cfg.IP), cfg.Port); Civilians = new List <Civ>(); if (File.Exists(cfg.Database)) { foreach (string line in File.ReadLines(cfg.Database)) { Civilians.Add(Civ.Parse(line, File.GetLastWriteTime(cfg.Database))); } } try { list.Start(); } catch { MessageBox.Show("The specified port (" + cfg.Port + ") is already in use.", "BCRPDB Server", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(0); } Log.WriteLine("Listening for connections..."); ThreadPool.QueueUserWorkItem(x => { while (true) { ThreadPool.QueueUserWorkItem(Connect, list.AcceptSocket()); } }); }
public override string Print(bool link = true, DwarfObject pov = null) { string eventString = GetYearTime(); eventString += SiteEntity != null?SiteEntity.ToLink(link, pov, this) : "UNKNOWN ENTITY"; eventString += " of "; eventString += Civ != null?Civ.ToLink(link, pov, this) : "UNKNOWN CIV"; eventString += " at the settlement of "; eventString += Site != null?Site.ToLink(link, pov, this) : "UNKNOWN SITE"; eventString += " regained their senses after an initial period of questionable judgment."; return(eventString); }
internal override string ToTimelineString() { string timelinestring = base.ToTimelineString(); if (HF != null && LinkType != null) { return(string.Format("{0} {1} became {2} of {3}.", timelinestring, HF.ToString(), LinkType, Civ.ToString())); } else { return(string.Format("{0} Added HF Link to {1}.", timelinestring, Civ.ToString())); } }
public override string LegendsDescription() { string timestring = base.LegendsDescription(); if (SiteCiv == null) { return(string.Format("{0} {1} constructed {2} in {3}.", timestring, Civ.ToString(), "UNKNOWN", Site.AltName)); } else { return(string.Format("{0} {1} of {2} constructed {3} in {4}.", timestring, SiteCiv.ToString(), Civ.ToString(), "UNKNOWN", Site.AltName)); } }
public Occasion(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 "ordinal": Ordinal = string.Intern(property.Value); break; case "occasion_id": OccasionId = Convert.ToInt32(property.Value); break; } } if (Civ != null && Civ.Occassions.Any()) { EntityOccasion = Civ.Occassions.ElementAt(OccasionId); } Civ.AddEventCollection(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 override string Print(bool link = true, DwarfObject pov = null) { string eventString = GetYearTime(); eventString += Civ != null?Civ.ToLink(link, pov) : "UNKNOWN CIV"; eventString += " held a "; if (Schedule != null) { if (!string.IsNullOrWhiteSpace(Schedule.ItemType) || !string.IsNullOrWhiteSpace(Schedule.ItemSubType)) { eventString += !string.IsNullOrWhiteSpace(Schedule.ItemSubType) ? Schedule.ItemSubType : Schedule.ItemType; eventString += " "; } } eventString += Schedule != null?Schedule.Type.GetDescription().ToLower() : OccasionType.ToString().ToLower(); if (Schedule != null) { switch (Schedule.Type) { case ScheduleType.PoetryRecital: if (Schedule.Reference != -1) { PoeticForm form = World.GetPoeticForm(Schedule.Reference); eventString += " of "; eventString += form != null?form.ToLink(link, pov) : "UNKNOWN POETRICFORM"; } break; case ScheduleType.MusicalPerformance: if (Schedule.Reference != -1) { MusicalForm form = World.GetMusicalForm(Schedule.Reference); eventString += " of "; eventString += form != null?form.ToLink(link, pov) : "UNKNOWN MUSICALFORM"; } break; case ScheduleType.DancePerformance: if (Schedule.Reference != -1) { DanceForm form = World.GetDanceForm(Schedule.Reference); eventString += " of "; eventString += form != null?form.ToLink(link, pov) : "UNKNOWN DANCEFORM"; } break; case ScheduleType.Storytelling: if (Schedule.Reference != -1) { WorldEvent worldEvent = World.GetEvent(Schedule.Reference); if (worldEvent is IFeatured) { eventString += " of "; eventString += worldEvent != null ? ((IFeatured)worldEvent).PrintFeature() : "UNKNOWN EVENT"; } } break; } } eventString += " in "; eventString += Site != null?Site.ToLink(link, pov) : "UNKNOWN SITE"; eventString += " as part of "; eventString += EntityOccasion != null?EntityOccasion.ToLink(link, pov) : "UNKNOWN OCCASION"; eventString += "."; if (Schedule != null) { switch (Schedule.Type) { case ScheduleType.Procession: Structure startStructure = Site.Structures.FirstOrDefault(s => s.Id == Schedule.Reference); Structure endStructure = Site.Structures.FirstOrDefault(s => s.Id == Schedule.Reference2); if (startStructure != null || endStructure != null) { eventString += " It started at "; eventString += startStructure != null?startStructure.ToLink(link, pov) : "UNKNOWN STRUCTURE"; eventString += " and ended at "; eventString += endStructure != null?endStructure.ToLink(link, pov) : "UNKNOWN STRUCTURE"; eventString += "."; } break; } } return(eventString); }
public override string Print(bool link = true, DwarfObject pov = null) { string eventString = GetYearTime(); switch (Reason) { case 0: eventString += HistoricalFigure != null?HistoricalFigure.ToLink(link, pov) : "UNKNOWN HISTORICAL FIGURE"; eventString += " of "; eventString += Civ != null?Civ.ToLink(link, pov) : "UNKNOWN CIV"; eventString += " created the position of "; eventString += !string.IsNullOrWhiteSpace(Position) ? Position : "UNKNOWN POSITION"; eventString += " through force of argument"; break; case 1: eventString += HistoricalFigure != null?HistoricalFigure.ToLink(link, pov) : "UNKNOWN HISTORICAL FIGURE"; eventString += " of "; eventString += Civ != null?Civ.ToLink(link, pov) : "UNKNOWN CIV"; eventString += " compelled the creation of the position of "; eventString += !string.IsNullOrWhiteSpace(Position) ? Position : "UNKNOWN POSITION"; eventString += " with threats of violence"; break; case 2: eventString += SiteCiv != null?SiteCiv.ToLink(link, pov) : "UNKNOWN ENTITY"; eventString += " collaborated to create the position of "; eventString += !string.IsNullOrWhiteSpace(Position) ? Position : "UNKNOWN POSITION"; break; case 3: eventString += HistoricalFigure != null?HistoricalFigure.ToLink(link, pov) : "UNKNOWN HISTORICAL FIGURE"; eventString += " of "; eventString += Civ != null?Civ.ToLink(link, pov) : "UNKNOWN CIV"; eventString += " created the position of "; eventString += !string.IsNullOrWhiteSpace(Position) ? Position : "UNKNOWN POSITION"; eventString += ", pushed by a wave of popular support"; break; case 4: eventString += HistoricalFigure != null?HistoricalFigure.ToLink(link, pov) : "UNKNOWN HISTORICAL FIGURE"; eventString += " of "; eventString += Civ != null?Civ.ToLink(link, pov) : "UNKNOWN CIV"; eventString += " created the position of "; eventString += !string.IsNullOrWhiteSpace(Position) ? Position : "UNKNOWN POSITION"; eventString += " as a matter of course"; break; } eventString += PrintParentCollection(link, pov); eventString += "."; return(eventString); }