public static void PostProcessGeneratedGear(Thing gear, Pawn pawn)
        {
            CompQuality compQuality = gear.TryGetComp <CompQuality>();

            if (compQuality != null)
            {
                QualityCategory q = QualityUtility.GenerateQualityGeneratingPawn(pawn.kindDef);
                if (pawn.royalty != null && pawn.Faction != null)
                {
                    RoyalTitleDef currentTitle = pawn.royalty.GetCurrentTitle(pawn.Faction);
                    if (currentTitle != null)
                    {
                        q = (QualityCategory)Mathf.Clamp((int)QualityUtility.GenerateQualityGeneratingPawn(pawn.kindDef), (int)currentTitle.requiredMinimumApparelQuality, 6);
                    }
                }
                compQuality.SetQuality(q, ArtGenerationContext.Outsider);
            }
            if (gear.def.useHitPoints)
            {
                float randomInRange = pawn.kindDef.gearHealthRange.RandomInRange;
                if (randomInRange < 1f)
                {
                    int b = Mathf.RoundToInt(randomInRange * (float)gear.MaxHitPoints);
                    b = (gear.HitPoints = Mathf.Max(1, b));
                }
            }
        }
Пример #2
0
        // Doesn't work. Never gets called :(
        public override void ProcessInput(Event ev)
        {
            Faction       possibleFaction = Find.FactionManager.AllFactionsListForReading.First(f => f.def.HasRoyalTitles);
            RoyalTitleDef titleDef        = possibleFaction.def.RoyalTitlesAllInSeniorityOrderForReading.First();

            Log.Message($"{possibleFaction.GetCallLabel()} - {titleDef.LabelCap}");
            Find.WindowStack.Add(new Dialog_InfoCard(titleDef, possibleFaction));
        }
 public Hyperlink(Thing thing, int statIndex = -1)
 {
     this.thing        = thing;
     stuff             = null;
     def               = null;
     worldObject       = null;
     titleDef          = null;
     faction           = null;
     selectedStatIndex = statIndex;
 }
 public Hyperlink(Def def, int statIndex = -1)
 {
     this.def          = def;
     thing             = null;
     stuff             = null;
     worldObject       = null;
     titleDef          = null;
     faction           = null;
     selectedStatIndex = statIndex;
 }
 public Hyperlink(Dialog_InfoCard infoCard, int statIndex = -1)
 {
     def               = infoCard.def;
     thing             = infoCard.thing;
     stuff             = infoCard.stuff;
     worldObject       = infoCard.worldObject;
     titleDef          = infoCard.titleDef;
     faction           = infoCard.faction;
     selectedStatIndex = statIndex;
 }
 public Hyperlink(RoyalTitleDef titleDef, Faction faction, int statIndex = -1)
 {
     def               = null;
     thing             = null;
     stuff             = null;
     worldObject       = null;
     this.titleDef     = titleDef;
     this.faction      = faction;
     selectedStatIndex = statIndex;
 }
Пример #7
0
        public static float VoteWeight(Pawn voter, Pawn candidate)
        {
            float weight = voter.relations.OpinionOf(candidate);

            // If the candidate is currently in a mental state, it's not good for an election. Penalty is doubled for aggressive mental states
            if (candidate.InMentalState)
            {
                weight -= Settings.MentalStateVoteWeightPenalty * (candidate.InAggroMentalState ? 2 : 1);
            }

            // For every backstory the two pawns have in common, a bonus is added
            int sameBackstories = voter.story.AllBackstories.Count(bs => candidate.story.AllBackstories.Contains(bs));

            if (sameBackstories > 0)
            {
                Utility.Log($"{voter} and {candidate} have {sameBackstories} backstories in common.");
            }
            weight += sameBackstories * Settings.SameBackstoryVoteWeightBonus;

            // If the candidate has a royal title, their vote weight is increased according to seniority
            RoyalTitleDef title = candidate.royalty?.MostSeniorTitle?.def;

            if (title != null)
            {
                Utility.Log($"{candidate} has royal title {title.label} (seniority {title.seniority}).");
                weight += 5 + title.seniority / 10;
            }

            // Taking into account political sympathy (built during campaigning)
            float sympathy = voter.needs.mood.thoughts.memories.Memories
                             .OfType <Thought_MemorySocial>()
                             .Where(m => m.def == RimocracyDefOf.PoliticalSympathy && m.otherPawn == candidate)
                             .Sum(m => m.OpinionOffset())
                             * Settings.PoliticalSympathyWeightFactor;

            if (sympathy != 0)
            {
                Utility.Log($"{voter} has {sympathy:N1} of sympathy for {candidate}.");
            }
            weight += sympathy;

            // If Meritocracy is in effect, sum of candidate's skills is taken into account
            if (Utility.RimocracyComp.DecisionActive("Meritocracy"))
            {
                float sumSkills = candidate.skills.skills.Sum(sr => sr.Level);
                Utility.Log($"{candidate} has a total level of skills of {sumSkills}, affecting Meritocracy.");
                weight += sumSkills * 0.25f;
            }

            // Adding a random factor of -5 to +5
            weight += Rand.Range(-Settings.RandomVoteWeightRadius, Settings.RandomVoteWeightRadius);

            Utility.Log($"{voter} vote weight for {candidate}: {weight:N0}.");
            return(weight);
        }
Пример #8
0
 public static void Postfix(QuestPart_BestowingCeremony __instance, Lord __result)
 {
     if (__instance.bestower.kindDef == PawnKindDefOf.Empire_Royal_Bestower)
     {
         RoyalTitleDef titleAwardedWhenUpdating = __instance.target.royalty.GetTitleAwardedWhenUpdating(__instance.bestower.Faction,
                                                                                                        __instance.target.royalty.GetFavor(__instance.bestower.Faction));
         if (titleAwardedWhenUpdating.defName == "Baron" || titleAwardedWhenUpdating.defName == "Count")
         {
             ThingOwner <Thing> innerContainer = __instance.bestower.inventory.innerContainer;
             innerContainer.TryAdd(ThingMaker.MakeThing(AlteredCarbonDefOf.AC_EmptyCorticalStack), 1);
         }
     }
 }
