Decompiled source of ZoomUnlocker v1.0.0

VRisingMod.dll

Decompiled 9 months 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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
using ProjectM.UI;
using UnityEngine;
using VRisingMod;
using kush;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("VRisingMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Lead a horse to a well to make it drink.")]
[assembly: AssemblyFileVersion("0.5.11.0")]
[assembly: AssemblyInformationalVersion("0.5.11+4.Branch.main.Sha.143926a745aa398f53ca0d7133c2bb315ae4c64d")]
[assembly: AssemblyProduct("VRisingMod")]
[assembly: AssemblyTitle("VRisingMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.5.11.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 VRisingMod
{
	public class VModComp : MonoBehaviour
	{
		private void Update()
		{
			try
			{
			}
			catch (Exception ex)
			{
				kush.VRisingMod.Logger.LogInfo((object)ex);
			}
		}
	}
	[HarmonyPatch(typeof(MiniMapHUDSystem), "_TryInitializeMiniMap_b__23_1")]
	public class MiniMapHUDSystem1
	{
		private static bool Prefix(ref MiniMapHUDSystem __instance)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			ManualLogSource logger = kush.VRisingMod.Logger;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(5, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Zoom ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(__instance._MapScale);
			}
			logger.LogInfo(val);
			MiniMapHUDSystem obj = __instance;
			obj._MapScale *= 0.8f;
			return false;
		}
	}
	[HarmonyPatch(typeof(MiniMapHUDSystem), "_TryInitializeMiniMap_b__23_0")]
	public class MiniMapHUDSystem2
	{
		private static bool Prefix(ref MiniMapHUDSystem __instance)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			ManualLogSource logger = kush.VRisingMod.Logger;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(5, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Zoom ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(__instance._MapScale);
			}
			logger.LogInfo(val);
			MiniMapHUDSystem obj = __instance;
			obj._MapScale /= 0.8f;
			return false;
		}
	}
}
namespace kush
{
	internal class Hooks
	{
	}
	internal static class Util
	{
		public static T getField<T>(this Type obj, string field)
		{
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic;
			try
			{
				return (T)obj.GetField(field, bindingAttr).GetValue(null);
			}
			catch (Exception ex)
			{
				Debug.Log(Object.op_Implicit("Error: " + ex));
			}
			return default(T);
		}

		public static T getFieldStatic<T>(this Type obj, string field)
		{
			BindingFlags bindingAttr = BindingFlags.Static | BindingFlags.NonPublic;
			try
			{
				return (T)obj.GetField(field, bindingAttr).GetValue(null);
			}
			catch (Exception ex)
			{
				Debug.Log(Object.op_Implicit("Error: " + ex));
			}
			return default(T);
		}

		public static void setField(this Type obj, string field, object value)
		{
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic;
			try
			{
				obj.GetField(field, bindingAttr).SetValue(null, value);
			}
			catch (Exception ex)
			{
				Debug.Log(Object.op_Implicit("Error: " + ex));
			}
		}

		public static void setFieldStatic(this Type obj, string field, object value)
		{
			BindingFlags bindingAttr = BindingFlags.Static | BindingFlags.NonPublic;
			try
			{
				obj.GetField(field, bindingAttr).SetValue(null, value);
			}
			catch (Exception ex)
			{
				Debug.Log(Object.op_Implicit("Error: " + ex));
			}
		}

		public static T getField<T>(this object obj, string field, bool isStatic = false)
		{
			BindingFlags bindingAttr = ((!isStatic) ? (BindingFlags.Instance | BindingFlags.NonPublic) : (BindingFlags.Static | BindingFlags.NonPublic));
			try
			{
				return (T)obj.GetType().GetField(field, bindingAttr).GetValue(obj);
			}
			catch (Exception ex)
			{
				Debug.Log(Object.op_Implicit("Error: " + ex?.ToString() + " obj " + ((obj == null) ? "null" : obj.GetType().Name) + " method " + field));
			}
			return default(T);
		}

		public static T getFieldPublic<T>(this object obj, string field)
		{
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public;
			try
			{
				return (T)obj.GetType().GetField(field, bindingAttr).GetValue(obj);
			}
			catch (Exception ex)
			{
				Debug.Log(Object.op_Implicit("Error: " + ex?.ToString() + " obj " + ((obj == null) ? "null" : obj.GetType().Name) + " method " + field));
			}
			return default(T);
		}

		public static void setField(this object obj, string field, object value)
		{
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic;
			try
			{
				obj.GetType().GetField(field, bindingAttr).SetValue(obj, value);
			}
			catch (Exception ex)
			{
				Debug.Log(Object.op_Implicit("Error: " + ex));
			}
		}

		public static void callMethod(this Type obj, string method, object[] pars)
		{
			BindingFlags bindingAttr = BindingFlags.Static | BindingFlags.NonPublic;
			try
			{
				obj.GetMethod(method, bindingAttr).Invoke(null, pars);
			}
			catch (Exception ex)
			{
				Debug.Log(Object.op_Implicit("Error: " + ex));
			}
		}

		public static void callMethod(this object obj, string method, object[] pars = null)
		{
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic;
			try
			{
				obj.GetType().GetMethod(method, bindingAttr).Invoke(obj, pars);
			}
			catch (Exception ex)
			{
				Debug.Log(Object.op_Implicit("Error: " + ex?.ToString() + " obj " + ((obj == null) ? "null" : obj.GetType().Name) + " method " + method));
			}
		}

		public static long GetMillis()
		{
			return DateTime.Now.Ticks / 10000;
		}

		public static T callMethodParams<T>(this object obj, string method, object[] pars)
		{
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic;
			try
			{
				return (T)obj.GetType().GetMethod(method, bindingAttr).Invoke(obj, pars);
			}
			catch (Exception ex)
			{
				Debug.Log(Object.op_Implicit("Error: " + ex));
			}
			return default(T);
		}
	}
	[BepInPlugin("VRisingMod", "kushzei", "1.0.0")]
	public class VRisingMod : BasePlugin
	{
		public const string creator = "kushzei";

		public static ManualLogSource Logger;

		public const string version = "1.0.0";

		public const string guid = "VRisingMod";

		private Harmony _hi = null;

		private static VRisingMod inst;

		public static VRisingMod Get()
		{
			return inst;
		}

		public void Start()
		{
			((BasePlugin)this).Log.LogInfo((object)"Starting kushlands");
		}

		public override void Load()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			inst = this;
			Logger = ((BasePlugin)this).Log;
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(21, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("VRisingMod");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded v2!");
			}
			log.LogInfo(val);
			_hi = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
			if (!ClassInjector.IsTypeRegisteredInIl2Cpp<VModComp>())
			{
				ClassInjector.RegisterTypeInIl2Cpp<VModComp>();
			}
			((BasePlugin)this).AddComponent<VModComp>();
		}
	}
}