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 TeaMod v1.0.2
TeaMod.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using TeaMod.Patches; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("TeaMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TeaMod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4194830a-5762-4dad-b6b3-60ab854e4aaa")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace TeaMod { [BepInPlugin("TeaEyes.TeaMod", "TeaMod", "1.0.1")] public class TeaMod : BaseUnityPlugin { private const string modGUID = "TeaEyes.TeaMod"; private const string modName = "TeaMod"; private const string modVersion = "1.0.1"; private readonly Harmony harmony = new Harmony("TeaEyes.TeaMod"); public static ManualLogSource mls; public static int slotAmount = 6; internal static TeaMod Instance; private void Awake() { Instance = this; mls = Logger.CreateLogSource("TeaMod"); mls.LogInfo((object)"Loaded TeaEyes.TeaMod. Patching."); harmony.PatchAll(typeof(TeaMod)); harmony.PatchAll(typeof(PlayerControllerBPatch)); harmony.PatchAll(typeof(HudManagerPatch)); harmony.PatchAll(typeof(GrabbableObjectPatch)); mls = ((BaseUnityPlugin)this).Logger; } } } namespace TeaMod.Patches { [HarmonyPatch(typeof(GrabbableObject))] public class GrabbableObjectPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void UpdateWeight(ref Item ___itemProperties) { if (___itemProperties.itemName.ToLower() == "shovel") { ___itemProperties.weight = PoundsToWeight(5f); } if (___itemProperties.itemName.ToLower() == "stop sign") { ___itemProperties.weight = PoundsToWeight(10f); } if (___itemProperties.itemName.ToLower() == "yield sign") { ___itemProperties.weight = PoundsToWeight(10f); } if (___itemProperties.itemName.ToLower() == "sheet metal") { ___itemProperties.weight = PoundsToWeight(10f); } } private static float PoundsToWeight(float pounds) { return 1f + pounds / 105f; } } [HarmonyPatch(typeof(HUDManager))] public class HudManagerPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void UpdateItemSlots(ref Image[] ___itemSlotIcons, ref Image[] ___itemSlotIconFrames) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown Debug.Log((object)("Loading More Slots: " + TeaMod.slotAmount)); GameObject val = Object.Instantiate<GameObject>(((Component)___itemSlotIconFrames[0]).gameObject); Transform parent = ((Component)___itemSlotIconFrames[0]).transform.parent; RectTransform component = ((Component)parent).GetComponent<RectTransform>(); ((Transform)component).localScale = new Vector3(1f, 1f, 1f); component.anchorMin = new Vector2(0.3f, 0f); component.anchorMax = new Vector2(0.9f, 0.4f); component.offsetMin = new Vector2(0f, 0f); component.offsetMax = new Vector2(0f, 0f); GridLayoutGroup val2 = ((Component)parent).gameObject.AddComponent<GridLayoutGroup>(); val2.spacing = new Vector2(15f, 15f); val2.cellSize = new Vector2(50f, 50f); ((LayoutGroup)val2).childAlignment = (TextAnchor)7; Debug.Log((object)parent); Debug.Log((object)val); Debug.Log((object)"Deleting Current Slots"); foreach (Transform item in parent) { Transform val3 = item; Object.Destroy((Object)(object)((Component)val3).gameObject); } parent.DetachChildren(); Debug.Log((object)"Adding New Slots"); for (int i = 0; i < TeaMod.slotAmount; i++) { GameObject val4 = Object.Instantiate<GameObject>(val, parent); ((Object)val4).name = $"Slot{i}"; } Object.Destroy((Object)(object)val); Debug.Log((object)"Emptying image arrays"); ___itemSlotIcons = (Image[])(object)new Image[TeaMod.slotAmount]; ___itemSlotIconFrames = (Image[])(object)new Image[TeaMod.slotAmount]; Debug.Log((object)"Add images to arrays"); Debug.Log((object)$"{___itemSlotIcons.Length} - {___itemSlotIconFrames.Length} - {parent.childCount}"); int num = 0; foreach (Transform item2 in parent) { Transform val5 = item2; Debug.Log((object)$"{val5} - {((Component)val5).GetComponent<Image>()} - {((Component)val5.GetChild(0)).GetComponent<Image>()}"); ___itemSlotIcons[num] = ((Component)val5.GetChild(0)).GetComponent<Image>(); ___itemSlotIconFrames[num] = ((Component)val5).GetComponent<Image>(); num++; } } } [HarmonyPatch(typeof(PlayerControllerB))] public class PlayerControllerBPatch { public static float percentalIncreaseRegen = 50f; [HarmonyPatch("Awake")] [HarmonyPostfix] private static void UpdateItemSlots(ref GrabbableObject[] ___ItemSlots) { ___ItemSlots = (GrabbableObject[])(object)new GrabbableObject[TeaMod.slotAmount]; } [HarmonyPatch("LateUpdate")] [HarmonyPrefix] private static void ChangeSprintRecharge(ref bool ___isSprinting, ref bool ___isWalking, ref float ___sprintMeter, ref float ___sprintTime) { if (!___isSprinting) { if (!___isWalking) { float num = Time.deltaTime / (___sprintTime + 4f) * (percentalIncreaseRegen / 100f); ___sprintMeter = Mathf.Clamp(___sprintMeter + num, 0f, 1f); } else { float num2 = Time.deltaTime / (___sprintTime + 9f) * (percentalIncreaseRegen / 100f); ___sprintMeter = Mathf.Clamp(___sprintMeter + num2, 0f, 1f); } } } } }