// Token: 0x06000075 RID: 117 RVA: 0x00004B08 File Offset: 0x00002D08 private string GetLetterText(Faction alliedFaction, List <Thing> items, int days, Site site, SitePart sitePart) { string result = GrammarResolverSimpleStringExtensions.Formatted(this.def.letterText, alliedFaction.leader.LabelShort, alliedFaction.def.leaderTitle, alliedFaction.Name, GenLabel.ThingsLabel(items, " - "), days.ToString(), SitePartUtility.GetDescriptionDialogue(site, sitePart), GenThing.GetMarketValue(items).ToStringMoney(null)).CapitalizeFirst(); GenThing.TryAppendSingleRewardInfo(ref result, items); return(result); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; IEnumerable <Pawn> freeColonists = map.mapPawns.FreeColonists; Func <Pawn, bool> predicate; bool flag = (predicate = MOIncidentWorker_Nausea.nausea.instancePawn) == null; if (flag) { predicate = (MOIncidentWorker_Nausea.nausea.instancePawn = new Func <Pawn, bool>(MOIncidentWorker_Nausea.nausea.IncidentNausea.TryExecute)); } Pawn pawn = null; bool flag2 = GenCollection.TryRandomElement <Pawn>(freeColonists.Where(predicate), out pawn); bool flag3 = flag2; bool result; if (flag3) { pawn.needs.rest.CurLevel = 0.1f; pawn.jobs.EndCurrentJob(JobCondition.Succeeded, true); pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDef.Named("MO_Nauseated"), null); Find.LetterStack.ReceiveLetter("MO_Nausea".Translate(), GrammarResolverSimpleStringExtensions.Formatted(Translator .Translate("MO_NauseaDesc"), NamedArgumentUtility.Named(pawn, "PAWN")) .AdjustedFor(pawn, "PAWN", true), LetterDefOf.NegativeEvent, pawn, null); //pawn.Name + " is feeling nauseous. He vomited all over and needs rest.", LetterDefOf.NegativeEvent, pawn, null); //pawn.Name + " is feeling nauseous. She vomited all over and needs rest.", LetterDefOf.NegativeEvent, pawn, null); int num; for (int i = 0; i < 10; i = num + 1) { IntVec3 intVec = CellFinder.RandomClosewalkCellNear(pawn.Position, map, 3); ThingDef named = DefDatabase <ThingDef> .GetNamed("Filth_Vomit", true); FilthMaker.TryMakeFilth(intVec, map, named, 1); num = i; } result = true; } else { result = true; } return(result); }
// Token: 0x060000B1 RID: 177 RVA: 0x000061A4 File Offset: 0x000043A4 protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; IntVec3 loc; if (!this.TryFindEntryCell(map, out loc)) { return(false); } Gender?gender = null; if (this.def.pawnFixedGender != Gender.None) { gender = new Gender?(this.def.pawnFixedGender); } PawnKindDef pawnKindDef = this.def.pawnKind; Faction ofPlayer = Faction.OfPlayer; List <PawnKindDef> list = (from def in DefDatabase <PawnKindDef> .AllDefs where def.race == ofPlayer.def.basicMemberKind.race && def.defName.Contains("BKRescuer") select def).ToList <PawnKindDef>(); if (list.Count > 0) { pawnKindDef = list.RandomElement <PawnKindDef>(); } else { list = (from def in DefDatabase <PawnKindDef> .AllDefs where def.defName.Contains("BKRescuer") select def).ToList <PawnKindDef>(); pawnKindDef = list.RandomElement <PawnKindDef>(); } pawnKindDef.defaultFactionType = ofPlayer.def; bool pawnMustBeCapableOfViolence = this.def.pawnMustBeCapableOfViolence; Gender?gender2 = gender; Pawn pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(pawnKindDef, ofPlayer, PawnGenerationContext.NonPlayer, -1, true, false, false, false, true, pawnMustBeCapableOfViolence, 20f, false, true, true, false, false, false, false, false, 0, null, 1, null, null, null, null, null, null, null, gender2, null, null)); GenSpawn.Spawn(pawn, loc, map, WipeMode.Vanish); TaggedString text = GenText.AdjustedFor(GrammarResolverSimpleStringExtensions.Formatted(this.def.letterText, pawn.Named("PAWN")), pawn, "PAWN"); TaggedString text2 = GenText.AdjustedFor(GrammarResolverSimpleStringExtensions.Formatted(this.def.letterLabel, pawn.Named("PAWN")), pawn, "PAWN"); PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, ref text2, pawn); Find.LetterStack.ReceiveLetter(text2, text, LetterDefOf.PositiveEvent, pawn, null, null); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = parms.target as Map; bool result; if (this.GetHasGoodStoryConditions(map)) { Pawn pawn; if (!this.CanFindPsychic(map, out pawn)) { result = false; } else { int randomInRange = IncidentWorker_OsirisCasket.TimeoutDaysRange.RandomInRange; int tile; if (TileFinder.TryFindNewSiteTile(out tile)) { Site site = (Site)WorldObjectMaker.MakeWorldObject(SiteDefOfReconAndDiscovery.RD_Adventure); site.Tile = tile; Faction faction = Faction.OfInsects; site.SetFaction(faction); site.AddPart(new SitePart(site, SiteDefOfReconAndDiscovery.RD_AbandonedCastle, SiteDefOfReconAndDiscovery.RD_AbandonedCastle.Worker.GenerateDefaultParams(StorytellerUtility.DefaultSiteThreatPointsNow(), tile, faction))); IEnumerable <PowerNet> source = from net in map.powerNetManager.AllNetsListForReading where net.hasPowerSource select net; if (source.Count <PowerNet>() > 0) { SitePart osirisCasket = new SitePart(site, SiteDefOfReconAndDiscovery.RD_OsirisCasket, SiteDefOfReconAndDiscovery.RD_OsirisCasket.Worker.GenerateDefaultParams(StorytellerUtility.DefaultSiteThreatPointsNow(), tile, faction)); osirisCasket.hidden = true; site.parts.Add(osirisCasket); } if (Rand.Value < 0.15f) { SitePart weatherSat = new SitePart(site, SiteDefOfReconAndDiscovery.RD_WeatherSat, SiteDefOfReconAndDiscovery.RD_WeatherSat.Worker.GenerateDefaultParams(StorytellerUtility.DefaultSiteThreatPointsNow(), tile, faction)); weatherSat.hidden = true; site.parts.Add(weatherSat); } site.GetComponent <TimeoutComp>().StartTimeout(randomInRange * 60000); if (Rand.Value < 0.25f) { SitePart scatteredManhunters = new SitePart(site, SiteDefOfReconAndDiscovery.RD_ScatteredManhunters, SiteDefOfReconAndDiscovery.RD_ScatteredManhunters.Worker.GenerateDefaultParams(StorytellerUtility.DefaultSiteThreatPointsNow(), tile, faction)); scatteredManhunters.hidden = true; site.parts.Add(scatteredManhunters); } if (Rand.Value < 0.1f) { SitePart scatteredTreasure = new SitePart(site, SiteDefOfReconAndDiscovery.RD_ScatteredTreasure, SiteDefOfReconAndDiscovery.RD_ScatteredTreasure.Worker.GenerateDefaultParams(StorytellerUtility.DefaultSiteThreatPointsNow(), tile, faction)); scatteredTreasure.hidden = true; site.parts.Add(scatteredTreasure); } if (Rand.Value < 1f) { SitePart enemyRaidOnArrival = new SitePart(site, SiteDefOfReconAndDiscovery.RD_EnemyRaidOnArrival, SiteDefOfReconAndDiscovery.RD_EnemyRaidOnArrival.Worker.GenerateDefaultParams(StorytellerUtility.DefaultSiteThreatPointsNow(), tile, faction)); enemyRaidOnArrival.hidden = true; site.parts.Add(enemyRaidOnArrival); } if (Rand.Value < 0.9f) { SitePart enemyRaidOnArrival = new SitePart(site, SiteDefOfReconAndDiscovery.RD_EnemyRaidOnArrival, SiteDefOfReconAndDiscovery.RD_EnemyRaidOnArrival.Worker.GenerateDefaultParams(StorytellerUtility.DefaultSiteThreatPointsNow(), tile, faction)); enemyRaidOnArrival.hidden = true; site.parts.Add(enemyRaidOnArrival); } if (Rand.Value < 0.6f) { SitePart enemyRaidOnArrival = new SitePart(site, SiteDefOfReconAndDiscovery.RD_EnemyRaidOnArrival, SiteDefOfReconAndDiscovery.RD_EnemyRaidOnArrival.Worker.GenerateDefaultParams(StorytellerUtility.DefaultSiteThreatPointsNow(), tile, faction)); enemyRaidOnArrival.hidden = true; site.parts.Add(enemyRaidOnArrival); } Find.WorldObjects.Add(site); QueuedIncident qi = new QueuedIncident(new FiringIncident(IncidentDef.Named("PsychicDrone"), null, parms), Find.TickManager.TicksGame + 1); Find.Storyteller.incidentQueue.Add(qi); Find.LetterStack.ReceiveLetter("RD_PsychicMessage".Translate(), GrammarResolverSimpleStringExtensions.Formatted(Translator .Translate("RD_ReceivedVisionBattle"), NamedArgumentUtility.Named(pawn, "PAWN")) .AdjustedFor(pawn, "PAWN", true) //has received visions accompanying the drone, showing a battle and crying out for help. Others must have noticed, so the site will probably be dangerous. , LetterDefOf.PositiveEvent, null); result = true; } else { result = false; } } } else { result = false; } return(result); }