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 TrashBox v1.3.0
TrashBox.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Modules; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("XiaoHai")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("TrashBox")] [assembly: AssemblyTitle("TrashBox")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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.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; } } [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 TrashBox { [BepInPlugin("com.REPO.XiaoHai.TrashBox", "TrashBox", "1.3")] public class Plugin : BaseUnityPlugin { private const string AssetBundleFileName = "trashbox"; public GameObject? TrashPrefab; public AudioClip? Trash2Money; public ConfigEntry<float>? recoveryRatioMin; public ConfigEntry<float>? recoveryRatioMax; internal static Plugin instance { get; private set; } internal static ManualLogSource logger => ((BaseUnityPlugin)instance).Logger; internal Harmony? Harmony { get; set; } private void Awake() { instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; recoveryRatioMin = ((BaseUnityPlugin)this).Config.Bind<float>("General", "RecoveryRatioMin", 0.3f, "The minimum ratio of item value recovered when trashing items."); recoveryRatioMax = ((BaseUnityPlugin)this).Config.Bind<float>("General", "RecoveryRatioMax", 0.8f, "The maximum ratio of item value recovered when trashing items."); LoadAB(); Patch(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } private IEnumerable<string> EnumerateAssetBundleDirectories() { List<string> directories = new List<string>(); HashSet<string> seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase); AddDirectory(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); AddDirectory(Paths.PluginPath); if (!string.IsNullOrWhiteSpace(Paths.PluginPath) && Directory.Exists(Paths.PluginPath)) { try { foreach (string item in Directory.EnumerateDirectories(Paths.PluginPath, "*", SearchOption.AllDirectories)) { AddDirectory(item); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("扫描插件目录失败: " + ex.Message)); } } return directories; void AddDirectory(string? dir) { if (!string.IsNullOrWhiteSpace(dir) && Directory.Exists(dir)) { string fullPath = Path.GetFullPath(dir); if (seen.Add(fullPath)) { directories.Add(fullPath); } } } } private string? FindAssetBundlePath() { string fileName = Path.GetFileName(((BaseUnityPlugin)this).Info.Location); List<string> list = EnumerateAssetBundleDirectories().ToList(); foreach (string item in list) { string text = Path.Combine(item, "trashbox"); string path = Path.Combine(item, fileName); if (File.Exists(text) && File.Exists(path)) { return text; } } foreach (string item2 in list) { string text2 = Path.Combine(item2, "trashbox"); if (File.Exists(text2)) { return text2; } } return null; } private void LoadAB() { string text = FindAssetBundlePath(); if (string.IsNullOrWhiteSpace(text)) { ((BaseUnityPlugin)this).Logger.LogError((object)("未找到 AssetBundle 'trashbox'。请确保它和 " + Path.GetFileName(((BaseUnityPlugin)this).Info.Location) + " 位于 BepInEx/plugins 下的同一目录。")); return; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("从以下路径加载 AssetBundle: " + text)); AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)("AssetBundle 加载失败: " + text)); return; } TrashPrefab = val.LoadAsset<GameObject>("TrashBox.prefab"); Trash2Money = val.LoadAsset<AudioClip>("trashBox.wav"); if ((Object)(object)TrashPrefab != (Object)null) { logger.LogInfo((object)"TrashBox Prefab 加载成功."); if ((Object)(object)TrashPrefab.GetComponent<TrashBox>() == (Object)null) { TrashPrefab.AddComponent<TrashBox>(); } NetworkPrefabs.RegisterNetworkPrefab(TrashPrefab); Utilities.FixAudioMixerGroups(TrashPrefab); } else { logger.LogError((object)"电视机预制体加载失败."); } } } [HarmonyPatch] public static class Patch { [HarmonyPatch(typeof(LevelGenerator))] public class LevelGeneratorPatch { [HarmonyPatch("GenerateDone")] [HarmonyPostfix] private static void AfterLevelGenerated(LevelGenerator __instance) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Plugin.instance.TrashPrefab == (Object)null || !ShouldRunCustomLogic() || !SemiFunc.IsMasterClientOrSingleplayer()) { return; } Plugin.logger.LogInfo((object)"在关卡生成后放置垃圾桶."); GameObject val = GameObject.Find("cctv"); if ((Object)(object)val != (Object)null) { if (SemiFunc.IsMultiplayer()) { GameObject val2 = PhotonNetwork.InstantiateRoomObject(((Object)Plugin.instance.TrashPrefab).name, Vector3.zero, Quaternion.identity, (byte)0, (object[])null); } else { GameObject val2 = Object.Instantiate<GameObject>(Plugin.instance.TrashPrefab, Vector3.zero, Quaternion.identity); } } } private static bool ShouldRunCustomLogic() { RunManager instance = RunManager.instance; return (Object)(object)instance != (Object)null && instance.levels.Contains(instance.levelCurrent) && (Object)(object)instance.levelCurrent != (Object)(object)instance.levelTutorial && !instance.levelShop.Contains(instance.levelCurrent) && (Object)(object)instance.levelCurrent != (Object)(object)instance.levelLobbyMenu; } } } public class TrashBox : MonoBehaviour { [CompilerGenerated] private sealed class <CloseCo>d__28 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TrashBox <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CloseCo>d__28(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = <>4__this.MoveLocalY(<>4__this.dangBan, 0f, 1f); <>1__state = 1; return true; case 1: <>1__state = -1; if (<>4__this.trashSound != null) { <>4__this.trashSound.Play(<>4__this.dangBan.transform.position, 1f, 1f, 1f, 1f); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <MoveLocalY>d__31 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GameObject go; public float targetY; public float duration; public TrashBox <>4__this; private Transform <tr>5__1; private float <startY>5__2; private float <t>5__3; private Vector3 <final>5__4; private float <k>5__5; private Vector3 <lp>5__6; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <MoveLocalY>d__31(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <tr>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <tr>5__1 = go.transform; <startY>5__2 = <tr>5__1.localPosition.y; <t>5__3 = 0f; break; case 1: <>1__state = -1; break; } if (<t>5__3 < duration) { <t>5__3 += Time.deltaTime; <k>5__5 = Mathf.Clamp01(<t>5__3 / duration); <lp>5__6 = <tr>5__1.localPosition; <lp>5__6.y = Mathf.Lerp(<startY>5__2, targetY, <k>5__5); <tr>5__1.localPosition = <lp>5__6; <>2__current = null; <>1__state = 1; return true; } <final>5__4 = <tr>5__1.localPosition; <final>5__4.y = targetY; <tr>5__1.localPosition = <final>5__4; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <OpenCo>d__30 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TrashBox <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OpenCo>d__30(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = <>4__this.MoveLocalY(<>4__this.dangBan, 0.6f, 2f); <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ProcessDebounced>d__25 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TrashBox <>4__this; private float <totalValue>5__1; private float <recoveredValue>5__2; private float <minRatio>5__3; private float <maxRatio>5__4; private List<ItemAttributes> <list>5__5; private List<ItemAttributes>.Enumerator <>s__6; private ItemAttributes <attr>5__7; private PhysGrabObject <physGrabObject>5__8; private float <itemValue>5__9; private float <itemRatio>5__10; private float <itemRecoveredValue>5__11; private StatsManager <sm>5__12; private int <current>5__13; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ProcessDebounced>d__25(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <list>5__5 = null; <>s__6 = default(List<ItemAttributes>.Enumerator); <attr>5__7 = null; <physGrabObject>5__8 = null; <sm>5__12 = null; <>1__state = -2; } private bool MoveNext() { //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown //IL_0532: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.busy = true; if ((Object)(object)<>4__this.pv != (Object)null) { if (SemiFunc.IsMultiplayer()) { <>4__this.pv.RPC("RPC_Close", (RpcTarget)0, Array.Empty<object>()); } else { <>4__this.RPC_Close(); } } else if ((Object)(object)<>4__this.dangBan != (Object)null) { <>2__current = <>4__this.MoveLocalY(<>4__this.dangBan, 0f, 1f); <>1__state = 1; return true; } goto IL_0137; case 1: <>1__state = -1; if (<>4__this.trashSound != null) { <>4__this.trashSound.Play(<>4__this.dangBan.transform.position, 1f, 1f, 1f, 1f); } goto IL_0137; case 2: <>1__state = -1; <totalValue>5__1 = 0f; <recoveredValue>5__2 = 0f; if (SemiFunc.IsMasterClientOrSingleplayer()) { <minRatio>5__3 = 0.5f; <maxRatio>5__4 = 0.5f; if (Plugin.instance.recoveryRatioMin != null && Plugin.instance.recoveryRatioMax != null) { <minRatio>5__3 = Mathf.Min(Plugin.instance.recoveryRatioMin.Value, Plugin.instance.recoveryRatioMax.Value); <maxRatio>5__4 = Mathf.Max(Plugin.instance.recoveryRatioMin.Value, Plugin.instance.recoveryRatioMax.Value); } <list>5__5 = new List<ItemAttributes>(<>4__this.insideSet); <>s__6 = <list>5__5.GetEnumerator(); try { while (<>s__6.MoveNext()) { <attr>5__7 = <>s__6.Current; if (!Object.op_Implicit((Object)(object)<attr>5__7)) { continue; } <physGrabObject>5__8 = ((Component)<attr>5__7).GetComponent<PhysGrabObject>(); ReleaseGrabbers(<physGrabObject>5__8); if (Object.op_Implicit((Object)(object)ShopManager.instance)) { ShopManager.instance.ShoppingListItemRemove(<attr>5__7); } <itemValue>5__9 = GetItemCurrencyValue(<attr>5__7); <itemRatio>5__10 = Random.Range(<minRatio>5__3, <maxRatio>5__4); <itemRecoveredValue>5__11 = <itemValue>5__9 * <itemRatio>5__10; <totalValue>5__1 += <itemValue>5__9; <recoveredValue>5__2 += <itemRecoveredValue>5__11; Plugin.logger.LogInfo((object)$"垃圾桶回收物品: {((Object)<attr>5__7).name},原始价值: {<itemValue>5__9},本次比例: {<itemRatio>5__10:F2},回收价值: {<itemRecoveredValue>5__11}"); try { <sm>5__12 = StatsManager.instance; if ((Object)(object)<sm>5__12 != (Object)null) { if (!string.IsNullOrEmpty(<attr>5__7.instanceName)) { <sm>5__12.ItemRemove(<attr>5__7.instanceName); } else if (Object.op_Implicit((Object)(object)<attr>5__7.item)) { <current>5__13 = <sm>5__12.GetItemPurchased(<attr>5__7.item); <sm>5__12.SetItemPurchase(<attr>5__7.item, Mathf.Max(0, <current>5__13 - 1)); } } <sm>5__12 = null; } catch { } if ((Object)(object)<physGrabObject>5__8 != (Object)null) { <physGrabObject>5__8.DestroyPhysGrabObject(); } else if (SemiFunc.IsMultiplayer()) { PhotonNetwork.Destroy(((Component)<attr>5__7).gameObject); } else { Object.Destroy((Object)(object)((Component)<attr>5__7).gameObject); } <physGrabObject>5__8 = null; <attr>5__7 = null; } } finally { ((IDisposable)<>s__6).Dispose(); } <>s__6 = default(List<ItemAttributes>.Enumerator); Plugin.logger.LogInfo((object)$"垃圾桶回收完成,物品数: {<list>5__5.Count},原始总值: {<totalValue>5__1},生成金额: {<recoveredValue>5__2}"); <list>5__5 = null; } if (SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)<>4__this.moneyPoint != (Object)null && <recoveredValue>5__2 > 0f) { SpawnMoney(<>4__this.moneyPoint.transform.position, <recoveredValue>5__2); } if ((Object)(object)<>4__this.pv != (Object)null) { if (SemiFunc.IsMultiplayer()) { <>4__this.pv.RPC("RPC_Open", (RpcTarget)0, Array.Empty<object>()); } else { <>4__this.RPC_Open(); } } else if ((Object)(object)<>4__this.dangBan != (Object)null) { <>2__current = <>4__this.MoveLocalY(<>4__this.dangBan, 0.6f, 2f); <>1__state = 3; return true; } break; case 3: { <>1__state = -1; break; } IL_0137: <>2__current = (object)new WaitForSeconds(<>4__this.processDuration); <>1__state = 2; return true; } <>4__this.insideSet.Clear(); <>4__this.lastSeenTimes.Clear(); <>4__this.busy = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private GameObject? moneyPoint; private GameObject? dangBan; private Collider? trashCollider; private bool busy; private float dangBanDefaultY; private readonly List<ItemAttributes> candidates = new List<ItemAttributes>(); private readonly HashSet<ItemAttributes> insideSet = new HashSet<ItemAttributes>(); private readonly Dictionary<ItemAttributes, Vector3> originalScales = new Dictionary<ItemAttributes, Vector3>(); private readonly Dictionary<ItemAttributes, Vector3> scaleVelocities = new Dictionary<ItemAttributes, Vector3>(); private readonly Dictionary<ItemAttributes, float> lastSeenTimes = new Dictionary<ItemAttributes, float>(); [SerializeField] private float collectWindow = 3f; [SerializeField] private float processDuration = 3f; [SerializeField] private float insideScaleMultiplier = 0.5f; [SerializeField] private float scaleSmoothTime = 0.12f; [SerializeField] private float insideExitGraceTime = 0.2f; private float collectTimer; private Sound? trashSound; private PhotonView? pv; private void Awake() { //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_015b: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("cctv"); if ((Object)(object)val != (Object)null) { Plugin.logger.LogInfo((object)"tv不为空!."); SetTransform(val, ((Component)this).gameObject); } else { Plugin.logger.LogInfo((object)"tv为空!."); } Transform obj = ((Component)this).transform.Find("MoneyPoint"); moneyPoint = ((obj != null) ? ((Component)obj).gameObject : null); Transform obj2 = ((Component)this).transform.Find("DangBan"); dangBan = ((obj2 != null) ? ((Component)obj2).gameObject : null); Transform obj3 = ((Component)this).transform.Find("Collider/TrashCollider"); GameObject val2 = ((obj3 != null) ? ((Component)obj3).gameObject : null); if ((Object)(object)val2 != (Object)null) { trashCollider = val2.GetComponentInChildren<Collider>(); } if ((Object)(object)moneyPoint == (Object)null || (Object)(object)dangBan == (Object)null || (Object)(object)trashCollider == (Object)null) { Plugin.logger.LogError((object)"TrashBox initialization failed: Missing components."); Object.Destroy((Object)(object)((Component)this).gameObject); } else { dangBanDefaultY = dangBan.transform.localPosition.y; } if ((Object)(object)Plugin.instance.Trash2Money != (Object)null) { trashSound = new Sound(); trashSound.Type = (AudioType)6; trashSound.SpatialBlend = 1f; trashSound.Volume = 1f; trashSound.Pitch = 1f; trashSound.Sounds = (AudioClip[])(object)new AudioClip[1] { Plugin.instance.Trash2Money }; } pv = ((Component)this).GetComponent<PhotonView>(); } public static void SetTransform(GameObject cctv, GameObject tb) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) tb.transform.SetParent(cctv.transform, false); tb.transform.localPosition = new Vector3(0.58f, -4.28f, -0.19f); tb.transform.localRotation = Quaternion.Euler(90f, 180f, 0f); tb.transform.localScale = new Vector3(2f, 2f, 1.5f); } public static void SpawnMoney(Vector3 position, float recycleValue) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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) GameObject surplusValuableSmall = AssetManager.instance.surplusValuableSmall; int num = Mathf.Max(1000, Mathf.RoundToInt(Mathf.Round(recycleValue / 100f) * 100f)); Plugin.logger.LogInfo((object)$"生成回收钱袋,价值: {num}"); GameObject val = ((!SemiFunc.IsMultiplayer()) ? Object.Instantiate<GameObject>(surplusValuableSmall, position, Quaternion.identity) : PhotonNetwork.InstantiateRoomObject("Valuables/" + ((Object)surplusValuableSmall).name, position, Quaternion.identity, (byte)0, (object[])null)); ValuableObject component = val.GetComponent<ValuableObject>(); if ((Object)(object)component != (Object)null) { component.dollarValueOverride = num; } } private void Update() { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer() || busy || (Object)(object)trashCollider == (Object)null) { return; } candidates.Clear(); GatherItemAttrsInside(candidates); float time = Time.time; bool flag = false; for (int i = 0; i < candidates.Count; i++) { ItemAttributes val = candidates[i]; lastSeenTimes[val] = time; if (!insideSet.Contains(val)) { insideSet.Add(val); flag = true; } if (!originalScales.ContainsKey(val)) { originalScales[val] = ((Component)val).transform.localScale; } } foreach (ItemAttributes item in new List<ItemAttributes>(insideSet)) { float value; if (!Object.op_Implicit((Object)(object)item)) { insideSet.Remove(item); originalScales.Remove(item); scaleVelocities.Remove(item); lastSeenTimes.Remove(item); } else if (!lastSeenTimes.TryGetValue(item, out value) || !(time - value <= insideExitGraceTime)) { insideSet.Remove(item); lastSeenTimes.Remove(item); } } UpdateItemScaleTransitions(); if (flag) { collectTimer = collectWindow; } if (insideSet.Count == 0) { if (collectTimer > 0f) { collectTimer -= Time.deltaTime; } } else if (collectTimer > 0f) { collectTimer -= Time.deltaTime; } else if (insideSet.Count > 0) { ((MonoBehaviour)this).StartCoroutine(ProcessDebounced()); } } private void UpdateItemScaleTransitions() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<ItemAttributes, Vector3> item in new List<KeyValuePair<ItemAttributes, Vector3>>(originalScales)) { ItemAttributes key = item.Key; if (!Object.op_Implicit((Object)(object)key)) { originalScales.Remove(key); scaleVelocities.Remove(key); lastSeenTimes.Remove(key); continue; } Vector3 val = (insideSet.Contains(key) ? (item.Value * insideScaleMultiplier) : item.Value); Vector3 value; Vector3 value2 = (scaleVelocities.TryGetValue(key, out value) ? value : Vector3.zero); ((Component)key).transform.localScale = Vector3.SmoothDamp(((Component)key).transform.localScale, val, ref value2, scaleSmoothTime); scaleVelocities[key] = value2; if (!insideSet.Contains(key) && Vector3.Distance(((Component)key).transform.localScale, item.Value) < 0.01f) { ((Component)key).transform.localScale = item.Value; originalScales.Remove(key); scaleVelocities.Remove(key); } } } private static float GetItemCurrencyValue(ItemAttributes attr) { try { attr.GetValue(); } catch { } return Mathf.Max(1000f, (float)attr.value * 1000f); } private void GatherItemAttrsInside(List<ItemAttributes> list) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)trashCollider == (Object)null) { return; } Bounds bounds = trashCollider.bounds; Collider[] array = Physics.OverlapBox(((Bounds)(ref bounds)).center, ((Bounds)(ref bounds)).extents, ((Component)trashCollider).transform.rotation); Collider[] array2 = array; foreach (Collider val in array2) { ItemAttributes componentInParent = ((Component)val).GetComponentInParent<ItemAttributes>(); if (Object.op_Implicit((Object)(object)componentInParent) && !list.Contains(componentInParent)) { list.Add(componentInParent); } } } [IteratorStateMachine(typeof(<ProcessDebounced>d__25))] private IEnumerator ProcessDebounced() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ProcessDebounced>d__25(0) { <>4__this = this }; } private static void ReleaseGrabbers(PhysGrabObject? physGrabObject) { if ((Object)(object)physGrabObject == (Object)null || physGrabObject.playerGrabbing.Count == 0) { return; } PhotonView component = ((Component)physGrabObject).GetComponent<PhotonView>(); int num = (((Object)(object)component != (Object)null) ? component.ViewID : (-1)); foreach (PhysGrabber item in physGrabObject.playerGrabbing.ToList()) { if (Object.op_Implicit((Object)(object)item)) { item.ReleaseObject(num, 0.1f); } } } [PunRPC] private void RPC_Close() { if (Object.op_Implicit((Object)(object)dangBan)) { ((MonoBehaviour)this).StartCoroutine(CloseCo()); } } [IteratorStateMachine(typeof(<CloseCo>d__28))] private IEnumerator CloseCo() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CloseCo>d__28(0) { <>4__this = this }; } [PunRPC] private void RPC_Open() { if (Object.op_Implicit((Object)(object)dangBan)) { ((MonoBehaviour)this).StartCoroutine(OpenCo()); } } [IteratorStateMachine(typeof(<OpenCo>d__30))] private IEnumerator OpenCo() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OpenCo>d__30(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<MoveLocalY>d__31))] private IEnumerator MoveLocalY(GameObject go, float targetY, float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <MoveLocalY>d__31(0) { <>4__this = this, go = go, targetY = targetY, duration = duration }; } } }