Decompiled source of ExperimentiumMod v1.0.0

ExperimentiumMod.dll

Decompiled 2 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ExperimentiumMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ExperimentiumMod")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("457a460f-08a3-4e5f-9083-5f4e1e31f0b9")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.NGeorge.ExperimentiumMod", "Experimentium Mod", "1.0.0")]
public class Main : BaseUnityPlugin
{
	public class ExperimentiumModBehaviour : MonoBehaviour
	{
		public void Update()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Invalid comparison between Unknown and I4
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Invalid comparison between Unknown and I4
			SpecialObj18 obj = Object.FindObjectOfType<SpecialObj18>();
			SpecialObj101Reroll obj2 = Object.FindObjectOfType<SpecialObj101Reroll>();
			LevelMgr val = Object.FindObjectOfType<LevelMgr>();
			FieldInfo field = typeof(SpecialObj18).GetField("useTimer", BindingFlags.Instance | BindingFlags.NonPublic);
			FieldInfo field2 = typeof(SpecialObj101Reroll).GetField("useTimer", BindingFlags.Instance | BindingFlags.NonPublic);
			Scene sceneByName;
			if (field != null)
			{
				sceneByName = SceneManager.GetSceneByName("Battle");
				if (((Scene)(ref sceneByName)).isLoaded && (int)val.CurrentRewardType == 5)
				{
					field.SetValue(obj, 0);
				}
			}
			if (field2 != null)
			{
				sceneByName = SceneManager.GetSceneByName("Battle");
				if (((Scene)(ref sceneByName)).isLoaded && (int)val.CurrentRewardType == 6)
				{
					field2.SetValue(obj2, 0);
				}
			}
		}
	}

	private GameObject modObject;

	public void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("com.NGeorge.ExperimentiumMod");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod has loaded!");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Have fun :)))");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"-------------------------------------------------------------------------------------------------");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"                                                                                                 ");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"This mod might have bugs soo if you find any please report them to our discord server.");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"https://discord.gg/WFaxE6A5Ae");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"                                                                                                 ");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"-------------------------------------------------------------------------------------------------");
		val.PatchAll();
		Debug.Log((object)"Harmony patches applied!");
		CreatePersistentObject();
		SceneManager.sceneLoaded += OnSceneLoaded;
	}

	private void CreatePersistentObject()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		if ((Object)(object)modObject == (Object)null)
		{
			modObject = new GameObject("ExperimentiumMod");
			modObject.AddComponent<ExperimentiumModBehaviour>();
			Object.DontDestroyOnLoad((Object)(object)modObject);
		}
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)("Scene loaded: " + ((Scene)(ref scene)).name));
		CreatePersistentObject();
	}
}
namespace ExperimentiumMod;

[HarmonyPatch(typeof(BattleData))]
public class Patch_MaxSpellLevel
{
	[HarmonyPatch("GetSpellFromPool")]
	[HarmonyPrefix]
	public static bool Prefix(ref int level)
	{
		level = 3;
		return true;
	}
}
[HarmonyPatch(typeof(UnitConfig))]
public class Patch_tempShield
{
	[HarmonyPatch("Copy")]
	[HarmonyPostfix]
	public static void Postfix(UnitConfig __instance)
	{
		typeof(UnitConfig).GetField("shieldTemp", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(__instance, 500f);
	}
}