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.4.0
MiniEepo.dll
Decompiled a month 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 = ".NET Standard 2.1")] [assembly: AssemblyCompany("MiniEepo")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.4.0.0")] [assembly: AssemblyInformationalVersion("1.4.0+4c8db129f3a431aa93ab390ec14003fb5247d070")] [assembly: AssemblyProduct("MiniEepo")] [assembly: AssemblyTitle("MiniEepo")] [assembly: AssemblyVersion("1.4.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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; } } [CompilerGenerated] [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 MiniEepo { [BepInPlugin("darkharasho.MiniEepo", "MiniEepo", "1.4.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> ShrinkValuables = null; internal static ConfigEntry<bool> ShrinkCart = null; internal static ConfigEntry<bool> VoiceMod = null; internal static ConfigEntry<bool> ShrinkInShop = null; internal static float ActivePlayerScale; internal static float ActiveItemScale; internal static float ActiveValuableScale; internal static float ActiveCartScale; internal static bool ActiveShrinkValuables; internal static bool ActiveShrinkCart; internal static bool ActiveVoiceMod; internal static bool ActiveShrinkInShop; internal static readonly HashSet<int> ManagedObjects = new HashSet<int>(); internal static bool IsApplying; 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Expected O, but got Unknown //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Expected O, but got Unknown //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Expected O, but got Unknown //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Expected O, but got Unknown //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_062a: Expected O, but got Unknown //IL_070c: Unknown result type (might be due to invalid IL or missing references) //IL_071a: Expected O, but got Unknown //IL_0792: Unknown result type (might be due to invalid IL or missing references) //IL_079f: Expected O, but got Unknown //IL_087e: Unknown result type (might be due to invalid IL or missing references) //IL_088b: 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>())); ShrinkValuables = ((BaseUnityPlugin)this).Config.Bind<bool>("Scaling", "ShrinkValuables", true, new ConfigDescription("Master on/off for shrinking valuables. When false, valuables spawn at full size (ValuableScale ignored). Separate from CartScale, which only shrinks valuables once they're IN the cart.", (AcceptableValueBase)null, Array.Empty<object>())); ShrinkCart = ((BaseUnityPlugin)this).Config.Bind<bool>("Scaling", "ShrinkCart", true, new ConfigDescription("On/off for shrinking the cart (C.A.R.T). The cart is an equippable item, so it shrinks via ItemScale through the item path; this toggle gates that independently. Default true (matches prior behavior). When false, the cart stays full size even though other items shrink.", (AcceptableValueBase)null, 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>())); ShrinkInShop = ((BaseUnityPlugin)this).Config.Bind<bool>("Scaling", "ShrinkInShop", false, new ConfigDescription("If true, shrinking applies in the shop level too. Default false — items stay normal size while shopping.", (AcceptableValueBase)null, Array.Empty<object>())); ResetToLocalConfig(); VoiceMod.SettingChanged += delegate { ActiveVoiceMod = VoiceMod.Value; }; PlayerScale.SettingChanged += delegate { OnHostScaleConfigChanged(); }; ItemScale.SettingChanged += delegate { OnHostScaleConfigChanged(); }; ValuableScale.SettingChanged += delegate { OnHostScaleConfigChanged(); }; CartScale.SettingChanged += delegate { OnHostScaleConfigChanged(); }; ShrinkValuables.SettingChanged += delegate { OnHostScaleConfigChanged(); }; ShrinkCart.SettingChanged += delegate { OnHostScaleConfigChanged(); }; ShrinkInShop.SettingChanged += delegate { OnHostScaleConfigChanged(); }; ((Component)this).gameObject.AddComponent<SettingsSyncer>(); Harmony val2 = new Harmony("darkharasho.MiniEepo"); val2.PatchAll(); Type type = null; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (assembly.GetName().Name != "ScalerCore") { continue; } Type[] types = assembly.GetTypes(); foreach (Type type2 in types) { if (type2.Name == "AudioPitchHelper") { type = type2; break; } } if (type != null) { break; } } MethodInfo methodInfo = ((type != null) ? AccessTools.Method(type, "ApplyPitch", (Type[])null, (Type[])null) : null); if (methodInfo != null) { val2.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(VoicePitchPatch), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)("[Voice] Patched " + type.FullName + ".ApplyPitch (Sound pitch)")); } else { Log.LogWarning((object)"[Voice] AudioPitchHelper.ApplyPitch not found"); } Type type3 = AccessTools.TypeByName("PlayerVoiceChat"); MethodInfo methodInfo2 = ((type3 != null) ? AccessTools.Method(type3, "OverridePitch", (Type[])null, (Type[])null) : null); if (methodInfo2 != null) { val2.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(VoicePitchPatch), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)"[Voice] Patched PlayerVoiceChat.OverridePitch (Photon Voice pitch)"); } else { Log.LogWarning((object)"[Voice] PlayerVoiceChat.OverridePitch not found"); } Type type4 = null; assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly2 in assemblies) { if (assembly2.GetName().Name != "ScalerCore") { continue; } Type[] types = assembly2.GetTypes(); foreach (Type type5 in types) { if (type5.Name == "PlayerHandler") { type4 = type5; break; } } if (type4 != null) { break; } } MethodInfo methodInfo3 = ((type4 != null) ? AccessTools.Method(type4, "OnUpdate", (Type[])null, (Type[])null) : null); if (methodInfo3 != null) { val2.Patch((MethodBase)methodInfo3, (HarmonyMethod)null, new HarmonyMethod(typeof(VoicePitchPatch), "PlayerHandlerOnUpdatePostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)("[Voice] Patched " + type4.FullName + ".OnUpdate (per-frame voice pitch fields)")); } else { Log.LogWarning((object)"[Voice] PlayerHandler.OnUpdate not found"); } Type type6 = null; assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly3 in assemblies) { if (assembly3.GetName().Name != "ScalerCore") { continue; } Type[] types = assembly3.GetTypes(); foreach (Type type7 in types) { if (type7.Name == "PlayerBonkPatch") { type6 = type7; break; } } if (type6 != null) { break; } } MethodInfo methodInfo4 = ((type6 != null) ? AccessTools.Method(type6, "Postfix", (Type[])null, (Type[])null) : null); if (methodInfo4 != null) { val2.Patch((MethodBase)methodInfo4, new HarmonyMethod(typeof(BonkBlocker), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)"[BonkImmune] Disabled ScalerCore's damage-bonk-expand (damage no longer un-shrinks)"); } else { Log.LogWarning((object)"[BonkImmune] PlayerBonkPatch.Postfix not found — damage may un-shrink"); } Type type8 = null; assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly4 in assemblies) { if (assembly4.GetName().Name != "ScalerCore") { continue; } Type[] types = assembly4.GetTypes(); foreach (Type type9 in types) { if (type9.Name == "PlayerDeathExpandPatch") { type8 = type9; break; } } if (type8 != null) { break; } } MethodInfo methodInfo5 = ((type8 != null) ? AccessTools.Method(type8, "Postfix", (Type[])null, (Type[])null) : null); if (methodInfo5 != null) { val2.Patch((MethodBase)methodInfo5, new HarmonyMethod(typeof(BonkBlocker), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)"[BonkImmune] Disabled ScalerCore's death-expand (dying no longer un-shrinks)"); } else { Log.LogWarning((object)"[BonkImmune] PlayerDeathExpandPatch.Postfix not found — death may un-shrink"); } string[] array = new string[2] { "ReviveRPC", "Revive" }; foreach (string text in array) { MethodInfo methodInfo6 = AccessTools.Method(typeof(PlayerAvatar), text, (Type[])null, (Type[])null); if (!(methodInfo6 == null)) { val2.Patch((MethodBase)methodInfo6, (HarmonyMethod)null, new HarmonyMethod(typeof(PlayerRevivePatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)("[Revive] Patched " + text)); } } Type type10 = null; assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly5 in assemblies) { if (assembly5.GetName().Name != "ScalerCore") { continue; } Type[] types = assembly5.GetTypes(); foreach (Type type11 in types) { if (type11.Name == "CartHandledDistancePatch") { type10 = type11; break; } } break; } MethodInfo methodInfo7 = ((type10 != null) ? AccessTools.Method(type10, "ScalePullDist", (Type[])null, (Type[])null) : null); if (methodInfo7 != null) { val2.Patch((MethodBase)methodInfo7, (HarmonyMethod)null, new HarmonyMethod(typeof(CartStandoffShrinkPatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)"[Cart] Strengthened shrunk-grabber cart standoff (reduces cart recoil/shove on tiny players)"); } else { Log.LogWarning((object)"[Cart] ScalerCore CartHandledDistancePatch.ScalePullDist not found — cart may shove shrunk players"); } Log.LogInfo((object)"MiniEepo v1.4.0 loaded — everything is tiny now."); } internal static void ResetToLocalConfig() { ActivePlayerScale = PlayerScale.Value; ActiveItemScale = ItemScale.Value; ActiveValuableScale = ValuableScale.Value; ActiveCartScale = CartScale.Value; ActiveShrinkValuables = ShrinkValuables.Value; ActiveShrinkCart = ShrinkCart.Value; ActiveVoiceMod = VoiceMod.Value; ActiveShrinkInShop = ShrinkInShop.Value; } private static void OnHostScaleConfigChanged() { if (!PhotonNetwork.InRoom || PhotonNetwork.IsMasterClient) { ResetToLocalConfig(); SettingsSyncer.Instance?.PushHostSettingsExternal(); } } internal static bool IsInGameplay() { if (!PhotonNetwork.InRoom) { return false; } RunManager instance = RunManager.instance; if ((Object)(object)instance == (Object)null) { return false; } Level levelCurrent = instance.levelCurrent; if ((Object)(object)levelCurrent == (Object)null) { return false; } if ((Object)(object)levelCurrent == (Object)(object)instance.levelLobby || (Object)(object)levelCurrent == (Object)(object)instance.levelLobbyMenu) { return false; } if (SemiFunc.IsLevelShop(levelCurrent) && !ActiveShrinkInShop) { return false; } return true; } internal static bool IsCart(GameObject go) { if (!((Object)(object)go.GetComponentInParent<PhysGrabCart>(true) != (Object)null)) { return (Object)(object)go.GetComponentInChildren<PhysGrabCart>(true) != (Object)null; } return true; } 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_0026: Unknown result type (might be due to invalid IL or missing references) ManagedObjects.Add(((Object)go).GetInstanceID()); ScaleOptions val = ScaleOptions.Default; val.Factor = factor; IsApplying = true; try { ScaleManager.ApplyIfNotScaled(go, val); } finally { IsApplying = false; } } } internal class SettingsSyncer : MonoBehaviour { 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_SHOP = "ME_SS"; private const string K_VAL_ON = "ME_VO"; private const string K_CART_ON = "ME_CO"; internal static SettingsSyncer? Instance; private bool _wasInRoom; private bool _wasMaster; private float _pullPollDelay; private float _watcherTimer; private readonly Dictionary<int, Transform?> _visualsCache = new Dictionary<int, Transform>(); private float _lastPushedPlayer = float.NaN; private float _lastPushedItem = float.NaN; private float _lastPushedValuable = float.NaN; private float _lastPushedCart = float.NaN; private bool? _lastPushedShop; private bool? _lastPushedValOn; private bool? _lastPushedCartOn; private void Awake() { Instance = this; } private void Start() { Plugin.Log.LogInfo((object)"[Sync] SettingsSyncer ready (polling mode)"); } internal void TriggerRescale() { ((MonoBehaviour)this).StartCoroutine(RescaleAfterJoin()); } private void Update() { bool inRoom = PhotonNetwork.InRoom; bool flag = inRoom && PhotonNetwork.IsMasterClient; if (inRoom && !_wasInRoom) { if (flag) { PushHostSettings(); } else { PullHostSettings(); } } else if (!inRoom && _wasInRoom) { Plugin.ResetToLocalConfig(); Plugin.Log.LogInfo((object)"[Sync] Left room — reset to local config"); } else if (inRoom && flag && !_wasMaster) { PushHostSettings(); } else if (inRoom && !flag) { _pullPollDelay -= Time.unscaledDeltaTime; if (_pullPollDelay <= 0f) { _pullPollDelay = 1f; PullHostSettings(); } } _wasInRoom = inRoom; _wasMaster = flag; } private void LateUpdate() { //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.IsInGameplay()) { return; } _watcherTimer -= Time.deltaTime; if (_watcherTimer > 0f) { return; } _watcherTimer = 0.25f; float activePlayerScale = Plugin.ActivePlayerScale; if (activePlayerScale < 0.99f && GameDirector.instance?.PlayerList != null) { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if (!((Object)(object)player == (Object)null)) { Transform transform = ((Component)player).transform; if (transform.localScale.x > 0.9f && transform.localScale.x > activePlayerScale + 0.4f) { transform.localScale = new Vector3(activePlayerScale, activePlayerScale, activePlayerScale); } int instanceID = ((Object)player).GetInstanceID(); if (!_visualsCache.TryGetValue(instanceID, out Transform value) || (Object)(object)value == (Object)null) { value = (((Object)(object)transform.parent != (Object)null) ? transform.parent.Find("Player Visuals") : null); _visualsCache[instanceID] = value; } if ((Object)(object)value != (Object)null && value.localScale.x > 0.9f && value.localScale.x > activePlayerScale + 0.4f) { value.localScale = new Vector3(activePlayerScale, activePlayerScale, activePlayerScale); } } } } float activeItemScale = Plugin.ActiveItemScale; if (!(activeItemScale < 0.99f) || PhysGrabObjectPatch.DirectScaledItems.Count <= 0) { return; } List<int> list = null; foreach (KeyValuePair<int, Transform> directScaledItem in PhysGrabObjectPatch.DirectScaledItems) { Transform value2 = directScaledItem.Value; if ((Object)(object)value2 == (Object)null) { (list ?? (list = new List<int>())).Add(directScaledItem.Key); } else if (value2.localScale.x > 0.9f && value2.localScale.x > activeItemScale + 0.4f) { value2.localScale = new Vector3(activeItemScale, activeItemScale, activeItemScale); } } if (list == null) { return; } foreach (int item in list) { PhysGrabObjectPatch.DirectScaledItems.Remove(item); } } private void PullHostSettings() { Room currentRoom = PhotonNetwork.CurrentRoom; Hashtable val = ((currentRoom != null) ? ((RoomInfo)currentRoom).CustomProperties : null); if (val == null) { return; } bool flag = false; if (((Dictionary<object, object>)(object)val).ContainsKey((object)"ME_PS")) { float num = (float)val[(object)"ME_PS"]; if (Plugin.ActivePlayerScale != num) { Plugin.ActivePlayerScale = num; flag = true; } } if (((Dictionary<object, object>)(object)val).ContainsKey((object)"ME_IS")) { float num2 = (float)val[(object)"ME_IS"]; if (Plugin.ActiveItemScale != num2) { Plugin.ActiveItemScale = num2; flag = true; } } if (((Dictionary<object, object>)(object)val).ContainsKey((object)"ME_VS")) { float num3 = (float)val[(object)"ME_VS"]; if (Plugin.ActiveValuableScale != num3) { Plugin.ActiveValuableScale = num3; flag = true; } } if (((Dictionary<object, object>)(object)val).ContainsKey((object)"ME_CS")) { float num4 = (float)val[(object)"ME_CS"]; if (Plugin.ActiveCartScale != num4) { Plugin.ActiveCartScale = num4; flag = true; } } if (((Dictionary<object, object>)(object)val).ContainsKey((object)"ME_SS")) { bool flag2 = (bool)val[(object)"ME_SS"]; if (Plugin.ActiveShrinkInShop != flag2) { Plugin.ActiveShrinkInShop = flag2; flag = true; } } if (((Dictionary<object, object>)(object)val).ContainsKey((object)"ME_VO")) { bool flag3 = (bool)val[(object)"ME_VO"]; if (Plugin.ActiveShrinkValuables != flag3) { Plugin.ActiveShrinkValuables = flag3; flag = true; } } if (((Dictionary<object, object>)(object)val).ContainsKey((object)"ME_CO")) { bool flag4 = (bool)val[(object)"ME_CO"]; if (Plugin.ActiveShrinkCart != flag4) { Plugin.ActiveShrinkCart = flag4; flag = true; } } if (flag) { Plugin.Log.LogInfo((object)$"[Sync] Pulled host settings — player={Plugin.ActivePlayerScale} item={Plugin.ActiveItemScale} valuable={Plugin.ActiveValuableScale} cart={Plugin.ActiveCartScale} shrinkValuables={Plugin.ActiveShrinkValuables} shrinkCart={Plugin.ActiveShrinkCart} shrinkInShop={Plugin.ActiveShrinkInShop}"); } } internal void PushHostSettingsExternal() { if (PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient) { PushHostSettings(); } } private void PushHostSettings() { //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Expected O, but got Unknown if (PhotonNetwork.CurrentRoom != null) { float value = Plugin.PlayerScale.Value; float value2 = Plugin.ItemScale.Value; float value3 = Plugin.ValuableScale.Value; float value4 = Plugin.CartScale.Value; bool value5 = Plugin.ShrinkInShop.Value; bool value6 = Plugin.ShrinkValuables.Value; bool value7 = Plugin.ShrinkCart.Value; if (value == _lastPushedPlayer && value2 == _lastPushedItem && value3 == _lastPushedValuable && value4 == _lastPushedCart && value5 == _lastPushedShop && value6 == _lastPushedValOn && value7 == _lastPushedCartOn) { Plugin.ResetToLocalConfig(); return; } _lastPushedPlayer = value; _lastPushedItem = value2; _lastPushedValuable = value3; _lastPushedCart = value4; _lastPushedShop = value5; _lastPushedValOn = value6; _lastPushedCartOn = value7; Hashtable val = new Hashtable { [(object)"ME_PS"] = value, [(object)"ME_IS"] = value2, [(object)"ME_VS"] = value3, [(object)"ME_CS"] = value4, [(object)"ME_SS"] = value5, [(object)"ME_VO"] = value6, [(object)"ME_CO"] = value7 }; PhotonNetwork.CurrentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); Plugin.ResetToLocalConfig(); Plugin.Log.LogInfo((object)$"[Sync] Host pushed settings — player={value} item={value2} valuable={value3} cart={value4} shrinkValuables={value6} shrinkCart={value7} shrinkInShop={value5}"); } } private IEnumerator RescaleAfterJoin() { yield return (object)new WaitForSeconds(3f); Plugin.Log.LogInfo((object)"[Sync] Running post-join rescale pass"); PhysGrabObject[] array = Object.FindObjectsOfType<PhysGrabObject>(); foreach (PhysGrabObject val in array) { ItemAttributes val2 = ((Component)val).GetComponentInParent<ItemAttributes>(true) ?? ((Component)val).GetComponentInChildren<ItemAttributes>(true); if (!((Object)(object)val2 == (Object)null) && (!Plugin.IsCart(((Component)val).gameObject) || Plugin.ActiveShrinkCart)) { Plugin.Shrink(((Component)val2).gameObject, Plugin.ActiveItemScale); } } PlayerAvatar[] array2 = Object.FindObjectsOfType<PlayerAvatar>(); for (int i = 0; i < array2.Length; i++) { Plugin.Shrink(((Component)array2[i]).gameObject, Plugin.ActivePlayerScale); } } } [HarmonyPatch(typeof(PlayerAvatar), "Start")] internal static class PlayerAvatarPatch { internal static readonly HashSet<int> DirectScaledPlayers = new HashSet<int>(); private static IEnumerator ShrinkNextFrame(PlayerAvatar instance) { yield return null; if (!Plugin.IsInGameplay()) { yield break; } if (PhotonNetwork.IsMasterClient || !PhotonNetwork.InRoom) { PhotonView component = ((Component)instance).GetComponent<PhotonView>(); if ((Object)(object)component == (Object)null || component.IsMine) { float w = 0f; while (w < 5f && ((Object)(object)PhysGrabber.instance == (Object)null || (Object)(object)((Component)instance).GetComponent<PlayerVisionTarget>() == (Object)null || (Object)(object)CameraPosition.instance == (Object)null)) { w += Time.deltaTime; yield return null; } if (!Plugin.IsInGameplay()) { yield break; } } Plugin.Shrink(((Component)instance).gameObject, Plugin.ActivePlayerScale); yield break; } float waited = 0f; while (waited < 5f && ((Component)instance).transform.localScale.x > 0.99f) { waited += Time.deltaTime; yield return null; } if (!(((Component)instance).transform.localScale.x > 0.99f) || !DirectScaledPlayers.Add(((Object)((Component)instance).gameObject).GetInstanceID())) { yield break; } Transform transform = ((Component)instance).transform; transform.localScale *= Plugin.ActivePlayerScale; Transform parent = ((Component)instance).transform.parent; if ((Object)(object)parent != (Object)null) { Transform val = parent.Find("Player Visuals"); if ((Object)(object)val != (Object)null && val.localScale.x > 0.99f) { val.localScale *= Plugin.ActivePlayerScale; } } } private static void Postfix(PlayerAvatar __instance) { ((MonoBehaviour)__instance).StartCoroutine(ShrinkNextFrame(__instance)); } } [HarmonyPatch(typeof(RunManager), "UpdateLevel")] internal static class RunManagerUpdateLevelPatch { private static void Postfix(RunManager __instance) { if (Plugin.IsInGameplay()) { SettingsSyncer.Instance?.TriggerRescale(); } } } [HarmonyPatch(typeof(PhysGrabObject), "Start")] internal static class PhysGrabObjectPatch { internal static readonly Dictionary<int, Transform> DirectScaledItems = new Dictionary<int, Transform>(); private static void Postfix(PhysGrabObject __instance) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.IsInGameplay()) { return; } GameObject val = null; ItemAttributes componentInParent = ((Component)__instance).GetComponentInParent<ItemAttributes>(true); if ((Object)(object)componentInParent != (Object)null) { val = ((Component)componentInParent).gameObject; } else if ((Object)(object)((Component)__instance).GetComponentInChildren<ItemAttributes>(true) != (Object)null) { val = ((Component)__instance).gameObject; } if ((Object)(object)val == (Object)null || (Plugin.IsCart(((Component)__instance).gameObject) && !Plugin.ActiveShrinkCart)) { return; } bool num = (Object)(object)val.GetComponentInChildren<ItemEquippable>(true) != (Object)null; bool flag = (Object)(object)val.GetComponentInChildren<ItemGun>(true) != (Object)null; if ((num && !flag) || (PhotonNetwork.InRoom && !PhotonNetwork.IsMasterClient)) { int instanceID = ((Object)val).GetInstanceID(); if (!DirectScaledItems.ContainsKey(instanceID)) { DirectScaledItems[instanceID] = val.transform; Transform transform = val.transform; transform.localScale *= Plugin.ActiveItemScale; } } else { Plugin.Shrink(val, 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.IsInGameplay()) { return; } int instanceID = ((Object)((Component)__instance).gameObject).GetInstanceID(); if (_scaled.Add(instanceID)) { if (Plugin.ActiveShrinkValuables) { Transform transform = ((Component)__instance).transform; transform.localScale *= Plugin.ActiveValuableScale; } 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 BonkBlocker { public static bool Prefix() { return false; } } internal static class VoicePitchPatch { private const BindingFlags BF = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private static FieldInfo? _handlerStateField; private static FieldInfo? _avatarField; private static FieldInfo? _voiceChatField; private static FieldInfo? _activeField; private static FieldInfo? _multField; private static readonly object _boxedFalse = false; private static readonly object _boxedOne = 1f; public static bool Prefix() { return Plugin.ActiveVoiceMod; } public static void PlayerHandlerOnUpdatePostfix(object ctrl) { if (Plugin.ActiveVoiceMod || ctrl == null) { return; } try { if ((object)_handlerStateField == null) { _handlerStateField = ctrl.GetType().GetField("HandlerState", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } object obj = _handlerStateField?.GetValue(ctrl); if (obj == null) { return; } if ((object)_avatarField == null) { _avatarField = obj.GetType().GetField("PlayerAvatar", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } object obj2 = _avatarField?.GetValue(obj); Object val = (Object)((obj2 is Object) ? obj2 : null); if ((val != null && val == (Object)null) || obj2 == null) { return; } if ((object)_voiceChatField == null) { _voiceChatField = obj2.GetType().GetField("voiceChat", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } object obj3 = _voiceChatField?.GetValue(obj2); Object val2 = (Object)((obj3 is Object) ? obj3 : null); if ((val2 == null || !(val2 == (Object)null)) && obj3 != null) { Type type = obj3.GetType(); if ((object)_activeField == null) { _activeField = type.GetField("overridePitchIsActive", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if ((object)_multField == null) { _multField = type.GetField("overridePitchMultiplierTarget", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } _activeField?.SetValue(obj3, _boxedFalse); _multField?.SetValue(obj3, _boxedOne); } } catch (Exception ex) { Plugin.Log.LogDebug((object)("[Voice] OnUpdate postfix swallowed: " + ex.GetType().Name)); } } } internal static class PlayerRevivePatch { internal static void Postfix(PlayerAvatar __instance) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) float activePlayerScale = Plugin.ActivePlayerScale; if (activePlayerScale < 0.99f) { ((Component)__instance).transform.localScale = new Vector3(activePlayerScale, activePlayerScale, activePlayerScale); } } } [HarmonyPatch(typeof(ItemEquippable), "RPC_CompleteUnequip")] internal static class UnequipReshrinkPatch { private static void Postfix(ItemEquippable __instance) { if (!(Plugin.ActiveItemScale >= 0.99f) && (!Plugin.IsCart(((Component)__instance).gameObject) || Plugin.ActiveShrinkCart)) { ((MonoBehaviour)__instance).StartCoroutine(Reshrink(__instance)); } } private static IEnumerator Reshrink(ItemEquippable equip) { yield return null; if (!((Object)(object)equip == (Object)null)) { ItemAttributes componentInParent = ((Component)equip).GetComponentInParent<ItemAttributes>(true); GameObject val = (((Object)(object)componentInParent != (Object)null) ? ((Component)componentInParent).gameObject : ((Component)equip).gameObject); float activeItemScale = Plugin.ActiveItemScale; if (val.transform.localScale.x > 0.9f && val.transform.localScale.x > activeItemScale + 0.4f) { val.transform.localScale = new Vector3(activeItemScale, activeItemScale, activeItemScale); } } } } [HarmonyPatch(typeof(PhysGrabObjectImpactDetector), "FixedUpdate")] internal static class ShrunkWeaponWhipPatch { private static readonly Dictionary<int, (bool isWeapon, PhysGrabObject? pgo)> _cache = new Dictionary<int, (bool, PhysGrabObject)>(); private static readonly FieldRef<PhysGrabObjectImpactDetector, Vector3> _ppvRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, Vector3>("previousPreviousVelocityRaw"); private static void Postfix(PhysGrabObjectImpactDetector __instance) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)__instance).GetInstanceID(); if (!_cache.TryGetValue(instanceID, out (bool, PhysGrabObject) value)) { value = ((Object)(object)((Component)__instance).GetComponent<ItemGun>() != (Object)null || (Object)(object)((Component)__instance).GetComponentInParent<ItemEquippable>(true) != (Object)null || (Object)(object)((Component)__instance).GetComponentInChildren<ItemEquippable>(true) != (Object)null, ((Component)__instance).GetComponent<PhysGrabObject>()); _cache[instanceID] = value; } if (!value.Item1 || (Object)(object)value.Item2 == (Object)null) { return; } List<PhysGrabber> playerGrabbing = value.Item2.playerGrabbing; if (playerGrabbing == null || playerGrabbing.Count == 0) { return; } float num = 1f; foreach (PhysGrabber item in playerGrabbing) { PlayerAvatar val = (((Object)(object)item != (Object)null) ? item.playerAvatar : null); if ((Object)(object)val != (Object)null) { num = ((Component)val).transform.localScale.x; break; } } if (!(num >= 0.99f) && !(num <= 0.05f)) { ref Vector3 reference = ref _ppvRef.Invoke(__instance); reference *= Mathf.Min(1f / num, 3f); } } } internal static class CartStandoffShrinkPatch { private const float Strength = 0.5f; internal static void Postfix(ref float __result, float d, PhysGrabber grabber) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)grabber == (Object)null) { return; } PlayerAvatar playerAvatar = grabber.playerAvatar; if (!((Object)(object)playerAvatar == (Object)null)) { float x = ((Component)playerAvatar).transform.localScale.x; if (!(x >= 0.99f)) { __result = d * Mathf.Lerp(1f, x, 0.5f); } } } } [HarmonyPatch(typeof(ScaleManager), "Apply", new Type[] { typeof(GameObject), typeof(ScaleOptions) })] internal static class ScaleManagerApplyPatch { private static bool Prefix(GameObject target) { if (Plugin.IsApplying) { return true; } 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) && !(Plugin.ActiveCartScale >= 1f)) { _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 = "darkharasho.MiniEepo"; public const string PLUGIN_NAME = "MiniEepo"; public const string PLUGIN_VERSION = "1.4.0"; } }