Decompiled source of AlternativeGoldScaling v1.0.1

plugins/AlternativeGoldScaling.dll

Decompiled 3 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using MiscFixes.Modules;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using RiskOfOptions;
using RoR2;
using SS2;
using SS2.Components;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AlternativeGoldScaling")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+72a487fa6fd16a475ca63fb19b4fccc0b5024d4d")]
[assembly: AssemblyProduct("AlternativeGoldScaling")]
[assembly: AssemblyTitle("AlternativeGoldScaling")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 AlternativeGoldScaling
{
	public static class ConfigOptions
	{
		private const string _wrbGoldRewardSectionName = "WRB - Enemy gold reward scaling";

		public static ConfigEntry<bool> EnableWRBGoldScaling;

		public static ConfigEntry<float> BaseGoldScalingMultiplier;

		public static ConfigEntry<float> LoopMultiplier;

		public static ConfigEntry<float> StageDivisor;

		public static ConfigEntry<float> StageClearCountMultiplier;

		public static ConfigEntry<float> StageMultiplier;

		public static ConfigEntry<float> SquareRootMultiplier;

		public static ConfigEntry<float> StageAndLoopMultiplier;

		private const string _wrbMultiplayerCostSectionName = "WRB - Multiplayer cost scaling";

		public static ConfigEntry<bool> EnableWRBMultiplayerCostScaling;

		public static ConfigEntry<float> BaseMultiplayerCostMultiplier;

		public static ConfigEntry<float> PerPlayerCostMultiplier;

		private const string _ss2EntireSectionName = "Starstorm 2 - Late-game elites support";

		public static ConfigEntry<bool> EnableSS2Support;

		private const string _ss2EmpyreanSectionName = "Starstorm 2 - Empyrean Gold Reward";

		public static ConfigEntry<bool> SS2Empyrean_EnableChange;

		public static ConfigEntry<float> SS2Empyrean_NerfBaseMultiplier;

		public static ConfigEntry<int> SS2Empyrean_StageOfNerfStart;

		public static ConfigEntry<float> SS2Empyrean_NerfPerStageMultiplier;

		private const string _ss2EtherealSectionName = "Starstorm 2 - Ethereal Gold Reward";

		public static ConfigEntry<bool> SS2Ethereal_EnableChange;

		public static ConfigEntry<float> SS2Ethereal_NerfBaseMultiplier;

		public static ConfigEntry<float> SS2Ethereal_EtherealsUsedMultiplier;

		public static ConfigEntry<int> SS2Ethereal_StageOfNerfStart;

		public static ConfigEntry<float> SS2Ethereal_NerfPerStageMultiplier;

		private const string _ss2UltraSectionName = "Starstorm 2 - Ultra Gold Reward";

		public static ConfigEntry<bool> SS2Ultra_EnableChange;

		public static ConfigEntry<float> SS2Ultra_NerfBaseMultiplier;

		public static ConfigEntry<float> SS2Ultra_EtherealsUsedMultiplier;

		public static ConfigEntry<int> SS2Ultra_StageOfNerfStart;

		public static ConfigEntry<float> SS2Ultra_NerfPerStageMultiplier;

		internal static void BindConfigOptions(ConfigFile config)
		{
			if (ModSupport.RiskOfOptionsMod.ModIsRunning)
			{
				ModSupport.RiskOfOptionsMod.SetRiskOfOptionsDescription();
			}
			BindWRBGoldRewardOptions(config);
			BindWRBMultiplayerGoldScalingOptions(config);
			BindSS2Options(config);
			Extensions.WipeConfig(config);
		}

		private static void BindWRBGoldRewardOptions(ConfigFile config)
		{
			EnableWRBGoldScaling = Extensions.BindOption<bool>(config, "WRB - Enemy gold reward scaling", "Enable", "Enable using the formula from Well-Rounded Balance (WRB) for scaling gold from enemy kills?\n\nFormula for gold reward: Minimum value between Vanilla Gold Reward * Base Multiplier and Base Multiplier * ((Vanilla Gold Reward / (Stage Divisor + (Stage Clear Count * Stage Clear Count Multiplier))) + Square Root(Square Root Multiplier * (Stage And Loop Multiplier + (Stage Clear Count * Stage Multiplier + Loop Clear Count * Loop Multiplier))))", true, (ConfigFlags)1);
			BaseGoldScalingMultiplier = Extensions.BindOptionSteppedSlider(config, "WRB - Enemy gold reward scaling", "Base Multiplier", "WRB's default value is 0.75", 1.13f, 0.01f, 0.01f, 2.5f, (ConfigFlags)0);
			LoopMultiplier = Extensions.BindOptionSteppedSlider(config, "WRB - Enemy gold reward scaling", "Loop Multiplier", "WRB's default value is unchanged", -660f, 5f, -1000f, 500f, (ConfigFlags)0);
			StageDivisor = Extensions.BindOptionSlider<float>(config, "WRB - Enemy gold reward scaling", "Stage Divisor", "WRB's default value is 3", 2f, (ConfigFlags)0);
			StageClearCountMultiplier = Extensions.BindOptionSlider<float>(config, "WRB - Enemy gold reward scaling", "Stage Clear Count Multiplier", "WRB's default value is 0.25", 0.5f, (ConfigFlags)0);
			StageMultiplier = Extensions.BindOptionSteppedSlider(config, "WRB - Enemy gold reward scaling", "Stage Multiplier", "WRB's default value is unchanged", 150f, 5f, 0f, 300f, (ConfigFlags)0);
			SquareRootMultiplier = Extensions.BindOptionSlider<float>(config, "WRB - Enemy gold reward scaling", "Square Root Multiplier", "WRB's default value is unchanged", 6f, (ConfigFlags)0);
			StageAndLoopMultiplier = Extensions.BindOptionSteppedSlider(config, "WRB - Enemy gold reward scaling", "Stage and Loop Multiplier", "WRB's default value is unchanged", 275f, 5f, 0f, 500f, (ConfigFlags)0);
		}

		private static void BindWRBMultiplayerGoldScalingOptions(ConfigFile config)
		{
			EnableWRBMultiplayerCostScaling = Extensions.BindOption<bool>(config, "WRB - Multiplayer cost scaling", "Enable", "Enable using the formula from Well-Rounded Balance (WRB) for scaling the cost of buyable things in multiplayer?\n\nFormula for cost scaling: Base Multiplier + (Per-Player Multiplier / Square Root(Player Count))", true, (ConfigFlags)0);
			BaseMultiplayerCostMultiplier = Extensions.BindOptionSlider<float>(config, "WRB - Multiplayer cost scaling", "Base Multiplier", "WRB's default value is unchanged", 1f, (ConfigFlags)0);
			PerPlayerCostMultiplier = Extensions.BindOptionSlider<float>(config, "WRB - Multiplayer cost scaling", "Per-Player cost multiplier", "WRB's default value is unchanged", 0.11f, (ConfigFlags)0);
		}

		private static void BindSS2Options(ConfigFile config)
		{
			EnableSS2Support = Extensions.BindOption<bool>(config, "Starstorm 2 - Late-game elites support", "Enable", "Enable special support for nerfing the gold reward from some late-game elites from Starstorm 2? The gold reward nerf for these elites are ON TOP OF the existing gold nerf from WRB if it's enabled.\n\nFormula for gold reward: Base Gold Reward * Highest value between 1 and (Base Multiplier + IF APPLICABLE (Ethereal Multiplier * Ethereals Used Count)) / (1 + (Highest value between 0 and ((Stage Clear Count + 1) - Starting Stage of Nerf) * Per-Stage Multiplier))", true, (ConfigFlags)1);
			SS2Empyrean_EnableChange = Extensions.BindOption<bool>(config, "Starstorm 2 - Empyrean Gold Reward", "Enable Empyrean Gold Reward Change", "", true, (ConfigFlags)1);
			SS2Empyrean_NerfBaseMultiplier = Extensions.BindOptionSlider<float>(config, "Starstorm 2 - Empyrean Gold Reward", "Empyrean - Base Multiplier", "", 10f, (ConfigFlags)0);
			SS2Empyrean_StageOfNerfStart = Extensions.BindOptionSlider<int>(config, "Starstorm 2 - Empyrean Gold Reward", "Empyrean - Starting stage of nerf", "", 9, (ConfigFlags)0);
			SS2Empyrean_NerfPerStageMultiplier = Extensions.BindOptionSlider<float>(config, "Starstorm 2 - Empyrean Gold Reward", "Empyrean - Per-Stage multiplier", "", 0.5f, (ConfigFlags)0);
			SS2Ethereal_EnableChange = Extensions.BindOption<bool>(config, "Starstorm 2 - Ethereal Gold Reward", "Enable Ethereal Gold Reward Change", "THIS IS FOR THE BETA VERSION OF SS2", false, (ConfigFlags)1);
			SS2Ethereal_NerfBaseMultiplier = Extensions.BindOptionSlider<float>(config, "Starstorm 2 - Ethereal Gold Reward", "Ethereal - Base Multiplier", "", 2f, (ConfigFlags)0);
			SS2Ethereal_EtherealsUsedMultiplier = Extensions.BindOptionSlider<float>(config, "Starstorm 2 - Ethereal Gold Reward", "Ethereal - Ethereals-used Multiplier", "", 2f, (ConfigFlags)0);
			SS2Ethereal_StageOfNerfStart = Extensions.BindOptionSlider<int>(config, "Starstorm 2 - Ethereal Gold Reward", "Ethereal - Starting stage of nerf", "", 8, (ConfigFlags)0);
			SS2Ethereal_NerfPerStageMultiplier = Extensions.BindOptionSlider<float>(config, "Starstorm 2 - Ethereal Gold Reward", "Ethereal - Per-Stage multiplier", "", 0.35f, (ConfigFlags)0);
			SS2Ultra_EnableChange = Extensions.BindOption<bool>(config, "Starstorm 2 - Ultra Gold Reward", "Enable Ultra Gold Reward Change", "THIS IS FOR THE BETA VERSION OF SS2", false, (ConfigFlags)1);
			SS2Ultra_NerfBaseMultiplier = Extensions.BindOptionSlider<float>(config, "Starstorm 2 - Ultra Gold Reward", "Ultra - Base Multiplier", "", 15f, (ConfigFlags)0);
			SS2Ultra_EtherealsUsedMultiplier = Extensions.BindOptionSlider<float>(config, "Starstorm 2 - Ultra Gold Reward", "Ultra - Ethereals-used Multiplier", "", 20f, (ConfigFlags)0);
			SS2Ultra_StageOfNerfStart = Extensions.BindOptionSlider<int>(config, "Starstorm 2 - Ultra Gold Reward", "Ultra - Starting stage of nerf", "", 12, (ConfigFlags)0);
			SS2Ultra_NerfPerStageMultiplier = Extensions.BindOptionSlider<float>(config, "Starstorm 2 - Ultra Gold Reward", "Ultra - Per-Stage multiplier", "", 0.8f, (ConfigFlags)0);
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	internal static class Main
	{
		internal static class Hooks
		{
			internal static void DeathRewards_OnKilledServer(orig_OnKilledServer orig, DeathRewards self, DamageReport damageReport)
			{
				self.goldReward = GetWRBGoldReward(self.goldReward);
				orig.Invoke(self, damageReport);
			}

			internal static void Run_GetDifficultyScaledCost_int_float(ILContext il)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1.25f)
				}))
				{
					int index = val.Index;
					val.Index = index + 1;
					val.EmitDelegate<Func<float, float>>((Func<float, float>)delegate(float orig)
					{
						int participatingPlayerCount = Run.instance.participatingPlayerCount;
						float num = ConfigOptions.BaseMultiplayerCostMultiplier.Value + ConfigOptions.PerPlayerCostMultiplier.Value / Mathf.Sqrt((float)participatingPlayerCount);
						return (participatingPlayerCount > 1) ? num : orig;
					});
				}
				else
				{
					Log.Error("COULD NOT IL HOOK " + ((MemberReference)il.Method).Name);
					Log.Warning($"cursor is {val}");
					Log.Warning($"il is {il}");
				}
			}
		}

		internal static int CurrentStageNumber => Run.instance.stageClearCount + 1;

		internal static uint GetWRBGoldReward(uint goldReward)
		{
			return Convert.ToUInt32(Mathf.Min((float)goldReward * ConfigOptions.BaseGoldScalingMultiplier.Value, ConfigOptions.BaseGoldScalingMultiplier.Value * ((float)goldReward / (ConfigOptions.StageDivisor.Value + (float)Run.instance.stageClearCount * ConfigOptions.StageClearCountMultiplier.Value) + Mathf.Sqrt(ConfigOptions.SquareRootMultiplier.Value * (ConfigOptions.StageAndLoopMultiplier.Value + ((float)Run.instance.stageClearCount * ConfigOptions.StageMultiplier.Value + (float)Run.instance.loopClearCount * ConfigOptions.LoopMultiplier.Value))))));
		}
	}
	internal static class ModSupport
	{
		internal static class RiskOfOptionsMod
		{
			private static bool? _modexists;

			public static bool ModIsRunning
			{
				get
				{
					if (!_modexists.HasValue)
					{
						_modexists = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
					}
					return _modexists.Value;
				}
			}

			[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
			internal static void SetRiskOfOptionsDescription()
			{
				ModSettingsManager.SetModDescription("A standalone version of the Well-Rounded Balance mod's gold scaling, with some more values now configurable + some mod support.");
			}
		}

		internal static class Starstorm2
		{
			private enum EtherealEliteType
			{
				Ethereal,
				Ultra
			}

			[HarmonyPatch]
			internal class EmpyreanGoldReward
			{
				[HarmonyPatch(typeof(CustomEliteDirector), "MakeEmpyrean")]
				[HarmonyILManipulator]
				internal static void Patch(ILContext il)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0007: Expected O, but got Unknown
					//IL_0074: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val = new ILCursor(il);
					if (!val.TryGotoNext((MoveType)1, new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallvirt<DeathRewards>(x, "set_goldReward")
					}))
					{
						Log.Error("COULD NOT IL HOOK " + ((MemberReference)il.Method).Name);
						Log.Warning($"cursor is {val}");
						Log.Warning($"il is {il}");
					}
					else
					{
						val.Emit(OpCodes.Ldloc, 3);
						val.EmitDelegate<Func<uint, DeathRewards, uint>>((Func<uint, DeathRewards, uint>)((uint oldGoldReward, DeathRewards deathRewards) => GetNewEmpyreanGoldReward(deathRewards.goldReward)));
					}
				}
			}

			[HarmonyPatch]
			internal class EmpyreanGoldReward_Beta
			{
				[HarmonyPatch(typeof(Empyrean), "MakeElite")]
				[HarmonyILManipulator]
				internal static void Patch(ILContext il)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0007: Expected O, but got Unknown
					//IL_0074: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val = new ILCursor(il);
					if (!val.TryGotoNext((MoveType)1, new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallvirt<DeathRewards>(x, "set_goldReward")
					}))
					{
						Log.Error("COULD NOT IL HOOK " + ((MemberReference)il.Method).Name);
						Log.Warning($"cursor is {val}");
						Log.Warning($"il is {il}");
					}
					else
					{
						val.Emit(OpCodes.Ldloc, 3);
						val.EmitDelegate<Func<uint, DeathRewards, uint>>((Func<uint, DeathRewards, uint>)((uint oldGoldReward, DeathRewards deathRewards) => GetNewEmpyreanGoldReward(deathRewards.goldReward)));
					}
				}
			}

			[HarmonyPatch]
			internal class EtherealGoldReward
			{
				[HarmonyPatch(typeof(Ethereal), "MakeElite")]
				[HarmonyILManipulator]
				internal static void Patch(ILContext il)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0007: Expected O, but got Unknown
					//IL_0074: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val = new ILCursor(il);
					if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallvirt<DeathRewards>(x, "set_goldReward")
					}))
					{
						Log.Error("COULD NOT IL HOOK " + ((MemberReference)il.Method).Name);
						Log.Warning($"cursor is {val}");
						Log.Warning($"il is {il}");
					}
					else
					{
						val.Emit(OpCodes.Ldloc, 4);
						val.EmitDelegate<Func<uint, DeathRewards, uint>>((Func<uint, DeathRewards, uint>)((uint oldGoldReward, DeathRewards deathRewards) => GetNewEtherealGoldReward(EtherealEliteType.Ethereal, deathRewards.goldReward)));
					}
				}
			}

			[HarmonyPatch]
			internal class UltraGoldReward
			{
				[HarmonyPatch(typeof(Ultra), "MakeElite")]
				[HarmonyILManipulator]
				internal static void Patch(ILContext il)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0007: Expected O, but got Unknown
					//IL_0074: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val = new ILCursor(il);
					if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallvirt<DeathRewards>(x, "set_goldReward")
					}))
					{
						Log.Error("COULD NOT IL HOOK " + ((MemberReference)il.Method).Name);
						Log.Warning($"cursor is {val}");
						Log.Warning($"il is {il}");
					}
					else
					{
						val.Emit(OpCodes.Ldloc, 4);
						val.EmitDelegate<Func<uint, DeathRewards, uint>>((Func<uint, DeathRewards, uint>)((uint oldGoldReward, DeathRewards deathRewards) => GetNewEtherealGoldReward(EtherealEliteType.Ultra, deathRewards.goldReward)));
					}
				}
			}

			private static bool? _modexists;

			private static bool? _isBetaVersion;

			internal static bool ModIsRunning
			{
				get
				{
					bool valueOrDefault = _modexists.GetValueOrDefault();
					if (!_modexists.HasValue)
					{
						valueOrDefault = Chainloader.PluginInfos.ContainsKey("com.TeamMoonstorm");
						_modexists = valueOrDefault;
					}
					return _modexists.Value;
				}
			}

			internal static bool IsBetaVersion
			{
				get
				{
					bool valueOrDefault = _isBetaVersion.GetValueOrDefault();
					if (!_isBetaVersion.HasValue)
					{
						valueOrDefault = Chainloader.PluginInfos.TryGetValue("com.TeamMoonstorm", out var value) && value.Metadata.Version.ToString() == "0.6.16";
						_isBetaVersion = valueOrDefault;
					}
					return _isBetaVersion.Value;
				}
			}

			[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
			private static uint GetNewEtherealGoldReward(EtherealEliteType eliteType, uint goldReward)
			{
				EtherealBehavior instance = EtherealBehavior.instance;
				float num = 0f;
				float num2 = 0f;
				int num3 = 0;
				float num4 = 0f;
				switch (eliteType)
				{
				case EtherealEliteType.Ethereal:
					num = ConfigOptions.SS2Ethereal_NerfBaseMultiplier.Value;
					num2 = ConfigOptions.SS2Ethereal_EtherealsUsedMultiplier.Value;
					num3 = ConfigOptions.SS2Ethereal_StageOfNerfStart.Value;
					num4 = ConfigOptions.SS2Ethereal_NerfPerStageMultiplier.Value;
					break;
				case EtherealEliteType.Ultra:
					num = ConfigOptions.SS2Ultra_NerfBaseMultiplier.Value;
					num2 = ConfigOptions.SS2Ultra_EtherealsUsedMultiplier.Value;
					num3 = ConfigOptions.SS2Ultra_StageOfNerfStart.Value;
					num4 = ConfigOptions.SS2Ultra_NerfPerStageMultiplier.Value;
					break;
				}
				return goldReward *= Convert.ToUInt32(MathF.Max(1f, (num + num2 * (float)instance.etherealsCompleted) / (1f + MathF.Max(0f, (float)(Main.CurrentStageNumber - num3) * num4))));
			}

			private static uint GetNewEmpyreanGoldReward(uint goldReward)
			{
				float value = ConfigOptions.SS2Empyrean_NerfBaseMultiplier.Value;
				int value2 = ConfigOptions.SS2Empyrean_StageOfNerfStart.Value;
				float value3 = ConfigOptions.SS2Empyrean_NerfPerStageMultiplier.Value;
				return goldReward *= Convert.ToUInt32(MathF.Max(1f, value / (1f + MathF.Max(0f, (float)(Main.CurrentStageNumber - value2) * value3))));
			}
		}
	}
	[BepInPlugin("LordVGames.AlternativeGoldScaling", "AlternativeGoldScaling", "1.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnKilledServer <0>__DeathRewards_OnKilledServer;

			public static Manipulator <1>__Run_GetDifficultyScaledCost_int_float;
		}

		public const string PluginGUID = "LordVGames.AlternativeGoldScaling";

		public const string PluginAuthor = "LordVGames";

		public const string PluginName = "AlternativeGoldScaling";

		public const string PluginVersion = "1.0.2";

		public void Awake()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			ConfigOptions.BindConfigOptions(((BaseUnityPlugin)this).Config);
			if (ConfigOptions.EnableWRBGoldScaling.Value)
			{
				object obj = <>O.<0>__DeathRewards_OnKilledServer;
				if (obj == null)
				{
					hook_OnKilledServer val = Main.Hooks.DeathRewards_OnKilledServer;
					<>O.<0>__DeathRewards_OnKilledServer = val;
					obj = (object)val;
				}
				DeathRewards.OnKilledServer += (hook_OnKilledServer)obj;
			}
			if (ConfigOptions.EnableWRBMultiplayerCostScaling.Value)
			{
				object obj2 = <>O.<1>__Run_GetDifficultyScaledCost_int_float;
				if (obj2 == null)
				{
					Manipulator val2 = Main.Hooks.Run_GetDifficultyScaledCost_int_float;
					<>O.<1>__Run_GetDifficultyScaledCost_int_float = val2;
					obj2 = (object)val2;
				}
				Run.GetDifficultyScaledCost_int_float += (Manipulator)obj2;
			}
			if (!ModSupport.Starstorm2.ModIsRunning || !ConfigOptions.EnableSS2Support.Value)
			{
				return;
			}
			Harmony val3 = new Harmony("LordVGames.AlternativeGoldScaling");
			if (ModSupport.Starstorm2.IsBetaVersion)
			{
				Log.Warning("Version number detected is the same as the beta's version! If errors happen while trying to patch, either this mod is broken/outdated or you may have to update your version of Starstorm 2!");
				if (ConfigOptions.SS2Empyrean_EnableChange.Value)
				{
					Log.Info("Patching SS2 beta's empyrean gold reward...");
					val3.CreateClassProcessor(typeof(ModSupport.Starstorm2.EmpyreanGoldReward_Beta)).Patch();
				}
				if (ConfigOptions.SS2Ethereal_EnableChange.Value)
				{
					Log.Info("Patching SS2 beta's ethereal gold reward...");
					val3.CreateClassProcessor(typeof(ModSupport.Starstorm2.EtherealGoldReward)).Patch();
				}
				if (ConfigOptions.SS2Ultra_EnableChange.Value)
				{
					Log.Info("Patching SS2 beta's ultra gold reward...");
					val3.CreateClassProcessor(typeof(ModSupport.Starstorm2.UltraGoldReward)).Patch();
				}
			}
			else if (ConfigOptions.SS2Empyrean_EnableChange.Value)
			{
				Log.Info("Patching SS2's empyrean gold reward...");
				val3.CreateClassProcessor(typeof(ModSupport.Starstorm2.EmpyreanGoldReward)).Patch();
			}
		}
	}
}