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 RandomValue v1.0.1
Repo_Random_value.dll
Decompiled 6 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 Photon.Pun; 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_Random_value")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Repo_Random_value")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("77a69136-ef53-4cbe-9d38-28de5fcf544d")] [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_Random_value; [BepInPlugin("Wan7.repo.randomvalue", "Random Value Mod", "1.0.1")] public class Main : BaseUnityPlugin { internal static ManualLogSource Log; private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Harmony val = new Harmony("Wan7.repo.randomvalue"); val.PatchAll(Assembly.GetExecutingAssembly()); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Wan7_Random Value 已加载"); } } internal static class RandomValueContext { internal static bool InSpawnSetup; } [HarmonyPatch(typeof(ValuableDirector))] [HarmonyPatch("Spawn")] public class Patch_SpawnFlag { private static void Prefix() { RandomValueContext.InSpawnSetup = true; } private static void Postfix() { RandomValueContext.InSpawnSetup = false; } } [HarmonyPatch(typeof(ValuableObject))] [HarmonyPatch("DollarValueSetLogic")] public class Patch_DollarValue { private static readonly FieldInfo f_orig = AccessTools.Field(typeof(ValuableObject), "dollarValueOriginal"); private static readonly FieldInfo f_current = AccessTools.Field(typeof(ValuableObject), "dollarValueCurrent"); private static readonly FieldInfo f_override = AccessTools.Field(typeof(ValuableObject), "dollarValueOverride"); private static readonly FieldInfo f_volume = AccessTools.Field(typeof(ValuableObject), "volumeType"); private static void Postfix(object __instance) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Invalid comparison between Unknown and I4 //IL_015d: Unknown result type (might be due to invalid IL or missing references) if (RandomValueContext.InSpawnSetup || f_orig == null || f_current == null || f_override == null || f_volume == null || (int)f_override.GetValue(__instance) != 0) { return; } float num = (float)f_current.GetValue(__instance); if (!(num <= 0f)) { Type val = (Type)f_volume.GetValue(__instance); float num2 = (((int)val <= 3) ? 300000f : 1200000f); float value = Random.value; float num3 = Mathf.Pow(value, 12f); float num4 = ((Random.value < 0.7f) ? 1f : (-1f)); float num5 = (num2 - num) * num3; float num6 = Mathf.Round(num + num4 * num5); if (num6 < 0f) { num6 = Random.Range(1, Mathf.Max(2, (int)num)); } f_current.SetValue(__instance, num6); f_orig.SetValue(__instance, num6); ManualLogSource log = Main.Log; if (log != null) { log.LogInfo((object)$"[RandomValueMod] volume={val}, base={num}, sign={((num4 > 0f) ? '+' : '-')}, new={num6}"); } } } } [HarmonyPatch(typeof(RoundDirector))] public static class Patch_RoundGoalEasy { private class AdjustFlag : MonoBehaviour { public bool done = false; } private static readonly FieldInfo f_haulGoal = AccessTools.Field(typeof(RoundDirector), "haulGoal"); [HarmonyPatch("StartRoundLogic")] [HarmonyPostfix] public static void Postfix(RoundDirector __instance) { if (!PhotonNetwork.IsMasterClient) { return; } AdjustFlag adjustFlag = ((Component)__instance).GetComponent<AdjustFlag>(); if ((Object)(object)adjustFlag == (Object)null) { adjustFlag = ((Component)__instance).gameObject.AddComponent<AdjustFlag>(); } if (!adjustFlag.done) { int num = (int)f_haulGoal.GetValue(__instance); int num2 = Mathf.RoundToInt((float)num * 0.7f); f_haulGoal.SetValue(__instance, num2); ManualLogSource log = Main.Log; if (log != null) { log.LogInfo((object)$"[RandomValueMod] haulGoal 调整: {num} → {num2}"); } adjustFlag.done = true; } } }