示例#1
0
 private void PrintRelationships()
 {
     if (_historicalFigure.RelationshipProfiles.Count > 0)
     {
         Html.AppendLine(Bold("Relationships") + LineBreak);
         Html.AppendLine("<ol>");
         foreach (var relationshipProfile in _historicalFigure.RelationshipProfiles.OrderByDescending(profile => profile.Reputations.OrderBy(rep => rep.Strength).FirstOrDefault()?.Strength))
         {
             HistoricalFigure hf = _world.GetHistoricalFigure(relationshipProfile.HistoricalFigureId);
             if (hf != null)
             {
                 Html.AppendLine("<li>");
                 Html.AppendLine(hf.ToLink());
                 if (relationshipProfile.Type != RelationShipProfileType.Unknown)
                 {
                     Html.Append(" (" + relationshipProfile.Type.GetDescription() + ")");
                 }
                 foreach (var reputation in relationshipProfile.Reputations)
                 {
                     if (reputation.Strength != 0)
                     {
                         Html.Append(", " + reputation.Print() + " ");
                     }
                 }
                 Html.AppendLine("</li>");
             }
         }
         Html.AppendLine("</ol>");
     }
 }
示例#2
0
        public HfRevived(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "ghost": _ghost = property.Value; break;

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

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

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

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

                case "raised_before": RaisedBefore = true; property.Known = true;  break;
                }
            }

            HistoricalFigure.AddEvent(this);
            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
        }
        public EntitySquadLink(XContainer data, HistoricalFigure hf)
            : this()
        {
            int valI;
            foreach (var element in data.Elements())
            {
                var val = element.Value;
                Int32.TryParse(val, out valI);
                switch (element.Name.LocalName)
                {
                    case "squad_id":
                        SquadID = valI;
                        break;
                    case "squad_position":
                        SquadPosition = valI;
                        break;
                    case "entity_id":
                        EntityID = valI;
                        break;
                    case "start_year":
                        StartYear = valI;
                        break;
                }
            }

            

            HF = hf;
        }
示例#4
0
 private void PrintCurseLineage()
 {
     if (_historicalFigure.ActiveInteractions.Any(interaction => interaction.Contains("CURSE")))
     {
         HistoricalFigure curser = _historicalFigure;
         while (curser.LineageCurseParent != null && !curser.LineageCurseParent.Deity)
         {
             curser = curser.LineageCurseParent;
         }
         string curse = "Curse";
         if (!string.IsNullOrWhiteSpace(_historicalFigure.Interaction))
         {
             curse = Formatting.InitCaps(_historicalFigure.Interaction);
         }
         Html.AppendLine(Bold(curse + " Lineage") + LineBreak);
         Html.AppendLine("<div class=\"tree\">");
         Html.AppendLine("<ul>");
         Html.AppendLine("<li>");
         Html.AppendLine(curser.LineageCurseParent != null ? curser.LineageCurseParent.ToTreeLeafLink(_historicalFigure) : "<a>UNKNOWN DEITY</a>");
         Html.AppendLine("<ul>");
         PrintLineageTreeLevel(curser);
         Html.AppendLine("</ul>");
         Html.AppendLine("</li>");
         Html.AppendLine("</ul>");
         Html.AppendLine("</div>");
         Html.AppendLine("</br>");
         Html.AppendLine("</br>");
     }
 }
