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 EnderPearl v4.0.0
EnderPearl.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using REPOLib.Modules; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("REPOJP")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("4.0.0.0")] [assembly: AssemblyInformationalVersion("4.0.0")] [assembly: AssemblyProduct("EnderPearl")] [assembly: AssemblyTitle("EnderPearl")] [assembly: AssemblyVersion("4.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace REPOJP.EnderPearl { public static class PearlCountLabel { private static readonly string[] Digits = new string[10] { "111101101101111", "010110010010111", "111001111100111", "111001111001111", "101101111001001", "111100111001111", "111100111101111", "111001010010010", "111101111101111", "111101111001111" }; public static string Name(int count) { return "Ender Pearls (" + Math.Max(0, Math.Min(16, count)) + ")"; } public static byte[] Mask(int count) { byte[] array = new byte[1024]; string text = Math.Max(0, Math.Min(16, count)).ToString(CultureInfo.InvariantCulture); int num = 31 - (text.Length * 8 - 2); for (int i = 0; i < 2; i++) { for (int j = 0; j < text.Length; j++) { for (int k = 0; k < 5; k++) { for (int l = 0; l < 3; l++) { if (Digits[text[j] - 48][k * 3 + l] != '1') { continue; } for (int m = 0; m < 2; m++) { for (int n = 0; n < 2; n++) { int num2 = num + j * 8 + l * 2 + n + ((i == 0) ? 1 : 0); int num3 = 2 + (4 - k) * 2 + m - ((i == 0) ? 1 : 0); array[num3 * 32 + num2] = (byte)(i + 1); } } } } } } return array; } } public sealed class PearlFlightRender { private readonly List<(double Time, DVec Position)> samples = new List<(double, DVec)>(); private double delay = 0.125; private double lastPacket = double.NaN; private double lastRenderTime = double.NegativeInfinity; public static DVec Between(DVec from, DVec to, double fraction) { double num = Math.Max(0.0, Math.Min(1.0, fraction)); return from * (1.0 - num) + to * num; } public void Seed(DVec position, double time) { samples.Clear(); samples.Add((time, position)); delay = 0.125; lastPacket = double.NaN; lastRenderTime = double.NegativeInfinity; } public bool Push(DVec position, double sampleTime, double sentTime, double receivedTime) { if (!position.Finite || double.IsNaN(sampleTime) || double.IsInfinity(sampleTime) || double.IsNaN(sentTime) || double.IsInfinity(sentTime) || double.IsNaN(receivedTime) || double.IsInfinity(receivedTime)) { return false; } if (!double.IsNaN(lastPacket) && sentTime <= lastPacket) { return false; } double num = (double.IsNaN(lastPacket) ? 0.1 : Math.Max(0.05, Math.Min(0.3, sentTime - lastPacket))); double num2 = Math.Max(0.0, receivedTime - sentTime) + num + 0.025; delay = (double.IsNaN(lastPacket) ? num2 : Math.Max(num2, delay * 0.9 + num2 * 0.1)); lastPacket = sentTime; if (samples.Count > 0 && sampleTime <= samples[samples.Count - 1].Time) { if (samples.Count != 1 || lastRenderTime > sampleTime) { return false; } samples.Clear(); } samples.Add((sampleTime, position)); if (samples.Count > 32) { samples.RemoveAt(0); } return true; } public DVec Sample(double now) { if (samples.Count == 0) { return default(DVec); } double val = Math.Max(lastRenderTime, now - delay); val = (lastRenderTime = Math.Min(val, samples[samples.Count - 1].Time)); while (samples.Count > 2 && samples[1].Time <= val) { samples.RemoveAt(0); } if (samples.Count == 1 || val <= samples[0].Time) { return samples[0].Position; } (double, DVec) tuple = samples[0]; (double, DVec) tuple2 = samples[1]; return Between(tuple.Item2, tuple2.Item2, (val - tuple.Item1) / (tuple2.Item1 - tuple.Item1)); } } public sealed class PearlModelData { public const int Segments = 96; public const int Rings = 48; public const int TextureWidth = 128; public const int TextureHeight = 64; public const float Metallic = 0.32f; public const float Smoothness = 0.62f; public const float Emission = 0.055f; public readonly float[] Positions; public readonly float[] Normals; public readonly float[] UV; public readonly int[] Triangles; public readonly byte[] Pixels; private PearlModelData(float[] positions, float[] normals, float[] uv, int[] triangles, byte[] pixels) { Positions = positions; Normals = normals; UV = uv; Triangles = triangles; Pixels = pixels; } public static PearlModelData Create() { float[] array = new float[4753 * 3]; float[] array2 = new float[4753 * 3]; float[] array3 = new float[4753 * 2]; int[] array4 = new int[27072]; int num = 0; for (int i = 0; i <= 48; i++) { for (int j = 0; j <= 96; j++) { int num2 = i * 97 + j; double num3 = Math.PI * (double)i / 48.0; double num4 = Math.PI * 2.0 * (double)(j % 96) / 96.0; double num5 = ((i == 0 || i == 48) ? 0.0 : Math.Sin(num3)); array2[num2 * 3] = (float)(num5 * Math.Sin(num4)); array2[num2 * 3 + 1] = (float)Math.Cos(num3); array2[num2 * 3 + 2] = (float)((0.0 - num5) * Math.Cos(num4)); for (int k = 0; k < 3; k++) { array[num2 * 3 + k] = array2[num2 * 3 + k] * 0.5f; } array3[num2 * 2] = (float)j / 96f; array3[num2 * 2 + 1] = 1f - (float)i / 48f; if (i != 48 && j != 96) { int num6 = num2 + 96 + 1; if (i > 0) { array4[num++] = num2; array4[num++] = num2 + 1; array4[num++] = num6; } if (i < 47) { array4[num++] = num2 + 1; array4[num++] = num6 + 1; array4[num++] = num6; } } } } int[] array5 = new int[8] { 601138, 1064771, 1464401, 2126437, 2985597, 4434582, 6866608, 10410956 }; byte[] array6 = new byte[32768]; for (int l = 0; l < 64; l++) { for (int m = 0; m < 128; m++) { double num7 = Math.PI * (1.0 - ((double)l + 0.5) / 64.0); double num8 = Math.PI * 2.0 * ((double)m + 0.5) / 128.0; double num9 = Math.Cos(num7); double num10 = Math.Sin(num7); double num11 = Math.Cos(2.0 * num8 + 3.4 * num9 + 0.5 * Math.Sin(5.0 * num9)); double num12 = 0.4 + 0.17 * num9 + 0.25 * num11 * num10; double num13 = Math.Exp(0.0 - Math.Pow((num9 - 0.4 - 0.22 * Math.Sin(2.0 * num8)) / 0.14, 2.0)); num12 += 0.26 * num13 * num10; int num14 = Math.Max(0, Math.Min(array5.Length - 1, (int)Math.Round(num12 * (double)(array5.Length - 1)))); int num15 = array5[num14]; int num16 = (l * 128 + m) * 4; array6[num16] = (byte)(num15 >> 16); array6[num16 + 1] = (byte)(num15 >> 8); array6[num16 + 2] = (byte)num15; array6[num16 + 3] = byte.MaxValue; } } return new PearlModelData(array, array2, array3, array4, array6); } } public readonly struct DVec { public readonly double X; public readonly double Y; public readonly double Z; public double Length => Math.Sqrt(X * X + Y * Y + Z * Z); public bool Finite { get { if (!double.IsNaN(X) && !double.IsInfinity(X) && !double.IsNaN(Y) && !double.IsInfinity(Y) && !double.IsNaN(Z)) { return !double.IsInfinity(Z); } return false; } } public DVec Normalized { get { if (!(Length > 1E-12)) { return default(DVec); } return this * (1.0 / Length); } } public DVec(double x, double y, double z) { X = x; Y = y; Z = z; } public static DVec operator +(DVec a, DVec b) { return new DVec(a.X + b.X, a.Y + b.Y, a.Z + b.Z); } public static DVec operator *(DVec a, double b) { return new DVec(a.X * b, a.Y * b, a.Z * b); } } public static class PearlRules { public const double TickSeconds = 0.05; public const double Speed = 0.6; public const double Gravity = 0.03; public const double Spread = 0.0172275; public const double AirDrag = 0.9900000095367432; public const double WaterDrag = 0.800000011920929; public const double CooldownSeconds = 1.0; public const int StackSize = 16; public const int Damage = 5; public static DVec Launch(DVec aim, DVec playerMetersPerSecond, bool grounded, Func<double> random) { if (!aim.Finite || !playerMetersPerSecond.Finite || aim.Length < 1E-09) { throw new ArgumentException("Invalid launch vector"); } DVec dVec = new DVec((random() - random()) * 0.0172275, (random() - random()) * 0.0172275, (random() - random()) * 0.0172275); DVec dVec2 = new DVec(playerMetersPerSecond.X, grounded ? 0.0 : playerMetersPerSecond.Y, playerMetersPerSecond.Z) * 0.05; return (aim.Normalized + dVec) * 0.6 + dVec2; } public static void Step(ref DVec position, ref DVec velocity, bool water = false) { position += velocity; velocity = velocity * (water ? 0.800000011920929 : 0.9900000095367432) + new DVec(0.0, -0.03, 0.0); } } public sealed class ThrowGate { private double readyAt = double.NegativeInfinity; public bool CanThrow(double now) { return now >= readyAt; } public void Commit(double now) { readyAt = now + 1.0; } public double Remaining(double now) { return Math.Max(0.0, readyAt - now); } } public sealed class PearlClock { private double remainder; public double Fraction => Math.Max(0.0, Math.Min(1.0, remainder / 0.05)); public int Advance(double seconds) { if (double.IsNaN(seconds) || double.IsInfinity(seconds) || seconds < 0.0) { throw new ArgumentOutOfRangeException("seconds"); } remainder += seconds; int num = (int)Math.Floor((remainder + 1E-09) / 0.05); remainder -= (double)num * 0.05; return num; } } [BepInPlugin("REPOJP.EnderPearl", "EnderPearl", "4.0.0")] [BepInDependency("REPOLib", "4.2.0")] public sealed class EnderPearlPlugin : BaseUnityPlugin { public const string Guid = "REPOJP.EnderPearl"; public const string Name = "EnderPearl"; public const string Version = "4.0.0"; internal static readonly string BuildToken = "4.0.0:" + typeof(EnderPearlPlugin).Assembly.ManifestModule.ModuleVersionId.ToString("N"); internal static ManualLogSource Log = null; private void Awake() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; try { GameAccess.Validate(); new Harmony("REPOJP.EnderPearl").PatchAll(typeof(EnderPearlPlugin).Assembly); PearlRuntime.Enabled = true; } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("EnderPearl initialization failed: " + ex)); ((Behaviour)this).enabled = false; return; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("EnderPearl 4.0.0 initialized; build=" + BuildToken + ". All players must install the same build.")); } } [HarmonyPatch(typeof(RunManager), "Awake")] internal static class RegisterPearls { [HarmonyPostfix] [HarmonyAfter(new string[] { "REPOLib" })] [HarmonyPriority(0)] private static void Postfix() { PearlContent.TryRegister(); } } [HarmonyPatch(typeof(PlayerAvatar), "Awake")] internal static class AttachPearlUser { [HarmonyPostfix] private static void Postfix(PlayerAvatar __instance) { if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<PearlUser>())) { ((Component)__instance).gameObject.AddComponent<PearlUser>(); } } } public sealed class PearlUser : MonoBehaviour { internal readonly ThrowGate Gate = new ThrowGate(); private float landingBlockedUntil; private int moveToken; private Vector3 target; private bool pending; private double cutoff; private float guardUntil; internal void ShowBlockedLanding() { landingBlockedUntil = Time.time + 2.5f; } private void OnGUI() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (!(Time.time >= landingBlockedUntil) && Object.op_Implicit((Object)(object)GameDirector.instance) && (int)GameDirector.instance.currentState == 2) { PlayerAvatar component = ((Component)this).GetComponent<PlayerAvatar>(); if (Object.op_Implicit((Object)(object)component) && GameAccess.Local.Invoke(component)) { GUI.Box(new Rect((float)Screen.width / 2f - 210f, (float)(Screen.height - 105), 420f, 30f), "Teleport blocked: not enough space at impact."); } } } internal void BeginMove(Vector3 rootPosition, int token) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) moveToken = token; target = rootPosition; pending = true; guardUntil = Time.unscaledTime + 2f; } internal void LocalMoveComplete() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) pending = false; cutoff = PhotonNetwork.Time; if (SemiFunc.IsMultiplayer()) { ((Component)this).GetComponent<PhotonView>().RPC("PearlPoseReadyRPC", (RpcTarget)1, new object[2] { moveToken, target }); } } [PunRPC] public void PearlPoseReadyRPC(int token, Vector3 rootPosition, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_000e: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) PhotonView component = ((Component)this).GetComponent<PhotonView>(); if (SemiFunc.IsMultiplayer() && info.Sender != null && component.OwnerActorNr == info.Sender.ActorNumber && token == moveToken && GameAccess.Finite(rootPosition) && !(Vector3.Distance(rootPosition, target) > 3f)) { target = rootPosition; cutoff = ((PhotonMessageInfo)(ref info)).SentServerTime; pending = false; } } internal void Guard(PlayerAvatar avatar, PhotonMessageInfo info) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0066: Unknown result type (might be due to invalid IL or missing references) if (!(Time.unscaledTime > guardUntil) && !GameAccess.Local.Invoke(avatar) && (pending || ((PhotonMessageInfo)(ref info)).SentServerTime < cutoff)) { GameAccess.ClientPosition.Invoke(avatar) = target; GameAccess.ClientCurrent.Invoke(avatar) = target; ((Component)avatar).transform.position = target; } } } internal static class GameAccess { internal static readonly FieldRef<PlayerAvatar, bool> Local = AccessTools.FieldRefAccess<PlayerAvatar, bool>("isLocal"); internal static readonly FieldRef<PlayerAvatar, bool> Disabled = AccessTools.FieldRefAccess<PlayerAvatar, bool>("isDisabled"); internal static readonly FieldRef<PlayerAvatar, bool> Dead = AccessTools.FieldRefAccess<PlayerAvatar, bool>("deadSet"); internal static readonly FieldRef<PlayerAvatar, bool> Grounded = AccessTools.FieldRefAccess<PlayerAvatar, bool>("isGrounded"); internal static readonly FieldRef<PlayerAvatar, Vector3> Velocity = AccessTools.FieldRefAccess<PlayerAvatar, Vector3>("rbVelocityRaw"); internal static readonly FieldRef<PlayerAvatar, Vector3> ClientPosition = AccessTools.FieldRefAccess<PlayerAvatar, Vector3>("clientPosition"); internal static readonly FieldRef<PlayerAvatar, Vector3> ClientCurrent = AccessTools.FieldRefAccess<PlayerAvatar, Vector3>("clientPositionCurrent"); internal static readonly FieldRef<PlayerAvatar, bool> Riding = AccessTools.FieldRefAccess<PlayerAvatar, bool>("clientPhysRiding"); internal static readonly FieldRef<PlayerAvatar, PlayerTumble> Tumble = AccessTools.FieldRefAccess<PlayerAvatar, PlayerTumble>("tumble"); internal static readonly FieldRef<PlayerAvatar, float> ResetTimer = AccessTools.FieldRefAccess<PlayerAvatar, float>("fallDamageResetTimer"); internal static readonly FieldRef<PlayerAvatar, bool> ResetState = AccessTools.FieldRefAccess<PlayerAvatar, bool>("fallDamageResetState"); internal static readonly FieldRef<PhysGrabObject, bool> HeldLocal = AccessTools.FieldRefAccess<PhysGrabObject, bool>("heldByLocalPlayer"); internal static readonly FieldRef<PhysGrabObject, List<PhysGrabber>> Grabbers = AccessTools.FieldRefAccess<PhysGrabObject, List<PhysGrabber>>("playerGrabbing"); internal static readonly FieldRef<ItemAttributes, string> InstanceName = AccessTools.FieldRefAccess<ItemAttributes, string>("instanceName"); internal static readonly FieldRef<ItemAttributes, bool> ShopItem = AccessTools.FieldRefAccess<ItemAttributes, bool>("shopItem"); internal static readonly FieldRef<StatsManager, SortedDictionary<string, Dictionary<string, int>>> Stats = AccessTools.FieldRefAccess<StatsManager, SortedDictionary<string, Dictionary<string, int>>>("dictionaryOfDictionaries"); internal static readonly FieldRef<PlayerController, Rigidbody> Body = AccessTools.FieldRefAccess<PlayerController, Rigidbody>("rb"); internal static readonly FieldRef<PlayerController, float> InputDisabled = AccessTools.FieldRefAccess<PlayerController, float>("InputDisableTimer"); internal static readonly FieldRef<PlayerController, Vector3> PreviousPosition = AccessTools.FieldRefAccess<PlayerController, Vector3>("positionPrevious"); internal static readonly FieldRef<PlayerCollisionController, float> FallY = AccessTools.FieldRefAccess<PlayerCollisionController, float>("fallLastY"); internal static readonly FieldRef<PlayerAvatarVisuals, Vector3> VisualPosition = AccessTools.FieldRefAccess<PlayerAvatarVisuals, Vector3>("visualPosition"); internal static readonly FieldRef<PhysGrabber, PhysGrabObject> HeldObject = AccessTools.FieldRefAccess<PhysGrabber, PhysGrabObject>("grabbedPhysGrabObject"); internal static readonly FieldRef<PhysGrabber, float> PullerDistance = AccessTools.FieldRefAccess<PhysGrabber, float>("pullerDistance"); internal static readonly FieldRef<ItemAttributes, string> ItemName = AccessTools.FieldRefAccess<ItemAttributes, string>("itemName"); internal static bool Alive(PlayerAvatar p) { if (Object.op_Implicit((Object)(object)p) && ((Component)p).gameObject.activeInHierarchy && !Disabled.Invoke(p)) { return !Dead.Invoke(p); } return false; } internal static void Validate() { _ = Local; _ = Stats; _ = Body; } internal static bool Finite(Vector3 p) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0034: 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) if (!float.IsNaN(p.x) && !float.IsInfinity(p.x) && !float.IsNaN(p.y) && !float.IsInfinity(p.y) && !float.IsNaN(p.z)) { return !float.IsInfinity(p.z); } return false; } internal static DVec D(Vector3 p) { //IL_0000: 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_000e: Unknown result type (might be due to invalid IL or missing references) return new DVec(p.x, p.y, p.z); } internal static Vector3 V(DVec p) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) return new Vector3((float)p.X, (float)p.Y, (float)p.Z); } internal static PlayerAvatar? Player(int id) { if (!SemiFunc.IsMultiplayer()) { return PlayerAvatar.instance; } PhotonView obj = PhotonView.Find(id); if (obj == null) { return null; } return ((Component)obj).GetComponent<PlayerAvatar>(); } private static void CarryPearls(PlayerAvatar p, int carryId, Vector3 carryPosition) { //IL_011c: 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_010c: 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) //IL_015e: Unknown result type (might be due to invalid IL or missing references) PhysGrabber physGrabber = p.physGrabber; PhysGrabObject val = (Object.op_Implicit((Object)(object)physGrabber) ? HeldObject.Invoke(physGrabber) : null); if ((Object)(object)val == (Object)null || !Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)physGrabber)) { return; } PhotonView component = ((Component)val).GetComponent<PhotonView>(); bool num = Object.op_Implicit((Object)(object)((Component)val).GetComponent<PearlStack>()) && carryId != 0 && (!SemiFunc.IsMultiplayer() || component.ViewID == carryId); physGrabber.OverridePhysGrabForcesDisable(0.3f); if (!num) { if (SemiFunc.IsMasterClientOrSingleplayer()) { physGrabber.OverrideGrabRelease(component.ViewID, 0.3f); } else if (Local.Invoke(p)) { physGrabber.ReleaseObject(-1, 0.3f); } return; } if (SemiFunc.IsMasterClientOrSingleplayer()) { PhysGrabber[] array = Grabbers.Invoke(val).ToArray(); foreach (PhysGrabber val2 in array) { if (Object.op_Implicit((Object)(object)val2) && (Object)(object)val2 != (Object)(object)physGrabber) { val2.OverrideGrabRelease(component.ViewID, 0.3f); } } } if (SemiFunc.IsMasterClientOrSingleplayer()) { val.Teleport(carryPosition, ((Component)val).transform.rotation); } ((Component)val).transform.position = carryPosition; if (Object.op_Implicit((Object)(object)val.rb)) { val.rb.position = carryPosition; if (!val.rb.isKinematic) { val.rb.velocity = Vector3.zero; val.rb.angularVelocity = Vector3.zero; } } } private static void FinishCarry(PlayerAvatar p, int carryId, Vector3 eye, Vector3 forward) { //IL_0092: 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) //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_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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00f1: 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_010a: Unknown result type (might be due to invalid IL or missing references) PhysGrabber physGrabber = p.physGrabber; PhysGrabObject val = (Object.op_Implicit((Object)(object)physGrabber) ? HeldObject.Invoke(physGrabber) : null); if (Object.op_Implicit((Object)(object)physGrabber) && !((Object)(object)val == (Object)null) && Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).GetComponent<PearlStack>()) && carryId != 0 && (!SemiFunc.IsMultiplayer() || ((Component)val).GetComponent<PhotonView>().ViewID == carryId)) { float num = Mathf.Clamp(PullerDistance.Invoke(physGrabber), physGrabber.minDistanceFromPlayer, Mathf.Max(physGrabber.minDistanceFromPlayer, Mathf.Min(physGrabber.grabRange, physGrabber.maxDistanceFromPlayer))); Vector3 val2 = eye + forward * num; Vector3 val3 = (Object.op_Implicit((Object)(object)physGrabber.grabbedObjectTransform) ? physGrabber.grabbedObjectTransform.TransformPoint(physGrabber.localGrabPosition) : ((Component)val).transform.position); PearlGrabPose.Reset(physGrabber.physGrabPointPlane, physGrabber.physGrabPointPuller, physGrabber.physGrabPoint, val2, val3); physGrabber.physGrabPointPosition = val3; physGrabber.physGrabPointPullerPosition = val2; if (Object.op_Implicit((Object)(object)physGrabber.physGrabBeamComponent)) { physGrabber.physGrabBeamComponent.physGrabPointPullerSmoothPosition = val2; } } } internal static void Move(PlayerAvatar p, Vector3 position, int token, Vector3 normal, int carryId, Vector3 carryPosition) { //IL_0000: 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_000c: 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_002f: 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_0034: 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_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_004d: 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_0077: 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_008e: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_010f: 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_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: 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_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023b: 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_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: 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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: 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_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) Vector3 val = position - ((Component)p).transform.position; Vector3 val2 = (Object.op_Implicit((Object)(object)CameraPosition.instance) ? ((Component)CameraPosition.instance).transform.position : Vector3.zero); Transform overrideTransform = p.localCamera.GetOverrideTransform(); Vector3 eye = overrideTransform.position + val; Vector3 forward = overrideTransform.forward; PearlUser pearlUser = ((Component)p).GetComponent<PearlUser>() ?? ((Component)p).gameObject.AddComponent<PearlUser>(); p.photonView.RefreshRpcMonoBehaviourCache(); pearlUser.BeginMove(position, token); CarryPearls(p, carryId, carryPosition); ((Component)p).transform.position = position; ClientPosition.Invoke(p) = position; ClientCurrent.Invoke(p) = position; Riding.Invoke(p) = false; ResetTimer.Invoke(p) = 0.1f; ResetState.Invoke(p) = true; if (Object.op_Implicit((Object)(object)p.playerAvatarVisuals)) { ((Component)p.playerAvatarVisuals).transform.position = position; VisualPosition.Invoke(p.playerAvatarVisuals) = position; } if (Object.op_Implicit((Object)(object)p.RoomVolumeCheck)) { p.RoomVolumeCheck.CheckSet(); } if (Object.op_Implicit((Object)(object)p.localCamera)) { p.localCamera.Teleported(); } PlayerTumble val3 = Tumble.Invoke(p); if (Object.op_Implicit((Object)(object)val3)) { PhysGrabObject component = ((Component)val3).GetComponent<PhysGrabObject>(); if (Object.op_Implicit((Object)(object)component) && SemiFunc.IsMasterClientOrSingleplayer()) { Rigidbody component2 = ((Component)val3).GetComponent<Rigidbody>(); Vector3 velocity = (Object.op_Implicit((Object)(object)component2) ? component2.velocity : Vector3.zero); component.Teleport(((Component)val3).transform.position + val, ((Component)val3).transform.rotation); if (Object.op_Implicit((Object)(object)component2) && !component2.isKinematic) { component2.velocity = PearlPlacement.ArrivalVelocity(velocity, normal); } } } if (!Local.Invoke(p)) { FinishCarry(p, carryId, eye, forward); return; } PlayerController instance = PlayerController.instance; Rigidbody val4 = Body.Invoke(instance); Vector3 velocity2 = val4.velocity; ((Component)instance).transform.position = position; val4.position = position; if (!val4.isKinematic) { val4.velocity = PearlPlacement.ArrivalVelocity(velocity2, normal); } PreviousPosition.Invoke(instance) = position; if (Object.op_Implicit((Object)(object)instance.CollisionGrounded)) { instance.CollisionGrounded.physRiding = false; } if (Object.op_Implicit((Object)(object)instance.CollisionController)) { instance.CollisionController.Grounded = false; instance.CollisionController.GroundedDisableTimer = 0.1f; } if (Object.op_Implicit((Object)(object)p.playerTransform)) { p.playerTransform.position = position; } if (Object.op_Implicit((Object)(object)CameraPosition.instance)) { ((Component)CameraPosition.instance).transform.position = val2 + val; } if (Object.op_Implicit((Object)(object)CameraAim.Instance)) { CameraAim.Instance.OverrideNoSmooth(0.1f); } if (Object.op_Implicit((Object)(object)instance.CollisionController)) { instance.CollisionController.ResetFalling(); FallY.Invoke(instance.CollisionController) = position.y + instance.CollisionController.Offset.y; } PhysGrabObject val5 = (Object.op_Implicit((Object)(object)p.physGrabber) ? HeldObject.Invoke(p.physGrabber) : null); if (Object.op_Implicit((Object)(object)p.physGrabber) && ((Object)(object)val5 == (Object)null || !Object.op_Implicit((Object)(object)((Component)val5).GetComponent<PearlStack>()))) { p.physGrabber.ReleaseObject(-1, 0.1f); } FinishCarry(p, carryId, eye, forward); pearlUser.LocalMoveComplete(); p.playerHealth.Hurt(5, false, -1, false); } } internal static class PearlCollision { internal static PlayerAvatar? Avatar(Collider c) { PlayerAvatar componentInParent = ((Component)c).GetComponentInParent<PlayerAvatar>(); if (Object.op_Implicit((Object)(object)componentInParent)) { return componentInParent; } PlayerController componentInParent2 = ((Component)c).GetComponentInParent<PlayerController>(); if (Object.op_Implicit((Object)(object)componentInParent2)) { return componentInParent2.playerAvatarScript; } PlayerCollision componentInParent3 = ((Component)c).GetComponentInParent<PlayerCollision>(); if (Object.op_Implicit((Object)(object)componentInParent3) && Object.op_Implicit((Object)(object)componentInParent3.Player)) { return componentInParent3.Player.playerAvatarScript; } PlayerCollisionController componentInParent4 = ((Component)c).GetComponentInParent<PlayerCollisionController>(); if (Object.op_Implicit((Object)(object)componentInParent4) && Object.op_Implicit((Object)(object)componentInParent4.FollowTarget)) { componentInParent2 = ((Component)componentInParent4.FollowTarget).GetComponentInParent<PlayerController>(); if (Object.op_Implicit((Object)(object)componentInParent2)) { return componentInParent2.playerAvatarScript; } } PlayerTumble componentInParent5 = ((Component)c).GetComponentInParent<PlayerTumble>(); if (Object.op_Implicit((Object)(object)componentInParent5)) { foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (Object.op_Implicit((Object)(object)item) && (Object)(object)GameAccess.Tumble.Invoke(item) == (Object)(object)componentInParent5) { return item; } } } return null; } internal static bool HasLeftOwner(Vector3 origin, Vector3 delta, PlayerAvatar owner) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0046: 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_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 val = default(Bounds); ((Bounds)(ref val))..ctor(origin + delta * 0.5f, new Vector3(Mathf.Abs(delta.x) + 2.25f, Mathf.Abs(delta.y) + 2.25f, Mathf.Abs(delta.z) + 2.25f)); Collider[] array = Physics.OverlapBox(((Bounds)(ref val)).center, ((Bounds)(ref val)).extents, Quaternion.identity, -1, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { if ((Object)(object)Avatar(array[i]) == (Object)(object)owner) { return false; } } return true; } private static bool HeldPearl(Collider c, PlayerAvatar owner) { PearlStack componentInParent = ((Component)c).GetComponentInParent<PearlStack>(); if (!Object.op_Implicit((Object)(object)componentInParent)) { return false; } PhysGrabObject component = ((Component)componentInParent).GetComponent<PhysGrabObject>(); if (Object.op_Implicit((Object)(object)component)) { return GameAccess.Grabbers.Invoke(component).Any((PhysGrabber g) => Object.op_Implicit((Object)(object)g) && (Object)(object)g.playerAvatar == (Object)(object)owner); } return false; } internal static bool Cast(Vector3 origin, Vector3 delta, PlayerAvatar owner, bool leftOwner, out Vector3 impact, out Vector3 normal, out Collider? hitCollider) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_003e: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: 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_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) impact = origin; normal = -((Vector3)(ref delta)).normalized; hitCollider = null; float magnitude = ((Vector3)(ref delta)).magnitude; if ((double)magnitude < 1E-07) { return false; } float num = float.PositiveInfinity; Ray val = default(Ray); ((Ray)(ref val))..ctor(origin, delta / magnitude); RaycastHit[] array = Physics.RaycastAll(val, magnitude, -1, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val2 = array[i]; if (!HeldPearl(((RaycastHit)(ref val2)).collider, owner) && (leftOwner || !((Object)(object)Avatar(((RaycastHit)(ref val2)).collider) == (Object)(object)owner)) && ((RaycastHit)(ref val2)).distance < num) { num = ((RaycastHit)(ref val2)).distance; impact = ((RaycastHit)(ref val2)).point; normal = ((RaycastHit)(ref val2)).normal; hitCollider = ((RaycastHit)(ref val2)).collider; } } Bounds val3 = default(Bounds); ((Bounds)(ref val3))..ctor(origin + delta * 0.5f, new Vector3(Mathf.Abs(delta.x) + 1f, Mathf.Abs(delta.y) + 1f, Mathf.Abs(delta.z) + 1f)); Collider[] array2 = Physics.OverlapBox(((Bounds)(ref val3)).center, ((Bounds)(ref val3)).extents, Quaternion.identity, -1, (QueryTriggerInteraction)1); float num2 = default(float); foreach (Collider val4 in array2) { PlayerAvatar val5 = Avatar(val4); if (HeldPearl(val4, owner) || (!leftOwner && (Object)(object)val5 == (Object)(object)owner)) { continue; } if (Object.op_Implicit((Object)(object)val5) || Object.op_Implicit((Object)(object)((Component)val4).GetComponentInParent<EnemyRigidbody>()) || Object.op_Implicit((Object)(object)((Component)val4).GetComponentInParent<EnemyHealth>())) { Bounds bounds = val4.bounds; ((Bounds)(ref bounds)).Expand(0.6f); if (((Bounds)(ref bounds)).Contains(origin)) { num2 = 0f; } else if (!((Bounds)(ref bounds)).IntersectRay(val, ref num2)) { continue; } if (num2 <= magnitude && num2 < num) { num = num2; impact = ((Ray)(ref val)).GetPoint(num2); normal = -((Ray)(ref val)).direction; hitCollider = val4; } } else if (PearlPlacement.ContainsPoint(val4, origin)) { num = 0f; impact = origin; normal = -((Ray)(ref val)).direction; hitCollider = val4; } } return !float.IsPositiveInfinity(num); } } internal static class PearlContent { internal static Item? Item; internal static PrefabRef? Projectile; internal static bool Ready; private static bool failed; internal static void TryRegister() { if (Ready || failed || !Object.op_Implicit((Object)(object)RunManager.instance) || !Object.op_Implicit((Object)(object)StatsManager.instance)) { return; } Item val = ((IEnumerable<Item>)StatsManager.instance.itemDictionary.Values).FirstOrDefault((Func<Item, bool>)((Item i) => Object.op_Implicit((Object)(object)i) && i.prefab != null && Object.op_Implicit((Object)(object)((PrefabRef<GameObject>)(object)i.prefab).Prefab) && Object.op_Implicit((Object)(object)((PrefabRef<GameObject>)(object)i.prefab).Prefab.GetComponent<ItemGrenadeExplosive>()))); if (!Object.op_Implicit((Object)(object)val)) { return; } try { Build(val); Ready = true; EnderPearlPlugin.Log.LogInfo((object)"Ender Pearls registered: shop item, 16 charges, 20 Hz projectiles."); } catch (Exception ex) { failed = true; EnderPearlPlugin.Log.LogError((object)("Ender Pearl registration failed: " + ex)); } } private static void Build(Item source) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Expected O, but got Unknown //IL_0369: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("EnderPearl templates"); val.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val); GameObject val2 = Object.Instantiate<GameObject>(((PrefabRef<GameObject>)(object)source.prefab).Prefab, val.transform); ((Object)val2).name = "REPOJP Ender Pearl"; MonoBehaviour[] componentsInChildren = val2.GetComponentsInChildren<MonoBehaviour>(true); foreach (MonoBehaviour val3 in componentsInChildren) { if (val3 is ItemGrenade || val3 is ItemGrenadeExplosive || val3 is ItemToggle || val3 is ParticleScriptExplosion) { Object.DestroyImmediate((Object)(object)val3); } } Renderer[] componentsInChildren2 = val2.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { componentsInChildren2[i].enabled = false; } AudioSource[] componentsInChildren3 = val2.GetComponentsInChildren<AudioSource>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { ((Behaviour)componentsInChildren3[i]).enabled = false; } ParticleSystem[] componentsInChildren4 = val2.GetComponentsInChildren<ParticleSystem>(true); for (int i = 0; i < componentsInChildren4.Length; i++) { ((Component)componentsInChildren4[i]).gameObject.SetActive(false); } Collider val4 = ((IEnumerable<Collider>)val2.GetComponentsInChildren<Collider>(true)).FirstOrDefault((Func<Collider, bool>)((Collider c) => !c.isTrigger)); int layer = (Object.op_Implicit((Object)(object)val4) ? ((Component)val4).gameObject.layer : val2.layer); Collider[] componentsInChildren5 = val2.GetComponentsInChildren<Collider>(true); foreach (Collider val5 in componentsInChildren5) { if (!val5.isTrigger) { val5.enabled = false; } } GameObject val6 = new GameObject("Pearl collider") { layer = layer, tag = "Phys Grab Object" }; val6.transform.SetParent(val2.transform, false); val6.AddComponent<SphereCollider>().radius = 0.16f; val6.AddComponent<PhysGrabObjectCollider>(); ItemAttributes component = val2.GetComponent<ItemAttributes>(); Item = Object.Instantiate<Item>(source); ((Object)Item).name = "Item REPOJP Ender Pearl"; Item.itemName = "Ender Pearls"; Item.itemNameLocalized = null; Item.description = "Throw to teleport. 16 pearls. Team limit: 2 stacks. Try in the shop without consuming pearls. One-second cooldown. Teleporting costs 5 health."; Item.maxAmount = 2; Item.maxAmountInShop = 2; Item.maxPurchase = false; Item.disabled = false; Item.value = ScriptableObject.CreateInstance<Value>(); Item.value.valueMin = 6000f; Item.value.valueMax = 6000f; component.item = Item; component.icon = PearlVisual.Icon; ItemEquippable component2 = val2.GetComponent<ItemEquippable>(); if (Object.op_Implicit((Object)(object)component2)) { component2.ItemIcon = PearlVisual.Icon; } PearlVisual.AddPearl(val2.transform, 0.32f); PearlStack item = val2.AddComponent<PearlStack>(); PhotonView component3 = val2.GetComponent<PhotonView>(); component3.ObservedComponents.RemoveAll((Component c) => !Object.op_Implicit((Object)(object)c)); component3.ObservedComponents.Add((Component)(object)item); component3.RefreshRpcMonoBehaviourCache(); val2.SetActive(true); Item.prefab = Items.RegisterItem(component) ?? throw new InvalidOperationException("REPOLib rejected pearl item"); GameObject val7 = new GameObject("REPOJP Ender Pearl Projectile"); val7.transform.SetParent(val.transform); PhotonView obj = val7.AddComponent<PhotonView>(); PearlProjectile item2 = val7.AddComponent<PearlProjectile>(); obj.ObservedComponents = new List<Component> { (Component)(object)item2 }; obj.Synchronization = (ViewSynchronization)3; PearlVisual.AddPearl(val7.transform, 0.25f); Projectile = NetworkPrefabs.RegisterNetworkPrefab("REPOJP.EnderPearl.Projectile", val7) ?? throw new InvalidOperationException("REPOLib rejected pearl projectile"); } } internal static class PearlCountIcon { internal static void Update(Texture2D texture, int count) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) Color32[] pixels = PearlVisual.Icon.texture.GetPixels32(); byte[] array = PearlCountLabel.Mask(count); for (int i = 0; i < pixels.Length; i++) { if (array[i] != 0) { pixels[i] = ((array[i] == 2) ? new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue) : new Color32((byte)12, (byte)12, (byte)12, byte.MaxValue)); } } texture.SetPixels32(pixels); texture.Apply(); } } internal static class PearlGrabPose { internal static void Reset(Transform plane, Transform puller, Transform point, Vector3 target, Vector3 contact) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) if (Object.op_Implicit((Object)(object)plane)) { plane.position = target; } if (Object.op_Implicit((Object)(object)puller)) { puller.position = target; } if (Object.op_Implicit((Object)(object)point)) { point.position = contact; } } } [HarmonyPatch(typeof(ItemAttributes), "GetItemNameLocalized")] internal static class PearlItemName { [HarmonyPostfix] private static void Postfix(ItemAttributes __instance, ref string __result) { PearlStack component = ((Component)__instance).GetComponent<PearlStack>(); if (Object.op_Implicit((Object)(object)component)) { __result = PearlCountLabel.Name(component.Remaining); } } } internal static class PearlLanding { internal static Collider? BodyCollider(PlayerAvatar p) { if (GameAccess.Local.Invoke(p) && Object.op_Implicit((Object)(object)PlayerController.instance) && Object.op_Implicit((Object)(object)PlayerController.instance.col)) { return PlayerController.instance.col; } PlayerAvatarCollision component = ((Component)p).GetComponent<PlayerAvatarCollision>(); if (!Object.op_Implicit((Object)(object)component)) { return null; } return (Collider?)(object)component.Collider; } internal static bool Ignore(Collider c, PlayerAvatar p) { if ((Object)(object)PearlCollision.Avatar(c) == (Object)(object)p) { return true; } PearlStack componentInParent = ((Component)c).GetComponentInParent<PearlStack>(); PhysGrabObject val = (Object.op_Implicit((Object)(object)componentInParent) ? ((Component)componentInParent).GetComponent<PhysGrabObject>() : null); if ((Object)(object)val != (Object)null && Object.op_Implicit((Object)(object)val)) { return GameAccess.Grabbers.Invoke(val).Any((PhysGrabber g) => Object.op_Implicit((Object)(object)g) && (Object)(object)g.playerAvatar == (Object)(object)p); } return false; } internal static bool TryResolve(PlayerAvatar p, Vector3 approach, Vector3 contact, Vector3 normal, out Vector3 root) { //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_0058: 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) //IL_0064: 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) root = ((Component)p).transform.position; Collider body = BodyCollider(p); if ((Object)(object)body == (Object)null || !Object.op_Implicit((Object)(object)body)) { return false; } return PearlPlacement.TryPlayer(PearlPlacement.WorldBounds(body), root, approach, contact, normal, (Collider c) => Ignore(c, p) || Physics.GetIgnoreLayerCollision(((Component)body).gameObject.layer, ((Component)c).gameObject.layer) || Physics.GetIgnoreCollision(body, c), out root); } internal static void PlanCarry(PlayerAvatar p, Vector3 root, out int viewId, out Vector3 position) { //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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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) viewId = 0; position = Vector3.zero; PhysGrabObject val = (Object.op_Implicit((Object)(object)p.physGrabber) ? GameAccess.HeldObject.Invoke(p.physGrabber) : null); Collider val2 = BodyCollider(p); if ((Object)(object)val == (Object)null || !Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)((Component)val).GetComponent<PearlStack>()) || (Object)(object)val2 == (Object)null || !Object.op_Implicit((Object)(object)val2)) { return; } Vector3 val3 = root - ((Component)p).transform.position; Bounds val4 = PearlPlacement.WorldBounds(val2); if (PearlPlacement.TryCarriedSphere(((Bounds)(ref val4)).center + val3, ((Component)val).transform.position + val3, 0.18f, (Collider c) => Ignore(c, p), out position)) { viewId = ((Component)val).GetComponent<PhotonView>().ViewID; if (!SemiFunc.IsMultiplayer()) { viewId = -1; } } } } internal static class PearlModel { private static Mesh mesh; private static Material material; internal static GameObject Attach(Transform parent, float diameter) { //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_0020: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown EnsureAssets(); GameObject val = new GameObject("Pearl 3D model") { layer = ((Component)parent).gameObject.layer }; val.transform.SetParent(parent, false); val.transform.localScale = Vector3.one * diameter; val.AddComponent<MeshFilter>().sharedMesh = mesh; MeshRenderer obj = val.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = material; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)1; ((Renderer)obj).receiveShadows = true; ((Renderer)obj).lightProbeUsage = (LightProbeUsage)1; ((Renderer)obj).reflectionProbeUsage = (ReflectionProbeUsage)1; return val; } private static void EnsureAssets() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00e3: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Expected O, but got Unknown //IL_0173: 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_0183: 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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Expected O, but got Unknown //IL_01ba: 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_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Expected O, but got Unknown //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)mesh) || !Object.op_Implicit((Object)(object)material)) { Shader val = Shader.Find("Standard") ?? Shader.Find("Legacy Shaders/Diffuse") ?? Shader.Find("Unlit/Texture"); if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("No supported opaque shader available for the pearl model."); } PearlModelData pearlModelData = PearlModelData.Create(); Vector3[] array = (Vector3[])(object)new Vector3[pearlModelData.Positions.Length / 3]; Vector3[] array2 = (Vector3[])(object)new Vector3[array.Length]; Vector2[] array3 = (Vector2[])(object)new Vector2[array.Length]; for (int i = 0; i < array.Length; i++) { array[i] = new Vector3(pearlModelData.Positions[i * 3], pearlModelData.Positions[i * 3 + 1], pearlModelData.Positions[i * 3 + 2]); array2[i] = new Vector3(pearlModelData.Normals[i * 3], pearlModelData.Normals[i * 3 + 1], pearlModelData.Normals[i * 3 + 2]); array3[i] = new Vector2(pearlModelData.UV[i * 2], pearlModelData.UV[i * 2 + 1]); } mesh = new Mesh { name = "Ender Pearl sphere (96 x 48)", vertices = array, normals = array2, uv = array3, triangles = pearlModelData.Triangles }; mesh.RecalculateBounds(); mesh.UploadMeshData(true); Texture2D val2 = new Texture2D(128, 64, (TextureFormat)4, true) { name = "Ender Pearl teal glaze", filterMode = (FilterMode)0, wrapModeU = (TextureWrapMode)0, wrapModeV = (TextureWrapMode)1, anisoLevel = 2 }; val2.SetPixelData<byte>(pearlModelData.Pixels, 0, 0); val2.Apply(true, true); material = new Material(val) { name = "Ender Pearl polished teal", mainTexture = (Texture)(object)val2 }; if (material.HasProperty("_Color")) { material.SetColor("_Color", Color.white); } if (material.HasProperty("_Metallic")) { material.SetFloat("_Metallic", 0.32f); } if (material.HasProperty("_Glossiness")) { material.SetFloat("_Glossiness", 0.62f); } if (material.HasProperty("_EmissionMap") && material.HasProperty("_EmissionColor")) { material.EnableKeyword("_EMISSION"); material.SetTexture("_EmissionMap", (Texture)(object)val2); material.SetColor("_EmissionColor", Color.white * 0.055f); } if (Application.isPlaying) { Object.DontDestroyOnLoad((Object)(object)mesh); Object.DontDestroyOnLoad((Object)(object)val2); Object.DontDestroyOnLoad((Object)(object)material); } } } } internal static class PearlPlacement { internal const float Skin = 0.04f; private static BoxCollider probe; internal static Bounds WorldBounds(Collider collider) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0068: 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) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00d6: 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_00e6: 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_00f0: 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_00fe: 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_010d: 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_0114: 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_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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_0090: 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) CapsuleCollider val = (CapsuleCollider)(object)((collider is CapsuleCollider) ? collider : null); Vector3 center; Vector3 val2; if (val != null) { center = val.center; val2 = Vector3.one * val.radius * 2f; ((Vector3)(ref val2))[val.direction] = Mathf.Max(val.height, val.radius * 2f); } else { BoxCollider val3 = (BoxCollider)(object)((collider is BoxCollider) ? collider : null); if (val3 != null) { center = val3.center; val2 = val3.size; } else { SphereCollider val4 = (SphereCollider)(object)((collider is SphereCollider) ? collider : null); if (val4 == null) { return collider.bounds; } center = val4.center; val2 = Vector3.one * val4.radius * 2f; } } Transform transform = ((Component)collider).transform; Vector3 v = transform.TransformVector(Vector3.right * val2.x * 0.5f); Vector3 v2 = transform.TransformVector(Vector3.up * val2.y * 0.5f); Vector3 v3 = transform.TransformVector(Vector3.forward * val2.z * 0.5f); return new Bounds(transform.TransformPoint(center), 2f * (Abs(v) + Abs(v2) + Abs(v3))); } internal static bool ContainsPoint(Collider c, Vector3 point) { //IL_002d: 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_0033: 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_0039: Unknown result type (might be due to invalid IL or missing references) if (!(c is BoxCollider) && !(c is SphereCollider) && !(c is CapsuleCollider)) { MeshCollider val = (MeshCollider)(object)((c is MeshCollider) ? c : null); if (val == null || !val.convex) { return false; } } Vector3 val2 = c.ClosestPoint(point) - point; return ((Vector3)(ref val2)).sqrMagnitude < 1E-10f; } private static BoxCollider Probe(Vector3 extents) { //IL_006d: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_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_001f: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)probe)) { GameObject val = new GameObject("EnderPearl clearance probe") { hideFlags = (HideFlags)61 }; probe = val.AddComponent<BoxCollider>(); ((Collider)probe).isTrigger = true; val.layer = 2; val.transform.position = new Vector3(0f, -10000f, 0f); if (Application.isPlaying) { Object.DontDestroyOnLoad((Object)(object)val); } } probe.size = extents * 2f + Vector3.one * 0.04f; return probe; } private static Vector3 Abs(Vector3 v) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_0021: Unknown result type (might be due to invalid IL or missing references) return new Vector3(Mathf.Abs(v.x), Mathf.Abs(v.y), Mathf.Abs(v.z)); } private static bool ClearBox(Vector3 center, Vector3 extents, Func<Collider, bool> ignore) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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) Collider[] array = Physics.OverlapBox(center, extents + Vector3.one * 0.02f, Quaternion.identity, -1, (QueryTriggerInteraction)1); foreach (Collider arg in array) { if (!ignore(arg)) { return false; } } return true; } private static bool Connected(Vector3 from, Vector3 to, Func<Collider, bool> ignore) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = to - from; if (((Vector3)(ref val)).magnitude < 0.001f) { return true; } RaycastHit[] array = Physics.RaycastAll(from, ((Vector3)(ref val)).normalized, ((Vector3)(ref val)).magnitude, -1, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val2 = array[i]; if (!ignore(((RaycastHit)(ref val2)).collider)) { return false; } } array = Physics.RaycastAll(to, -((Vector3)(ref val)).normalized, ((Vector3)(ref val)).magnitude, -1, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val3 = array[i]; if (!ignore(((RaycastHit)(ref val3)).collider)) { return false; } } return true; } private static bool AdjustToClearance(ref Vector3 candidate, Vector3 extents, Vector3 contact, Vector3 normal, float support, Func<Collider, bool> ignore) { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_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_0032: 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_010e: 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) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_0095: 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_00a4: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00e5: Unknown result type (might be due to invalid IL or missing references) Vector3 val = candidate; BoxCollider val2 = Probe(extents); Vector3 val4 = default(Vector3); float num = default(float); for (int i = 0; i < 12; i++) { bool flag = false; Collider[] array = Physics.OverlapBox(candidate, extents + Vector3.one * 0.02f, Quaternion.identity, -1, (QueryTriggerInteraction)1); foreach (Collider val3 in array) { if (!ignore(val3) && Physics.ComputePenetration((Collider)(object)val2, candidate, Quaternion.identity, val3, ((Component)val3).transform.position, ((Component)val3).transform.rotation, ref val4, ref num)) { candidate += val4 * (num + 0.002f); candidate += normal * Mathf.Max(0f, support + 0.04f - Vector3.Dot(candidate - contact, normal)); flag = true; } } if (Vector3.Distance(candidate, val) > Mathf.Max(1f, extents.y * 2f)) { return false; } if (ClearBox(candidate, extents, ignore)) { return true; } if (!flag) { return false; } } return false; } internal static bool TryPlayer(Bounds body, Vector3 oldRoot, Vector3 approach, Vector3 contact, Vector3 normal, Func<Collider, bool> ignore, out Vector3 root) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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_001d: 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_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) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0085: 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_008c: 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) //IL_0094: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00f6: 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) //IL_0100: 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) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) root = oldRoot; if (((Bounds)(ref body)).size.x < 0.01f || ((Bounds)(ref body)).size.y < 0.01f || ((Bounds)(ref body)).size.z < 0.01f || ((Vector3)(ref normal)).sqrMagnitude < 0.5f) { return false; } ((Vector3)(ref normal)).Normalize(); Vector3 extents = ((Bounds)(ref body)).extents; Vector3 val = ((Bounds)(ref body)).center - oldRoot; Vector3 val2 = contact + Vector3.up * extents.y; float num = Vector3.Dot(Abs(normal), extents); val2 += normal * Mathf.Max(0f, num + 0.04f - Vector3.Dot(val2 - contact, normal)); int num2 = Mathf.CeilToInt(((Bounds)(ref body)).size.y / 0.2f); for (int i = 0; i <= 5; i++) { for (int j = 0; j <= num2; j++) { Vector3 candidate = val2 + normal * ((float)i * 0.2f) - Vector3.up * ((float)j * 0.2f); if (!(Vector3.Dot(candidate - contact, normal) < num + 0.02f) && (ClearBox(candidate, extents, ignore) || AdjustToClearance(ref candidate, extents, contact, normal, num, ignore)) && Connected(approach, candidate, ignore)) { root = candidate - val; return true; } } } return false; } internal static bool TryCarriedSphere(Vector3 anchor, Vector3 desired, float radius, Func<Collider, bool> ignore, out Vector3 position) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006d: 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_010f: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) position = anchor; Collider[] array = Physics.OverlapSphere(anchor, radius + 0.04f, -1, (QueryTriggerInteraction)1); foreach (Collider arg in array) { if (!ignore(arg)) { return false; } } Vector3 val = desired - anchor; float num = Mathf.Min(((Vector3)(ref val)).magnitude, 1.5f); if (num > 0.001f) { Vector3 normalized = ((Vector3)(ref val)).normalized; float num2 = num; RaycastHit[] array2 = Physics.SphereCastAll(anchor, radius + 0.04f, normalized, num, -1, (QueryTriggerInteraction)1); for (int i = 0; i < array2.Length; i++) { RaycastHit val2 = array2[i]; if (!ignore(((RaycastHit)(ref val2)).collider)) { num2 = Mathf.Min(num2, Mathf.Max(0f, ((RaycastHit)(ref val2)).distance - 0.04f)); } } position = anchor + normalized * num2; } array = Physics.OverlapSphere(position, radius + 0.02f, -1, (QueryTriggerInteraction)1); foreach (Collider arg2 in array) { if (!ignore(arg2)) { return false; } } return Connected(anchor, position, ignore); } internal static Vector3 ArrivalVelocity(Vector3 velocity, Vector3 normal) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Dot(velocity, normal); if (!(num < 0f)) { return velocity; } return velocity - normal * num; } } [HarmonyPatch(typeof(PlayerAvatar), "OnPhotonSerializeView")] internal static class PearlPoseGuard { [HarmonyPostfix] private static void Postfix(PlayerAvatar __instance, PhotonStream stream, PhotonMessageInfo info) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (stream.IsReading) { ((Component)__instance).GetComponent<PearlUser>()?.Guard(__instance, info); } } } public sealed class PearlProjectile : MonoBehaviourPunCallbacks, IPunObservable, IPunInstantiateMagicCallback { private DVec position; private DVec velocity; private int owner; private bool initialized; private bool ended; private bool leftOwner; private readonly PearlClock clock = new PearlClock(); private bool impactApplied; private float destroyAt; private DVec previousPosition; private readonly PearlFlightRender render = new PearlFlightRender(); private double lastStateTime = double.NegativeInfinity; public void OnPhotonInstantiate(PhotonMessageInfo info) { object[] instantiationData = ((MonoBehaviourPun)this).photonView.InstantiationData; if (instantiationData != null && instantiationData.Length == 4 && instantiationData[0] is int ownerId && instantiationData[1] is double x && instantiationData[2] is double y && instantiationData[3] is double z) { Initialize(ownerId, new DVec(x, y, z), ((PhotonMessageInfo)(ref info)).SentServerTime); } } public void Initialize(int ownerId, DVec speed, double? createdAt = null) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (!initialized) { owner = ownerId; position = GameAccess.D(((Component)this).transform.position); velocity = speed; initialized = true; previousPosition = position; render.Seed(position, createdAt ?? PhotonNetwork.Time); if (Object.op_Implicit((Object)(object)LevelGenerator.Instance) && Object.op_Implicit((Object)(object)LevelGenerator.Instance.ItemParent)) { ((Component)this).transform.SetParent(LevelGenerator.Instance.ItemParent.transform, true); } } } private void Update() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0217: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_016f: 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_017d: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0189: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) if (!initialized) { return; } if (ended) { if (SemiFunc.IsMasterClientOrSingleplayer() && Time.time >= destroyAt) { Remove(); } return; } if (!SemiFunc.IsMasterClientOrSingleplayer()) { ((Component)this).transform.position = GameAccess.V(render.Sample(PhotonNetwork.Time)); return; } PlayerAvatar val = GameAccess.Player(owner); if ((Object)(object)val == (Object)null || !GameAccess.Alive(val)) { Remove(); return; } int num = clock.Advance(Time.deltaTime); for (int i = 0; i < num; i++) { if (ended) { break; } Vector3 val2 = GameAccess.V(position); Vector3 delta = GameAccess.V(velocity); if (!leftOwner) { leftOwner = PearlCollision.HasLeftOwner(val2, delta, val); } if (PearlCollision.Cast(val2, delta, val, leftOwner, out Vector3 impact, out Vector3 normal, out Collider _)) { Vector3 root; bool flag = PearlLanding.TryResolve(val, val2, impact, normal, out root); int viewId = 0; Vector3 zero = Vector3.zero; if (flag) { PearlLanding.PlanCarry(val, root, out viewId, out zero); } if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)this).photonView.RPC("ImpactRPC", (RpcTarget)0, new object[7] { root, owner, normal, flag, viewId, zero, impact }); } else { ImpactRPC(root, owner, normal, flag, viewId, zero, impact); } break; } previousPosition = position; PearlRules.Step(ref position, ref velocity); if (position.Y < -256.0 || !position.Finite) { Remove(); return; } } if (!ended) { ((Component)this).transform.position = GameAccess.V(PearlFlightRender.Between(previousPosition, position, clock.Fraction)); } } [PunRPC] public void ImpactRPC(Vector3 destination, int playerId, Vector3 normal, bool canLand, int carryId, Vector3 carryPosition, Vector3 impact, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.MasterOnlyRPC(info) || impactApplied || playerId != owner || !GameAccess.Finite(destination) || !GameAccess.Finite(normal) || !GameAccess.Finite(carryPosition) || !GameAccess.Finite(impact)) { return; } impactApplied = true; ended = true; destroyAt = Time.time + 0.5f; Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } ((Component)this).transform.position = impact; PlayerAvatar val = GameAccess.Player(owner); if (!canLand) { PearlVisual.Burst(impact); if ((Object)(object)val != (Object)null && GameAccess.Local.Invoke(val)) { ((Component)val).GetComponent<PearlUser>()?.ShowBlockedLanding(); } } else if (!((Object)(object)val == (Object)null) && GameAccess.Alive(val)) { GameAccess.Move(val, destination, ((MonoBehaviourPun)this).photonView.ViewID, normal, carryId, carryPosition); PearlVisual.Burst(destination); PearlVisual.Sound(destination, teleport: true); } } private void Remove() { if (SemiFunc.IsMultiplayer()) { PhotonNetwork.Destroy(((Component)this).gameObject); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) if (stream.IsWriting) { stream.SendNext((object)new double[7] { position.X, position.Y, position.Z, velocity.X, velocity.Y, velocity.Z, clock.Fraction }); stream.SendNext((object)leftOwner); stream.SendNext((object)ended); stream.SendNext((object)owner); return; } double[] array = (double[])stream.ReceiveNext(); bool flag = (bool)stream.ReceiveNext(); bool flag2 = (bool)stream.ReceiveNext(); int num = (int)stream.ReceiveNext(); if (array.Length != 7 || info.Sender != PhotonNetwork.MasterClient || ((PhotonMessageInfo)(ref info)).SentServerTime <= lastStateTime) { return; } DVec dVec = new DVec(array[0], array[1], array[2]); DVec dVec2 = new DVec(array[3], array[4], array[5]); if (!dVec.Finite || !dVec2.Finite || double.IsNaN(array[6]) || array[6] < 0.0 || array[6] > 1.0) { return; } lastStateTime = ((PhotonMessageInfo)(ref info)).SentServerTime; render.Push(dVec, ((PhotonMessageInfo)(ref info)).SentServerTime - array[6] * 0.05, ((PhotonMessageInfo)(ref info)).SentServerTime, PhotonNetwork.Time); previousPosition = position; position = dVec; velocity = dVec2; leftOwner = flag; owner = num; initialized = true; if (flag2 && !ended) { ended = true; destroyAt = Time.time + 0.5f; Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } } } } internal static class PearlRuntime { internal static bool Enabled; private static float nextCheck; private static float nextError; internal static void Tick() { //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_006a: Expected O, but got Unknown //IL_0071: Expected O, but got Unknown if (!Enabled || Time.unscaledTime < nextCheck) { return; } nextCheck = Time.unscaledTime + 1f; try { PearlContent.TryRegister(); if (PhotonNetwork.InRoom && !object.Equals(PhotonNetwork.LocalPlayer.CustomProperties[(object)"REPOJP.EnderPearl"], EnderPearlPlugin.BuildToken)) { Player localPlayer = PhotonNetwork.LocalPlayer; Hashtable val = new Hashtable(); ((Dictionary<object, object>)val).Add((object)"REPOJP.EnderPearl", (object)EnderPearlPlugin.BuildToken); localPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } } catch (Exception ex) { if (!(Time.unscaledTime < nextError)) { nextError = Time.unscaledTime + 10f; EnderPearlPlugin.Log.LogError((object)("EnderPearl runtime update failed: " + ex)); } } } } [HarmonyPatch(typeof(GameDirector), "Update")] internal static class PearlRuntimeUpdate { [HarmonyPostfix] private static void Postfix() { PearlRuntime.Tick(); } } public sealed class PearlStack : MonoBehaviour, IPunObservable { private PhotonView view; private PhysGrabObject phys; private ItemAttributes attrs; private ItemEquippable equipment; private int count = 16; private int shownCount = -1; private Texture2D countTexture; private bool initialized; private bool spent; private float localNext; private string status = ""; private float statusUntil; private const string StatKey = "REPOJP.EnderPearl.Count"; internal int Remaining => count; private bool IsShopTrial { get { if (SemiFunc.RunIsShop()) { return GameAccess.ShopItem.Invoke(attrs); } return false; } } private static bool UsesSavedCount { get { if (!SemiFunc.RunIsShop()) { return !SemiFunc.RunIsArena(); } return false; } } private void Awake() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) view = ((Component)this).GetComponent<PhotonView>(); phys = ((Component)this).GetComponent<PhysGrabObject>(); attrs = ((Component)this).GetComponent<ItemAttributes>(); equipment = ((Component)this).GetComponent<ItemEquippable>(); countTexture = Object.Ins