using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using Eremite;
using Eremite.Controller;
using Eremite.Model;
using Eremite.Model.Effects;
using Eremite.Model.State;
using Eremite.Services;
using Eremite.Services.Meta;
using Eremite.Services.World;
using Eremite.View.Cameras;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("Josiwe.ATS.Cheats")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Cheat Mod for Against The Storm - By Josiwe")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+af812b2767f119879f3eb8627822e7f3f18779f5")]
[assembly: AssemblyProduct("Josiwe.ATS.Cheats")]
[assembly: AssemblyTitle("Josiwe.ATS.Cheats")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Josiwe.ATS.Cheats
{
public class CheatConfig
{
public float ZoomMultiplier = 7f;
public bool AllRacesInWorldMap = false;
public int BonusPreparationPoints = 0;
public bool WildcardBlueprints = false;
public bool InfiniteCornerstoneRerolls = false;
public float ResolveMultiplier = 1f;
public float ReputationMutiplier = 1f;
public float ImpatienceMultiplier = 1f;
public int ReputationStopgap = 0;
public int ImpatienceStopgap = 0;
public int MoarMaxReputation = 0;
public int MoarMaxImpatience = 0;
public int BlueprintsMultiplier = 1;
public int CashRewardMultiplier = 1;
public int CornerstonePicksPerSeason = 1;
public bool EnableAllBuildingsMoving = false;
public bool MoarSeasonRewards = false;
public float StormLengthMultiplier = 1f;
public float DrizzleLengthMultiplier = 1f;
public float ClearanceLengthMultiplier = 1f;
public float Prestige_2_Amount = 1f;
public int Prestige_4_Amount = 10;
public float Prestige_5_Amount = 1f;
public float Prestige_6_Amount = 0.5f;
public float Prestige_7_Amount = 0.5f;
public float Prestige_8_Amount = 0.5f;
public float Prestige_9_Amount = -0.33f;
public float Prestige_10_Amount = -0.5f;
public int Prestige_12_Amount = -2;
public int Prestige_13_Amount = 2;
public float Prestige_14_Amount = 0.5f;
public int Prestige_15_Amount = 1;
public int Prestige_17_Amount = 1;
public float Prestige_18_Amount = -0.35f;
private string m_CurrentSection = null;
private bool m_LoadedFromJSON = true;
public void LoadedFromJSON()
{
m_LoadedFromJSON = true;
}
public void ReadValues()
{
Section("World Rewards");
Init(ref ZoomMultiplier, "ZoomMultiplier", 7f, "Increases how far the zoom goes");
Init(ref AllRacesInWorldMap, "AllRacesInWorldMap", defaultValue: false, "");
Init(ref BonusPreparationPoints, "BonusPreparationPoints", 0, "Adds additional embark points");
Section("Season Rewards");
Init(ref WildcardBlueprints, "WildcardBlueprints", defaultValue: false, "");
Init(ref InfiniteCornerstoneRerolls, "InfiniteCornerstoneRerolls", defaultValue: false, "");
Init(ref ResolveMultiplier, "ResolveMultiplier", 1f, "");
Init(ref ReputationMutiplier, "ReputationMutiplier", 1f, "");
Init(ref ImpatienceMultiplier, "ImpatienceMultiplier", 1f, "");
Init(ref ReputationStopgap, "ReputationStopgap", 0, "");
Init(ref ImpatienceStopgap, "ImpatienceStopgap", 0, "");
Init(ref MoarMaxReputation, "MoarMaxReputation", 0, "");
Init(ref MoarMaxImpatience, "MoarMaxImpatience", 0, "");
Init(ref BlueprintsMultiplier, "BlueprintsMultiplier", 0, "");
Init(ref CashRewardMultiplier, "CashRewardMultiplier", 0, "");
Init(ref CornerstonePicksPerSeason, "CornerstonePicksPerSeason", 0, "");
Init(ref EnableAllBuildingsMoving, "EnableAllBuildingsMoving", defaultValue: false, "");
Section("Prestige Difficulties");
Init(ref Prestige_2_Amount, "Prestige_2_Amount", 1f, "Longer Storm - One of the seals is loosening its grip, leaking darkness upon this land. Storm season lasts 100% longer.");
Init(ref Prestige_4_Amount, "Prestige_4_Amount", 10, "Higher Blueprints Reroll Cost - The Archivist assigned to your settlement is fiercely loyal to the Royal Court, so bribing him will be more expensive. Blueprint rerolls cost 10 Amber more.");
Init(ref Prestige_5_Amount, "Prestige_5_Amount", 1f, "Faster Leaving - Villagers are less understanding than they used to be. They’re probably getting a bit spoiled by now. Villagers are 100% faster to leave if they have low Resolve.");
Init(ref Prestige_6_Amount, "Prestige_6_Amount", 0.5f, "Wet Soil - It's particularly hard to build anything in this region. Buildings require 50% more materials.");
Init(ref Prestige_7_Amount, "Prestige_7_Amount", 0.5f, "Parasites - One of the villagers was sick, and infected the rest of the settlement with a parasite. All villagers have a 50% chance of eating twice as much during their break.");
Init(ref Prestige_8_Amount, "Prestige_8_Amount", 0.5f, "Higher Needs Consumption Rate - Villagers have forgotten what a modest life looks like. They want to enjoy life to the fullest. Villagers have a 50% chance to consume double the amount of luxury goods.");
Init(ref Prestige_9_Amount, "Prestige_9_Amount", -0.33f, "Longer Relics Working Time - Villagers are reluctant to venture into Dangerous Glades. Scouts work 33% slower on Glade Events.");
Init(ref Prestige_10_Amount, "Prestige_10_Amount", -0.5f, "Higher Traders Prices - Traders gossip about you doing pretty well lately. All your goods are worth 50% less to traders.");
Init(ref Prestige_12_Amount, "Prestige_12_Amount", -2, "Fewer Blueprints Options - The greedy Royal Archivist sold most of the blueprints to traders and fled the Citadel. You have 2 fewer blueprint choices.");
Init(ref Prestige_13_Amount, "Prestige_13_Amount", 2, "Fewer Cornerstones Options - The Royal Envoy comes to you with bad news. The Queen has restricted your cornerstone choices by 2.");
Init(ref Prestige_14_Amount, "Prestige_14_Amount", 0.5f, "Lower Impatience Reduction - The Queen expects a lot from a viceroy of your rank. Impatience falls by 0.5 points less for every Reputation point you gain.");
Init(ref Prestige_15_Amount, "Prestige_15_Amount", 1, "Global Reputation Treshold Increase - You took a very peculiar group of settlers with you. They seem perpetually dissatisfied. The Resolve threshold at which each species starts producing Reputation increases by 1 more point for every Reputation point they generate.");
Init(ref Prestige_17_Amount, "Prestige_17_Amount", 1, "Hunger Multiplier Effects - Famine outbreaks in your previous settlements have made the villagers particularly sensitive to food shortages. Every time villagers have nothing to eat during a break, they will gain two stacks of the Hunger effect instead of one.");
Init(ref Prestige_18_Amount, "Prestige_18_Amount", -0.35f, "Faster Fuel Sacrifice - The Ancient Hearth seems to have a defect. No matter how hard the firekeeper tries, sacrificed resources are burning 35% quicker.");
Section("Season Rewards");
Init(ref MoarSeasonRewards, "MoarSeasonRewards", defaultValue: false, "Gives more seasoning rewards!");
Init(ref StormLengthMultiplier, "StormLengthMultiplier", 1f, "Extends how long the Storm season lasts!");
Init(ref DrizzleLengthMultiplier, "DrizzleLengthMultiplier", 1f, "Extends how long the Drizzle season lasts!");
Init(ref ClearanceLengthMultiplier, "ClearanceLengthMultiplier", 1f, "Extends how long the Clearance season lasts!");
if (m_LoadedFromJSON)
{
((BaseUnityPlugin)Plugin.Instance).Config.Save();
}
}
private void Section(string seasonRewards)
{
m_CurrentSection = seasonRewards;
}
private void Init<T>(ref T entry, string key, T defaultValue, string description)
{
ConfigEntry<T> val = Bind(m_CurrentSection, key, defaultValue, description);
if (m_LoadedFromJSON)
{
val.Value = entry;
}
else
{
entry = val.Value;
}
}
private ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, string description)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
return ((BaseUnityPlugin)Plugin.Instance).Config.Bind<T>(section, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()));
}
}
public class JSONConfig : CheatConfig
{
private string m_CurrentSection = null;
private void Section(string seasonRewards)
{
m_CurrentSection = seasonRewards;
}
private void Init<T>(out T entry, string key, T defaultValue, string description)
{
ConfigEntry<T> val = Bind(key, defaultValue, description);
entry = val.Value;
}
private ConfigEntry<T> Bind<T>(string key, T defaultValue, string description)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
return ((BaseUnityPlugin)Plugin.Instance).Config.Bind<T>(m_CurrentSection, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()));
}
}
[BepInPlugin("Josiwe.ATS.Cheats", "Josiwe.ATS.Cheats", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
private Harmony harmony;
public static Plugin Instance;
private static CheatConfig _configuration;
[HarmonyPatch(typeof(CameraController), "SetUp")]
[HarmonyPostfix]
public static void Setup_PostPatch(CameraController __instance)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
float num = 1f;
if (_configuration != null)
{
num = _configuration.ZoomMultiplier;
}
float num2 = -20f * num;
float num3 = -8f;
__instance.ZoomLimit = new Vector2(num2, num3);
if (num != 0f)
{
__instance.zoomSmoothTime /= num;
}
}
[HarmonyPatch(typeof(WorldEmbarkService), "GetBonusPreparationPoints")]
[HarmonyPrefix]
public static bool GetBonusPreparationPoints(WorldEmbarkService __instance, ref int __result)
{
if (_configuration == null || _configuration.BonusPreparationPoints <= 0)
{
return true;
}
WriteLog($"Default embark points: {__instance.Effects.bonusPreparationPoints} - we added {_configuration.BonusPreparationPoints} more");
__result = __instance.Effects.bonusPreparationPoints + _configuration.BonusPreparationPoints;
return false;
}
[HarmonyPatch(typeof(EffectsService), "GetSeasonLenghtRate")]
[HarmonyPrefix]
private static bool GetSeasonLenghtRate_PrePatch(EffectsService __instance, Season season, ref float __result)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Expected I4, but got Unknown
if (_configuration == null)
{
return true;
}
float stormLengthMultiplier = _configuration.StormLengthMultiplier;
float drizzleLengthMultiplier = _configuration.DrizzleLengthMultiplier;
float clearanceLengthMultiplier = _configuration.ClearanceLengthMultiplier;
if (1 == 0)
{
}
float num = (int)season switch
{
0 => (drizzleLengthMultiplier > 0f) ? (__instance.Effects.drizzleLength * drizzleLengthMultiplier) : __instance.Effects.drizzleLength,
1 => (clearanceLengthMultiplier > 0f) ? (__instance.Effects.clearanceleLength * clearanceLengthMultiplier) : __instance.Effects.clearanceleLength,
2 => (stormLengthMultiplier > 0f) ? (__instance.Effects.stormLength * stormLengthMultiplier) : __instance.Effects.stormLength,
_ => throw new NotImplementedException(((object)(Season)(ref season)).ToString()),
};
if (1 == 0)
{
}
__result = num;
return false;
}
[HarmonyPatch(typeof(EffectsService), "AddDifficultyEarlyModifiers")]
[HarmonyPrefix]
private static bool AddDifficultyEarlyModifiers_PrePatch()
{
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Expected O, but got Unknown
if (_configuration == null || Serviceable.ConditionsService.IsCustomGame())
{
return true;
}
AscensionModifierModel[] modifiers = Serviceable.BiomeService.Difficulty.modifiers;
foreach (AscensionModifierModel val in modifiers)
{
if (!val.isEarlyEffect)
{
continue;
}
WriteLog("--------------------");
WriteLog($"Early Effect: {((Object)val.effect).name} - {((object)val.effect).GetType()}");
WriteLog(((SO)val).Name + " - " + val.effect.Description);
WriteLog(" - Display Name Key " + val.effect.DisplayNameKey);
WriteLog(" - Amount Text " + val.effect.GetAmountText());
WriteLog(" - Raw Amount Text " + val.effect.GetRawAmountText());
WriteLog($" - Float Amount {val.effect.GetFloatAmount()}");
WriteLog($" - Int Amount {val.effect.GetIntAmount()}");
WriteLog("--------------------");
switch (val.effect.DisplayNameKey)
{
case "Effect_FewerBlueprintsOptions_Name":
{
if ((float)_configuration.Prestige_12_Amount > 0f)
{
val.effect.ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
ReputationRewardsBonusOptionsEffectModel val2 = (ReputationRewardsBonusOptionsEffectModel)val.effect;
val2.amount = _configuration.Prestige_12_Amount;
((EffectModel)val2).ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
default:
val.effect.ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
}
return false;
}
[HarmonyPatch(typeof(EffectsService), "AddLateInitialEffects")]
[HarmonyPrefix]
private static bool AddLateInitialEffects_PrePatch()
{
//IL_0a26: Unknown result type (might be due to invalid IL or missing references)
//IL_0a2d: Expected O, but got Unknown
//IL_09d0: Unknown result type (might be due to invalid IL or missing references)
//IL_09d7: Expected O, but got Unknown
//IL_0920: Unknown result type (might be due to invalid IL or missing references)
//IL_0927: Expected O, but got Unknown
//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
//IL_05f3: Expected O, but got Unknown
//IL_0758: Unknown result type (might be due to invalid IL or missing references)
//IL_075f: Expected O, but got Unknown
//IL_0810: Unknown result type (might be due to invalid IL or missing references)
//IL_0817: Expected O, but got Unknown
//IL_07b4: Unknown result type (might be due to invalid IL or missing references)
//IL_07bb: Expected O, but got Unknown
//IL_08c4: Unknown result type (might be due to invalid IL or missing references)
//IL_08cb: Expected O, but got Unknown
//IL_0978: Unknown result type (might be due to invalid IL or missing references)
//IL_097f: Expected O, but got Unknown
//IL_06a0: Unknown result type (might be due to invalid IL or missing references)
//IL_06a7: Expected O, but got Unknown
//IL_0644: Unknown result type (might be due to invalid IL or missing references)
//IL_064b: Expected O, but got Unknown
//IL_086c: Unknown result type (might be due to invalid IL or missing references)
//IL_0873: Expected O, but got Unknown
//IL_06fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0703: Expected O, but got Unknown
if (_configuration == null)
{
return true;
}
EffectModel[] effects = Serviceable.Biome.effects;
foreach (EffectModel val in effects)
{
val.Apply((EffectContextType)0, (string)null, 0);
}
foreach (string activeEventsEffect in Serviceable.WorldStateService.Cycle.activeEventsEffects)
{
Serviceable.Settings.GetEffect(activeEventsEffect).Apply((EffectContextType)0, (string)null, 0);
}
foreach (string embarkEffect in Serviceable.MetaStateService.GameConditions.embarkEffects)
{
Serviceable.Settings.GetEffect(embarkEffect).Apply((EffectContextType)0, (string)null, 0);
}
foreach (string lateEffect in Serviceable.MetaStateService.GameConditions.lateEffects)
{
Serviceable.Settings.GetEffect(lateEffect).Apply((EffectContextType)0, (string)null, 0);
}
if (!Serviceable.ConditionsService.IsCustomGame())
{
AscensionModifierModel[] modifiers = Serviceable.BiomeService.Difficulty.modifiers;
foreach (AscensionModifierModel val2 in modifiers)
{
if (val2.isEarlyEffect)
{
continue;
}
WriteLog("--------------------");
WriteLog($"Late Effect: {((Object)val2.effect).name} - {((object)val2.effect).GetType()}");
WriteLog(((SO)val2).Name + " - " + val2.effect.Description);
WriteLog(" - Display Name Key " + val2.effect.DisplayNameKey);
WriteLog(" - Amount Text " + val2.effect.GetAmountText());
WriteLog(" - Raw Amount Text " + val2.effect.GetRawAmountText());
WriteLog($" - Float Amount {val2.effect.GetFloatAmount()}");
WriteLog($" - Int Amount {val2.effect.GetIntAmount()}");
WriteLog("--------------------");
switch (val2.effect.DisplayNameKey)
{
case "Effect_CrumblingSeal_Name":
{
if (_configuration.Prestige_2_Amount < 0f)
{
val2.effect.ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
SeasonLengthEffectModel val13 = (SeasonLengthEffectModel)val2.effect;
val13.amount = _configuration.Prestige_2_Amount;
((EffectModel)val13).ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
case "Effect_HigherBlueprintsRerollCost_Name":
{
if (_configuration.Prestige_4_Amount < 0)
{
val2.effect.ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
ReputationRewardsRerollCostEffectModel val8 = (ReputationRewardsRerollCostEffectModel)val2.effect;
val8.amount = _configuration.Prestige_4_Amount;
((EffectModel)val8).ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
case "Effect_FasterLeaving_Name":
{
if (_configuration.Prestige_5_Amount < 0f)
{
val2.effect.ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
LeavingRateEffectModel val14 = (LeavingRateEffectModel)val2.effect;
val14.amount = _configuration.Prestige_5_Amount;
((EffectModel)val14).ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
case "Effect_WetSoil_Name":
{
if (_configuration.Prestige_6_Amount < 0f)
{
val2.effect.ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
ConstructionCostEffectModel val5 = (ConstructionCostEffectModel)val2.effect;
val5.amount = _configuration.Prestige_6_Amount;
((EffectModel)val5).ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
case "Effect_Parasites_Name":
{
if (_configuration.Prestige_7_Amount < 0f)
{
val2.effect.ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
ChanceForExtraConsumptionEffectModel val10 = (ChanceForExtraConsumptionEffectModel)val2.effect;
val10.amount = _configuration.Prestige_7_Amount;
((EffectModel)val10).ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
case "Effect_HigherNeedsConsumptionRate_Name":
{
if (_configuration.Prestige_8_Amount < 0f)
{
val2.effect.ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
ChanceForExtraConsumptionEffectModel val4 = (ChanceForExtraConsumptionEffectModel)val2.effect;
val4.amount = _configuration.Prestige_8_Amount;
((EffectModel)val4).ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
case "Effect_LongerRelicsWorkingTime_Name":
{
if (_configuration.Prestige_9_Amount > 0f)
{
val2.effect.ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
RelicsWorkingTimeRateEffectModel val11 = (RelicsWorkingTimeRateEffectModel)val2.effect;
val11.amount = _configuration.Prestige_9_Amount;
((EffectModel)val11).ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
case "Effect_HigherTradersPrices_Name":
{
if (_configuration.Prestige_10_Amount > 0f)
{
val2.effect.ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
TraderGlobalSellPriceEffectModel val7 = (TraderGlobalSellPriceEffectModel)val2.effect;
val7.amount = _configuration.Prestige_10_Amount;
((EffectModel)val7).ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
case "Effect_FewerCornerstonesOptions_Name":
{
if (_configuration.Prestige_13_Amount < 0)
{
val2.effect.ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
SeasonalRewardsBonusOptionsEffectModel val15 = (SeasonalRewardsBonusOptionsEffectModel)val2.effect;
val15.amount = _configuration.Prestige_13_Amount;
((EffectModel)val15).ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
case "Effect_LowerImpatienceReduction_Name":
{
if (_configuration.Prestige_14_Amount < 0f)
{
val2.effect.ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
BonusReputationPenaltyPerReputationEffectModel val12 = (BonusReputationPenaltyPerReputationEffectModel)val2.effect;
val12.amount = _configuration.Prestige_14_Amount;
((EffectModel)val12).ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
case "Effect_GlobalReputationTresholdIncrease_Name":
{
if (_configuration.Prestige_15_Amount < 0)
{
val2.effect.ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
BonusGlobalReputationTresholdIncreaseEffectModel val9 = (BonusGlobalReputationTresholdIncreaseEffectModel)val2.effect;
((BaseAmountEffectModel)val9).amount = _configuration.Prestige_15_Amount;
((EffectModel)val9).ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
case "Effect_AscensionHungerMultiplier_Name":
{
if (_configuration.Prestige_17_Amount < 0)
{
val2.effect.ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
HungerMultiplierEffectModel val6 = (HungerMultiplierEffectModel)val2.effect;
val6.amount = _configuration.Prestige_17_Amount;
((EffectModel)val6).ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
case "Effect_FasterFuelSacrifice_Name":
{
if (_configuration.Prestige_18_Amount > 0f)
{
val2.effect.ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
HearthSacraficeTimeEffectModel val3 = (HearthSacraficeTimeEffectModel)val2.effect;
val3.amount = _configuration.Prestige_18_Amount;
((EffectModel)val3).ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
default:
val2.effect.ConsumeAsNonPerk((EffectContextType)0, (string)null, 0);
break;
}
}
}
if (Serviceable.ConditionsService.IsBlightActive() && !Serviceable.TutorialService.IsAnyTutorial(Serviceable.Biome))
{
EffectModel[] initialEffects = Serviceable.Settings.blightConfig.initialEffects;
foreach (EffectModel val16 in initialEffects)
{
val16.Apply((EffectContextType)0, (string)null, 0);
}
}
return false;
}
[HarmonyPatch(typeof(ResolveReputationCalculator), "AddReputation")]
[HarmonyPrefix]
private static bool AddReputation_PrePatch(ResolveReputationCalculator __instance, string race, float change)
{
if (!Serviceable.ReputationService.IsValidReputationGain(change) || _configuration == null || _configuration.ResolveMultiplier < 0f)
{
return true;
}
float num = change * _configuration.ResolveMultiplier;
Serviceable.ReputationService.AddReputationPoints(num, (ReputationChangeSource)2, (string)null);
__instance.ReputationGains[race] += num;
return false;
}
[HarmonyPatch(typeof(ReputationService), "GetReputationToWin")]
[HarmonyPrefix]
public static bool GetReputationToWin_PrePatch(ReputationService __instance, ref int __result)
{
if (_configuration == null || _configuration.MoarMaxReputation == 0)
{
return true;
}
__result = __instance.Conditions.reputationToWin + _configuration.MoarMaxReputation;
return false;
}
[HarmonyPatch(typeof(ReputationService), "GetReputationPenaltyToLoose")]
[HarmonyPrefix]
public static bool GetReputationPenaltyToLoose_PrePatch(ReputationService __instance, ref int __result)
{
if (_configuration == null || _configuration.MoarMaxImpatience == 0)
{
return true;
}
__result = __instance.Conditions.reputationPenaltyToLoose + _configuration.MoarMaxImpatience;
return false;
}
[HarmonyPatch(typeof(ReputationService), "AddReputationPoints")]
[HarmonyPrefix]
public static bool AddReputationPoints_PrePatch(ReputationService __instance, float amount, ReputationChangeSource type, string reason = null)
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Invalid comparison between Unknown and I4
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
if (!__instance.IsValidReputationGain(amount) || _configuration == null || (_configuration.ReputationMutiplier < 0f && _configuration.ReputationStopgap <= 0))
{
return true;
}
float num = amount * _configuration.ReputationMutiplier;
float num2 = (((int)type != 2) ? ((float)__instance.GetReputationToWin()) : ((float)__instance.GetReputationToWin() - (float)_configuration.ReputationStopgap));
__instance.State.reputationSources[type] += num;
__instance.State.reputation = Mathf.Clamp(__instance.State.reputation + num, 0f, num2);
__instance.Reputation.Value = __instance.State.reputation;
__instance.reputationChangedSubject.OnNext(new ReputationChange(num, reason, type));
__instance.CheckForWin();
return false;
}
[HarmonyPatch(typeof(ReputationService), "AddReputationPenalty")]
[HarmonyPrefix]
public static bool AddReputationPenalty_PrePatch(ReputationService __instance, float amount, ReputationChangeSource type, bool force, string reason = null)
{
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
if (_configuration == null || (_configuration.ImpatienceMultiplier < 0f && _configuration.ImpatienceStopgap <= 0))
{
return true;
}
float num = amount * _configuration.ImpatienceMultiplier;
int num2 = __instance.GetReputationPenaltyToLoose() - _configuration.ImpatienceStopgap;
__instance.State.reputationPenalty = Mathf.Clamp(__instance.State.reputationPenalty + num, 0f, (float)num2);
__instance.ReputationPenalty.Value = __instance.State.reputationPenalty;
__instance.reputationPenaltyChangedSubject.OnNext(new ReputationChange(num, reason, type));
__instance.CheckForLoose();
return false;
}
[HarmonyPatch(typeof(CornerstonesService), "GetRerollsLeft")]
[HarmonyPrefix]
public static bool GetRerollsLeft_PrePatch()
{
if (_configuration == null || !_configuration.InfiniteCornerstoneRerolls)
{
return true;
}
Serviceable.StateService.Gameplay.cornerstonesRerollsLeft = 99;
return true;
}
[HarmonyPatch(typeof(CornerstonesService), "GenerateRewards")]
[HarmonyPrefix]
private static bool GenerateRewards_PrePatch(CornerstonesService __instance, ref SeasonRewardModel model, int seed, List<EffectModel> toExclude)
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
if (_configuration == null || !_configuration.MoarSeasonRewards)
{
return true;
}
if (model == null)
{
model = Serviceable.Biome.seasons.SeasonRewards.Find((SeasonRewardModel srm) => srm.year == __instance.GetCurrentPick().date.year);
}
int num = VectorExtensions.Random(model.effectsTable.amounts) + Serviceable.StateService.Effects.bonusSeasonalRewardsOptions + Serviceable.MetaStateService.Perks.bonusSeasonRewardsAmount;
if (num < 4)
{
WriteLog($"Generating {4 - num} extra pick options for the cornerstones UI");
MetaPerksState perks = Serviceable.MetaStateService.Perks;
perks.bonusSeasonRewardsAmount += 4 - num;
}
return true;
}
[HarmonyPatch(typeof(CornerstonesService), "GenerateRewardsFor")]
[HarmonyPrefix]
public static bool GenerateRewardsFor_PrePatch(CornerstonesService __instance, SeasonRewardModel model, string viewConfiguration, bool isExtra)
{
if (_configuration == null || _configuration.CornerstonePicksPerSeason <= 1)
{
return true;
}
WriteLog($"Generating extra cornerstone picks for season change: {_configuration.CornerstonePicksPerSeason}");
for (int i = 1; i < _configuration.CornerstonePicksPerSeason; i++)
{
__instance.Picks.Add(__instance.CreatePick(model, new List<EffectModel>(), viewConfiguration, isExtra));
}
return true;
}
[HarmonyPatch(typeof(CornerstonesService), "GetAllCurrentOptions")]
[HarmonyPrefix]
public static bool GetAllCurrentOptions_PrePatch(ref List<EffectModel> __result)
{
if (_configuration == null || !_configuration.MoarSeasonRewards)
{
return true;
}
__result = new List<EffectModel>();
return false;
}
[HarmonyPatch(typeof(CornerstonesService), "RewardForDecline")]
[HarmonyPrefix]
private static bool RewardForDecline_PrePatch()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
if (_configuration == null || _configuration.CashRewardMultiplier < 0)
{
return true;
}
Good val = Serviceable.Biome.seasons.seasonRewardsDeclineGood.ToGood();
val.amount *= _configuration.CashRewardMultiplier;
Serviceable.StorageService.Main.Store(val);
return false;
}
[HarmonyPatch(typeof(ReputationRewardsService), "PrepareInitialPoints")]
[HarmonyPrefix]
private static bool PrepareInitialPoints_PrePatch(ReputationRewardsService __instance)
{
if (__instance.State.initialReputationPicksGranted || _configuration == null || !_configuration.WildcardBlueprints || _configuration.BlueprintsMultiplier < 0 || MB.TutorialService.IsAnyTutorial(GameMB.Biome))
{
return true;
}
WriteLog("WildcardBlueprints: " + _configuration.WildcardBlueprints);
WriteLog("Initial Reputation Picks Granted: " + __instance.State.initialReputationPicksGranted);
__instance.State.initialReputationPicksGranted = true;
WriteLog($"Generating {_configuration.BlueprintsMultiplier} wildcard blueprint picks");
Serviceable.EffectsService.GrantWildcardPick(_configuration.BlueprintsMultiplier);
ReputationRewardsState state = __instance.State;
state.lastGrantedReputationReward -= __instance.ReputationConfig.initialReputationRewards;
return false;
}
[HarmonyPatch(typeof(ReputationRewardsService), "UpdateRegularReputationReward")]
[HarmonyPrefix]
private static bool UpdateRegularReputationReward_PrePatch(ReputationRewardsService __instance, int points)
{
if (__instance.State.lastGrantedReputationReward > points)
{
__instance.State.lastGrantedReputationReward = points;
}
if (_configuration == null || !_configuration.WildcardBlueprints || MB.TutorialService.IsAnyTutorial(GameMB.Biome))
{
return true;
}
if (__instance.State.lastGrantedReputationReward >= points)
{
return false;
}
int num = __instance.CountRegularRewardsToCollect();
__instance.State.lastGrantedReputationReward = points;
WriteLog($"Generating new wildcard blueprint pick for reputation threshold {points}");
for (int i = 0; i < num; i++)
{
Serviceable.EffectsService.GrantWildcardPick(1);
}
__instance.UpdateWaitingRewards();
if (__instance.State.currentPick == null)
{
__instance.GenerateNewPick();
}
return false;
}
[HarmonyPatch(typeof(CaravanGenerator), "GetUniqueRevealedRaces")]
[HarmonyPrefix]
protected static bool GetUniqueRevealedRaces_PrePatch(CaravanGenerator __instance, List<EmbarkCaravanState> current, ref int __result)
{
if (_configuration == null || !_configuration.AllRacesInWorldMap)
{
return true;
}
for (int i = 0; i < 10; i++)
{
int num = __instance.rng.Next(1, 5);
if (__instance.IsUnique(num, current))
{
__result = num;
return false;
}
}
__result = __instance.rng.Next(1, 5);
return false;
}
[HarmonyPatch(typeof(MainController), "OnServicesReady")]
[HarmonyPostfix]
private static void HookMainControllerSetup()
{
((BaseUnityPlugin)Instance).Logger.LogInfo((object)"Performing game initialization on behalf of Josiwe.ATS.Cheats.");
((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"The game has loaded {MainController.Instance.Settings.effects.Length} effects.");
}
[HarmonyPatch(typeof(GameController), "StartGame")]
[HarmonyPostfix]
private static void HookEveryGameStart()
{
bool flag = MB.GameSaveService.IsNewGame();
WriteLog($"Entered a game. Is this a new game? {flag}.");
if (_configuration != null && !MB.TutorialService.IsAnyTutorial(GameMB.Biome) && _configuration.EnableAllBuildingsMoving && !Serviceable.EffectsService.IsMovingAllBuildingsEnabled())
{
Serviceable.EffectsService.EnableAllBuildingsMoving("josiwe");
}
}
private void Awake()
{
Instance = this;
_configuration = GetCheatConfig();
harmony = Harmony.CreateAndPatchAll(typeof(Plugin), (string)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Josiwe.ATS.Cheats v1.0.2 is loaded!");
}
private static CheatConfig GetCheatConfig()
{
string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location);
string text = "Josiwe.ATS.Cheats.Config.json";
string path = directoryName + "/" + text;
CheatConfig cheatConfig = null;
if (File.Exists(path))
{
try
{
WriteLog("Loading " + text);
cheatConfig = JsonConvert.DeserializeObject<CheatConfig>(File.ReadAllText(path));
cheatConfig.LoadedFromJSON();
}
catch (Exception ex)
{
WriteLog("Failed loading cheat config =(");
WriteLog(ex.Message);
}
}
if (cheatConfig == null)
{
WriteLog(text + " not found. Using thunder store config values instead.");
cheatConfig = new CheatConfig();
}
cheatConfig.ReadValues();
return cheatConfig;
}
private static void WriteLog(string message)
{
((BaseUnityPlugin)Instance).Logger.LogInfo((object)message);
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "Josiwe.ATS.Cheats";
public const string PLUGIN_NAME = "Josiwe.ATS.Cheats";
public const string PLUGIN_VERSION = "1.0.2";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}