protected override bool TryExecuteWorker(IncidentParms parms) { Faction faction = Find.FactionManager.RandomAlliedFaction(false, false, false, TechLevel.Undefined); if (faction == null) { return(false); } int tile; if (!TileFinder.TryFindNewSiteTile(out tile, 8, 30, false, true, -1)) { return(false); } SitePartDef sitePart; Faction siteFaction; if (!SiteMakerHelper.TryFindSiteParams_SingleSitePart(SiteCoreDefOf.ItemStash, (!Rand.Chance(0.15f)) ? IncidentWorker_QuestItemStash.ItemStashQuestThreatTag : null, out sitePart, out siteFaction, null, true, null)) { return(false); } int randomInRange = IncidentWorker_QuestItemStash.TimeoutDaysRange.RandomInRange; List <Thing> list = this.GenerateItems(siteFaction); bool sitePartsKnown = Rand.Chance(0.5f); int num = 0; if (Rand.Chance(this.FeeDemandChance(faction))) { num = IncidentWorker_QuestItemStash.FeeRange.RandomInRange; } string letterText = this.GetLetterText(faction, list, randomInRange, sitePart, sitePartsKnown, num); if (num > 0) { Map map = TradeUtility.PlayerHomeMapWithMostLaunchableSilver(); ChoiceLetter_ItemStashFeeDemand choiceLetter_ItemStashFeeDemand = (ChoiceLetter_ItemStashFeeDemand)LetterMaker.MakeLetter(this.def.letterLabel, letterText, LetterDefOf.ItemStashFeeDemand); choiceLetter_ItemStashFeeDemand.title = "ItemStashQuestTitle".Translate(); choiceLetter_ItemStashFeeDemand.radioMode = true; choiceLetter_ItemStashFeeDemand.map = map; choiceLetter_ItemStashFeeDemand.fee = num; choiceLetter_ItemStashFeeDemand.siteDaysTimeout = randomInRange; choiceLetter_ItemStashFeeDemand.items.TryAddRangeOrTransfer(list, false, false); choiceLetter_ItemStashFeeDemand.siteFaction = siteFaction; choiceLetter_ItemStashFeeDemand.sitePart = sitePart; choiceLetter_ItemStashFeeDemand.alliedFaction = faction; choiceLetter_ItemStashFeeDemand.sitePartsKnown = sitePartsKnown; choiceLetter_ItemStashFeeDemand.StartTimeout(60000); Find.LetterStack.ReceiveLetter(choiceLetter_ItemStashFeeDemand, null); } else { Site o = IncidentWorker_QuestItemStash.CreateSite(tile, sitePart, randomInRange, siteFaction, list, sitePartsKnown); Find.LetterStack.ReceiveLetter(this.def.letterLabel, letterText, this.def.letterDef, o, null); } return(true); }