using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("my.pahsiv.MyPrevision")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("my.pahsiv.MyPrevision")] [assembly: AssemblyTitle("MyPrevision")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Embedded] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Embedded] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace Microsoft.CodeAnalysis { [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace MyPrevision { public static class ColoredLogging { private static readonly MethodInfo SetConsoleColorMethod; private static readonly TextWriter ConsoleStream; static ColoredLogging() { Assembly assembly = typeof(BaseUnityPlugin).Assembly; Type type = assembly.GetType("BepInEx.ConsoleManager"); if (type != null) { SetConsoleColorMethod = type.GetMethod("SetConsoleColor", BindingFlags.Static | BindingFlags.Public); ConsoleStream = type.GetProperty("ConsoleStream", BindingFlags.Static | BindingFlags.Public)?.GetValue(null) as TextWriter; } } private static void SetColor(ConsoleColor color) { SetConsoleColorMethod?.Invoke(null, new object[1] { color }); } private static void WriteColored(string message, ConsoleColor color, bool newline = true) { if (ConsoleStream != null) { SetColor(color); if (newline) { ConsoleStream.WriteLine(message); } else { ConsoleStream.Write(message); } SetColor(ConsoleColor.Gray); } } public static void LogColor(this ManualLogSource log, string message, ConsoleColor color = ConsoleColor.Gray) { WriteColored(message, color); } public static void LogColorW(this ManualLogSource log, string message, ConsoleColor color = ConsoleColor.Yellow) { WriteColored(message, color); } public static void LogColorE(this ManualLogSource log, string message, ConsoleColor color = ConsoleColor.Red) { WriteColored(message, color); } public static void LogColorS(this ManualLogSource log, string message, ConsoleColor color = ConsoleColor.Green) { WriteColored(message, color); } public static void LogColorM(this ManualLogSource log, string message, ConsoleColor color = ConsoleColor.Magenta) { WriteColored(message, color); } public static void LogColorC(this ManualLogSource log, string message, ConsoleColor color = ConsoleColor.Cyan) { WriteColored(message, color); } } public static class ColorHelper { public const string White = "FFFFFF"; public const string Black = "000000"; public const string Red = "FF0000"; public const string Green = "00FF00"; public const string Blue = "0000FF"; public const string Yellow = "FFFF00"; public const string Purple = "8765CA"; public const string Gray = "808080"; public const string Orange = "FFA500"; public const string Cyan = "00FFFF"; public const string Magenta = "FF00FF"; public const string Pink = "FFC0CB"; public const string Brown = "A52A2A"; public const string Lime = "00FF00"; public const string Teal = "008080"; public const string Navy = "000080"; public const string Maroon = "800000"; public const string Olive = "808000"; public const string Aqua = "00FFFF"; public const string Silver = "C0C0C0"; public const string Gold = "FFD700"; public const string LightRed = "FF6B6B"; public const string LightGreen = "90EE90"; public const string LightBlue = "ADD8E6"; public const string LightGray = "D3D3D3"; public const string LightPink = "FFB6C1"; public const string DarkRed = "8B0000"; public const string DarkGreen = "006400"; public const string DarkBlue = "00008B"; public const string DarkGray = "A9A9A9"; public const string DarkOrange = "FF8C00"; public const string Pahsiv = "3582E7"; } internal class Patch { [HarmonyPatch(typeof(CharacterItems), "DoDropping")] public class ThrowPredictionPatch { private static GameObject trajectoryVisualization; private static Item currentItemBeingCharged; private static List lastTrajectoryPoints = new List(); private static float predictionUpdateTimer = 0f; private const float PREDICTION_UPDATE_INTERVAL = 0.1f; public static void Postfix(CharacterItems __instance) { if (!Object.op_Implicit((Object)(object)__instance.character.data.currentItem)) { return; } if (__instance.pressedDrop && __instance.character.input.dropIsPressed && __instance.throwChargeLevel > 0f) { predictionUpdateTimer += Time.deltaTime; if (predictionUpdateTimer >= 0.1f) { ShowThrowPrediction(__instance); if (Plugin.HideItemInHand.Value) { SetItemTransparency(__instance.character.data.currentItem); } currentItemBeingCharged = __instance.character.data.currentItem; predictionUpdateTimer = 0f; } return; } predictionUpdateTimer = 0f; if ((Object)(object)trajectoryVisualization != (Object)null) { Object.Destroy((Object)(object)trajectoryVisualization); trajectoryVisualization = null; } if ((Object)(object)currentItemBeingCharged != (Object)null) { if (Plugin.HideItemInHand.Value) { RestoreItemTransparency(currentItemBeingCharged); } currentItemBeingCharged = null; } } private static void ShowThrowPrediction(CharacterItems characterItems) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_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_0043: 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_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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_010e: Unknown result type (might be due to invalid IL or missing references) Character character = characterItems.character; Item currentItem = character.data.currentItem; if (!Object.op_Implicit((Object)(object)currentItem) || !Object.op_Implicit((Object)(object)((Component)currentItem).GetComponent())) { return; } Vector3 val = HelperFunctions.LookToDirection(Vector2.op_Implicit(character.data.lookValues), Vector3.forward); Vector3 normalized = ((Vector3)(ref val)).normalized; float num = characterItems.minThrowForce + (characterItems.maxThrowForce - characterItems.minThrowForce) * characterItems.throwChargeLevel; Rigidbody component = ((Component)currentItem).GetComponent(); Vector3 linearVelocity = component.linearVelocity; float throwForceMultiplier = currentItem.throwForceMultiplier; float linearDamping = component.linearDamping; Vector3 throwVelocity = linearVelocity + normalized * num * 0.5f * throwForceMultiplier; if (!PredictItemImpact(((Component)currentItem).transform.position, throwVelocity, linearDamping, currentItem, out var impactPoint, out var impactNormal, out var predictionSucceeded)) { return; } VisualizeTrajectorySingleLine(impactPoint, impactNormal); if (predictionSucceeded && Plugin.EnablePredictionVine.Value) { MagicBean component2 = ((Component)currentItem).GetComponent(); if ((Object)(object)component2 != (Object)null) { Vector3 val2 = CalculateVineDirection(impactPoint, impactNormal); float vineDistance = GetVineDistance(impactPoint, val2, component2); VisualizeVineGrowth(impactPoint, val2, vineDistance, component2); } } } private static Vector3 CalculateVineDirection(Vector3 impactPoint, Vector3 centralNormal) { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0058: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_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_00c6: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_00ee: 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_00ff: 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) List list = new List(); float num = 0.2f; RaycastHit val4 = default(RaycastHit); for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { if (i != 0 || j != 0) { Vector3 val = Vector3.ProjectOnPlane(new Vector3((float)i, 0f, (float)j), centralNormal); Vector3 val2 = ((Vector3)(ref val)).normalized * num; Vector3 val3 = impactPoint + val2 + centralNormal; Physics.Raycast(val3, val3 - centralNormal, ref val4, 2f, LayerMask.op_Implicit(GetPredictionLayerMask())); if ((Object)(object)((RaycastHit)(ref val4)).collider != (Object)null) { list.Add(((RaycastHit)(ref val4)).normal); } } } } Vector3 val5 = centralNormal; foreach (Vector3 item in list) { val5 += item; } val5 = ((Vector3)(ref val5)).normalized; if (Vector3.Angle(val5, Vector3.up) < 15f) { val5 = Vector3.up; } return val5; } private static float GetVineDistance(Vector3 startPos, Vector3 direction, MagicBean magicBean) { //IL_000b: 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_0019: Unknown result type (might be due to invalid IL or missing references) RaycastHit[] array = (RaycastHit[])(object)new RaycastHit[128]; int num = Physics.RaycastNonAlloc(startPos, direction, array, magicBean.plantPrefab.maxLength, LayerMask.op_Implicit(GetPredictionLayerMask())); float num2 = magicBean.plantPrefab.maxLength; for (int i = 0; i < num; i++) { if (Object.op_Implicit((Object)(object)((RaycastHit)(ref array[i])).collider) && ((RaycastHit)(ref array[i])).distance > 0.7f && ((RaycastHit)(ref array[i])).distance < num2) { num2 = ((RaycastHit)(ref array[i])).distance; } } return num2; } private static void VisualizePrediction(Vector3 startPos, Vector3 impactPoint, Vector3 impactNormal, Vector3 vineDirection, float vineDistance, MagicBean magicBean) { //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_0007: 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) VisualizeTrajectorySingleLine(impactPoint, impactNormal); VisualizeVineGrowth(impactPoint, vineDirection, vineDistance, magicBean); } private static void VisualizeVineGrowth(Vector3 impactPoint, Vector3 vineDirection, float vineDistance, MagicBean magicBean) { //IL_000b: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00dc: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(((Component)magicBean.plantPrefab).gameObject, impactPoint, Quaternion.identity); ((Object)val).name = "VineGrowthPreview"; val.transform.parent = trajectoryVisualization.transform; val.transform.up = vineDirection; MagicBeanVine component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.maxLength = vineDistance; component.growingSpeed = 0f; component.currentLength = vineDistance; component.Grow(); } Transform val2 = val.transform.Find("VineOrigin/Stalk"); if ((Object)(object)val2 != (Object)null) { Renderer component2 = ((Component)val2).GetComponent(); if ((Object)(object)component2 != (Object)null) { Material val3 = new Material(Shader.Find("Scouts/ItemPreview")); val3.renderQueue = 3021; val3.SetColor("_Tint", new Color(0f, 1.388976f, 2.934567f, 0f)); float num = 90f - Vector3.Angle(vineDirection, Vector3.up); if (Mathf.Abs(num) < 45f) { val3.SetColor("_Color0", Color.green); } else { val3.SetColor("_Color0", Color.red); } val3.SetFloat("_PhongTessStrength", 0.5f); val3.SetFloat("_MaxTessellation", 16f); val3.SetFloat("_TessMinDistance", 10f); val3.SetFloat("_TessMaxDistance", 25f); val3.SetFloat("_EdgeLength", 16f); val3.SetFloat("_MaxDisplacement", 25f); val3.doubleSidedGI = false; component2.material = val3; } } Collider[] componentsInChildren = val.GetComponentsInChildren(); Collider[] array = componentsInChildren; foreach (Collider val4 in array) { Object.Destroy((Object)(object)val4); } } private static LayerMask GetPredictionLayerMask() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) return LayerMask.op_Implicit(LayerMask.GetMask(new string[4] { "Terrain", "Map", "Default", "Character" })); } private static bool PredictItemImpact(Vector3 startPos, Vector3 throwVelocity, float linearDamping, Item currentItem, out Vector3 impactPoint, out Vector3 impactNormal, out bool predictionSucceeded) { //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_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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_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) //IL_00be: 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_00c8: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: 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_018a: 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_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_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_010b: 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_011e: 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_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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) impactPoint = Vector3.zero; impactNormal = Vector3.zero; predictionSucceeded = false; float fixedDeltaTime = Time.fixedDeltaTime; Vector3 val = startPos; Vector3 val2 = throwVelocity; int num = 500; float num2 = 500f; float num3 = 0f; List list = new List(); list.Add(val); Collider[] componentsInChildren = ((Component)currentItem).GetComponentsInChildren(); Character componentInParent = ((Component)currentItem).GetComponentInParent(); Collider[] array = (Collider[])(((object)((componentInParent != null) ? ((Component)componentInParent).GetComponentsInChildren() : null)) ?? ((object)new Collider[0])); Frisbee component = ((Component)currentItem).GetComponent(); Antigrav component2 = ((Component)currentItem).GetComponent(); Rigidbody component3 = ((Component)currentItem).GetComponent(); RaycastHit val7 = default(RaycastHit); for (int i = 0; i < num; i++) { Vector3 val3 = Physics.gravity; if ((Object)(object)component2 != (Object)null) { val3 -= Physics.gravity * component2.intensity; } val2 += val3 * fixedDeltaTime; if ((Object)(object)component != (Object)null && (Object)(object)component3 != (Object)null) { float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; float num4 = Mathf.InverseLerp(0f, component.velocityForLift, sqrMagnitude); Vector3 up = ((Component)currentItem).transform.up; float num5 = Mathf.Clamp01(Vector3.Dot(up, Vector3.up)); Vector3 val4 = up * num5 * component.liftForce * num4 / component3.mass; val2 += val4 * fixedDeltaTime; } val2 *= 1f - linearDamping * fixedDeltaTime; Vector3 val5 = val + val2 * fixedDeltaTime; Vector3 val6 = val5 - val; Vector3 normalized = ((Vector3)(ref val6)).normalized; float num6 = Vector3.Distance(val, val5); num3 += num6; if (num3 > num2) { lastTrajectoryPoints = list; return true; } if (Physics.Raycast(val, normalized, ref val7, num6, LayerMask.op_Implicit(GetPredictionLayerMask()))) { bool flag = false; Collider[] array2 = componentsInChildren; foreach (Collider val8 in array2) { if ((Object)(object)((RaycastHit)(ref val7)).collider == (Object)(object)val8) { flag = true; break; } } if (!flag) { Collider[] array3 = array; foreach (Collider val9 in array3) { if ((Object)(object)((RaycastHit)(ref val7)).collider == (Object)(object)val9) { flag = true; break; } } } if (!flag) { impactPoint = ((RaycastHit)(ref val7)).point; impactNormal = ((RaycastHit)(ref val7)).normal; list.Add(impactPoint); predictionSucceeded = true; lastTrajectoryPoints = list; return true; } } list.Add(val5); val = val5; if (val.y < startPos.y - 100f) { lastTrajectoryPoints = list; return true; } } lastTrajectoryPoints = list; return true; } private static void VisualizeTrajectorySingleLine(Vector3 impactPoint, Vector3 impactNormal) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_00f5: 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_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_012d: 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_012f: 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_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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_0197: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: 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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Expected O, but got Unknown //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Expected O, but got Unknown //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Expected O, but got Unknown //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: 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_0119: 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_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_005c: 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_008c: Expected O, but got Unknown //IL_00a1: 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) if ((Object)(object)trajectoryVisualization != (Object)null) { Object.Destroy((Object)(object)trajectoryVisualization); } trajectoryVisualization = new GameObject("TrajectoryPreview"); if (Plugin.EnableThrowTrajectory.Value) { LineRenderer val = trajectoryVisualization.AddComponent(); val.positionCount = lastTrajectoryPoints.Count; for (int i = 0; i < lastTrajectoryPoints.Count; i++) { val.SetPosition(i, lastTrajectoryPoints[i]); } ((Renderer)val).material = new Material(Shader.Find("Sprites/Default")); val.startColor = new Color(1f, 1f, 0f, 0.6f); val.endColor = new Color(1f, 1f, 0f, 0.01f); val.startWidth = 0.3f; val.endWidth = 0.1f; } if (Plugin.EnableImpactPoint.Value) { float num = 0.5f; Vector3 val2 = Vector3.Cross(impactNormal, Vector3.up); Vector3 normalized = ((Vector3)(ref val2)).normalized; if (((Vector3)(ref normalized)).magnitude < 0.1f) { val2 = Vector3.Cross(impactNormal, Vector3.right); normalized = ((Vector3)(ref val2)).normalized; } val2 = Vector3.Cross(normalized, impactNormal); Vector3 normalized2 = ((Vector3)(ref val2)).normalized; GameObject val3 = new GameObject("XLine1"); val3.transform.parent = trajectoryVisualization.transform; LineRenderer val4 = val3.AddComponent(); val4.positionCount = 2; val4.SetPosition(0, impactPoint - normalized * num - normalized2 * num); val4.SetPosition(1, impactPoint + normalized * num + normalized2 * num); ((Renderer)val4).material = new Material(Shader.Find("Sprites/Default")); val4.startColor = new Color(1f, 0f, 0f, 0.8f); val4.endColor = new Color(1f, 0f, 0f, 0.8f); val4.startWidth = 0.2f; val4.endWidth = 0.2f; GameObject val5 = new GameObject("XLine2"); val5.transform.parent = trajectoryVisualization.transform; LineRenderer val6 = val5.AddComponent(); val6.positionCount = 2; val6.SetPosition(0, impactPoint + normalized * num - normalized2 * num); val6.SetPosition(1, impactPoint - normalized * num + normalized2 * num); ((Renderer)val6).material = new Material(Shader.Find("Sprites/Default")); val6.startColor = new Color(1f, 0f, 0f, 0.8f); val6.endColor = new Color(1f, 0f, 0f, 0.8f); val6.startWidth = 0.2f; val6.endWidth = 0.2f; } } private static void SetItemTransparency(Item item) { Renderer[] componentsInChildren = ((Component)item).GetComponentsInChildren(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { val.enabled = false; } } private static void RestoreItemTransparency(Item item) { Renderer[] componentsInChildren = ((Component)item).GetComponentsInChildren(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { val.enabled = true; } } } [HarmonyPatch(typeof(MagicBean), "Update")] public static class MagicBeanActualVinePredictionPatch { private static GameObject actualVineVisualization; public static void Postfix(MagicBean __instance) { if (Plugin.EnableActualVine.Value && ((MonoBehaviourPun)__instance).photonView.IsMine) { if (__instance.isPlanted && __instance.timeToPlant > 0f) { ShowActualVinePrediction(__instance); } else if ((Object)(object)actualVineVisualization != (Object)null) { Object.Destroy((Object)(object)actualVineVisualization); actualVineVisualization = null; } } } private static void ShowActualVinePrediction(MagicBean magicBean) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0051: 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_007c: 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_00f7: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)actualVineVisualization != (Object)null) { Object.Destroy((Object)(object)actualVineVisualization); } actualVineVisualization = new GameObject("ActualVinePrediction"); Vector3 averageNormal = magicBean.averageNormal; float vineDistance = magicBean.GetVineDistance(((Component)magicBean).transform.position, averageNormal); GameObject val = Object.Instantiate(((Component)magicBean.plantPrefab).gameObject, ((Component)magicBean).transform.position, Quaternion.identity); val.transform.parent = actualVineVisualization.transform; val.transform.up = averageNormal; MagicBeanVine component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.maxLength = vineDistance; component.growingSpeed = 0f; component.currentLength = vineDistance; component.Grow(); } Transform val2 = val.transform.Find("VineOrigin/Stalk"); if ((Object)(object)val2 != (Object)null) { Renderer component2 = ((Component)val2).GetComponent(); if ((Object)(object)component2 != (Object)null) { Material val3 = new Material(Shader.Find("Scouts/ItemPreview")); val3.renderQueue = 3021; val3.SetColor("_Tint", new Color(1f, 1f, 0f, 0f)); val3.SetColor("_Color0", Color.yellow); val3.SetFloat("_PhongTessStrength", 0.5f); val3.SetFloat("_MaxTessellation", 16f); val3.SetFloat("_TessMinDistance", 10f); val3.SetFloat("_TessMaxDistance", 25f); val3.SetFloat("_EdgeLength", 16f); val3.SetFloat("_MaxDisplacement", 25f); val3.doubleSidedGI = false; component2.material = val3; } } Collider[] componentsInChildren = val.GetComponentsInChildren(); Collider[] array = componentsInChildren; foreach (Collider val4 in array) { Object.Destroy((Object)(object)val4); } } } } [BepInPlugin("my.pahsiv.MyPrevision", "MyPrevision", "0.1.0")] public class Plugin : BaseUnityPlugin { public static ConfigEntry EnableThrowTrajectory; public static ConfigEntry EnableImpactPoint; public static ConfigEntry HideItemInHand; public static ConfigEntry EnablePredictionVine; public static ConfigEntry EnableActualVine; public const string Id = "my.pahsiv.MyPrevision"; internal static ManualLogSource Log { get; private set; } public static Plugin? Instance { get; private set; } public static string Name => "MyPrevision"; public static string Version => "0.1.0"; private void Awake() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Instance = this; Log.LogColorM(" Plugin " + Name + " " + Version + " is loading..."); Harmony val = new Harmony("my.pahsiv.MyPrevision"); val.PatchAll(); BindConfig(); Log.LogColorC(" Plugin " + Name + " " + Version + " is loaded!"); } private void BindConfig() { EnableThrowTrajectory = ((BaseUnityPlugin)this).Config.Bind("General", "Enable Throw Trajectory", true, "Enable or disable the predicted throw trajectory."); EnableImpactPoint = ((BaseUnityPlugin)this).Config.Bind("General", "Enable Impact Point", true, "Enable or disable the predicted item impact point. (The red X)"); HideItemInHand = ((BaseUnityPlugin)this).Config.Bind("General", "Hide Item In Hand", true, "Hide the item in hand during throw for better visibility."); EnablePredictionVine = ((BaseUnityPlugin)this).Config.Bind("General", "Enable Prediction Vine", true, "Enable or disable the pre-throw prediction of estimated vine."); EnableActualVine = ((BaseUnityPlugin)this).Config.Bind("General", "Enable Actual Vine", true, "Enable or disable the post-landing prediction of actual vine."); } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ConstantExpectedAttribute : Attribute { public object? Min { get; set; } public object? Max { get; set; } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ExperimentalAttribute : Attribute { public string DiagnosticId { get; } public string? UrlFormat { get; set; } public ExperimentalAttribute(string diagnosticId) { DiagnosticId = diagnosticId; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SetsRequiredMembersAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class StringSyntaxAttribute : Attribute { public const string CompositeFormat = "CompositeFormat"; public const string DateOnlyFormat = "DateOnlyFormat"; public const string DateTimeFormat = "DateTimeFormat"; public const string EnumFormat = "EnumFormat"; public const string GuidFormat = "GuidFormat"; public const string Json = "Json"; public const string NumericFormat = "NumericFormat"; public const string Regex = "Regex"; public const string TimeOnlyFormat = "TimeOnlyFormat"; public const string TimeSpanFormat = "TimeSpanFormat"; public const string Uri = "Uri"; public const string Xml = "Xml"; public string Syntax { get; } public object?[] Arguments { get; } public StringSyntaxAttribute(string syntax) { Syntax = syntax; Arguments = new object[0]; } public StringSyntaxAttribute(string syntax, params object?[] arguments) { Syntax = syntax; Arguments = arguments; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class UnscopedRefAttribute : Attribute { } } namespace System.Runtime.Versioning { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiresPreviewFeaturesAttribute : Attribute { public string? Message { get; } public string? Url { get; set; } public RequiresPreviewFeaturesAttribute() { } public RequiresPreviewFeaturesAttribute(string? message) { Message = message; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CallerArgumentExpressionAttribute : Attribute { public string ParameterName { get; } public CallerArgumentExpressionAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CollectionBuilderAttribute : Attribute { public Type BuilderType { get; } public string MethodName { get; } public CollectionBuilderAttribute(Type builderType, string methodName) { BuilderType = builderType; MethodName = methodName; } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CompilerFeatureRequiredAttribute : Attribute { public const string RefStructs = "RefStructs"; public const string RequiredMembers = "RequiredMembers"; public string FeatureName { get; } public bool IsOptional { get; set; } public CompilerFeatureRequiredAttribute(string featureName) { FeatureName = featureName; } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute { public string[] Arguments { get; } public InterpolatedStringHandlerArgumentAttribute(string argument) { Arguments = new string[1] { argument }; } public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) { Arguments = arguments; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal static class IsExternalInit { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ModuleInitializerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class OverloadResolutionPriorityAttribute : Attribute { public int Priority { get; } public OverloadResolutionPriorityAttribute(int priority) { Priority = priority; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)] [ExcludeFromCodeCoverage] internal sealed class ParamCollectionAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiredMemberAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal sealed class RequiresLocationAttribute : Attribute { } [AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SkipLocalsInitAttribute : Attribute { } }