Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Repo Training v1.2.0
Repo_Training.dll
Decompiled 3 months agousing 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 UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Repo_Training")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Repo_Training")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("edc661b0-040f-4e4d-9cd0-0701a92bb841")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace Repo_Training; [BepInPlugin("Wan7._Repo_Training", "Wan7_Repo_Training", "1.1.1")] [BepInProcess("REPO.exe")] public class Main : BaseUnityPlugin { internal static ManualLogSource Log; private Harmony _harmony; private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("Wan7.Repo_Training"); _harmony.PatchAll(); Log.LogInfo((object)"Wan7_Repo_Training 已加载"); } } [HarmonyPatch(typeof(PlayerController), "FixedUpdate")] public static class Patch_CrouchStandHeal { private static readonly FieldRef<PlayerAvatar, bool> f_isLocal = AccessTools.FieldRefAccess<PlayerAvatar, bool>("isLocal"); private static readonly FieldRef<PlayerHealth, int> f_maxHealth = AccessTools.FieldRefAccess<PlayerHealth, int>("maxHealth"); private static readonly FieldRef<PlayerHealth, int> f_health = AccessTools.FieldRefAccess<PlayerHealth, int>("health"); private static bool hasCrouchPos = false; private static Vector3 crouchPos; private static bool wasCrouching = false; private static void Prefix(PlayerController __instance) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance == (Object)null) && __instance.Crouching) { if (!wasCrouching) { crouchPos = ((Component)__instance).transform.position; hasCrouchPos = true; } wasCrouching = true; } } private static void Postfix(PlayerController __instance) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null) { return; } PlayerAvatar playerAvatarScript = __instance.playerAvatarScript; if ((Object)(object)playerAvatarScript == (Object)null || !f_isLocal.Invoke(playerAvatarScript) || !wasCrouching || __instance.Crouching) { return; } wasCrouching = false; if (!hasCrouchPos) { return; } Vector3 position = ((Component)__instance).transform.position; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(crouchPos.x, crouchPos.z); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(position.x, position.z); if (Vector2.Distance(val, val2) > 0.05f) { hasCrouchPos = false; return; } hasCrouchPos = false; if (position != crouchPos) { hasCrouchPos = false; return; } hasCrouchPos = false; PlayerHealth playerHealth = playerAvatarScript.playerHealth; if (!((Object)(object)playerHealth == (Object)null) && f_health.Invoke(playerHealth) < f_maxHealth.Invoke(playerHealth)) { float energyStart = __instance.EnergyStart; int num = Mathf.FloorToInt(energyStart * 0.2f); if (!(__instance.EnergyCurrent < (float)num)) { __instance.EnergyCurrent -= (float)num; int num2 = Mathf.Max(1, Mathf.FloorToInt((float)f_maxHealth.Invoke(playerHealth) * 0.05f)); playerHealth.Heal(num2, true); } } } }