Decompiled source of GameVersionForger v1.0.1

GameVersionForger.dll

Decompiled 4 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LethalPlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalPlugin")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0e442c44-8597-4d85-abe7-d8d3cc7d1e3f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LethalPlugin;

[BepInPlugin("Vrtua.LethalPlugin.pluginX.LethalPluginXII", "LethalPluginXII", "1.0.0")]
public class LethalPluginXII : BaseUnityPlugin
{
	public static ConfigEntry<string> _versionString;

	private void Awake()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully load Patch");
		new Harmony("Vrtua.LethalPlugin.plugin.LethalPluginXII");
		new Harmony("Vrtua.LethalPlugin.pluginX.LethalPluginXII").PatchAll();
		_versionString = ((BaseUnityPlugin)this).Config.Bind<string>("General", "version", "v1.0", "The version of the plugin.");
		_versionString.SettingChanged += OnConfigChanged;
	}

	private void OnConfigChanged(object sender, EventArgs e)
	{
		ReadVersion();
	}

	private void ReadVersion()
	{
		GlobalsVar._version = _versionString.Value;
		((BaseUnityPlugin)this).Logger.LogInfo((object)("Current Version: " + _versionString.Value));
	}
}
public class GlobalsVar
{
	public static bool inserted;

	public static string _version;

	public static int _original_version;

	public static ConfigEntry<KeyboardShortcut> ShowCounter { get; set; }
}
[HarmonyPatch(typeof(GameNetworkManager))]
[HarmonyPatch("Awake")]
internal class Patch_O
{
	public static void Postfix(GameNetworkManager __instance)
	{
		GlobalsVar._original_version = __instance.gameVersionNum;
	}
}
[HarmonyPatch(typeof(LobbySlot))]
[HarmonyPatch("Awake")]
internal class Patch
{
	public static void Prefix()
	{
		string text = GlobalsVar._version;
		string text2 = "O";
		if (text.StartsWith("+"))
		{
			text = text.Substring(1);
			text2 = "P";
		}
		else if (text.StartsWith("-"))
		{
			text = text.Substring(1);
			text2 = "N";
		}
		int result = 0;
		if (int.TryParse(text, out result))
		{
			if (text2.Equals("P"))
			{
				GameNetworkManager.Instance.gameVersionNum = GlobalsVar._original_version + result;
			}
			else if (text2.Equals("N"))
			{
				GameNetworkManager.Instance.gameVersionNum = GlobalsVar._original_version - result;
			}
			else
			{
				GameNetworkManager.Instance.gameVersionNum = result;
			}
		}
	}
}