using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; 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 Microsoft.CodeAnalysis; using Photon.Pun; 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("REPOJP")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("zabuMod")] [assembly: AssemblyTitle("zabuMod")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace REPOJP.QuickShopDelivery { [BepInPlugin("REPOJP.QuickShopDelivery", "QuickShopDelivery", "4.0.1")] public sealed class QuickShopDeliveryPlugin : BaseUnityPlugin { private enum TeleportActionMode { RightClick, MiddleClick, Hotkey } private enum DeliveryMoveMode { MoveInside, MoveOutside } [CompilerGenerated] private sealed class d__48 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PhysGrabObject physGrabObject; public RoomVolumeCheck roomVolumeCheck; public Vector3 targetPosition; public Quaternion targetRotation; public int objectKey; public DeliveryMoveMode moveMode; public QuickShopDeliveryPlugin <>4__this; private float 5__1; private bool 5__2; private bool 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__48(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.TryReleaseHeldObject(physGrabObject); 5__1 = Mathf.Clamp(<>4__this.configReleaseDelaySeconds.Value, 0.01f, 0.5f); <>2__current = (object)new WaitForSeconds(5__1); <>1__state = 1; return true; case 1: <>1__state = -1; 5__2 = <>4__this.TryTeleportObject(physGrabObject, targetPosition, targetRotation); if (!5__2) { <>4__this.activeTeleportObjectKeys.Remove(objectKey); <>4__this.ShowLocalMessage((moveMode == DeliveryMoveMode.MoveOutside) ? "Move outside failed" : "Delivery failed"); return false; } <>2__current = (object)new WaitForSeconds(0.55f); <>1__state = 2; return true; case 2: <>1__state = -1; 5__3 = <>4__this.IsObjectInExtraction(physGrabObject, roomVolumeCheck); if (moveMode == DeliveryMoveMode.MoveInside) { if (5__3) { <>4__this.ShowLocalMessage("Delivered to extraction"); } else { <>4__this.ShowLocalMessage("Teleported, waiting for host check"); } } else if (!5__3) { <>4__this.ShowLocalMessage("Moved outside extraction"); } else { <>4__this.ShowLocalMessage("Moved, waiting for host check"); } <>4__this.activeTeleportObjectKeys.Remove(objectKey); 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 const string PluginGuid = "REPOJP.QuickShopDelivery"; private const string PluginName = "QuickShopDelivery"; private const string PluginVersion = "4.0.1"; private static ManualLogSource logSource; private ConfigEntry configEnabled; private ConfigEntry configTeleportAction; private ConfigEntry configHotkey; private ConfigEntry configRequireCrouch; private ConfigEntry configCooldownSeconds; private ConfigEntry configReleaseDelaySeconds; private ConfigEntry configReleaseDisableSeconds; private ConfigEntry configDropHeightOffset; private ConfigEntry configDropSpreadRadius; private ConfigEntry configToggleIfAlreadyInExtraction; private ConfigEntry configOutsideDistance; private ConfigEntry configOutsideHeightOffset; private ConfigEntry configOnlyShopItems; private ConfigEntry configShowMessage; private ConfigEntry configMessageSeconds; private ConfigEntry configDebugLog; private FieldInfo fieldGrabbedPhysGrabObject; private FieldInfo fieldShopItem; private FieldInfo fieldIsCrouching; private FieldInfo fieldInExtractionPoint; private RoomVolume cachedExtractionRoom; private Bounds cachedExtractionBounds; private int spreadIndex; private readonly HashSet activeTeleportObjectKeys = new HashSet(); private readonly Dictionary itemCooldownUntil = new Dictionary(); private string messageText = string.Empty; private float messageTimer; private string cachedHotkeyText = string.Empty; private KeyCode cachedHotkeyKey = (KeyCode)0; private bool cachedHotkeyValid; private bool cachedHotkeyInitialized; private void Awake() { logSource = ((BaseUnityPlugin)this).Logger; ((Component)this).transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)52; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); BindConfig(); CacheReflection(); WriteDebugLog("Loaded"); } private void BindConfig() { configEnabled = ((BaseUnityPlugin)this).Config.Bind("General", "Enabled", true, "Enable QuickShopDelivery. QuickShopDeliveryを有効化します。"); configTeleportAction = ((BaseUnityPlugin)this).Config.Bind("Input", "TeleportAction", TeleportActionMode.RightClick, "Select the teleport action. Choose RightClick, MiddleClick, or Hotkey. TP操作を選択します。RightClick、MiddleClick、Hotkeyから選択します。"); configHotkey = ((BaseUnityPlugin)this).Config.Bind("Input", "Hotkey", "T", "Hotkey used only when TeleportAction is Hotkey. Examples: A, Z, 1, 0, T, F1, Space, Minus, Slash, Semicolon, BackQuote. TeleportActionがHotkeyの場合だけ使用するキーです。例: A, Z, 1, 0, T, F1, Space, Minus, Slash, Semicolon, BackQuote。"); configRequireCrouch = ((BaseUnityPlugin)this).Config.Bind("Input", "RequireCrouch", false, "Require crouching while using the selected teleport action. 選択したTP操作を使う時にしゃがみを必須にします。"); configCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind("Delivery", "CooldownSeconds", 0.15f, "Cooldown for the same item after one teleport attempt. Different items can be delivered immediately. 同じアイテムへのTP再実行クールダウンです。別アイテムは即座に納品できます。"); configReleaseDelaySeconds = ((BaseUnityPlugin)this).Config.Bind("Delivery", "ReleaseDelaySeconds", 0.08f, "Delay after releasing the held item before teleporting it. 掴み解除後にTPするまでの待機時間です。"); configReleaseDisableSeconds = ((BaseUnityPlugin)this).Config.Bind("Delivery", "ReleaseDisableSeconds", 0.05f, "Grab disable time applied when the held item is released. Effective value is clamped to 0.01-0.10 seconds for quick consecutive deliveries. 掴み解除時に適用する再掴み無効時間です。連続納品用に実効値は0.01~0.10秒へ制限されます。"); configDropHeightOffset = ((BaseUnityPlugin)this).Config.Bind("Delivery", "DropHeightOffset", 0.35f, "Vertical offset from the center of the extraction RoomVolume. 納品所RoomVolume中心から上方向へずらす高さです。"); configDropSpreadRadius = ((BaseUnityPlugin)this).Config.Bind("Delivery", "DropSpreadRadius", 0.25f, "Horizontal spread radius used to reduce item overlap. Set 0 to always use the center. アイテム同士の重なりを減らす水平分散半径です。0にすると常に中央へ置きます。"); configToggleIfAlreadyInExtraction = ((BaseUnityPlugin)this).Config.Bind("Delivery", "ToggleIfAlreadyInExtraction", true, "Teleport the held item outside when it is already inside the extraction area. 既に納品所内にあるアイテムは外へTPします。"); configOutsideDistance = ((BaseUnityPlugin)this).Config.Bind("Delivery", "OutsideDistance", 1.2f, "Distance added from the extraction area edge when moving an item outside. 納品所外へ出す際に納品所外周から追加で離す距離です。"); configOutsideHeightOffset = ((BaseUnityPlugin)this).Config.Bind("Delivery", "OutsideHeightOffset", 0.35f, "Height offset from the extraction area floor when moving an item outside. 納品所外へ出す際に納品所床面から上方向へずらす高さです。"); configOnlyShopItems = ((BaseUnityPlugin)this).Config.Bind("Delivery", "OnlyShopItems", true, "Only allow items spawned as shop items. ショップ商品として生成されたアイテムだけを対象にします。"); configShowMessage = ((BaseUnityPlugin)this).Config.Bind("UI", "ShowMessage", true, "Show a small local message after delivery actions. 納品操作後にローカルメッセージを表示します。"); configMessageSeconds = ((BaseUnityPlugin)this).Config.Bind("UI", "MessageSeconds", 1.5f, "Local message display seconds. ローカルメッセージの表示秒数です。"); configDebugLog = ((BaseUnityPlugin)this).Config.Bind("Debug", "DebugLog", false, "Write detailed debug logs. 詳細Debugログを出力します。"); } private void CacheReflection() { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; fieldGrabbedPhysGrabObject = typeof(PhysGrabber).GetField("grabbedPhysGrabObject", bindingAttr); fieldShopItem = typeof(ItemAttributes).GetField("shopItem", bindingAttr); fieldIsCrouching = typeof(PlayerAvatar).GetField("isCrouching", bindingAttr); fieldInExtractionPoint = typeof(RoomVolumeCheck).GetField("inExtractionPoint", bindingAttr); } private void Update() { UpdateMessageTimer(); if (configEnabled.Value && IsTeleportActionPressed() && IsTextInputSafe()) { if (configRequireCrouch.Value && !IsLocalPlayerCrouching()) { ShowLocalMessage("Crouch required"); } else { TryStartDelivery(); } } } private void OnGUI() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) if (configShowMessage.Value && !(messageTimer <= 0f) && !string.IsNullOrEmpty(messageText)) { float num = 520f; float num2 = 34f; Rect val = default(Rect); ((Rect)(ref val))..ctor(((float)Screen.width - num) * 0.5f, (float)Screen.height * 0.72f, num, num2); GUIStyle val2 = new GUIStyle(GUI.skin.box); val2.fontSize = 18; val2.alignment = (TextAnchor)4; val2.normal.textColor = Color.white; GUI.Box(val, messageText, val2); } } private bool IsTeleportActionPressed() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) switch (configTeleportAction.Value) { case TeleportActionMode.RightClick: return Input.GetKeyDown((KeyCode)324); case TeleportActionMode.MiddleClick: return Input.GetKeyDown((KeyCode)325); case TeleportActionMode.Hotkey: if (!RefreshHotkeyCache()) { return false; } return Input.GetKeyDown(cachedHotkeyKey); default: return Input.GetKeyDown((KeyCode)325); } } private bool RefreshHotkeyCache() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) string text = configHotkey.Value; if (text == null) { text = string.Empty; } if (cachedHotkeyInitialized && string.Equals(cachedHotkeyText, text, StringComparison.Ordinal)) { return cachedHotkeyValid; } cachedHotkeyInitialized = true; cachedHotkeyText = text; cachedHotkeyValid = TryParseHotkey(text, out cachedHotkeyKey); if (!cachedHotkeyValid) { cachedHotkeyKey = (KeyCode)0; WriteDebugLog("Invalid hotkey setting: " + text); ShowLocalMessage("Invalid Hotkey: " + text); } else { WriteDebugLog("Hotkey parsed: " + text + " -> " + ((object)(KeyCode)(ref cachedHotkeyKey)).ToString()); } return cachedHotkeyValid; } private bool TryParseHotkey(string hotkeyText, out KeyCode keyCode) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected I4, but got Unknown keyCode = (KeyCode)0; if (string.IsNullOrWhiteSpace(hotkeyText)) { return false; } string text = hotkeyText.Trim(); if (text.Length == 1 && TryParseSingleCharacterKey(text[0], out keyCode)) { return true; } if (TryParseKeyAlias(text, out keyCode)) { return true; } try { keyCode = (KeyCode)(int)(KeyCode)Enum.Parse(typeof(KeyCode), text, ignoreCase: true); return (int)keyCode != 0; } catch { keyCode = (KeyCode)0; return false; } } private bool TryParseSingleCharacterKey(char character, out KeyCode keyCode) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected I4, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected I4, but got Unknown keyCode = (KeyCode)0; if ((character >= 'a' && character <= 'z') || (character >= 'A' && character <= 'Z')) { string value = char.ToUpperInvariant(character).ToString(); keyCode = (KeyCode)(int)(KeyCode)Enum.Parse(typeof(KeyCode), value, ignoreCase: true); return true; } if (character >= '0' && character <= '9') { keyCode = (KeyCode)(int)(KeyCode)Enum.Parse(typeof(KeyCode), "Alpha" + character, ignoreCase: true); return true; } switch (character) { case '!': keyCode = (KeyCode)33; return true; case '"': keyCode = (KeyCode)34; return true; case '#': keyCode = (KeyCode)35; return true; case '$': keyCode = (KeyCode)36; return true; case '%': keyCode = (KeyCode)37; return true; case '&': keyCode = (KeyCode)38; return true; case '\'': keyCode = (KeyCode)39; return true; case '(': keyCode = (KeyCode)40; return true; case ')': keyCode = (KeyCode)41; return true; case '*': keyCode = (KeyCode)42; return true; case '+': keyCode = (KeyCode)43; return true; case ',': keyCode = (KeyCode)44; return true; case '-': keyCode = (KeyCode)45; return true; case '.': keyCode = (KeyCode)46; return true; case '/': keyCode = (KeyCode)47; return true; case ':': keyCode = (KeyCode)58; return true; case ';': keyCode = (KeyCode)59; return true; case '<': keyCode = (KeyCode)60; return true; case '=': keyCode = (KeyCode)61; return true; case '>': keyCode = (KeyCode)62; return true; case '?': keyCode = (KeyCode)63; return true; case '@': keyCode = (KeyCode)64; return true; case '[': keyCode = (KeyCode)91; return true; case '\\': keyCode = (KeyCode)92; return true; case ']': keyCode = (KeyCode)93; return true; case '^': keyCode = (KeyCode)94; return true; case '_': keyCode = (KeyCode)95; return true; case '`': keyCode = (KeyCode)96; return true; case '{': keyCode = (KeyCode)91; return true; case '}': keyCode = (KeyCode)93; return true; case '|': keyCode = (KeyCode)92; return true; case '~': keyCode = (KeyCode)96; return true; case ' ': keyCode = (KeyCode)32; return true; default: return false; } } private bool TryParseKeyAlias(string hotkeyText, out KeyCode keyCode) { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected I4, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected I4, but got Unknown keyCode = (KeyCode)0; string text = hotkeyText.Trim().ToLowerInvariant().Replace(" ", string.Empty) .Replace("_", string.Empty) .Replace("-", string.Empty); if (text.Length == 2 && text[0] == 'd' && text[1] >= '0' && text[1] <= '9') { keyCode = (KeyCode)(int)(KeyCode)Enum.Parse(typeof(KeyCode), "Alpha" + text[1], ignoreCase: true); return true; } if (text.Length >= 2 && text[0] == 'f' && int.TryParse(text.Substring(1), out var result) && result >= 1 && result <= 15) { keyCode = (KeyCode)(int)(KeyCode)Enum.Parse(typeof(KeyCode), "F" + result, ignoreCase: true); return true; } switch (text) { case "rightclick": case "rightmouse": case "mouse1": keyCode = (KeyCode)324; return true; case "middleclick": case "wheelclick": case "middlemouse": case "mouse2": keyCode = (KeyCode)325; return true; case "leftclick": case "leftmouse": case "mouse0": keyCode = (KeyCode)323; return true; case "enter": case "return": keyCode = (KeyCode)13; return true; case "escape": case "esc": keyCode = (KeyCode)27; return true; case "space": case "spacebar": keyCode = (KeyCode)32; return true; case "tab": keyCode = (KeyCode)9; return true; case "backspace": keyCode = (KeyCode)8; return true; case "delete": case "del": keyCode = (KeyCode)127; return true; case "insert": case "ins": keyCode = (KeyCode)277; return true; case "home": keyCode = (KeyCode)278; return true; case "end": keyCode = (KeyCode)279; return true; case "pageup": case "pgup": keyCode = (KeyCode)280; return true; case "pagedown": case "pgdn": keyCode = (KeyCode)281; return true; case "up": case "uparrow": keyCode = (KeyCode)273; return true; case "down": case "downarrow": keyCode = (KeyCode)274; return true; case "left": case "leftarrow": keyCode = (KeyCode)276; return true; case "right": case "rightarrow": keyCode = (KeyCode)275; return true; case "minus": case "hyphen": keyCode = (KeyCode)45; return true; case "equals": case "equal": keyCode = (KeyCode)61; return true; case "plus": keyCode = (KeyCode)43; return true; case "backquote": case "backtick": case "grave": case "tilde": keyCode = (KeyCode)96; return true; case "leftbracket": case "openbracket": keyCode = (KeyCode)91; return true; case "rightbracket": case "closebracket": keyCode = (KeyCode)93; return true; case "backslash": case "pipe": keyCode = (KeyCode)92; return true; case "semicolon": keyCode = (KeyCode)59; return true; case "colon": keyCode = (KeyCode)58; return true; case "quote": case "apostrophe": keyCode = (KeyCode)39; return true; case "doublequote": keyCode = (KeyCode)34; return true; case "comma": keyCode = (KeyCode)44; return true; case "less": keyCode = (KeyCode)60; return true; case "period": case "dot": keyCode = (KeyCode)46; return true; case "greater": keyCode = (KeyCode)62; return true; case "slash": keyCode = (KeyCode)47; return true; case "question": keyCode = (KeyCode)63; return true; case "exclaim": case "bang": keyCode = (KeyCode)33; return true; case "hash": keyCode = (KeyCode)35; return true; case "dollar": keyCode = (KeyCode)36; return true; case "percent": keyCode = (KeyCode)37; return true; case "ampersand": keyCode = (KeyCode)38; return true; case "asterisk": case "star": keyCode = (KeyCode)42; return true; case "at": keyCode = (KeyCode)64; return true; case "caret": keyCode = (KeyCode)94; return true; case "underscore": keyCode = (KeyCode)95; return true; default: return false; } } private void TryStartDelivery() { //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) if (!IsShopReady()) { ShowLocalMessage("Only available in shop"); return; } PhysGrabber instance = PhysGrabber.instance; if ((Object)(object)instance == (Object)null || !instance.grabbed) { ShowLocalMessage("No held item"); return; } PhysGrabObject heldPhysGrabObject = GetHeldPhysGrabObject(instance); if ((Object)(object)heldPhysGrabObject == (Object)null || !((Behaviour)heldPhysGrabObject).enabled || heldPhysGrabObject.dead) { ShowLocalMessage("No valid held item"); return; } ItemAttributes component = ((Component)heldPhysGrabObject).GetComponent(); if ((Object)(object)component == (Object)null) { ShowLocalMessage("Held object is not a shop item"); return; } if (configOnlyShopItems.Value && !IsShopItem(component)) { ShowLocalMessage("Held item is not a shop item"); return; } RoomVolumeCheck component2 = ((Component)heldPhysGrabObject).GetComponent(); bool flag = false; if ((Object)(object)component2 != (Object)null) { SafeCheckRoomVolume(component2); flag = IsInExtractionPoint(component2); } if (flag && !configToggleIfAlreadyInExtraction.Value) { ShowLocalMessage("Already in extraction"); return; } RoomVolume extractionRoom = GetExtractionRoom(); if ((Object)(object)extractionRoom == (Object)null) { ShowLocalMessage("Extraction area not found"); return; } int objectKey = GetObjectKey(heldPhysGrabObject); float value; if (activeTeleportObjectKeys.Contains(objectKey)) { ShowLocalMessage("This item is already being moved"); } else if (!itemCooldownUntil.TryGetValue(objectKey, out value) || !(Time.time < value)) { DeliveryMoveMode deliveryMoveMode = (flag ? DeliveryMoveMode.MoveOutside : DeliveryMoveMode.MoveInside); Vector3 targetPosition = ((deliveryMoveMode == DeliveryMoveMode.MoveOutside) ? GetOutsideDeliveryPosition(heldPhysGrabObject) : GetDeliveryPosition()); Quaternion rotation = ((Component)heldPhysGrabObject).transform.rotation; CleanItemCooldowns(); activeTeleportObjectKeys.Add(objectKey); itemCooldownUntil[objectKey] = Time.time + Mathf.Max(0.01f, configCooldownSeconds.Value); ((MonoBehaviour)this).StartCoroutine(DeliverAfterRelease(heldPhysGrabObject, component2, targetPosition, rotation, objectKey, deliveryMoveMode)); } } [IteratorStateMachine(typeof(d__48))] private IEnumerator DeliverAfterRelease(PhysGrabObject physGrabObject, RoomVolumeCheck roomVolumeCheck, Vector3 targetPosition, Quaternion targetRotation, int objectKey, DeliveryMoveMode moveMode) { //IL_001c: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__48(0) { <>4__this = this, physGrabObject = physGrabObject, roomVolumeCheck = roomVolumeCheck, targetPosition = targetPosition, targetRotation = targetRotation, objectKey = objectKey, moveMode = moveMode }; } private bool TryTeleportObject(PhysGrabObject physGrabObject, Vector3 targetPosition, Quaternion targetRotation) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)physGrabObject == (Object)null || !((Behaviour)physGrabObject).enabled || physGrabObject.dead) { return false; } Rigidbody rb = physGrabObject.rb; if ((Object)(object)rb != (Object)null) { rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; } physGrabObject.OverrideIndestructible(0.5f); physGrabObject.OverrideBreakEffects(0.5f); physGrabObject.OverrideDrag(10f, 0.5f); physGrabObject.OverrideAngularDrag(10f, 0.5f); physGrabObject.Teleport(targetPosition, targetRotation); string name = ((Object)physGrabObject).name; Vector3 val = targetPosition; WriteDebugLog("Teleport requested: " + name + " -> " + ((object)(Vector3)(ref val)).ToString()); return true; } catch (Exception ex) { WriteDebugLog("Teleport failed: " + ex.Message); return false; } } private void TryReleaseHeldObject(PhysGrabObject physGrabObject) { try { PhysGrabber instance = PhysGrabber.instance; if (!((Object)(object)instance == (Object)null) && !((Object)(object)physGrabObject == (Object)null)) { int photonViewId = GetPhotonViewId(physGrabObject); instance.OverrideGrabRelease(photonViewId, Mathf.Clamp(configReleaseDisableSeconds.Value, 0.01f, 0.1f)); } } catch (Exception ex) { WriteDebugLog("Release failed: " + ex.Message); } } private int GetObjectKey(PhysGrabObject physGrabObject) { if ((Object)(object)physGrabObject == (Object)null) { return 0; } int photonViewId = GetPhotonViewId(physGrabObject); if (photonViewId > 0) { return photonViewId; } return ((Object)physGrabObject).GetInstanceID(); } private int GetPhotonViewId(PhysGrabObject physGrabObject) { if ((Object)(object)physGrabObject == (Object)null) { return -1; } PhotonView component = ((Component)physGrabObject).GetComponent(); if ((Object)(object)component != (Object)null) { return component.ViewID; } return -1; } private void CleanItemCooldowns() { if (itemCooldownUntil.Count < 64) { return; } List list = new List(); foreach (KeyValuePair item in itemCooldownUntil) { if (Time.time >= item.Value && !activeTeleportObjectKeys.Contains(item.Key)) { list.Add(item.Key); } } for (int i = 0; i < list.Count; i++) { itemCooldownUntil.Remove(list[i]); } } private bool IsShopReady() { if ((Object)(object)RunManager.instance == (Object)null || (Object)(object)LevelGenerator.Instance == (Object)null) { return false; } if (!LevelGenerator.Instance.Generated) { return false; } try { return SemiFunc.RunIsShop(); } catch (Exception ex) { WriteDebugLog("RunIsShop failed: " + ex.Message); return false; } } private bool IsTextInputSafe() { try { return SemiFunc.NoTextInputsActive(); } catch (Exception ex) { WriteDebugLog("NoTextInputsActive failed: " + ex.Message); return true; } } private bool IsLocalPlayerCrouching() { PhysGrabber instance = PhysGrabber.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.playerAvatar == (Object)null || fieldIsCrouching == null) { return false; } if (!(fieldIsCrouching.GetValue(instance.playerAvatar) is bool result)) { return false; } return result; } private PhysGrabObject GetHeldPhysGrabObject(PhysGrabber grabber) { if ((Object)(object)grabber == (Object)null || fieldGrabbedPhysGrabObject == null) { return null; } object? value = fieldGrabbedPhysGrabObject.GetValue(grabber); return (PhysGrabObject)((value is PhysGrabObject) ? value : null); } private bool IsShopItem(ItemAttributes itemAttributes) { if ((Object)(object)itemAttributes == (Object)null || fieldShopItem == null) { return false; } if (!(fieldShopItem.GetValue(itemAttributes) is bool result)) { return false; } return result; } private bool IsInExtractionPoint(RoomVolumeCheck roomVolumeCheck) { if ((Object)(object)roomVolumeCheck == (Object)null) { return false; } if (!(fieldInExtractionPoint != null) || !(fieldInExtractionPoint.GetValue(roomVolumeCheck) is bool result)) { if (roomVolumeCheck.CurrentRooms == null) { return false; } for (int i = 0; i < roomVolumeCheck.CurrentRooms.Count; i++) { RoomVolume val = roomVolumeCheck.CurrentRooms[i]; if ((Object)(object)val != (Object)null && val.Extraction) { return true; } } return false; } return result; } private bool IsObjectInExtraction(PhysGrabObject physGrabObject, RoomVolumeCheck roomVolumeCheck) { if ((Object)(object)physGrabObject == (Object)null) { return false; } if ((Object)(object)roomVolumeCheck == (Object)null) { roomVolumeCheck = ((Component)physGrabObject).GetComponent(); } if ((Object)(object)roomVolumeCheck == (Object)null) { return false; } SafeCheckRoomVolume(roomVolumeCheck); return IsInExtractionPoint(roomVolumeCheck); } private void SafeCheckRoomVolume(RoomVolumeCheck roomVolumeCheck) { if ((Object)(object)roomVolumeCheck == (Object)null || !((Behaviour)roomVolumeCheck).enabled) { return; } try { roomVolumeCheck.CheckSet(); } catch (Exception ex) { WriteDebugLog("RoomVolumeCheck.CheckSet failed: " + ex.Message); } } private RoomVolume GetExtractionRoom() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cachedExtractionRoom != (Object)null && (Object)(object)((Component)cachedExtractionRoom).gameObject != (Object)null && ((Component)cachedExtractionRoom).gameObject.activeInHierarchy && cachedExtractionRoom.Extraction) { return cachedExtractionRoom; } cachedExtractionRoom = null; cachedExtractionBounds = new Bounds(Vector3.zero, Vector3.zero); RoomVolume[] array = Object.FindObjectsOfType(true); int num = 0; RoomVolume val = null; foreach (RoomVolume val2 in array) { if (!((Object)(object)val2 == (Object)null) && val2.Extraction) { num++; if ((Object)(object)val == (Object)null) { val = val2; } } } if ((Object)(object)val == (Object)null) { return null; } if (num > 1) { WriteDebugLog("Multiple extraction RoomVolumes found. Using first one. Count=" + num); } cachedExtractionRoom = val; cachedExtractionBounds = GetRoomVolumeBounds(val); return cachedExtractionRoom; } private Bounds GetRoomVolumeBounds(RoomVolume roomVolume) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = default(Bounds); ((Bounds)(ref bounds))..ctor(((Component)roomVolume).transform.position, Vector3.one); bool flag = false; Collider[] componentsInChildren = ((Component)roomVolume).GetComponentsInChildren(true); foreach (Collider val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && val.enabled) { if (!flag) { bounds = val.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val.bounds); } } } return bounds; } private Vector3 GetDeliveryPosition() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00b2: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0121: Unknown result type (might be due to invalid IL or missing references) Bounds val = cachedExtractionBounds; if (((Bounds)(ref val)).size == Vector3.zero) { val = (cachedExtractionBounds = GetRoomVolumeBounds(cachedExtractionRoom)); } Vector3 center = ((Bounds)(ref val)).center; float num = ((Bounds)(ref val)).min.y + 0.05f; float num2 = ((Bounds)(ref val)).max.y - 0.05f; center.y = Mathf.Clamp(center.y + configDropHeightOffset.Value, num, num2); Vector2 spreadOffset = GetSpreadOffset(Mathf.Max(0f, configDropSpreadRadius.Value)); center.x = Mathf.Clamp(center.x + spreadOffset.x, ((Bounds)(ref val)).min.x + 0.05f, ((Bounds)(ref val)).max.x - 0.05f); center.z = Mathf.Clamp(center.z + spreadOffset.y, ((Bounds)(ref val)).min.z + 0.05f, ((Bounds)(ref val)).max.z - 0.05f); return center; } private Vector3 GetOutsideDeliveryPosition(PhysGrabObject physGrabObject) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) Bounds extractionBounds = cachedExtractionBounds; if (((Bounds)(ref extractionBounds)).size == Vector3.zero) { extractionBounds = (cachedExtractionBounds = GetRoomVolumeBounds(cachedExtractionRoom)); } Vector3 outsideDirection = GetOutsideDirection(extractionBounds); float num = Mathf.Abs(outsideDirection.x); float num2 = Mathf.Abs(outsideDirection.z); float num3 = ((num > 0.001f) ? (((Bounds)(ref extractionBounds)).extents.x / num) : float.PositiveInfinity); float num4 = ((num2 > 0.001f) ? (((Bounds)(ref extractionBounds)).extents.z / num2) : float.PositiveInfinity); float num5 = Mathf.Min(num3, num4); if (float.IsInfinity(num5) || float.IsNaN(num5) || num5 <= 0f) { num5 = Mathf.Max(((Bounds)(ref extractionBounds)).extents.x, ((Bounds)(ref extractionBounds)).extents.z); } float num6 = Mathf.Clamp(configOutsideDistance.Value, 0.2f, 5f); Vector3 val = ((Bounds)(ref extractionBounds)).center + outsideDirection * (num5 + num6); float num7 = Mathf.Clamp(configOutsideHeightOffset.Value, 0f, 2f); val.y = ((Bounds)(ref extractionBounds)).min.y + num7; if ((Object)(object)physGrabObject != (Object)null) { val.y = Mathf.Max(val.y, ((Component)physGrabObject).transform.position.y - 0.25f); } Vector2 spreadOffset = GetSpreadOffset(Mathf.Max(0f, configDropSpreadRadius.Value)); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0f - outsideDirection.z, 0f, outsideDirection.x); val += val2 * spreadOffset.x; return val + outsideDirection * Mathf.Max(0f, spreadOffset.y); } private Vector3 GetOutsideDirection(Bounds extractionBounds) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; PhysGrabber instance = PhysGrabber.instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.playerAvatar != (Object)null) { val = ((Component)instance.playerAvatar).transform.position - ((Bounds)(ref extractionBounds)).center; } val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.0001f && (Object)(object)Camera.main != (Object)null) { val = ((Component)Camera.main).transform.forward; val.y = 0f; } if (((Vector3)(ref val)).sqrMagnitude < 0.0001f && (Object)(object)cachedExtractionRoom != (Object)null) { val = ((Component)cachedExtractionRoom).transform.forward; val.y = 0f; } if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = Vector3.forward; } return ((Vector3)(ref val)).normalized; } private Vector2 GetSpreadOffset(float radius) { //IL_0064: 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) //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_006d: Unknown result type (might be due to invalid IL or missing references) if (radius <= 0f) { return Vector2.zero; } spreadIndex++; float num = (float)spreadIndex * 137.50777f * (MathF.PI / 180f); float num2 = (float)((spreadIndex - 1) % 5 + 1) / 5f; float num3 = radius * num2; return new Vector2(Mathf.Cos(num) * num3, Mathf.Sin(num) * num3); } private void UpdateMessageTimer() { if (messageTimer > 0f) { messageTimer -= Time.deltaTime; if (messageTimer <= 0f) { messageText = string.Empty; } } } private void ShowLocalMessage(string text) { if (configShowMessage.Value) { messageText = text; messageTimer = Mathf.Max(0.1f, configMessageSeconds.Value); } } private void WriteDebugLog(string message) { if ((configDebugLog == null || configDebugLog.Value) && logSource != null) { logSource.LogInfo((object)("[QuickShopDelivery] " + message)); } } } }