示例#5
0
        public RemoveHfSiteLink(List <Property> properties, World world) : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;

                case "structure": StructureId = Convert.ToInt32(property.Value); break;

                case "civ": Civ = world.GetEntity(Convert.ToInt32(property.Value)); break;

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

                case "link_type":
                    switch (property.Value)
                    {
                    case "lair": LinkType = SiteLinkType.Lair; break;

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

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

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

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

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

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

                    case "home_site_realization_building": LinkType = SiteLinkType.HomeSiteRealizationBuilding; break;

                    case "home_site_abstract_building": LinkType = SiteLinkType.HomeSiteAbstractBuilding; break;

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

                case "site": if (Site == null)
                    {
                        Site = world.GetSite(Convert.ToInt32(property.Value));
                    }
                    else
                    {
                        property.Known = true;
                    } break;
                }
            }
            if (Site != null)
            {
                Structure = Site.Structures.FirstOrDefault(structure => structure.Id == StructureId);
            }
            HistoricalFigure.AddEvent(this);
            Civ.AddEvent(this);
            Site.AddEvent(this);
            Structure.AddEvent(this);
        }
        public FormCreatedEvent(List <Property> properties, World world) : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "hist_figure_id":
                    HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value));
                    break;

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

                case "form_id":
                    FormId = property.Value;
                    break;

                case "reason":
                    Reason = property.Value;
                    break;

                case "reason_id":
                    ReasonId = Convert.ToInt32(property.Value);
                    break;

                case "circumstance":
                    Circumstance = property.Value;
                    break;

                case "circumstance_id":
                    CircumstanceId = Convert.ToInt32(property.Value);
                    break;

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

            Site.AddEvent(this);
            Region.AddEvent(this);
            HistoricalFigure.AddEvent(this);
            if (Reason == "glorify hf")
            {
                GlorifiedHf = world.GetHistoricalFigure(ReasonId);
                if (GlorifiedHf != HistoricalFigure)
                {
                    GlorifiedHf.AddEvent(this);
                }
            }
            if (Circumstance == "pray to hf")
            {
                PrayToHf = world.GetHistoricalFigure(CircumstanceId);
                if (PrayToHf != GlorifiedHf)
                {
                    PrayToHf.AddEvent(this);
                }
            }
        }
示例#7
0
        public HfTravel(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;

                case "escape": Escaped = true; property.Known = true; break;

                case "return": Returned = true; property.Known = true; break;

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

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

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

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

            HistoricalFigure.AddEvent(this);
            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
        }
示例#8
0
        public override string Print(bool link = true, DwarfObject pov = null)
        {
            string eventString = GetYearTime() + HistoricalFigure.ToLink(link, pov, this) + " ";
            string stateString = "";

            switch (BodyState)
            {
            case BodyState.EntombedAtSite: stateString = "was entombed"; break;

            case BodyState.Unknown: stateString = "(" + _unknownBodyState + ")"; break;
            }
            eventString += stateString;
            if (Region != null)
            {
                eventString += " in " + Region.ToLink(link, pov, this);
            }

            if (Site != null)
            {
                eventString += " at " + Site.ToLink(link, pov, this);
            }

            eventString += " within ";
            eventString += Structure != null?Structure.ToLink(link, pov, this) : "UNKNOWN STRUCTURE";

            eventString += PrintParentCollection(link, pov);
            eventString += ".";
            return(eventString);
        }
示例#9
0
        private void ReadLeaders()
        {
            while (LeaderStart())
            {
                string leaderType = Formatting.InitCaps(_currentLine.Substring(1, _currentLine.IndexOf("List") - 2));
                _currentCiv.LeaderTypes.Add(leaderType);
                _currentCiv.Leaders.Add(new List <HistoricalFigure>());
                ReadLine();
                while (_currentLine != null && _currentLine.StartsWith("  "))
                {
                    if (_currentLine.Contains("[*]"))
                    {
                        string           leaderName = Formatting.ReplaceNonAscii(_currentLine.Substring(_currentLine.IndexOf("[*]") + 4, _currentLine.IndexOf("(b") - _currentLine.IndexOf("[*]") - 5));
                        HistoricalFigure leader     = null;
                        try
                        {
                            leader = _world.GetHistoricalFigure(leaderName);
                        }
                        catch (Exception e)
                        {
                            leader = _world.HistoricalFigures.FirstOrDefault(hf =>
                                                                             string.Compare(hf.Name, leaderName, StringComparison.OrdinalIgnoreCase) == 0);
                            if (leader == null)
                            {
                                _log.AppendLine(e.Message + ", a Leader of " + _currentCiv.Name);
                                ReadLine();
                                continue;
                            }
                        }

                        int reignBegan = Convert.ToInt32(_currentLine.Substring(_currentLine.IndexOf(":") + 2, _currentLine.IndexOf("), ") - _currentLine.IndexOf(":") - 2));
                        if (_currentCiv.Leaders[_currentCiv.LeaderTypes.Count - 1].Count > 0) //End of previous leader's reign
                        {
                            _currentCiv.Leaders[_currentCiv.LeaderTypes.Count - 1].Last().Positions.Last().Ended = reignBegan - 1;
                        }

                        if (leader.Positions.Count > 0 && leader.Positions.Last().Ended == -1) //End of leader's last leader position (move up rank etc.)
                        {
                            HistoricalFigure.Position lastPosition = leader.Positions.Last();
                            lastPosition.Ended  = reignBegan;
                            lastPosition.Length = lastPosition.Began - reignBegan;
                        }
                        HistoricalFigure.Position newPosition = new HistoricalFigure.Position(_currentCiv, reignBegan, -1, leaderType);
                        if (leader.DeathYear != -1)
                        {
                            newPosition.Ended  = leader.DeathYear;
                            newPosition.Length = leader.DeathYear - newPosition.Ended;
                        }
                        else
                        {
                            newPosition.Length = _world.Events.Last().Year - newPosition.Began;
                        }

                        leader.Positions.Add(newPosition);
                        _currentCiv.Leaders[_currentCiv.LeaderTypes.Count - 1].Add(leader);
                    }
                    ReadLine();
                }
            }
        }
