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 PocketPlayers v1.0.0
PocketPlayers.dll
Decompiled 7 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+bc3c02b4204f5eb622b052bba30cbea236f03a6e")] [assembly: AssemblyProduct("PocketPlayers")] [assembly: AssemblyTitle("PocketPlayers")] [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; } } } [BepInPlugin("empress.repo.pocketplayers", "Empress Pocket Players", "1.8.1")] public class EmpressPocketPlayers : BaseUnityPlugin { public const string GUID = "empress.repo.pocketplayers"; public const string NAME = "Empress Pocket Players"; public const string VERSION = "1.8.1"; internal static ManualLogSource LogS; private Harmony _harmony; private readonly HashSet<int> _rpcAttached = new HashSet<int>(); private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown LogS = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("empress.repo.pocketplayers"); _harmony.PatchAll(typeof(EmpressPocketPlayers)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Empress Pocket Players 1.8.1 booting."); PocketAssets.TryLoadBundle(); SceneManager.sceneLoaded += OnSceneLoaded; ((MonoBehaviour)this).InvokeRepeating("SweepAvatars", 2f, 2f); } private void OnDestroy() { try { SceneManager.sceneLoaded -= OnSceneLoaded; } catch { } try { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } catch { } } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { PocketRoom.EnsureBuilt(); } private void SweepAvatars() { PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); foreach (PlayerAvatar val in array) { if (!Object.op_Implicit((Object)(object)val)) { continue; } int instanceID = ((Object)val).GetInstanceID(); if (!_rpcAttached.Contains(instanceID)) { if ((Object)(object)((Component)val).GetComponent<PocketRPC>() == (Object)null) { ((Component)val).gameObject.AddComponent<PocketRPC>(); } _rpcAttached.Add(instanceID); ManualLogSource logS = LogS; string name = ((Object)val).name; PhotonView photonView = val.photonView; logS.LogDebug((object)$"[sweep] PocketRPC attached to {name} pv={((photonView != null) ? new int?(photonView.ViewID) : null)}"); } if ((Object)(object)val.photonView != (Object)null && val.photonView.IsMine && (Object)(object)((Component)val).GetComponent<PocketManager>() == (Object)null) { ((Component)val).gameObject.AddComponent<PocketManager>(); LogS.LogInfo((object)"[sweep] PocketManager attached to local avatar."); } } } [HarmonyPatch(typeof(PlayerAvatar), "Start")] [HarmonyPostfix] private static void PlayerAvatar_Start_Postfix(PlayerAvatar __instance) { try { if (Object.op_Implicit((Object)(object)__instance)) { PocketRoom.EnsureBuilt(); if ((Object)(object)((Component)__instance).GetComponent<PocketRPC>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<PocketRPC>(); ManualLogSource logS = LogS; string name = ((Object)__instance).name; PhotonView photonView = __instance.photonView; logS.LogDebug((object)$"[patch] PocketRPC attached to {name} pv={((photonView != null) ? new int?(photonView.ViewID) : null)}"); } if ((Object)(object)__instance.photonView != (Object)null && __instance.photonView.IsMine && (Object)(object)((Component)__instance).GetComponent<PocketManager>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<PocketManager>(); LogS.LogInfo((object)"[patch] PocketManager attached to local avatar."); } } } catch (Exception ex) { LogS.LogError((object)("PlayerAvatar_Start_Postfix error: " + ex)); } } } public class PocketRPC : MonoBehaviourPunCallbacks { [CompilerGenerated] private sealed class <ReassertSpawn>d__5 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerAvatar target; public Vector3 pos; public Quaternion rot; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ReassertSpawn>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0053: 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_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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.08f); <>1__state = 1; return true; case 1: <>1__state = -1; try { target.Spawn(pos, rot); } catch { } <>2__current = (object)new WaitForSeconds(0.18f); <>1__state = 2; return true; case 2: <>1__state = -1; try { target.Spawn(pos, rot); } catch { } 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 PlayerAvatar _avatar; private void Awake() { _avatar = ((Component)this).GetComponent<PlayerAvatar>(); } [PunRPC] public void Empress_MasterEnterPocket(int slotIndex, Vector3 roomPos, Quaternion roomRot, Vector3 savedPos, Quaternion savedRot, int captorViewId, PhotonMessageInfo _info) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsMasterClient || (Object)(object)_avatar == (Object)null) { return; } try { _avatar.Spawn(roomPos, roomRot); if (Object.op_Implicit((Object)(object)_avatar.rb)) { _avatar.rb.velocity = Vector3.zero; _avatar.rb.angularVelocity = Vector3.zero; } ((MonoBehaviour)this).StartCoroutine(ReassertSpawn(_avatar, roomPos, roomRot)); } catch (Exception arg) { EmpressPocketPlayers.LogS.LogError((object)$"[MASTER] EnterPocket failed: {arg}"); } } [PunRPC] public void Empress_MasterExitPocket(int slotIndex, Vector3 returnPos, Quaternion returnRot, int captorViewId, PhotonMessageInfo _info) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsMasterClient || (Object)(object)_avatar == (Object)null) { return; } try { _avatar.Spawn(returnPos, returnRot); if (Object.op_Implicit((Object)(object)_avatar.rb)) { _avatar.rb.velocity = Vector3.zero; _avatar.rb.angularVelocity = Vector3.zero; } } catch (Exception arg) { EmpressPocketPlayers.LogS.LogError((object)$"[MASTER] ExitPocket failed: {arg}"); } } [PunRPC] public void Empress_MasterExitToPos(Vector3 worldPos, Quaternion worldRot, int captorViewId, PhotonMessageInfo _info) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsMasterClient || (Object)(object)_avatar == (Object)null) { return; } try { _avatar.Spawn(worldPos, worldRot); if (Object.op_Implicit((Object)(object)_avatar.rb)) { _avatar.rb.velocity = Vector3.zero; _avatar.rb.angularVelocity = Vector3.zero; } } catch (Exception arg) { EmpressPocketPlayers.LogS.LogError((object)$"[MASTER] ExitToPos failed: {arg}"); } } [IteratorStateMachine(typeof(<ReassertSpawn>d__5))] private static IEnumerator ReassertSpawn(PlayerAvatar target, Vector3 pos, Quaternion rot) { //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) //IL_0015: 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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ReassertSpawn>d__5(0) { target = target, pos = pos, rot = rot }; } [PunRPC] public void Empress_SpawnOrb(Vector3 origin, Vector3 dir, float speed, float lifetime, PhotonMessageInfo _info) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_0127: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)val).name = "[Empress] CaptureOrb"; val.transform.position = origin + dir * 0.6f; val.transform.localScale = Vector3.one * 0.25f; Rigidbody val2 = val.AddComponent<Rigidbody>(); val2.useGravity = true; val2.collisionDetectionMode = (CollisionDetectionMode)2; val2.mass = 0.2f; try { val.GetComponent<Renderer>().material.color = Color.red; } catch { } Collider val3 = default(Collider); if (val.TryGetComponent<Collider>(ref val3)) { Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>(); foreach (Collider val4 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val4)) { Physics.IgnoreCollision(val3, val4, true); } } } CaptureOrb captureOrb = val.AddComponent<CaptureOrb>(); bool flag = _info.Sender == PhotonNetwork.LocalPlayer; captureOrb.owner = (flag ? ((Component)this).GetComponent<PocketManager>() : null); captureOrb.throwDir = dir; captureOrb.lifetime = lifetime; captureOrb.speed = speed; captureOrb.visualOnly = !flag; val2.AddForce(dir * speed, (ForceMode)2); } catch (Exception arg) { EmpressPocketPlayers.LogS.LogWarning((object)$"[orb] Spawn failed: {arg}"); } } } public class PocketManager : MonoBehaviour { private struct Slot { public int TargetViewId; public Vector3 ReturnPos; public Quaternion ReturnRot; public bool Occupied => TargetViewId != 0; public void Clear() { TargetViewId = 0; } } private class SlotUI { public Image Icon; public Text Label; } private PlayerAvatar _self; private Transform _rayOrigin; private readonly Slot[] _slots = new Slot[3]; private Canvas _canvas; private SlotUI[] _slotUi = new SlotUI[3]; private Text _status; private void Start() { _self = ((Component)this).GetComponent<PlayerAvatar>(); if ((Object)(object)_self == (Object)null || (Object)(object)_self.photonView == (Object)null || !_self.photonView.IsMine) { ((Behaviour)this).enabled = false; return; } PocketRoom.EnsureBuilt(); PlayerVisionTarget component = ((Component)this).GetComponent<PlayerVisionTarget>(); _rayOrigin = (Object.op_Implicit((Object)(object)component) ? component.VisionTransform : (Object.op_Implicit((Object)(object)Camera.main) ? ((Component)Camera.main).transform : ((Component)_self).transform)); BuildUi(); EmpressPocketPlayers.LogS.LogInfo((object)"PocketManager ready. X = throw capture orb. 1/2/3 eject slots."); } private void Update() { if (Input.GetKeyDown((KeyCode)120)) { ThrowCaptureOrb(); } if ((Object)(object)InputManager.instance != (Object)null) { HandleEjectKey(0, (InputKey)19); HandleEjectKey(1, (InputKey)20); HandleEjectKey(2, (InputKey)21); } UpdateUi(); } private void HandleEjectKey(int slotIndex, InputKey key) { //IL_0006: 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_00b4: Unknown result type (might be due to invalid IL or missing references) if (!InputManager.instance.KeyDown(key)) { return; } ref Slot reference = ref _slots[slotIndex]; if (!reference.Occupied) { Status($"[{slotIndex + 1}] empty"); return; } PhotonView val = PhotonView.Find(reference.TargetViewId); if ((Object)(object)val == (Object)null) { Status($"[{slotIndex + 1}] target lost"); reference.Clear(); return; } val.RPC("Empress_MasterExitPocket", (RpcTarget)2, new object[4] { slotIndex, reference.ReturnPos, reference.ReturnRot, _self.photonView.ViewID }); Status($"[{slotIndex + 1}] ejected"); reference.Clear(); } private void ThrowCaptureOrb() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_008d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (Object.op_Implicit((Object)(object)_rayOrigin) ? _rayOrigin.position : (((Component)_self).transform.position + Vector3.up * 1.4f)); Vector3 val2 = (Object.op_Implicit((Object)(object)_rayOrigin) ? _rayOrigin.forward : ((Component)_self).transform.forward); _self.photonView.RPC("Empress_SpawnOrb", (RpcTarget)0, new object[4] { val, val2, 18f, 8f }); } internal void CaptureTarget(PlayerAvatar target) { //IL_0086: 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_0095: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) int num = -1; for (int i = 0; i < 3; i++) { if (!_slots[i].Occupied) { num = i; break; } } if (num < 0) { Status("all pockets full"); return; } PhotonView photonView = target.photonView; if ((Object)(object)photonView == (Object)null) { Status("target has no PhotonView"); return; } bool usedFallback; Transform point = PocketRoom.GetPoint(num, out usedFallback); Vector3 val = point.position + Vector3.up * 0.05f; Quaternion rotation = ((Component)target).transform.rotation; _slots[num].TargetViewId = photonView.ViewID; _slots[num].ReturnPos = ((Component)target).transform.position; _slots[num].ReturnRot = ((Component)target).transform.rotation; photonView.RPC("Empress_MasterEnterPocket", (RpcTarget)2, new object[6] { num, val, rotation, _slots[num].ReturnPos, _slots[num].ReturnRot, _self.photonView.ViewID }); object arg = num + 1; Player owner = photonView.Owner; Status(string.Format("[{0}] pocketed {1}{2}", arg, ((owner != null) ? owner.NickName : null) ?? $"#{photonView.ViewID}", usedFallback ? " (fallback root)" : "")); } internal bool TryEjectFirstTo(Vector3 atPosition, Vector3 lookForwardHint) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) int num = -1; for (int i = 0; i < 3; i++) { if (_slots[i].Occupied) { num = i; break; } } if (num < 0) { Status("no one to eject"); return false; } ref Slot reference = ref _slots[num]; PhotonView val = PhotonView.Find(reference.TargetViewId); if ((Object)(object)val == (Object)null) { Status("target lost"); reference.Clear(); return false; } Vector3 forward = default(Vector3); ((Vector3)(ref forward))..ctor(lookForwardHint.x, 0f, lookForwardHint.z); if (((Vector3)(ref forward)).sqrMagnitude < 0.001f) { ((Vector3)(ref forward))..ctor(((Component)_self).transform.forward.x, 0f, ((Component)_self).transform.forward.z); } if (((Vector3)(ref forward)).sqrMagnitude < 0.001f) { forward = Vector3.forward; } Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref forward)).normalized, Vector3.up); val.RPC("Empress_MasterExitToPos", (RpcTarget)2, new object[3] { atPosition, val2, _self.photonView.ViewID }); Status($"[{num + 1}] ejected to orb"); reference.Clear(); return true; } private void BuildUi() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_003f: 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_0078: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("[Empress] Pocket UI"); Object.DontDestroyOnLoad((Object)(object)val); _canvas = val.AddComponent<Canvas>(); _canvas.renderMode = (RenderMode)0; val.AddComponent<CanvasScaler>(); val.AddComponent<GraphicRaycaster>(); RectTransform val2 = new GameObject("Root").AddComponent<RectTransform>(); ((Component)val2).transform.SetParent(val.transform, false); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 0f); val2.anchorMax = val3; val2.anchorMin = val3; val2.pivot = new Vector2(0.5f, 0f); val2.anchoredPosition = new Vector2(0f, 40f); val2.sizeDelta = new Vector2(360f, 96f); for (int i = 0; i < 3; i++) { RectTransform val4 = new GameObject($"Slot{i + 1}").AddComponent<RectTransform>(); ((Component)val4).transform.SetParent((Transform)(object)val2, false); val4.sizeDelta = new Vector2(100f, 80f); val4.anchoredPosition = new Vector2((float)((i - 1) * 120), 0f); Image val5 = new GameObject("Icon").AddComponent<Image>(); ((Component)val5).transform.SetParent((Transform)(object)val4, false); RectTransform component = ((Component)val5).GetComponent<RectTransform>(); component.sizeDelta = new Vector2(64f, 64f); component.anchoredPosition = new Vector2(0f, 16f); val5.sprite = Sprite.Create(MakeNoiseTex(64, 64), new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 64f); Text val6 = new GameObject("Label").AddComponent<Text>(); ((Component)val6).transform.SetParent((Transform)(object)val4, false); RectTransform component2 = ((Component)val6).GetComponent<RectTransform>(); component2.sizeDelta = new Vector2(120f, 20f); component2.anchoredPosition = new Vector2(0f, -28f); val6.alignment = (TextAnchor)4; val6.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); val6.fontSize = 14; val6.text = $"[{i + 1}] empty"; ((Graphic)val6).color = Color.white; _slotUi[i] = new SlotUI { Icon = val5, Label = val6 }; } Text val7 = new GameObject("Status").AddComponent<Text>(); ((Component)val7).transform.SetParent((Transform)(object)val2, false); RectTransform component3 = ((Component)val7).GetComponent<RectTransform>(); component3.sizeDelta = new Vector2(360f, 18f); component3.anchoredPosition = new Vector2(0f, 56f); val7.alignment = (TextAnchor)4; val7.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); val7.fontSize = 12; ((Graphic)val7).color = new Color(1f, 1f, 1f, 0.85f); _status = val7; } private void Status(string s) { if (Object.op_Implicit((Object)(object)_status)) { _status.text = s; } EmpressPocketPlayers.LogS.LogInfo((object)s); } private void UpdateUi() { for (int i = 0; i < 3; i++) { SlotUI slotUI = _slotUi[i]; if (slotUI != null) { if (_slots[i].Occupied) { PhotonView val = PhotonView.Find(_slots[i].TargetViewId); string arg = ((!((Object)(object)val != (Object)null)) ? "unknown" : ((val.Owner != null) ? val.Owner.NickName : $"#{val.ViewID}")); slotUI.Label.text = $"[{i + 1}] {arg}"; } else { slotUI.Label.text = $"[{i + 1}] empty"; } } } } private static Texture2D MakeNoiseTex(int w, int h) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); Random random = new Random(Random.Range(0, int.MaxValue)); Color32[] array = (Color32[])(object)new Color32[w * h]; for (int i = 0; i < array.Length; i++) { array[i] = new Color32((byte)random.Next(32, 200), (byte)random.Next(32, 200), (byte)random.Next(32, 200), byte.MaxValue); } val.SetPixels32(array); val.Apply(false, true); return val; } } public class CaptureOrb : MonoBehaviour { [CompilerGenerated] private sealed class <Tilt>d__12 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float deltaAngle; public float t; public CaptureOrb <>4__this; private Quaternion <start>5__1; private Quaternion <end>5__2; private float <e>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Tilt>d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00ad: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <start>5__1 = ((Component)<>4__this).transform.rotation; <end>5__2 = <start>5__1 * Quaternion.Euler(deltaAngle, 0f, 0f); <e>5__3 = 0f; break; case 1: <>1__state = -1; break; } if (<e>5__3 < 1f) { <e>5__3 += Time.deltaTime / Mathf.Max(0.01f, t); ((Component)<>4__this).transform.rotation = Quaternion.Slerp(<start>5__1, <end>5__2, <e>5__3); <>2__current = null; <>1__state = 1; return true; } 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 <WiggleOnGround>d__11 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Vector3 groundPoint; public bool playAudio; public CaptureOrb <>4__this; private int <wiggles>5__1; private float <angle>5__2; private float <dur>5__3; private int <i>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WiggleOnGround>d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Expected O, but got Unknown //IL_01ea: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (Object.op_Implicit((Object)(object)<>4__this._rb)) { <>4__this._rb.isKinematic = true; <>4__this._rb.detectCollisions = false; } ((Component)<>4__this).transform.position = groundPoint + Vector3.up * 0.12f; <wiggles>5__1 = 3; <angle>5__2 = 18f; <dur>5__3 = 0.22f; <i>5__4 = 0; goto IL_01c6; case 1: <>1__state = -1; <>2__current = <>4__this.Tilt((0f - <angle>5__2) * 2f, <dur>5__3); <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = <>4__this.Tilt(<angle>5__2, <dur>5__3 * 0.5f); <>1__state = 3; return true; case 3: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.15f); <>1__state = 4; return true; case 4: <>1__state = -1; <i>5__4++; goto IL_01c6; case 5: { <>1__state = -1; Object.Destroy((Object)(object)((Component)<>4__this).gameObject); return false; } IL_01c6: if (<i>5__4 < <wiggles>5__1) { if (playAudio) { PocketAssets.PlayClipAt(groundPoint, PocketAssets.WiggleSfx); } <>2__current = <>4__this.Tilt(<angle>5__2, <dur>5__3 * 0.5f); <>1__state = 1; return true; } if (playAudio) { PocketAssets.PlayClipAt(groundPoint, PocketAssets.CatchSfx); } <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 5; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public PocketManager owner; public bool visualOnly = false; public float lifetime = 8f; public float speed = 18f; public Vector3 throwDir; private Rigidbody _rb; private bool _capturedSomeone = false; private bool _wiggling = false; private void Awake() { _rb = ((Component)this).GetComponent<Rigidbody>(); } private void Update() { lifetime -= Time.deltaTime; if (lifetime <= 0f) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void OnCollisionEnter(Collision collision) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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) if (!Object.op_Implicit((Object)(object)_rb)) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } ContactPoint contact; if (visualOnly) { if (!_wiggling) { _wiggling = true; contact = collision.GetContact(0); Vector3 point = ((ContactPoint)(ref contact)).point; ((MonoBehaviour)this).StartCoroutine(WiggleOnGround(point, playAudio: false)); } return; } if (!Object.op_Implicit((Object)(object)owner)) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } PlayerAvatar componentInParent = ((Component)collision.collider).GetComponentInParent<PlayerAvatar>(); if (!_capturedSomeone && Object.op_Implicit((Object)(object)componentInParent) && (Object)(object)componentInParent != (Object)(object)((Component)owner).GetComponent<PlayerAvatar>()) { _capturedSomeone = true; owner.CaptureTarget(componentInParent); return; } if (_capturedSomeone && !_wiggling) { _wiggling = true; contact = collision.GetContact(0); Vector3 point2 = ((ContactPoint)(ref contact)).point; ((MonoBehaviour)this).StartCoroutine(WiggleOnGround(point2, playAudio: true)); return; } if (_capturedSomeone) { return; } contact = collision.GetContact(0); Vector3 atPosition = ((ContactPoint)(ref contact)).point + Vector3.up * 1.1f; Vector3 velocity2; if (Object.op_Implicit((Object)(object)_rb)) { Vector3 velocity = _rb.velocity; if (((Vector3)(ref velocity)).sqrMagnitude > 0.01f) { velocity2 = _rb.velocity; goto IL_01a0; } } velocity2 = throwDir; goto IL_01a0; IL_01a0: Vector3 lookForwardHint = velocity2; owner.TryEjectFirstTo(atPosition, lookForwardHint); Object.Destroy((Object)(object)((Component)this).gameObject); } [IteratorStateMachine(typeof(<WiggleOnGround>d__11))] private IEnumerator WiggleOnGround(Vector3 groundPoint, bool playAudio) { //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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WiggleOnGround>d__11(0) { <>4__this = this, groundPoint = groundPoint, playAudio = playAudio }; } [IteratorStateMachine(typeof(<Tilt>d__12))] private IEnumerator Tilt(float deltaAngle, float t) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Tilt>d__12(0) { <>4__this = this, deltaAngle = deltaAngle, t = t }; } } internal static class PocketRoom { private static bool _built; private static readonly Transform[] _roomRoots = (Transform[])(object)new Transform[3]; private static readonly Transform[] _pointTargets = (Transform[])(object)new Transform[3]; private static readonly Vector3 Base = new Vector3(200f, 200f, 200f); private static readonly float Spacing = 60f; public static void EnsureBuilt() { if (!_built) { Build(); } } public static Transform GetPoint(int slot, out bool usedFallback) { EnsureBuilt(); slot = Mathf.Clamp(slot, 0, 2); Transform result = (((Object)(object)_pointTargets[slot] != (Object)null) ? _pointTargets[slot] : _roomRoots[slot]); usedFallback = (Object)(object)_pointTargets[slot] == (Object)null; return result; } private static void Build() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) if (_built) { return; } Transform transform = new GameObject("[Empress] PocketRooms").transform; Object.DontDestroyOnLoad((Object)(object)((Component)transform).gameObject); for (int i = 0; i < 3; i++) { Transform transform2 = new GameObject($"PocketRoom_{i}").transform; transform2.SetParent(transform); transform2.position = Base + new Vector3((float)i * Spacing, 0f, 0f); _roomRoots[i] = transform2; if ((Object)(object)PocketAssets.JailPrefab != (Object)null) { GameObject val = Object.Instantiate<GameObject>(PocketAssets.JailPrefab); ((Object)val).name = "jailroom"; val.transform.position = transform2.position; val.transform.rotation = Quaternion.identity; Object.DontDestroyOnLoad((Object)(object)val); Transform val2 = FindDeepChild(val.transform, "point1"); if ((Object)(object)val2 == (Object)null) { GameObject val3 = new GameObject("point1"); val3.transform.SetParent(val.transform, false); val3.transform.localPosition = new Vector3(0f, 1.5f, 0f); val3.transform.localRotation = Quaternion.identity; val2 = val3.transform; } _pointTargets[i] = val2; ManualLogSource logS = EmpressPocketPlayers.LogS; object arg = i + 1; object arg2 = val2.position; Quaternion rotation = val2.rotation; logS.LogInfo((object)$"[jail] slot {arg} target @ {arg2:F2} rot {((Quaternion)(ref rotation)).eulerAngles:F1}"); } else { _pointTargets[i] = null; EmpressPocketPlayers.LogS.LogWarning((object)$"[jail] slot {i + 1} has no prefab; using root as point."); } } EmpressPocketPlayers.LogS.LogInfo((object)$"Pocket rooms built. Prefab={(Object)(object)PocketAssets.JailPrefab != (Object)null} (no safety pad, no collider overrides)."); _built = true; } private static Transform FindDeepChild(Transform aParent, string nameLower) { if ((Object)(object)aParent == (Object)null) { return null; } nameLower = nameLower.ToLowerInvariant(); Stack<Transform> stack = new Stack<Transform>(); stack.Push(aParent); while (stack.Count > 0) { Transform val = stack.Pop(); if (((Object)val).name.ToLowerInvariant() == nameLower) { return val; } for (int i = 0; i < val.childCount; i++) { stack.Push(val.GetChild(i)); } } return null; } } internal static class PocketAssets { private static AssetBundle _bundle; public static AudioClip WiggleSfx { get; private set; } public static AudioClip CatchSfx { get; private set; } public static GameObject JailPrefab { get; private set; } public static void TryLoadBundle() { try { if ((Object)(object)_bundle != (Object)null) { return; } string directoryName = Path.GetDirectoryName(typeof(EmpressPocketPlayers).Assembly.Location); string text = Path.Combine(directoryName ?? "", "catchem"); if (!File.Exists(text)) { string text2 = text + ".bundle"; string text3 = text + ".assets"; if (File.Exists(text2)) { text = text2; } else if (File.Exists(text3)) { text = text3; } } _bundle = (File.Exists(text) ? AssetBundle.LoadFromFile(text) : null); if ((Object)(object)_bundle == (Object)null) { EmpressPocketPlayers.LogS.LogWarning((object)"[Assets] catchem bundle not found — SFX + jailroom disabled."); return; } WiggleSfx = SafeLoad<AudioClip>("wiggle"); CatchSfx = SafeLoad<AudioClip>("catch") ?? SafeLoad<AudioClip>("catch.oggg"); JailPrefab = SafeLoad<GameObject>("jailroom"); EmpressPocketPlayers.LogS.LogInfo((object)$"[Assets] Loaded: wiggle={(Object)(object)WiggleSfx != (Object)null} catch={(Object)(object)CatchSfx != (Object)null} jailroom={(Object)(object)JailPrefab != (Object)null}"); } catch (Exception ex) { EmpressPocketPlayers.LogS.LogWarning((object)("[Assets] Failed to load bundle: " + ex.Message)); } } private static T SafeLoad<T>(string name) where T : Object { try { return Object.op_Implicit((Object)(object)_bundle) ? _bundle.LoadAsset<T>(name) : default(T); } catch { return default(T); } } public static void PlayClipAt(Vector3 pos, AudioClip clip, float volume = 0.4f) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)clip == (Object)null)) { GameObject val = new GameObject("[Empress] OneShotSFX"); val.transform.position = pos; AudioSource val2 = val.AddComponent<AudioSource>(); val2.spatialBlend = 1f; val2.rolloffMode = (AudioRolloffMode)1; val2.minDistance = 2f; val2.maxDistance = 30f; val2.playOnAwake = false; val2.clip = clip; val2.volume = volume; val2.dopplerLevel = 0f; val2.Play(); Object.Destroy((Object)(object)val, clip.length + 0.1f); } } } namespace PocketPlayers { [BepInPlugin("Omniscye.PocketPlayers", "PocketPlayers", "1.0")] public class PocketPlayers : BaseUnityPlugin { internal static PocketPlayers Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); 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() { } } }