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);
        }
Пример #2
0
        protected override bool CanFireNowSub(IncidentParms parms)
        {
            List <SitePartDef> x = new List <SitePartDef>();

            x.Add(SitePartDefOf.DownedT5Android);
            return(base.CanFireNowSub(parms) && this.TryFindTile(out int num) && SiteMakerHelper.TryFindRandomFactionFor(x, out Faction faction, true, null));
        }
Пример #3
0
        protected override bool CanFireNowSub(IncidentParms parms)
        {
            int     num;
            Faction faction;

            return(base.CanFireNowSub(parms) && this.TryFindTile(out num) && SiteMakerHelper.TryFindRandomFactionFor(SiteCoreDefOf.DownedRefugee, null, out faction, true, null));
        }
Пример #4
0
        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);
        }
Пример #5
0
        private bool TrySetVars(Slate slate, bool test)
        {
            Pawn  asker = slate.Get <Pawn>("asker");
            Thing mustBeHostileToFactionOfResolved = mustBeHostileToFactionOf.GetValue(slate);

            if (!SiteMakerHelper.TryFindRandomFactionFor(sitePartDefs.GetValue(slate), out Faction faction, disallowNonHostileFactions : true, delegate(Faction x)
            {
                if (asker != null && asker.Faction == x)
                {
                    return(false);
                }
                return((mustBeHostileToFactionOfResolved == null || mustBeHostileToFactionOfResolved.Faction == null || (x != mustBeHostileToFactionOfResolved.Faction && x.HostileTo(mustBeHostileToFactionOfResolved.Faction))) ? true : false);
            }))
            {
                return(false);
            }
            if (!Find.Storyteller.difficulty.allowViolentQuests && faction.HostileTo(Faction.OfPlayer))
            {
                return(false);
            }
            slate.Set(storeAs.GetValue(slate), faction);
            if (!test && faction != null && !faction.def.hidden)
            {
                QuestPart_InvolvedFactions questPart_InvolvedFactions = new QuestPart_InvolvedFactions();
                questPart_InvolvedFactions.factions.Add(faction);
                QuestGen.quest.AddPart(questPart_InvolvedFactions);
            }
            return(true);
        }
Пример #6
0
        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);
        }
Пример #7
0
        protected override bool CanFireNowSub(IncidentParms parms)
        {
            var x = new List <SitePartDef> {
                SitePartDefOf.DownedT5Android
            };

            return(base.CanFireNowSub(parms) && TryFindTile(out var num) && SiteMakerHelper.TryFindRandomFactionFor(x, out var faction));
        }
Пример #8
0
        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);
        }
Пример #9
0
        protected override bool CanFireNowSub(IIncidentTarget target)
        {
            if (!base.CanFireNowSub(target))
            {
                return(false);
            }
            int     num     = default(int);
            Faction faction = default(Faction);

            return(this.TryFindTile(out num) && SiteMakerHelper.TryFindRandomFactionFor(SiteCoreDefOf.DownedRefugee, (IEnumerable <SitePartDef>)null, out faction, true, (Predicate <Faction>)null));
        }
Пример #10
0
        protected override bool CanFireNowSub(IncidentParms parms)
        {
            if (!base.CanFireNowSub(parms))
            {
                return(false);
            }
            int     tile;
            Faction faction;

            return(TryFindTile(out tile) && SiteMakerHelper.TryFindRandomFactionFor(SiteCoreDefOf.DownedRefugee, null, out faction));
        }
 private void SetVars(Slate slate)
 {
     SiteMakerHelper.GenerateDefaultParams(slate.Get("points", 0f), tile.GetValue(slate), faction.GetValue(slate), sitePartDefs.GetValue(slate), out List <SitePartDefWithParams> sitePartDefsWithParams);
     for (int i = 0; i < sitePartDefsWithParams.Count; i++)
     {
         if (sitePartDefsWithParams[i].def == SitePartDefOf.PreciousLump)
         {
             sitePartDefsWithParams[i].parms.preciousLumpResources = slate.Get <ThingDef>("targetMineable");
         }
     }
     slate.Set(storeSitePartsParamsAs.GetValue(slate), sitePartDefsWithParams);
 }
        private bool TrySetVars(Slate slate)
        {
            float   points       = slate.Get("points", 0f);
            Faction factionToUse = slate.Get <Faction>("enemyFaction");
            Pawn    asker        = slate.Get <Pawn>("asker");
            Thing   mustBeHostileToFactionOfResolved = mustBeHostileToFactionOf.GetValue(slate);

            for (int i = 0; i < 2; i++)
            {
                tmpTags.Clear();
                foreach (SitePartOption item in sitePartsTags.GetValue(slate))
                {
                    if (Rand.Chance(item.chance) && (i != 1 || !(item.chance < 1f)))
                    {
                        tmpTags.Add(item.tag);
                    }
                }
                if (!SiteMakerHelper.TryFindSiteParams_MultipleSiteParts(tmpTags.Where((string x) => x != null).Select(delegate(string x)
                {
                    IEnumerable <SitePartDef> enumerable = SiteMakerHelper.SitePartDefsWithTag(x);
                    IEnumerable <SitePartDef> enumerable2 = enumerable.Where((SitePartDef y) => points >= y.minThreatPoints);
                    return((!enumerable2.Any()) ? enumerable : enumerable2);
                }), out List <SitePartDef> siteParts, out Faction faction, factionToUse, disallowNonHostileFactions: true, delegate(Faction x)
                {
                    if (asker != null && asker.Faction != null && asker.Faction == x)
                    {
                        return(false);
                    }
                    return((mustBeHostileToFactionOfResolved == null || mustBeHostileToFactionOfResolved.Faction == null || (x != mustBeHostileToFactionOfResolved.Faction && x.HostileTo(mustBeHostileToFactionOfResolved.Faction))) ? true : false);
                }))
                {
                    continue;
                }
                slate.Set(storeAs.GetValue(slate), siteParts);
                slate.Set("sitePartCount", siteParts.Count);
                if (QuestGen.Working)
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    for (int j = 0; j < siteParts.Count; j++)
                    {
                        dictionary[siteParts[j].defName + "_exists"] = "True";
                    }
                    QuestGen.AddQuestDescriptionConstants(dictionary);
                }
                if (!storeFactionAs.GetValue(slate).NullOrEmpty())
                {
                    slate.Set(storeFactionAs.GetValue(slate), faction);
                }
                return(true);
            }
            return(false);
        }
