protected override bool TryExecuteWorker(IncidentParms parms) { int tile; if (!this.TryFindTile(out tile)) { return(false); } Site site = SiteMaker.TryMakeSite_SingleSitePart(SiteCoreDefOf.PrisonerWillingToJoin, "PrisonerRescueQuestThreat", tile, null, true, null, true, null); if (site == null) { return(false); } site.sitePartsKnown = true; Pawn pawn = PrisonerWillingToJoinQuestUtility.GeneratePrisoner(tile, site.Faction); site.GetComponent <PrisonerWillingToJoinComp>().pawn.TryAdd(pawn, true); int randomInRange = SiteTuning.QuestSiteTimeoutDaysRange.RandomInRange; site.GetComponent <TimeoutComp>().StartTimeout(randomInRange * 60000); Find.WorldObjects.Add(site); string text; string label; this.GetLetterText(pawn, site, site.parts.FirstOrDefault <SitePart>(), randomInRange, out text, out label); Find.LetterStack.ReceiveLetter(label, text, this.def.letterDef, site, site.Faction, null); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { int tile = default(int); if (!this.TryFindTile(out tile)) { return(false); } Site site = SiteMaker.TryMakeSite_SingleSitePart(SiteCoreDefOf.PrisonerWillingToJoin, IncidentWorker_QuestPrisonerWillingToJoin.PrisonerWillingToJoinQuestThreatTag, null, true, null); if (site == null) { return(false); } site.Tile = tile; Pawn pawn = PrisonerWillingToJoinQuestUtility.GeneratePrisoner(tile, site.Faction); ((WorldObject)site).GetComponent <PrisonerWillingToJoinComp>().pawn.TryAdd(pawn, true); int randomInRange = IncidentWorker_QuestPrisonerWillingToJoin.TimeoutDaysRange.RandomInRange; ((WorldObject)site).GetComponent <TimeoutComp>().StartTimeout(randomInRange * 60000); Find.WorldObjects.Add(site); Find.LetterStack.ReceiveLetter(base.def.letterLabel, this.GetLetterText(pawn, site.Faction, randomInRange), base.def.letterDef, site, null); return(true); }
private void FoundMinerals(Pawn worker) { this.daysWorkingSinceLastMinerals = 0f; IntRange preciousLumpSiteDistanceRange = SiteTuning.PreciousLumpSiteDistanceRange; int min = preciousLumpSiteDistanceRange.min; int max = preciousLumpSiteDistanceRange.max; int tile = this.parent.Tile; int tile2; if (!TileFinder.TryFindNewSiteTile(out tile2, min, max, false, true, tile)) { return; } Site site = SiteMaker.TryMakeSite_SingleSitePart(SiteCoreDefOf.PreciousLump, (!Rand.Chance(0.6f)) ? "MineralScannerPreciousLumpThreat" : null, tile2, null, true, null, true, null); if (site != null) { site.sitePartsKnown = true; site.core.parms.preciousLumpResources = this.targetMineable; int randomInRange = SiteTuning.MineralScannerPreciousLumpTimeoutDaysRange.RandomInRange; site.GetComponent <TimeoutComp>().StartTimeout(randomInRange * 60000); Find.WorldObjects.Add(site); Find.LetterStack.ReceiveLetter("LetterLabelFoundPreciousLump".Translate(), "LetterFoundPreciousLump".Translate(this.targetMineable.label, randomInRange, SitePartUtility.GetDescriptionDialogue(site, site.parts.FirstOrDefault <SitePart>()).CapitalizeFirst(), worker.LabelShort, worker.Named("WORKER")), LetterDefOf.PositiveEvent, site, null, null); } }
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 void FoundMinerals() { int tile = base.parent.Tile; int tile2 = default(int); if (TileFinder.TryFindNewSiteTile(out tile2, 8, 30, false, true, tile)) { Site site = SiteMaker.TryMakeSite_SingleSitePart(SiteCoreDefOf.PreciousLump, (!Rand.Chance(0.6f)) ? CompLongRangeMineralScanner.MineralScannerPreciousLumpThreatTag : null, null, true, null); if (site != null) { site.Tile = tile2; Find.WorldObjects.Add(site); Find.LetterStack.ReceiveLetter("LetterLabelFoundPreciousLump".Translate(), "LetterFoundPreciousLump".Translate(), LetterDefOf.PositiveEvent, site, null); } } }