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 RepoUtilities v1.0.0
RepoUtilities.dll
Decompiled 8 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("RepoUtilities")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RepoUtilities")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("0F687366-0F3F-4E05-8A4D-7AB9DCE7009B")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] [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 RepoUtilities { internal static class LoggerManager { private static ManualLogSource ManualLogSource { get; set; } public static void Initialize(ManualLogSource manualLogSource) { ManualLogSource = manualLogSource; LogInfo("Initialized!"); } public static void LogDebug(object data) { Log((LogLevel)32, data); } public static void LogInfo(object data, bool extended = false) { Log((LogLevel)16, data, extended); } public static void LogWarning(object data, bool extended = false) { Log((LogLevel)4, data, extended); } public static void LogError(object data, bool extended = false) { Log((LogLevel)2, data, extended); } public static void LogFatal(object data, bool extended = false) { Log((LogLevel)1, data, extended); } private static void Log(LogLevel logLevel, object data, bool extended = false) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) ManualLogSource manualLogSource = ManualLogSource; if (manualLogSource != null) { manualLogSource.Log(logLevel, data); } } } [BepInPlugin("ITG.REPO.RepoUtilities", "REPO Repo Utilities", "1.0.0")] public class Plugin : BaseUnityPlugin { private readonly Harmony _harmony = new Harmony("ITG.REPO.RepoUtilities"); private void Awake() { LoggerManager.Initialize(Logger.CreateLogSource("ITG.REPO.RepoUtilities")); _harmony.PatchAll(); } } } namespace RepoUtilities.Patches { [HarmonyPatch(typeof(PunManager))] public class PunManagerPatch { private static readonly FieldRef<PunManager, StatsManager> _statsManagerRef = AccessTools.FieldRefAccess<PunManager, StatsManager>("statsManager"); private static readonly FieldRef<StatsManager, Dictionary<string, int>> _playerUpgradeHealthRef = AccessTools.FieldRefAccess<StatsManager, Dictionary<string, int>>("playerUpgradeHealth"); private static readonly FieldRef<StatsManager, Dictionary<string, int>> _playerUpgradeStaminaRef = AccessTools.FieldRefAccess<StatsManager, Dictionary<string, int>>("playerUpgradeStamina"); private static readonly FieldRef<StatsManager, Dictionary<string, int>> _playerUpgradeExtraJumpRef = AccessTools.FieldRefAccess<StatsManager, Dictionary<string, int>>("playerUpgradeExtraJump"); private static readonly FieldRef<StatsManager, Dictionary<string, int>> _playerUpgradeLaunchRef = AccessTools.FieldRefAccess<StatsManager, Dictionary<string, int>>("playerUpgradeLaunch"); private static readonly FieldRef<StatsManager, Dictionary<string, int>> _playerUpgradeMapPlayerCountRef = AccessTools.FieldRefAccess<StatsManager, Dictionary<string, int>>("playerUpgradeMapPlayerCount"); private static readonly FieldRef<StatsManager, Dictionary<string, int>> _playerUpgradeSpeedRef = AccessTools.FieldRefAccess<StatsManager, Dictionary<string, int>>("playerUpgradeSpeed"); private static readonly FieldRef<StatsManager, Dictionary<string, int>> _playerUpgradeStrengthRef = AccessTools.FieldRefAccess<StatsManager, Dictionary<string, int>>("playerUpgradeStrength"); private static readonly FieldRef<StatsManager, Dictionary<string, int>> _playerUpgradeThrowRef = AccessTools.FieldRefAccess<StatsManager, Dictionary<string, int>>("playerUpgradeThrow"); private static readonly FieldRef<StatsManager, Dictionary<string, int>> _playerUpgradeRangeRef = AccessTools.FieldRefAccess<StatsManager, Dictionary<string, int>>("playerUpgradeRange"); private static readonly FieldRef<StatsManager, Dictionary<string, int>> _playerUpgradeCrouchRestRef = AccessTools.FieldRefAccess<StatsManager, Dictionary<string, int>>("playerUpgradeCrouchRest"); private static readonly FieldRef<StatsManager, Dictionary<string, int>> _playerUpgradeTumbleWingsRef = AccessTools.FieldRefAccess<StatsManager, Dictionary<string, int>>("playerUpgradeTumbleWings"); private static readonly Dictionary<string, int> _playerUpgradeSpeed = _playerUpgradeSpeedRef.Invoke(_statsManager); private static readonly Dictionary<string, int> _playerUpgradeStrength = _playerUpgradeStrengthRef.Invoke(_statsManager); private static readonly Dictionary<string, int> _playerUpgradeThrow = _playerUpgradeThrowRef.Invoke(_statsManager); private static readonly Dictionary<string, int> _playerUpgradeRange = _playerUpgradeRangeRef.Invoke(_statsManager); private static readonly Dictionary<string, int> _playerUpgradeCrouchRest = _playerUpgradeCrouchRestRef.Invoke(_statsManager); private static readonly Dictionary<string, int> _playerUpgradeTumbleWings = _playerUpgradeTumbleWingsRef.Invoke(_statsManager); private static readonly Dictionary<string, int> _playerUpgradeHealth = _playerUpgradeHealthRef.Invoke(_statsManager); private static readonly Dictionary<string, int> _playerUpgradeStamina = _playerUpgradeStaminaRef.Invoke(_statsManager); private static readonly Dictionary<string, int> _playerUpgradeExtraJump = _playerUpgradeExtraJumpRef.Invoke(_statsManager); private static readonly Dictionary<string, int> _playerUpgradeLaunch = _playerUpgradeLaunchRef.Invoke(_statsManager); private static readonly Dictionary<string, int> _playerUpgradeMapPlayerCount = _playerUpgradeMapPlayerCountRef.Invoke(_statsManager); private static readonly MethodInfo _playerUpdateSprintSpeedRightAway = AccessTools.Method(typeof(PunManager), "UpdateSprintSpeedRightAway", (Type[])null, (Type[])null); private static readonly MethodInfo _playerUpdateGrabStrengthRightAway = AccessTools.Method(typeof(PunManager), "UpdateGrabStrengthRightAway", (Type[])null, (Type[])null); private static readonly MethodInfo _playerUpdateThrowStrengthRightAway = AccessTools.Method(typeof(PunManager), "UpdateThrowStrengthRightAway", (Type[])null, (Type[])null); private static readonly MethodInfo _playerUpdateGrabRangeRightAway = AccessTools.Method(typeof(PunManager), "UpdateGrabRangeRightAway", (Type[])null, (Type[])null); private static readonly MethodInfo _playerUpdateCrouchRestRightAway = AccessTools.Method(typeof(PunManager), "UpdateCrouchRestRightAway", (Type[])null, (Type[])null); private static readonly MethodInfo _playerUpdateTumbleWingsRightAway = AccessTools.Method(typeof(PunManager), "UpdateTumbleWingsRightAway", (Type[])null, (Type[])null); private static readonly MethodInfo _playerUpdateHealthRightAway = AccessTools.Method(typeof(PunManager), "UpdateHealthRightAway", (Type[])null, (Type[])null); private static readonly MethodInfo _playerUpdateEnergyRightAway = AccessTools.Method(typeof(PunManager), "UpdateEnergyRightAway", (Type[])null, (Type[])null); private static readonly MethodInfo _playerUpdateExtraJumpRightAway = AccessTools.Method(typeof(PunManager), "UpdateExtraJumpRightAway", (Type[])null, (Type[])null); private static readonly MethodInfo _playerUpdateTumbleLaunchRightAway = AccessTools.Method(typeof(PunManager), "UpdateTumbleLaunchRightAway", (Type[])null, (Type[])null); private static readonly MethodInfo _playerUpdateMapPlayerCountRightAway = AccessTools.Method(typeof(PunManager), "UpdateMapPlayerCountRightAway", (Type[])null, (Type[])null); private static StatsManager _statsManager => _statsManagerRef.Invoke(PunManager.instance); [HarmonyPrefix] [HarmonyPatch("UpgradePlayerHealth")] public static bool UpgradePlayersHealth(PunManager __instance) { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { string text = SemiFunc.PlayerGetSteamID(player); Dictionary<string, int> playerUpgradeHealth = _playerUpgradeHealth; string key = text; int value = playerUpgradeHealth[key] + 1; playerUpgradeHealth[key] = value; _playerUpdateHealthRightAway.Invoke(__instance, new object[1] { text }); } return false; } [HarmonyPrefix] [HarmonyPatch("UpgradePlayerEnergy")] public static bool UpgradePlayersEnergy(PunManager __instance) { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { string text = SemiFunc.PlayerGetSteamID(player); Dictionary<string, int> playerUpgradeStamina = _playerUpgradeStamina; string key = text; int value = playerUpgradeStamina[key] + 1; playerUpgradeStamina[key] = value; _playerUpdateEnergyRightAway.Invoke(__instance, new object[1] { text }); } return false; } [HarmonyPrefix] [HarmonyPatch("UpgradePlayerExtraJump")] public static bool UpgradePlayersExtraJump(PunManager __instance) { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { string text = SemiFunc.PlayerGetSteamID(player); Dictionary<string, int> playerUpgradeExtraJump = _playerUpgradeExtraJump; string key = text; int value = playerUpgradeExtraJump[key] + 1; playerUpgradeExtraJump[key] = value; _playerUpdateExtraJumpRightAway.Invoke(__instance, new object[1] { text }); } return false; } [HarmonyPrefix] [HarmonyPatch("UpgradeMapPlayerCount")] public static bool UpgradeMapPlayerCount(PunManager __instance) { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { string text = SemiFunc.PlayerGetSteamID(player); Dictionary<string, int> playerUpgradeMapPlayerCount = _playerUpgradeMapPlayerCount; string key = text; int value = playerUpgradeMapPlayerCount[key] + 1; playerUpgradeMapPlayerCount[key] = value; _playerUpdateMapPlayerCountRightAway.Invoke(__instance, new object[1] { text }); } return false; } [HarmonyPrefix] [HarmonyPatch("UpgradePlayerTumbleLaunch")] public static bool UpgradePlayersTumbleLaunch(PunManager __instance) { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { string text = SemiFunc.PlayerGetSteamID(player); Dictionary<string, int> playerUpgradeLaunch = _playerUpgradeLaunch; string key = text; int value = playerUpgradeLaunch[key] + 1; playerUpgradeLaunch[key] = value; _playerUpdateTumbleLaunchRightAway.Invoke(__instance, new object[1] { text }); } return false; } [HarmonyPrefix] [HarmonyPatch("UpgradePlayerTumbleWings")] public static bool UpgradePlayersTumbleWings(PunManager __instance) { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { string text = SemiFunc.PlayerGetSteamID(player); Dictionary<string, int> playerUpgradeTumbleWings = _playerUpgradeTumbleWings; string key = text; int value = playerUpgradeTumbleWings[key] + 1; playerUpgradeTumbleWings[key] = value; _playerUpdateTumbleWingsRightAway.Invoke(__instance, new object[1] { text }); } return false; } [HarmonyPrefix] [HarmonyPatch("UpgradePlayerSprintSpeed")] public static bool UpgradePlayersSprintSpeed(PunManager __instance) { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { string text = SemiFunc.PlayerGetSteamID(player); Dictionary<string, int> playerUpgradeSpeed = _playerUpgradeSpeed; string key = text; int value = playerUpgradeSpeed[key] + 1; playerUpgradeSpeed[key] = value; _playerUpdateSprintSpeedRightAway.Invoke(__instance, new object[1] { text }); } return false; } [HarmonyPrefix] [HarmonyPatch("UpgradePlayerCrouchRest")] public static bool UpgradePlayersCrouchRest(PunManager __instance) { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { string text = SemiFunc.PlayerGetSteamID(player); Dictionary<string, int> playerUpgradeCrouchRest = _playerUpgradeCrouchRest; string key = text; int value = playerUpgradeCrouchRest[key] + 1; playerUpgradeCrouchRest[key] = value; _playerUpdateCrouchRestRightAway.Invoke(__instance, new object[1] { text }); } return false; } [HarmonyPrefix] [HarmonyPatch("UpgradePlayerGrabStrength")] public static bool UpgradePlayersGrabStrength(PunManager __instance) { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { string text = SemiFunc.PlayerGetSteamID(player); Dictionary<string, int> playerUpgradeStrength = _playerUpgradeStrength; string key = text; int value = playerUpgradeStrength[key] + 1; playerUpgradeStrength[key] = value; _playerUpdateGrabStrengthRightAway.Invoke(__instance, new object[1] { text }); } return false; } [HarmonyPrefix] [HarmonyPatch("UpgradePlayerThrowStrength")] public static bool UpgradePlayersThrowStrength(PunManager __instance) { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { string text = SemiFunc.PlayerGetSteamID(player); Dictionary<string, int> playerUpgradeThrow = _playerUpgradeThrow; string key = text; int value = playerUpgradeThrow[key] + 1; playerUpgradeThrow[key] = value; _playerUpdateThrowStrengthRightAway.Invoke(__instance, new object[1] { text }); } return false; } [HarmonyPrefix] [HarmonyPatch("UpgradePlayerGrabRange")] public static bool UpgradePlayersGrabRange(PunManager __instance) { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { string text = SemiFunc.PlayerGetSteamID(player); Dictionary<string, int> playerUpgradeRange = _playerUpgradeRange; string key = text; int value = playerUpgradeRange[key] + 1; playerUpgradeRange[key] = value; _playerUpdateGrabRangeRightAway.Invoke(__instance, new object[1] { text }); } return false; } } [HarmonyPatch(typeof(ShopManager))] public static class ShopManagerPatch { [HarmonyPostfix] [HarmonyPatch("GetAllItemsFromStatsManager")] private static void SetAllUpgradeTypes() { ShopManager.instance.potentialItemUpgrades.Clear(); IEnumerable<Item> enumerable = StatsManager.instance.itemDictionary.Values.Where((Item obj) => (int)obj.itemType == 3); foreach (Item item in enumerable) { ShopManager.instance.potentialItemUpgrades.Add(item); } } } }