Decompiled source of ThrowAssist v1.1.0
ThrowAssist.dll
Decompiled 12 hours 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.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using FistVR; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: AssemblyCompany("ThrowAssist")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+3eb5b45993fa3191d9bba50b60af68f72c6aea1e")] [assembly: AssemblyProduct("ThrowAssist")] [assembly: AssemblyTitle("ThrowAssist")] [assembly: AssemblyVersion("1.0.0.0")] namespace ThrowAssist; public static class Patches { public static void Apply(Harmony harmony) { MethodInfo target = AccessTools.Method(typeof(FVRPhysicalObject), "EndInteraction", new Type[1] { typeof(FVRViveHand) }, (Type[])null); MethodInfo target2 = AccessTools.Method(typeof(MeleeParams), "MeleeEndInteraction", new Type[1] { typeof(FVRViveHand) }, (Type[])null); MethodInfo target3 = AccessTools.Method(typeof(Sosig), "Start", (Type[])null, (Type[])null); MethodInfo target4 = AccessTools.Method(typeof(Sosig), "SosigDies", (Type[])null, (Type[])null); Patch(harmony, target, "FVRPhysicalObject.EndInteraction", null, "EndInteraction_Postfix"); Patch(harmony, target2, "FVRPhysicalObject.MeleeParams.MeleeEndInteraction", "MeleeEndInteraction_Prefix", null); Patch(harmony, target3, "Sosig.Start", null, "SosigStart_Postfix"); Patch(harmony, target4, "Sosig.SosigDies", null, "SosigDies_Postfix"); } private static void Patch(Harmony harmony, MethodInfo target, string label, string prefixName, string postfixName) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if ((object)target == null) { Plugin.Log.LogError((object)("[ThrowAssist] could not resolve " + label + " - that part of the mod is inactive on this game build.")); return; } try { HarmonyMethod val = ((prefixName == null) ? ((HarmonyMethod)null) : new HarmonyMethod(AccessTools.Method(typeof(Patches), prefixName, (Type[])null, (Type[])null))); HarmonyMethod val2 = ((postfixName == null) ? ((HarmonyMethod)null) : new HarmonyMethod(AccessTools.Method(typeof(Patches), postfixName, (Type[])null, (Type[])null))); harmony.Patch((MethodBase)target, val, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex) { Plugin.Log.LogError((object)("[ThrowAssist] patching " + label + " threw: " + ex)); return; } Patches patchInfo = Harmony.GetPatchInfo((MethodBase)target); int num = patchInfo?.Prefixes.Count ?? 0; int num2 = patchInfo?.Postfixes.Count ?? 0; if (patchInfo != null && (prefixName == null || num > 0) && (postfixName == null || num2 > 0)) { Plugin.Log.LogInfo((object)("[ThrowAssist] patched " + label + " (prefixes=" + num + ", postfixes=" + num2 + ")")); } else { Plugin.Log.LogError((object)("[ThrowAssist] patch did NOT attach to " + label + " - throw assist will not work correctly.")); } } private static void EndInteraction_Postfix(FVRPhysicalObject __instance, FVRViveHand hand) { try { ThrowSolver.OnRelease(__instance, hand); } catch (Exception ex) { Plugin.Log.LogError((object)("[ThrowAssist] throw solve failed: " + ex)); } } private static bool MeleeEndInteraction_Prefix(MeleeParams __instance) { if (!Plugin.Enabled.Value) { return true; } if (!Plugin.SuppressVanillaAutoAim.Value) { return true; } try { if (__instance != null && __instance.GetReadyToAim()) { __instance.SetReadyToAim(false); } } catch (Exception ex) { Plugin.Log.LogError((object)("[ThrowAssist] clearing ready-to-aim failed: " + ex)); } return false; } private static void SosigStart_Postfix(Sosig __instance) { SosigRegistry.Add(__instance); } private static void SosigDies_Postfix(Sosig __instance) { SosigRegistry.Remove(__instance); } } [BepInPlugin("ken.h3vr.throwassist", "Throw Assist", "1.1.0")] [BepInProcess("h3vr.exe")] public class Plugin : BaseUnityPlugin { public const string Guid = "ken.h3vr.throwassist"; public const string Version = "1.1.0"; public static ManualLogSource Log; public static ConfigEntry<bool> Enabled; public static ConfigEntry<bool> SuppressVanillaAutoAim; public static ConfigEntry<string> TargetLayers; public static ConfigEntry<float> CastRadius; public static ConfigEntry<float> MaxRange; public static ConfigEntry<float> MaxAssistAngle; public static ConfigEntry<float> FallbackMaxLookAngle; public static ConfigEntry<bool> RequireLineOfSight; public static ConfigEntry<bool> AssistFriendlies; public static ConfigEntry<float> MinThrowSpeed; public static ConfigEntry<float> MaxSpeedMultiplier; public static ConfigEntry<float> ThrowBoostLight; public static ConfigEntry<float> ThrowBoostHeavy; public static ConfigEntry<float> BoostMassReference; public static ConfigEntry<bool> LeadMovingTargets; public static ConfigEntry<float> LeadConeAngle; public static ConfigEntry<float> LeadStaticSpeed; public static ConfigEntry<float> LeadStaticBonus; public static ConfigEntry<float> LeadAccelHorizon; public static ConfigEntry<float> LeadAverageWindow; public static ConfigEntry<float> LeadMaxSpeed; public static ConfigEntry<float> LeadMaxAccel; public static ConfigEntry<float> LeadMaxDistance; public static ConfigEntry<float> LeadMaxTime; public static ConfigEntry<float> LeadVerticalFactor; public static ConfigEntry<bool> AssistHandguns; public static ConfigEntry<bool> AssistLongGuns; public static ConfigEntry<bool> AssistAmmunition; public static ConfigEntry<bool> AssistMeleeWeapons; public static ConfigEntry<bool> AssistAttachments; public static ConfigEntry<bool> AssistMisc; public static ConfigEntry<string> BlacklistTypes; public static ConfigEntry<string> BlacklistNames; public static ConfigEntry<bool> EnableSpin; public static ConfigEntry<float> MinTimeOfFlightToSpin; public static ConfigEntry<float> MinAngularVelocityToSpin; public static ConfigEntry<float> SpinRate; public static ConfigEntry<float> KnifeOverrotationAngle; public static ConfigEntry<float> SpinLockoutTime; public static ConfigEntry<string> DiscSpinNames; public static ConfigEntry<float> DiscSpinRate; public static ConfigEntry<string> DiscSpinAxis; public static ConfigEntry<bool> DiscSpinStabilise; public static ConfigEntry<bool> SpinStabilise; public static ConfigEntry<float> SpinCorrectWithinTurns; public static ConfigEntry<float> SpinMaxAngularAccel; public static ConfigEntry<float> RollCorrectRate; public static ConfigEntry<bool> DiscSpinInvert; public static ConfigEntry<bool> OrientOnlyMelee; public static ConfigEntry<string> AlwaysSpinNames; public static ConfigEntry<string> SpearNames; public static ConfigEntry<string> ExtraSpinNames; public static ConfigEntry<float> ExtraSpinMultiplier; public static ConfigEntry<string> ExtraRangeNames; public static ConfigEntry<float> ExtraRangeMultiplier; public static ConfigEntry<string> InvertTipNames; public static ConfigEntry<float> SpinTurnsPerMetre; public static ConfigEntry<float> SpinLockoutAngle; public static ConfigEntry<bool> DebugLog; public static ConfigEntry<bool> DebugDrawTrajectory; private static readonly object[] NoTags = (object[])Array.CreateInstance(typeof(object), 0); private static ConfigDescription Desc(string description, AcceptableValueBase acceptableValues) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown return new ConfigDescription(description, acceptableValues, NoTags); } private void Awake() { //IL_07dd: Unknown result type (might be due to invalid IL or missing references) //IL_07e7: Expected O, but got Unknown //IL_0af9: Unknown result type (might be due to invalid IL or missing references) //IL_0b03: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Master switch for throw assist."); SuppressVanillaAutoAim = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "SuppressVanillaAutoAim", true, "Disable H3VR's own straight-line thrown auto-aim so it cannot fight the ballistic solve. Also suppresses a stock null-reference exception in that code path."); TargetLayers = ((BaseUnityPlugin)this).Config.Bind<string>("Targeting", "TargetLayers", "AgentBody,Interactable,AIEntity", "Comma-separated Unity layer names used to find a target by looking at it. Names that do not exist on this build are skipped. If none resolve, targeting falls back to scanning tracked Sosigs by angle, which still works."); CastRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Targeting", "CastRadius", 0.35f, Desc("Radius of the spherecast fired along your look direction. Bigger = more forgiving aim.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 2f))); MaxRange = ((BaseUnityPlugin)this).Config.Bind<float>("Targeting", "MaxRange", 100f, Desc("Maximum assist range in metres.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 300f))); MaxAssistAngle = ((BaseUnityPlugin)this).Config.Bind<float>("Targeting", "MaxAssistAngle", 30f, Desc("How far off-target your actual throw may be and still get assisted, in degrees. This is what decides 'is the player trying to throw at that enemy'. Lower = stricter.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 90f))); FallbackMaxLookAngle = ((BaseUnityPlugin)this).Config.Bind<float>("Targeting", "FallbackMaxLookAngle", 15f, Desc("When the look-cast finds nothing, the mod scans tracked enemies directly. That path has no cast proving you looked at anyone, so it is held to this tighter cone off your view direction. Lower = less likely to grab someone off to the side.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 60f))); AssistFriendlies = ((BaseUnityPlugin)this).Config.Bind<bool>("Targeting", "AssistFriendlies", true, "Assist throws at anyone, including allies and Sosigs sharing your IFF. Set false to only assist throws at hostiles, in which case a throw at a friend is left as pure physics rather than being blocked."); RequireLineOfSight = ((BaseUnityPlugin)this).Config.Bind<bool>("Targeting", "RequireLineOfSight", true, "Require an unobstructed line to the aim point, so you cannot curve a knife through a wall."); MinThrowSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "MinThrowSpeed", 3f, Desc("Release speed below which the throw is treated as a drop and left alone, in m/s.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 20f))); MaxSpeedMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "MaxSpeedMultiplier", 2f, Desc("If your throw is too weak to physically reach the target, the solve may speed it up by at most this factor. 1.0 disables any speed boost.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 5f))); ThrowBoostLight = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "ThrowBoostLight", 1.6f, Desc("Speed multiplier applied to the lightest objects. Small things fly noticeably harder than your hand actually moved.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 4f))); ThrowBoostHeavy = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "ThrowBoostHeavy", 1.05f, Desc("Speed multiplier applied at and above BoostMassReference. Heavy things stay close to the speed you really threw them.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 4f))); BoostMassReference = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "BoostMassReference", 2.5f, Desc("Mass in kg at which the boost has fallen all the way to ThrowBoostHeavy.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 20f))); LeadMovingTargets = ((BaseUnityPlugin)this).Config.Bind<bool>("Targeting", "LeadMovingTargets", true, "Aim at where a moving enemy will be, from its core body's velocity and acceleration, rather than where it stood at the moment of release."); LeadConeAngle = ((BaseUnityPlugin)this).Config.Bind<float>("Targeting", "LeadConeAngle", 60f, Desc("The wider cone used only to notice enemies you are throwing AHEAD of. A led throw must still resolve back inside MaxAssistAngle to count, so this does not make the assist grabbier at stationary targets.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 120f))); LeadStaticSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Targeting", "LeadStaticSpeed", 0.6f, Desc("Core body speed below which an enemy counts as standing still, in m/s.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f))); LeadStaticBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Targeting", "LeadStaticBonus", 20f, Desc("Scoring bonus in degrees given to a stationary enemy, so someone standing still in the middle of your throw beats a runner you merely pointed near.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 90f))); LeadAccelHorizon = ((BaseUnityPlugin)this).Config.Bind<float>("Targeting", "LeadAccelHorizon", 0.35f, Desc("How far ahead acceleration is trusted, in seconds. Extrapolating a turn or a stumble further than this produces wild aim points.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f))); LeadAverageWindow = ((BaseUnityPlugin)this).Config.Bind<float>("Targeting", "LeadAverageWindow", 1.5f, Desc("Seconds of core-body movement averaged together to work out which way an enemy is actually travelling. A walk cycle throws the core forward and back with every stride, far faster than the character really moves, so a short window measures the animation rather than the travel. Longer is steadier but slower to notice a change of direction.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f))); LeadMaxSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Targeting", "LeadMaxSpeed", 7f, Desc("Fastest core-body speed the lead will believe, in m/s. Ragdolls and respawns move the body far in one step and would otherwise read as enormous velocity.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 30f))); LeadMaxAccel = ((BaseUnityPlugin)this).Config.Bind<float>("Targeting", "LeadMaxAccel", 12f, Desc("Largest acceleration the lead will believe, in m/s squared.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f))); LeadMaxDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Targeting", "LeadMaxDistance", 4f, Desc("Furthest ahead of itself a target may be aimed, in metres. This is the stop on the prediction running away with itself.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f))); LeadMaxTime = ((BaseUnityPlugin)this).Config.Bind<float>("Targeting", "LeadMaxTime", 2f, Desc("Longest flight time the lead will predict over, in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f))); LeadVerticalFactor = ((BaseUnityPlugin)this).Config.Bind<float>("Targeting", "LeadVerticalFactor", 0f, Desc("How much of the target's VERTICAL motion to lead on. A walking Sosig's core bobs with its animation, and leading on that sends the throw over its head, so this is off by default. Raise it only if you want jumping enemies led.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f))); AssistHandguns = ((BaseUnityPlugin)this).Config.Bind<bool>("Eligibility", "AssistHandguns", true, "Assist thrown pistols and revolvers."); AssistLongGuns = ((BaseUnityPlugin)this).Config.Bind<bool>("Eligibility", "AssistLongGuns", true, "Assist thrown rifles, shotguns, SMGs and any other long gun."); AssistAmmunition = ((BaseUnityPlugin)this).Config.Bind<bool>("Eligibility", "AssistAmmunition", true, "Assist thrown magazines, clips, loose rounds and speedloaders."); AssistMeleeWeapons = ((BaseUnityPlugin)this).Config.Bind<bool>("Eligibility", "AssistMeleeWeapons", true, "Assist thrown melee weapons: knives, shurikens, axes and the like."); AssistAttachments = ((BaseUnityPlugin)this).Config.Bind<bool>("Eligibility", "AssistAttachments", false, "Assist detached attachments, including attachable melee weapons such as bayonets."); AssistMisc = ((BaseUnityPlugin)this).Config.Bind<bool>("Eligibility", "AssistMisc", true, "Assist everything else: props, tools, pencils, hotdogs."); BlacklistTypes = ((BaseUnityPlugin)this).Config.Bind<string>("Eligibility", "BlacklistTypes", "", "Comma-separated class names never assisted, whatever their category is set to. Base classes count, so one entry can exclude a whole family (e.g. 'Revolver' or 'FVRFireArmMagazine'). Live explosives are always blocked and need no entry here."); BlacklistNames = ((BaseUnityPlugin)this).Config.Bind<string>("Eligibility", "BlacklistNames", "", "Comma-separated substrings matched against the thrown object's name, for excluding one specific item rather than a whole class."); EnableSpin = ((BaseUnityPlugin)this).Config.Bind<bool>("Spin", "EnableSpin", true, "Give knife-like throwables a whole number of rotations across the flight, landing tip-first."); MinTimeOfFlightToSpin = ((BaseUnityPlugin)this).Config.Bind<float>("Spin", "MinTimeOfFlightToSpin", 0.35f, Desc("Flights shorter than this fly straight instead of spinning, in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f))); MinAngularVelocityToSpin = ((BaseUnityPlugin)this).Config.Bind<float>("Spin", "MinAngularVelocityToSpin", 2f, Desc("Minimum hand angular speed at release before a spin throw is used, in rad/s. A flat push-throw stays straight; a flick spins.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f))); SpinRate = ((BaseUnityPlugin)this).Config.Bind<float>("Spin", "SpinRate", 2f, Desc("Target rotations per second, rounded to a whole number of turns over the flight.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 8f))); KnifeOverrotationAngle = ((BaseUnityPlugin)this).Config.Bind<float>("Spin", "KnifeOverrotationAngle", 8f, Desc("Extra rotation past flat at impact so the tip bites instead of glancing, in degrees.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-45f, 45f))); SpinLockoutTime = ((BaseUnityPlugin)this).Config.Bind<float>("Spin", "SpinLockoutTime", 0.12f, Desc("Seconds before predicted impact at which spin is cancelled and the object is snapped tip-forward. This is the safety net that guarantees the stab angle check passes.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.5f))); DiscSpinNames = ((BaseUnityPlugin)this).Config.Bind<string>("Spin", "DiscSpinNames", "Shuriken", "Comma-separated name substrings for throwables that fly like a disc rather than point first. These spin flat about their own face normal and are never turned tip-forward in flight."); DiscSpinRate = ((BaseUnityPlugin)this).Config.Bind<float>("Spin", "DiscSpinRate", 6f, Desc("Flat spin rate for disc throwables, in rotations per second. A harder flick than this keeps its own faster spin.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f))); DiscSpinAxis = ((BaseUnityPlugin)this).Config.Bind<string>("Spin", "DiscSpinAxis", "Auto", new ConfigDescription("Local axis a disc spins about. Auto picks the thinnest axis of the mesh, which is the face normal of a flat plate.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[4] { "Auto", "Forward", "Up", "Right" }), NoTags)); DiscSpinStabilise = ((BaseUnityPlugin)this).Config.Bind<bool>("Spin", "DiscSpinStabilise", true, "Re-assert the flat spin every physics step so drag and glancing contacts cannot degrade it into a wobble."); SpinCorrectWithinTurns = ((BaseUnityPlugin)this).Config.Bind<float>("Spin", "SpinCorrectWithinTurns", 3f, Desc("How close to impact the spin starts being trimmed, measured in rotations still to go. Above this the throw is left entirely alone. Lower is more faithful to your throw but has less room to land the edge correctly.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 10f))); SpinMaxAngularAccel = ((BaseUnityPlugin)this).Config.Bind<float>("Spin", "SpinMaxAngularAccel", 40f, Desc("How hard the spin may be sped up or slowed to land edge-first, in rad/s per second. Low values look natural but may not converge in time.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(2f, 400f))); RollCorrectRate = ((BaseUnityPlugin)this).Config.Bind<float>("Spin", "RollCorrectRate", 120f, Desc("How fast the blade is rolled square to its direction of travel, in degrees per second, so it arrives edge-on rather than flat-on. Rate limited, never a snap. Zero disables it.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 720f))); SpinStabilise = ((BaseUnityPlugin)this).Config.Bind<bool>("Spin", "SpinStabilise", true, "Hold a spinning melee weapon on its intended axis during flight. A rigidbody spun about anything but a principal axis precesses, which looks like a wobble even when the solve was right."); DiscSpinInvert = ((BaseUnityPlugin)this).Config.Bind<bool>("Spin", "DiscSpinInvert", false, "Flip which way discs spin, if the boost comes out backwards for your throw style."); OrientOnlyMelee = ((BaseUnityPlugin)this).Config.Bind<bool>("Spin", "OrientOnlyMelee", true, "Only melee weapons get their landing orientation controlled. Guns, magazines and props keep their natural tumble instead of arrowing stock-first into the target."); AlwaysSpinNames = ((BaseUnityPlugin)this).Config.Bind<string>("Spin", "AlwaysSpinNames", "Tomahawk,Hatchet,Axe,Cleaver,Kukri,Sickle,Billhook,Pickaxe,Bardiche,Mace,Warhammer,Hammer,Sledge,Mallet,Crowbar,PipeWrench,Wrench,CircleSaw", "Weapons whose edge or mass sits out to the side of the shaft, so they have to arrive mid-swing to land on the head rather than the handle. These always spin end over end and are never thrown straight, whatever the flight time or flick."); SpearNames = ((BaseUnityPlugin)this).Config.Bind<string>("Spin", "SpearNames", "Katana,Rapier,Estoc,Claymore,Espadon,Falchion,Flameberg,Grossmesser,Katzbalger,Zweihander,Gladius,Pilum,Cutlass,Machete,Kabartana,LaserSword,LongSword,BastardSword,ArmingSword,Pitchfork,Pencil,Screwdriver,Scraper", "Long blades with the point on the axis, and anything else that should fly like a javelin. These never spin - they are turned point-forward and held there."); ExtraSpinNames = ((BaseUnityPlugin)this).Config.Bind<string>("Spin", "ExtraSpinNames", "Karambit", "Weapons that get their spin multiplied by ExtraSpinMultiplier, for things that should whirl rather than tumble."); ExtraSpinMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Spin", "ExtraSpinMultiplier", 2.5f, Desc("Turn multiplier applied to anything matching ExtraSpinNames.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 6f))); ExtraRangeNames = ((BaseUnityPlugin)this).Config.Bind<string>("Targeting", "ExtraRangeNames", "Tomahawk,Hatchet,Axe", "Weapons that get their assist range multiplied by ExtraRangeMultiplier, for heavy throws that carry further than the default range allows."); ExtraRangeMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Targeting", "ExtraRangeMultiplier", 1.75f, Desc("Range multiplier applied to anything matching ExtraRangeNames.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 4f))); InvertTipNames = ((BaseUnityPlugin)this).Config.Bind<string>("Spin", "InvertTipNames", "Tomahawk,Hatchet,Axe", "Comma-separated name substrings whose leading end is backwards - use this if something lands handle-first. Check the log line 'orientation: ... tipRef=...' to see what the mod thinks the pointy end is."); SpinTurnsPerMetre = ((BaseUnityPlugin)this).Config.Bind<float>("Spin", "SpinTurnsPerMetre", 0.15f, Desc("Whole rotations per metre of throw distance, so a close toss makes one clean flip and a long throw makes several. Always at least one turn.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 2f))); SpinLockoutAngle = ((BaseUnityPlugin)this).Config.Bind<float>("Spin", "SpinLockoutAngle", 25f, Desc("At the lockout moment, only correct the orientation if the leading edge is further off the travel direction than this. Stops a throw that was already landing correctly from visibly snapping.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 90f))); DebugLog = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "DebugLog", false, "Log every assisted throw: target, aim point, flight time, solved speed."); DebugDrawTrajectory = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "DebugDrawTrajectory", false, "Draw the solved arc and aim point with Debug.DrawLine (visible in a scene-view capture, not in HMD)."); ((Component)this).gameObject.AddComponent<SosigMotion>(); Patches.Apply(new Harmony("ken.h3vr.throwassist")); Log.LogInfo((object)"Throw Assist 1.1.0 loaded."); } } public class SosigMotion : MonoBehaviour { private struct Frame { public Vector3 Position; public float Time; } private class Track { public readonly List<Frame> Frames = new List<Frame>(); public Vector3 Velocity; public Vector3 Acceleration; public bool Primed; } private const int MaxFrames = 256; private static readonly Dictionary<Sosig, Track> Tracks = new Dictionary<Sosig, Track>(); private static readonly List<Sosig> Scratch = new List<Sosig>(); private static readonly List<Sosig> Dead = new List<Sosig>(); public static Vector3 CorePosition(Sosig s) { //IL_0009: 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_0044: 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) if ((Object)(object)s == (Object)null) { return Vector3.zero; } if ((Object)(object)s.CoreRB != (Object)null) { return s.CoreRB.position; } if ((Object)(object)s.CoreTarget != (Object)null) { return s.CoreTarget.position; } return s.GetMostRelevantPoint(); } public static bool TryGet(Sosig s, out Vector3 velocity, out Vector3 acceleration) { //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_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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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) velocity = Vector3.zero; acceleration = Vector3.zero; if ((Object)(object)s == (Object)null) { return false; } if (!Tracks.TryGetValue(s, out var value) || !value.Primed) { return false; } velocity = value.Velocity; acceleration = value.Acceleration; return true; } public static float Speed(Sosig s) { if (!TryGet(s, out var velocity, out var _)) { return 0f; } return ((Vector3)(ref velocity)).magnitude; } public static Vector3 PredictCore(Sosig s, float t) { //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_0026: 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_0032: 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_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_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_0057: 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_005e: 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_0061: 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) Vector3 val = CorePosition(s); if (!TryGet(s, out var velocity, out var acceleration)) { return val; } float num = Mathf.Min(t, Plugin.LeadAccelHorizon.Value); Vector3 val2 = velocity * t + 0.5f * acceleration * num * num; val2 = Vector3.ClampMagnitude(val2, Plugin.LeadMaxDistance.Value); return val + val2; } private static Vector3 MeanVelocity(Frame from, Frame to) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) float num = to.Time - from.Time; if (num < 0.0001f) { return Vector3.zero; } Vector3 val = (to.Position - from.Position) / num; val.y *= Plugin.LeadVerticalFactor.Value; return Vector3.ClampMagnitude(val, Plugin.LeadMaxSpeed.Value); } private void FixedUpdate() { //IL_007b: 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_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_00b0: 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_00b9: 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_0105: 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) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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_0269: 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_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: 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_02d4: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; float num = Mathf.Max(Plugin.LeadAverageWindow.Value, 0.05f); Scratch.Clear(); List<Sosig> all = SosigRegistry.GetAll(); Frame item = default(Frame); for (int i = 0; i < all.Count; i++) { Sosig val = all[i]; if ((Object)(object)val == (Object)null) { continue; } Scratch.Add(val); if (!Tracks.TryGetValue(val, out var value)) { value = new Track(); Tracks[val] = value; } Vector3 val2 = CorePosition(val); if (value.Frames.Count > 0) { Frame frame = value.Frames[value.Frames.Count - 1]; Vector3 val3 = val2 - frame.Position; float magnitude = ((Vector3)(ref val3)).magnitude; float num2 = Plugin.LeadMaxSpeed.Value * Mathf.Max(time - frame.Time, 0.0001f) * 4f + 0.5f; if (magnitude > num2) { value.Frames.Clear(); value.Velocity = Vector3.zero; value.Acceleration = Vector3.zero; value.Primed = false; } } item.Position = val2; item.Time = time; value.Frames.Add(item); float num3 = time - num; int j; for (j = 0; j < value.Frames.Count - 1 && value.Frames[j].Time < num3; j++) { } if (j > 0) { value.Frames.RemoveRange(0, j); } if (value.Frames.Count > 256) { value.Frames.RemoveRange(0, value.Frames.Count - 256); } Frame frame2 = value.Frames[0]; Frame to = value.Frames[value.Frames.Count - 1]; float num4 = to.Time - frame2.Time; if (value.Frames.Count < 3 || num4 < Mathf.Min(0.2f, num * 0.5f)) { value.Primed = false; continue; } value.Velocity = MeanVelocity(frame2, to); int index = value.Frames.Count / 2; Vector3 val4 = MeanVelocity(value.Frames[0], value.Frames[index]); Vector3 val5 = MeanVelocity(value.Frames[index], value.Frames[value.Frames.Count - 1]); float num5 = Mathf.Max(num4 * 0.5f, 0.0001f); value.Acceleration = Vector3.ClampMagnitude((val5 - val4) / num5, Plugin.LeadMaxAccel.Value); value.Primed = true; } if (Tracks.Count <= Scratch.Count) { return; } Dead.Clear(); foreach (KeyValuePair<Sosig, Track> track in Tracks) { if ((Object)(object)track.Key == (Object)null || !Scratch.Contains(track.Key)) { Dead.Add(track.Key); } } for (int k = 0; k < Dead.Count; k++) { Tracks.Remove(Dead[k]); } } } public static class SosigRegistry { private static readonly List<Sosig> Live = new List<Sosig>(); public static void Add(Sosig s) { if (!((Object)(object)s == (Object)null) && !Live.Contains(s)) { Live.Add(s); } } public static void Remove(Sosig s) { if (!((Object)(object)s == (Object)null)) { Live.Remove(s); } } public static List<Sosig> GetAll() { for (int num = Live.Count - 1; num >= 0; num--) { if ((Object)(object)Live[num] == (Object)null) { Live.RemoveAt(num); } } return Live; } public static void Clear() { Live.Clear(); } } public class ThrowAssistFlight : MonoBehaviour { private const float StraightSlerpRate = 18.5f; private const float LockoutSlerpRate = 12f; private const float LingerAfterFlight = 0.75f; private const float DiscHoldSeconds = 5f; private FVRPhysicalObject _obj; private Rigidbody _rb; private Transform _tipRef; private bool _invert; private bool _spinning; private float _flightTime; private float _startTime; private bool _hadLongThrowable; private bool _longThrowableSuppressed; private bool _spinCancelled; private bool _active; private bool _discMode; private Vector3 _discAxisLocal; private float _discSpeed; private bool _discStabilise; private Vector3 _spinAxis; private float _spinSpeed; private bool _spinLock; private Vector3 _tipLocal; private Vector3 _flatLocal; public void Begin(FVRPhysicalObject obj, Transform tipRef, bool invert, float flightTime, bool spinning, Vector3 spinAxis) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_006e: Unknown result type (might be due to invalid IL or missing references) RestoreLongThrowable(); _obj = obj; _rb = (((Object)(object)obj != (Object)null) ? obj.RootRigidbody : null); _tipRef = tipRef; _invert = invert; _spinning = spinning; _spinLock = false; _spinAxis = spinAxis; _spinSpeed = (((Object)(object)_rb != (Object)null && spinning) ? Vector3.Dot(_rb.angularVelocity, spinAxis) : 0f); _discMode = false; _flightTime = flightTime; _startTime = Time.time; _spinCancelled = false; _active = true; if ((Object)(object)_obj != (Object)null && _obj.MP != null) { _hadLongThrowable = _obj.MP.IsLongThrowable; _obj.MP.IsLongThrowable = false; _longThrowableSuppressed = true; } } public void BeginDisc(FVRPhysicalObject obj, Vector3 axisLocal, float speed, bool stabilise) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) RestoreLongThrowable(); _obj = obj; _rb = (((Object)(object)obj != (Object)null) ? obj.RootRigidbody : null); _tipRef = null; _spinning = false; _spinCancelled = false; _discMode = true; _spinLock = false; _discAxisLocal = axisLocal; _discSpeed = speed; _discStabilise = stabilise; _flightTime = 0f; _startTime = Time.time; _active = true; if ((Object)(object)_obj != (Object)null && _obj.MP != null) { _hadLongThrowable = _obj.MP.IsLongThrowable; _obj.MP.IsLongThrowable = false; _longThrowableSuppressed = true; } } public void BeginSpinLock(FVRPhysicalObject obj, Transform tipRef, bool invert, Vector3 tipLocal, Vector3 flatLocal, Vector3 axis, float flightTime) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0044: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) RestoreLongThrowable(); _obj = obj; _rb = (((Object)(object)obj != (Object)null) ? obj.RootRigidbody : null); _tipRef = tipRef; _invert = invert; _tipLocal = tipLocal; _flatLocal = flatLocal; _spinAxis = axis; _spinSpeed = (((Object)(object)_rb != (Object)null) ? Vector3.Dot(_rb.angularVelocity, axis) : 0f); _flightTime = flightTime; _startTime = Time.time; _spinning = true; _spinLock = true; _spinCancelled = false; _discMode = false; _active = true; if ((Object)(object)_obj != (Object)null && _obj.MP != null) { _hadLongThrowable = _obj.MP.IsLongThrowable; _obj.MP.IsLongThrowable = false; _longThrowableSuppressed = true; } } private static float ForwardAngleAbout(Vector3 from, Vector3 to, Vector3 axis) { //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_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) //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_0032: 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_0040: 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_0042: 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) Vector3 val = Vector3.ProjectOnPlane(from, axis); Vector3 val2 = Vector3.ProjectOnPlane(to, axis); if (((Vector3)(ref val)).sqrMagnitude < 1E-06f || ((Vector3)(ref val2)).sqrMagnitude < 1E-06f) { return -1f; } float num = Vector3.Angle(val, val2) * ((float)Math.PI / 180f); if (Vector3.Dot(Vector3.Cross(val, val2), axis) < 0f) { num = (float)Math.PI * 2f - num; } return num; } private bool SpinLockStep(float elapsed) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_0081: 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_008a: 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_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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_0113: 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_00dc: 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_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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_0103: 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_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) float num = _flightTime - elapsed; if (num <= 0.03f) { return false; } Vector3 velocity = _rb.velocity; if (((Vector3)(ref velocity)).sqrMagnitude < 0.01f) { return true; } float num2 = Vector3.Dot(_rb.angularVelocity, _spinAxis); if (num2 < 0.2f) { return true; } Vector3 val = velocity + Physics.gravity * num; Vector3 normalized = ((Vector3)(ref val)).normalized; val = ((Component)_obj).transform.TransformDirection(_flatLocal); Vector3 normalized2 = ((Vector3)(ref val)).normalized; Vector3 val2 = Vector3.ProjectOnPlane(normalized2, ((Vector3)(ref velocity)).normalized); if (((Vector3)(ref val2)).sqrMagnitude > 1E-05f) { ((Vector3)(ref val2)).Normalize(); float num3 = Vector3.Angle(normalized2, val2); if (num3 > 0.5f) { float num4 = Mathf.Min(num3, Plugin.RollCorrectRate.Value * Time.fixedDeltaTime); val = Vector3.Cross(normalized2, val2); Quaternion val3 = Quaternion.AngleAxis(num4, ((Vector3)(ref val)).normalized); _rb.MoveRotation(val3 * _rb.rotation); } _spinAxis = val2; } val = ((Component)_obj).transform.TransformDirection(_tipLocal); float num5 = ForwardAngleAbout(((Vector3)(ref val)).normalized, normalized, _spinAxis); if (num5 < 0f) { return true; } if (num2 * num / ((float)Math.PI * 2f) > Plugin.SpinCorrectWithinTurns.Value) { if (Plugin.SpinStabilise.Value) { _rb.angularVelocity = _spinAxis * num2; } return true; } int num6 = Mathf.RoundToInt((num2 * num - num5) / ((float)Math.PI * 2f)); if (num6 < 0) { num6 = 0; } float num7 = (num5 + (float)num6 * 2f * (float)Math.PI) / num; float num8 = Plugin.SpinMaxAngularAccel.Value * Time.fixedDeltaTime; float num9 = Mathf.MoveTowards(num2, num7, num8); if (num9 > _rb.maxAngularVelocity) { num9 = _rb.maxAngularVelocity; } if (num9 < 0.2f) { num9 = 0.2f; } _rb.angularVelocity = _spinAxis * num9; return true; } private void FixedUpdate() { //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00c9: 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_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_0198: 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_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: 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_01b2: 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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_0214: 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_021b: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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_022c: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_022f: 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_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: 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_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) if (!_active) { return; } if ((Object)(object)_obj == (Object)null || (Object)(object)_rb == (Object)null || ((Object)(object)_tipRef == (Object)null && !_discMode)) { Finish(); return; } if (((FVRInteractiveObject)_obj).IsHeld || _rb.isKinematic || (Object)(object)_obj.QuickbeltSlot != (Object)null) { Finish(); return; } float num = Time.time - _startTime; if (_discMode) { if (num > 5f) { Finish(); } else if (_discStabilise) { Vector3 val = ((Component)_obj).transform.TransformDirection(_discAxisLocal); Vector3 normalized = ((Vector3)(ref val)).normalized; _rb.angularVelocity = normalized * _discSpeed; } return; } if (num > _flightTime + 0.75f) { Finish(); return; } if (_spinLock) { if (!SpinLockStep(num)) { Finish(); } return; } Vector3 velocity = _rb.velocity; if (((Vector3)(ref velocity)).sqrMagnitude < 0.01f) { return; } Vector3 normalized2 = ((Vector3)(ref velocity)).normalized; float num2; if (_spinning && !_spinCancelled) { if (_flightTime - num > Plugin.SpinLockoutTime.Value) { if (Plugin.SpinStabilise.Value && ((Vector3)(ref _spinAxis)).sqrMagnitude > 0.0001f) { _rb.angularVelocity = _spinAxis * _spinSpeed; } return; } Vector3 val2 = _tipRef.forward; if (_invert) { val2 = -val2; } if (Vector3.Angle(val2, normalized2) <= Plugin.SpinLockoutAngle.Value) { Finish(); return; } _rb.angularVelocity = Vector3.zero; _spinCancelled = true; num2 = 12f; } else { num2 = (_spinCancelled ? 12f : 18.5f); } Vector3 val3 = _tipRef.forward; if (_invert) { val3 = -val3; } if (!(((Vector3)(ref val3)).sqrMagnitude < 0.0001f)) { Quaternion val4 = Quaternion.FromToRotation(val3, normalized2) * _rb.rotation; _rb.MoveRotation(Quaternion.Slerp(_rb.rotation, val4, Time.deltaTime * num2)); } } private void OnCollisionEnter(Collision collision) { Finish(); } private void RestoreLongThrowable() { if (_longThrowableSuppressed) { if ((Object)(object)_obj != (Object)null && _obj.MP != null) { _obj.MP.IsLongThrowable = _hadLongThrowable; } _longThrowableSuppressed = false; } } private void Finish() { _active = false; RestoreLongThrowable(); Object.Destroy((Object)(object)this); } private void OnDestroy() { RestoreLongThrowable(); } } public static class ThrowSolver { private struct Candidate { public Sosig Sosig; public Vector3 AimPoint; public Vector3 SegmentOffset; public float Distance; public float Score; public bool Static; } private const int MaxSolveAttempts = 12; private static int _cachedMask; private static string _cachedMaskSource; private static void T(string msg) { if (Plugin.DebugLog.Value) { Plugin.Log.LogInfo((object)("[TA] " + msg)); } } public unsafe static void OnRelease(FVRPhysicalObject obj, FVRViveHand hand) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: 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_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_05d8: Unknown result type (might be due to invalid IL or missing references) //IL_05de: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.Enabled.Value) { return; } if ((Object)(object)obj == (Object)null || (Object)(object)hand == (Object)null) { T("release: null obj/hand"); return; } T("release: " + ((Object)obj).name + " (" + ((object)obj).GetType().Name + ")"); Rigidbody rootRigidbody = obj.RootRigidbody; if ((Object)(object)rootRigidbody == (Object)null) { T(" bail: no RootRigidbody"); return; } if (rootRigidbody.isKinematic) { T(" bail: rigidbody kinematic"); return; } if ((Object)(object)obj.QuickbeltSlot != (Object)null) { T(" bail: in quickbelt slot"); return; } if (((FVRInteractiveObject)obj).IsHeld) { T(" bail: still held"); return; } if (!IsEligible(obj)) { T(" bail: type not eligible"); return; } Vector3 val = rootRigidbody.velocity; Vector3 velLinearWorld = hand.Input.VelLinearWorld; if (((Vector3)(ref velLinearWorld)).magnitude > ((Vector3)(ref val)).magnitude) { val = velLinearWorld; } float num = Mathf.Clamp01(Mathf.Max(rootRigidbody.mass, 0.01f) / Mathf.Max(Plugin.BoostMassReference.Value, 0.01f)); float num2 = Mathf.Lerp(Plugin.ThrowBoostLight.Value, Plugin.ThrowBoostHeavy.Value, num); val *= num2; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < Plugin.MinThrowSpeed.Value) { T(" bail: speed " + magnitude.ToString("F2") + " < MinThrowSpeed " + Plugin.MinThrowSpeed.Value); return; } T(" speed " + magnitude.ToString("F2") + " m/s (hand " + ((Vector3)(ref hand.Input.VelLinearWorld)).magnitude.ToString("F2") + ", mass " + rootRigidbody.mass.ToString("F2") + "kg, boost x" + num2.ToString("F2") + ")"); if (IsDiscThrowable(obj)) { ApplyDiscSpin(obj, rootRigidbody, hand); } FVRPlayerBody currentPlayerBody = GM.CurrentPlayerBody; if ((Object)(object)currentPlayerBody == (Object)null || (Object)(object)currentPlayerBody.Head == (Object)null) { T(" bail: no player body/head"); return; } Vector3 position = rootRigidbody.position; if (!TryPickTarget(obj, currentPlayerBody, position, val, magnitude, out var best)) { T(" bail: no target accepted"); return; } T(" target " + (((Object)(object)best.Sosig != (Object)null) ? ((Object)best.Sosig).name : "?") + " at " + best.Distance.ToString("F1") + "m, throw off by " + Vector3.Angle(val, best.AimPoint - position).ToString("F0") + " deg"); float num3 = Mathf.Abs(Physics.gravity.y); if (num3 < 0.01f) { return; } if (Plugin.LeadMovingTargets.Value && !best.Static && (Object)(object)best.Sosig != (Object)null) { Vector3 val3; for (int i = 0; i < 3; i++) { if (!TrySolve(position, best.AimPoint, magnitude, num3, out var solved)) { break; } float num4 = EstimateFlightTime(position, best.AimPoint, solved); if (num4 <= 0f) { break; } Vector3 val2 = SosigMotion.PredictCore(best.Sosig, num4) + best.SegmentOffset; val3 = val2 - best.AimPoint; if (((Vector3)(ref val3)).sqrMagnitude < 0.0004f) { best.AimPoint = val2; break; } best.AimPoint = val2; best.Distance = Vector3.Distance(position, val2); } string[] obj2 = new string[5] { " led aim -> ", null, null, null, null }; val3 = best.AimPoint; obj2[1] = ((object)(*(Vector3*)(&val3))/*cast due to .constrained prefix*/).ToString(); obj2[2] = " at "; obj2[3] = best.Distance.ToString("F1"); obj2[4] = "m"; T(string.Concat(obj2)); } if (!TrySolve(position, best.AimPoint, magnitude, num3, out var solved2)) { if (Plugin.DebugLog.Value) { Plugin.Log.LogInfo((object)("[ThrowAssist] no ballistic solution for " + ((Object)obj).name + " at " + magnitude.ToString("F1") + " m/s over " + best.Distance.ToString("F1") + " m; throw left untouched.")); } return; } float num5 = EstimateFlightTime(position, best.AimPoint, solved2); if (num5 <= 0f) { T(" bail: flight time <= 0"); return; } rootRigidbody.drag = 0f; rootRigidbody.angularDrag = 0f; rootRigidbody.velocity = solved2; ApplyOrientation(obj, rootRigidbody, hand, solved2, num5, best.Distance); if (Plugin.DebugLog.Value) { Plugin.Log.LogInfo((object)string.Format("[ThrowAssist] {0} -> {1} | aim {2} | dist {3:F1}m | thrown {4:F1} m/s, solved {5:F1} m/s | flight {6:F2}s", ((Object)obj).name, ((Object)(object)best.Sosig != (Object)null) ? ((Object)best.Sosig).name : "?", best.AimPoint, best.Distance, magnitude, ((Vector3)(ref solved2)).magnitude, num5)); } if (Plugin.DebugDrawTrajectory.Value) { DrawArc(position, solved2, num5, best.AimPoint); } } private static bool IsEligible(FVRPhysicalObject obj) { if (obj is FVRGrenade || obj is PinnedGrenade || obj is FVRCappedGrenade) { T(" bail: live explosive (always blacklisted)"); return false; } if (MatchesBlacklist(obj)) { return false; } string text = Categorise(obj); if (!CategoryEnabled(text)) { T(" bail: category " + text + " disabled"); return false; } return true; } private static string Categorise(FVRPhysicalObject obj) { if (obj is FVRFireArmAttachment) { return "Attachments"; } if (obj is Handgun || obj is Revolver) { return "Handguns"; } if (obj is FVRFireArm) { return "LongGuns"; } if (obj is FVRFireArmMagazine || obj is FVRFireArmClip || obj is FVRFireArmRound || obj is Speedloader) { return "Ammunition"; } if (obj is FVRMeleeWeapon) { return "MeleeWeapons"; } return "Misc"; } private static bool CategoryEnabled(string category) { return category switch { "Handguns" => Plugin.AssistHandguns.Value, "LongGuns" => Plugin.AssistLongGuns.Value, "Ammunition" => Plugin.AssistAmmunition.Value, "MeleeWeapons" => Plugin.AssistMeleeWeapons.Value, "Attachments" => Plugin.AssistAttachments.Value, _ => Plugin.AssistMisc.Value, }; } private static bool MatchesBlacklist(FVRPhysicalObject obj) { string value = Plugin.BlacklistTypes.Value; if (!string.IsNullOrEmpty(value)) { string[] array = value.Split(new char[1] { ',' }); Type type = ((object)obj).GetType(); while ((object)type != null) { for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length != 0 && string.Equals(text, type.Name, StringComparison.OrdinalIgnoreCase)) { T(" bail: type " + type.Name + " is in BlacklistTypes"); return true; } } type = type.BaseType; } } string value2 = Plugin.BlacklistNames.Value; if (!string.IsNullOrEmpty(value2)) { string name = ((Object)obj).name; string[] array2 = value2.Split(new char[1] { ',' }); for (int j = 0; j < array2.Length; j++) { string text2 = array2[j].Trim(); if (text2.Length != 0 && name.IndexOf(text2, StringComparison.OrdinalIgnoreCase) >= 0) { T(" bail: name matches BlacklistNames entry '" + text2 + "'"); return true; } } } return false; } private static Vector3 SpinAxisFromThrow(FVRViveHand hand, Rigidbody rb, Vector3 launch) { //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_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_0032: 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_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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0054: 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_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_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) Vector3 normalized = ((Vector3)(ref launch)).normalized; Vector3 val = rb.angularVelocity; if (((Vector3)(ref val)).sqrMagnitude < 0.25f && (Object)(object)hand != (Object)null) { val = hand.Input.VelAngularWorld; } Vector3 val2 = val - Vector3.Project(val, normalized); if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f) { val2 = Vector3.Cross(Vector3.up, normalized); if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f) { val2 = Vector3.right; } } return ((Vector3)(ref val2)).normalized; } private static Quaternion RollAlign(Vector3 tipLocal, Vector3 normalLocal, Vector3 tipTarget, Vector3 normalTarget, Transform fallback) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0061: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_008e: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (((Vector3)(ref tipLocal)).sqrMagnitude < 0.0001f || ((Vector3)(ref normalLocal)).sqrMagnitude < 0.0001f || ((Vector3)(ref tipTarget)).sqrMagnitude < 0.0001f || ((Vector3)(ref normalTarget)).sqrMagnitude < 0.0001f) { return fallback.rotation; } if (Mathf.Abs(Vector3.Dot(((Vector3)(ref tipLocal)).normalized, ((Vector3)(ref normalLocal)).normalized)) > 0.99f || Mathf.Abs(Vector3.Dot(((Vector3)(ref tipTarget)).normalized, ((Vector3)(ref normalTarget)).normalized)) > 0.99f) { return fallback.rotation; } Quaternion val = Quaternion.LookRotation(tipTarget, normalTarget); Quaternion val2 = Quaternion.LookRotation(tipLocal, normalLocal); return val * Quaternion.Inverse(val2); } private static bool IsDiscThrowable(FVRPhysicalObject obj) { return MatchesNameList(obj, Plugin.DiscSpinNames.Value); } private static bool MatchesNameList(FVRPhysicalObject obj, string cfg) { if (string.IsNullOrEmpty(cfg) || (Object)(object)obj == (Object)null) { return false; } string name = ((Object)obj).name; string[] array = cfg.Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length != 0 && name.IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; } private unsafe static void ApplyDiscSpin(FVRPhysicalObject obj, Rigidbody rb, FVRViveHand hand) { //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_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_002a: 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_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_0057: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_012b: 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) Vector3 val = DiscAxisLocal(obj); float num = Plugin.DiscSpinRate.Value * 2f * (float)Math.PI; Vector3 val2 = ((Component)obj).transform.TransformDirection(val); Vector3 normalized = ((Vector3)(ref val2)).normalized; float num2 = Vector3.Dot(rb.angularVelocity, normalized); float num3 = (((Object)(object)hand != (Object)null) ? Vector3.Dot(hand.Input.VelAngularWorld, normalized) : 0f); float num4 = ((((Mathf.Abs(num3) > 0.05f) ? num3 : num2) < 0f) ? (-1f) : 1f); if (Plugin.DiscSpinInvert.Value) { num4 = 0f - num4; } float num5 = num4 * Mathf.Max(num, Mathf.Abs(num2)); if (num5 > rb.maxAngularVelocity) { num5 = rb.maxAngularVelocity; } if (num5 < 0f - rb.maxAngularVelocity) { num5 = 0f - rb.maxAngularVelocity; } rb.angularVelocity = normalized * num5; ThrowAssistFlight throwAssistFlight = ((Component)obj).gameObject.GetComponent<ThrowAssistFlight>(); if ((Object)(object)throwAssistFlight == (Object)null) { throwAssistFlight = ((Component)obj).gameObject.AddComponent<ThrowAssistFlight>(); } throwAssistFlight.BeginDisc(obj, val, num5, Plugin.DiscSpinStabilise.Value); string[] obj2 = new string[5] { " disc spin: axis ", null, null, null, null }; val2 = val; obj2[1] = ((object)(*(Vector3*)(&val2))/*cast due to .constrained prefix*/).ToString(); obj2[2] = " at "; obj2[3] = (num5 / ((float)Math.PI * 2f)).ToString("F1"); obj2[4] = " rev/s"; T(string.Concat(obj2)); } private static Vector3 LocalExtents(FVRPhysicalObject obj) { //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_000d: 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_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) //IL_010b: 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_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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00a5: 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_00ba: 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_00d0: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00da: 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_00e1: 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_00c8: 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) Collider[] componentsInChildren = ((Component)obj).GetComponentsInChildren<Collider>(); Vector3 val = Vector3.zero; Vector3 val2 = Vector3.zero; bool flag = false; Vector3 val3 = default(Vector3); for (int i = 0; i < componentsInChildren.Length; i++) { if ((Object)(object)componentsInChildren[i] == (Object)null || componentsInChildren[i].isTrigger) { continue; } Bounds bounds = componentsInChildren[i].bounds; for (int j = 0; j < 8; j++) { ((Vector3)(ref val3))..ctor(((j & 1) == 0) ? ((Bounds)(ref bounds)).min.x : ((Bounds)(ref bounds)).max.x, ((j & 2) == 0) ? ((Bounds)(ref bounds)).min.y : ((Bounds)(ref bounds)).max.y, ((j & 4) == 0) ? ((Bounds)(ref bounds)).min.z : ((Bounds)(ref bounds)).max.z); Vector3 val4 = ((Component)obj).transform.InverseTransformPoint(val3); if (!flag) { val = val4; val2 = val4; flag = true; } else { val = Vector3.Min(val, val4); val2 = Vector3.Max(val2, val4); } } } if (!flag) { return Vector3.one; } return val2 - val; } private static Vector3 TipLocal(FVRPhysicalObject obj, Rigidbody rb, Vector3 alongLocal, Transform tipRef, bool hasStabDir) { //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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_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_014b: 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_0143: 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_0079: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00b2: 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_00d2: 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) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_0102: Unknown result type (might be due to invalid IL or missing references) Vector3 val = alongLocal; if (hasStabDir && (Object)(object)tipRef != (Object)null) { if (Vector3.Dot(((Component)obj).transform.InverseTransformDirection(tipRef.forward), val) < 0f) { val = -val; } return ((Vector3)(ref val)).normalized; } Vector3 centerOfMass = rb.centerOfMass; float num = 0f; Collider[] componentsInChildren = ((Component)obj).GetComponentsInChildren<Collider>(); Vector3 val2 = default(Vector3); for (int i = 0; i < componentsInChildren.Length; i++) { if ((Object)(object)componentsInChildren[i] == (Object)null || componentsInChildren[i].isTrigger) { continue; } Bounds bounds = componentsInChildren[i].bounds; for (int j = 0; j < 8; j++) { ((Vector3)(ref val2))..ctor(((j & 1) == 0) ? ((Bounds)(ref bounds)).min.x : ((Bounds)(ref bounds)).max.x, ((j & 2) == 0) ? ((Bounds)(ref bounds)).min.y : ((Bounds)(ref bounds)).max.y, ((j & 4) == 0) ? ((Bounds)(ref bounds)).min.z : ((Bounds)(ref bounds)).max.z); float num2 = Vector3.Dot(((Component)obj).transform.InverseTransformPoint(val2) - centerOfMass, val); if (Mathf.Abs(num2) > Mathf.Abs(num)) { num = num2; } } } if (num < 0f) { val = -val; } return ((Vector3)(ref val)).normalized; } private static void PrincipalAxes(Rigidbody rb, out Vector3 flat, out Vector3 along) { //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_0008: 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_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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_002a: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_003e: 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_007b: 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_0063: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0087: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00b4: 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_009e: 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_00d4: 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_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_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) Vector3 inertiaTensor = rb.inertiaTensor; Quaternion inertiaTensorRotation = rb.inertiaTensorRotation; Vector3 val = inertiaTensorRotation * Vector3.right; Vector3 val2 = inertiaTensorRotation * Vector3.up; Vector3 val3 = inertiaTensorRotation * Vector3.forward; if (inertiaTensor.x >= inertiaTensor.y && inertiaTensor.x >= inertiaTensor.z) { flat = val; } else if (inertiaTensor.y >= inertiaTensor.x && inertiaTensor.y >= inertiaTensor.z) { flat = val2; } else { flat = val3; } if (inertiaTensor.x <= inertiaTensor.y && inertiaTensor.x <= inertiaTensor.z) { along = val; } else if (inertiaTensor.y <= inertiaTensor.x && inertiaTensor.y <= inertiaTensor.z) { along = val2; } else { along = val3; } flat = ((Vector3)(ref flat)).normalized; along = ((Vector3)(ref along)).normalized; } private unsafe static Vector3 DiscAxisLocal(FVRPhysicalObject obj) { //IL_0019: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) string value = Plugin.DiscSpinAxis.Value; if (string.Equals(value, "Forward", StringComparison.OrdinalIgnoreCase)) { return Vector3.forward; } if (string.Equals(value, "Up", StringComparison.OrdinalIgnoreCase)) { return Vector3.up; } if (string.Equals(value, "Right", StringComparison.OrdinalIgnoreCase)) { return Vector3.right; } Rigidbody rootRigidbody = obj.RootRigidbody; if ((Object)(object)rootRigidbody == (Object)null) { return Vector3.up; } PrincipalAxes(rootRigidbody, out var flat, out var _); Vector3 val = flat; T(" disc face normal (local): " + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString() + " I=" + ((object)rootRigidbody.inertiaTensor/*cast due to .constrained prefix*/).ToString()); return flat; } private static bool TryPickTarget(FVRPhysicalObject obj, FVRPlayerBody body, Vector3 origin, Vector3 launchVel, float launchSpeed, out Candidate best) { //IL_0016: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_026d: 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_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_027e: 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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0290: 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_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) best = default(Candidate); int playerIFF = body.GetPlayerIFF(); Transform head = body.Head; Vector3 position = head.position; Vector3 forward = head.forward; float value = Plugin.MaxAssistAngle.Value; float num = Plugin.MaxRange.Value; if (MatchesNameList(obj, Plugin.ExtraRangeNames.Value)) { num *= Plugin.ExtraRangeMultiplier.Value; } Vector3 normalized = ((Vector3)(ref launchVel)).normalized; bool flag = false; float num2 = float.MaxValue; int num3 = ResolveTargetMask(); T(" mask=" + num3 + " registry=" + SosigRegistry.GetAll().Count + " range=" + num + " maxAngle=" + value); if (num3 != 0) { RaycastHit[] array = Physics.SphereCastAll(position, Plugin.CastRadius.Value, forward, num, num3, (QueryTriggerInteraction)2); T(" spherecast hits=" + array.Length); for (int i = 0; i < array.Length; i++) { Sosig val = ResolveSosig(((RaycastHit)(ref array[i])).collider); if ((Object)(object)val == (Object)null) { T(" hit " + ((Object)((RaycastHit)(ref array[i])).collider).name + " -> no Sosig"); continue; } string text = RejectReason(val, playerIFF); if (text != null) { T(" hit " + ((Object)val).name + " -> rejected: " + text); continue; } Vector3 val2 = ((RaycastHit)(ref array[i])).point; if (((RaycastHit)(ref array[i])).distance <= 0f || val2 == Vector3.zero) { Bounds bounds = ((RaycastHit)(ref array[i])).collider.bounds; val2 = ((Bounds)(ref bounds)).center; } if (Consider(val, val2, origin, normalized, launchSpeed, value, out var cand) && !(cand.Score >= num2)) { num2 = cand.Score; best = cand; flag = true; } } } if (flag) { return true; } T(" spherecast found nothing; falling back to registry scan"); List<Sosig> all = SosigRegistry.GetAll(); for (int j = 0; j < all.Count; j++) { Sosig val3 = all[j]; if (!IsValidTarget(val3, playerIFF)) { continue; } Vector3 val4 = PickLinkAimPoint(val3, position, forward); if (!(val4 == Vector3.zero) && !(Vector3.Distance(position, val4) > num)) { float num4 = Vector3.Angle(forward, val4 - position); Candidate cand2; if (num4 > Plugin.FallbackMaxLookAngle.Value) { T(" " + ((Object)val3).name + " fallback rejected: look off by " + num4.ToString("F0") + " deg"); } else if (Consider(val3, val4, origin, normalized, launchSpeed, value, out cand2) && !(cand2.Score >= num2)) { num2 = cand2.Score; best = cand2; flag = true; } } } return flag; } private static bool Consider(Sosig s, Vector3 aimNow, Vector3 origin, Vector3 throwDir, float launchSpeed, float maxAngle, out Candidate cand) { //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_000f: 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_0016: 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_002d: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00cc: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: 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_01c0: 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_0077: 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) //IL_007f: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0220: 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_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) cand = default(Candidate); Vector3 val = SosigMotion.CorePosition(s); Vector3 val2 = aimNow - val; float num = SosigMotion.Speed(s); bool flag = num < Plugin.LeadStaticSpeed.Value; Vector3 val3 = aimNow; if (!flag && Plugin.LeadMovingTargets.Value) { float num2 = Vector3.Distance(origin, aimNow) / Mathf.Max(launchSpeed, 0.1f); for (int i = 0; i < 4; i++) { num2 = Mathf.Min(num2, Plugin.LeadMaxTime.Value); Vector3 val4 = SosigMotion.PredictCore(s, num2) + val2; float num3 = Vector3.Distance(origin, val4) / Mathf.Max(launchSpeed, 0.1f); val3 = val4; if (Mathf.Abs(num3 - num2) < 0.005f) { break; } num2 = num3; } } float num4 = Vector3.Angle(throwDir, aimNow - origin); float num5 = Vector3.Angle(throwDir, val3 - origin); bool flag2 = num5 <= maxAngle; bool flag3 = num4 <= maxAngle; if (!flag2 && !flag3 && !(num4 <= Plugin.LeadConeAngle.Value)) { T(" " + ((Object)s).name + " rejected: throw off by " + num4.ToString("F0") + " deg (led " + num5.ToString("F0") + ")"); return false; } if (!flag2) { if (!flag3) { T(" " + ((Object)s).name + " rejected: lead " + num5.ToString("F0") + " deg not credible and direct " + num4.ToString("F0") + " deg outside cone"); return false; } val3 = aimNow; num5 = num4; } if (!Accept(origin, throwDir, val3, Mathf.Max(maxAngle, Plugin.LeadConeAngle.Value), out var distance)) { T(" " + ((Object)s).name + " rejected: line of sight"); return false; } float num6 = num5; if (flag) { num6 -= Plugin.LeadStaticBonus.Value; } cand.Sosig = s; cand.AimPoint = val3; cand.SegmentOffset = val2; cand.Distance = distance; cand.Score = num6; cand.Static = flag; T(" " + ((Object)s).name + " candidate: off " + num4.ToString("F0") + " deg, led " + num5.ToString("F0") + ", " + distance.ToString("F1") + "m, " + (flag ? "static" : ("moving " + num.ToString("F1") + " m/s")) + ", score " + num6.ToString("F0")); return true; } private static bool Accept(Vector3 origin, Vector3 throwDir, Vector3 aim, float maxAngle, out float distance) { //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_001e: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) Vector3 val = aim - origin; distance = ((Vector3)(ref val)).magnitude; if (distance < 0.25f) { return false; } if (Vector3.Angle(throwDir, val) > maxAngle) { return false; } if (Plugin.RequireLineOfSight.Value && IsBlocked(origin, aim)) { return false; } return true; } private static bool IsBlocked(Vector3 origin, Vector3 aim) { //IL_000f: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0042: 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_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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ManagerSingleton<IM>.Instance == (Object)null) { return false; } int num = LayerMask.op_Implicit(IM.LM_Env); if (num == 0) { return false; } Vector3 val = aim - origin; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.4f) { return false; } Vector3 val2 = val / magnitude; return Physics.Linecast(origin + val2 * 0.2f, aim - val2 * 0.2f, num, (QueryTriggerInteraction)1); } private static bool IsValidTarget(Sosig s, int playerIFF) { return RejectReason(s, playerIFF) == null; } private static string RejectReason(Sosig s, int playerIFF) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 if ((Object)(object)s == (Object)null) { return "null"; } if ((int)s.BodyState == 3) { return "BodyState=Dead"; } if (s.IsBodyCompletelyDestroyed()) { return "body destroyed"; } if ((Object)(object)s.E == (Object)null) { return "E==null"; } if (s.Priority == null) { return "Priority==null"; } int iFF = s.GetIFF(); if (iFF < 0) { return "IFF=" + iFF + " (negative)"; } if (!Plugin.AssistFriendlies.Value && playerIFF >= 0 && s.Priority.IsFriend(playerIFF)) { return "friendly (sosigIFF=" + iFF + " playerIFF=" + playerIFF + "), AssistFriendlies=false"; } return null; } private static Sosig ResolveSosig(Collider col) { if ((Object)(object)col == (Object)null) { return null; } SosigLink componentInParent = ((Component)col).GetComponentInParent<SosigLink>(); if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent.S != (Object)null) { return componentInParent.S; } AIEntity componentInParent2 = ((Component)col).GetComponentInParent<AIEntity>(); if ((Object)(object)componentInParent2 != (Object)null) { Sosig component = ((Component)componentInParent2).GetComponent<Sosig>(); if ((Object)(object)component != (Object)null) { return component; } } return null; } private static Vector3 PickLinkAimPoint(Sosig s, Vector3 lookOrigin, Vector3 lookDir) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0069: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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 refe