Пример #9
0
 private static bool PlayerHasResearchedBedroomRequirementsFor(RoyalTitleDef title)
 {
     if (title.bedroomRequirements == null)
     {
         return(true);
     }
     for (int i = 0; i < title.bedroomRequirements.Count; i++)
     {
         if (!title.bedroomRequirements[i].PlayerHasResearched())
         {
             return(false);
         }
     }
     return(true);
 }
 public PawnGenerationRequest(PawnKindDef kind, Faction faction = null, PawnGenerationContext context = PawnGenerationContext.NonPlayer, int tile = -1, bool forceGenerateNewPawn = false, bool newborn = false, bool allowDead = false, bool allowDowned = false, bool canGeneratePawnRelations = true, bool mustBeCapableOfViolence = false, float colonistRelationChanceFactor = 1f, bool forceAddFreeWarmLayerIfNeeded = false, bool allowGay = true, bool allowFood = true, bool allowAddictions = true, bool inhabitant = false, bool certainlyBeenInCryptosleep = false, bool forceRedressWorldPawnIfFormerColonist = false, bool worldPawnFactionDoesntMatter = false, float biocodeWeaponChance = 0f, Pawn extraPawnForExtraRelationChance = null, float relationWithExtraPawnChanceFactor = 1f, Predicate <Pawn> validatorPreGear = null, Predicate <Pawn> validatorPostGear = null, IEnumerable <TraitDef> forcedTraits = null, IEnumerable <TraitDef> prohibitedTraits = null, float?minChanceToRedressWorldPawn = null, float?fixedBiologicalAge = null, float?fixedChronologicalAge = null, Gender?fixedGender = null, float?fixedMelanin = null, string fixedLastName = null, string fixedBirthName = null, RoyalTitleDef fixedTitle = null)
 {
     this = default(PawnGenerationRequest);
     if (context == PawnGenerationContext.All)
     {
         Log.Error("Should not generate pawns with context 'All'");
         context = PawnGenerationContext.NonPlayer;
     }
     if (inhabitant && (tile == -1 || Current.Game.FindMap(tile) == null))
     {
         Log.Error("Trying to generate an inhabitant but map is null.");
         inhabitant = false;
     }
     KindDef = kind;
     Context = context;
     Faction = faction;
     Tile    = tile;
     ForceGenerateNewPawn = forceGenerateNewPawn;
     Newborn     = newborn;
     AllowDead   = allowDead;
     AllowDowned = allowDowned;
     CanGeneratePawnRelations      = canGeneratePawnRelations;
     MustBeCapableOfViolence       = mustBeCapableOfViolence;
     ColonistRelationChanceFactor  = colonistRelationChanceFactor;
     ForceAddFreeWarmLayerIfNeeded = forceAddFreeWarmLayerIfNeeded;
     AllowGay                              = allowGay;
     AllowFood                             = allowFood;
     AllowAddictions                       = allowAddictions;
     ForcedTraits                          = forcedTraits;
     ProhibitedTraits                      = prohibitedTraits;
     Inhabitant                            = inhabitant;
     CertainlyBeenInCryptosleep            = certainlyBeenInCryptosleep;
     ForceRedressWorldPawnIfFormerColonist = forceRedressWorldPawnIfFormerColonist;
     WorldPawnFactionDoesntMatter          = worldPawnFactionDoesntMatter;
     ExtraPawnForExtraRelationChance       = extraPawnForExtraRelationChance;
     RelationWithExtraPawnChanceFactor     = relationWithExtraPawnChanceFactor;
     BiocodeWeaponChance                   = biocodeWeaponChance;
     ValidatorPreGear                      = validatorPreGear;
     ValidatorPostGear                     = validatorPostGear;
     MinChanceToRedressWorldPawn           = minChanceToRedressWorldPawn;
     FixedBiologicalAge                    = fixedBiologicalAge;
     FixedChronologicalAge                 = fixedChronologicalAge;
     FixedGender                           = fixedGender;
     FixedMelanin                          = fixedMelanin;
     FixedLastName                         = fixedLastName;
     FixedBirthName                        = fixedBirthName;
     FixedTitle                            = fixedTitle;
 }
        private static string GetTitleTipString(Pawn pawn, Faction faction, RoyalTitle title, int favor)
        {
            RoyalTitleDef def = title.def;
            TaggedString  t   = "RoyalTitleTooltipHasTitle".Translate(pawn.Named("PAWN"), faction.Named("FACTION"), def.GetLabelCapFor(pawn).Named("TITLE"));

            t += "\n\n" + faction.def.royalFavorLabel.CapitalizeFirst() + ": " + favor;
            RoyalTitleDef nextTitle = def.GetNextTitle(faction);

            if (nextTitle != null)
            {
                t += "\n" + "RoyalTitleTooltipNextTitle".Translate() + ": " + nextTitle.GetLabelCapFor(pawn) + " (" + "RoyalTitleTooltipNextTitleFavorCost".Translate(nextTitle.favorCost.ToString(), faction.Named("FACTION")) + ")";
            }
            else
            {
                t += "\n" + "RoyalTitleTooltipFinalTitle".Translate();
            }
            if (title.def.canBeInherited)
            {
                Pawn heir = pawn.royalty.GetHeir(faction);
                if (heir != null)
                {
                    t += "\n\n" + "RoyalTitleTooltipInheritance".Translate(pawn.Named("PAWN"), heir.Named("HEIR"));
                    if (heir.Faction == null)
                    {
                        t += " " + "RoyalTitleTooltipHeirNoFaction".Translate(heir.Named("HEIR"));
                    }
                    else if (heir.Faction != faction)
                    {
                        t += " " + "RoyalTitleTooltipHeirDifferentFaction".Translate(heir.Named("HEIR"), heir.Faction.Named("FACTION"));
                    }
                }
                else
                {
                    t += "\n\n" + "RoyalTitleTooltipNoHeir".Translate(pawn.Named("PAWN"));
                }
            }
            else
            {
                t += "\n\n" + "LetterRoyalTitleCantBeInherited".Translate(title.def.Named("TITLE")).CapitalizeFirst() + " " + "LetterRoyalTitleNoHeir".Translate(pawn.Named("PAWN"));
            }
            t += "\n\n" + (title.conceited ? "RoyalTitleTooltipConceited" : "RoyalTitleTooltipNonConceited").Translate(pawn.Named("PAWN"));
            t += "\n\n" + RoyalTitleUtility.GetTitleProgressionInfo(faction, pawn);
            return((t + ("\n\n" + "ClickToLearnMore".Translate())).Resolve());
        }