Пример #13
0
        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);
 }
Пример #15
0
        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);
        }
Пример #16
0
        protected override bool CanFireNowSub(IncidentParms parms)
        {
            int     num;
            Faction faction;

            return(base.CanFireNowSub(parms) && (Find.FactionManager.RandomNonHostileFaction(false, false, false, TechLevel.Undefined) != null && TileFinder.TryFindNewSiteTile(out num, 7, 27, false, true, -1)) && SiteMakerHelper.TryFindRandomFactionFor(PolarisIncidentDefOf.Polaris_TradeShipPodCrashSiteCore, null, out faction, true, null));
        }
Пример #17
0
        protected override bool CanFireNowSub(IIncidentTarget target)
        {
            int     num;
            Faction faction;

            return(base.CanFireNowSub(target) && (Find.FactionManager.RandomAlliedFaction(false, false, false, TechLevel.Undefined) != null && TileFinder.TryFindNewSiteTile(out num, 8, 30, false, true, -1)) && SiteMakerHelper.TryFindRandomFactionFor(SiteCoreDefOf.ItemStash, null, out faction, true, null));
        }
Пример #18
0
        protected override bool CanFireNowSub(IncidentParms parms)
        {
            if (!base.CanFireNowSub(parms))
            {
                return(false);
            }
            int     tile;
            Faction faction;

            return(Find.FactionManager.RandomNonHostileFaction(allowHidden: false, allowDefeated: false, allowNonHumanlike: false) != null && TryFindTile(out tile) && SiteMakerHelper.TryFindRandomFactionFor(SiteCoreDefOf.ItemStash, null, out faction));
        }
        // Token: 0x06000070 RID: 112 RVA: 0x00004920 File Offset: 0x00002B20
        protected override bool CanFireNowSub(IncidentParms parms)
        {
            int     num;
            Faction faction;

            return(base.CanFireNowSub(parms) && Find.FactionManager.RandomNonHostileFaction(false, false, false, TechLevel.Industrial) != null && this.TryFindTile(out num) && SiteMakerHelper.TryFindRandomFactionFor(SiteCoreDefOf.OldOutpost, null, ref faction, true, null));
        }
        protected override bool CanFireNowSub(IIncidentTarget target)
        {
            if (!base.CanFireNowSub(target))
            {
                return(false);
            }
            int     num     = default(int);
            Faction faction = default(Faction);

            return(Find.FactionManager.RandomAlliedFaction(false, false, false, TechLevel.Undefined) != null && TileFinder.TryFindNewSiteTile(out num, 8, 30, false, true, -1) && SiteMakerHelper.TryFindRandomFactionFor(SiteCoreDefOf.ItemStash, (IEnumerable <SitePartDef>)null, out faction, true, (Predicate <Faction>)null));
        }
        protected override bool CanFireNowSub(IncidentParms parms)
        {
            if (!base.CanFireNowSub(parms))
            {
                return(false);
            }

            if (!SnapshotStoreManager.Instance.CanFireLargeEvent())
            {
                return(false);
            }

            int     tile;
            Faction faction;

            return(Find.FactionManager.RandomNonHostileFaction(false, false, false, TechLevel.Undefined) != null && TryFindTile(out tile) && SiteMakerHelper.TryFindRandomFactionFor(DefDatabase <SiteCoreDef> .GetNamed("RuinedBaseSite"), null, out faction, true, null));
        }
        protected override bool CanFireNowSub(IncidentParms parms)
        {
            int     num;
            Faction faction;

            return(base.CanFireNowSub(parms) && (Find.FactionManager.RandomNonHostileFaction(false, false, false, TechLevel.Undefined) != null && this.TryFindTile(out num)) && SiteMakerHelper.TryFindRandomFactionFor(SiteCoreDefOf.ItemStash, null, out faction, true, null));
        }
Пример #23
0
        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));
        }
Пример #24
0
        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));
        }