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 MiniEepo v1.1.0
MiniEepo.dll
Decompiled 5 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using ScalerCore; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("MiniEepo")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MiniEepo")] [assembly: AssemblyTitle("MiniEepo")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace MiniEepo { [BepInPlugin("darkharasho.MiniEepo", "MiniEepo", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log = null; internal static ConfigEntry<float> PlayerScale = null; internal static ConfigEntry<float> ItemScale = null; internal static ConfigEntry<float> ValuableScale = null; internal static ConfigEntry<float> CartScale = null; internal static ConfigEntry<bool> VoiceMod = null; internal static float ActivePlayerScale; internal static float ActiveItemScale; internal static float ActiveValuableScale; internal static float ActiveCartScale; internal static bool ActiveVoiceMod; internal static readonly HashSet<int> ManagedObjects = new HashSet<int>(); private void Awake() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; AcceptableValueRange<float> val = new AcceptableValueRange<float>(0.1f, 1f); PlayerScale = ((BaseUnityPlugin)this).Config.Bind<float>("Scaling", "PlayerScale", 0.4f, new ConfigDescription("Scale multiplier for players (0.4 = 40%)", (AcceptableValueBase)(object)val, Array.Empty<object>())); ItemScale = ((BaseUnityPlugin)this).Config.Bind<float>("Scaling", "ItemScale", 0.4f, new ConfigDescription("Scale multiplier for items (0.4 = 40%)", (AcceptableValueBase)(object)val, Array.Empty<object>())); ValuableScale = ((BaseUnityPlugin)this).Config.Bind<float>("Scaling", "ValuableScale", 0.4f, new ConfigDescription("Scale multiplier for valuables (0.4 = 40%)", (AcceptableValueBase)(object)val, Array.Empty<object>())); CartScale = ((BaseUnityPlugin)this).Config.Bind<float>("Scaling", "CartScale", 1f, new ConfigDescription("Extra scale multiplier applied when a valuable is in the cart (1.0 = no change, 0.5 = half size)", (AcceptableValueBase)(object)val, Array.Empty<object>())); VoiceMod = ((BaseUnityPlugin)this).Config.Bind<bool>("Audio", "VoiceMod", true, new ConfigDescription("Enable voice pitch modulation when players are shrunk", (AcceptableValueBase)null, Array.Empty<object>())); ResetToLocalConfig(); GameObject val2 = new GameObject("MiniEepo_Syncer"); Object.DontDestroyOnLoad((Object)val2); val2.AddComponent<SettingsSyncer>(); Harmony val3 = new Harmony("darkharasho.MiniEepo"); val3.PatchAll(); MethodInfo methodInfo = AccessTools.Method(typeof(PlayerAvatar), "SetVoicePitchRPC", new Type[1] { typeof(float) }, (Type[])null); if ((object)methodInfo == null) { methodInfo = AccessTools.Method(typeof(PlayerAvatar), "SetVoicePitchRPC", (Type[])null, (Type[])null); } if (methodInfo != null) { val3.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(VoicePitchPatch), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } else { Log.LogWarning((object)"SetVoicePitchRPC not found — voice mod toggle disabled"); } Log.LogInfo((object)"MiniEepo v1.0.0 loaded — everything is tiny now."); } internal static void ResetToLocalConfig() { ActivePlayerScale = PlayerScale.Value; ActiveItemScale = ItemScale.Value; ActiveValuableScale = ValuableScale.Value; ActiveCartScale = CartScale.Value; ActiveVoiceMod = VoiceMod.Value; } internal static void Shrink(GameObject go, float factor) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) ManagedObjects.Add(((Object)go).GetInstanceID()); ScaleOptions @default = ScaleOptions.Default; @default.Factor = factor; ScaleManager.ApplyIfNotScaled(go, @default); } } internal class SettingsSyncer : MonoBehaviourPunCallbacks { private const string K_PLAYER = "ME_PS"; private const string K_ITEM = "ME_IS"; private const string K_VALUABLE = "ME_VS"; private const string K_CART = "ME_CS"; private const string K_VOICE = "ME_VM"; public override void OnEnable() { } public override void OnDisable() { } private void Start() { PhotonNetwork.AddCallbackTarget((object)this); } private void OnDestroy() { PhotonNetwork.RemoveCallbackTarget((object)this); } public override void OnRoomPropertiesUpdate(Hashtable changed) { if (((Dictionary<object, object>)(object)changed).ContainsKey((object)"ME_PS")) { Plugin.ActivePlayerScale = (float)changed[(object)"ME_PS"]; } if (((Dictionary<object, object>)(object)changed).ContainsKey((object)"ME_IS")) { Plugin.ActiveItemScale = (float)changed[(object)"ME_IS"]; } if (((Dictionary<object, object>)(object)changed).ContainsKey((object)"ME_VS")) { Plugin.ActiveValuableScale = (float)changed[(object)"ME_VS"]; } if (((Dictionary<object, object>)(object)changed).ContainsKey((object)"ME_CS")) { Plugin.ActiveCartScale = (float)changed[(object)"ME_CS"]; } if (((Dictionary<object, object>)(object)changed).ContainsKey((object)"ME_VM")) { Plugin.ActiveVoiceMod = (bool)changed[(object)"ME_VM"]; } Plugin.Log.LogInfo((object)$"[Sync] Settings received from host — player={Plugin.ActivePlayerScale} item={Plugin.ActiveItemScale} valuable={Plugin.ActiveValuableScale} cart={Plugin.ActiveCartScale} voiceMod={Plugin.ActiveVoiceMod}"); } public override void OnJoinedRoom() { if (PhotonNetwork.IsMasterClient) { PushHostSettings(); return; } Room currentRoom = PhotonNetwork.CurrentRoom; Hashtable val = ((currentRoom != null) ? ((RoomInfo)currentRoom).CustomProperties : null); if (val != null) { ((MonoBehaviourPunCallbacks)this).OnRoomPropertiesUpdate(val); } } public override void OnMasterClientSwitched(Player newMasterClient) { if (newMasterClient.IsLocal) { PushHostSettings(); } } private void PushHostSettings() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown if (PhotonNetwork.CurrentRoom != null) { Hashtable val = new Hashtable { [(object)"ME_PS"] = Plugin.PlayerScale.Value, [(object)"ME_IS"] = Plugin.ItemScale.Value, [(object)"ME_VS"] = Plugin.ValuableScale.Value, [(object)"ME_CS"] = Plugin.CartScale.Value, [(object)"ME_VM"] = Plugin.VoiceMod.Value }; PhotonNetwork.CurrentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); Plugin.Log.LogInfo((object)$"[Sync] Host settings pushed — player={Plugin.PlayerScale.Value} item={Plugin.ItemScale.Value} valuable={Plugin.ValuableScale.Value} cart={Plugin.CartScale.Value}"); } } public override void OnLeftRoom() { Plugin.ResetToLocalConfig(); } } [HarmonyPatch(typeof(PlayerAvatar), "Start")] internal static class PlayerAvatarPatch { private static IEnumerator ShrinkNextFrame(PlayerAvatar instance) { yield return null; Plugin.Shrink(((Component)instance).gameObject, Plugin.ActivePlayerScale); } private static void Postfix(PlayerAvatar __instance) { ((MonoBehaviour)__instance).StartCoroutine(ShrinkNextFrame(__instance)); } } [HarmonyPatch(typeof(PhysGrabObject), "Start")] internal static class PhysGrabObjectPatch { private static void Postfix(PhysGrabObject __instance) { ItemAttributes componentInParent = ((Component)__instance).GetComponentInParent<ItemAttributes>(true); if ((Object)(object)componentInParent != (Object)null) { Plugin.Shrink(((Component)componentInParent).gameObject, Plugin.ActiveItemScale); } } } [HarmonyPatch(typeof(ValuableObject), "Start")] internal static class ValuableObjectPatch { private static readonly HashSet<int> _scaled = new HashSet<int>(); private static void Postfix(ValuableObject __instance) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)((Component)__instance).gameObject).GetInstanceID(); if (_scaled.Add(instanceID)) { Transform transform = ((Component)__instance).transform; transform.localScale *= Plugin.ActiveValuableScale; if (!(Plugin.ActiveCartScale >= 1f)) { PhysGrabObject val = ((Component)__instance).GetComponentInChildren<PhysGrabObject>(true) ?? ((Component)__instance).GetComponentInParent<PhysGrabObject>(true); (((Object)(object)val != (Object)null) ? ((Component)val).gameObject : ((Component)__instance).gameObject).AddComponent<ValuableCartTracker>().SetValuable(__instance); } } } } internal static class VoicePitchPatch { internal static void Prefix(ref float __0) { if (!Plugin.ActiveVoiceMod) { __0 = 1f; } } } [HarmonyPatch(typeof(ScaleManager), "Apply", new Type[] { typeof(GameObject), typeof(ScaleOptions) })] internal static class ScaleManagerApplyPatch { private static bool Prefix(GameObject target) { ScaleController controller = ScaleManager.GetController(target); int item = (((Object)(object)controller != (Object)null) ? ((Object)((Component)controller).gameObject).GetInstanceID() : ((Object)target).GetInstanceID()); return !Plugin.ManagedObjects.Contains(item); } } internal class ValuableCartTracker : MonoBehaviour { private ValuableObject? _vo; private bool _inCart; private Vector3 _preCartScale; internal void SetValuable(ValuableObject vo) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) _vo = vo; _preCartScale = ((Component)vo).transform.localScale; } private void OnTriggerEnter(Collider other) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (!_inCart && !((Object)(object)_vo == (Object)null) && !((Object)(object)((Component)other).GetComponentInParent<PhysGrabInCart>() == (Object)null)) { _inCart = true; ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(ScaleTo(((Component)_vo).transform.localScale * Plugin.ActiveCartScale, 0.4f)); } } private void OnTriggerExit(Collider other) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (_inCart && !((Object)(object)_vo == (Object)null) && !((Object)(object)((Component)other).GetComponentInParent<PhysGrabInCart>() == (Object)null)) { _inCart = false; ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(ScaleTo(_preCartScale, 0.3f)); } } private IEnumerator ScaleTo(Vector3 target, float duration) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Vector3 start = ((Component)_vo).transform.localScale; for (float t = 0f; t < duration; t += Time.deltaTime) { ((Component)_vo).transform.localScale = Vector3.Lerp(start, target, t / duration); yield return null; } ((Component)_vo).transform.localScale = target; } } public static class PluginInfo { public const string PLUGIN_GUID = "MiniEepo"; public const string PLUGIN_NAME = "MiniEepo"; public const string PLUGIN_VERSION = "1.0.0"; } }