示例#10
0
        public override string Print(bool link = true, DwarfObject pov = null)
        {
            string eventString = GetYearTime();

            eventString += HistoricalFigure != null?HistoricalFigure.ToLink(link, pov, this) : "UNKNOWN HISTORICAL FIGURE";

            eventString += " reached the summit";
            if (Region != null)
            {
                eventString += ", which rises above ";
                eventString += Region.ToLink(link, pov, this);
            }
            else if (UndergroundRegion != null)
            {
                eventString += ", in the depths of ";
                eventString += UndergroundRegion.ToLink(link, pov, this);
            }
            if (Site != null)
            {
                eventString += " in ";
                eventString += Site.ToLink(link, pov, this);
            }
            eventString += ".";
            return(eventString);
        }
示例#11
0
        }                               // TODO // legends_plus.xml

        public CreateEntityPosition(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "histfig": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "civ": Civ = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "site_civ": SiteCiv = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "position": Position = property.Value; break;

                case "reason": Reason = Convert.ToInt32(property.Value); break;
                }
            }
            HistoricalFigure.AddEvent(this);
            Civ.AddEvent(this);
            if (SiteCiv != Civ)
            {
                SiteCiv.AddEvent(this);
            }
        }
示例#12
0
        public HfReachSummit(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "group_hfid": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

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

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

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

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

                case "group": if (HistoricalFigure == null)
                    {
                        HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value));
                    }
                    else
                    {
                        property.Known = true;
                    } break;
                }
            }
            HistoricalFigure.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
            Site.AddEvent(this);
        }
示例#13
0
        public void HistoricalFigureDeityXML_Parses()
        {
            var world = LoadingWorld.GetTestWorld();
            var xdoc  = new XDocument(new XElement("historical_figure",
                                                   new XElement("id", 303),
                                                   new XElement("name", "arist"),
                                                   new XElement("race", "DWARF"),
                                                   new XElement("caste", "FEMALE"),
                                                   new XElement("appeared", -1),
                                                   new XElement("birth_year", -1),
                                                   new XElement("birth_seconds72", -1),
                                                   new XElement("death_year", -1),
                                                   new XElement("death_seconds", -1),
                                                   new XElement("deity"),
                                                   new XElement("sphere", "fortresses"),
                                                   new XElement("sphere", "war")
                                                   )
                                      );

            var historicalFigure = new HistoricalFigure(xdoc, world);

            Assert.AreEqual(historicalFigure.Id, 303);
            Assert.AreEqual(historicalFigure.Name, "arist");
            Assert.AreEqual(historicalFigure.RaceName, "DWARF");
            Assert.AreEqual(HistoricalFigure.Castes[historicalFigure.Caste.Value], "FEMALE");
            Assert.AreEqual(historicalFigure.Appeared.Year, -1);
            Assert.AreEqual(historicalFigure.Birth.Year, -1);
            Assert.AreEqual(historicalFigure.Death, WorldTime.Present);
            Assert.IsTrue(historicalFigure.Deity);
            Assert.AreEqual(historicalFigure.Sphere.Count, 2);
            Assert.AreEqual(HistoricalFigure.Spheres[historicalFigure.Sphere[0]], "fortresses");
            Assert.AreEqual(HistoricalFigure.Spheres[historicalFigure.Sphere[1]], "war");
        }