Пример #12
0
        public static bool Prefix(Pawn_RoyaltyTracker __instance, Faction faction, RoyalTitleDef currentTitle, RoyalTitleDef newTitle, bool sendLetter)
        {
            Pawn        pawn          = __instance.pawn;
            List <Pawn> startingPawns = Find.GameInitData.startingAndOptionalPawns;

            if (startingPawns.NullOrEmpty())
            {
                //    Log.Message("startingPawns.NullOrEmpty()");
                return(true);
            }
            if (pawn.Faction == Faction.OfPlayer)
            {
                if (startingPawns.Contains(pawn))
                {
                    OnPreTitleChanged(__instance, faction, currentTitle, newTitle, false);
                    return(false);
                }
            }
            return(true);
        }
Пример #13
0
        public override string GetInspectString()
        {
            string text = base.GetInspectString();

            if (base.Faction != Faction.OfPlayer)
            {
                if (!text.NullOrEmpty())
                {
                    text += "\n";
                }
                text += base.Faction.PlayerRelationKind.GetLabel();
                if (!base.Faction.def.hidden)
                {
                    text = text + " (" + base.Faction.PlayerGoodwill.ToStringWithSign() + ")";
                }
                RoyalTitleDef royalTitleDef = TraderKind?.TitleRequiredToTrade;
                if (royalTitleDef != null)
                {
                    text += "\n" + "RequiresTradePermission".Translate(royalTitleDef.GetLabelCapForBothGenders());
                }
            }
            return(text);
        }
