private static string GetRelationsString(SocialCardUtility.CachedSocialTabEntry entry, Pawn selPawnForSocialInfo) { string text = string.Empty; if (entry.relations.Count != 0) { for (int i = 0; i < entry.relations.Count; i++) { PawnRelationDef pawnRelationDef = entry.relations[i]; if (!text.NullOrEmpty()) { text = text + ", " + pawnRelationDef.GetGenderSpecificLabel(entry.otherPawn); } else { text = pawnRelationDef.GetGenderSpecificLabelCap(entry.otherPawn); } } return(text); } if (entry.opinionOfOtherPawn < -20) { return("Rival".Translate()); } if (entry.opinionOfOtherPawn > 20) { return("Friend".Translate()); } return("Acquaintance".Translate()); }
protected override bool TryExecuteWorker(IncidentParms parms) { int tile; if (!this.TryFindTile(out tile)) { return(false); } Site site = SiteMaker.TryMakeSite_SingleSitePart(SiteCoreDefOf.DownedRefugee, (!Rand.Chance(0.3f)) ? "DownedRefugeeQuestThreat" : null, tile, null, true, null, true, null); if (site == null) { return(false); } site.sitePartsKnown = true; Pawn pawn = DownedRefugeeQuestUtility.GenerateRefugee(tile); site.GetComponent <DownedRefugeeComp>().pawn.TryAdd(pawn, true); int randomInRange = SiteTuning.QuestSiteRefugeeTimeoutDaysRange.RandomInRange; site.GetComponent <TimeoutComp>().StartTimeout(randomInRange * 60000); Find.WorldObjects.Add(site); string text = this.def.letterLabel; string text2 = string.Format(this.def.letterText.AdjustedFor(pawn, "PAWN"), new object[] { randomInRange, pawn.ageTracker.AgeBiologicalYears, pawn.story.Title, SitePartUtility.GetDescriptionDialogue(site, site.parts.FirstOrDefault <SitePart>()) }).CapitalizeFirst(); Pawn mostImportantColonyRelative = PawnRelationUtility.GetMostImportantColonyRelative(pawn); if (mostImportantColonyRelative != null) { PawnRelationDef mostImportantRelation = mostImportantColonyRelative.GetMostImportantRelation(pawn); if (mostImportantRelation != null && mostImportantRelation.opinionOffset > 0) { pawn.relations.relativeInvolvedInRescueQuest = mostImportantColonyRelative; text2 = text2 + "\n\n" + "RelatedPawnInvolvedInQuest".Translate(new object[] { mostImportantColonyRelative.LabelShort, mostImportantRelation.GetGenderSpecificLabel(pawn) }).AdjustedFor(pawn, "PAWN"); } else { PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text2, pawn); } text = text + " " + "RelationshipAppendedLetterSuffix".Translate(); } if (pawn.relations != null) { pawn.relations.everSeenByPlayer = true; } Find.LetterStack.ReceiveLetter(text, text2, this.def.letterDef, site, null, null); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { int tile; if (!this.TryFindTile(out tile)) { return(false); } Site site = SiteMaker.TryMakeSite_SingleSitePart(SiteCoreDefOf.DownedRefugee, (!Rand.Chance(0.3f)) ? IncidentWorker_QuestDownedRefugee.DownedRefugeeQuestThreatTag : null, null, true, null); if (site == null) { return(false); } site.Tile = tile; Pawn pawn = DownedRefugeeQuestUtility.GenerateRefugee(tile); site.GetComponent <DownedRefugeeComp>().pawn.TryAdd(pawn, true); int randomInRange = IncidentWorker_QuestDownedRefugee.TimeoutDaysRange.RandomInRange; site.GetComponent <TimeoutComp>().StartTimeout(randomInRange * 60000); Find.WorldObjects.Add(site); string text = string.Format(this.def.letterText.AdjustedFor(pawn), pawn.Label, randomInRange).CapitalizeFirst(); Pawn mostImportantColonyRelative = PawnRelationUtility.GetMostImportantColonyRelative(pawn); if (mostImportantColonyRelative != null) { PawnRelationDef mostImportantRelation = mostImportantColonyRelative.GetMostImportantRelation(pawn); if (mostImportantRelation != null && mostImportantRelation.opinionOffset > 0) { pawn.relations.relativeInvolvedInRescueQuest = mostImportantColonyRelative; text = text + "\n\n" + "RelatedPawnInvolvedInQuest".Translate(new object[] { mostImportantColonyRelative.LabelShort, mostImportantRelation.GetGenderSpecificLabel(pawn) }).AdjustedFor(pawn); } else { PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, pawn); } } if (pawn.relations != null) { pawn.relations.everSeenByPlayer = true; } Find.LetterStack.ReceiveLetter(this.def.letterLabel, text, this.def.letterDef, site, null); return(true); }
private static string GetRelationsString(CachedSocialTabEntry entry, Pawn selPawnForSocialInfo) { string text = ""; if (entry.relations.Count == 0) { if (entry.opinionOfOtherPawn < -20) { return("Rival".Translate()); } if (entry.opinionOfOtherPawn > 20) { return("Friend".Translate()); } return("Acquaintance".Translate()); } for (int i = 0; i < entry.relations.Count; i++) { PawnRelationDef pawnRelationDef = entry.relations[i]; text = (text.NullOrEmpty() ? pawnRelationDef.GetGenderSpecificLabelCap(entry.otherPawn) : (text + ", " + pawnRelationDef.GetGenderSpecificLabel(entry.otherPawn))); } return(text); }