示例#14
0
        public EntityCreated(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "entity_id": Entity = world.GetEntity(Convert.ToInt32(property.Value)); break;

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

                case "structure_id": StructureId = Convert.ToInt32(property.Value); break;

                case "creator_hfid": Creator = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;
                }
            }
            if (Site != null)
            {
                Structure = Site.Structures.FirstOrDefault(structure => structure.Id == StructureId);
                if (Entity != null && Structure != null)
                {
                    Entity.OriginStructure = Structure;
                }
            }
            Entity.AddEvent(this);
            Site.AddEvent(this);
            Structure.AddEvent(this);
        }
示例#15
0
        public HistoricalFigure ScaleFamilyTree(HistoricalFigure branch, Leader leaderMatch)
        {
            if (branch.isLeader && branch.Leader == leaderMatch)
            {
                return(branch);
            }

            if (branch.HFLinks.ContainsKey("mother"))
            {
                HistoricalFigure motherMatch = ScaleFamilyTree(branch.HFLinks["mother"][0].HF, leaderMatch);
                if (motherMatch != null)
                {
                    return(motherMatch);
                }
            }
            if (branch.HFLinks.ContainsKey("father"))
            {
                HistoricalFigure fatherMatch = ScaleFamilyTree(branch.HFLinks["father"][0].HF, leaderMatch);
                if (fatherMatch != null)
                {
                    return(fatherMatch);
                }
            }
            return(null);
        }
示例#16
0
 private void ReadWorships()
 {
     if (_currentLine.Contains("Worship List"))
     {
         ReadLine();
         while (_currentLine != null && _currentLine.StartsWith("  "))
         {
             string           worshipName = Formatting.InitCaps(Formatting.ReplaceNonAscii(_currentLine.Substring(2, _currentLine.IndexOf(",") - 2)));
             HistoricalFigure worship     = null;
             try
             {
                 worship = _world.GetHistoricalFigure(worshipName);
             }
             catch (Exception e)
             {
                 worship = _world.HistoricalFiguresByName.FirstOrDefault(h => h.Name.Equals(worshipName, StringComparison.OrdinalIgnoreCase) && (h.Deity || h.Force));
                 if (worship == null)
                 {
                     _log.AppendLine(e.Message + ", a Worship of " + _currentCiv.Name);
                     ReadLine();
                     continue;
                 }
             }
             worship.WorshippedBy = _currentCiv;
             _currentCiv.Worshipped.Add(worship);
             ReadLine();
         }
     }
 }
示例#17
0
        public HFSiteLink(XContainer data, HistoricalFigure hf)
        {
            var linktypename = data.Element("link_type").Value;

            if (!LinkTypes.Contains(linktypename))
            {
                LinkTypes.Add(linktypename);
            }
            LinkType = LinkTypes.IndexOf(linktypename);

            SiteId = Convert.ToInt32(data.Element("site_id").Value);
            if (data.Elements("sub_id").Count() != 0)
            {
                SubId = Convert.ToInt32(data.Element("sub_id").Value);
            }
            if (data.Elements("occupation_id").Count() != 0)
            {
                OccupationId = Convert.ToInt32(data.Element("occupation_id").Value);
            }
            if (data.Elements("entity_id").Count() != 0)
            {
                EntityId = Convert.ToInt32(data.Element("entity_id").Value);
            }

            Hf = hf;
        }
示例#18
0
文件: Dynasty.cs 项目: tier6tank/DFWV
 public Dynasty(World world, HistoricalFigure hf, string type, Civilization civ) : base(world)
 {
     Members = new List <HistoricalFigure>();
     Members.Add(hf);
     Type         = type;
     Civilization = civ;
 }
