├── LegendsViewer ├── 7z.dll ├── 7z64.dll ├── book.ico ├── SevenZipSharp.dll ├── Resources │ ├── chart16x16.png │ ├── globe16x16.png │ ├── map16x16.png │ ├── search16x16.png │ ├── arrow_back16x16.png │ ├── piechart16x16.png │ └── arrow_forward16x16.png ├── Properties │ ├── Resources.resources │ ├── Settings.settings │ ├── Settings.Designer.cs │ └── AssemblyInfo.cs ├── WebContent │ ├── images │ │ ├── sort_asc.png │ │ ├── sort_both.png │ │ ├── sort_desc.png │ │ ├── sort_asc_disabled.png │ │ └── sort_desc_disabled.png │ └── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ ├── fontawesome-webfont.woff2 │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 ├── app.config ├── Legends │ ├── Enums │ │ ├── UnitType.cs │ │ ├── BodyState.cs │ │ ├── EntityLawType.cs │ │ ├── SecretGoal.cs │ │ ├── SitePropertyType.cs │ │ ├── ConfrontSituation.cs │ │ ├── Evilness.cs │ │ ├── ConfrontReason.cs │ │ ├── ActionsForHistoricalFigures.cs │ │ ├── FormType.cs │ │ ├── DissolveReason.cs │ │ ├── InsurrectionOutcome.cs │ │ ├── ActionsForEntities.cs │ │ ├── StructureSubType.cs │ │ ├── PreachTopic.cs │ │ ├── WorldConstructionType.cs │ │ ├── AgreementReason.cs │ │ ├── OccasionType.cs │ │ ├── RelationShipProfileType.cs │ │ ├── AgreementTopic.cs │ │ ├── AbuseType.cs │ │ ├── IntrigueAction.cs │ │ ├── Circumstance.cs │ │ ├── Dispute.cs │ │ ├── HfEntityLinkType.cs │ │ ├── BattleOutcome.cs │ │ ├── ReasonForCreatingEntity.cs │ │ ├── Mood.cs │ │ ├── HFState.cs │ │ ├── TacticalSituationType.cs │ │ ├── ArtifactReason.cs │ │ ├── Claim.cs │ │ ├── SiteConqueredType.cs │ │ ├── IntrigueMethod.cs │ │ ├── ChangeHfStateReason.cs │ │ ├── PileType.cs │ │ ├── ReferenceType.cs │ │ ├── StructureType.cs │ │ ├── EntityLinkType.cs │ │ ├── HFSimpleBattleType.cs │ │ ├── SiteType.cs │ │ ├── SiteLinkType.cs │ │ ├── EntityType.cs │ │ ├── HistoricalFigureLinkType.cs │ │ ├── ScheduleType.cs │ │ ├── ReputationType.cs │ │ ├── VagueRelationshipType.cs │ │ ├── WrittenContentType.cs │ │ └── DeathCause.cs │ ├── Interfaces │ │ ├── IFeatured.cs │ │ └── IHasCoordinates.cs │ ├── Events │ │ ├── PeaceAccepted.cs │ │ ├── PeaceRejected.cs │ │ ├── Ceremony.cs │ │ ├── MasterpieceArchDesign.cs │ │ ├── Procession.cs │ │ ├── Performance.cs │ │ ├── DanceFormCreated.cs │ │ ├── MasterpieceArchConstructed.cs │ │ ├── PoeticFormCreated.cs │ │ ├── MusicalFormCreated.cs │ │ ├── AgreementVoid.cs │ │ ├── EntityFledSite.cs │ │ ├── HolyCityDeclaration.cs │ │ ├── EntityRampagedInSite.cs │ │ ├── EntityAllianceFormed.cs │ │ ├── ImpersonateHF.cs │ │ ├── FirstContact.cs │ │ ├── EntitySearchedSite.cs │ │ ├── ArtifactDestroyed.cs │ │ ├── RazedStructure.cs │ │ ├── EntityExpelsHF.cs │ │ ├── DiplomatLost.cs │ │ ├── Sabotage.cs │ │ ├── ArtifactStored.cs │ │ ├── PeaceEfforts.cs │ │ ├── AddHfEntityHonor.cs │ │ ├── KnowledgeDiscovered.cs │ │ ├── SneakIntoSite.cs │ │ ├── ModifiedBuilding.cs │ │ ├── HFReunion.cs │ │ ├── HfAttackedSite.cs │ │ ├── SiteAbandoned.cs │ │ ├── HFGainsSecretGoal.cs │ │ ├── SiteSurrendered.cs │ │ ├── SpottedLeavingSite.cs │ │ ├── EntityDissolved.cs │ │ ├── HFAbducted.cs │ │ ├── EntityBreachFeatureLayer.cs │ │ ├── EntityEquipmentPurchase.cs │ │ ├── HFRazedStructure.cs │ │ ├── SiteRetired.cs │ │ ├── HFDisturbedStructure.cs │ │ └── SiteTributeForced.cs │ ├── WorldObjects │ │ ├── DwarfObject.cs │ │ ├── MusicalForm.cs │ │ ├── DanceForm.cs │ │ └── PoeticForm.cs │ ├── Parser │ │ ├── Property.cs │ │ ├── ParsingErrors.cs │ │ └── Section.cs │ ├── OwnerPeriod.cs │ ├── PlotActor.cs │ ├── EntityPositionAssignment.cs │ ├── EventCollections │ │ ├── Journey.cs │ │ ├── CeremonyCollection.cs │ │ ├── CompetitionCollection.cs │ │ ├── PerformanceCollection.cs │ │ ├── ProcessionCollection.cs │ │ ├── Purge.cs │ │ ├── Occasion.cs │ │ ├── Persecution.cs │ │ ├── Insurrection.cs │ │ └── EntityOverthrownCollection.cs │ ├── EntitySiteLink.cs │ ├── WorldObject.cs │ ├── Feature.cs │ ├── Population.cs │ ├── EntityPopulation.cs │ ├── RelationshipProfileHF.cs │ ├── CreatureInfo.cs │ ├── HonorEntity.cs │ ├── ArtForm.cs │ ├── IntrigueActor.cs │ ├── EntityEntityLink.cs │ ├── HistoricalFigureLink.cs │ ├── Misc.cs │ ├── Skill.cs │ ├── IntriguePlot.cs │ ├── Reference.cs │ └── SiteLink.cs ├── Controls │ ├── Map │ │ └── MapUtil.cs │ ├── EventArgs.cs │ ├── Query │ │ ├── Attributes │ │ │ ├── ShowInAdvancedSearchResultsAttribute.cs │ │ │ └── AllowAdvancedSearchAttribute.cs │ │ └── DwarfQuery.cs │ ├── PageControl.cs │ ├── HTML │ │ ├── StringPrinter.cs │ │ ├── ArtFormPrinter.cs │ │ ├── Utilities │ │ │ ├── BrowserUtil.cs │ │ │ └── HTMLStyleUtil.cs │ │ ├── RiverPrinter.cs │ │ ├── LandmassPrinter.cs │ │ ├── RaidPrinter.cs │ │ ├── SiteConqueredPrinter.cs │ │ ├── BeastAttackPrinter.cs │ │ └── MountainPeakPrinter.cs │ ├── Chart │ │ ├── ChartOption.cs │ │ ├── dlgHF.cs │ │ └── ChartControl.cs │ ├── Tabs │ │ └── BaseSearchTab.designer.cs │ └── DwarfTabPage.cs ├── LegendsViewer.csproj.DotSettings ├── packages.config └── Program.cs ├── .gitignore ├── LegendsViewer.sln └── appveyor.yml /LegendsViewer/7z.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/7z.dll -------------------------------------------------------------------------------- /LegendsViewer/7z64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/7z64.dll -------------------------------------------------------------------------------- /LegendsViewer/book.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/book.ico -------------------------------------------------------------------------------- /LegendsViewer/SevenZipSharp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/SevenZipSharp.dll -------------------------------------------------------------------------------- /LegendsViewer/Resources/chart16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/Resources/chart16x16.png -------------------------------------------------------------------------------- /LegendsViewer/Resources/globe16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/Resources/globe16x16.png -------------------------------------------------------------------------------- /LegendsViewer/Resources/map16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/Resources/map16x16.png -------------------------------------------------------------------------------- /LegendsViewer/Resources/search16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/Resources/search16x16.png -------------------------------------------------------------------------------- /LegendsViewer/Resources/arrow_back16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/Resources/arrow_back16x16.png -------------------------------------------------------------------------------- /LegendsViewer/Resources/piechart16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/Resources/piechart16x16.png -------------------------------------------------------------------------------- /LegendsViewer/Properties/Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/Properties/Resources.resources -------------------------------------------------------------------------------- /LegendsViewer/WebContent/images/sort_asc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/WebContent/images/sort_asc.png -------------------------------------------------------------------------------- /LegendsViewer/WebContent/images/sort_both.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/WebContent/images/sort_both.png -------------------------------------------------------------------------------- /LegendsViewer/WebContent/images/sort_desc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/WebContent/images/sort_desc.png -------------------------------------------------------------------------------- /LegendsViewer/Resources/arrow_forward16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/Resources/arrow_forward16x16.png -------------------------------------------------------------------------------- /LegendsViewer/WebContent/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/WebContent/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /LegendsViewer/WebContent/images/sort_asc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/WebContent/images/sort_asc_disabled.png -------------------------------------------------------------------------------- /LegendsViewer/WebContent/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/WebContent/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /LegendsViewer/WebContent/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/WebContent/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /LegendsViewer/WebContent/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/WebContent/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /LegendsViewer/WebContent/images/sort_desc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/WebContent/images/sort_desc_disabled.png -------------------------------------------------------------------------------- /LegendsViewer/WebContent/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/WebContent/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /LegendsViewer/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/UnitType.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum UnitType 4 | { 5 | Unknown, 6 | Monk 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /LegendsViewer/WebContent/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/WebContent/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /LegendsViewer/WebContent/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/WebContent/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/BodyState.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum BodyState 4 | { 5 | Unknown, 6 | EntombedAtSite 7 | } 8 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/EntityLawType.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum EntityLawType 4 | { 5 | Unknown, 6 | Harsh 7 | } 8 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/SecretGoal.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum SecretGoal 4 | { 5 | Unknown, 6 | Immortality 7 | } 8 | } -------------------------------------------------------------------------------- /LegendsViewer/WebContent/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/WebContent/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /LegendsViewer/WebContent/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kromtec/LegendsViewer/HEAD/LegendsViewer/WebContent/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/SitePropertyType.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum SitePropertyType 4 | { 5 | Unknown, 6 | House 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/ConfrontSituation.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum ConfrontSituation 4 | { 5 | Unknown, 6 | GeneralSuspicion 7 | } 8 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/Evilness.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum Evilness 4 | { 5 | Neutral, 6 | Good, 7 | Evil 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/ConfrontReason.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum ConfrontReason 4 | { 5 | Unknown, 6 | Ageless, 7 | Murder 8 | } 9 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/ActionsForHistoricalFigures.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum ActionsForHistoricalFigures 4 | { 5 | Unknown, 6 | Profane 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/FormType.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum FormType 4 | { 5 | Unknown, 6 | Musical, 7 | Poetic, 8 | Dance 9 | } 10 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/DissolveReason.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum DissolveReason 4 | { 5 | Unknown, 6 | HeavyLossesInBattle, 7 | LackOfFunds 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/InsurrectionOutcome.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum InsurrectionOutcome 4 | { 5 | Unknown, 6 | LeadershipOverthrown, 7 | PopulationGone 8 | } 9 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/ActionsForEntities.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum ActionsForEntities 4 | { 5 | Unknown, 6 | Relocate, 7 | PrimaryCriminals 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/StructureSubType.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum StructureSubType 4 | { 5 | Unknown, 6 | Dungeon, 7 | Sewers, 8 | Catacombs 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/PreachTopic.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum PreachTopic 4 | { 5 | Unknown, 6 | SetEntity1AgainstEntity2, 7 | Entity1ShouldLoveEntity2 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/WorldConstructionType.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum WorldConstructionType 4 | { 5 | Unknown, 6 | Road, 7 | Bridge, 8 | Tunnel 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/AgreementReason.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum AgreementReason 4 | { 5 | Unknown, 6 | Whim, 7 | ViolentDisagreement, 8 | ArrivedAtLocation 9 | } 10 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/OccasionType.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum OccasionType 4 | { 5 | Unknown, 6 | Procession, 7 | Ceremony, 8 | Performance, 9 | Competition 10 | } 11 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/RelationShipProfileType.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum RelationShipProfileType 4 | { 5 | Unknown, 6 | Visual, 7 | Historical, 8 | Identity 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/AgreementTopic.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum AgreementTopic 4 | { 5 | Unknown, 6 | TreeQuota, 7 | BecomeLandHolder, 8 | PromoteLandHolder, 9 | Tribute 10 | } 11 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Interfaces/IFeatured.cs: -------------------------------------------------------------------------------- 1 | using LegendsViewer.Legends.WorldObjects; 2 | 3 | namespace LegendsViewer.Legends.Interfaces 4 | { 5 | interface IFeatured 6 | { 7 | string PrintFeature(bool link = true, DwarfObject pov = null); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Interfaces/IHasCoordinates.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace LegendsViewer.Legends.Interfaces 4 | { 5 | interface IHasCoordinates 6 | { 7 | List Coordinates { get; set; } // legends_plus.xml 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/AbuseType.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum AbuseType 4 | { 5 | Unknown, 6 | Impaled, 7 | Flayed, 8 | Piled, 9 | Hung, 10 | Mutilated, 11 | Animated 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/IntrigueAction.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum IntrigueAction 4 | { 5 | Unknown, 6 | BribeOfficial, 7 | InduceToEmbezzle, 8 | CorruptInPlace, 9 | BringIntoNetwork 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /LegendsViewer/Controls/Map/MapUtil.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | 3 | namespace LegendsViewer.Controls.Map 4 | { 5 | public static class MapUtil 6 | { 7 | public static Bitmap AlternateMap { get; set; } 8 | public static float AltMapAlpha { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /LegendsViewer/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/Circumstance.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum Circumstance 4 | { 5 | Unknown, 6 | HistoricalEventCollection, 7 | DefeatedHf, 8 | MurderedHf, 9 | HfIsDead, 10 | AbductedHf 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/Dispute.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum Dispute 4 | { 5 | Unknown, 6 | FishingRights, 7 | GrazingRights, 8 | LivestockOwnership, 9 | RightsOfWay, 10 | Territory, 11 | WaterRights 12 | } 13 | } -------------------------------------------------------------------------------- /LegendsViewer/Controls/EventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LegendsViewer.Controls 4 | { 5 | public class EventArgs : EventArgs 6 | { 7 | public T Arg { get; private set; } 8 | 9 | public EventArgs(T arg) 10 | { 11 | Arg = arg; 12 | } 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/HfEntityLinkType.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum HfEntityLinkType 4 | { 5 | Unknown, 6 | Enemy, 7 | Member, 8 | FormerMember, 9 | Position, 10 | Prisoner, 11 | Slave, 12 | Squad 13 | } 14 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/BattleOutcome.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LegendsViewer.Legends.Enums 4 | { 5 | public enum BattleOutcome 6 | { 7 | Unknown, 8 | [Description("Attacker Won")] 9 | AttackerWon, 10 | [Description("Defender Won")] 11 | DefenderWon 12 | } 13 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/ReasonForCreatingEntity.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum ReasonForCreatingEntity 4 | { 5 | Unknown, 6 | ForceOfArgument, 7 | ThreatOfViolence, 8 | Collaboration, 9 | WaveOfPopularSupport, 10 | AsAMatterOfCourse 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/Mood.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum Mood 4 | { 5 | Unknown, 6 | Macabre, 7 | Secretive, 8 | Insane, 9 | Possessed, 10 | Berserk, 11 | Fey, 12 | Melancholy, 13 | Fell, 14 | Catatonic 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/HFState.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum HfState : byte 4 | { 5 | Unknown, 6 | None, 7 | Settled, 8 | Wandering, 9 | Scouting, 10 | Snatcher, 11 | Refugee, 12 | Thief, 13 | Hunting, 14 | Visiting 15 | } 16 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/TacticalSituationType.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum TacticalSituationType 4 | { 5 | Unknown, 6 | NeitherFavored, 7 | AttackersSlightlyFavored, 8 | DefendersSlightlyFavored, 9 | AttackersStronglyFavored, 10 | DefendersStronglyFavored 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/ArtifactReason.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum ArtifactReason 4 | { 5 | Unknown, 6 | ArtifactIsHeirloomOfFamilyHfid, 7 | ArtifactIsSymbolOfEntityPosition, 8 | CementBondsOfFriendship, 9 | PartOfTradeNegotiation, 10 | SanctifyHistoricalFigure 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/Claim.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LegendsViewer.Legends.Enums 4 | { 5 | public enum Claim 6 | { 7 | Unknown, 8 | [Description("symbol")] 9 | Symbol, 10 | [Description("family heirloom")] 11 | Heirloom, 12 | [Description("treasure")] 13 | Treasure 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/SiteConqueredType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LegendsViewer.Legends.Enums 4 | { 5 | public enum SiteConqueredType 6 | { 7 | Unknown, 8 | Pillaging, 9 | Destruction, 10 | Conquest, 11 | [Description("Tribute Enforcement")] 12 | TributeEnforcement, 13 | Invasion 14 | } 15 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/IntrigueMethod.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum IntrigueMethod 4 | { 5 | Unknown, 6 | Intimidate, 7 | Flatter, 8 | Bribe, 9 | Precedence, 10 | OfferImmortality, 11 | ReligiousSympathy, 12 | BlackmailOverEmbezzlement, 13 | RevengeOnGrudge 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/ChangeHfStateReason.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum ChangeHfStateReason 4 | { 5 | Unknown, 6 | FailedMood, 7 | GatherInformation, 8 | BeWithMaster, 9 | Flight, 10 | Scholarship, 11 | Pilgrimage, 12 | LackOfSleep, 13 | GreatDealOfStress, 14 | ExiledAfterConviction 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LegendsViewer/LegendsViewer.csproj.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | No -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/PeaceAccepted.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using LegendsViewer.Legends.Parser; 3 | 4 | namespace LegendsViewer.Legends.Events 5 | { 6 | public class PeaceAccepted : PeaceEfforts 7 | { 8 | public PeaceAccepted(List properties, World world) 9 | : base(properties, world) 10 | { 11 | Decision = "accepted"; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/PeaceRejected.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using LegendsViewer.Legends.Parser; 3 | 4 | namespace LegendsViewer.Legends.Events 5 | { 6 | public class PeaceRejected : PeaceEfforts 7 | { 8 | public PeaceRejected(List properties, World world) 9 | : base(properties, world) 10 | { 11 | Decision = "rejected"; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | #ignore thumbnails created by windows 3 | Thumbs.db 4 | #Ignore files build by Visual Studio 5 | *.obj 6 | *.exe 7 | *.pdb 8 | *.user 9 | *.aps 10 | *.pch 11 | *.vspscc 12 | *_i.c 13 | *_p.c 14 | *.ncb 15 | *.suo 16 | *.tlb 17 | *.tlh 18 | *.bak 19 | *.cache 20 | *.ilk 21 | *.log 22 | [Bb]in 23 | [Dd]ebug*/ 24 | *.lib 25 | *.sbr 26 | obj/ 27 | [Rr]elease*/ 28 | _ReSharper*/ 29 | [Tt]est[Rr]esult* 30 | .vs/ 31 | packages/ 32 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/Ceremony.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using LegendsViewer.Legends.Enums; 3 | using LegendsViewer.Legends.Parser; 4 | 5 | namespace LegendsViewer.Legends.Events 6 | { 7 | public class Ceremony : OccasionEvent 8 | { 9 | public Ceremony(List properties, World world) : base(properties, world) 10 | { 11 | OccasionType = OccasionType.Ceremony; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/PileType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LegendsViewer.Legends.Enums 4 | { 5 | public enum PileType 6 | { 7 | [Description("pile")] 8 | Unknown, 9 | [Description("grisly mound")] 10 | GrislyMound, 11 | [Description("grotesque pillar")] 12 | GrotesquePillar, 13 | [Description("gruesome sculpture")] 14 | GruesomeSculpture 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/MasterpieceArchDesign.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using LegendsViewer.Legends.Parser; 3 | 4 | namespace LegendsViewer.Legends.Events 5 | { 6 | public class MasterpieceArchDesign : MasterpieceArch 7 | { 8 | public MasterpieceArchDesign(List properties, World world) 9 | : base(properties, world) 10 | { 11 | Process = "designed"; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/Procession.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using LegendsViewer.Legends.Enums; 3 | using LegendsViewer.Legends.Parser; 4 | 5 | namespace LegendsViewer.Legends.Events 6 | { 7 | public class Procession : OccasionEvent 8 | { 9 | public Procession(List properties, World world) : base(properties, world) 10 | { 11 | OccasionType = OccasionType.Procession; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/Performance.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using LegendsViewer.Legends.Enums; 3 | using LegendsViewer.Legends.Parser; 4 | 5 | namespace LegendsViewer.Legends.Events 6 | { 7 | public class Performance : OccasionEvent 8 | { 9 | public Performance(List properties, World world) : base(properties, world) 10 | { 11 | OccasionType = OccasionType.Performance; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/DanceFormCreated.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using LegendsViewer.Legends.Enums; 3 | using LegendsViewer.Legends.Parser; 4 | 5 | namespace LegendsViewer.Legends.Events 6 | { 7 | public class DanceFormCreated : FormCreatedEvent 8 | { 9 | public DanceFormCreated(List properties, World world) : base(properties, world) 10 | { 11 | FormType = FormType.Dance; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/MasterpieceArchConstructed.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using LegendsViewer.Legends.Parser; 3 | 4 | namespace LegendsViewer.Legends.Events 5 | { 6 | public class MasterpieceArchConstructed : MasterpieceArch 7 | { 8 | public MasterpieceArchConstructed(List properties, World world) 9 | : base(properties, world) 10 | { 11 | Process = "constructed"; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /LegendsViewer/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/WorldObjects/DwarfObject.cs: -------------------------------------------------------------------------------- 1 | using LegendsViewer.Legends.Events; 2 | 3 | namespace LegendsViewer.Legends.WorldObjects 4 | { 5 | public abstract class DwarfObject 6 | { 7 | public virtual string GetIcon() 8 | { 9 | return ""; 10 | } 11 | 12 | public virtual string ToLink(bool link = true, DwarfObject pov = null, WorldEvent worldEvent = null) 13 | { 14 | return ""; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/ReferenceType.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Legends.Enums 2 | { 3 | public enum ReferenceType 4 | { 5 | Unknown, 6 | WrittenContent, 7 | PoeticForm, 8 | MusicalForm, 9 | DanceForm, 10 | ValueLevel, 11 | KnowledgeScholarFlag, 12 | Site, 13 | HistoricalEvent, 14 | Interaction, 15 | Entity, 16 | HistoricalFigure, 17 | Language, 18 | Subregion, 19 | AbstractBuilding, 20 | Artifact, 21 | Sphere 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /LegendsViewer/Controls/Query/Attributes/ShowInAdvancedSearchResultsAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LegendsViewer.Controls.Query.Attributes 4 | { 5 | [AttributeUsage(AttributeTargets.Property)] 6 | public class ShowInAdvancedSearchResultsAttribute : Attribute 7 | { 8 | public string Header { get; } 9 | 10 | public ShowInAdvancedSearchResultsAttribute() 11 | { 12 | 13 | } 14 | 15 | public ShowInAdvancedSearchResultsAttribute(string header) 16 | { 17 | Header = header; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/StructureType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LegendsViewer.Legends.Enums 4 | { 5 | public enum StructureType 6 | { 7 | Unknown, 8 | [Description("Mead Hall")] 9 | MeadHall, 10 | Market, 11 | Keep, 12 | Temple, 13 | Dungeon, 14 | [Description("Tavern & Inn")] 15 | InnTavern, 16 | Tomb, 17 | [Description("Underworld Spire")] 18 | UnderworldSpire, 19 | Library, 20 | Tower, 21 | [Description("Counting House")] 22 | CountingHouse, 23 | Guildhall 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /LegendsViewer/Controls/PageControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace LegendsViewer.Controls 5 | { 6 | public abstract class PageControl : IDisposable 7 | { 8 | public DwarfTabControl TabControl; 9 | public string Title; 10 | 11 | internal bool Disposed; 12 | 13 | public abstract Control GetControl(); 14 | 15 | public void Dispose() 16 | { 17 | Dispose(true); 18 | GC.SuppressFinalize(this); 19 | } 20 | public abstract void Refresh(); 21 | 22 | protected virtual void Dispose(bool disposing) 23 | { 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/EntityLinkType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LegendsViewer.Legends.Enums 4 | { 5 | public enum EntityLinkType 6 | { 7 | Unknown, 8 | Criminal, 9 | Enemy, 10 | Member, 11 | [Description("Former Member")] 12 | FormerMember, 13 | Position, 14 | [Description("Former Position")] 15 | FormerPosition, 16 | Prisoner, 17 | [Description("Former Prisoner")] 18 | FormerPrisoner, 19 | [Description("Former Slave")] 20 | FormerSlave, 21 | Slave, 22 | [Description("Respected for heroic acts")] 23 | Hero 24 | } 25 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/PoeticFormCreated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Enums; 4 | using LegendsViewer.Legends.Parser; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class PoeticFormCreated : FormCreatedEvent 9 | { 10 | public PoeticFormCreated(List properties, World world) : base(properties, world) 11 | { 12 | FormType = FormType.Poetic; 13 | if (!string.IsNullOrWhiteSpace(FormId)) 14 | { 15 | ArtForm = world.GetPoeticForm(Convert.ToInt32(FormId)); 16 | ArtForm.AddEvent(this); 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/MusicalFormCreated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Enums; 4 | using LegendsViewer.Legends.Parser; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class MusicalFormCreated : FormCreatedEvent 9 | { 10 | public MusicalFormCreated(List properties, World world) : base(properties, world) 11 | { 12 | FormType = FormType.Musical; 13 | if (!string.IsNullOrWhiteSpace(FormId)) 14 | { 15 | ArtForm = world.GetMusicalForm(Convert.ToInt32(FormId)); 16 | ArtForm.AddEvent(this); 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /LegendsViewer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace LegendsViewer 5 | { 6 | static class Program 7 | { 8 | /// 9 | /// The main entry point for the application. 10 | /// 11 | [STAThread] 12 | static void Main(string[] args) 13 | { 14 | Application.EnableVisualStyles(); 15 | Application.SetCompatibleTextRenderingDefault(false); 16 | if (args.Length > 0) 17 | { 18 | Application.Run(new FrmLegendsViewer(args[0])); 19 | } 20 | else 21 | { 22 | Application.Run(new FrmLegendsViewer()); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /LegendsViewer/Controls/HTML/StringPrinter.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using LegendsViewer.Legends; 3 | 4 | namespace LegendsViewer.Controls.HTML 5 | { 6 | class StringPrinter : HtmlPrinter 7 | { 8 | string _title; 9 | public StringPrinter(string htmlString) 10 | { 11 | Html = new StringBuilder(); 12 | _title = htmlString.Substring(0, htmlString.IndexOf("\n")); 13 | Html.AppendLine(htmlString.Substring(htmlString.IndexOf("\n") + 1)); 14 | } 15 | 16 | public override string Print() 17 | { 18 | return Html.ToString(); 19 | } 20 | 21 | public override string GetTitle() 22 | { 23 | return _title; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/HFSimpleBattleType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LegendsViewer.Legends.Enums 4 | { 5 | public enum HfSimpleBattleType : byte 6 | { 7 | Unknown, 8 | [Description("2nd HF Lost After Giving Wounds")] 9 | Hf2LostAfterGivingWounds, 10 | [Description("2nd HF Lost After Mutual Wounds")] 11 | Hf2LostAfterMutualWounds, 12 | [Description("2nd HF Lost After Recieving Wounds")] 13 | Hf2LostAfterReceivingWounds, 14 | Attacked, 15 | Scuffle, 16 | Confronted, 17 | Ambushed, 18 | [Description("Happened Upon")] 19 | HappenedUpon, 20 | Cornered, 21 | Surprised, 22 | GotIntoABrawl, 23 | Subdued 24 | } 25 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/AgreementVoid.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using LegendsViewer.Legends.Parser; 3 | using LegendsViewer.Legends.WorldObjects; 4 | 5 | namespace LegendsViewer.Legends.Events 6 | { 7 | public class AgreementVoid : WorldEvent 8 | { 9 | public AgreementVoid(List properties, World world) : base(properties, world) 10 | { 11 | } 12 | 13 | public override string Print(bool link = true, DwarfObject pov = null) 14 | { 15 | string eventString = GetYearTime(); 16 | eventString += " an agreement has been annulated"; 17 | eventString += PrintParentCollection(link, pov); 18 | eventString += "."; 19 | return eventString; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Parser/Property.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace LegendsViewer.Legends.Parser 5 | { 6 | public class Property 7 | { 8 | public string Name; 9 | public bool Known; 10 | 11 | public List SubProperties { get; set; } 12 | 13 | private string _value; 14 | public string Value 15 | { 16 | get 17 | { 18 | Known = true; 19 | return _value ?? string.Empty; 20 | } 21 | set 22 | { 23 | _value = value; 24 | } 25 | } 26 | 27 | public int ValueAsInt() 28 | { 29 | return Convert.ToInt32(Value); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/SiteType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LegendsViewer.Legends.Enums 4 | { 5 | public enum SiteType 6 | { 7 | Unknown, 8 | Cave, 9 | Fortress, 10 | [Description("Forest Retreat")] 11 | ForestRetreat, 12 | [Description("Dark Fortress")] 13 | DarkFortress, 14 | Town, 15 | Hamlet, 16 | Vault, 17 | [Description("Dark Pits")] 18 | DarkPits, 19 | Hillocks, 20 | Tomb, 21 | Tower, 22 | [Description("Mountain Halls")] 23 | MountainHalls, 24 | Camp, 25 | Lair, 26 | Labyrinth, 27 | Shrine, 28 | [Description("Important Location")] 29 | ImportantLocation, 30 | Fort, 31 | Monastery, 32 | Castle 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/SiteLinkType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LegendsViewer.Legends.Enums 4 | { 5 | public enum SiteLinkType 6 | { 7 | Unknown, 8 | Lair, 9 | Hangout, 10 | [Description("Home - Site Building")] 11 | HomeSiteBuilding, 12 | [Description("Home - Site Underground")] 13 | HomeSiteUnderground, 14 | [Description("Home - Structure")] 15 | HomeStructure, 16 | [Description("Seat of Power")] 17 | SeatOfPower, 18 | Occupation, 19 | [Description("Home - Site Realization Building")] 20 | HomeSiteRealizationBuilding, 21 | [Description("Home - Site Abstract Building")] 22 | HomeSiteAbstractBuilding, 23 | [Description("Prison - Site Building")] 24 | PrisonSiteBuildingProfile 25 | } 26 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/EntityType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LegendsViewer.Legends.Enums 4 | { 5 | public enum EntityType // legends_plus.xml 6 | { 7 | Unknown, 8 | Civilization, 9 | [Description("Nomads")] 10 | NomadicGroup, 11 | [Description("Migrants")] 12 | MigratingGroup, 13 | [Description("Outcasts")] 14 | Outcast, 15 | [Description("Religion")] 16 | Religion, 17 | [Description("Government")] 18 | SiteGovernment, 19 | [Description("Performers")] 20 | PerformanceTroupe, 21 | [Description("Mercenary Company")] 22 | MercenaryCompany, 23 | Guild, 24 | [Description("Military Unit")] 25 | MilitaryUnit, 26 | [Description("Merchant Company")] 27 | MerchantCompany, 28 | } 29 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/OwnerPeriod.cs: -------------------------------------------------------------------------------- 1 | using LegendsViewer.Legends.WorldObjects; 2 | 3 | namespace LegendsViewer.Legends 4 | { 5 | public class OwnerPeriod 6 | { 7 | public readonly Site Site; 8 | public HistoricalFigure Founder; 9 | public Entity Owner; 10 | public Entity Ender; 11 | public HistoricalFigure Destroyer; 12 | public readonly int StartYear; 13 | public int EndYear; 14 | public string StartCause; 15 | public string EndCause; 16 | 17 | public OwnerPeriod(Site site, Entity owner, int startYear, string startCause, HistoricalFigure founder = null) 18 | { 19 | Site = site; 20 | Owner = owner; 21 | StartYear = startYear; 22 | StartCause = startCause; 23 | EndYear = -1; 24 | 25 | Founder = founder; 26 | 27 | Owner?.AddOwnedSite(this); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LegendsViewer/Controls/Query/Attributes/AllowAdvancedSearchAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LegendsViewer.Controls.Query.Attributes 4 | { 5 | [AttributeUsage(AttributeTargets.Property)] 6 | public class AllowAdvancedSearchAttribute : Attribute 7 | { 8 | public bool IsSelectable { get; } 9 | public string Description { get; } 10 | 11 | public AllowAdvancedSearchAttribute() 12 | { 13 | 14 | } 15 | 16 | public AllowAdvancedSearchAttribute(string description) 17 | { 18 | Description = description; 19 | } 20 | 21 | public AllowAdvancedSearchAttribute(string description, bool isSelectable) : this(description) 22 | { 23 | IsSelectable = isSelectable; 24 | } 25 | 26 | public AllowAdvancedSearchAttribute(bool isSelectable) 27 | { 28 | IsSelectable = isSelectable; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/HistoricalFigureLinkType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LegendsViewer.Legends.Enums 4 | { 5 | public enum HistoricalFigureLinkType 6 | { 7 | Unknown, 8 | Apprentice, 9 | Master, 10 | [Description("Former Apprentice")] 11 | FormerApprentice, 12 | [Description("Former Master")] 13 | FormerMaster, 14 | Child, 15 | Deity, 16 | Father, 17 | Lover, 18 | Mother, 19 | Spouse, 20 | Imprisoner, 21 | Prisoner, //Not found in XML, used by AddHFHFLink event 22 | [Description("Ex-Spouse")] 23 | ExSpouse, 24 | [Description("Traveling Companion")] 25 | Companion, 26 | [Description("Pet Owner")] 27 | PetOwner, 28 | [Description("Former Spouse")] 29 | FormerSpouse, 30 | [Description("Deceased Spouse")] 31 | DeceasedSpouse 32 | } 33 | } -------------------------------------------------------------------------------- /LegendsViewer/Controls/Chart/ChartOption.cs: -------------------------------------------------------------------------------- 1 | namespace LegendsViewer.Controls.Chart 2 | { 3 | public enum ChartOption : byte 4 | { 5 | TimelineEvents, 6 | TimelineEventsFiltered, 7 | TimelineBattleDeaths, 8 | TimelineActiveSites, 9 | TimelineActiveSitesByRace, 10 | TimelineAliveHFs, 11 | TimeLineAliveHfSpecific, 12 | TimelineActiveWars, 13 | TimelineBattles, 14 | TimelineBeastAttacks, 15 | OtherEventTypes, 16 | OtherKillsByRace, 17 | OtherEntityPopulations, 18 | OtherDeaths, 19 | OtherSitePopulations, 20 | OtherWarLosses, 21 | OtherBattleRemaining, 22 | WorldHfRaces, 23 | WorldHfAlive, 24 | WorldHfRemaining, 25 | WorldSitePopulations, 26 | WorldDeaths, 27 | WorldSiteTypes, 28 | WorldRegionTypes, 29 | WorldOutdoorPopulations, 30 | WorldUndergroundPopulations 31 | } 32 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/ScheduleType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LegendsViewer.Legends.Enums 4 | { 5 | public enum ScheduleType 6 | { 7 | Unknown, 8 | Procession, 9 | Ceremony, 10 | [Description("Foot Race")] 11 | FootRace, 12 | [Description("Throwing Competition")] 13 | ThrowingCompetition, 14 | [Description("Dance Performance")] 15 | DancePerformance, 16 | Storytelling, 17 | [Description("Poetry Recital")] 18 | PoetryRecital, 19 | [Description("Musical Performance")] 20 | MusicalPerformance, 21 | [Description("Wrestling Competition")] 22 | WrestlingCompetition, 23 | [Description("Gladiatory Competition")] 24 | GladiatoryCompetition, 25 | [Description("Poetry Competition")] 26 | PoetryCompetition, 27 | [Description("Dance Competition")] 28 | DanceCompetition, 29 | [Description("Musical Competition")] 30 | MusicalCompetition 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Parser/ParsingErrors.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text; 3 | 4 | namespace LegendsViewer.Legends.Parser 5 | { 6 | public class ParsingErrors 7 | { 8 | private readonly List _reportedErrorTypes = new List(); 9 | private readonly StringBuilder _log = new StringBuilder(); 10 | 11 | public void Report(string description, string details = null) 12 | { 13 | if (_reportedErrorTypes.FindIndex(error => error == description) == -1) 14 | { 15 | _log.Append(description); 16 | if (!string.IsNullOrWhiteSpace(details)) 17 | { 18 | _log.AppendLine(" (" + details + ")"); 19 | } 20 | else 21 | { 22 | _log.AppendLine(); 23 | } 24 | 25 | _reportedErrorTypes.Add(description); 26 | } 27 | } 28 | 29 | public string Print() 30 | { 31 | return _log.ToString(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LegendsViewer/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | using System.CodeDom.Compiler; 12 | using System.Configuration; 13 | using System.Runtime.CompilerServices; 14 | 15 | namespace LegendsViewer.Properties { 16 | 17 | 18 | [CompilerGenerated()] 19 | [GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 20 | internal sealed partial class Settings : ApplicationSettingsBase { 21 | 22 | private static Settings defaultInstance = ((Settings)(Synchronized(new Settings()))); 23 | 24 | public static Settings Default { 25 | get { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/PlotActor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | 5 | namespace LegendsViewer.Legends 6 | { 7 | public class PlotActor 8 | { 9 | public int ActorId { get; set; } 10 | public string PlotRole { get; set; } 11 | public int AgreementId { get; set; } 12 | public bool AgreementHasMessenger { get; set; } 13 | 14 | public PlotActor(List properties) 15 | { 16 | foreach (Property property in properties) 17 | { 18 | switch (property.Name) 19 | { 20 | case "actor_id": ActorId = Convert.ToInt32(property.Value); break; 21 | case "plot_role": PlotRole = property.Value; break; 22 | case "agreement_id": AgreementId = Convert.ToInt32(property.Value); break; 23 | case "agreement_has_messenger": 24 | property.Known = true; 25 | AgreementHasMessenger = true; 26 | break; 27 | } 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /LegendsViewer/Controls/HTML/ArtFormPrinter.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using LegendsViewer.Legends; 3 | 4 | namespace LegendsViewer.Controls.HTML 5 | { 6 | public class ArtFormPrinter : HtmlPrinter 7 | { 8 | private readonly ArtForm _artform; 9 | private readonly World _world; 10 | 11 | public ArtFormPrinter(ArtForm artform, World world) 12 | { 13 | _artform = artform; 14 | _world = world; 15 | } 16 | 17 | public override string GetTitle() 18 | { 19 | return _artform.Name; 20 | } 21 | 22 | public override string Print() 23 | { 24 | Html = new StringBuilder(); 25 | 26 | Html.AppendLine("

" + _artform.GetIcon() + " " + _artform.Name + ", " + _artform.FormType + " Form


"); 27 | if (!string.IsNullOrEmpty(_artform.Description)) 28 | { 29 | Html.AppendLine(_artform.Description.Replace("[B]", "
") + "

"); 30 | } 31 | PrintEventLog(_world, _artform.Events, ArtForm.Filters, _artform); 32 | 33 | return Html.ToString(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/ReputationType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LegendsViewer.Legends.Enums 4 | { 5 | public enum ReputationType 6 | { 7 | Unknown, 8 | [Description("Enemy Fighter")] 9 | EnemyFighter, 10 | [Description("Trade Partner")] 11 | TradePartner, 12 | Killer, 13 | Poet, 14 | Bard, 15 | Storyteller, 16 | Dancer, 17 | Friendly, 18 | Buddy, 19 | Grudge, 20 | Bonded, 21 | Quarreler, 22 | Psychopath, 23 | [Description("Loyal Soldier")] 24 | LoyalSoldier, 25 | Bully, 26 | Hero, 27 | Hunter, 28 | [Description("Information Source")] 29 | InformationSource, 30 | [Description("Treasure Hunter")] 31 | TreasureHunter, 32 | [Description("Knowledge Preserver")] 33 | KnowledgePreserver, 34 | [Description("Protector Of The Weak")] 35 | ProtectorOfWeak, 36 | Love, 37 | Respect, 38 | Trust, 39 | Loyalty, 40 | Fear, 41 | Comrade, 42 | Murderer, 43 | Violent, 44 | Flatterer 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/EntityPositionAssignment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends 7 | { 8 | public class EntityPositionAssignment 9 | { 10 | public int Id { get; set; } 11 | public HistoricalFigure HistoricalFigure { get; set; } 12 | public int PositionId { get; set; } 13 | public int SquadId { get; set; } 14 | 15 | public EntityPositionAssignment(List properties, World world) 16 | { 17 | Id = -1; 18 | foreach (Property property in properties) 19 | { 20 | switch (property.Name) 21 | { 22 | case "id": Id = Convert.ToInt32(property.Value); break; 23 | case "histfig": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; 24 | case "position_id": PositionId = Convert.ToInt32(property.Value); break; 25 | case "squad_id": SquadId = Convert.ToInt32(property.Value); break; 26 | } 27 | } 28 | 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/EventCollections/Journey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Events; 5 | using LegendsViewer.Legends.Parser; 6 | using LegendsViewer.Legends.WorldObjects; 7 | 8 | namespace LegendsViewer.Legends.EventCollections 9 | { 10 | public class Journey : EventCollection 11 | { 12 | public string Ordinal; 13 | public List Filters; 14 | public override List FilteredEvents 15 | { 16 | get { return AllEvents.Where(dwarfEvent => !Filters.Contains(dwarfEvent.Type)).ToList(); } 17 | } 18 | public Journey(List properties, World world) 19 | : base(properties, world) 20 | { 21 | foreach (Property property in properties) 22 | { 23 | switch (property.Name) 24 | { 25 | case "ordinal": Ordinal = String.Intern(property.Value); break; 26 | } 27 | } 28 | } 29 | public override string ToLink(bool link = true, DwarfObject pov = null, WorldEvent worldEvent = null) 30 | { 31 | return "a journey"; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/VagueRelationshipType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LegendsViewer.Legends.Enums 4 | { 5 | public enum VagueRelationshipType 6 | { 7 | Unknown, 8 | [Description("War Buddy")] 9 | WarBuddy, 10 | [Description("Athlete Buddy")] 11 | AthleteBuddy, 12 | [Description("Childhood Friend")] 13 | ChildhoodFriend, 14 | [Description("Persecution Grudge")] 15 | PersecutionGrudge, 16 | [Description("Supernatural Grudge")] 17 | SupernaturalGrudge, 18 | [Description("Religious Persecution Grudge")] 19 | ReligiousPersecutionGrudge, 20 | [Description("Artistic Buddy")] 21 | ArtisticBuddy, 22 | [Description("Jealous Obsession")] 23 | JealousObsession, 24 | Grudge, 25 | [Description("Jealous Relationship Grudge")] 26 | JealousRelationshipGrudge, 27 | [Description("Scholar Buddy")] 28 | ScholarBuddy, 29 | [Description("Business Rival")] 30 | BusinessRival, 31 | [Description("Athletic Rival")] 32 | AthleticRival, 33 | Lover, 34 | [Description("Former Lover")] 35 | FormerLover, 36 | Lieutenant 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/EventCollections/CeremonyCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Events; 5 | using LegendsViewer.Legends.Parser; 6 | using LegendsViewer.Legends.WorldObjects; 7 | 8 | namespace LegendsViewer.Legends.EventCollections 9 | { 10 | public class CeremonyCollection : EventCollection 11 | { 12 | public string Ordinal; 13 | 14 | public List Filters; 15 | public override List FilteredEvents 16 | { 17 | get { return AllEvents.Where(dwarfEvent => !Filters.Contains(dwarfEvent.Type)).ToList(); } 18 | } 19 | public CeremonyCollection(List properties, World world) 20 | : base(properties, world) 21 | { 22 | foreach (Property property in properties) 23 | { 24 | switch (property.Name) 25 | { 26 | case "ordinal": Ordinal = String.Intern(property.Value); break; 27 | } 28 | } 29 | } 30 | public override string ToLink(bool link = true, DwarfObject pov = null, WorldEvent worldEvent = null) 31 | { 32 | return "a ceremony"; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/EventCollections/CompetitionCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Events; 5 | using LegendsViewer.Legends.Parser; 6 | using LegendsViewer.Legends.WorldObjects; 7 | 8 | namespace LegendsViewer.Legends.EventCollections 9 | { 10 | public class CompetitionCollection : EventCollection 11 | { 12 | public string Ordinal; 13 | 14 | public List Filters; 15 | public override List FilteredEvents 16 | { 17 | get { return AllEvents.Where(dwarfEvent => !Filters.Contains(dwarfEvent.Type)).ToList(); } 18 | } 19 | public CompetitionCollection(List properties, World world) 20 | : base(properties, world) 21 | { 22 | foreach (Property property in properties) 23 | { 24 | switch (property.Name) 25 | { 26 | case "ordinal": Ordinal = String.Intern(property.Value); break; 27 | } 28 | } 29 | } 30 | public override string ToLink(bool link = true, DwarfObject pov = null, WorldEvent worldEvent = null) 31 | { 32 | return "a competition"; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/EventCollections/PerformanceCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Events; 5 | using LegendsViewer.Legends.Parser; 6 | using LegendsViewer.Legends.WorldObjects; 7 | 8 | namespace LegendsViewer.Legends.EventCollections 9 | { 10 | public class PerformanceCollection : EventCollection 11 | { 12 | public string Ordinal; 13 | 14 | public List Filters; 15 | public override List FilteredEvents 16 | { 17 | get { return AllEvents.Where(dwarfEvent => !Filters.Contains(dwarfEvent.Type)).ToList(); } 18 | } 19 | public PerformanceCollection(List properties, World world) 20 | : base(properties, world) 21 | { 22 | foreach (Property property in properties) 23 | { 24 | switch (property.Name) 25 | { 26 | case "ordinal": Ordinal = String.Intern(property.Value); break; 27 | } 28 | } 29 | } 30 | public override string ToLink(bool link = true, DwarfObject pov = null, WorldEvent worldEvent = null) 31 | { 32 | return "a performance"; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/EventCollections/ProcessionCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Events; 5 | using LegendsViewer.Legends.Parser; 6 | using LegendsViewer.Legends.WorldObjects; 7 | 8 | namespace LegendsViewer.Legends.EventCollections 9 | { 10 | public class ProcessionCollection : EventCollection 11 | { 12 | public string Ordinal; 13 | 14 | public List Filters; 15 | public override List FilteredEvents 16 | { 17 | get { return AllEvents.Where(dwarfEvent => !Filters.Contains(dwarfEvent.Type)).ToList(); } 18 | } 19 | public ProcessionCollection(List properties, World world) 20 | : base(properties, world) 21 | { 22 | foreach (Property property in properties) 23 | { 24 | switch (property.Name) 25 | { 26 | case "ordinal": Ordinal = String.Intern(property.Value); break; 27 | } 28 | } 29 | } 30 | public override string ToLink(bool link = true, DwarfObject pov = null, WorldEvent worldEvent = null) 31 | { 32 | return "a procession"; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/EntitySiteLink.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using LegendsViewer.Legends.Parser; 3 | using LegendsViewer.Legends.WorldObjects; 4 | 5 | namespace LegendsViewer.Legends 6 | { 7 | public enum EntitySiteLinkType // legends_plus.xml 8 | { 9 | Unknown 10 | } 11 | 12 | public class EntitySiteLink : DwarfObject // legends_plus.xml 13 | { 14 | public EntitySiteLink(List properties, World world) 15 | { 16 | Type = EntitySiteLinkType.Unknown; 17 | foreach (Property property in properties) 18 | { 19 | switch (property.Name) 20 | { 21 | case "type": 22 | //All unknown for the time being. 23 | break; 24 | case "site": 25 | Site = world.GetSite(property.ValueAsInt()); 26 | break; 27 | case "strength": 28 | Strength = property.ValueAsInt(); 29 | break; 30 | } 31 | } 32 | } 33 | 34 | public EntitySiteLinkType Type { get; set; } 35 | public Site Site { get; set; } 36 | public int Strength { get; set; } 37 | } 38 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/WrittenContentType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LegendsViewer.Legends.Enums 4 | { 5 | public enum WrittenContentType 6 | { 7 | Unknown, 8 | Autobiography, 9 | Biography, 10 | Chronicle, 11 | Dialog, 12 | Essay, 13 | Guide, 14 | Letter, 15 | Manual, 16 | Novel, 17 | Play, 18 | Poem, 19 | [Description("Short Story")] 20 | ShortStory, 21 | Choreography, 22 | [Description("Musical Composition")] 23 | MusicalComposition, 24 | [Description("Star Chart")] 25 | StarChart, 26 | [Description("Cultural History")] 27 | CulturalHistory, 28 | [Description("Comparative Biography")] 29 | ComparativeBiography, 30 | [Description("Cultural Comparison")] 31 | CulturalComparison, 32 | Atlas, 33 | [Description("Treatise On Technological Evolution")] 34 | TreatiseOnTechnologicalEvolution, 35 | [Description("Alternate History")] 36 | AlternateHistory, 37 | [Description("Star Catalogue")] 38 | StarCatalogue, 39 | Dictionary, 40 | Genealogy, 41 | Encyclopedia, 42 | [Description("Biographical Dictionary")] 43 | BiographicalDictionary 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Parser/Section.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LegendsViewer.Legends.Parser 4 | { 5 | // !!! In order as they appear in the XML. !!! 6 | public enum Section 7 | { 8 | Unknown, 9 | Junk, 10 | Landmasses, 11 | [Description("Mountain Peaks")] 12 | MountainPeaks, 13 | Regions, 14 | [Description("Underground Regions")] 15 | UndergroundRegions, 16 | Rivers, 17 | CreatureRaw, 18 | Sites, 19 | [Description("World Constructions")] 20 | WorldConstructions, 21 | Artifacts, 22 | [Description("Historical Figures")] 23 | HistoricalFigures, 24 | Identities, 25 | [Description("Entity Populations")] 26 | EntityPopulations, 27 | Entities, 28 | Events, 29 | [Description("Event Collections")] 30 | EventCollections, 31 | [Description("Historical Event Relationships")] 32 | HistoricalEventRelationships, 33 | HistoricalEventRelationshipSupplement, 34 | Eras, 35 | [Description("Written Content")] 36 | WrittenContent, 37 | [Description("Poetic Forms")] 38 | PoeticForms, 39 | [Description("Musical Forms")] 40 | MusicalForms, 41 | [Description("Dance Forms")] 42 | DanceForms, 43 | } 44 | // !!! In order as they appear in the XML. !!! 45 | } 46 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/WorldObjects/MusicalForm.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using LegendsViewer.Controls.HTML.Utilities; 3 | using LegendsViewer.Legends.Enums; 4 | using LegendsViewer.Legends.Events; 5 | using LegendsViewer.Legends.Parser; 6 | 7 | namespace LegendsViewer.Legends.WorldObjects 8 | { 9 | public class MusicalForm : ArtForm 10 | { 11 | public static string Icon = ""; 12 | 13 | public MusicalForm(List properties, World world) 14 | : base(properties, world) 15 | { 16 | FormType = FormType.Musical; 17 | } 18 | 19 | public override string ToLink(bool link = true, DwarfObject pov = null, WorldEvent worldEvent = null) 20 | { 21 | if (link) 22 | { 23 | string title = "Musical Form"; 24 | title += " "; 25 | title += "Events: " + Events.Count; 26 | 27 | if (pov != this) 28 | { 29 | return Icon + "" + Name + ""; 30 | } 31 | return Icon + "" + HtmlStyleUtil.CurrentDwarfObject(Name) + ""; 32 | } 33 | return Name; 34 | } 35 | 36 | public override string GetIcon() 37 | { 38 | return Icon; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/WorldObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.EventCollections; 4 | using LegendsViewer.Legends.Events; 5 | using LegendsViewer.Legends.Parser; 6 | using LegendsViewer.Legends.WorldObjects; 7 | 8 | namespace LegendsViewer.Legends 9 | { 10 | public abstract class WorldObject : DwarfObject 11 | { 12 | public List Events { get; set; } 13 | public abstract List FilteredEvents { get; } 14 | public List EventCollectons { get; set; } 15 | public int EventCount { get { return Events.Count; } set { } } 16 | public int Id { get; set; } 17 | 18 | protected WorldObject() { 19 | Id = -1; 20 | Events = new List(); 21 | EventCollectons = new List(); 22 | } 23 | 24 | protected WorldObject(List properties, World world) : this() 25 | { 26 | foreach(Property property in properties) 27 | { 28 | switch (property.Name) 29 | { 30 | case "id": Id = Convert.ToInt32(property.Value); break; 31 | } 32 | } 33 | } 34 | 35 | 36 | public override string ToLink(bool link = true, DwarfObject pov = null, WorldEvent worldEvent = null) 37 | { 38 | return ""; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Feature.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Controls.Query.Attributes; 5 | using LegendsViewer.Legends.Events; 6 | using LegendsViewer.Legends.Parser; 7 | using LegendsViewer.Legends.WorldObjects; 8 | 9 | namespace LegendsViewer.Legends 10 | { 11 | public class Feature : WorldObject 12 | { 13 | public string Type { get; set; } // legends_plus.xml 14 | public int Reference { get; set; } // legends_plus.xml 15 | 16 | public static List Filters; 17 | public override List FilteredEvents 18 | { 19 | get { return Events.Where(dwarfEvent => !Filters.Contains(dwarfEvent.Type)).ToList(); } 20 | } 21 | 22 | public Feature(List properties, World world) 23 | : base(properties, world) 24 | { 25 | foreach (Property property in properties) 26 | { 27 | switch (property.Name) 28 | { 29 | case "type": Type = string.Intern(property.Value); break; 30 | case "reference": Reference = Convert.ToInt32(property.Value); break; 31 | } 32 | } 33 | } 34 | 35 | public override string ToString() { return Type; } 36 | 37 | public override string ToLink(bool link = true, DwarfObject pov = null, WorldEvent worldEvent = null) 38 | { 39 | return Type; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/EntityFledSite.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class EntityFledSite : WorldEvent 9 | { 10 | public Entity FledCiv { get; set; } 11 | public Site Site { get; set; } 12 | 13 | public EntityFledSite(List properties, World world) 14 | : base(properties, world) 15 | { 16 | foreach (Property property in properties) 17 | { 18 | switch (property.Name) 19 | { 20 | case "fled_civ_id": FledCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; 21 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 22 | } 23 | } 24 | 25 | FledCiv.AddEvent(this); 26 | Site.AddEvent(this); 27 | } 28 | 29 | public override string Print(bool link = true, DwarfObject pov = null) 30 | { 31 | string eventString = GetYearTime(); 32 | eventString += FledCiv?.ToLink(true, pov) ?? "an unknown civilization"; 33 | eventString += " fled "; 34 | eventString += Site?.ToLink(true, pov) ?? "an unknown site"; 35 | eventString += PrintParentCollection(link, pov); 36 | eventString += "."; 37 | return eventString; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /LegendsViewer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("LegendsViewer")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("LegendsViewer")] 12 | [assembly: AssemblyCopyright("")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a Race in this assembly from 18 | // COM, set the ComVisible attribute to true on that Race. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("4bf20b5b-a94c-445d-9fb0-45fa6c7bf137")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.20.08")] 35 | [assembly: AssemblyFileVersion("1.20.08")] 36 | -------------------------------------------------------------------------------- /LegendsViewer/Controls/HTML/Utilities/BrowserUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using Microsoft.Win32; 5 | 6 | namespace LegendsViewer.Controls.HTML.Utilities 7 | { 8 | public static class BrowserUtil 9 | { 10 | /// 11 | /// WebBrowser Control is as default rendered with IE7 rendering engine 12 | /// Setting FEATURE_BROWSER_EMULATION Registry Key of the process to MODE sets it to rendering mode IE10 13 | /// 14 | public static void SetBrowserEmulationMode() 15 | { 16 | try 17 | { 18 | var appName = Path.GetFileName(Process.GetCurrentProcess().MainModule.FileName); 19 | 20 | if (string.Compare(appName, "devenv.exe", StringComparison.OrdinalIgnoreCase) == 0 || 21 | string.Compare(appName, "XDesProc.exe", StringComparison.OrdinalIgnoreCase) == 0) 22 | { 23 | return; 24 | } 25 | 26 | const uint mode = 10000; 27 | using (var key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION\", 28 | RegistryKeyPermissionCheck.ReadWriteSubTree)) 29 | { 30 | key?.SetValue(appName, mode, RegistryValueKind.DWord); 31 | } 32 | } 33 | catch (Exception) 34 | { 35 | // ignored 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/HolyCityDeclaration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class HolyCityDeclaration : WorldEvent 9 | { 10 | public Site Site { get; set; } 11 | public Entity ReligionEntity { get; set; } 12 | 13 | public HolyCityDeclaration(List properties, World world) 14 | : base(properties, world) 15 | { 16 | foreach (Property property in properties) 17 | { 18 | switch (property.Name) 19 | { 20 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 21 | case "religion_id": ReligionEntity = world.GetEntity(Convert.ToInt32(property.Value)); break; 22 | } 23 | } 24 | Site.AddEvent(this); 25 | ReligionEntity.AddEvent(this); 26 | } 27 | 28 | public override string Print(bool link = true, DwarfObject pov = null) 29 | { 30 | string eventString = GetYearTime(); 31 | eventString += ReligionEntity.ToLink(link, pov, this); 32 | eventString += " declared "; 33 | eventString += Site.ToLink(link, pov, this); 34 | eventString += " to be a holy city"; 35 | 36 | eventString += PrintParentCollection(link, pov); 37 | eventString += "."; 38 | return eventString; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/WorldObjects/DanceForm.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using LegendsViewer.Controls.HTML.Utilities; 3 | using LegendsViewer.Legends.Enums; 4 | using LegendsViewer.Legends.Events; 5 | using LegendsViewer.Legends.Parser; 6 | 7 | namespace LegendsViewer.Legends.WorldObjects 8 | { 9 | public class DanceForm : ArtForm 10 | { 11 | public static string Icon = ""; 12 | 13 | public DanceForm(List properties, World world) 14 | : base(properties, world) 15 | { 16 | FormType = FormType.Dance; 17 | } 18 | 19 | public override string ToLink(bool link = true, DwarfObject pov = null, WorldEvent worldEvent = null) 20 | { 21 | if (link) 22 | { 23 | string linkedString = ""; 24 | if (pov != this) 25 | { 26 | string title = "Dance Form"; 27 | title += " "; 28 | title += "Events: " + Events.Count; 29 | 30 | linkedString = Icon + "" + Name + ""; 31 | } 32 | else 33 | { 34 | linkedString = Icon + HtmlStyleUtil.CurrentDwarfObject(Name); 35 | } 36 | return linkedString; 37 | } 38 | return Name; 39 | } 40 | 41 | public override string GetIcon() 42 | { 43 | return Icon; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /LegendsViewer/Controls/HTML/RiverPrinter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Drawing; 3 | using System.Linq; 4 | using System.Text; 5 | using LegendsViewer.Controls.Map; 6 | using LegendsViewer.Legends; 7 | using LegendsViewer.Legends.WorldObjects; 8 | 9 | namespace LegendsViewer.Controls.HTML 10 | { 11 | public class RiverPrinter : HtmlPrinter 12 | { 13 | River _river; 14 | World _world; 15 | 16 | public RiverPrinter(River river, World world) 17 | { 18 | _river = river; 19 | _world = world; 20 | } 21 | 22 | public override string GetTitle() 23 | { 24 | return _river.Name; 25 | } 26 | 27 | public override string Print() 28 | { 29 | Html = new StringBuilder(); 30 | 31 | Html.AppendLine("

" + _river.GetIcon() + " " + _river.Name + ", River


"); 32 | 33 | if (_river.Coordinates.Any()) 34 | { 35 | List maps = MapPanel.CreateBitmaps(_world, _river); 36 | 37 | Html.AppendLine(""); 38 | Html.AppendLine(""); 39 | Html.AppendLine(""); 40 | Html.AppendLine(""); 41 | Html.AppendLine("
" + MakeLink(BitmapToHtml(maps[0]), LinkOption.LoadMap) + "" + MakeLink(BitmapToHtml(maps[1]), LinkOption.LoadMap) + "

"); 42 | } 43 | 44 | PrintEventLog(_world, _river.Events, River.Filters, _river); 45 | 46 | return Html.ToString(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/EventCollections/Purge.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Events; 5 | using LegendsViewer.Legends.Parser; 6 | using LegendsViewer.Legends.WorldObjects; 7 | 8 | namespace LegendsViewer.Legends.EventCollections 9 | { 10 | public class Purge : EventCollection 11 | { 12 | public string Ordinal; 13 | public string Adjective { get; set; } 14 | public Site Site; 15 | 16 | public List Filters; 17 | 18 | public override List FilteredEvents 19 | { 20 | get { return AllEvents.Where(dwarfEvent => !Filters.Contains(dwarfEvent.Type)).ToList(); } 21 | } 22 | 23 | public Purge(List properties, World world) 24 | : base(properties, world) 25 | { 26 | foreach (Property property in properties) 27 | { 28 | switch (property.Name) 29 | { 30 | case "ordinal": Ordinal = String.Intern(property.Value); break; 31 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 32 | case "adjective": Adjective = property.Value; break; 33 | } 34 | } 35 | Site.AddEventCollection(this); 36 | } 37 | 38 | public override string ToLink(bool link = true, DwarfObject pov = null, WorldEvent worldEvent = null) 39 | { 40 | return "a "+(!string.IsNullOrWhiteSpace(Adjective) ? Adjective.ToLower()+" " : "")+"purge"; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/EntityRampagedInSite.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class EntityRampagedInSite : WorldEvent 9 | { 10 | public Entity RampageCiv { get; set; } 11 | public Site Site { get; set; } 12 | 13 | public EntityRampagedInSite(List properties, World world) 14 | : base(properties, world) 15 | { 16 | foreach (Property property in properties) 17 | { 18 | switch (property.Name) 19 | { 20 | case "rampage_civ_id": RampageCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; 21 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 22 | } 23 | } 24 | 25 | RampageCiv.AddEvent(this); 26 | Site.AddEvent(this); 27 | } 28 | 29 | public override string Print(bool link = true, DwarfObject pov = null) 30 | { 31 | string eventString = GetYearTime(); 32 | eventString += " the forces of "; 33 | eventString += RampageCiv?.ToLink(true, pov) ?? "an unknown civilization"; 34 | eventString += " rampaged throughout "; 35 | eventString += Site?.ToLink(true, pov) ?? "an unknown site"; 36 | eventString += PrintParentCollection(link, pov); 37 | eventString += "."; 38 | return eventString; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/WorldObjects/PoeticForm.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using LegendsViewer.Controls.HTML.Utilities; 3 | using LegendsViewer.Legends.Enums; 4 | using LegendsViewer.Legends.Events; 5 | using LegendsViewer.Legends.Parser; 6 | 7 | namespace LegendsViewer.Legends.WorldObjects 8 | { 9 | public class PoeticForm : ArtForm 10 | { 11 | public static string Icon = ""; 12 | 13 | public PoeticForm(List properties, World world) 14 | : base(properties, world) 15 | { 16 | FormType = FormType.Poetic; 17 | } 18 | 19 | public override string ToLink(bool link = true, DwarfObject pov = null, WorldEvent worldEvent = null) 20 | { 21 | if (link) 22 | { 23 | string title = "Poetic Form"; 24 | title += " "; 25 | title += "Events: " + Events.Count; 26 | 27 | string linkedString = ""; 28 | if (pov != this) 29 | { 30 | linkedString = Icon + "" + Name + ""; 31 | } 32 | else 33 | { 34 | linkedString = Icon + "" + HtmlStyleUtil.CurrentDwarfObject(Name) + ""; 35 | } 36 | return linkedString; 37 | } 38 | return Name; 39 | } 40 | 41 | public override string GetIcon() 42 | { 43 | return Icon; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /LegendsViewer/Controls/HTML/LandmassPrinter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Drawing; 3 | using System.Linq; 4 | using System.Text; 5 | using LegendsViewer.Controls.Map; 6 | using LegendsViewer.Legends; 7 | using LegendsViewer.Legends.WorldObjects; 8 | 9 | namespace LegendsViewer.Controls.HTML 10 | { 11 | public class LandmassPrinter : HtmlPrinter 12 | { 13 | Landmass _landmass; 14 | World _world; 15 | 16 | public LandmassPrinter(Landmass landmass, World world) 17 | { 18 | _landmass = landmass; 19 | _world = world; 20 | } 21 | 22 | public override string GetTitle() 23 | { 24 | return _landmass.Name; 25 | } 26 | 27 | public override string Print() 28 | { 29 | Html = new StringBuilder(); 30 | 31 | Html.AppendLine("

" + _landmass.GetIcon() + " " + _landmass.Name + ", Landmass


"); 32 | 33 | if (_landmass.Coordinates.Any()) 34 | { 35 | List maps = MapPanel.CreateBitmaps(_world, _landmass); 36 | 37 | Html.AppendLine(""); 38 | Html.AppendLine(""); 39 | Html.AppendLine(""); 40 | Html.AppendLine(""); 41 | Html.AppendLine("
" + MakeLink(BitmapToHtml(maps[0]), LinkOption.LoadMap) + "" + MakeLink(BitmapToHtml(maps[1]), LinkOption.LoadMap) + "

"); 42 | } 43 | 44 | PrintEventLog(_world, _landmass.Events, Landmass.Filters, _landmass); 45 | 46 | return Html.ToString(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/EntityAllianceFormed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class EntityAllianceFormed : WorldEvent 9 | { 10 | public Entity InitiatingEntity { get; set; } 11 | public Entity JoiningEntity { get; set; } 12 | 13 | public EntityAllianceFormed(List properties, World world) : base(properties, world) 14 | { 15 | foreach (Property property in properties) 16 | { 17 | switch (property.Name) 18 | { 19 | case "initiating_enid": InitiatingEntity = world.GetEntity(Convert.ToInt32(property.Value)); break; 20 | case "joining_enid": JoiningEntity = world.GetEntity(Convert.ToInt32(property.Value)); break; 21 | } 22 | } 23 | 24 | 25 | InitiatingEntity.AddEvent(this); 26 | JoiningEntity.AddEvent(this); 27 | } 28 | 29 | public override string Print(bool link = true, DwarfObject pov = null) 30 | { 31 | string eventString = GetYearTime(); 32 | eventString += JoiningEntity.ToLink(link, pov, this); 33 | eventString += " swore to support "; 34 | eventString += InitiatingEntity.ToLink(link, pov, this); 35 | eventString += " in war if the latter did likewise"; 36 | 37 | eventString += PrintParentCollection(link, pov); 38 | eventString += "."; 39 | return eventString; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/ImpersonateHF.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class ImpersonateHf : WorldEvent 9 | { 10 | public HistoricalFigure Trickster, Cover; 11 | public Entity Target; 12 | public ImpersonateHf(List properties, World world) 13 | : base(properties, world) 14 | { 15 | foreach (Property property in properties) 16 | { 17 | switch (property.Name) 18 | { 19 | case "trickster_hfid": Trickster = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; 20 | case "cover_hfid": Cover = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; 21 | case "target_enid": Target = world.GetEntity(Convert.ToInt32(property.Value)); break; 22 | } 23 | } 24 | 25 | Trickster.AddEvent(this); 26 | Cover.AddEvent(this); 27 | Target.AddEvent(this); 28 | } 29 | public override string Print(bool link = true, DwarfObject pov = null) 30 | { 31 | string eventString = GetYearTime() + Trickster.ToLink(link, pov, this) + " fooled " + Target.ToLink(link, pov, this) 32 | + " into believing he/she was a manifestation of the deity " + Cover.ToLink(link, pov, this); 33 | eventString += PrintParentCollection(link, pov); 34 | eventString += "."; 35 | return eventString; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Population.cs: -------------------------------------------------------------------------------- 1 | using LegendsViewer.Controls.Query.Attributes; 2 | 3 | namespace LegendsViewer.Legends 4 | { 5 | public class Population 6 | { 7 | public bool IsMainRace 8 | { 9 | get 10 | { 11 | return World.MainRaces.ContainsKey(Race); 12 | } 13 | } 14 | 15 | public bool IsOutcasts 16 | { 17 | get 18 | { 19 | return Race.NamePlural.Contains("Outcasts"); 20 | } 21 | } 22 | 23 | public bool IsPrisoners 24 | { 25 | get 26 | { 27 | return Race.NamePlural.Contains("Prisoners"); 28 | } 29 | } 30 | 31 | public bool IsSlaves 32 | { 33 | get 34 | { 35 | return Race.NamePlural.Contains("Slaves"); 36 | } 37 | } 38 | 39 | public bool IsVisitors 40 | { 41 | get 42 | { 43 | return Race.NamePlural.Contains("Visitors"); 44 | } 45 | } 46 | 47 | public bool IsAnimalPeople 48 | { 49 | get 50 | { 51 | return Race.NamePlural.Contains(" Men") && !IsSlaves && !IsPrisoners && !IsOutcasts && !IsVisitors; 52 | } 53 | } 54 | 55 | [AllowAdvancedSearch] 56 | public CreatureInfo Race { get; set; } 57 | [AllowAdvancedSearch] 58 | public int Count { get; set; } 59 | 60 | public Population(CreatureInfo type, int count) 61 | { 62 | Race = type; 63 | Count = count; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /LegendsViewer.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LegendsViewer", "LegendsViewer\LegendsViewer.csproj", "{010B16A9-DE79-4047-80EF-13F3FA12B147}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|Mixed Platforms = Debug|Mixed Platforms 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|Mixed Platforms = Release|Mixed Platforms 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {010B16A9-DE79-4047-80EF-13F3FA12B147}.Debug|Any CPU.ActiveCfg = Debug|x86 19 | {010B16A9-DE79-4047-80EF-13F3FA12B147}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 20 | {010B16A9-DE79-4047-80EF-13F3FA12B147}.Debug|Mixed Platforms.Build.0 = Debug|x86 21 | {010B16A9-DE79-4047-80EF-13F3FA12B147}.Debug|x86.ActiveCfg = Debug|x86 22 | {010B16A9-DE79-4047-80EF-13F3FA12B147}.Debug|x86.Build.0 = Debug|x86 23 | {010B16A9-DE79-4047-80EF-13F3FA12B147}.Release|Any CPU.ActiveCfg = Release|x86 24 | {010B16A9-DE79-4047-80EF-13F3FA12B147}.Release|Mixed Platforms.ActiveCfg = Release|x86 25 | {010B16A9-DE79-4047-80EF-13F3FA12B147}.Release|Mixed Platforms.Build.0 = Release|x86 26 | {010B16A9-DE79-4047-80EF-13F3FA12B147}.Release|x86.ActiveCfg = Release|x86 27 | {010B16A9-DE79-4047-80EF-13F3FA12B147}.Release|x86.Build.0 = Release|x86 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/EntityPopulation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Controls.Query.Attributes; 5 | using LegendsViewer.Legends.Events; 6 | using LegendsViewer.Legends.Parser; 7 | using LegendsViewer.Legends.WorldObjects; 8 | 9 | namespace LegendsViewer.Legends 10 | { 11 | public class EntityPopulation : WorldObject 12 | { 13 | public CreatureInfo Race { get; set; } // legends_plus.xml 14 | public int Count { get; set; } // legends_plus.xml 15 | public int EntityId { get; set; } // legends_plus.xml 16 | public Entity Entity { get; set; } // legends_plus.xml 17 | public List Member { get; set; } 18 | 19 | public static List Filters; 20 | public override List FilteredEvents 21 | { 22 | get { return Events.Where(dwarfEvent => !Filters.Contains(dwarfEvent.Type)).ToList(); } 23 | } 24 | public EntityPopulation(List properties, World world) 25 | : base(properties, world) 26 | { 27 | EntityId = -1; 28 | foreach (Property property in properties) 29 | { 30 | switch (property.Name) 31 | { 32 | case "race": 33 | var raceCount = property.Value.Split(':'); 34 | Race = world.GetCreatureInfo(raceCount[0]); 35 | Count = Convert.ToInt32(raceCount[1]); 36 | break; 37 | case "civ_id": 38 | EntityId = property.ValueAsInt(); 39 | break; 40 | } 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/FirstContact.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class FirstContact : WorldEvent 9 | { 10 | public Site Site; 11 | public Entity Contactor; 12 | public Entity Contacted; 13 | public FirstContact(List properties, World world) 14 | : base(properties, world) 15 | { 16 | foreach (Property property in properties) 17 | { 18 | switch (property.Name) 19 | { 20 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 21 | case "contactor_enid": Contactor = world.GetEntity(Convert.ToInt32(property.Value)); break; 22 | case "contacted_enid": Contacted = world.GetEntity(Convert.ToInt32(property.Value)); break; 23 | } 24 | } 25 | Site.AddEvent(this); 26 | Contactor.AddEvent(this); 27 | Contacted.AddEvent(this); 28 | } 29 | public override string Print(bool link = true, DwarfObject pov = null) 30 | { 31 | string eventString = GetYearTime(); 32 | eventString += Contactor != null ? Contactor.ToLink(link, pov, this) : "UNKNOWN ENTITY"; 33 | eventString += " made contact with "; 34 | eventString += Contacted != null ? Contacted.ToLink(link, pov, this) : "UNKNOWN ENTITY"; 35 | eventString += " at "; 36 | eventString += Site != null ? Site.ToLink(link, pov, this) : "UNKNOWN SITE"; 37 | return eventString; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /LegendsViewer/Controls/HTML/RaidPrinter.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using LegendsViewer.Controls.Map; 3 | using LegendsViewer.Legends; 4 | using LegendsViewer.Legends.EventCollections; 5 | 6 | namespace LegendsViewer.Controls.HTML 7 | { 8 | public class RaidPrinter : HtmlPrinter 9 | { 10 | Raid _raid; 11 | World _world; 12 | 13 | public RaidPrinter(Raid raid, World world) 14 | { 15 | _raid = raid; 16 | _world = world; 17 | } 18 | 19 | public override string GetTitle() 20 | { 21 | return _raid.Name; 22 | } 23 | 24 | public override string Print() 25 | { 26 | Html = new StringBuilder(); 27 | 28 | Html.AppendLine("

" + _raid.GetIcon() + " " + _raid.Name + "


"); 29 | 30 | PrintMaps(); 31 | 32 | PrintEventLog(_world, _raid.GetSubEvents(), Raid.Filters, _raid); 33 | 34 | return Html.ToString(); 35 | } 36 | 37 | private void PrintMaps() 38 | { 39 | if (_raid.Site?.Coordinates == null) 40 | { 41 | return; 42 | } 43 | 44 | Html.AppendLine("
"); 45 | Html.AppendLine("
"); 46 | var maps = MapPanel.CreateBitmaps(_world, _raid.Site); 47 | Html.AppendLine(""); 48 | Html.AppendLine(""); 49 | Html.AppendLine(""); 50 | Html.AppendLine(""); 51 | Html.AppendLine("
" + MakeLink(BitmapToHtml(maps[0]), LinkOption.LoadMap) + "" + MakeLink(BitmapToHtml(maps[1]), LinkOption.LoadMap) + "

"); 52 | Html.AppendLine("
"); 53 | Html.AppendLine("
"); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /LegendsViewer/Controls/Chart/dlgHF.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Windows.Forms; 4 | using LegendsViewer.Legends; 5 | 6 | namespace LegendsViewer.Controls.Chart 7 | { 8 | public partial class DlgHf : Form 9 | { 10 | //List Populations = new List(); 11 | public string SelectedRace; 12 | public DlgHf(World world) 13 | { 14 | InitializeComponent(); 15 | 16 | var hfByRace = world.HistoricalFigures.GroupBy(hf => hf.Race).Select(hf => hf.Key).OrderBy(hf => hf); 17 | foreach (var race in hfByRace) 18 | { 19 | listHFRaces.Items.Add(race); 20 | } 21 | } 22 | 23 | 24 | private void btnAll_Click(object sender, EventArgs e) 25 | { 26 | for (int i = 0; i < listHFRaces.Items.Count; i++) 27 | { 28 | listHFRaces.SetSelected(i, true); 29 | } 30 | } 31 | 32 | private void btnNone_Click(object sender, EventArgs e) 33 | { 34 | for (int i = 0; i < listHFRaces.Items.Count; i++) 35 | { 36 | listHFRaces.SetSelected(i, false); 37 | } 38 | } 39 | 40 | private void btnName_Click(object sender, EventArgs e) 41 | { 42 | 43 | } 44 | 45 | private void btnNumber_Click(object sender, EventArgs e) 46 | { 47 | 48 | } 49 | 50 | private void btnAccept_Click(object sender, EventArgs e) 51 | { 52 | SelectedRace = listHFRaces.SelectedItem as string; 53 | Close(); 54 | } 55 | 56 | private void btnCancel_Click(object sender, EventArgs e) 57 | { 58 | SelectedRace = ""; 59 | Close(); 60 | } 61 | 62 | } 63 | 64 | 65 | 66 | } 67 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/EventCollections/Occasion.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Events; 5 | using LegendsViewer.Legends.Parser; 6 | using LegendsViewer.Legends.WorldObjects; 7 | 8 | namespace LegendsViewer.Legends.EventCollections 9 | { 10 | public class Occasion : EventCollection 11 | { 12 | public Entity Civ { get; set; } 13 | public string Ordinal { get; set; } 14 | public int OccasionId { get; set; } 15 | public EntityOccasion EntityOccasion { get; set; } 16 | 17 | public List Filters; 18 | public override List FilteredEvents 19 | { 20 | get { return AllEvents.Where(dwarfEvent => !Filters.Contains(dwarfEvent.Type)).ToList(); } 21 | } 22 | 23 | public Occasion(List properties, World world) 24 | : base(properties, world) 25 | { 26 | foreach (Property property in properties) 27 | { 28 | switch (property.Name) 29 | { 30 | case "civ_id": Civ = world.GetEntity(Convert.ToInt32(property.Value)); break; 31 | case "ordinal": Ordinal = string.Intern(property.Value); break; 32 | case "occasion_id": OccasionId = Convert.ToInt32(property.Value); break; 33 | } 34 | } 35 | if (Civ != null && Civ.Occassions.Any()) 36 | { 37 | EntityOccasion = Civ.Occassions.ElementAt(OccasionId); 38 | } 39 | Civ.AddEventCollection(this); 40 | } 41 | 42 | public override string ToLink(bool link = true, DwarfObject pov = null, WorldEvent worldEvent = null) 43 | { 44 | return "an occasion"; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /LegendsViewer/Controls/Tabs/BaseSearchTab.designer.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows.Forms; 3 | 4 | namespace LegendsViewer.Controls.Tabs 5 | { 6 | partial class BaseSearchTab 7 | { 8 | /// 9 | /// Required designer variable. 10 | /// 11 | private IContainer components = null; 12 | 13 | /// 14 | /// Clean up any resources being used. 15 | /// 16 | /// true if managed resources should be disposed; otherwise, false. 17 | protected override void Dispose(bool disposing) 18 | { 19 | if (disposing && (components != null)) 20 | { 21 | components.Dispose(); 22 | } 23 | base.Dispose(disposing); 24 | } 25 | 26 | #region Component Designer generated code 27 | 28 | /// 29 | /// Required method for Designer support - do not modify 30 | /// the contents of this method with the code editor. 31 | /// 32 | private void InitializeComponent() 33 | { 34 | this.components = new System.ComponentModel.Container(); 35 | this.hint = new System.Windows.Forms.ToolTip(this.components); 36 | this.SuspendLayout(); 37 | // 38 | // LVQueryBaseTab 39 | // 40 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 41 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 42 | this.Name = "LVQueryBaseTab"; 43 | this.Size = new System.Drawing.Size(269, 518); 44 | this.ResumeLayout(false); 45 | 46 | } 47 | 48 | #endregion 49 | 50 | protected internal ToolTip hint; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/EntitySearchedSite.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class EntitySearchedSite : WorldEvent 9 | { 10 | public Entity SearcherCiv { get; set; } 11 | public Site Site { get; set; } 12 | public string Result { get; set; } 13 | 14 | public EntitySearchedSite(List properties, World world) 15 | : base(properties, world) 16 | { 17 | foreach (Property property in properties) 18 | { 19 | switch (property.Name) 20 | { 21 | case "searcher_civ_id": SearcherCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; 22 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 23 | case "result": Result = property.Value; break; 24 | } 25 | } 26 | 27 | SearcherCiv.AddEvent(this); 28 | Site.AddEvent(this); 29 | } 30 | 31 | public override string Print(bool link = true, DwarfObject pov = null) 32 | { 33 | string eventString = GetYearTime(); 34 | eventString += " the forces of "; 35 | eventString += SearcherCiv?.ToLink(true, pov) ?? "an unknown civilization"; 36 | eventString += " searched "; 37 | eventString += Site?.ToLink(true, pov) ?? "an unknown site"; 38 | eventString += PrintParentCollection(link, pov); 39 | if (!string.IsNullOrEmpty(Result)) 40 | { 41 | eventString += " and " + Result; 42 | } 43 | eventString += "."; 44 | return eventString; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/RelationshipProfileHF.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Enums; 4 | using LegendsViewer.Legends.Parser; 5 | 6 | namespace LegendsViewer.Legends 7 | { 8 | public class RelationshipProfileHf 9 | { 10 | public int MeetCount { get; set; } 11 | public int LastMeetYear { get; set; } 12 | public int LastMeetSeconds72 { get; set; } 13 | public int Id { get; set; } 14 | public int HistoricalFigureId { get; set; } 15 | public int KnownIdentityId { get; set; } // TODO find the purpose of this property 16 | public List Reputations { get; set; } 17 | public RelationShipProfileType Type { get; set; } 18 | 19 | public RelationshipProfileHf(List properties, RelationShipProfileType type) 20 | { 21 | Type = type; 22 | Reputations = new List(); 23 | foreach (Property property in properties) 24 | { 25 | switch (property.Name) 26 | { 27 | case "meet_count": MeetCount = Convert.ToInt32(property.Value); break; 28 | case "last_meet_year": LastMeetYear = Convert.ToInt32(property.Value); break; 29 | case "last_meet_seconds72": LastMeetSeconds72 = Convert.ToInt32(property.Value); break; 30 | case "id": Id = Convert.ToInt32(property.Value); break; 31 | case "hf_id": HistoricalFigureId = Convert.ToInt32(property.Value); break; 32 | case "known_identity_id": KnownIdentityId = Convert.ToInt32(property.Value); break; 33 | default: 34 | Reputations.Add(new Reputation(property)); 35 | break; 36 | } 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/CreatureInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using LegendsViewer.Controls.Query.Attributes; 3 | using LegendsViewer.Legends.Parser; 4 | 5 | namespace LegendsViewer.Legends 6 | { 7 | public class CreatureInfo 8 | { 9 | public static CreatureInfo Unknown { get; set; } 10 | public string Id { get; set; } 11 | 12 | [AllowAdvancedSearch("Name Singular")] 13 | [ShowInAdvancedSearchResults("Name Singular")] 14 | public string NameSingular { get; set; } 15 | [AllowAdvancedSearch("Name Plural")] 16 | public string NamePlural { get; set; } 17 | 18 | public CreatureInfo(List properties, World world) 19 | { 20 | foreach (Property property in properties) 21 | { 22 | switch (property.Name) 23 | { 24 | case "creature_id": Id = string.Intern(property.Value); break; 25 | case "name_singular": NameSingular = string.Intern(Formatting.FormatRace(property.Value)); break; 26 | case "name_plural": NamePlural = string.Intern(Formatting.FormatRace(property.Value)); break; 27 | // TODO read the other properties and use them 28 | default: 29 | property.Known = true; 30 | break; 31 | } 32 | } 33 | } 34 | 35 | public CreatureInfo(string identifier) 36 | { 37 | Id = identifier.ToLower(); 38 | NameSingular = string.Intern(Formatting.FormatRace(identifier)); 39 | NamePlural = string.Intern(Formatting.MakePopulationPlural(NameSingular)); 40 | } 41 | 42 | public override string ToString() 43 | { 44 | return NameSingular ?? NamePlural ?? string.Empty; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/ArtifactDestroyed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class ArtifactDestroyed : WorldEvent 9 | { 10 | public Artifact Artifact { get; set; } 11 | public Site Site { get; set; } 12 | public HistoricalFigure Destroyer { get; set; } 13 | 14 | public ArtifactDestroyed(List properties, World world) 15 | : base(properties, world) 16 | { 17 | foreach (Property property in properties) 18 | { 19 | switch (property.Name) 20 | { 21 | case "artifact_id": Artifact = world.GetArtifact(Convert.ToInt32(property.Value)); break; 22 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 23 | case "destroyer_enid": Destroyer = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; 24 | } 25 | } 26 | 27 | Site.AddEvent(this); 28 | Artifact.AddEvent(this); 29 | Destroyer.AddEvent(this); 30 | } 31 | 32 | public override string Print(bool link = true, DwarfObject pov = null) 33 | { 34 | string eventString = GetYearTime(); 35 | eventString += Artifact.ToLink(link, pov, this); 36 | eventString += " was destroyed"; 37 | if (Destroyer != null) 38 | { 39 | eventString += " by "; 40 | eventString += Destroyer.ToLink(link, pov, this); 41 | } 42 | eventString += " in "; 43 | eventString += Site.ToLink(link, pov, this); 44 | eventString += "."; 45 | return eventString; 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/HonorEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Parser; 5 | using LegendsViewer.Legends.WorldObjects; 6 | 7 | namespace LegendsViewer.Legends 8 | { 9 | public class HonorEntity 10 | { 11 | public int EntityId { get; } 12 | public List HonorIds { get; set; } 13 | public Entity Entity { get; set; } 14 | public List Honors { get; set; } 15 | public int Battles { get; set; } 16 | public int Kills { get; set; } 17 | 18 | public HonorEntity(List properties, World world) 19 | { 20 | HonorIds = new List(); 21 | Honors = new List(); 22 | foreach (Property property in properties) 23 | { 24 | switch (property.Name) 25 | { 26 | case "entity": EntityId = Convert.ToInt32(property.Value); break; 27 | case "battles": Battles = Convert.ToInt32(property.Value); break; 28 | case "kills": Kills = Convert.ToInt32(property.Value); break; 29 | case "honor_id": HonorIds.Add(Convert.ToInt32(property.Value)); break; 30 | } 31 | } 32 | } 33 | 34 | public void Resolve(World world, HistoricalFigure historicalFigure) 35 | { 36 | Entity = world.GetEntity(EntityId); 37 | if (Entity != null) 38 | { 39 | foreach (var honorId in HonorIds) 40 | { 41 | var honor = Entity.Honors.FirstOrDefault(h => h.Id == honorId); 42 | if (honor != null) 43 | { 44 | honor.HonoredHfs.Add(historicalFigure); 45 | Honors.Add(honor); 46 | } 47 | } 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/RazedStructure.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Parser; 5 | using LegendsViewer.Legends.WorldObjects; 6 | 7 | namespace LegendsViewer.Legends.Events 8 | { 9 | public class RazedStructure : WorldEvent 10 | { 11 | public Entity Entity { get; set; } 12 | public Site Site { get; set; } 13 | public int StructureId { get; set; } 14 | public Structure Structure { get; set; } 15 | 16 | public RazedStructure(List properties, World world) 17 | : base(properties, world) 18 | { 19 | foreach (Property property in properties) 20 | { 21 | switch (property.Name) 22 | { 23 | case "civ_id": Entity = world.GetEntity(Convert.ToInt32(property.Value)); break; 24 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 25 | case "structure_id": StructureId = Convert.ToInt32(property.Value); break; 26 | } 27 | } 28 | if (Site != null) 29 | { 30 | Structure = Site.Structures.FirstOrDefault(structure => structure.Id == StructureId); 31 | } 32 | 33 | Entity.AddEvent(this); 34 | Site.AddEvent(this); 35 | Structure.AddEvent(this); 36 | } 37 | 38 | public override string Print(bool link = true, DwarfObject pov = null) 39 | { 40 | string eventString = GetYearTime() + Entity.ToLink(link, pov, this) + " razed "; 41 | eventString += Structure != null ? Structure.ToLink(link, pov, this) : "UNKNOWN STRUCTURE"; 42 | eventString += " in " + Site.ToLink(link, pov, this); 43 | eventString += PrintParentCollection(link, pov); 44 | eventString += "."; 45 | return eventString; 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /LegendsViewer/Controls/HTML/Utilities/HTMLStyleUtil.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | 3 | namespace LegendsViewer.Controls.HTML.Utilities 4 | { 5 | public static class HtmlStyleUtil 6 | { 7 | public const string SymbolPopulation = ""; 8 | public const string SymbolSite = ""; 9 | public const string SymbolDead = ""; 10 | 11 | public static string CurrentDwarfObject(string name) 12 | { 13 | return "" + name + ""; 14 | } 15 | 16 | /// 17 | /// Creates color with corrected brightness. 18 | /// 19 | /// Color to correct. 20 | /// The brightness correction factor. Must be between -1 and 1. 21 | /// Negative values produce darker colors. 22 | /// 23 | /// Corrected structure. 24 | /// 25 | public static Color ChangeColorBrightness(Color color, float correctionFactor) 26 | { 27 | float red = color.R; 28 | float green = color.G; 29 | float blue = color.B; 30 | 31 | if (correctionFactor < 0) 32 | { 33 | correctionFactor = 1 + correctionFactor; 34 | red *= correctionFactor; 35 | green *= correctionFactor; 36 | blue *= correctionFactor; 37 | } 38 | else 39 | { 40 | red = (255 - red) * correctionFactor + red; 41 | green = (255 - green) * correctionFactor + green; 42 | blue = (255 - blue) * correctionFactor + blue; 43 | } 44 | 45 | return Color.FromArgb(color.A, (int)red, (int)green, (int)blue); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/EntityExpelsHF.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class EntityExpelsHf : WorldEvent 9 | { 10 | public Entity Entity { get; set; } 11 | public HistoricalFigure HistoricalFigure { get; set; } 12 | public Site Site { get; set; } 13 | 14 | public EntityExpelsHf(List properties, World world) 15 | : base(properties, world) 16 | { 17 | foreach (Property property in properties) 18 | { 19 | switch (property.Name) 20 | { 21 | case "entity_id": 22 | Entity = world.GetEntity(Convert.ToInt32(property.Value)); 23 | break; 24 | case "hfid": 25 | HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); 26 | break; 27 | case "site_id": 28 | Site = world.GetSite(Convert.ToInt32(property.Value)); 29 | break; 30 | } 31 | } 32 | 33 | Entity.AddEvent(this); 34 | HistoricalFigure.AddEvent(this); 35 | Site.AddEvent(this); 36 | } 37 | 38 | public override string Print(bool link = true, DwarfObject pov = null) 39 | { 40 | string eventString = GetYearTime(); 41 | eventString += Entity?.ToLink(true, pov) ?? "an unknown entity"; 42 | eventString += " expelled "; 43 | eventString += HistoricalFigure?.ToLink(true, pov) ?? "an unknown creature"; 44 | eventString += " from "; 45 | eventString += Site?.ToLink(true, pov) ?? "an unknown site"; 46 | eventString += PrintParentCollection(link, pov); 47 | eventString += "."; 48 | return eventString; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/ArtForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Controls.Query.Attributes; 5 | using LegendsViewer.Legends.Enums; 6 | using LegendsViewer.Legends.Events; 7 | using LegendsViewer.Legends.Parser; 8 | using LegendsViewer.Legends.WorldObjects; 9 | 10 | namespace LegendsViewer.Legends 11 | { 12 | public class ArtForm : WorldObject 13 | { 14 | public string Name { get; set; } // legends_plus.xml 15 | public string Description { get; set; } 16 | public FormType FormType { get; set; } 17 | public static List Filters; 18 | public override List FilteredEvents 19 | { 20 | get { return Events.Where(dwarfEvent => !Filters.Contains(dwarfEvent.Type)).ToList(); } 21 | } 22 | 23 | public ArtForm(List properties, World world) 24 | : base(properties, world) 25 | { 26 | foreach (Property property in properties) 27 | { 28 | switch (property.Name) 29 | { 30 | case "name": 31 | Name = Formatting.InitCaps(property.Value); 32 | break; 33 | case "description": 34 | var index = property.Value.IndexOf(" is a ", StringComparison.Ordinal); 35 | if (index != -1 && string.IsNullOrEmpty(Name)) 36 | { 37 | Name = property.Value.Substring(0, index); 38 | } 39 | Description = property.Value; 40 | break; 41 | } 42 | } 43 | if (string.IsNullOrEmpty(Name)) 44 | { 45 | Name = "Untitled"; 46 | } 47 | } 48 | 49 | public override string ToString() { return Name; } 50 | 51 | public override string ToLink(bool link = true, DwarfObject pov = null, WorldEvent worldEvent = null) { return Name; } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/DiplomatLost.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class DiplomatLost : WorldEvent 9 | { 10 | public Entity Entity { get; set; } 11 | public Entity InvolvedEntity { get; set; } 12 | public Site Site { get; set; } 13 | 14 | public DiplomatLost(List properties, World world) 15 | : base(properties, world) 16 | { 17 | foreach (Property property in properties) 18 | { 19 | switch (property.Name) 20 | { 21 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 22 | case "site": if (Site == null) { Site = world.GetSite(Convert.ToInt32(property.Value)); } else { property.Known = true; } break; 23 | case "entity": Entity = world.GetEntity(Convert.ToInt32(property.Value)); break; 24 | case "involved": InvolvedEntity = world.GetEntity(Convert.ToInt32(property.Value)); break; 25 | } 26 | } 27 | 28 | Site.AddEvent(this); 29 | Entity.AddEvent(this); 30 | InvolvedEntity.AddEvent(this); 31 | } 32 | public override string Print(bool link = true, DwarfObject pov = null) 33 | { 34 | string eventString = GetYearTime(); 35 | eventString += Entity != null ? Entity.ToLink(link, pov, this) : "UNKNOWN ENTITY"; 36 | eventString += " lost a diplomat at "; 37 | eventString += Site != null ? Site.ToLink(link, pov, this) : "UNKNOWN SITE"; 38 | eventString += ". They suspected the involvement of "; 39 | eventString += InvolvedEntity != null ? InvolvedEntity.ToLink(link, pov, this) : "UNKNOWN ENTITY"; 40 | eventString += PrintParentCollection(link, pov); 41 | eventString += "."; 42 | return eventString; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/Sabotage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class Sabotage : WorldEvent 9 | { 10 | public HistoricalFigure SaboteurHf { get; set; } 11 | public HistoricalFigure TargetHf { get; set; } 12 | public Site Site { get; set; } 13 | 14 | public Sabotage(List properties, World world) 15 | : base(properties, world) 16 | { 17 | foreach (Property property in properties) 18 | { 19 | switch (property.Name) 20 | { 21 | case "saboteur_hfid": 22 | SaboteurHf = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); 23 | break; 24 | case "target_hfid": 25 | TargetHf = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); 26 | break; 27 | case "site_id": 28 | Site = world.GetSite(Convert.ToInt32(property.Value)); 29 | break; 30 | } 31 | } 32 | 33 | SaboteurHf.AddEvent(this); 34 | TargetHf.AddEvent(this); 35 | Site.AddEvent(this); 36 | } 37 | 38 | public override string Print(bool link = true, DwarfObject pov = null) 39 | { 40 | string eventString = GetYearTime(); 41 | eventString += SaboteurHf.ToLink(link, pov, this); 42 | eventString += " sabotaged the activities of "; 43 | eventString += TargetHf.ToLink(link, pov, this); 44 | if (Site != null) 45 | { 46 | eventString += " at "; 47 | eventString += Site.ToLink(link, pov, this); 48 | } 49 | eventString += PrintParentCollection(link, pov); 50 | eventString += "."; 51 | return eventString; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /LegendsViewer/Controls/Query/DwarfQuery.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Linq.Expressions; 4 | 5 | namespace LegendsViewer.Controls.Query 6 | { 7 | public static class PredicateBuilder 8 | { 9 | public static Expression> True() 10 | { 11 | return f => true; 12 | } 13 | 14 | public static Expression> False() 15 | { 16 | return f => false; 17 | } 18 | 19 | public static Expression> Or(this Expression> expr1, 20 | Expression> expr2) 21 | { 22 | var invokedExpr = Expression.Invoke(expr2, expr1.Parameters.Cast()); 23 | return Expression.Lambda> 24 | (Expression.OrElse(expr1.Body, invokedExpr), expr1.Parameters); 25 | } 26 | 27 | public static Expression> And(this Expression> expr1, 28 | Expression> expr2) 29 | { 30 | var invokedExpr = Expression.Invoke(expr2, expr1.Parameters.Cast()); 31 | return Expression.Lambda> 32 | (Expression.AndAlso(expr1.Body, invokedExpr), expr1.Parameters); 33 | } 34 | } 35 | 36 | public enum QueryOperator 37 | { 38 | And = 0, 39 | Or = 1 40 | } 41 | 42 | public enum QueryComparer 43 | { 44 | Equals, 45 | StringEquals, 46 | NotEqual, 47 | StringNotEqual, 48 | StartsWith, 49 | NotStartsWith, 50 | EndsWith, 51 | NotEndsWith, 52 | Contains, 53 | NotContains, 54 | GreaterThan, 55 | LessThan, 56 | Count, 57 | Min, 58 | Max, 59 | Sum, 60 | Average, 61 | All, 62 | Is, 63 | IsNot, 64 | ListEquals, 65 | ListGreaterThan, 66 | ListLessThan, 67 | Property 68 | } 69 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/ArtifactStored.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class ArtifactStored : WorldEvent 9 | { 10 | public Artifact Artifact { get; set; } 11 | public int UnitId { get; set; } 12 | public HistoricalFigure HistoricalFigure { get; set; } 13 | public Site Site { get; set; } 14 | 15 | public ArtifactStored(List properties, World world) 16 | : base(properties, world) 17 | { 18 | foreach (Property property in properties) 19 | { 20 | switch (property.Name) 21 | { 22 | case "artifact_id": Artifact = world.GetArtifact(Convert.ToInt32(property.Value)); break; 23 | case "unit_id": UnitId = Convert.ToInt32(property.Value); break; 24 | case "hist_figure_id": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; 25 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 26 | } 27 | } 28 | 29 | Artifact.AddEvent(this); 30 | HistoricalFigure.AddEvent(this); 31 | Site.AddEvent(this); 32 | } 33 | 34 | public override string Print(bool link = true, DwarfObject pov = null) 35 | { 36 | string eventString = GetYearTime(); 37 | eventString += Artifact.ToLink(link, pov, this); 38 | eventString += " was stored"; 39 | if (HistoricalFigure != null) 40 | { 41 | eventString += " by "; 42 | eventString += HistoricalFigure.ToLink(link, pov, this); 43 | } 44 | eventString += " in "; 45 | eventString += Site.ToLink(link, pov, this); 46 | eventString += PrintParentCollection(link, pov); 47 | eventString += "."; 48 | return eventString; 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/IntrigueActor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | 5 | namespace LegendsViewer.Legends 6 | { 7 | public class IntrigueActor 8 | { 9 | public int LocalId { get; set; } 10 | public string Role { get; set; } 11 | public string Strategy { get; set; } 12 | public int EntityId { get; } 13 | public int HfId { get; set; } 14 | public int HandleActorId { get; set; } 15 | public int StrategyEnId { get; set; } 16 | public int StrategyEppId { get; set; } 17 | public bool PromisedActorImmortality { get; set; } 18 | public bool PromisedMeImmortality { get; set; } 19 | 20 | public IntrigueActor(List properties) 21 | { 22 | foreach (Property property in properties) 23 | { 24 | switch (property.Name) 25 | { 26 | case "local_id": LocalId = Convert.ToInt32(property.Value); break; 27 | case "entity_id": EntityId = Convert.ToInt32(property.Value); break; 28 | case "role": Role = property.Value; break; 29 | case "strategy": Strategy = property.Value; break; 30 | case "hfid": HfId = Convert.ToInt32(property.Value); break; 31 | case "handle_actor_id": HandleActorId = Convert.ToInt32(property.Value); break; 32 | case "strategy_enid": StrategyEnId = Convert.ToInt32(property.Value); break; 33 | case "strategy_eppid": StrategyEppId = Convert.ToInt32(property.Value); break; 34 | case "promised_actor_immortality": 35 | property.Known = true; 36 | PromisedActorImmortality = true; 37 | break; 38 | case "promised_me_immortality": 39 | property.Known = true; 40 | PromisedMeImmortality = true; 41 | break; 42 | } 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/PeaceEfforts.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class PeaceEfforts : WorldEvent 9 | { 10 | public string Decision { get; set; } 11 | public string Topic { get; set; } 12 | public Entity Source { get; set; } 13 | public Entity Destination { get; set; } 14 | public Site Site; 15 | public PeaceEfforts(List properties, World world) 16 | : base(properties, world) 17 | { 18 | foreach (Property property in properties) 19 | { 20 | switch (property.Name) 21 | { 22 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 23 | case "site": if (Site == null) { Site = world.GetSite(Convert.ToInt32(property.Value)); } else { property.Known = true; } break; 24 | case "topic": Topic = property.Value; break; 25 | case "source": Source = world.GetEntity(Convert.ToInt32(property.Value)); break; 26 | case "destination": Destination = world.GetEntity(Convert.ToInt32(property.Value)); break; 27 | } 28 | } 29 | 30 | Site.AddEvent(this); 31 | Source.AddEvent(this); 32 | Destination.AddEvent(this); 33 | } 34 | 35 | public override string Print(bool link = true, DwarfObject pov = null) 36 | { 37 | string eventString = GetYearTime(); 38 | if (Source != null && Destination != null) 39 | { 40 | eventString += Destination.ToLink(link, pov, this) + " " + Decision + " an offer of peace from " + Source.ToLink(link, pov, this) + " in " + ParentCollection.ToLink(link, pov, this) + "."; 41 | } 42 | else 43 | { 44 | eventString += "Peace " + Decision + " in " + ParentCollection.ToLink(link, pov, this) + "."; 45 | } 46 | return eventString; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/AddHfEntityHonor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Parser; 5 | using LegendsViewer.Legends.WorldObjects; 6 | 7 | namespace LegendsViewer.Legends.Events 8 | { 9 | public class AddHfEntityHonor : WorldEvent 10 | { 11 | public Entity Entity { get; set; } 12 | public HistoricalFigure HistoricalFigure { get; set; } 13 | public Honor Honor { get; set; } 14 | public int HonorId { get; set; } 15 | 16 | public AddHfEntityHonor(List properties, World world) : base(properties, world) 17 | { 18 | HonorId = -1; 19 | foreach (Property property in properties) 20 | { 21 | switch (property.Name) 22 | { 23 | case "entity_id": Entity = world.GetEntity(Convert.ToInt32(property.Value)); break; 24 | case "hfid": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; 25 | case "honor_id": HonorId = Convert.ToInt32(property.Value); break; 26 | } 27 | } 28 | 29 | if (HonorId >= 0) 30 | { 31 | Honor = Entity.Honors.FirstOrDefault(h => h.Id == HonorId); 32 | } 33 | Entity.AddEvent(this); 34 | HistoricalFigure.AddEvent(this); 35 | } 36 | 37 | public override string Print(bool link = true, DwarfObject pov = null) 38 | { 39 | string eventString = GetYearTime(); 40 | eventString += HistoricalFigure.ToLink(link, pov, this); 41 | eventString += $" received the title {Honor.Name} in "; 42 | eventString += Entity.ToLink(link, pov, this); 43 | string requirementsString = Honor.PrintRequirementsAsString(); 44 | if (!string.IsNullOrWhiteSpace(requirementsString)) 45 | { 46 | eventString += $" after {requirementsString}"; 47 | } 48 | eventString += PrintParentCollection(link, pov); 49 | eventString += "."; 50 | return eventString; 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # version format 2 | # {major_release}.{feature_release}.{minor_release}.{build} 3 | version: 1.20.08.{build} 4 | 5 | branches: 6 | only: 7 | - master 8 | - develop 9 | 10 | image: Visual Studio 2019 11 | 12 | before_build: 13 | - where msbuild 14 | - nuget restore 15 | 16 | build: 17 | project: LegendsViewer.sln # path to Visual Studio solution or project 18 | verbosity: minimal # quiet|minimal|normal|detailed 19 | 20 | 21 | # Operating system (build VM template) 22 | #os: Windows Server 2012 23 | 24 | # msbuild settings 25 | #platform: AnyCPU 26 | configuration: Release 27 | 28 | # to disable automatic tests 29 | #test: off 30 | 31 | # enable patching of AssemblyInfo.* files 32 | assembly_info: 33 | patch: true 34 | file: AssemblyInfo.* 35 | assembly_version: "{version}" 36 | assembly_file_version: "{version}" 37 | assembly_informational_version: "{version}" 38 | 39 | # to run auto tests 40 | #tests: 41 | 42 | ####################### 43 | # HOOKS 44 | 45 | # on successful build 46 | on_success: 47 | - ps: | 48 | $baseFolder = "$($env:APPVEYOR_BUILD_FOLDER)\LegendsViewer\bin\" 49 | $buildFolder = join-path $baseFolder "Release" 50 | $dropFolder = (New-Item -Path "$($baseFolder)\Output" -ItemType "directory").FullName 51 | Get-ChildItem "$($buildFolder)\*.exe", "$($buildFolder)\*.dll" | Copy-Item -Destination "$($dropFolder)" 52 | Copy-Item "$($buildFolder)\WebContent" "$($dropFolder)\WebContent" -Recurse 53 | $deploymentName = "$($env:APPVEYOR_BUILD_VERSION) $($env:APPVEYOR_REPO_BRANCH)" 54 | $releaseVersion = ($env:APPVEYOR_BUILD_VERSION).Replace($env:APPVEYOR_BUILD_NUMBER, "").Trim(".") 55 | $zipName = "LegendsViewer-$($releaseVersion).zip" 56 | [Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem"); 57 | [System.IO.Compression.ZipFile]::CreateFromDirectory("$($dropFolder)", "$($baseFolder)\$zipName", [System.IO.Compression.CompressionLevel]::Optimal, $false); 58 | Push-AppveyorArtifact "$($baseFolder)\$zipName" -FileName $zipName -DeploymentName $deploymentName 59 | 60 | 61 | ####################### 62 | 63 | # to disable deployment 64 | deploy: off 65 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/KnowledgeDiscovered.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class KnowledgeDiscovered : WorldEvent 9 | { 10 | public string[] Knowledge { get; set; } 11 | public bool First { get; set; } 12 | public HistoricalFigure HistoricalFigure { get; set; } 13 | 14 | public KnowledgeDiscovered(List properties, World world) : base(properties, world) 15 | { 16 | foreach (Property property in properties) 17 | { 18 | switch (property.Name) 19 | { 20 | case "hfid": 21 | HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); 22 | break; 23 | case "knowledge": 24 | Knowledge = property.Value.Split(':'); 25 | break; 26 | case "first": 27 | First = true; 28 | property.Known = true; 29 | break; 30 | } 31 | } 32 | 33 | HistoricalFigure.AddEvent(this); 34 | } 35 | 36 | public override string Print(bool link = true, DwarfObject pov = null) 37 | { 38 | string eventString = GetYearTime(); 39 | eventString += HistoricalFigure.ToLink(link, pov, this); 40 | if (First) 41 | { 42 | eventString += " was the first to discover "; 43 | } 44 | else 45 | { 46 | eventString += " independently discovered "; 47 | } 48 | if (Knowledge.Length > 1) 49 | { 50 | eventString += " the " + Knowledge[1]; 51 | if (Knowledge.Length > 2) 52 | { 53 | eventString += " (" + Knowledge[2] + ")"; 54 | } 55 | eventString += " in the field of " + Knowledge[0] + "."; 56 | } 57 | return eventString; 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/EntityEntityLink.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using LegendsViewer.Legends.Parser; 5 | using LegendsViewer.Legends.WorldObjects; 6 | 7 | namespace LegendsViewer.Legends 8 | { 9 | public enum EntityEntityLinkType // legends_plus.xml 10 | { 11 | [Description("Subgroup")] 12 | Child, 13 | [Description("Parentgroup")] 14 | Parent, 15 | Religious, 16 | Unknown 17 | } 18 | 19 | public class EntityEntityLink // legends_plus.xml 20 | { 21 | public EntityEntityLink(List properties, World world) 22 | { 23 | Type = EntityEntityLinkType.Unknown; 24 | foreach (Property property in properties) 25 | { 26 | switch (property.Name) 27 | { 28 | case "type": 29 | switch (property.Value) 30 | { 31 | case "CHILD": 32 | Type = EntityEntityLinkType.Child; 33 | break; 34 | case "PARENT": 35 | Type = EntityEntityLinkType.Parent; 36 | break; 37 | case "RELIGIOUS": 38 | Type = EntityEntityLinkType.Religious; 39 | break; 40 | default: 41 | world.ParsingErrors.Report("Unknown Entity Entity Link Type: " + property.Value); 42 | break; 43 | } 44 | break; 45 | case "target": 46 | Target = world.GetEntity(Convert.ToInt32(property.Value)); 47 | break; 48 | case "strength": 49 | Strength = Convert.ToInt32(property.Value); 50 | break; 51 | } 52 | } 53 | } 54 | 55 | public EntityEntityLinkType Type { get; set; } 56 | public Entity Target { get; set; } 57 | public int Strength { get; set; } 58 | } 59 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/SneakIntoSite.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class SneakIntoSite : WorldEvent 9 | { 10 | public Entity Attacker { get; set; } 11 | public Entity Defender { get; set; } 12 | public Entity SiteCiv { get; set; } 13 | public Site Site { get; set; } 14 | 15 | public SneakIntoSite(List properties, World world) 16 | : base(properties, world) 17 | { 18 | foreach (Property property in properties) 19 | { 20 | switch (property.Name) 21 | { 22 | case "attacker_civ_id": Attacker = world.GetEntity(Convert.ToInt32(property.Value)); break; 23 | case "defender_civ_id": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break; 24 | case "site_civ_id": SiteCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; 25 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 26 | } 27 | } 28 | 29 | Attacker.AddEvent(this); 30 | Defender.AddEvent(this); 31 | SiteCiv.AddEvent(this); 32 | Site.AddEvent(this); 33 | } 34 | 35 | public override string Print(bool link = true, DwarfObject pov = null) 36 | { 37 | string eventString = GetYearTime(); 38 | eventString += Attacker?.ToLink(true, pov) ?? "an unknown civilization"; 39 | eventString += " slipped into "; 40 | eventString += Site?.ToLink(true, pov) ?? "an unknown site"; 41 | if (SiteCiv != null) 42 | { 43 | eventString += " undetected by "; 44 | eventString += SiteCiv.ToLink(true, pov); 45 | eventString += " of "; 46 | eventString += Defender?.ToLink(true, pov) ?? "an unknown civilization"; 47 | } 48 | eventString += PrintParentCollection(link, pov); 49 | eventString += "."; 50 | return eventString; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/ModifiedBuilding.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Parser; 5 | using LegendsViewer.Legends.WorldObjects; 6 | 7 | namespace LegendsViewer.Legends.Events 8 | { 9 | public class ModifiedBuilding : WorldEvent 10 | { 11 | public HistoricalFigure ModifierHf { get; set; } 12 | public Site Site { get; set; } 13 | public int StructureId { get; set; } 14 | public Structure Structure { get; set; } 15 | public string Modification { get; set; } 16 | 17 | public ModifiedBuilding(List properties, World world) : base(properties, world) 18 | { 19 | foreach (Property property in properties) 20 | { 21 | switch (property.Name) 22 | { 23 | case "modifier_hfid": ModifierHf = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; 24 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 25 | case "structure_id": StructureId = Convert.ToInt32(property.Value); break; 26 | case "modification": Modification = property.Value; break; 27 | } 28 | } 29 | 30 | if (Site != null) 31 | { 32 | Structure = Site.Structures.FirstOrDefault(structure => structure.Id == StructureId); 33 | } 34 | ModifierHf.AddEvent(this); 35 | Site.AddEvent(this); 36 | Structure.AddEvent(this); 37 | } 38 | 39 | public override string Print(bool link = true, DwarfObject pov = null) 40 | { 41 | string eventString = GetYearTime(); 42 | eventString += ModifierHf.ToLink(link, pov, this); 43 | eventString += " had a "; 44 | eventString += Modification; 45 | eventString += " added to "; 46 | eventString += Structure.ToLink(link, pov, this); 47 | if (Site != null) 48 | { 49 | eventString += " in "; 50 | eventString += Site.ToLink(link, pov, this); 51 | } 52 | eventString += PrintParentCollection(link, pov); 53 | eventString += "."; 54 | return eventString; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /LegendsViewer/Controls/HTML/SiteConqueredPrinter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Drawing; 3 | using System.Text; 4 | using LegendsViewer.Controls.Map; 5 | using LegendsViewer.Legends; 6 | using LegendsViewer.Legends.EventCollections; 7 | 8 | namespace LegendsViewer.Controls.HTML 9 | { 10 | class SiteConqueredPrinter : HtmlPrinter 11 | { 12 | SiteConquered _conquering; 13 | World _world; 14 | 15 | public SiteConqueredPrinter(SiteConquered conquering, World world) 16 | { 17 | _conquering = conquering; 18 | _world = world; 19 | } 20 | 21 | public override string GetTitle() 22 | { 23 | return "The " + Formatting.AddOrdinal(_conquering.Ordinal) + " " + _conquering.ConquerType + " of " + _conquering.Site.ToLink(false); 24 | } 25 | 26 | public override string Print() 27 | { 28 | Html = new StringBuilder(); 29 | 30 | Html.AppendLine("

" + _conquering.GetIcon() + " " + GetTitle() + "


"); 31 | 32 | Html.AppendLine($"{_conquering.GetYearTime()}, the {Formatting.AddOrdinal(_conquering.Ordinal)} {_conquering.ConquerType} of {_conquering.Site.ToLink()} occurred as a result of {_conquering.Battle.ToLink()}{(_conquering.ParentCollection == null ? "" : " in " + _conquering.ParentCollection.ToLink() + " waged by " + (_conquering.ParentCollection as War).Attacker.PrintEntity() + " on " + (_conquering.ParentCollection as War).Defender.PrintEntity() )}.

"); 33 | 34 | List maps = MapPanel.CreateBitmaps(_world, _conquering); 35 | 36 | Html.AppendLine(""); 37 | Html.AppendLine(""); 38 | Html.AppendLine(""); 39 | Html.AppendLine(""); 40 | Html.AppendLine("
" + MakeLink(BitmapToHtml(maps[0]), LinkOption.LoadMap) + "" + MakeLink(BitmapToHtml(maps[1]), LinkOption.LoadMap) + "

"); 41 | 42 | Html.AppendLine("" + _conquering.Attacker.PrintEntity() + " (Attacker)
"); 43 | Html.AppendLine("" + _conquering.Defender.PrintEntity() + " (Defender)

"); 44 | 45 | PrintEventLog(_world, _conquering.GetSubEvents(), SiteConquered.Filters, _conquering); 46 | 47 | return Html.ToString(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/HFReunion.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class HfReunion : WorldEvent 9 | { 10 | public HistoricalFigure HistoricalFigure1, HistoricalFigure2; 11 | public Site Site; 12 | public WorldRegion Region; 13 | public UndergroundRegion UndergroundRegion; 14 | public HfReunion(List properties, World world) 15 | : base(properties, world) 16 | { 17 | foreach (Property property in properties) 18 | { 19 | switch (property.Name) 20 | { 21 | case "group_1_hfid": HistoricalFigure1 = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; 22 | case "group_2_hfid": HistoricalFigure2 = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; 23 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 24 | case "subregion_id": Region = world.GetRegion(Convert.ToInt32(property.Value)); break; 25 | case "feature_layer_id": UndergroundRegion = world.GetUndergroundRegion(Convert.ToInt32(property.Value)); break; 26 | } 27 | } 28 | 29 | HistoricalFigure1.AddEvent(this); 30 | HistoricalFigure2.AddEvent(this); 31 | Site.AddEvent(this); 32 | Region.AddEvent(this); 33 | UndergroundRegion.AddEvent(this); 34 | } 35 | public override string Print(bool link = true, DwarfObject pov = null) 36 | { 37 | string eventString = GetYearTime() + " " + HistoricalFigure1.ToLink(link, pov, this) + " was reunited with " + HistoricalFigure2.ToLink(link, pov, this); 38 | if (Site != null) 39 | { 40 | eventString += " in " + Site.ToLink(link, pov, this); 41 | } 42 | else if (Region != null) 43 | { 44 | eventString += " in " + Region.ToLink(link, pov, this); 45 | } 46 | 47 | eventString += PrintParentCollection(link, pov); 48 | eventString += "."; 49 | return eventString; 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/HistoricalFigureLink.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Controls.Query.Attributes; 4 | using LegendsViewer.Legends.Enums; 5 | using LegendsViewer.Legends.Parser; 6 | using LegendsViewer.Legends.WorldObjects; 7 | 8 | namespace LegendsViewer.Legends 9 | { 10 | public class HistoricalFigureLink 11 | { 12 | [AllowAdvancedSearch("Historical Figure")] 13 | public HistoricalFigure HistoricalFigure { get; set; } 14 | [AllowAdvancedSearch] 15 | public HistoricalFigureLinkType Type { get; set; } 16 | [AllowAdvancedSearch] 17 | public int Strength { get; set; } 18 | 19 | public HistoricalFigureLink(List properties, World world) 20 | { 21 | Strength = 0; 22 | foreach (Property property in properties) 23 | { 24 | switch (property.Name) 25 | { 26 | case "hfid": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; 27 | case "link_strength": Strength = Convert.ToInt32(property.Value); break; 28 | case "link_type": 29 | HistoricalFigureLinkType linkType; 30 | if (Enum.TryParse(Formatting.InitCaps(property.Value).Replace(" ", ""), out linkType)) 31 | { 32 | Type = linkType; 33 | } 34 | else 35 | { 36 | Type = HistoricalFigureLinkType.Unknown; 37 | world.ParsingErrors.Report("Unknown HF HF Link Type: " + property.Value); 38 | } 39 | break; 40 | } 41 | } 42 | 43 | //XML states that deity links, that should be 100, are 0. 44 | if (Type == HistoricalFigureLinkType.Deity && Strength == 0) 45 | { 46 | Strength = 100; 47 | } 48 | } 49 | 50 | public HistoricalFigureLink(HistoricalFigure historicalFigureTarget, HistoricalFigureLinkType type, int strength = 0) 51 | { 52 | HistoricalFigure = historicalFigureTarget; 53 | Type = type; 54 | Strength = strength; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/EventCollections/Persecution.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Events; 5 | using LegendsViewer.Legends.Parser; 6 | using LegendsViewer.Legends.WorldObjects; 7 | 8 | namespace LegendsViewer.Legends.EventCollections 9 | { 10 | public class Persecution : EventCollection 11 | { 12 | public string Ordinal; 13 | public Location Coordinates; 14 | 15 | public WorldRegion Region; 16 | public UndergroundRegion UndergroundRegion; 17 | public Site Site; 18 | public Entity TargetEntity; 19 | 20 | public List Filters; 21 | public override List FilteredEvents 22 | { 23 | get { return AllEvents.Where(dwarfEvent => !Filters.Contains(dwarfEvent.Type)).ToList(); } 24 | } 25 | public Persecution(List properties, World world) 26 | : base(properties, world) 27 | { 28 | foreach (Property property in properties) 29 | { 30 | switch (property.Name) 31 | { 32 | case "ordinal": Ordinal = String.Intern(property.Value); break; 33 | case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break; 34 | case "parent_eventcol": ParentCollection = world.GetEventCollection(Convert.ToInt32(property.Value)); break; 35 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 36 | case "subregion_id": Region = world.GetRegion(Convert.ToInt32(property.Value)); break; 37 | case "feature_layer_id": UndergroundRegion = world.GetUndergroundRegion(Convert.ToInt32(property.Value)); break; 38 | case "target_entity_id": TargetEntity = world.GetEntity(Convert.ToInt32(property.Value)); break; 39 | } 40 | } 41 | 42 | Region.AddEventCollection(this); 43 | UndergroundRegion.AddEventCollection(this); 44 | Site.AddEventCollection(this); 45 | TargetEntity.AddEventCollection(this); 46 | } 47 | public override string ToLink(bool link = true, DwarfObject pov = null, WorldEvent worldEvent = null) 48 | { 49 | return "a persecution"; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Enums/DeathCause.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace LegendsViewer.Legends.Enums 4 | { 5 | public enum DeathCause 6 | { 7 | Unknown, 8 | None, 9 | Struck, 10 | [Description("Old Age")] 11 | OldAge, 12 | Thirst, 13 | Suffocated, 14 | Bled, 15 | Cold, 16 | [Description("Crushed by a Bridge")] 17 | CrushedByABridge, 18 | Drowned, 19 | Starved, 20 | [Description("In a Cage")] 21 | InACage, 22 | Infection, 23 | [Description("Collided With an Obstacle")] 24 | CollidedWithAnObstacle, 25 | [Description("Put to Rest")] 26 | PutToRest, 27 | [Description("Starved on Quit")] 28 | StarvedQuit, 29 | Trap, 30 | [Description("Dragon's Fire")] 31 | DragonsFire, 32 | Burned, 33 | Murdered, 34 | Shot, 35 | [Description("Cave In")] 36 | CaveIn, 37 | [Description("Frozen in Water")] 38 | FrozenInWater, 39 | [Description("Executed - Generic")] 40 | ExecutedGeneric, 41 | [Description("Executed - Fed To Beasts")] 42 | ExecutedFedToBeasts, 43 | [Description("Executed - Burned Alive")] 44 | ExecutedBurnedAlive, 45 | [Description("Executed - Crucified")] 46 | ExecutedCrucified, 47 | [Description("Executed - Drowned")] 48 | ExecutedDrowned, 49 | [Description("Executed - Hacked To Pieces")] 50 | ExecutedHackedToPieces, 51 | [Description("Executed - Buried Alive")] 52 | ExecutedBuriedAlive, 53 | [Description("Executed - Beheaded")] 54 | ExecutedBeheaded, 55 | [Description("Drained of blood")] 56 | DrainedBlood, 57 | Collapsed, 58 | [Description("Scared to death")] 59 | ScaredToDeath, 60 | Scuttled, 61 | [Description("Killed by flying object")] 62 | FlyingObject, 63 | Slaughtered, 64 | Melted, 65 | Spikes, 66 | Heat, 67 | Vanish, 68 | [Description("Encased in cooling magma")] 69 | CoolingMagma, 70 | Vehicle, 71 | [Description("Suicide - Drowned")] 72 | SuicideDrowned, 73 | [Description("Suicide - Leaping")] 74 | SuicideLeaping, 75 | Chasm 76 | } 77 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/HfAttackedSite.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class HfAttackedSite : WorldEvent 9 | { 10 | public HistoricalFigure Attacker { get; set; } 11 | public Entity DefenderCiv { get; set; } 12 | public Entity SiteCiv { get; set; } 13 | public Site Site { get; set; } 14 | 15 | public HfAttackedSite(List properties, World world) : base(properties, world) 16 | { 17 | foreach (Property property in properties) 18 | { 19 | switch (property.Name) 20 | { 21 | case "attacker_hfid": 22 | Attacker = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); 23 | break; 24 | case "defender_civ_id": 25 | DefenderCiv = world.GetEntity(Convert.ToInt32(property.Value)); 26 | break; 27 | case "site_civ_id": 28 | SiteCiv = world.GetEntity(Convert.ToInt32(property.Value)); 29 | break; 30 | case "site_id": 31 | Site = world.GetSite(Convert.ToInt32(property.Value)); 32 | break; 33 | } 34 | } 35 | 36 | Attacker.AddEvent(this); 37 | DefenderCiv.AddEvent(this); 38 | if (SiteCiv != DefenderCiv) 39 | { 40 | SiteCiv.AddEvent(this); 41 | } 42 | Site.AddEvent(this); 43 | } 44 | 45 | public override string Print(bool link = true, DwarfObject pov = null) 46 | { 47 | string eventString = GetYearTime() + Attacker.ToLink(link, pov, this) + " attacked " + SiteCiv.ToLink(link, pov, this); 48 | if (DefenderCiv != null && DefenderCiv != SiteCiv) 49 | { 50 | eventString += " of " + DefenderCiv.ToLink(link, pov, this); 51 | } 52 | eventString += " at " + Site.ToLink(link, pov, this); 53 | eventString += PrintParentCollection(link, pov); 54 | eventString += "."; 55 | return eventString; 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/EventCollections/Insurrection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Events; 5 | using LegendsViewer.Legends.Parser; 6 | using LegendsViewer.Legends.WorldObjects; 7 | 8 | namespace LegendsViewer.Legends.EventCollections 9 | { 10 | class Insurrection : EventCollection 11 | { 12 | public String Name { get; set; } 13 | public Site Site { get; set; } 14 | public Entity TargetEntity { get; set; } 15 | public int Ordinal { get; set; } 16 | public List Filters; 17 | public override List FilteredEvents 18 | { 19 | get { return AllEvents.Where(dwarfEvent => !Filters.Contains(dwarfEvent.Type)).ToList(); } 20 | } 21 | 22 | public Insurrection(List properties, World world) 23 | : base(properties, world) 24 | { 25 | Filters = new List(); 26 | foreach (Property property in properties) 27 | { 28 | switch (property.Name) 29 | { 30 | case "site_id": 31 | Site = world.GetSite(Convert.ToInt32(property.Value)); 32 | break; 33 | case "target_enid": 34 | TargetEntity = world.GetEntity(Convert.ToInt32(property.Value)); 35 | break; 36 | case"ordinal": 37 | Ordinal = Convert.ToInt32(property.Value); 38 | break; 39 | } 40 | } 41 | 42 | Name = "The " + Formatting.AddOrdinal(Ordinal) + " Insurrection in " + Site; 43 | InsurrectionStarted insurrectionStart = Collection.OfType().FirstOrDefault(); 44 | if (insurrectionStart != null) 45 | { 46 | insurrectionStart.ActualStart = true; 47 | } 48 | TargetEntity.AddEventCollection(this); 49 | Site.AddEventCollection(this); 50 | } 51 | 52 | public override string ToLink(bool link = true, DwarfObject pov = null, WorldEvent worldEvent = null) 53 | { 54 | return Name; 55 | } 56 | 57 | public override string ToString() 58 | { 59 | return Name; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /LegendsViewer/Controls/HTML/BeastAttackPrinter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Text; 5 | using LegendsViewer.Controls.Map; 6 | using LegendsViewer.Legends; 7 | using LegendsViewer.Legends.EventCollections; 8 | 9 | namespace LegendsViewer.Controls.HTML 10 | { 11 | public class BeastAttackPrinter : HtmlPrinter 12 | { 13 | private readonly BeastAttack _attack; 14 | private readonly World _world; 15 | 16 | public BeastAttackPrinter(BeastAttack attack, World world) 17 | { 18 | _attack = attack; 19 | _world = world; 20 | } 21 | 22 | public override string GetTitle() 23 | { 24 | string beastName; 25 | if (_attack.Beast != null) 26 | { 27 | var spaceIndex = _attack.Beast.Name.IndexOf(" ", StringComparison.Ordinal); 28 | beastName = spaceIndex > 0 ? _attack.Beast.Name.Substring(0, spaceIndex) : _attack.Beast.Name; 29 | } 30 | else 31 | { 32 | beastName = "an unknown creature"; 33 | } 34 | 35 | return "Rampage of " + beastName; 36 | } 37 | 38 | public override string Print() 39 | { 40 | Html = new StringBuilder(); 41 | 42 | Html.AppendLine("

" + _attack.GetIcon() + " " + GetTitle() + "


"); 43 | 44 | string beastName = "an unknown creature"; 45 | if (_attack.Beast != null) 46 | { 47 | beastName = _attack.Beast.ToLink(); 48 | } 49 | 50 | Html.AppendLine("The " + Formatting.AddOrdinal(_attack.Ordinal) + " Rampage of " + beastName + " in " + _attack.Site.ToLink() + ".

"); 51 | 52 | List maps = MapPanel.CreateBitmaps(_world, _attack.Site); 53 | Html.AppendLine(""); 54 | Html.AppendLine(""); 55 | Html.AppendLine(""); 56 | Html.AppendLine(""); 57 | Html.AppendLine("
" + MakeLink(BitmapToHtml(maps[0]), LinkOption.LoadMap) + "" + MakeLink(BitmapToHtml(maps[1]), LinkOption.LoadMap) + "

"); 58 | 59 | PrintEventLog(_world, _attack.GetSubEvents(), BeastAttack.Filters, _attack); 60 | 61 | return Html.ToString(); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/EventCollections/EntityOverthrownCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Events; 5 | using LegendsViewer.Legends.Parser; 6 | using LegendsViewer.Legends.WorldObjects; 7 | 8 | namespace LegendsViewer.Legends.EventCollections 9 | { 10 | public class EntityOverthrownCollection : EventCollection 11 | { 12 | public string Ordinal; 13 | public Location Coordinates; 14 | 15 | public WorldRegion Region; 16 | public UndergroundRegion UndergroundRegion; 17 | public Site Site; 18 | public Entity TargetEntity; 19 | 20 | public List Filters; 21 | public override List FilteredEvents 22 | { 23 | get { return AllEvents.Where(dwarfEvent => !Filters.Contains(dwarfEvent.Type)).ToList(); } 24 | } 25 | public EntityOverthrownCollection(List properties, World world) 26 | : base(properties, world) 27 | { 28 | foreach (Property property in properties) 29 | { 30 | switch (property.Name) 31 | { 32 | case "ordinal": Ordinal = String.Intern(property.Value); break; 33 | case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break; 34 | case "parent_eventcol": ParentCollection = world.GetEventCollection(Convert.ToInt32(property.Value)); break; 35 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 36 | case "subregion_id": Region = world.GetRegion(Convert.ToInt32(property.Value)); break; 37 | case "feature_layer_id": UndergroundRegion = world.GetUndergroundRegion(Convert.ToInt32(property.Value)); break; 38 | case "target_entity_id": TargetEntity = world.GetEntity(Convert.ToInt32(property.Value)); break; 39 | } 40 | } 41 | 42 | Region.AddEventCollection(this); 43 | UndergroundRegion.AddEventCollection(this); 44 | Site.AddEventCollection(this); 45 | TargetEntity.AddEventCollection(this); 46 | } 47 | public override string ToLink(bool link = true, DwarfObject pov = null, WorldEvent worldEvent = null) 48 | { 49 | return "a coup"; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/SiteAbandoned.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Parser; 5 | using LegendsViewer.Legends.WorldObjects; 6 | 7 | namespace LegendsViewer.Legends.Events 8 | { 9 | public class SiteAbandoned : WorldEvent 10 | { 11 | public Entity Civ, SiteEntity; 12 | public Site Site; 13 | public SiteAbandoned(List properties, World world) 14 | : base(properties, world) 15 | { 16 | foreach (Property property in properties) 17 | { 18 | switch (property.Name) 19 | { 20 | case "civ_id": Civ = world.GetEntity(Convert.ToInt32(property.Value)); break; 21 | case "site_civ_id": SiteEntity = world.GetEntity(Convert.ToInt32(property.Value)); break; 22 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 23 | } 24 | } 25 | 26 | Site.OwnerHistory.Last().EndYear = Year; 27 | Site.OwnerHistory.Last().EndCause = "abandoned"; 28 | if (SiteEntity != null) 29 | { 30 | SiteEntity.SiteHistory.Last(s => s.Site == Site).EndYear = Year; 31 | SiteEntity.SiteHistory.Last(s => s.Site == Site).EndCause = "abandoned"; 32 | } 33 | Civ.SiteHistory.Last(s => s.Site == Site).EndYear = Year; 34 | Civ.SiteHistory.Last(s => s.Site == Site).EndCause = "abandoned"; 35 | 36 | Civ.AddEvent(this); 37 | SiteEntity.AddEvent(this); 38 | Site.AddEvent(this); 39 | 40 | world.AddPlayerRelatedDwarfObjects(SiteEntity); 41 | world.AddPlayerRelatedDwarfObjects(Site); 42 | } 43 | public override string Print(bool link = true, DwarfObject pov = null) 44 | { 45 | string eventString = GetYearTime(); 46 | if (SiteEntity != null && SiteEntity != Civ) 47 | { 48 | eventString += SiteEntity.ToLink(link, pov, this) + " of "; 49 | } 50 | 51 | eventString += Civ.ToLink(link, pov, this) + " abandoned the settlement at " + Site.ToLink(link, pov, this); 52 | eventString += PrintParentCollection(link, pov); 53 | eventString += "."; 54 | return eventString; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Misc.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using LegendsViewer.Legends.EventCollections; 3 | using LegendsViewer.Legends.Events; 4 | 5 | namespace LegendsViewer.Legends 6 | { 7 | public static class Misc 8 | { 9 | public static void AddEvent(this WorldObject worldObject, WorldEvent worldEvent) 10 | { 11 | if (worldObject == null ||worldEvent == null) 12 | { 13 | return; 14 | } 15 | #if DEBUG 16 | if (!worldObject.Events.Contains(worldEvent)) 17 | { 18 | #endif 19 | worldObject.Events.Add(worldEvent); 20 | #if DEBUG 21 | } 22 | else 23 | { 24 | worldEvent.World.ParsingErrors.Report($"Already added event {worldEvent.Id} '{worldEvent.Type}' to object {worldObject.Id} '{worldObject.GetType()}'"); 25 | } 26 | #endif 27 | } 28 | 29 | public static void AddEventCollection(this WorldObject worldObject, EventCollection eventCollection) 30 | { 31 | if (worldObject == null || eventCollection == null) 32 | { 33 | return; 34 | } 35 | #if DEBUG 36 | if (!worldObject.EventCollectons.Contains(eventCollection)) 37 | { 38 | #endif 39 | worldObject.EventCollectons.Add(eventCollection); 40 | #if DEBUG 41 | } 42 | else 43 | { 44 | eventCollection.World.ParsingErrors.Report($"Already added eventCollection {eventCollection.Id} '{eventCollection.Type}' to object {worldObject.Id} '{worldObject.GetType()}'"); 45 | } 46 | #endif 47 | } 48 | 49 | public static T GetWorldObject(this List list, int id) where T : WorldObject 50 | { 51 | int min = 0; 52 | int max = list.Count - 1; 53 | while (min <= max) 54 | { 55 | int mid = min + (max - min) / 2; 56 | if (id > list[mid].Id) 57 | { 58 | min = mid + 1; 59 | } 60 | else if (id < list[mid].Id) 61 | { 62 | max = mid - 1; 63 | } 64 | else 65 | { 66 | return list[mid]; 67 | } 68 | } 69 | return null; 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/HFGainsSecretGoal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Enums; 4 | using LegendsViewer.Legends.Parser; 5 | using LegendsViewer.Legends.WorldObjects; 6 | 7 | namespace LegendsViewer.Legends.Events 8 | { 9 | public class HfGainsSecretGoal : WorldEvent 10 | { 11 | public HistoricalFigure HistoricalFigure { get; set; } 12 | public SecretGoal Goal { get; set; } 13 | private string _unknownGoal; 14 | 15 | public HfGainsSecretGoal(List properties, World world) 16 | : base(properties, world) 17 | { 18 | foreach (Property property in properties) 19 | { 20 | switch (property.Name) 21 | { 22 | case "hfid": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; 23 | case "secret_goal": 24 | switch (property.Value) 25 | { 26 | case "immortality": Goal = SecretGoal.Immortality; break; 27 | default: 28 | Goal = SecretGoal.Unknown; 29 | _unknownGoal = property.Value; 30 | world.ParsingErrors.Report("Unknown Secret Goal: " + _unknownGoal); 31 | break; 32 | } 33 | break; 34 | } 35 | } 36 | 37 | HistoricalFigure.AddEvent(this); 38 | } 39 | 40 | public override string Print(bool link = true, DwarfObject pov = null) 41 | { 42 | string eventString = GetYearTime() + HistoricalFigure.ToLink(link, pov, this); 43 | string goalString = ""; 44 | switch (Goal) 45 | { 46 | case SecretGoal.Immortality: goalString = " became obsessed with " + HistoricalFigure.CasteNoun(true) + " own mortality and sought to extend " + HistoricalFigure.CasteNoun(true) + " life by any means"; break; 47 | case SecretGoal.Unknown: goalString = " gained secret goal (" + _unknownGoal + ")"; break; 48 | } 49 | eventString += goalString; 50 | eventString += PrintParentCollection(link, pov); 51 | eventString += "."; 52 | return eventString; 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Skill.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Controls.HTML.Utilities; 4 | using LegendsViewer.Controls.Query.Attributes; 5 | using LegendsViewer.Legends.Parser; 6 | 7 | namespace LegendsViewer.Legends 8 | { 9 | public class Skill 10 | { 11 | private static readonly int[] PointCutoffs = { 29000, 26600, 24300, 22100, 20000, 18000, 16100, 14300, 12600, 11000, 9500, 8100, 12 | 6800, 5600, 4500, 3500, 2600, 1800, 1100, 500, 1 }; 13 | private static readonly string[] Titles = { 14 | "Legendary+5", "Legendary+4", "Legendary+3", "Legendary+2", "Legendary+1", "Legendary", 15 | "Grand Master", "High Master", "Master", "Great", "Accomplished", "Professional", 16 | "Expert", "Adept", "Talented", "Proficient", "Skilled", "Competent", "Adequate", "Novice", "Dabbling" }; 17 | 18 | [AllowAdvancedSearch] 19 | public string Name { get; set; } 20 | [AllowAdvancedSearch] 21 | public int Points { get; set; } 22 | 23 | [AllowAdvancedSearch] 24 | public string Rank 25 | { 26 | get 27 | { 28 | for (var i = 0; i < PointCutoffs.Length; i++) 29 | { 30 | if (Points >= PointCutoffs[i]) 31 | { 32 | return Titles[i]; 33 | } 34 | } 35 | return "Unknown"; 36 | } 37 | } 38 | public Skill(List properties) 39 | { 40 | foreach (Property property in properties) 41 | { 42 | switch (property.Name) 43 | { 44 | case "skill": 45 | Name = Formatting.InitCaps(property.Value); 46 | if (!SkillDictionary.IsKnownSkill(this)) 47 | { 48 | property.Known = false; 49 | } 50 | break; 51 | case "total_ip": 52 | Points = Convert.ToInt32(property.Value); 53 | break; 54 | } 55 | } 56 | } 57 | 58 | public Skill(string skillName, int totalIp) 59 | { 60 | Name = Formatting.InitCaps(skillName); 61 | Points = totalIp; 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/SiteSurrendered.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class SiteSurrendered : WorldEvent 9 | { 10 | public Entity Attacker { get; set; } 11 | public Entity Defender { get; set; } 12 | public Entity SiteEntity { get; set; } 13 | public Site Site { get; set; } 14 | 15 | public SiteSurrendered(List properties, World world) : base(properties, world) 16 | { 17 | foreach (Property property in properties) 18 | { 19 | switch (property.Name) 20 | { 21 | case "attacker_civ_id": 22 | Attacker = world.GetEntity(Convert.ToInt32(property.Value)); 23 | break; 24 | case "defender_civ_id": 25 | Defender = world.GetEntity(Convert.ToInt32(property.Value)); 26 | break; 27 | case "site_civ_id": 28 | SiteEntity = world.GetEntity(Convert.ToInt32(property.Value)); 29 | break; 30 | case "site_id": 31 | Site = world.GetSite(Convert.ToInt32(property.Value)); 32 | break; 33 | } 34 | } 35 | 36 | Attacker.AddEvent(this); 37 | Defender.AddEvent(this); 38 | if (SiteEntity != Defender) 39 | { 40 | SiteEntity.AddEvent(this); 41 | } 42 | Site.AddEvent(this); 43 | } 44 | 45 | public override string Print(bool link = true, DwarfObject pov = null) 46 | { 47 | string eventString = GetYearTime(); 48 | eventString += SiteEntity?.ToLink(link, pov, this); 49 | eventString += " of "; 50 | eventString += Defender?.ToLink(link, pov, this); 51 | eventString += " surrendered "; 52 | eventString += Site?.ToLink(link, pov, this); 53 | eventString += " to "; 54 | eventString += Attacker?.ToLink(link, pov, this); 55 | eventString += "."; 56 | eventString += PrintParentCollection(link, pov); 57 | eventString += "."; 58 | return eventString; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/IntriguePlot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | 5 | namespace LegendsViewer.Legends 6 | { 7 | public class IntriguePlot 8 | { 9 | public int LocalId { get; set; } 10 | public string Type { get; set; } 11 | public int EntityId { get; } 12 | public bool OnHold { get; set; } 13 | public int ArtifactId { get; set; } 14 | public int ActorId { get; set; } 15 | public int ParentPlotId { get; set; } 16 | public int ParentPlotHfId { get; set; } 17 | public int DelegatedPlotId { get; set; } 18 | public int DelegatedPlotHfId { get; set; } 19 | public List PlotActors { get; set; } 20 | 21 | public IntriguePlot(List properties) 22 | { 23 | PlotActors = new List(); 24 | 25 | foreach (Property property in properties) 26 | { 27 | switch (property.Name) 28 | { 29 | case "local_id": LocalId = Convert.ToInt32(property.Value); break; 30 | case "type": Type = property.Value; break; 31 | case "entity_id": EntityId = Convert.ToInt32(property.Value); break; 32 | case "artifact_id": ArtifactId = Convert.ToInt32(property.Value); break; 33 | case "actor_id": ActorId = Convert.ToInt32(property.Value); break; 34 | case "parent_plot_id": ParentPlotId = Convert.ToInt32(property.Value); break; 35 | case "parent_plot_hfid": ParentPlotHfId = Convert.ToInt32(property.Value); break; 36 | case "delegated_plot_id": DelegatedPlotId = Convert.ToInt32(property.Value); break; 37 | case "delegated_plot_hfid": DelegatedPlotHfId = Convert.ToInt32(property.Value); break; 38 | case "on_hold": 39 | property.Known = true; 40 | OnHold = true; 41 | break; 42 | case "plot_actor": 43 | property.Known = true; 44 | if (property.SubProperties != null) 45 | { 46 | PlotActors.Add(new PlotActor(property.SubProperties)); 47 | } 48 | break; 49 | } 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/SpottedLeavingSite.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class SpottedLeavingSite : WorldEvent 9 | { 10 | public HistoricalFigure Spotter { get; set; } 11 | public Entity LeaverCiv { get; set; } 12 | public Entity SiteCiv { get; set; } 13 | public Site Site { get; set; } 14 | 15 | public SpottedLeavingSite(List properties, World world) 16 | : base(properties, world) 17 | { 18 | foreach (Property property in properties) 19 | { 20 | switch (property.Name) 21 | { 22 | case "spotter_hfid": Spotter = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; 23 | case "leaver_civ_id": LeaverCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; 24 | case "site_civ_id": SiteCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; 25 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 26 | } 27 | } 28 | 29 | Spotter.AddEvent(this); 30 | LeaverCiv.AddEvent(this); 31 | SiteCiv.AddEvent(this); 32 | Site.AddEvent(this); 33 | } 34 | 35 | public override string Print(bool link = true, DwarfObject pov = null) 36 | { 37 | string eventString = GetYearTime(); 38 | eventString += Spotter?.ToLink(true, pov) ?? "An unknown creature"; 39 | if (SiteCiv != null) 40 | { 41 | eventString += " of "; 42 | eventString += SiteCiv.ToLink(true, pov); 43 | } 44 | eventString += " spotted the forces"; 45 | if (LeaverCiv != null) 46 | { 47 | eventString += " of "; 48 | eventString += LeaverCiv.ToLink(true, pov); 49 | } 50 | eventString += " slipping out"; 51 | if (Site != null) 52 | { 53 | eventString += " of "; 54 | eventString += Site.ToLink(true, pov); 55 | } 56 | eventString += PrintParentCollection(link, pov); 57 | eventString += "."; 58 | return eventString; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/EntityDissolved.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Enums; 4 | using LegendsViewer.Legends.Parser; 5 | using LegendsViewer.Legends.WorldObjects; 6 | 7 | namespace LegendsViewer.Legends.Events 8 | { 9 | public class EntityDissolved : WorldEvent 10 | { 11 | public Entity Entity { get; set; } 12 | public DissolveReason Reason { get; set; } 13 | public string ReasonString { get; set; } 14 | 15 | 16 | public EntityDissolved(List properties, World world) : base(properties, world) 17 | { 18 | foreach (Property property in properties) 19 | { 20 | switch (property.Name) 21 | { 22 | case "entity_id": Entity = world.GetEntity(Convert.ToInt32(property.Value)); break; 23 | case "reason": 24 | ReasonString = property.Value; 25 | switch (property.Value) 26 | { 27 | case "heavy losses in battle": Reason = DissolveReason.HeavyLossesInBattle; break; 28 | case "lack of funds": Reason = DissolveReason.LackOfFunds; break; 29 | default: 30 | property.Known = false; 31 | break; 32 | } 33 | break; 34 | } 35 | } 36 | 37 | Entity.AddEvent(this); 38 | } 39 | 40 | public override string Print(bool link = true, DwarfObject pov = null) 41 | { 42 | string eventString = GetYearTime(); 43 | eventString += Entity.ToLink(link, pov, this); 44 | eventString += " dissolved"; 45 | switch (Reason) 46 | { 47 | case DissolveReason.HeavyLossesInBattle: 48 | eventString += " taking "; 49 | break; 50 | case DissolveReason.LackOfFunds: 51 | eventString += " due to "; 52 | break; 53 | default: 54 | eventString += " because of "; 55 | break; 56 | } 57 | eventString += ReasonString; 58 | 59 | eventString += PrintParentCollection(link, pov); 60 | eventString += "."; 61 | return eventString; 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/HFAbducted.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.EventCollections; 4 | using LegendsViewer.Legends.Parser; 5 | using LegendsViewer.Legends.WorldObjects; 6 | 7 | namespace LegendsViewer.Legends.Events 8 | { 9 | public class HfAbducted : WorldEvent 10 | { 11 | public HistoricalFigure Target { get; set; } 12 | public HistoricalFigure Snatcher { get; set; } 13 | public Site Site { get; set; } 14 | public WorldRegion Region { get; set; } 15 | public UndergroundRegion UndergroundRegion { get; set; } 16 | public HfAbducted(List properties, World world) 17 | : base(properties, world) 18 | { 19 | foreach (Property property in properties) 20 | { 21 | switch (property.Name) 22 | { 23 | case "target_hfid": Target = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; 24 | case "snatcher_hfid": Snatcher = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; 25 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 26 | case "subregion_id": Region = world.GetRegion(Convert.ToInt32(property.Value)); break; 27 | case "feature_layer_id": UndergroundRegion = world.GetUndergroundRegion(Convert.ToInt32(property.Value)); break; 28 | } 29 | } 30 | 31 | Target.AddEvent(this); 32 | Snatcher.AddEvent(this); 33 | Site.AddEvent(this); 34 | Region.AddEvent(this); 35 | UndergroundRegion.AddEvent(this); 36 | } 37 | public override string Print(bool link = true, DwarfObject pov = null) 38 | { 39 | string eventString = GetYearTime(); 40 | if (Snatcher != null) 41 | { 42 | eventString += Snatcher.ToLink(link, pov, this); 43 | } 44 | else 45 | { 46 | eventString += "UNKNOWN HISTORICAL FIGURE"; 47 | } 48 | 49 | eventString += " abducted " + Target.ToLink(link, pov, this) + " from " + Site.ToLink(link, pov, this); 50 | if (!(ParentCollection is Abduction)) 51 | { 52 | eventString += PrintParentCollection(link, pov); 53 | } 54 | eventString += "."; 55 | return eventString; 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/EntityBreachFeatureLayer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class EntityBreachFeatureLayer : WorldEvent 9 | { 10 | public Entity SiteEntity { get; set; } 11 | public Entity CivEntity { get; set; } 12 | public Site Site { get; set; } 13 | public UndergroundRegion UndergroundRegion { get; set; } 14 | 15 | // http://www.bay12games.com/dwarves/mantisbt/view.php?id=11335 16 | // 0011335: and of "entity breach feature layer" event point both to same entity 17 | public EntityBreachFeatureLayer(List properties, World world) : base(properties, world) 18 | { 19 | foreach (Property property in properties) 20 | { 21 | switch (property.Name) 22 | { 23 | case "site_entity_id": SiteEntity = world.GetEntity(Convert.ToInt32(property.Value)); break; 24 | case "civ_entity_id": CivEntity = world.GetEntity(Convert.ToInt32(property.Value)); break; 25 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 26 | case "feature_layer_id": UndergroundRegion = world.GetUndergroundRegion(Convert.ToInt32(property.Value)); break; 27 | } 28 | } 29 | 30 | if (SiteEntity != CivEntity) 31 | { 32 | SiteEntity.AddEvent(this); 33 | } 34 | CivEntity.AddEvent(this); 35 | Site.AddEvent(this); 36 | UndergroundRegion.AddEvent(this); 37 | } 38 | 39 | public override string Print(bool link = true, DwarfObject pov = null) 40 | { 41 | string eventString = GetYearTime(); 42 | eventString += SiteEntity.ToLink(link, pov, this); 43 | eventString += " of "; 44 | eventString += CivEntity.ToLink(link, pov, this); 45 | eventString += " breached "; 46 | eventString += UndergroundRegion.ToLink(link, pov, this); 47 | if (Site != null) 48 | { 49 | eventString += " at "; 50 | eventString += Site.ToLink(link, pov, this); 51 | } 52 | eventString += PrintParentCollection(link, pov); 53 | eventString += "."; 54 | return eventString; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Reference.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Enums; 4 | using LegendsViewer.Legends.Parser; 5 | 6 | namespace LegendsViewer.Legends 7 | { 8 | public class Reference 9 | { 10 | public int ID { get; set; } // legends_plus.xml 11 | public ReferenceType Type { get; set; } // legends_plus.xml 12 | 13 | public Reference(List properties, World world) 14 | { 15 | foreach (Property property in properties) 16 | { 17 | switch (property.Name) 18 | { 19 | case "id": ID = Convert.ToInt32(property.Value); break; 20 | case "type": 21 | switch (property.Value) 22 | { 23 | case "WRITTEN_CONTENT": Type = ReferenceType.WrittenContent; break; 24 | case "POETIC_FORM": Type = ReferenceType.PoeticForm; break; 25 | case "MUSICAL_FORM": Type = ReferenceType.MusicalForm; break; 26 | case "DANCE_FORM": Type = ReferenceType.DanceForm; break; 27 | case "VALUE_LEVEL": Type = ReferenceType.ValueLevel; break; 28 | case "KNOWLEDGE_SCHOLAR_FLAG": Type = ReferenceType.KnowledgeScholarFlag; break; 29 | case "SITE": Type = ReferenceType.Site; break; 30 | case "HISTORICAL_EVENT": Type = ReferenceType.HistoricalEvent; break; 31 | case "INTERACTION": Type = ReferenceType.Interaction; break; 32 | case "ENTITY": Type = ReferenceType.Entity; break; 33 | case "HISTORICAL_FIGURE": Type = ReferenceType.HistoricalFigure; break; 34 | case "LANGUAGE": Type = ReferenceType.Language; break; 35 | case "SUBREGION": Type = ReferenceType.Subregion; break; 36 | case "ABSTRACT_BUILDING": Type = ReferenceType.AbstractBuilding; break; 37 | case "ARTIFACT": Type = ReferenceType.Artifact; break; 38 | case "SPHERE": Type = ReferenceType.Sphere; break; 39 | default: 40 | property.Known = false; 41 | break; 42 | } 43 | break; 44 | } 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/EntityEquipmentPurchase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class EntityEquipmentPurchase : WorldEvent 9 | { 10 | public Entity Entity { get; set; } 11 | public HistoricalFigure HistoricalFigure { get; set; } 12 | public int Quality { get; set; } 13 | 14 | public EntityEquipmentPurchase(List properties, World world) : base(properties, world) 15 | { 16 | foreach (Property property in properties) 17 | { 18 | switch (property.Name) 19 | { 20 | case "entity_id": Entity = world.GetEntity(Convert.ToInt32(property.Value)); break; 21 | case "hfid": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; 22 | case "new_equipment_level": Quality = Convert.ToInt32(property.Value); break; 23 | } 24 | } 25 | 26 | Entity.AddEvent(this); 27 | HistoricalFigure.AddEvent(this); 28 | } 29 | 30 | public override string Print(bool link = true, DwarfObject pov = null) 31 | { 32 | string eventString = GetYearTime(); 33 | eventString += Entity.ToLink(link, pov, this); 34 | eventString += " purchased "; 35 | if (Quality == 1) 36 | { 37 | eventString += "well-crafted "; 38 | } 39 | else if (Quality == 2) 40 | { 41 | eventString += "finely-crafted "; 42 | } 43 | else if (Quality == 3) 44 | { 45 | eventString += "superior quality "; 46 | } 47 | else if (Quality == 4) 48 | { 49 | eventString += "exceptional "; 50 | } 51 | else if (Quality == 5) 52 | { 53 | eventString += "masterwork "; 54 | } 55 | eventString += "equipment"; 56 | if (HistoricalFigure != null) 57 | { 58 | eventString += ", which "; 59 | eventString += HistoricalFigure.ToLink(link, pov, this); 60 | eventString += " received"; 61 | } 62 | eventString += PrintParentCollection(link, pov); 63 | eventString += "."; 64 | return eventString; 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/SiteLink.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Controls.Query.Attributes; 4 | using LegendsViewer.Legends.Enums; 5 | using LegendsViewer.Legends.Parser; 6 | using LegendsViewer.Legends.WorldObjects; 7 | 8 | namespace LegendsViewer.Legends 9 | { 10 | public class SiteLink 11 | { 12 | [AllowAdvancedSearch] 13 | public Site Site { get; set; } 14 | [AllowAdvancedSearch] 15 | public SiteLinkType Type { get; set; } 16 | public int SubId { get; set; } 17 | public int OccupationId { get; set; } 18 | [AllowAdvancedSearch] 19 | public Entity Entity { get; set; } 20 | 21 | public SiteLink(List properties, World world) 22 | { 23 | foreach (Property property in properties) 24 | { 25 | switch (property.Name) 26 | { 27 | case "link_type": 28 | switch(property.Value) 29 | { 30 | case "lair": Type = SiteLinkType.Lair; break; 31 | case "hangout": Type = SiteLinkType.Hangout; break; 32 | case "home_site_building": Type = SiteLinkType.HomeSiteBuilding; break; 33 | case "home_site_underground": Type = SiteLinkType.HomeSiteUnderground; break; 34 | case "home_structure": Type = SiteLinkType.HomeStructure; break; 35 | case "seat_of_power": Type = SiteLinkType.SeatOfPower; break; 36 | case "occupation": Type = SiteLinkType.Occupation; break; 37 | default: 38 | property.Known = false; 39 | break; 40 | } 41 | break; 42 | case "site_id": 43 | Site = world.GetSite(Convert.ToInt32(property.Value)); 44 | break; 45 | case "sub_id": 46 | SubId = Convert.ToInt32(property.Value); 47 | break; 48 | case "entity_id": 49 | Entity = world.GetEntity(Convert.ToInt32(property.Value)); 50 | break; 51 | case "occupation_id": 52 | OccupationId = Convert.ToInt32(property.Value); 53 | break; 54 | } 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /LegendsViewer/Controls/Chart/ChartControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | using LegendsViewer.Legends; 6 | using LegendsViewer.Legends.WorldObjects; 7 | 8 | namespace LegendsViewer.Controls.Chart 9 | { 10 | public class ChartControl : PageControl, IDisposable 11 | { 12 | public ChartPanel DwarfChart; 13 | public DwarfObject FocusObject; 14 | public World World; 15 | public List SeriesOptions; 16 | public Boolean OtherChart; 17 | public ChartControl(World world, DwarfObject focusObject, DwarfTabControl dwarfTabControl) 18 | { 19 | World = world; FocusObject = focusObject; TabControl = dwarfTabControl; 20 | Title = "Chart"; 21 | if (FocusObject != null) 22 | { 23 | Title += " - " + FocusObject.ToLink(false, FocusObject); 24 | } 25 | } 26 | public override Control GetControl() 27 | { 28 | if (DwarfChart == null || DwarfChart.IsDisposed) 29 | { 30 | if (SeriesOptions != null) 31 | { 32 | DwarfChart = new ChartPanel(World, FocusObject, SeriesOptions) 33 | { 34 | OtherChart = OtherChart 35 | }; 36 | } 37 | else 38 | { 39 | DwarfChart = new ChartPanel(World, FocusObject); 40 | } 41 | } 42 | return DwarfChart; 43 | } 44 | 45 | public override void Refresh() 46 | { 47 | DwarfChart.RefreshFiltered(); 48 | //DwarfChart.RefreshAllSeries(); 49 | } 50 | 51 | protected override void Dispose(bool disposing) 52 | { 53 | if (!Disposed) 54 | { 55 | if (disposing) 56 | { 57 | if (DwarfChart != null) 58 | { 59 | SeriesOptions = 60 | DwarfChart.SeriesOptions.GroupBy(option => option).Select(option => option.Key).ToList(); 61 | OtherChart = DwarfChart.OtherChart; 62 | DwarfChart.Dispose(); 63 | DwarfChart = null; 64 | } 65 | } 66 | base.Dispose(disposing); 67 | Disposed = true; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/HFRazedStructure.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Parser; 5 | using LegendsViewer.Legends.WorldObjects; 6 | 7 | namespace LegendsViewer.Legends.Events 8 | { 9 | public class HfRazedStructure : WorldEvent 10 | { 11 | //public int Action { get; set; } // legends_plus.xml 12 | public HistoricalFigure HistoricalFigure { get; set; } 13 | public Site Site { get; set; } 14 | public int StructureId { get; set; } 15 | public Structure Structure { get; set; } 16 | 17 | public HfRazedStructure(List properties, World world) 18 | : base(properties, world) 19 | { 20 | foreach (Property property in properties) 21 | { 22 | switch (property.Name) 23 | { 24 | case "hist_fig_id": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; 25 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 26 | case "structure_id": StructureId = Convert.ToInt32(property.Value); break; 27 | case "structure": StructureId = Convert.ToInt32(property.Value); break; 28 | case "histfig": if (HistoricalFigure == null) { HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); } else { property.Known = true; } break; 29 | case "site": if (Site == null) { Site = world.GetSite(Convert.ToInt32(property.Value)); } else { property.Known = true; } break; 30 | //case "action": Action = Convert.ToInt32(property.Value); break; 31 | } 32 | } 33 | if (Site != null) 34 | { 35 | Structure = Site.Structures.FirstOrDefault(structure => structure.Id == StructureId); 36 | } 37 | HistoricalFigure.AddEvent(this); 38 | Site.AddEvent(this); 39 | Structure.AddEvent(this); 40 | } 41 | 42 | public override string Print(bool link = true, DwarfObject pov = null) 43 | { 44 | string eventString = GetYearTime() + HistoricalFigure.ToLink(link, pov, this) + " razed "; 45 | eventString += Structure != null ? Structure.ToLink(link, pov, this) : "UNKNOWN STRUCTURE"; 46 | eventString += " in " + Site.ToLink(link, pov, this); 47 | eventString += PrintParentCollection(link, pov); 48 | eventString += "."; 49 | return eventString; 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /LegendsViewer/Controls/HTML/MountainPeakPrinter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Drawing; 3 | using System.Linq; 4 | using System.Text; 5 | using LegendsViewer.Controls.Map; 6 | using LegendsViewer.Legends; 7 | using LegendsViewer.Legends.WorldObjects; 8 | 9 | namespace LegendsViewer.Controls.HTML 10 | { 11 | public class MountainPeakPrinter : HtmlPrinter 12 | { 13 | MountainPeak _mountainPeak; 14 | World _world; 15 | 16 | public MountainPeakPrinter(MountainPeak mountainPeak, World world) 17 | { 18 | _mountainPeak = mountainPeak; 19 | _world = world; 20 | } 21 | 22 | public override string GetTitle() 23 | { 24 | return _mountainPeak.Name; 25 | } 26 | 27 | public override string Print() 28 | { 29 | Html = new StringBuilder(); 30 | 31 | Html.AppendLine("

" + _mountainPeak.GetIcon() + " " + _mountainPeak.Name + ", " + _mountainPeak.TypeAsString + "


"); 32 | 33 | if (_mountainPeak.Coordinates.Any()) 34 | { 35 | List maps = MapPanel.CreateBitmaps(_world, _mountainPeak); 36 | 37 | Html.AppendLine(""); 38 | Html.AppendLine(""); 39 | Html.AppendLine(""); 40 | Html.AppendLine(""); 41 | Html.AppendLine("
" + MakeLink(BitmapToHtml(maps[0]), LinkOption.LoadMap) + "" + MakeLink(BitmapToHtml(maps[1]), LinkOption.LoadMap) + "

"); 42 | } 43 | 44 | if (_mountainPeak.Region != null) 45 | { 46 | Html.AppendLine("Geography
"); 47 | Html.AppendLine("
    "); 48 | if (_mountainPeak.Region != null) 49 | { 50 | Html.AppendLine("
  • Region: " + _mountainPeak.Region.ToLink() + ", " + _mountainPeak.Region.Type.GetDescription() + "
  • "); 51 | } 52 | Html.AppendLine("
"); 53 | } 54 | 55 | if (_mountainPeak.Height > 0) 56 | { 57 | Html.AppendLine(Bold("Height of " + _mountainPeak.ToLink(true, _mountainPeak)) + LineBreak); 58 | Html.AppendLine("
    "); 59 | Html.AppendLine("
  • " + _mountainPeak.Height + " tiles ~ " + 3 * _mountainPeak.Height + " m
  • "); 60 | Html.AppendLine("
"); 61 | } 62 | 63 | PrintEventLog(_world, _mountainPeak.Events, MountainPeak.Filters, _mountainPeak); 64 | 65 | return Html.ToString(); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/SiteRetired.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Parser; 5 | using LegendsViewer.Legends.WorldObjects; 6 | 7 | namespace LegendsViewer.Legends.Events 8 | { 9 | public class SiteRetired : WorldEvent 10 | { 11 | public Site Site { get; set; } 12 | public Entity Civ { get; set; } 13 | public Entity SiteEntity { get; set; } 14 | public string First { get; set; } 15 | public SiteRetired(List properties, World world) 16 | : base(properties, world) 17 | { 18 | foreach (Property property in properties) 19 | { 20 | switch (property.Name) 21 | { 22 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 23 | case "civ_id": Civ = world.GetEntity(Convert.ToInt32(property.Value)); break; 24 | case "site_civ_id": SiteEntity = world.GetEntity(Convert.ToInt32(property.Value)); break; 25 | case "first": First = property.Value; break; 26 | } 27 | } 28 | Site.OwnerHistory.Last().EndYear = Year; 29 | Site.OwnerHistory.Last().EndCause = "retired"; 30 | if (SiteEntity != null) 31 | { 32 | SiteEntity.SiteHistory.Last(s => s.Site == Site).EndYear = Year; 33 | SiteEntity.SiteHistory.Last(s => s.Site == Site).EndCause = "retired"; 34 | } 35 | Civ.SiteHistory.Last(s => s.Site == Site).EndYear = Year; 36 | Civ.SiteHistory.Last(s => s.Site == Site).EndCause = "retired"; 37 | 38 | Site.AddEvent(this); 39 | Civ.AddEvent(this); 40 | SiteEntity.AddEvent(this); 41 | 42 | world.AddPlayerRelatedDwarfObjects(SiteEntity); 43 | world.AddPlayerRelatedDwarfObjects(Site); 44 | } 45 | public override string Print(bool link = true, DwarfObject pov = null) 46 | { 47 | string eventString = GetYearTime(); 48 | eventString += SiteEntity != null ? SiteEntity.ToLink(link, pov, this) : "UNKNOWN ENTITY"; 49 | eventString += " of "; 50 | eventString += Civ != null ? Civ.ToLink(link, pov, this) : "UNKNOWN CIV"; 51 | eventString += " at the settlement of "; 52 | eventString += Site != null ? Site.ToLink(link, pov, this) : "UNKNOWN SITE"; 53 | eventString += " regained their senses after an initial period of questionable judgment."; 54 | return eventString; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /LegendsViewer/Controls/DwarfTabPage.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Windows.Forms; 3 | using LegendsViewer.Controls.Chart; 4 | 5 | namespace LegendsViewer.Controls 6 | { 7 | public class DwarfTabPage : TabPage 8 | { 9 | private readonly Stack _backHistory = new Stack(); 10 | private readonly Stack _forwardHistory = new Stack(); 11 | 12 | public PageControl Current { get; private set; } 13 | 14 | public DwarfTabPage(PageControl pageControl) 15 | { 16 | Current = pageControl; 17 | LoadPageControl(); 18 | } 19 | 20 | public void NewPageControl(PageControl pageControl) 21 | { 22 | foreach (var control in _forwardHistory) 23 | { 24 | control.Dispose(); 25 | } 26 | _forwardHistory.Clear(); 27 | 28 | if (Current != null) 29 | { 30 | _backHistory.Push(Current); 31 | } 32 | Current = pageControl; 33 | LoadPageControl(); 34 | } 35 | 36 | private void LoadPageControl() 37 | { 38 | Controls.Clear(); 39 | Text = Current.Title; 40 | Control newControl = Current.GetControl(); 41 | Controls.Add(newControl); 42 | if (newControl.GetType() == typeof(ChartPanel) && Current.TabControl.SelectedTab != null) 43 | { 44 | Width = Current.TabControl.SelectedTab.Width; 45 | Refresh(); 46 | (newControl as ChartPanel)?.RefreshAllSeries(); 47 | } 48 | } 49 | 50 | public void Back() 51 | { 52 | if (_backHistory.Count > 0) 53 | { 54 | _forwardHistory.Push(Current); 55 | Current = _backHistory.Pop(); 56 | LoadPageControl(); 57 | } 58 | } 59 | 60 | public void Forward() 61 | { 62 | if (_forwardHistory.Count > 0) 63 | { 64 | _backHistory.Push(Current); 65 | Current = _forwardHistory.Pop(); 66 | LoadPageControl(); 67 | } 68 | } 69 | 70 | protected override void Dispose(bool disposing) 71 | { 72 | foreach (var forward in _forwardHistory) 73 | { 74 | forward.Dispose(); 75 | } 76 | foreach (var back in _backHistory) 77 | { 78 | back.Dispose(); 79 | } 80 | Current.Dispose(); 81 | base.Dispose(disposing); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/HFDisturbedStructure.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using LegendsViewer.Legends.Parser; 5 | using LegendsViewer.Legends.WorldObjects; 6 | 7 | namespace LegendsViewer.Legends.Events 8 | { 9 | public class HfDisturbedStructure : WorldEvent 10 | { 11 | public string Action { get; set; } // legends_plus.xml TODO not used in Legends Mode 12 | public HistoricalFigure HistoricalFigure { get; set; } 13 | public Site Site { get; set; } 14 | public int StructureId { get; set; } 15 | public Structure Structure { get; set; } 16 | 17 | public HfDisturbedStructure(List properties, World world) 18 | : base(properties, world) 19 | { 20 | foreach (Property property in properties) 21 | { 22 | switch (property.Name) 23 | { 24 | case "hist_fig_id": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; 25 | case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; 26 | case "structure_id": StructureId = Convert.ToInt32(property.Value); break; 27 | case "structure": StructureId = Convert.ToInt32(property.Value); break; 28 | case "histfig": if (HistoricalFigure == null) { HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); } else { property.Known = true; } break; 29 | case "site": if (Site == null) { Site = world.GetSite(Convert.ToInt32(property.Value)); } else { property.Known = true; } break; 30 | case "action": 31 | Action = property.Value; 32 | break; 33 | } 34 | } 35 | if (Site != null) 36 | { 37 | Structure = Site.Structures.FirstOrDefault(structure => structure.Id == StructureId); 38 | } 39 | HistoricalFigure.AddEvent(this); 40 | Site.AddEvent(this); 41 | Structure.AddEvent(this); 42 | } 43 | 44 | public override string Print(bool link = true, DwarfObject pov = null) 45 | { 46 | string eventString = GetYearTime() + HistoricalFigure.ToLink(link, pov, this) + " disturbed "; 47 | eventString += Structure != null ? Structure.ToLink(link, pov, this) : "UNKNOWN STRUCTURE"; 48 | eventString += " in " + Site.ToLink(link, pov, this); 49 | eventString += PrintParentCollection(link, pov); 50 | eventString += "."; 51 | return eventString; 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /LegendsViewer/Legends/Events/SiteTributeForced.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using LegendsViewer.Legends.Parser; 4 | using LegendsViewer.Legends.WorldObjects; 5 | 6 | namespace LegendsViewer.Legends.Events 7 | { 8 | public class SiteTributeForced : WorldEvent 9 | { 10 | public Entity Attacker { get; set; } 11 | public Entity Defender { get; set; } 12 | public Entity SiteEntity { get; set; } 13 | public Site Site { get; set; } 14 | public string Season { get; set; } 15 | 16 | public SiteTributeForced(List properties, World world) : base(properties, world) 17 | { 18 | foreach (Property property in properties) 19 | { 20 | switch (property.Name) 21 | { 22 | case "attacker_civ_id": 23 | Attacker = world.GetEntity(Convert.ToInt32(property.Value)); 24 | break; 25 | case "defender_civ_id": 26 | Defender = world.GetEntity(Convert.ToInt32(property.Value)); 27 | break; 28 | case "site_civ_id": 29 | SiteEntity = world.GetEntity(Convert.ToInt32(property.Value)); 30 | break; 31 | case "site_id": 32 | Site = world.GetSite(Convert.ToInt32(property.Value)); 33 | break; 34 | case "season": 35 | Season = property.Value; 36 | break; 37 | } 38 | } 39 | 40 | Attacker.AddEvent(this); 41 | Defender.AddEvent(this); 42 | if (SiteEntity != Defender) 43 | { 44 | SiteEntity.AddEvent(this); 45 | } 46 | Site.AddEvent(this); 47 | } 48 | 49 | public override string Print(bool link = true, DwarfObject pov = null) 50 | { 51 | string eventString = GetYearTime() + Attacker.ToLink(link, pov, this) + " secured tribute from " + SiteEntity.ToLink(link, pov, this); 52 | if (Defender != null) 53 | { 54 | eventString += " of " + Defender.ToLink(link, pov, this); 55 | } 56 | eventString += ", to be delivered from " + Site.ToLink(link, pov, this); 57 | if (!string.IsNullOrWhiteSpace(Season)) 58 | { 59 | eventString += " every " + Season.Trim(); 60 | } 61 | eventString += PrintParentCollection(link, pov); 62 | eventString += "."; 63 | return eventString; 64 | } 65 | } 66 | } --------------------------------------------------------------------------------