public override void GameComponentTick() { if (Find.TickManager.TicksGame % 2000 != 0 || !Rand.Chance(0.05f)) { return; } if (this.sendAICoreRequestReminder) { if (ResearchProjectTagDefOf.ShipRelated.CompletedProjects() < 2) { return; } if (PlayerItemAccessibilityUtility.PlayerOrQuestRewardHas(ThingDefOf.AIPersonaCore) || PlayerItemAccessibilityUtility.PlayerOrQuestRewardHas(ThingDefOf.Ship_ComputerCore)) { return; } Faction faction = Find.FactionManager.RandomNonHostileFaction(false, false, true, TechLevel.Undefined); if (faction == null || faction.leader == null) { return; } Find.LetterStack.ReceiveLetter("LetterLabelAICoreOffer".Translate(), "LetterAICoreOffer".Translate(faction.leader.LabelDefinite(), faction.Name, faction.leader.Named("PAWN")).CapitalizeFirst(), LetterDefOf.NeutralEvent, GlobalTargetInfo.Invalid, faction, null); this.sendAICoreRequestReminder = false; } }
public override void GameComponentTick() { if (Find.TickManager.TicksGame % 2000 == 0 && Rand.Chance(0.05f)) { if (this.sendAICoreRequestReminder) { if (ResearchProjectTagDefOf.ShipRelated.CompletedProjects() >= 2) { if (!PlayerItemAccessibilityUtility.PlayerOrItemStashHas(ThingDefOf.AIPersonaCore) && !PlayerItemAccessibilityUtility.PlayerOrItemStashHas(ThingDefOf.Ship_ComputerCore)) { Faction faction = Find.FactionManager.RandomNonHostileFaction(false, false, true, TechLevel.Undefined); if (faction != null && faction.leader != null) { Find.LetterStack.ReceiveLetter("LetterLabelAICoreOffer".Translate(), "LetterAICoreOffer".Translate(new object[] { faction.leader.LabelDefinite(), faction.Name }).CapitalizeFirst(), LetterDefOf.NeutralEvent, GlobalTargetInfo.Invalid, faction, null); this.sendAICoreRequestReminder = false; } } } } } }
private static bool TryFindRandomRequestedThingDef_NewTmp(Map map, out ThingDef thingDef, out int count, List <ThingDef> dontRequest) { requestCountDict.Clear(); Func <ThingDef, bool> globalValidator = delegate(ThingDef td) { if (td.BaseMarketValue / td.BaseMass < 5f) { return(false); } if (!td.alwaysHaulable) { return(false); } CompProperties_Rottable compProperties = td.GetCompProperties <CompProperties_Rottable>(); if (compProperties != null && compProperties.daysToRotStart < 10f) { return(false); } if (td.ingestible != null && td.ingestible.HumanEdible) { return(false); } if (td == ThingDefOf.Silver) { return(false); } if (!td.PlayerAcquirable) { return(false); } int num = RandomRequestCount(td, map); requestCountDict.Add(td, num); if (!PlayerItemAccessibilityUtility.PossiblyAccessible(td, num, map)) { return(false); } if (!PlayerItemAccessibilityUtility.PlayerCanMake(td, map)) { return(false); } if (td.thingSetMakerTags != null && td.thingSetMakerTags.Contains("RewardStandardHighFreq")) { return(false); } return((dontRequest.NullOrEmpty() || !dontRequest.Contains(td)) ? true : false); }; if (ThingSetMakerUtility.allGeneratableItems.Where((ThingDef td) => globalValidator(td)).TryRandomElement(out thingDef)) { count = requestCountDict[thingDef]; return(true); } count = 0; return(false); }
public static void ItemAccessibility() { IEnumerable <ThingDef> arg_129_0 = from x in ThingSetMakerUtility.allGeneratableItems orderby x.defName select x; TableDataGetter <ThingDef>[] expr_2D = new TableDataGetter <ThingDef> [6]; expr_2D[0] = new TableDataGetter <ThingDef>("defName", (ThingDef d) => d.defName); expr_2D[1] = new TableDataGetter <ThingDef>("1", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 1, Find.CurrentMap)) ? string.Empty : "✓"); expr_2D[2] = new TableDataGetter <ThingDef>("10", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 10, Find.CurrentMap)) ? string.Empty : "✓"); expr_2D[3] = new TableDataGetter <ThingDef>("100", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 100, Find.CurrentMap)) ? string.Empty : "✓"); expr_2D[4] = new TableDataGetter <ThingDef>("1000", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 1000, Find.CurrentMap)) ? string.Empty : "✓"); expr_2D[5] = new TableDataGetter <ThingDef>("10000", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 10000, Find.CurrentMap)) ? string.Empty : "✓"); DebugTables.MakeTablesDialog <ThingDef>(arg_129_0, expr_2D); }
static bool Prefix(ref GameComponent_OnetimeNotification __instance) { if (Find.TickManager.TicksGame % 2000 > RefcellRespeedConfig.currentTimeMultiplier - 1 || !Rand.Chance(0.05f) || (!__instance.sendAICoreRequestReminder || ResearchProjectTagDefOf.ShipRelated.CompletedProjects() < 2) || (PlayerItemAccessibilityUtility.PlayerOrQuestRewardHas(ThingDefOf.AIPersonaCore) || PlayerItemAccessibilityUtility.PlayerOrQuestRewardHas(ThingDefOf.Ship_ComputerCore))) { return(false); } Faction relatedFaction = Find.FactionManager.RandomNonHostileFaction(); if (relatedFaction == null || relatedFaction.leader == null) { return(false); } Find.LetterStack.ReceiveLetter( "LetterLabelAICoreOffer".Translate(), "LetterAICoreOffer".Translate((NamedArgument)relatedFaction.leader.LabelDefinite(), (NamedArgument)relatedFaction.Name, relatedFaction.leader.Named("PAWN")).CapitalizeFirst(), LetterDefOf.NeutralEvent, (LookTargets)GlobalTargetInfo.Invalid, relatedFaction); __instance.sendAICoreRequestReminder = false; return(false); }
public static void ItemAccessibility() { DebugTables.MakeTablesDialog(from x in ThingSetMakerUtility.allGeneratableItems orderby x.defName select x, new TableDataGetter <ThingDef>("defName", (ThingDef d) => d.defName), new TableDataGetter <ThingDef>("1", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 1, Find.CurrentMap)) ? string.Empty : "✓"), new TableDataGetter <ThingDef>("10", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 10, Find.CurrentMap)) ? string.Empty : "✓"), new TableDataGetter <ThingDef>("100", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 100, Find.CurrentMap)) ? string.Empty : "✓"), new TableDataGetter <ThingDef>("1000", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 1000, Find.CurrentMap)) ? string.Empty : "✓"), new TableDataGetter <ThingDef>("10000", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 10000, Find.CurrentMap)) ? string.Empty : "✓")); }
public override void GameComponentTick() { if (Find.TickManager.TicksGame % 2000 == 0 && Rand.Chance(0.05f) && sendAICoreRequestReminder && ResearchProjectTagDefOf.ShipRelated.CompletedProjects() >= 2 && !PlayerItemAccessibilityUtility.PlayerOrQuestRewardHas(ThingDefOf.AIPersonaCore) && !PlayerItemAccessibilityUtility.PlayerOrQuestRewardHas(ThingDefOf.Ship_ComputerCore)) { Faction faction = Find.FactionManager.RandomNonHostileFaction(); if (faction != null && faction.leader != null) { Find.LetterStack.ReceiveLetter("LetterLabelAICoreOffer".Translate(), "LetterAICoreOffer".Translate(faction.leader.LabelDefinite(), faction.Name, faction.leader.Named("PAWN")).CapitalizeFirst(), LetterDefOf.NeutralEvent, GlobalTargetInfo.Invalid, faction); sendAICoreRequestReminder = false; } } }
public static void ItemAccessibility() { DebugTables.MakeTablesDialog(ThingSetMakerUtility.allGeneratableItems.OrderBy((ThingDef x) => x.defName), new TableDataGetter <ThingDef>("defName", (ThingDef d) => d.defName), new TableDataGetter <ThingDef>("1", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 1, Find.CurrentMap)) ? "" : "✓"), new TableDataGetter <ThingDef>("10", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 10, Find.CurrentMap)) ? "" : "✓"), new TableDataGetter <ThingDef>("100", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 100, Find.CurrentMap)) ? "" : "✓"), new TableDataGetter <ThingDef>("1000", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 1000, Find.CurrentMap)) ? "" : "✓"), new TableDataGetter <ThingDef>("10000", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 10000, Find.CurrentMap)) ? "" : "✓")); }