示例#19
0
        public override string Print(bool link = true, DwarfObject pov = null)
        {
            string eventString = base.Print(link, pov);

            if (Competitors.Any())
            {
                eventString += "</br>";
                eventString += "Competing were ";
                for (int i = 0; i < Competitors.Count; i++)
                {
                    HistoricalFigure competitor = Competitors.ElementAt(i);
                    if (i == 0)
                    {
                        eventString += competitor.ToLink(link, pov);
                    }
                    else if (i == Competitors.Count - 1)
                    {
                        eventString += " and " + competitor.ToLink(link, pov);
                    }
                    else
                    {
                        eventString += ", " + competitor.ToLink(link, pov);
                    }
                }
                eventString += ". ";
            }
            if (Winner != null)
            {
                eventString += "The winner was ";
                eventString += Winner.ToLink(link, pov);
                eventString += ".";
            }
            return(eventString);
        }
示例#20
0
        public FieldBattle(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;

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

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

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

                case "attacker_general_hfid": AttackerGeneral = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "defender_general_hfid": DefenderGeneral = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

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

            Attacker.AddEvent(this);
            Defender.AddEvent(this);
            AttackerGeneral.AddEvent(this);
            DefenderGeneral.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
        }
示例#21
0
        public CreatedSite(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "civ_id": Civ = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "site_civ_id": SiteEntity = world.GetEntity(Convert.ToInt32(property.Value)); break;

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

                case "builder_hfid": Builder = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;
                }
            }

            if (SiteEntity != null)
            {
                SiteEntity.Parent = Civ;
                Site.OwnerHistory.Add(new OwnerPeriod(Site, SiteEntity, Year, "founded"));
            }
            else if (Civ != null)
            {
                Site.OwnerHistory.Add(new OwnerPeriod(Site, Civ, Year, "founded"));
            }
            else if (Builder != null)
            {
                Site.OwnerHistory.Add(new OwnerPeriod(Site, Builder, Year, "created"));
            }
            Site.AddEvent(this);
            SiteEntity.AddEvent(this);
            Civ.AddEvent(this);
            Builder.AddEvent(this);
        }
        public HfViewedArtifact(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "artifact_id":
                    Artifact = world.GetArtifact(Convert.ToInt32(property.Value));
                    break;

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

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

                case "structure_id":
                    StructureId = Convert.ToInt32(property.Value);
                    break;
                }
            }

            if (Site != null)
            {
                Structure = Site.Structures.FirstOrDefault(structure => structure.Id == StructureId);
            }
            Artifact.AddEvent(this);
            HistoricalFigure.AddEvent(this);
            Site.AddEvent(this);
            Structure.AddEvent(this);
        }
示例#23
0
        private void PrintCurrentLeadership()
        {
            if (_entity.EntityPositionAssignments.Any() && _entity.EntityPositionAssignments.Where(epa => epa.HistoricalFigure != null).Any())
            {
                Html.AppendLine("<b>Current Leadership</b><br />");
                Html.AppendLine("<ul>");
                foreach (EntityPositionAssignment assignment in _entity.EntityPositionAssignments)
                {
                    EntityPosition position = _entity.EntityPositions.FirstOrDefault(pos => pos.Id == assignment.PositionId);
                    if (position != null && assignment.HistoricalFigure != null)
                    {
                        string positionName = position.GetTitleByCaste(assignment.HistoricalFigure.Caste);

                        Html.AppendLine("<li>" + assignment.HistoricalFigure.ToLink() + ", " + positionName + "</li>");

                        if (!string.IsNullOrEmpty(position.Spouse))
                        {
                            HistoricalFigureLink spouseLink = assignment.HistoricalFigure.RelatedHistoricalFigures.FirstOrDefault(hfLink => hfLink.Type == HistoricalFigureLinkType.Spouse);
                            if (spouseLink != null)
                            {
                                HistoricalFigure spouse = spouseLink.HistoricalFigure;
                                if (spouse != null)
                                {
                                    string spousePositionName = position.GetTitleByCaste(spouse.Caste, true);
                                    Html.AppendLine("<li>" + spouse.ToLink() + ", " + spousePositionName + "</li>");
                                }
                            }
                        }
                    }
                }
                Html.AppendLine("</ul>");
            }
        }
