protected override bool CanFireNowSub(IIncidentTarget target) { if (!base.CanFireNowSub(target)) { return(false); } if (Find.AnyPlayerHomeMap == null) { return(false); } if (!CommsConsoleUtility.PlayerHasPoweredCommsConsole()) { return(false); } int num = default(int); if (!this.TryFindTile(out num)) { return(false); } SitePartDef sitePartDef = default(SitePartDef); Faction faction = default(Faction); if (!SiteMakerHelper.TryFindSiteParams_SingleSitePart(SiteCoreDefOf.PrisonerWillingToJoin, IncidentWorker_QuestPrisonerWillingToJoin.PrisonerWillingToJoinQuestThreatTag, out sitePartDef, out faction, (Faction)null, true, (Predicate <Faction>)null)) { return(false); } return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { Faction faction = parms.faction; if (faction == null) { faction = Find.FactionManager.RandomNonHostileFaction(allowHidden: false, allowDefeated: false, allowNonHumanlike: false); } if (faction == null) { return(false); } if (!TryFindTile(out int tile)) { return(false); } if (!SiteMakerHelper.TryFindSiteParams_SingleSitePart(SiteCoreDefOf.ItemStash, (!Rand.Chance(0.15f)) ? "ItemStashQuestThreat" : null, out SitePartDef sitePart, out Faction faction2)) { return(false); } int randomInRange = SiteTuning.QuestSiteTimeoutDaysRange.RandomInRange; Site site = CreateSite(tile, sitePart, randomInRange, faction2); List <Thing> list = GenerateItems(faction2, site.desiredThreatPoints); site.GetComponent <ItemStashContentsComp>().contents.TryAddRangeOrTransfer(list, canMergeWithExistingStacks: false); string letterText = GetLetterText(faction, list, randomInRange, site, site.parts.FirstOrDefault()); Find.LetterStack.ReceiveLetter(def.letterLabel, letterText, def.letterDef, site, faction); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { Faction faction = parms.faction; if (faction == null) { faction = Find.FactionManager.RandomNonHostileFaction(false, false, false, TechLevel.Undefined); } if (faction == null) { return(false); } int tile; if (!this.TryFindTile(out tile)) { return(false); } SitePartDef sitePart; Faction siteFaction; if (!SiteMakerHelper.TryFindSiteParams_SingleSitePart(SiteCoreDefOf.ItemStash, (!Rand.Chance(0.15f)) ? "ItemStashQuestThreat" : null, out sitePart, out siteFaction, null, true, null)) { return(false); } int randomInRange = SiteTuning.QuestSiteTimeoutDaysRange.RandomInRange; Site site = IncidentWorker_QuestItemStash.CreateSite(tile, sitePart, randomInRange, siteFaction); List <Thing> list = this.GenerateItems(siteFaction, site.desiredThreatPoints); site.GetComponent <ItemStashContentsComp>().contents.TryAddRangeOrTransfer(list, false, false); string letterText = this.GetLetterText(faction, list, randomInRange, site, site.parts.FirstOrDefault <SitePart>()); Find.LetterStack.ReceiveLetter(this.def.letterLabel, letterText, this.def.letterDef, site, faction, null); return(true); }
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); }
protected override bool TryExecuteWorker(IncidentParms parms) { if (!tryFindTile(out int tile)) { return(false); } if (!SiteMakerHelper.TryFindSiteParams_SingleSitePart(CavesDefOf.Biomes_SkulltopSprout, (string)null, out SitePartDef sitePart, out Faction faction)) { return(false); } int timeout = SiteTuning.QuestSiteTimeoutDaysRange.RandomInRange; Site site = SiteMaker.MakeSite(CavesDefOf.Biomes_SkulltopSprout, sitePart, tile, faction); site.sitePartsKnown = true; site.GetComponent <TimeoutComp>().StartTimeout(SiteTuning.QuestSiteTimeoutDaysRange.RandomInRange * 60000); Find.WorldObjects.Add(site); SendStandardLetter(site); return(true); }
protected override bool CanFireNowSub(IncidentParms parms) { if (!base.CanFireNowSub(parms)) { return(false); } if (Find.AnyPlayerHomeMap == null) { return(false); } if (!TryFindTile(out int _)) { return(false); } if (!SiteMakerHelper.TryFindSiteParams_SingleSitePart(SiteCoreDefOf.PrisonerWillingToJoin, "PrisonerRescueQuestThreat", out SitePartDef _, out Faction _)) { return(false); } return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { Faction faction = parms.faction; if (faction == null) { faction = Find.FactionManager.RandomNonHostileFaction(false, false, false, TechLevel.Undefined); } bool result; int tile; SitePartDef sitePart; Faction siteFaction; if (faction == null) { result = false; } else if (!TileFinder.TryFindNewSiteTile(out tile, 7, 27, false, true, -1)) { result = false; } else if (!SiteMakerHelper.TryFindSiteParams_SingleSitePart(PolarisIncidentDefOf.Polaris_TradeShipPodCrashSiteCore, (!Rand.Chance(IncidentWorker_QuestTradeShipPodCrash.NoSitePartChance)) ? IncidentWorker_QuestTradeShipPodCrash.TradeShipPodCrashQuestThreatTag : null, out sitePart, out siteFaction, null, true, null)) { result = false; } else { int randomInRange = IncidentWorker_QuestTradeShipPodCrash.TimeoutDaysRange.RandomInRange; List <Thing> items = this.GenThingList(out string tradeShipKind); Site site = IncidentWorker_QuestTradeShipPodCrash.CreateSite(tile, sitePart, randomInRange, siteFaction, items); string letterText = this.GetLetterText(faction, tradeShipKind, randomInRange, site, site.parts.FirstOrDefault <SitePart>()); Find.LetterStack.ReceiveLetter(this.def.letterLabel, letterText, this.def.letterDef, site, faction, null); result = true; } return(result); }
protected override bool CanFireNowSub(IncidentParms parms) { int num; SitePartDef sitePartDef; Faction faction; return(base.CanFireNowSub(parms) && Find.AnyPlayerHomeMap != null && this.TryFindTile(out num) && SiteMakerHelper.TryFindSiteParams_SingleSitePart(SiteCoreDefOf.PrisonerWillingToJoin, "PrisonerRescueQuestThreat", out sitePartDef, out faction, null, true, null)); }
protected override bool CanFireNowSub(IIncidentTarget target) { int num; SitePartDef sitePartDef; Faction faction; return(base.CanFireNowSub(target) && Find.AnyPlayerHomeMap != null && CommsConsoleUtility.PlayerHasPoweredCommsConsole() && this.TryFindTile(out num) && SiteMakerHelper.TryFindSiteParams_SingleSitePart(SiteCoreDefOf.PrisonerWillingToJoin, IncidentWorker_QuestPrisonerWillingToJoin.PrisonerWillingToJoinQuestThreatTag, out sitePartDef, out faction, null, true, null)); }