Decompiled source of Tiny Scouts v1.0.0

JellyJamTinyPeakMod.dll

Decompiled 2 weeks ago
using System;
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 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("JellyJamTinyPeakMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JellyJamTinyPeakMod")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2d93bd1e-dec2-44dd-8b8c-15a66882fa97")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[HarmonyPatch(typeof(CharacterItems), "EquipSlotRpc")]
public static class EquipSlotRpcPatch
{
	private static void Postfix(CharacterItems __instance, int slotID, int objectViewID)
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		if (objectViewID == -1)
		{
			return;
		}
		PhotonView photonView = PhotonNetwork.GetPhotonView(objectViewID);
		if ((Object)(object)photonView != (Object)null)
		{
			Item component = ((Component)photonView).GetComponent<Item>();
			if ((Object)(object)component != (Object)null)
			{
				Transform transform = ((Component)component).transform;
				transform.localScale *= 0.6f;
				Debug.Log((object)$"[Patch] Scaled item {((Object)component).name} to {((Component)component).transform.localScale}");
			}
		}
	}
}
namespace JellyJamTinyPeakMod
{
	[BepInPlugin("JellyJam.TinyPeakMod", "JellyJamTinyPeakMod", "1.0.0.0")]
	public class ModBase : BaseUnityPlugin
	{
		private const string modGUID = "JellyJam.TinyPeakMod";

		private const string modName = "JellyJamTinyPeakMod";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("JellyJam.TinyPeakMod");

		private static ModBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("JellyJam.TinyPeakMod");
			mls.LogInfo((object)"The JellyJamTinyPeakMod has started");
			harmony.PatchAll();
		}
	}
}
namespace JellyJamTinyPeakMod.Patches
{
	[HarmonyPatch(typeof(BreakableBridge), "Update")]
	internal class BridgePatch
	{
		[HarmonyPostfix]
		private static void UpdatePostFix(BreakableBridge __instance)
		{
			if (__instance.breakChance > 0f)
			{
				__instance.breakChance = 0f;
			}
		}
	}
	[HarmonyPatch(typeof(BackpackData))]
	public class BackpackPatch
	{
		[HarmonyPatch(typeof(BackpackWheelSlice), "UpdateInteractable")]
		private class Patch_BackpackWheelSlice_UpdateInteractable
		{
			private static void Postfix(BackpackWheelSlice __instance)
			{
				if (__instance.backpackSlot == 3)
				{
					((Selectable)((UIWheelSlice)__instance).button).interactable = false;
				}
			}
		}

		[HarmonyPatch(typeof(BackpackWheelSlice), "Hover")]
		private class Patch_BackpackWheelSlice_Hover
		{
			private static bool Prefix(BackpackWheelSlice __instance)
			{
				return __instance.backpackSlot != 3;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("AddItem")]
		public static bool PreventAddingToFourthSlot(ref byte backpackSlotID)
		{
			if (backpackSlotID == 3)
			{
				Debug.Log((object)"[TinyMod] Prevented adding item to disabled 4th backpack slot.");
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Character))]
	public class PlayerPatch
	{
		private static float bodySize = 0.36f;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdatePostfix(Character __instance)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance != (Object)null)
			{
				((Component)__instance).transform.localScale = Vector3.one * bodySize;
			}
			if (Input.GetKeyDown((KeyCode)112))
			{
				Character[] array = Object.FindObjectsByType<Character>((FindObjectsSortMode)0);
				Character[] array2 = array;
				foreach (Character val in array2)
				{
					((Component)val).transform.localScale = Vector3.one * bodySize;
				}
			}
		}
	}
	[HarmonyPatch(typeof(CharacterAfflictions), "UpdateWeight")]
	public class UpdateWeightPatch
	{
		private static float bodySize = 0.36f;

		[HarmonyPostfix]
		private static void Postfix(CharacterAfflictions __instance)
		{
			Character character = __instance.character;
			if (!((Object)(object)character == (Object)null))
			{
				float currentStatus = __instance.GetCurrentStatus((STATUSTYPE)7);
				float num = currentStatus * 1.2f;
				__instance.SetStatus((STATUSTYPE)7, num);
				Debug.Log((object)$"[TINY MOD] Increased weight status from {currentStatus:F3} to {num:F3}");
			}
		}
	}
	[HarmonyPatch(typeof(CharacterMovement))]
	public class MovementPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		private static void UpdatePostfix(CharacterMovement __instance)
		{
			__instance.movementModifier = 0.8f;
			__instance.jumpGravity = 3f;
		}
	}
	[HarmonyPatch(typeof(CharacterMovement), "CheckFallDamage")]
	public class FallDamagePatch
	{
		private static bool Prefix(CharacterMovement __instance)
		{
			Character component = ((Component)__instance).GetComponent<Character>();
			if ((Object)(object)component == (Object)null)
			{
				return false;
			}
			float valueOrDefault = (AccessTools.Method(typeof(CharacterMovement), "FallTime", (Type[])null, (Type[])null).Invoke(__instance, null) as float?).GetValueOrDefault();
			if (valueOrDefault < 1.5f)
			{
				return false;
			}
			Debug.Log((object)"[TINY MOD] Fall Damage Prevented");
			return false;
		}
	}
	[HarmonyPatch(typeof(CharacterClimbing))]
	public class CharacterClimbingPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Postfix(CharacterClimbing __instance)
		{
			__instance.climbSpeedMod = 1.3f;
		}
	}
}