Decompiled source of LunarDeflation v1.0.0

LunarDeflation.dll

Decompiled 6 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using On.RoR2;
using On.RoR2.UI.MainMenu;
using RoR2;
using RoR2.UI.MainMenu;
using UnityEngine;
using UnityEngine.AddressableAssets;

[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 = "")]
[assembly: AssemblyCompany("LunarDeflation")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LunarDeflation")]
[assembly: AssemblyTitle("LunarDeflation")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LunarDeflation;

[BepInPlugin("com.rob.LunarDeflation", "LunarDeflation", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string MODUID = "com.rob.LunarDeflation";

	private void Awake()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		BaseMainMenuScreen.Awake += new hook_Awake(BaseMainMenuScreen_Awake);
		PurchaseInteraction.Awake += new hook_Awake(PurchaseInteraction_Awake);
	}

	private void PurchaseInteraction_Awake(orig_Awake orig, PurchaseInteraction self)
	{
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		orig.Invoke(self);
		if (Object.op_Implicit((Object)(object)self) && ((Object)self).name.Contains("LunarShopTerminal"))
		{
			((Component)self).gameObject.AddComponent<LunarPriceSetter>();
		}
		if (Object.op_Implicit((Object)(object)self) && ((Object)self).name.Contains("ShrineRestack"))
		{
			self.costType = (CostTypeIndex)0;
			self.cost = 0;
		}
		if (Object.op_Implicit((Object)(object)self) && ((Object)self).name.Contains("SeerStation"))
		{
			((Component)self).gameObject.AddComponent<LunarPriceSetter>();
		}
		if (Object.op_Implicit((Object)(object)self) && ((Object)self).name.Contains("NewtStatue"))
		{
			self.costType = (CostTypeIndex)0;
			self.cost = 0;
		}
		if (Object.op_Implicit((Object)(object)self) && ((Object)self).name.Contains("FrogInteractable"))
		{
			self.costType = (CostTypeIndex)0;
			self.cost = 0;
		}
	}

	private void BaseMainMenuScreen_Awake(orig_Awake orig, BaseMainMenuScreen self)
	{
		ReduceCosts();
		orig.Invoke(self);
	}

	private void ReduceCosts()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ShrineRestack/ShrineRestack.prefab").WaitForCompletion();
		if (Object.op_Implicit((Object)(object)val))
		{
			PurchaseInteraction component = val.GetComponent<PurchaseInteraction>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.cost = 0;
				component.costType = (CostTypeIndex)0;
			}
		}
		val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/bazaar/SeerStation.prefab").WaitForCompletion();
		if (Object.op_Implicit((Object)(object)val))
		{
			PurchaseInteraction component2 = val.GetComponent<PurchaseInteraction>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				component2.cost = 1;
				component2.automaticallyScaleCostWithDifficulty = false;
			}
			val.AddComponent<LunarPriceSetter>();
		}
		val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarShopTerminal/LunarShopTerminal.prefab").WaitForCompletion();
		if (Object.op_Implicit((Object)(object)val))
		{
			PurchaseInteraction component3 = val.GetComponent<PurchaseInteraction>();
			if (Object.op_Implicit((Object)(object)component3))
			{
				component3.cost = 1;
				component3.automaticallyScaleCostWithDifficulty = false;
			}
			val.AddComponent<LunarPriceSetter>();
		}
	}
}
public class LunarPriceSetter : MonoBehaviour
{
	private void Start()
	{
		PurchaseInteraction component = ((Component)this).GetComponent<PurchaseInteraction>();
		if (Object.op_Implicit((Object)(object)component))
		{
			component.cost = 1;
			component.automaticallyScaleCostWithDifficulty = false;
		}
		Object.Destroy((Object)(object)this);
	}
}