Esempio n. 1
0
        public IEnumerable <string> GetUnmetThroneroomRequirements(bool includeOnGracePeriod = true, bool onlyOnGracePeriod = false)
        {
            if (pawn.ownership.AssignedThrone == null)
            {
                yield break;
            }
            RoyalTitle highestTitle = HighestTitleWithThroneRoomRequirements();

            if (highestTitle != null)
            {
                Room throneRoom = pawn.ownership.AssignedThrone.GetRoom();
                if (throneRoom != null)
                {
                    RoyalTitleDef prevTitle = highestTitle.def.GetPreviousTitle(highestTitle.faction);
                    foreach (RoomRequirement throneRoomRequirement in highestTitle.def.throneRoomRequirements)
                    {
                        if (!throneRoomRequirement.Met(throneRoom, pawn))
                        {
                            bool flag  = highestTitle.RoomRequirementGracePeriodActive(pawn);
                            bool flag2 = prevTitle != null && !prevTitle.HasSameThroneroomRequirement(throneRoomRequirement);
                            if ((!onlyOnGracePeriod || (flag2 && flag)) && (!flag || !flag2 || includeOnGracePeriod))
                            {
                                yield return(throneRoomRequirement.LabelCap(throneRoom));
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public IEnumerable <string> GetUnmetBedroomRequirements(bool includeOnGracePeriod = true, bool onlyOnGracePeriod = false)
        {
            RoyalTitle royalTitle = HighestTitleWithBedroomRequirements();

            if (royalTitle != null)
            {
                bool          gracePeriodActive = royalTitle.RoomRequirementGracePeriodActive(pawn);
                RoyalTitleDef prevTitle         = royalTitle.def.GetPreviousTitle(royalTitle.faction);
                if (HasPersonalBedroom())
                {
                    Room bedroom = pawn.ownership.OwnedRoom;
                    foreach (RoomRequirement bedroomRequirement in royalTitle.def.GetBedroomRequirements(pawn))
                    {
                        if (!bedroomRequirement.Met(bedroom))
                        {
                            bool flag = prevTitle != null && !prevTitle.HasSameBedroomRequirement(bedroomRequirement);
                            if ((!onlyOnGracePeriod || (flag && gracePeriodActive)) && (!gracePeriodActive || !flag || includeOnGracePeriod))
                            {
                                yield return(bedroomRequirement.LabelCap(bedroom));
                            }
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 public override TaggedString GetExplanation()
 {
     return(defaultExplanation + "\n" + Targets.Select(delegate(Pawn t)
     {
         RoyalTitle royalTitle = t.royalty.HighestTitleWithBedroomRequirements();
         RoyalTitleDef royalTitleDef = (royalTitle.RoomRequirementGracePeriodActive(t) ? royalTitle.def.GetPreviousTitle(royalTitle.faction) : royalTitle.def);
         string[] array = t.royalty.GetUnmetBedroomRequirements(includeOnGracePeriod: false).ToArray();
         string[] array2 = t.royalty.GetUnmetBedroomRequirements(includeOnGracePeriod: true, onlyOnGracePeriod: true).ToArray();
         bool flag = royalTitleDef != null && array.Length != 0;
         StringBuilder stringBuilder = new StringBuilder();
         if (flag)
         {
             stringBuilder.Append(t.LabelShort + " (" + royalTitleDef.GetLabelFor(t.gender) + "):\n" + array.ToLineList("- "));
         }
         if (array2.Length != 0)
         {
             if (flag)
             {
                 stringBuilder.Append("\n\n");
             }
             stringBuilder.Append(t.LabelShort + " (" + royalTitle.def.GetLabelFor(t.gender) + ", " + "RoomRequirementGracePeriodDesc".Translate(royalTitle.RoomRequirementGracePeriodDaysLeft.ToString("0.0")) + ")" + ":\n" + array2.ToLineList("- "));
         }
         return stringBuilder.ToString();
     }).ToLineList("\n"));
 }