Decompiled source of YNGgamevision v1.0.0

BepInEx/plugins/YNGgamevision/YNGgamevision.dll

Decompiled 2 years ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Photon.Pun;
using TestModForRepo.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("TestModForRepo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestModForRepo")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("df5667d6-d34d-4067-8647-e904005683fd")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TestModForRepo
{
	[BepInPlugin("yngprodaction.repo.vision", "R.E.P.O. testing", "0.5.0")]
	public class TestMod : BaseUnityPlugin
	{
		public const string pluginGuid = "yngprodaction.repo.vision";

		public const string pluginName = "R.E.P.O. testing";

		public const string pluginVersion = "0.5.0";

		public void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod R.E.P.O. testing was launched");
			Harmony val = new Harmony("yngprodaction.repo.vision");
			val.PatchAll(typeof(TextChatPatch));
			val.PatchAll(typeof(UpgradePatch));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Method ChatMessageSend was altered");
		}
	}
}
namespace TestModForRepo.Patches
{
	[HarmonyPatch(typeof(PlayerAvatar))]
	public static class TextChatPatch
	{
		[HarmonyPatch("ChatMessageSend")]
		[HarmonyPrefix]
		public static void ChatMessageSendPatch(PlayerAvatar __instance, ref string _message, ref bool _debugMessage)
		{
			_message = "ya loh bez voicechata";
		}
	}
	[HarmonyPatch(typeof(PunManager))]
	public static class UpgradePatch
	{
		[HarmonyPatch("UpgradePlayerEnergy")]
		[HarmonyPrefix]
		public static bool UpgradePlayerEnergyPatch(PunManager __instance, StatsManager ___statsManager, PhotonView ___photonView)
		{
			ManualLogSource val = Logger.CreateLogSource("[UpdatePlayerEnergy]");
			val.LogInfo((object)"called");
			Dictionary<string, int> playerUpgradeStamina = ___statsManager.playerUpgradeStamina;
			List<PlayerAvatar> list = SemiFunc.PlayerGetAll();
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				MethodInfo method = ((object)__instance).GetType().GetMethod("UpdateEnergyRightAway", BindingFlags.Instance | BindingFlags.NonPublic);
				foreach (PlayerAvatar item in list)
				{
					string text = SemiFunc.PlayerGetSteamID(item);
					method.Invoke(__instance, new object[1] { text });
				}
			}
			if (SemiFunc.IsMasterClient())
			{
				foreach (PlayerAvatar item2 in list)
				{
					string text2 = SemiFunc.PlayerGetSteamID(item2);
					playerUpgradeStamina[text2]++;
					___photonView.RPC("UpgradePlayerEnergyRPC", (RpcTarget)1, new object[2]
					{
						text2,
						___statsManager.playerUpgradeStamina[text2]
					});
				}
			}
			return false;
		}
	}
}