示例#24
0
        public EntityLaw(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "entity_id": Entity = world.GetEntity(Convert.ToInt32(property.Value)); break;

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

                case "law_add":
                case "law_remove":
                    switch (property.Value)
                    {
                    case "harsh": Law = EntityLawType.Harsh; break;

                    default:
                        Law             = EntityLawType.Unknown;
                        _unknownLawType = property.Value;
                        world.ParsingErrors.Report("Unknown Law Type: " + _unknownLawType);
                        break;
                    }
                    LawLaid = property.Name == "law_add";
                    break;
                }
            }

            Entity.AddEvent(this);
            HistoricalFigure.AddEvent(this);
        }
        public EntityExpelsHf(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "entity_id":
                    Entity = world.GetEntity(Convert.ToInt32(property.Value));
                    break;

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

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

            Entity.AddEvent(this);
            HistoricalFigure.AddEvent(this);
            Site.AddEvent(this);
        }
示例#26
0
        public override string Print(bool link = true, DwarfObject pov = null)
        {
            string eventString = GetYearTime() + HistoricalFigure.ToLink(link, pov);

            if (LawLaid)
            {
                eventString += " laid a series of ";
            }
            else
            {
                eventString += " lifted numerous ";
            }

            switch (Law)
            {
            case EntityLawType.Harsh: eventString += "oppressive"; break;

            case EntityLawType.Unknown: eventString += "(" + _unknownLawType + ")"; break;
            }
            if (LawLaid)
            {
                eventString += " edicts upon ";
            }
            else
            {
                eventString += " laws from ";
            }

            eventString += Entity.ToLink(link, pov);
            eventString += PrintParentCollection(link, pov);
            eventString += ".";
            return(eventString);
        }
示例#27
0
        public EntityPositionLink(XContainer data, HistoricalFigure hf) : this()
        {
            foreach (var element in data.Elements())
            {
                var val = element.Value;
                int valI;
                int.TryParse(val, out valI);
                switch (element.Name.LocalName)
                {
                case "position_profile_id":
                    PositionProfileId = valI;
                    break;

                case "entity_id":
                    EntityId = valI;
                    break;

                case "start_year":
                    StartYear = valI;
                    break;
                }
            }



            Hf = hf;
        }
示例#28
0
        public HfGainsSecretGoal(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "hfid": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "secret_goal":
                    switch (property.Value)
                    {
                    case "immortality": Goal = SecretGoal.Immortality; break;

                    default:
                        Goal         = SecretGoal.Unknown;
                        _unknownGoal = property.Value;
                        world.ParsingErrors.Report("Unknown Secret Goal: " + _unknownGoal);
                        break;
                    }
                    break;
                }
            }

            HistoricalFigure.AddEvent(this);
        }
        public override string Print(bool link = true, DwarfObject pov = null)
        {
            string eventString = GetYearTime();

            eventString += HistoricalFigure.ToLink(link, pov, this);
            eventString += " asked about ";
            eventString += Artifact.ToLink(link, pov, this);
            if (Structure != null)
            {
                eventString += " inside ";
                eventString += Structure.ToLink(link, pov, this);
            }
            if (Site != null)
            {
                eventString += " in ";
                eventString += Site.ToLink(link, pov, this);
            }
            else if (Region != null)
            {
                eventString += " in ";
                eventString += Region.ToLink(link, pov, this);
            }
            else if (UndergroundRegion != null)
            {
                eventString += " in ";
                eventString += UndergroundRegion.ToLink(link, pov, this);
            }
            eventString += PrintParentCollection(link, pov);
            eventString += ".";
            return(eventString);
        }
示例#30
0
        public HfReunion(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "group_1_hfid": HistoricalFigure1 = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "group_2_hfid": HistoricalFigure2 = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

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

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

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

            HistoricalFigure1.AddEvent(this);
            HistoricalFigure2.AddEvent(this);
            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
        }