Пример #14
0
 public override IEnumerable <Gizmo> GetGizmos()
 {
     foreach (Gizmo gizmo in base.GetGizmos())
     {
         yield return(gizmo);
     }
     if (TraderKind != null)
     {
         Command_Action command_Action = new Command_Action();
         command_Action.defaultLabel = "CommandShowSellableItems".Translate();
         command_Action.defaultDesc  = "CommandShowSellableItemsDesc".Translate();
         command_Action.icon         = ShowSellableItemsCommand;
         command_Action.action       = delegate
         {
             Find.WindowStack.Add(new Dialog_SellableItems(this));
             RoyalTitleDef titleRequiredToTrade = TraderKind.TitleRequiredToTrade;
             if (titleRequiredToTrade != null)
             {
                 TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.TradingRequiresPermit, titleRequiredToTrade.GetLabelCapForBothGenders());
             }
         };
         yield return(command_Action);
     }
     if (base.Faction != Faction.OfPlayer && !PlayerKnowledgeDatabase.IsComplete(ConceptDefOf.FormCaravan))
     {
         Command_Action command_Action2 = new Command_Action();
         command_Action2.defaultLabel = "CommandFormCaravan".Translate();
         command_Action2.defaultDesc  = "CommandFormCaravanDesc".Translate();
         command_Action2.icon         = FormCaravanCommand;
         command_Action2.action       = delegate
         {
             Find.Tutor.learningReadout.TryActivateConcept(ConceptDefOf.FormCaravan);
             Messages.Message("MessageSelectOwnBaseToFormCaravan".Translate(), MessageTypeDefOf.RejectInput, historical: false);
         };
         yield return(command_Action2);
     }
 }
        private static void SetTitleForced()
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            foreach (Faction item in Find.FactionManager.AllFactions.Where((Faction f) => f.def.RoyalTitlesAwardableInSeniorityOrderForReading.Count > 0))
            {
                Faction localFaction = item;
                list.Add(new DebugMenuOption(localFaction.Name, DebugMenuOptionMode.Action, delegate
                {
                    List <DebugMenuOption> list2 = new List <DebugMenuOption>();
                    RoyalTitleDef localTitleDef  = default(RoyalTitleDef);
                    foreach (RoyalTitleDef item2 in DefDatabase <RoyalTitleDef> .AllDefsListForReading)
                    {
                        localTitleDef = item2;
                        list2.Add(new DebugMenuOption(localTitleDef.defName, DebugMenuOptionMode.Tool, delegate
                        {
                            UI.MouseCell().GetFirstPawn(Find.CurrentMap)?.royalty.SetTitle(localFaction, localTitleDef, grantRewards: true);
                        }));
                    }
                    Find.WindowStack.Add(new Dialog_DebugOptionListLister(list2));
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
Пример #16
0
        private static void PawnKindAbilityCheck()
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();
            StringBuilder          sb   = new StringBuilder();

            foreach (PawnKindDef item in from kd in DefDatabase <PawnKindDef> .AllDefs
                     where kd.titleRequired != null || !kd.titleSelectOne.NullOrEmpty()
                     orderby kd.defName
                     select kd)
            {
                PawnKindDef localKindDef = item;
                list.Add(new DebugMenuOption(localKindDef.defName, DebugMenuOptionMode.Action, delegate
                {
                    Faction faction = FactionUtility.DefaultFactionFrom(localKindDef.defaultFactionType);
                    for (int i = 0; i < 100; i++)
                    {
                        RoyalTitleDef fixedTitle = null;
                        if (localKindDef.titleRequired != null)
                        {
                            fixedTitle = localKindDef.titleRequired;
                        }
                        else if (!localKindDef.titleSelectOne.NullOrEmpty() && Rand.Chance(localKindDef.royalTitleChance))
                        {
                            fixedTitle = localKindDef.titleSelectOne.RandomElementByWeight((RoyalTitleDef t) => t.commonality);
                        }
                        Pawn pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(localKindDef, faction, PawnGenerationContext.NonPlayer, -1, forceGenerateNewPawn: false, newborn: false, allowDead: false, allowDowned: false, canGeneratePawnRelations: true, mustBeCapableOfViolence: false, 1f, forceAddFreeWarmLayerIfNeeded: false, allowGay: true, allowFood: true, allowAddictions: true, inhabitant: false, certainlyBeenInCryptosleep: false, forceRedressWorldPawnIfFormerColonist: false, worldPawnFactionDoesntMatter: false, 0f, null, 1f, null, null, null, null, null, null, null, null, null, null, null, fixedTitle));
                        RoyalTitle mostSeniorTitle = pawn.royalty.MostSeniorTitle;
                        if (mostSeniorTitle != null)
                        {
                            Hediff_Psylink mainPsylinkSource = pawn.GetMainPsylinkSource();
                            if (mainPsylinkSource == null)
                            {
                                if (mostSeniorTitle.def.MaxAllowedPsylinkLevel(faction.def) > 0)
                                {
                                    string text = mostSeniorTitle.def.LabelCap + " - No psylink.";
                                    if (pawn.abilities.abilities.Any((Ability x) => x.def.level > 0))
                                    {
                                        text += " Has psycasts without psylink.";
                                    }
                                    sb.AppendLine(text);
                                }
                            }
                            else if (mainPsylinkSource.level < mostSeniorTitle.def.MaxAllowedPsylinkLevel(faction.def))
                            {
                                sb.AppendLine("Psylink at level " + mainPsylinkSource.level + ", but requires " + mostSeniorTitle.def.MaxAllowedPsylinkLevel(faction.def));
                            }
                            else if (mainPsylinkSource.level > mostSeniorTitle.def.MaxAllowedPsylinkLevel(faction.def))
                            {
                                sb.AppendLine("Psylink at level " + mainPsylinkSource.level + ". Max is " + mostSeniorTitle.def.MaxAllowedPsylinkLevel(faction.def));
                            }
                        }
                        Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Discard);
                    }
                    if (sb.Length == 0)
                    {
                        Log.Message("No errors for " + localKindDef.defName);
                    }
                    else
                    {
                        Log.Error("Errors:\n" + sb.ToString());
                    }
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
Пример #17
0
 private static void OnPreTitleChanged(Pawn_RoyaltyTracker __instance, Faction faction, RoyalTitleDef currentTitle, RoyalTitleDef newTitle, bool sendLetter = true)
 {
     __instance.AssignHeirIfNone(newTitle, faction);
     if (currentTitle != null)
     {
         for (int i = 0; i < currentTitle.grantedAbilities.Count; i++)
         {
             __instance.pawn.abilities.RemoveAbility(currentTitle.grantedAbilities[i]);
         }
     }
 }
Пример #18
0
        private static Pawn TryGenerateNewPawnInternal(ref PawnGenerationRequest request, out string error, bool ignoreScenarioRequirements, bool ignoreValidator)
        {
            error = null;
            Pawn pawn = (Pawn)ThingMaker.MakeThing(request.KindDef.race);

            pawnsBeingGenerated.Add(new PawnGenerationStatus(pawn, null));
            try
            {
                pawn.kindDef = request.KindDef;
                pawn.SetFactionDirect(request.Faction);
                PawnComponentsUtility.CreateInitialComponents(pawn);
                if (request.FixedGender.HasValue)
                {
                    pawn.gender = request.FixedGender.Value;
                }
                else if (pawn.RaceProps.hasGenders)
                {
                    if (Rand.Value < 0.5f)
                    {
                        pawn.gender = Gender.Male;
                    }
                    else
                    {
                        pawn.gender = Gender.Female;
                    }
                }
                else
                {
                    pawn.gender = Gender.None;
                }
                GenerateRandomAge(pawn, request);
                pawn.needs.SetInitialLevels();
                if (!request.Newborn && request.CanGeneratePawnRelations)
                {
                    GeneratePawnRelations(pawn, ref request);
                }
                if (pawn.RaceProps.Humanlike)
                {
                    Faction    faction;
                    FactionDef factionType = ((request.Faction != null) ? request.Faction.def : ((!Find.FactionManager.TryGetRandomNonColonyHumanlikeFaction_NewTemp(out faction, tryMedievalOrBetter: false, allowDefeated: true)) ? Faction.OfAncients.def : faction.def));
                    pawn.story.melanin   = (request.FixedMelanin.HasValue ? request.FixedMelanin.Value : PawnSkinColors.RandomMelanin(request.Faction));
                    pawn.story.crownType = ((Rand.Value < 0.5f) ? CrownType.Average : CrownType.Narrow);
                    pawn.story.hairColor = PawnHairColors.RandomHairColor(pawn.story.SkinColor, pawn.ageTracker.AgeBiologicalYears);
                    PawnBioAndNameGenerator.GiveAppropriateBioAndNameTo(pawn, request.FixedLastName, factionType);
                    if (pawn.story != null)
                    {
                        if (request.FixedBirthName != null)
                        {
                            pawn.story.birthLastName = request.FixedBirthName;
                        }
                        else if (pawn.Name is NameTriple)
                        {
                            pawn.story.birthLastName = ((NameTriple)pawn.Name).Last;
                        }
                    }
                    pawn.story.hairDef = PawnHairChooser.RandomHairDefFor(pawn, factionType);
                    GenerateTraits(pawn, request);
                    GenerateBodyType_NewTemp(pawn, request);
                    GenerateSkills(pawn);
                }
                if (pawn.RaceProps.Animal && request.Faction != null && request.Faction.IsPlayer)
                {
                    pawn.training.SetWantedRecursive(TrainableDefOf.Tameness, checkOn: true);
                    pawn.training.Train(TrainableDefOf.Tameness, null, complete: true);
                }
                GenerateInitialHediffs(pawn, request);
                if (!request.ForbidAnyTitle)
                {
                    RoyalTitleDef royalTitleDef = request.FixedTitle;
                    if (royalTitleDef == null)
                    {
                        if (request.KindDef.titleRequired != null)
                        {
                            royalTitleDef = request.KindDef.titleRequired;
                        }
                        else if (!request.KindDef.titleSelectOne.NullOrEmpty() && Rand.Chance(request.KindDef.royalTitleChance))
                        {
                            royalTitleDef = request.KindDef.titleSelectOne.RandomElementByWeight((RoyalTitleDef t) => t.commonality);
                        }
                    }
                    if (request.KindDef.minTitleRequired != null && (royalTitleDef == null || royalTitleDef.seniority < request.KindDef.minTitleRequired.seniority))
                    {
                        royalTitleDef = request.KindDef.minTitleRequired;
                    }
                    if (royalTitleDef != null)
                    {
                        Faction faction2 = ((request.Faction != null && request.Faction.def.HasRoyalTitles) ? request.Faction : Find.FactionManager.RandomRoyalFaction());
                        pawn.royalty.SetTitle(faction2, royalTitleDef, grantRewards: false);
                        if (request.Faction != null && !request.Faction.IsPlayer)
                        {
                            PurchasePermits(pawn, faction2);
                        }
                        int amount = 0;
                        if (royalTitleDef.GetNextTitle(faction2) != null)
                        {
                            amount = Rand.Range(0, royalTitleDef.GetNextTitle(faction2).favorCost - 1);
                        }
                        pawn.royalty.SetFavor_NewTemp(faction2, amount);
                        if (royalTitleDef.maxPsylinkLevel > 0)
                        {
                            Hediff_ImplantWithLevel hediff_ImplantWithLevel = HediffMaker.MakeHediff(HediffDefOf.PsychicAmplifier, pawn, pawn.health.hediffSet.GetBrain()) as Hediff_ImplantWithLevel;
                            pawn.health.AddHediff(hediff_ImplantWithLevel);
                            hediff_ImplantWithLevel.SetLevelTo(royalTitleDef.maxPsylinkLevel);
                        }
                    }
                }
                if (pawn.royalty != null)
                {
                    pawn.royalty.allowRoomRequirements    = request.KindDef.allowRoyalRoomRequirements;
                    pawn.royalty.allowApparelRequirements = request.KindDef.allowRoyalApparelRequirements;
                }
                if (pawn.workSettings != null && request.Faction != null && request.Faction.IsPlayer)
                {
                    pawn.workSettings.EnableAndInitialize();
                }
                if (request.Faction != null && pawn.RaceProps.Animal)
                {
                    pawn.GenerateNecessaryName();
                }
                if (Find.Scenario != null)
                {
                    Find.Scenario.Notify_NewPawnGenerating(pawn, request.Context);
                }
                if (!request.AllowDead && (pawn.Dead || pawn.Destroyed))
                {
                    DiscardGeneratedPawn(pawn);
                    error = "Generated dead pawn.";
                    return(null);
                }
                if (!request.AllowDowned && pawn.Downed)
                {
                    DiscardGeneratedPawn(pawn);
                    error = "Generated downed pawn.";
                    return(null);
                }
                if (request.MustBeCapableOfViolence && ((pawn.story != null && pawn.WorkTagIsDisabled(WorkTags.Violent)) || (pawn.RaceProps.ToolUser && !pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation))))
                {
                    DiscardGeneratedPawn(pawn);
                    error = "Generated pawn incapable of violence.";
                    return(null);
                }
                if (request.KindDef != null && !request.KindDef.skills.NullOrEmpty())
                {
                    List <SkillRange> skills = request.KindDef.skills;
                    for (int i = 0; i < skills.Count; i++)
                    {
                        if (pawn.skills.GetSkill(skills[i].Skill).TotallyDisabled)
                        {
                            error = "Generated pawn incapable of required skill: " + skills[i].Skill.defName;
                            return(null);
                        }
                    }
                }
                if (request.KindDef.requiredWorkTags != 0 && (pawn.CombinedDisabledWorkTags & request.KindDef.requiredWorkTags) != 0)
                {
                    DiscardGeneratedPawn(pawn);
                    error = "Generated pawn with disabled requiredWorkTags.";
                    return(null);
                }
                if (!ignoreScenarioRequirements && request.Context == PawnGenerationContext.PlayerStarter && Find.Scenario != null && !Find.Scenario.AllowPlayerStartingPawn(pawn, tryingToRedress: false, request))
                {
                    DiscardGeneratedPawn(pawn);
                    error = "Generated pawn doesn't meet scenario requirements.";
                    return(null);
                }
                if (!ignoreValidator && request.ValidatorPreGear != null && !request.ValidatorPreGear(pawn))
                {
                    DiscardGeneratedPawn(pawn);
                    error = "Generated pawn didn't pass validator check (pre-gear).";
                    return(null);
                }
                if (!request.Newborn)
                {
                    GenerateGearFor(pawn, request);
                }
                if (!ignoreValidator && request.ValidatorPostGear != null && !request.ValidatorPostGear(pawn))
                {
                    DiscardGeneratedPawn(pawn);
                    error = "Generated pawn didn't pass validator check (post-gear).";
                    return(null);
                }
                for (int j = 0; j < pawnsBeingGenerated.Count - 1; j++)
                {
                    if (pawnsBeingGenerated[j].PawnsGeneratedInTheMeantime == null)
                    {
                        pawnsBeingGenerated[j] = new PawnGenerationStatus(pawnsBeingGenerated[j].Pawn, new List <Pawn>());
                    }
                    pawnsBeingGenerated[j].PawnsGeneratedInTheMeantime.Add(pawn);
                }
                return(pawn);
            }
            finally
            {
                pawnsBeingGenerated.RemoveLast();
            }
        }
Пример #19
0
 public DefHyperlink(RoyalTitleDef def, Faction faction)
 {
     this.def     = def;
     this.faction = faction;
 }
 public Dialog_InfoCard(RoyalTitleDef titleDef, Faction faction)
 {
     this.titleDef = titleDef;
     this.faction  = faction;
     Setup();
 }
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            //if(this.wo != null)
            //{
            //    this.wo.interactable = false;
            //}

            if (parms.target is Map)
            {
                return(IncidentDefOf.TravelerGroup.Worker.TryExecute(parms));
            }
            Caravan caravan         = (Caravan)parms.target;
            Faction faction         = parms.faction;
            bool    factionCanTrade = WorldUtility.FactionCanTrade(parms.faction);
            //if (parms.faction != null && factionCanTrade)
            //{
            //    faction = parms.faction;
            //}
            //else
            //{
            //    return false;
            //}
            List <Pawn> list = GenerateCaravanPawns(faction, wo.RimWarPoints);

            if (!list.Any())
            {
                Log.Error("IncidentWorker_CaravanMeeting could not generate any pawns.");
                return(false);
            }
            Caravan metCaravan      = CaravanMaker.MakeCaravan(list, faction, -1, addToWorldPawnsIfNotAlready: false);
            bool    hostileToPlayer = faction.HostileTo(Faction.OfPlayer);

            CameraJumper.TryJumpAndSelect(caravan);
            DiaNode diaNode = new DiaNode((string)"CaravanMeeting".Translate(caravan.Name, faction.Name, PawnUtility.PawnKindsToLineList(from x in metCaravan.PawnsListForReading
                                                                                                                                         select x.kindDef, "  - ")).CapitalizeFirst());
            Pawn bestPlayerNegotiator = BestCaravanPawnUtility.FindBestNegotiator(caravan, faction, metCaravan.TraderKind);

            if (metCaravan.CanTradeNow)
            {
                DiaOption diaOption = new DiaOption("CaravanMeeting_Trade".Translate());
                diaOption.action = delegate
                {
                    Find.WindowStack.Add(new Dialog_Trade(bestPlayerNegotiator, metCaravan));
                    PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter_Send(metCaravan.Goods.OfType <Pawn>(), "LetterRelatedPawnsTradingWithOtherCaravan".Translate(Faction.OfPlayer.def.pawnsPlural), LetterDefOf.NeutralEvent);
                };
                if (bestPlayerNegotiator == null)
                {
                    if (metCaravan.TraderKind.permitRequiredForTrading != null && !caravan.pawns.Any(delegate(Pawn p)
                    {
                        if (p.royalty != null)
                        {
                            return(p.royalty.HasPermit(metCaravan.TraderKind.permitRequiredForTrading, faction));
                        }
                        return(false);
                    }))
                    {
                        RoyalTitleDef royalTitleDef = faction.def.RoyalTitlesAwardableInSeniorityOrderForReading.First(delegate(RoyalTitleDef t)
                        {
                            if (t.permits != null)
                            {
                                return(t.permits.Contains(metCaravan.TraderKind.permitRequiredForTrading));
                            }
                            return(false);
                        });
                        diaOption.Disable("CaravanMeeting_NoPermit".Translate(royalTitleDef.GetLabelForBothGenders(), faction).Resolve());
                    }
                    else if (hostileToPlayer)
                    {
                        diaOption.Disable("RW_CaravanMeeting_TradeUnwilling".Translate(faction.Name));
                    }
                    else
                    {
                        diaOption.Disable("CaravanMeeting_TradeIncapable".Translate());
                    }
                }
                else if (!factionCanTrade)
                {
                    diaOption.Disable("RW_CaravanMeeting_FactionIncapableOfTrade".Translate());
                }
                diaNode.options.Add(diaOption);
            }
            DiaOption diaOption2 = new DiaOption("CaravanMeeting_Attack".Translate());

            diaOption2.action = delegate
            {
                LongEventHandler.QueueLongEvent(delegate
                {
                    Pawn t2 = caravan.PawnsListForReading[0];
                    faction.TrySetRelationKind(Faction.OfPlayer, FactionRelationKind.Hostile, true, "GoodwillChangedReason_AttackedCaravan".Translate(), t2);
                    Map map = CaravanIncidentUtility.GetOrGenerateMapForIncident(caravan, new IntVec3(100, 1, 100), WorldObjectDefOf.AttackedNonPlayerCaravan);
                    map.Parent.SetFaction(faction);
                    MultipleCaravansCellFinder.FindStartingCellsFor2Groups(map, out IntVec3 playerSpot, out IntVec3 enemySpot);
                    CaravanEnterMapUtility.Enter(caravan, map, (Pawn p) => CellFinder.RandomClosewalkCellNear(playerSpot, map, 12), CaravanDropInventoryMode.DoNotDrop, draftColonists: true);
                    List <Pawn> list2 = metCaravan.PawnsListForReading.ToList();
                    CaravanEnterMapUtility.Enter(metCaravan, map, (Pawn p) => CellFinder.RandomClosewalkCellNear(enemySpot, map, 12));
                    LordMaker.MakeNewLord(faction, new LordJob_DefendAttackedTraderCaravan(list2[0].Position), map, list2);
                    Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
                    CameraJumper.TryJumpAndSelect(t2);
                    PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter_Send(list2, "LetterRelatedPawnsGroupGeneric".Translate(Faction.OfPlayer.def.pawnsPlural), LetterDefOf.NeutralEvent, informEvenIfSeenBefore: true);
                    wo.Destroy();
                }, "GeneratingMapForNewEncounter", false, null);
Пример #22
0
        private static bool IsValidCandidateToRedress(Pawn pawn, PawnGenerationRequest request)
        {
            if (pawn.def != request.KindDef.race)
            {
                return(false);
            }
            if (!request.WorldPawnFactionDoesntMatter && pawn.Faction != request.Faction)
            {
                return(false);
            }
            if (!request.AllowDead)
            {
                if (pawn.Dead || pawn.Destroyed)
                {
                    return(false);
                }
                if (pawn.health.hediffSet.GetBrain() == null)
                {
                    return(false);
                }
            }
            if (!request.AllowDowned && pawn.Downed)
            {
                return(false);
            }
            if (pawn.health.hediffSet.BleedRateTotal > 0.001f)
            {
                return(false);
            }
            if (!request.CanGeneratePawnRelations && pawn.RaceProps.IsFlesh && pawn.relations.RelatedToAnyoneOrAnyoneRelatedToMe)
            {
                return(false);
            }
            if (!request.AllowGay && pawn.RaceProps.Humanlike && pawn.story.traits.HasTrait(TraitDefOf.Gay))
            {
                return(false);
            }
            if (!request.AllowAddictions && AddictionUtility.AddictedToAnything(pawn))
            {
                return(false);
            }
            if (request.ProhibitedTraits != null && request.ProhibitedTraits.Any((TraitDef t) => pawn.story.traits.HasTrait(t)))
            {
                return(false);
            }
            List <SkillRange> skills = request.KindDef.skills;

            if (skills != null)
            {
                for (int i = 0; i < skills.Count; i++)
                {
                    SkillRecord skill = pawn.skills.GetSkill(skills[i].Skill);
                    if (skill.TotallyDisabled)
                    {
                        return(false);
                    }
                    if (skill.Level < skills[i].Range.min || skill.Level > skills[i].Range.max)
                    {
                        return(false);
                    }
                }
            }
            if (request.ForcedTraits != null)
            {
                foreach (TraitDef forcedTrait in request.ForcedTraits)
                {
                    if (!pawn.story.traits.HasTrait(forcedTrait))
                    {
                        return(false);
                    }
                }
            }
            if (request.ValidatorPreGear != null && !request.ValidatorPreGear(pawn))
            {
                return(false);
            }
            if (request.ValidatorPostGear != null && !request.ValidatorPostGear(pawn))
            {
                return(false);
            }
            if (request.FixedBiologicalAge.HasValue && pawn.ageTracker.AgeBiologicalYearsFloat != request.FixedBiologicalAge)
            {
                return(false);
            }
            if (request.FixedChronologicalAge.HasValue && (float)pawn.ageTracker.AgeChronologicalYears != request.FixedChronologicalAge)
            {
                return(false);
            }
            if (request.FixedGender.HasValue && pawn.gender != request.FixedGender)
            {
                return(false);
            }
            if (request.FixedLastName != null && (!(pawn.Name is NameTriple) || ((NameTriple)pawn.Name).Last != request.FixedLastName))
            {
                return(false);
            }
            if (request.FixedMelanin.HasValue && pawn.story != null && pawn.story.melanin != request.FixedMelanin)
            {
                return(false);
            }
            if (request.FixedTitle != null && (pawn.royalty == null || !pawn.royalty.HasTitle(request.FixedTitle)))
            {
                return(false);
            }
            if (request.KindDef.minTitleRequired != null)
            {
                if (pawn.royalty == null)
                {
                    return(false);
                }
                RoyalTitleDef royalTitleDef = pawn.royalty.MainTitle();
                if (royalTitleDef == null || royalTitleDef.seniority < request.KindDef.minTitleRequired.seniority)
                {
                    return(false);
                }
            }
            if (request.Context == PawnGenerationContext.PlayerStarter && Find.Scenario != null && !Find.Scenario.AllowPlayerStartingPawn(pawn, tryingToRedress: true, request))
            {
                return(false);
            }
            if (request.MustBeCapableOfViolence)
            {
                if (pawn.WorkTagIsDisabled(WorkTags.Violent))
                {
                    return(false);
                }
                if (pawn.RaceProps.ToolUser && !pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation))
                {
                    return(false);
                }
            }
            if (request.RedressValidator != null && !request.RedressValidator(pawn))
            {
                return(false);
            }
            if (request.KindDef.requiredWorkTags != 0 && pawn.kindDef != request.KindDef && (pawn.CombinedDisabledWorkTags & request.KindDef.requiredWorkTags) != 0)
            {
                return(false);
            }
            return(true);
        }
Пример #23
0
        protected override void RunInt()
        {
            if (!ModLister.RoyaltyInstalled)
            {
                Log.ErrorOnce("Bestowing ceremony is a Royalty-specific game system. If you want to use this code please check ModLister.RoyaltyInstalled before calling it. See rules on the Ludeon forum for more info.", 3454535);
                return;
            }
            Quest quest = QuestGen.quest;
            Slate slate = QuestGen.slate;

            if (!TryGetCeremonyTarget(QuestGen.slate, out var pawn, out var bestowingFaction))
            {
                return;
            }
            RoyalTitleDef titleAwardedWhenUpdating = pawn.royalty.GetTitleAwardedWhenUpdating(bestowingFaction, pawn.royalty.GetFavor(bestowingFaction));
            string        text      = QuestGenUtility.HardcodedTargetQuestTagWithQuestID("Bestowing");
            string        text2     = QuestGenUtility.QuestTagSignal(text, "CeremonyExpired");
            string        inSignal  = QuestGenUtility.QuestTagSignal(text, "CeremonyFailed");
            string        inSignal2 = QuestGenUtility.QuestTagSignal(text, "CeremonyDone");
            string        inSignal3 = QuestGenUtility.QuestTagSignal(text, "TitleAwardedWhenUpdatingChanged");
            Thing         thing     = QuestGen_Shuttle.GenerateShuttle(bestowingFaction, null, null, acceptColonists: false, onlyAcceptColonists: false, onlyAcceptHealthy: false, 0, dropEverythingIfUnsatisfied: false, leaveImmediatelyWhenSatisfied: true, dropEverythingOnArrival: true, stayAfterDroppedEverythingOnArrival: true);
            Pawn          pawn2     = quest.GetPawn(new QuestGen_Pawns.GetPawnParms
            {
                mustBeOfKind    = PawnKindDefOf.Empire_Royal_Bestower,
                canGeneratePawn = true,
                mustBeOfFaction = bestowingFaction,
                mustBeWorldPawn = true
            });

            QuestUtility.AddQuestTag(ref thing.questTags, text);
            QuestUtility.AddQuestTag(ref pawn.questTags, text);
            ThingOwner <Thing> innerContainer = pawn2.inventory.innerContainer;

            for (int num = innerContainer.Count - 1; num >= 0; num--)
            {
                if (innerContainer[num].def == ThingDefOf.PsychicAmplifier)
                {
                    Thing thing2 = innerContainer[num];
                    innerContainer.RemoveAt(num);
                    thing2.Destroy();
                }
            }
            int num2 = titleAwardedWhenUpdating.maxPsylinkLevel - pawn.GetPsylinkLevel();

            for (int i = 0; i < num2 + 1; i++)
            {
                innerContainer.TryAdd(ThingMaker.MakeThing(ThingDefOf.PsychicAmplifier), 1);
            }
            List <Pawn> list = new List <Pawn>();

            list.Add(pawn2);
            slate.Set("shuttleContents", list);
            slate.Set("shuttle", thing);
            slate.Set("target", pawn);
            slate.Set("bestowingFaction", bestowingFaction);
            List <Pawn> list2 = new List <Pawn>();

            for (int j = 0; j < 6; j++)
            {
                Pawn item = quest.GeneratePawn(PawnKindDefOf.Empire_Fighter_Janissary, bestowingFaction);
                list.Add(item);
                list2.Add(item);
            }
            slate.Set("defenders", list2);
            CompShuttle compShuttle = thing.TryGetComp <CompShuttle>();

            compShuttle.requiredPawns          = list;
            compShuttle.sendAwayIfAllDespawned = list.Cast <Thing>().ToList();
            compShuttle.sendAwayIfAllPawnsLeftToLoadAreNotOfFaction = bestowingFaction;
            quest.AddContentsToShuttle(thing, list);
            quest.SpawnSkyfaller(null, ThingDefOf.ShuttleIncoming, Gen.YieldSingle(thing), Faction.OfPlayer, null, null, lookForSafeSpot: true, tryLandInShipLandingZone: true, null, pawn);
            quest.FactionGoodwillChange(bestowingFaction, -5, QuestGenUtility.HardcodedSignalWithQuestID("defenders.Killed"), canSendMessage: true, canSendHostilityLetter: true, "GoodwillChangeReason_AttackedFaction".Translate(bestowingFaction));
            QuestPart_BestowingCeremony questPart_BestowingCeremony = new QuestPart_BestowingCeremony();

            questPart_BestowingCeremony.inSignal = QuestGen.slate.Get <string>("inSignal");
            questPart_BestowingCeremony.pawns.Add(pawn2);
            questPart_BestowingCeremony.mapOfPawn = pawn;
            questPart_BestowingCeremony.faction   = pawn2.Faction;
            questPart_BestowingCeremony.bestower  = pawn2;
            questPart_BestowingCeremony.target    = pawn;
            questPart_BestowingCeremony.shuttle   = thing;
            questPart_BestowingCeremony.questTag  = text;
            quest.AddPart(questPart_BestowingCeremony);
            QuestPart_EscortPawn questPart_EscortPawn = new QuestPart_EscortPawn();

            questPart_EscortPawn.inSignal = QuestGen.slate.Get <string>("inSignal");
            questPart_EscortPawn.escortee = pawn2;
            questPart_EscortPawn.pawns.AddRange(list2);
            questPart_EscortPawn.mapOfPawn = pawn;
            questPart_EscortPawn.faction   = pawn2.Faction;
            questPart_EscortPawn.shuttle   = thing;
            quest.AddPart(questPart_EscortPawn);
            string inSignal4 = QuestGenUtility.HardcodedSignalWithQuestID("shuttle.Killed");

            quest.SetFactionRelations(bestowingFaction, FactionRelationKind.Hostile, inSignal4);
            quest.End(QuestEndOutcome.Fail, 0, null, inSignal4, QuestPart.SignalListenMode.OngoingOnly, sendStandardLetter: true);
            QuestPart_RequirementsToAcceptThroneRoom questPart_RequirementsToAcceptThroneRoom = new QuestPart_RequirementsToAcceptThroneRoom();

            questPart_RequirementsToAcceptThroneRoom.faction  = bestowingFaction;
            questPart_RequirementsToAcceptThroneRoom.forPawn  = pawn;
            questPart_RequirementsToAcceptThroneRoom.forTitle = titleAwardedWhenUpdating;
            quest.AddPart(questPart_RequirementsToAcceptThroneRoom);
            QuestPart_RequirementsToAcceptPawnOnColonyMap questPart_RequirementsToAcceptPawnOnColonyMap = new QuestPart_RequirementsToAcceptPawnOnColonyMap();

            questPart_RequirementsToAcceptPawnOnColonyMap.pawn = pawn;
            quest.AddPart(questPart_RequirementsToAcceptPawnOnColonyMap);
            QuestPart_RequirementsToAcceptNoDanger questPart_RequirementsToAcceptNoDanger = new QuestPart_RequirementsToAcceptNoDanger();

            questPart_RequirementsToAcceptNoDanger.map      = pawn.Map;
            questPart_RequirementsToAcceptNoDanger.dangerTo = bestowingFaction;
            quest.AddPart(questPart_RequirementsToAcceptNoDanger);
            string inSignal5 = QuestGenUtility.HardcodedSignalWithQuestID("shuttleContents.Recruited");
            string inSignal6 = QuestGenUtility.HardcodedSignalWithQuestID("bestowingFaction.BecameHostileToPlayer");

            quest.Signal(inSignal5, delegate
            {
                quest.End(QuestEndOutcome.Fail, 0, null, null, QuestPart.SignalListenMode.OngoingOnly, sendStandardLetter: true);
            });
            quest.End(QuestEndOutcome.Fail, 0, null, QuestGenUtility.HardcodedSignalWithQuestID("target.Killed"), QuestPart.SignalListenMode.OngoingOrNotYetAccepted, sendStandardLetter: true);
            quest.Letter(LetterDefOf.NegativeEvent, text2, null, null, null, useColonistsFromCaravanArg: false, QuestPart.SignalListenMode.OngoingOnly, null, filterDeadPawnsFromLookTargets: false, label: "LetterLabelBestowingCeremonyExpired".Translate(), text: "LetterTextBestowingCeremonyExpired".Translate(pawn.Named("TARGET")));
            quest.End(QuestEndOutcome.Fail, 0, null, text2);
            quest.End(QuestEndOutcome.Fail, 0, null, inSignal6, QuestPart.SignalListenMode.OngoingOrNotYetAccepted, sendStandardLetter: true);
            quest.End(QuestEndOutcome.Fail, 0, null, inSignal, QuestPart.SignalListenMode.OngoingOnly, sendStandardLetter: true);
            quest.End(QuestEndOutcome.Fail, 0, null, inSignal3, QuestPart.SignalListenMode.OngoingOrNotYetAccepted, sendStandardLetter: true);
            quest.End(QuestEndOutcome.Success, 0, null, inSignal2);
            QuestPart_Choice questPart_Choice = quest.RewardChoice();

            QuestPart_Choice.Choice item2 = new QuestPart_Choice.Choice
            {
                rewards =
                {
                    (Reward) new Reward_BestowingCeremony
                    {
                        targetPawnName  = pawn.NameShortColored.Resolve(),
                        titleName       = titleAwardedWhenUpdating.GetLabelCapFor(pawn),
                        awardingFaction = bestowingFaction,
                        givePsylink     = (titleAwardedWhenUpdating.maxPsylinkLevel > pawn.GetPsylinkLevel()),
                        royalTitle      = titleAwardedWhenUpdating
                    }
                }
            };
            questPart_Choice.choices.Add(item2);
            List <Rule> list3 = new List <Rule>();

            list3.AddRange(GrammarUtility.RulesForPawn("pawn", pawn));
            list3.Add(new Rule_String("newTitle", titleAwardedWhenUpdating.GetLabelCapFor(pawn)));
            QuestGen.AddQuestNameRules(list3);
            List <Rule> list4 = new List <Rule>();

            list4.AddRange(GrammarUtility.RulesForFaction("faction", bestowingFaction));
            list4.AddRange(GrammarUtility.RulesForPawn("pawn", pawn));
            list4.Add(new Rule_String("newTitle", pawn.royalty.GetTitleAwardedWhenUpdating(bestowingFaction, pawn.royalty.GetFavor(bestowingFaction)).GetLabelFor(pawn)));
            list4.Add(new Rule_String("psylinkLevel", titleAwardedWhenUpdating.maxPsylinkLevel.ToString()));
            QuestGen.AddQuestDescriptionRules(list4);
        }