Decompiled source of DrinkWater v1.1.0

Mods/DrinkWater.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using DrinkWaters;
using Il2CppTMPro;
using MelonLoader;
using RumbleModUI;
using RumbleModdingAPI;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Class1), "DrinkWater", "1.1.0", "Davilonchi", null)]
[assembly: MelonColor(255, 67, 216, 250)]
[assembly: MelonAuthorColor(255, 67, 216, 250)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: AssemblyTitle("DrinkWater")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Davilonchi")]
[assembly: AssemblyProduct("DrinkWater")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("59e042b5-eec0-4b1d-b2c0-fd3520a435e9")]
[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")]
namespace DrinkWaters;

public static class BuildInfo
{
	public const string ModName = "DrinkWater";

	public const string ModVersion = "1.1.0";

	public const string Description = "Reminds you to drink water";

	public const string Author = "Davilonchi";

	public const string Company = "";
}
public class Validation : ValidationParameters
{
	private int Length;

	public Validation(int i)
	{
		Length = i;
	}

	public override bool DoValidation(string Input)
	{
		if (Input.Length == Length)
		{
			return true;
		}
		return false;
	}
}
public class Class1 : MelonMod
{
	private Mod DrinkWater = new Mod();

	private GameObject newtablet;

	private int scenesUntillWater = 10;

	private int waterCounter;

	private bool init;

	private string currentScene = "Loader";

	public void OnUIInit()
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Expected O, but got Unknown
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Expected O, but got Unknown
		DrinkWater.ModName = "DrinkWater";
		DrinkWater.ModVersion = "1.1.0";
		DrinkWater.SetFolder("DrinkWater");
		DrinkWater.AddDescription("Description", "", "Reminds you to drink water", new Tags
		{
			IsSummary = true
		});
		DrinkWater.AddToList("Matches till break", 10, "Number of matches untill you get a warning to drink water next to the matchmaking lever", new Tags());
		DrinkWater.GetFromFile();
		UI.instance.AddMod(DrinkWater);
		MelonLogger.Msg("Added Mod");
		OnSettingSave();
	}

	public void OnSettingSave()
	{
		scenesUntillWater = (int)DrinkWater.Settings[1].SavedValue;
	}

	public override void OnLateInitializeMelon()
	{
		Calls.onMapInitialized += Openning;
		DrinkWater.ModSaved += OnSettingSave;
		UI.instance.UI_Initialized += OnUIInit;
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		init = false;
		currentScene = sceneName;
		switch (sceneName)
		{
		case "Gym":
			newtablet = Object.Instantiate<GameObject>(((Component)GameObject.Find("--------------LOGIC--------------").transform.GetChild(6).GetChild(0).GetChild(0)
				.GetChild(0)
				.GetChild(0)).gameObject);
			CheckWater(sceneName);
			break;
		case "Map0":
		case "Map1":
			waterCounter++;
			break;
		}
	}

	public void Openning()
	{
		init = true;
	}

	public override void OnUpdate()
	{
	}

	public void CheckWater(string sceneName)
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		if (waterCounter >= scenesUntillWater)
		{
			newtablet.active = true;
			newtablet.transform.position = new Vector3(5.28f, 1.5327f, 9.3073f);
			newtablet.transform.localRotation = Quaternion.Euler(0f, 160.9055f, 0f);
			((TMP_Text)((Component)newtablet.transform.GetChild(1).GetChild(0)).GetComponent<TextMeshProUGUI>()).text = "Go ahead and drink some water";
			waterCounter = 0;
		}
	}
}