Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ValuableParry v1.0.0
RepoValuableParry.dll
Decompiled 6 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using RepoValuableParry.Attacks; using RepoValuableParry.Attacks.EnemySpecific; using RepoValuableParry.Core; using RepoValuableParry.DebugTools; using RepoValuableParry.Destruction; using RepoValuableParry.Detection; using RepoValuableParry.Effects; using RepoValuableParry.Input; using RepoValuableParry.Networking; using RepoValuableParry.Physics; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RepoValuableParry")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Valuable Parry")] [assembly: AssemblyTitle("RepoValuableParry")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RepoValuableParry { internal static class ParryConfig { public static ConfigEntry<bool> Enabled; public static ConfigEntry<bool> UseVanillaInteract; public static ConfigEntry<KeyCode> FallbackParryKey; public static ConfigEntry<float> ParryWindow; public static ConfigEntry<float> PlayerKnockbackMultiplier; public static ConfigEntry<float> EnemyKnockbackMultiplier; public static ConfigEntry<float> EffectsIntensity; public static ConfigEntry<float> CameraShake; public static ConfigEntry<bool> DebugOverlay; public static ConfigEntry<bool> DebugGizmos; public static ConfigEntry<bool> VerboseLogs; public static ConfigEntry<float> DamageWeight; public static ConfigEntry<float> ForceWeight; public static ConfigEntry<float> TumbleWeight; public static ConfigEntry<float> SizeWeight; public static ConfigEntry<float> MassWeight; public static ConfigEntry<float> SizeMultiplier; public static ConfigEntry<float> MassMultiplier; public static ConfigEntry<float> MinimumCoverage; public static ConfigEntry<float> MinimumArea; public static ConfigEntry<float> CoverageForgiveness; public static ConfigEntry<float> FreezeDuration; public static ConfigEntry<float> AbsorptionDuration; public static ConfigEntry<float> OverloadDuration; public static ConfigEntry<float> MinExplosionForce; public static ConfigEntry<float> MaxExplosionForce; public static ConfigEntry<float> MinExplosionRadius; public static ConfigEntry<float> MaxExplosionRadius; public static ConfigEntry<float> MinAttackEnergy; public static ConfigEntry<float> MaxAttackEnergy; public static ConfigEntry<float> PlayerTumbleTime; public static ConfigEntry<int> EnemyDirectDamage; public static void Bind(ConfigFile config) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Expected O, but got Unknown //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Expected O, but got Unknown Enabled = config.Bind<bool>("User", "Enable Mod", true, "Master switch for Valuable Parry."); UseVanillaInteract = config.Bind<bool>("User", "Use Vanilla Interact", true, "If true, parry uses the vanilla Interact action (E by default, respects rebinds/controllers). If false, uses Fallback Parry Key."); FallbackParryKey = config.Bind<KeyCode>("User", "Fallback Parry Key", (KeyCode)101, "Used only when Use Vanilla Interact is false."); ParryWindow = config.Bind<float>("User", "Parry Window", 0.35f, new ConfigDescription("How long ParryIntent stays armed after pressing E, in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 0.8f), Array.Empty<object>())); PlayerKnockbackMultiplier = config.Bind<float>("User", "Player Knockback Multiplier", 1f, new ConfigDescription("Scales knockback applied to the parrying player.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); EnemyKnockbackMultiplier = config.Bind<float>("User", "Enemy Knockback Multiplier", 1f, new ConfigDescription("Scales knockback applied to the attacking enemy.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); EffectsIntensity = config.Bind<float>("User", "Effects Intensity", 1f, new ConfigDescription("Scales VFX and audio intensity.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); CameraShake = config.Bind<float>("User", "Camera Shake", 1f, new ConfigDescription("Scales camera shake on detonation.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); DebugOverlay = config.Bind<bool>("Debug", "Debug Overlay", false, "Shows live parry numbers. Off in a normal playthrough."); DebugGizmos = config.Bind<bool>("Debug", "Debug Gizmos", false, "Draws attack line, valuable bounds, contact point and knockback vectors."); VerboseLogs = config.Bind<bool>("Debug", "Verbose Logs", true, "Logs every reject reason and successful capture."); DamageWeight = config.Bind<float>("Balance", "Damage Weight", 1f, "AttackEnergy contribution from HurtCollider.playerDamage."); ForceWeight = config.Bind<float>("Balance", "Force Weight", 3f, "AttackEnergy contribution from HurtCollider.physHitForce / playerHitForce."); TumbleWeight = config.Bind<float>("Balance", "Tumble Weight", 4f, "AttackEnergy contribution from HurtCollider.playerTumbleForce."); SizeWeight = config.Bind<float>("Balance", "Size Weight", 0.7f, "Share of ParryCapacity that comes from projected area."); MassWeight = config.Bind<float>("Balance", "Mass Weight", 0.3f, "Share of ParryCapacity that comes from mass."); SizeMultiplier = config.Bind<float>("Balance", "Size Multiplier", 40f, "Projected area is multiplied by this before weighting."); MassMultiplier = config.Bind<float>("Balance", "Mass Multiplier", 15f, "sqrt(mass) is multiplied by this before weighting."); MinimumCoverage = config.Bind<float>("Balance", "Minimum Coverage", 0.25f, new ConfigDescription("Minimum fraction of the player torso that the valuable must cover.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 0.9f), Array.Empty<object>())); MinimumArea = config.Bind<float>("Balance", "Minimum Area", 0.06f, "Hard minimum projected area in square metres."); CoverageForgiveness = config.Bind<float>("Balance", "Coverage Forgiveness", 0.4f, "Bounds padding in metres. Extra slack so a held valuable counts as covering a laser/melee line."); FreezeDuration = config.Bind<float>("Balance", "Freeze Duration", 0.18f, new ConfigDescription("How long the captured attack stays frozen, in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.08f, 0.4f), Array.Empty<object>())); AbsorptionDuration = config.Bind<float>("Balance", "Absorption Duration", 0.14f, "Energy-in visual window after freeze starts."); OverloadDuration = config.Bind<float>("Balance", "Overload Duration", 0.03f, "Short flash before detonation."); MinExplosionForce = config.Bind<float>("Balance", "Min Explosion Force", 8f, "Knockback force at the weakest parryable hit."); MaxExplosionForce = config.Bind<float>("Balance", "Max Explosion Force", 28f, "Knockback force at the strongest parryable hit."); MinExplosionRadius = config.Bind<float>("Balance", "Min Explosion Radius", 1.4f, "Shockwave radius at the weakest parryable hit."); MaxExplosionRadius = config.Bind<float>("Balance", "Max Explosion Radius", 4.5f, "Shockwave radius at the strongest parryable hit."); MinAttackEnergy = config.Bind<float>("Balance", "Min Attack Energy", 8f, "Maps to min explosion scale."); MaxAttackEnergy = config.Bind<float>("Balance", "Max Attack Energy", 80f, "Maps to max explosion scale."); PlayerTumbleTime = config.Bind<float>("Balance", "Player Tumble Time", 1.35f, "How long the player stays tumbling after detonation."); EnemyDirectDamage = config.Bind<int>("Balance", "Enemy Direct Damage", 0, "Direct HP damage to the attacker. Keep at 0 so parry is not an offensive weapon."); } } [BepInPlugin("valuableparry.repovaluableparry", "Valuable Parry", "1.0.0")] public class Plugin : BaseUnityPlugin { private static ManualLogSource _log; private Harmony _harmony; internal static Plugin Instance { get; private set; } private void Awake() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown Instance = this; _log = ((BaseUnityPlugin)this).Logger; ParryConfig.Bind(((BaseUnityPlugin)this).Config); ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; ParryManager.Ensure(); GameObject gameObject = ((Component)ParryManager.Instance).gameObject; if ((Object)(object)gameObject.GetComponent<ParryDebugOverlay>() == (Object)null) { gameObject.AddComponent<ParryDebugOverlay>(); } if ((Object)(object)gameObject.GetComponent<DebugGizmos>() == (Object)null) { gameObject.AddComponent<DebugGizmos>(); } _harmony = new Harmony("valuableparry.repovaluableparry"); _harmony.PatchAll(); Log("Valuable Parry v1.0.0 loaded."); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } internal static void Log(string message) { ManualLogSource log = _log; if (log != null) { log.LogInfo((object)message); } } internal static void LogWarning(string message) { ManualLogSource log = _log; if (log != null) { log.LogWarning((object)message); } } internal static void LogError(string message) { ManualLogSource log = _log; if (log != null) { log.LogError((object)message); } } internal static void LogVerbose(string message) { if (ParryConfig.VerboseLogs != null && ParryConfig.VerboseLogs.Value) { ManualLogSource log = _log; if (log != null) { log.LogInfo((object)("[VERBOSE] " + message)); } } } } internal static class PluginInfo { public const string PLUGIN_GUID = "valuableparry.repovaluableparry"; public const string PLUGIN_NAME = "Valuable Parry"; public const string PLUGIN_VERSION = "1.0.0"; } public static class MyPluginInfo { public const string PLUGIN_GUID = "RepoValuableParry"; public const string PLUGIN_NAME = "Valuable Parry"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace RepoValuableParry.Physics { internal static class AttackEnergyCalculator { public static float Compute(HurtCollider collider) { if ((Object)(object)collider == (Object)null) { return 0f; } GetRaw(collider, out var damage, out var force, out var tumble); return damage * ParryConfig.DamageWeight.Value + Mathf.Sqrt(force) * ParryConfig.ForceWeight.Value + Mathf.Sqrt(tumble) * ParryConfig.TumbleWeight.Value; } public static void GetRaw(HurtCollider collider, out float damage, out float force, out float tumble) { damage = (((Object)(object)collider != (Object)null) ? ((float)collider.playerDamage) : 0f); force = (((Object)(object)collider != (Object)null) ? Mathf.Max(0f, Mathf.Max(collider.physHitForce, collider.playerHitForce)) : 0f); tumble = (((Object)(object)collider != (Object)null) ? Mathf.Max(0f, collider.playerTumbleForce) : 0f); } public static void ScaleExplosion(float energy, out float force, out float radius) { float value = ParryConfig.MinAttackEnergy.Value; float num = Mathf.Max(value + 0.01f, ParryConfig.MaxAttackEnergy.Value); float num2 = Mathf.Sqrt(Mathf.Clamp01((energy - value) / (num - value))); force = Mathf.Lerp(ParryConfig.MinExplosionForce.Value, ParryConfig.MaxExplosionForce.Value, num2); radius = Mathf.Lerp(ParryConfig.MinExplosionRadius.Value, ParryConfig.MaxExplosionRadius.Value, num2); } } internal static class KnockbackCalculator { private const float UpBias = 0.35f; public static Vector3 DirectionFrom(Vector3 from, Vector3 to) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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) Vector3 val = to - from; val.y += 0.35f; if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = Vector3.up + Vector3.back; } return ((Vector3)(ref val)).normalized; } public static Vector3 PlayerForce(Vector3 detonationPoint, Vector3 playerPosition, float explosionForce) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) return DirectionFrom(detonationPoint, playerPosition) * explosionForce * ParryConfig.PlayerKnockbackMultiplier.Value; } public static Vector3 EnemyForce(Vector3 detonationPoint, Vector3 enemyPosition, float explosionForce) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) return DirectionFrom(detonationPoint, enemyPosition) * explosionForce * ParryConfig.EnemyKnockbackMultiplier.Value; } } internal static class ParryCapacityCalculator { public static ValuableStats Evaluate(ValuableObject valuable, PhysGrabObject phys, Vector3 attackDirection) { //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_0093: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) ValuableStats result = new ValuableStats { Name = (((Object)(object)valuable != (Object)null) ? StripClone(((Object)((Component)valuable).gameObject).name) : "none"), DollarValue = GameAccess.GetDollarValue(valuable), Mass = GetMass(phys, valuable) }; result.Bounds = CombineColliderBounds(((Object)(object)phys != (Object)null) ? ((Component)phys).gameObject : (((Object)(object)valuable != (Object)null) ? ((Component)valuable).gameObject : null)); Vector3 dir = ((((Vector3)(ref attackDirection)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref attackDirection)).normalized : Vector3.forward); result.ProjectedArea = ProjectedArea(((Bounds)(ref result.Bounds)).size, dir); result.MeetsMinimumSize = result.ProjectedArea >= ParryConfig.MinimumArea.Value; float num = result.ProjectedArea * ParryConfig.SizeMultiplier.Value; float num2 = Mathf.Sqrt(Mathf.Max(result.Mass, 0f)) * ParryConfig.MassMultiplier.Value; result.Capacity = num * ParryConfig.SizeWeight.Value + num2 * ParryConfig.MassWeight.Value; return result; } public static float GetMass(PhysGrabObject phys, ValuableObject valuable) { if ((Object)(object)phys != (Object)null && phys.massOriginal > 0f) { return phys.massOriginal; } if ((Object)(object)phys != (Object)null && (Object)(object)phys.rb != (Object)null) { return phys.rb.mass; } if ((Object)(object)valuable != (Object)null && (Object)(object)valuable.physAttributePreset != (Object)null) { return valuable.physAttributePreset.mass; } return 1f; } public static float ProjectedArea(Vector3 size, Vector3 dir) { //IL_0002: 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_0018: 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_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_0043: 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_0051: 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_0062: Unknown result type (might be due to invalid IL or missing references) ((Vector3)(ref dir))..ctor(Mathf.Abs(dir.x), Mathf.Abs(dir.y), Mathf.Abs(dir.z)); float num = size.x * size.y; float num2 = size.x * size.z; float num3 = size.y * size.z; return num * dir.z + num2 * dir.y + num3 * dir.x; } public static Bounds CombineColliderBounds(GameObject go) { //IL_002d: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)go == (Object)null) { return new Bounds(Vector3.zero, Vector3.one * 0.1f); } Collider[] componentsInChildren = go.GetComponentsInChildren<Collider>(); bool flag = false; Bounds result = default(Bounds); Collider[] array = componentsInChildren; foreach (Collider val in array) { if (!((Object)(object)val == (Object)null) && val.enabled && !val.isTrigger) { if (!flag) { result = val.bounds; flag = true; } else { ((Bounds)(ref result)).Encapsulate(val.bounds); } } } if (!flag) { ((Bounds)(ref result))..ctor(go.transform.position, go.transform.lossyScale); } float value = ParryConfig.CoverageForgiveness.Value; ((Bounds)(ref result)).Expand(value * 2f); return result; } private static string StripClone(string name) { if (string.IsNullOrEmpty(name)) { return "Valuable"; } return name.Replace("(Clone)", "").Trim(); } } } namespace RepoValuableParry.Patches { [HarmonyPatch(typeof(HurtCollider), "PlayerHurt")] internal static class HurtColliderPatch { private static bool Prefix(HurtCollider __instance, PlayerAvatar _player) { if (!ParryConfig.Enabled.Value) { return true; } if ((Object)(object)ParryManager.Instance == (Object)null) { return true; } if ((Object)(object)_player == (Object)null) { return true; } if (ParryManager.Instance.IsAttackConsumed(__instance)) { Plugin.LogVerbose("Skipping consumed HurtCollider hit."); return false; } if (ParryManager.Instance.TryInterceptAttack(__instance, _player)) { return false; } return true; } } [HarmonyPatch(typeof(PlayerAvatar), "Awake")] internal static class PlayerAvatarAwakePatch { private static void Postfix(PlayerAvatar __instance) { ParryNetworkManager.EnsureOnPlayer(__instance); } } [HarmonyPatch] internal static class ValuablePatch { [HarmonyPatch(typeof(ValuableObject), "Start")] [HarmonyPostfix] private static void StartPostfix(ValuableObject __instance) { } } } namespace RepoValuableParry.Networking { internal sealed class ParryNetworkBehaviour : MonoBehaviourPun { public PlayerAvatar Player; [PunRPC] public void VP_ParryStart(int sequenceId, int playerViewId, int enemyViewId, int valuableViewId, float energy, Vector3 contact, int seed, PhotonMessageInfo info) { //IL_0047: 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) if (!((Object)(object)ParryManager.Instance == (Object)null)) { ParryManager.Instance.ReceiveRemoteParryStart(new ParryEvent { SequenceId = sequenceId, PlayerViewId = playerViewId, EnemyViewId = enemyViewId, ValuableViewId = valuableViewId, AttackEnergy = energy, ContactPoint = contact, EffectSeed = seed }); } } [PunRPC] public void VP_ParryCommit(int playerViewId, int enemyViewId, int valuableViewId, float energy, Vector3 contact, int seed, PhotonMessageInfo info) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ParryManager.Instance == (Object)null) && SemiFunc.IsMasterClient()) { ParryManager.Instance.HostCommitParry(playerViewId, enemyViewId, valuableViewId, energy, contact, seed); } } } internal static class ParryNetworkManager { public static void EnsureOnPlayer(PlayerAvatar player) { if (!((Object)(object)player == (Object)null) && (Object)(object)((Component)player).GetComponent<ParryNetworkBehaviour>() == (Object)null) { ((Component)player).gameObject.AddComponent<ParryNetworkBehaviour>().Player = player; } } public static int ViewId(Component component) { if ((Object)(object)component == (Object)null) { return 0; } PhotonView val = component.GetComponent<PhotonView>(); if ((Object)(object)val == (Object)null) { val = component.GetComponentInParent<PhotonView>(); } if (!((Object)(object)val != (Object)null)) { return 0; } return val.ViewID; } public static void BroadcastParryStart(ParryContext context) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer() && SemiFunc.IsMasterClient()) { ParryNetworkBehaviour parryNetworkBehaviour = RpcHost(); if (!((Object)(object)parryNetworkBehaviour == (Object)null) && !((Object)(object)((MonoBehaviourPun)parryNetworkBehaviour).photonView == (Object)null)) { ((MonoBehaviourPun)parryNetworkBehaviour).photonView.RPC("VP_ParryStart", (RpcTarget)1, new object[7] { context.SequenceId, ViewId((Component)(object)context.Player), ((Object)(object)context.Enemy != (Object)null) ? ((MonoBehaviourPun)context.Enemy).photonView.ViewID : 0, ViewId((Component)(object)context.PhysObject), context.AttackEnergy, context.ContactPoint, context.EffectSeed }); } } } public static void SendCommitToHost(ParryContext context) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer() && !SemiFunc.IsMasterClient()) { ParryNetworkBehaviour parryNetworkBehaviour = (((Object)(object)context.Player != (Object)null) ? ((Component)context.Player).GetComponent<ParryNetworkBehaviour>() : null); if (!((Object)(object)parryNetworkBehaviour == (Object)null) && !((Object)(object)((MonoBehaviourPun)parryNetworkBehaviour).photonView == (Object)null)) { ((MonoBehaviourPun)parryNetworkBehaviour).photonView.RPC("VP_ParryCommit", (RpcTarget)2, new object[6] { ViewId((Component)(object)context.Player), ((Object)(object)context.Enemy != (Object)null) ? ((MonoBehaviourPun)context.Enemy).photonView.ViewID : 0, ViewId((Component)(object)context.PhysObject), context.AttackEnergy, context.ContactPoint, context.EffectSeed }); } } } private static ParryNetworkBehaviour RpcHost() { PlayerAvatar val = SemiFunc.PlayerGetLocal(); if (!((Object)(object)val != (Object)null)) { return null; } return ((Component)val).GetComponent<ParryNetworkBehaviour>(); } } public struct ParryRequest { public int PlayerViewId; public int ValuableViewId; public int InputSequence; public float ClientTime; } public struct ParryEvent { public int SequenceId; public int PlayerViewId; public int EnemyViewId; public int ValuableViewId; public float AttackEnergy; public Vector3 ContactPoint; public int EffectSeed; } } namespace RepoValuableParry.Input { internal static class ParryInput { private static readonly FieldRef<ChatManager, bool> ChatActive = AccessTools.FieldRefAccess<ChatManager, bool>("chatActive"); public static bool WasParryPressed() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (IsChatOpen()) { return false; } if (ParryConfig.UseVanillaInteract.Value) { if ((Object)(object)InputManager.instance == (Object)null) { return Input.GetKeyDown((KeyCode)101); } return SemiFunc.InputDown((InputKey)2); } return Input.GetKeyDown(ParryConfig.FallbackParryKey.Value); } private static bool IsChatOpen() { if ((Object)(object)ChatManager.instance == (Object)null) { return false; } try { return ChatActive.Invoke(ChatManager.instance); } catch { return false; } } } } namespace RepoValuableParry.Effects { internal static class AbsorptionEffect { private class AbsorptionDriver : MonoBehaviour { private Vector3 _contact; private Transform _valuable; private Light _light; private float _duration; private float _intensity; private float _age; private LineRenderer[] _arcs; public void Init(Vector3 contact, Transform valuable, Light light, float duration, float intensity) { //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_0049: 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_0096: 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_00e5: Unknown result type (might be due to invalid IL or missing references) _contact = contact; _valuable = valuable; _light = light; _duration = duration; _intensity = intensity; _arcs = (LineRenderer[])(object)new LineRenderer[3]; for (int i = 0; i < _arcs.Length; i++) { GameObject val = new GameObject("Arc" + i); val.transform.SetParent(((Component)this).transform, false); LineRenderer val2 = val.AddComponent<LineRenderer>(); val2.positionCount = 6; val2.widthMultiplier = 0.08f * intensity; val2.useWorldSpace = true; Material val3 = ParryShaders.Make(new Color(0.55f, 0.95f, 1f, 1f)); if ((Object)(object)val3 != (Object)null) { ((Renderer)val2).material = val3; } val2.startColor = new Color(1f, 1f, 1f, 1f); val2.endColor = new Color(0.3f, 0.8f, 1f, 0.4f); _arcs[i] = val2; } } private void Update() { //IL_002e: 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_0033: 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_00a7: 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_00c1: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) _age += Time.deltaTime; Vector3 val = (((Object)(object)_valuable != (Object)null) ? _valuable.position : _contact); float num = Mathf.Clamp01(_age / Mathf.Max(0.01f, _duration)); if ((Object)(object)_light != (Object)null) { ((Component)_light).transform.position = val; _light.intensity = Mathf.Lerp(6f, 18f * _intensity, num); _light.color = Color.Lerp(new Color(0.55f, 0.85f, 1f), new Color(1f, 0.95f, 0.7f), num); } for (int i = 0; i < _arcs.Length; i++) { if ((Object)(object)_arcs[i] == (Object)null) { continue; } for (int j = 0; j < 6; j++) { float num2 = (float)j / 5f; Vector3 val2 = Vector3.Lerp(_contact, val, num2); float num3 = Mathf.Sin(Time.time * (8f + (float)i * 3f) + (float)j) * 0.08f * (1f - Mathf.Abs(num2 * 2f - 1f)); Vector3 val3 = val - _contact; Vector3 val4 = Vector3.Cross(((Vector3)(ref val3)).normalized, Vector3.up); if (((Vector3)(ref val4)).sqrMagnitude < 0.01f) { val4 = Vector3.right; } val2 += ((Vector3)(ref val4)).normalized * num3 + Vector3.up * num3 * 0.4f; _arcs[i].SetPosition(j, val2); } _arcs[i].widthMultiplier = Mathf.Lerp(0.05f, 0.14f, num) * _intensity; } } } public static GameObject Spawn(Vector3 contact, Transform valuable, float intensity, float duration) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: 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_01db: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ValuableParryAbsorption"); val.transform.position = contact; GameObject val2 = new GameObject("Glow"); val2.transform.SetParent(val.transform, false); if ((Object)(object)valuable != (Object)null) { val2.transform.position = valuable.position; } Light val3 = val2.AddComponent<Light>(); val3.type = (LightType)2; val3.color = new Color(0.45f, 0.9f, 1f); val3.range = 8f + intensity * 4f; val3.intensity = 8f * intensity; GameObject val4 = new GameObject("PullParticles"); val4.transform.SetParent(val.transform, false); val4.transform.position = contact; ParticleSystem obj = val4.AddComponent<ParticleSystem>(); MainModule main = obj.main; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(Mathf.Max(0.08f, duration)); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0.2f); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.05f * intensity); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.7f, 0.95f, 1f, 0.85f)); ((MainModule)(ref main)).maxParticles = 64; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission = obj.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(80f * intensity); ShapeModule shape = obj.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 0.12f; TrailModule trails = obj.trails; ((TrailModule)(ref trails)).enabled = true; ((TrailModule)(ref trails)).lifetime = MinMaxCurve.op_Implicit(0.15f); ParticleSystemRenderer component = val4.GetComponent<ParticleSystemRenderer>(); component.renderMode = (ParticleSystemRenderMode)0; Material val5 = ParryShaders.Make(new Color(0.7f, 0.95f, 1f, 0.9f)); if ((Object)(object)val5 != (Object)null) { ((Renderer)component).material = val5; } val.AddComponent<AbsorptionDriver>().Init(contact, valuable, val3, duration, intensity); Object.Destroy((Object)(object)val, duration + 0.4f); return val; } } internal static class CameraEffects { public static void ShakeDetonation(Vector3 position, float intensity) { //IL_0020: 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) float num = Mathf.Max(0f, intensity) * ParryConfig.CameraShake.Value; if (!(num <= 0.01f)) { SemiFunc.CameraShakeImpactDistance(position, 5.5f * num, 0.4f, 0.5f, 16f); SemiFunc.CameraShakeDistance(position, 3.2f * num, 0.5f, 1f, 18f); } } } internal static class DetonationEffect { private class DetonationDriver : MonoBehaviour { private Light _light; private Transform _ring; private float _radius; private float _intensity; private float _age; public void Init(Light light, Transform ring, float radius, float intensity) { _light = light; _ring = ring; _radius = radius; _intensity = intensity; } private void Update() { //IL_0092: 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_00cb: 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_00ee: Unknown result type (might be due to invalid IL or missing references) _age += Time.deltaTime; float num = Mathf.Clamp01(_age / 0.35f); if ((Object)(object)_light != (Object)null) { _light.intensity = Mathf.Lerp(22f * _intensity, 0f, num); } if ((Object)(object)_ring != (Object)null) { float num2 = Mathf.Lerp(0.35f, Mathf.Max(3f, _radius * 3.2f), Mathf.Sqrt(num)); _ring.localScale = Vector3.one * num2; MeshRenderer component = ((Component)_ring).GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null && (Object)(object)((Renderer)component).material != (Object)null) { Color color = ((Renderer)component).material.color; color.a = Mathf.Lerp(0.35f, 0f, num); ((Renderer)component).material.color = color; } } } } public static void Spawn(Vector3 position, float radius, float intensity) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00eb: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_019c: 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_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0224: 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_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Expected O, but got Unknown GameObject val = new GameObject("ValuableParryDetonation"); val.transform.position = position; GameObject val2 = new GameObject("Flash"); val2.transform.SetParent(val.transform, false); Light val3 = val2.AddComponent<Light>(); val3.type = (LightType)2; val3.color = new Color(1f, 0.95f, 0.75f); val3.range = Mathf.Max(10f, radius * 3f); val3.intensity = 22f * intensity; GameObject val4 = new GameObject("Burst"); val4.transform.SetParent(val.transform, false); ParticleSystem val5 = val4.AddComponent<ParticleSystem>(); MainModule main = val5.main; ((MainModule)(ref main)).duration = 0.4f; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.35f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(4f * intensity); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.08f * intensity); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.85f, 0.95f, 1f, 1f)); ((MainModule)(ref main)).maxParticles = 80; ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.2f); EmissionModule emission = val5.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1] { new Burst(0f, (short)Mathf.RoundToInt(40f * intensity)) }); ShapeModule shape = val5.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 0.15f; ParticleSystemRenderer component = val4.GetComponent<ParticleSystemRenderer>(); Material val6 = ParryShaders.Make(Color.white); if ((Object)(object)val6 != (Object)null) { ((Renderer)component).material = val6; } GameObject val7 = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)val7).name = "Shockwave"; val7.transform.SetParent(val.transform, false); val7.transform.localScale = Vector3.one * 0.2f; Object.Destroy((Object)(object)val7.GetComponent<Collider>()); MeshRenderer component2 = val7.GetComponent<MeshRenderer>(); Material val8 = ParryShaders.Make(new Color(0.75f, 0.95f, 1f, 0.55f)); if ((Object)(object)val8 == (Object)null) { val8 = new Material(Shader.Find("Sprites/Default")); } val8.color = new Color(0.75f, 0.95f, 1f, 0.55f); ((Renderer)component2).material = val8; ((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0; val.AddComponent<DetonationDriver>().Init(val3, val7.transform, radius, intensity); Object.Destroy((Object)(object)val, 0.7f); } } internal static class ParryAudio { private static AudioClip _thump; private static AudioClip _hum; private static AudioClip _overload; private static AudioClip _boom; private static bool _built; public static void PlayThump(Vector3 position, float intensity) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) EnsureClips(); Play(_thump, position, 0.85f * intensity, 0.7f); } public static void PlayHum(Vector3 position, float intensity) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) EnsureClips(); Play(_hum, position, 0.55f * intensity, 1f); } public static void PlayOverload(Vector3 position, float intensity) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) EnsureClips(); Play(_overload, position, 0.7f * intensity, 1.2f); } public static void PlayDetonation(Vector3 position, float intensity) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) EnsureClips(); Play(_boom, position, 1.1f * intensity, 0.55f + intensity * 0.15f); } private static void Play(AudioClip clip, Vector3 position, float volume, float pitch) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown if (!((Object)(object)clip == (Object)null)) { GameObject val = new GameObject("ValuableParryAudio"); val.transform.position = position; AudioSource obj = val.AddComponent<AudioSource>(); obj.clip = clip; obj.spatialBlend = 1f; obj.rolloffMode = (AudioRolloffMode)1; obj.minDistance = 1.5f; obj.maxDistance = 22f; obj.volume = Mathf.Clamp01(volume); obj.pitch = Mathf.Clamp(pitch, 0.4f, 1.8f); obj.Play(); Object.Destroy((Object)val, clip.length + 0.1f); } } private static void EnsureClips() { if (!_built) { _built = true; _thump = Build("parry-thump", 0.18f, delegate(float t, float n) { float num = Mathf.Exp((0f - t) * 18f); return (Mathf.Sin(t * 90f * MathF.PI * 2f) * 0.7f + n * 0.3f) * num; }); _hum = Build("parry-hum", 0.16f, delegate(float t, float n) { float num = Mathf.Sin(Mathf.Clamp01(t / 0.16f) * MathF.PI); float num2 = Mathf.Lerp(180f, 420f, t / 0.16f); return (Mathf.Sin(t * num2 * MathF.PI * 2f) + n * 0.08f) * num * 0.5f; }); _overload = Build("parry-overload", 0.08f, delegate(float t, float n) { float num = t / 0.08f; float num2 = Mathf.Lerp(400f, 1400f, num); return (Mathf.Sin(t * num2 * MathF.PI * 2f) + n * 0.15f) * num; }); _boom = Build("parry-boom", 0.42f, delegate(float t, float n) { float num = Mathf.Exp((0f - t) * 7f); float num2 = Mathf.Sin(t * 55f * MathF.PI * 2f); float num3 = Mathf.Sin(t * 110f * MathF.PI * 2f) * 0.4f; return (num2 + num3 + n * 0.45f) * num; }); } } private static AudioClip Build(string name, float duration, Func<float, float, float> sample) { int num = Mathf.CeilToInt(duration * 22050f); float[] array = new float[num]; Random random = new Random(name.GetHashCode()); for (int i = 0; i < num; i++) { float arg = (float)i / 22050f; float arg2 = (float)(random.NextDouble() * 2.0 - 1.0); array[i] = Mathf.Clamp(sample(arg, arg2), -1f, 1f); } AudioClip obj = AudioClip.Create(name, num, 1, 22050, false); obj.SetData(array, 0); return obj; } } internal static class ParryEffectController { public static void PlayCapture(Vector3 contact, float intensity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ParryAudio.PlayThump(contact, intensity); } public static GameObject PlayAbsorption(Vector3 contact, Transform valuable, float intensity, float duration) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) ParryAudio.PlayHum(contact, intensity); return AbsorptionEffect.Spawn(contact, valuable, intensity, duration); } public static void PlayOverload(Vector3 position, float intensity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ParryAudio.PlayOverload(position, intensity); } public static void PlayDetonation(Vector3 position, float radius, float intensity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) ParryAudio.PlayDetonation(position, intensity); DetonationEffect.Spawn(position, radius, intensity); CameraEffects.ShakeDetonation(position, intensity); } } internal static class ParryShaders { private static Shader _cached; private static bool _searched; public static Shader Unlit { get { if (_searched) { return _cached; } _searched = true; string[] array = new string[8] { "Universal Render Pipeline/Unlit", "Universal Render Pipeline/Particles/Unlit", "Sprites/Default", "UI/Default", "Unlit/Color", "Unlit/Transparent", "Particles/Standard Unlit", "Hidden/InternalErrorShader" }; foreach (string text in array) { Shader val = Shader.Find(text); if ((Object)(object)val != (Object)null) { _cached = val; Plugin.LogVerbose("Parry VFX shader: " + text); return _cached; } } return null; } } public static Material Make(Color color) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_001f: Expected O, but got Unknown //IL_0032: 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) Shader unlit = Unlit; if ((Object)(object)unlit == (Object)null) { return null; } Material val = new Material(unlit) { color = color }; if (val.HasProperty("_BaseColor")) { val.SetColor("_BaseColor", color); } if (val.HasProperty("_Color")) { val.SetColor("_Color", color); } return val; } } } namespace RepoValuableParry.Detection { internal static class AttackDetector { private static readonly List<IParryAttackAdapter> Adapters = new List<IParryAttackAdapter> { new BeamerAdapter(), new ReaperAdapter(), new TrudgeAdapter(), new GenericMeleeAdapter() }; public static IParryAttackAdapter FindAdapter(HurtCollider collider) { foreach (IParryAttackAdapter adapter in Adapters) { if (adapter.CanHandle(collider)) { return adapter; } } return null; } } internal static class HeldValuableDetector { public static bool TryGetHeldValuable(PlayerAvatar player, out PhysGrabObject phys, out ValuableObject valuable, out ParryRejectReason reject) { phys = null; valuable = null; reject = ParryRejectReason.NoHeldObject; if ((Object)(object)player == (Object)null) { return false; } PhysGrabber physGrabber = player.physGrabber; if ((Object)(object)physGrabber == (Object)null || !physGrabber.grabbed) { return false; } phys = GameAccess.GetGrabbed(physGrabber); if ((Object)(object)phys == (Object)null) { return false; } valuable = ((Component)phys).GetComponent<ValuableObject>(); if ((Object)(object)valuable == (Object)null) { reject = ParryRejectReason.NotValuable; return false; } reject = ParryRejectReason.None; return true; } public static bool TryGetLocalHeldValuable(out PhysGrabObject phys, out ValuableObject valuable, out ParryRejectReason reject) { phys = null; valuable = null; reject = ParryRejectReason.NoHeldObject; if (!SemiFunc.PhysGrabberLocalIsGrabbing()) { return false; } phys = SemiFunc.PhysGrabberLocalGetGrabbedPhysGrabObject(); if ((Object)(object)phys == (Object)null) { return false; } valuable = ((Component)phys).GetComponent<ValuableObject>(); if ((Object)(object)valuable == (Object)null) { reject = ParryRejectReason.NotValuable; return false; } reject = ParryRejectReason.None; return true; } } internal static class ValuableCoverageDetector { public static bool CoversPlayer(Bounds valuableBounds, Vector3 attackOrigin, Vector3 playerBodyPoint, out float coverage, out Vector3 contactPoint) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_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_0040: 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_0056: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0074: 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_007b: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_00f8: 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_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_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_00e6: Unknown result type (might be due to invalid IL or missing references) coverage = 0f; contactPoint = ((Bounds)(ref valuableBounds)).ClosestPoint(playerBodyPoint); Vector3 val = playerBodyPoint - attackOrigin; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.05f) { return false; } Vector3 val2 = val / magnitude; float num = Vector3.Dot(((Bounds)(ref valuableBounds)).center - attackOrigin, val2); if (num < -0.25f) { return false; } Vector3 val3 = attackOrigin + val2 * Mathf.Clamp(num, 0f, magnitude); Vector3 val4 = ((Bounds)(ref valuableBounds)).ClosestPoint(val3); float num2 = Vector3.Distance(val3, val4); Vector3 extents = ((Bounds)(ref valuableBounds)).extents; float num3 = ((Vector3)(ref extents)).magnitude * 0.5f + ParryConfig.CoverageForgiveness.Value + 0.25f; bool flag = num2 <= num3; float num4 = default(float); if (((Bounds)(ref valuableBounds)).IntersectRay(new Ray(attackOrigin, val2), ref num4) && num4 <= magnitude + 0.5f) { flag = true; contactPoint = attackOrigin + val2 * num4; } else { contactPoint = val4; } coverage = TorsoCoverage(valuableBounds, playerBodyPoint, val2); if (flag && coverage < ParryConfig.MinimumCoverage.Value) { coverage = ParryConfig.MinimumCoverage.Value; } return flag; } public static bool CoversBeam(HurtCollider beamCollider, Bounds valuableBounds, Vector3 beamOrigin, Vector3 playerBodyPoint, out float coverage, out Vector3 contactPoint) { //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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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_0080: 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_008d: 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_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) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) coverage = 0f; contactPoint = ((Bounds)(ref valuableBounds)).ClosestPoint(playerBodyPoint); Collider val = (((Object)(object)beamCollider != (Object)null) ? ((Component)beamCollider).GetComponent<Collider>() : null); Vector3 val2 = beamOrigin; Vector3 val3 = playerBodyPoint - val2; float num = ((Vector3)(ref val3)).magnitude; if (num > 0.05f) { val3 /= num; } Vector3 val4; if ((Object)(object)val != (Object)null) { Vector3 forward = ((Component)val).transform.forward; if (((Vector3)(ref forward)).sqrMagnitude > 0.001f) { Bounds bounds = val.bounds; Vector3 center = ((Bounds)(ref bounds)).center; Vector3 normalized = ((Vector3)(ref forward)).normalized; bounds = val.bounds; val4 = ((Bounds)(ref bounds)).size; val2 = center - normalized * (((Vector3)(ref val4)).magnitude * 0.5f); Vector3 val5 = val.ClosestPoint(((Bounds)(ref valuableBounds)).center); contactPoint = ((Bounds)(ref valuableBounds)).ClosestPoint(val5); float num2 = Vector3.Distance(val5, contactPoint); float num3 = ParryConfig.CoverageForgiveness.Value + 0.35f; if (num2 <= num3) { coverage = 1f; return true; } val3 = ((Vector3)(ref forward)).normalized; num = Mathf.Max(num, ((Component)val).transform.lossyScale.z); val2 = ((Component)val).transform.position; } } Ray val6 = default(Ray); ((Ray)(ref val6))..ctor(val2, val3); float num4 = default(float); if (((Bounds)(ref valuableBounds)).IntersectRay(val6, ref num4) && num4 >= -0.5f && num4 <= num + 0.5f) { contactPoint = val2 + val3 * Mathf.Max(0f, num4); coverage = 1f; return true; } float num5 = Vector3.Dot(((Bounds)(ref valuableBounds)).center - val2, val3); if (num5 < -0.25f || num5 > num + 0.75f) { return CoversPlayer(valuableBounds, beamOrigin, playerBodyPoint, out coverage, out contactPoint); } Vector3 val7 = val2 + val3 * num5; contactPoint = ((Bounds)(ref valuableBounds)).ClosestPoint(val7); float num6 = Vector3.Distance(val7, contactPoint); val4 = ((Bounds)(ref valuableBounds)).extents; float num7 = ((Vector3)(ref val4)).magnitude * 0.35f + ParryConfig.CoverageForgiveness.Value + 0.35f; bool num8 = num6 <= num7; if (num8) { coverage = 1f; } return num8; } public static bool CoversContact(Bounds valuableBounds, Vector3 enemyPosition, Vector3 playerBodyPoint, out float coverage, out Vector3 contactPoint) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0099: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) coverage = 0f; contactPoint = ((Bounds)(ref valuableBounds)).ClosestPoint(playerBodyPoint); Vector3 center = ((Bounds)(ref valuableBounds)).center; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(enemyPosition.x, enemyPosition.z); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(playerBodyPoint.x, playerBodyPoint.z); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(center.x, center.z); Vector2 val4 = val2 - val; float magnitude = ((Vector2)(ref val4)).magnitude; float num = ParryConfig.CoverageForgiveness.Value + 0.7f; Vector3 extents = ((Bounds)(ref valuableBounds)).extents; float num2 = ((Vector3)(ref extents)).magnitude + num; if (magnitude < 1.6f) { float num3 = Vector2.Distance(val3, val); float num4 = Vector2.Distance(val3, val2); if (num3 <= 2.4f || num4 <= 2.2f) { coverage = 1f; contactPoint = ((Bounds)(ref valuableBounds)).ClosestPoint(enemyPosition); return true; } } if (magnitude < 0.05f) { return false; } Vector2 val5 = val4 / magnitude; float num5 = Vector2.Dot(val3 - val, val5); if (num5 < -0.4f || num5 > magnitude + 0.6f) { return false; } if (Vector2.Distance(val + val5 * num5, val3) <= num2) { coverage = 1f; contactPoint = center; return true; } return false; } private static float TorsoCoverage(Bounds valuableBounds, Vector3 playerBodyPoint, Vector3 attackDir) { //IL_0000: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0083: 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_008a: 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_0098: 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_00b7: 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_00c4: 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_00da: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = new Bounds(playerBodyPoint, new Vector3(0.7f, 0.9f, 0.6f)); Vector3 val = Vector3.Cross(attackDir, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.Cross(attackDir, Vector3.right); } ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.Cross(attackDir, val); Vector3 normalized = ((Vector3)(ref val2)).normalized; ProjectAabb(bounds, val, normalized, out var min, out var max); ProjectAabb(valuableBounds, val, normalized, out var min2, out var max2); Vector2 val3 = Vector2.Max(min, min2); Vector2 val4 = Vector2.Min(max, max2) - val3; if (val4.x <= 0f || val4.y <= 0f) { return 0f; } float num = Mathf.Max(0.0001f, (max.x - min.x) * (max.y - min.y)); return Mathf.Clamp01(val4.x * val4.y / num); } private static void ProjectAabb(Bounds bounds, Vector3 axisA, Vector3 axisB, out Vector2 min, out Vector2 max) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_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_001f: 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_002b: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_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_008d: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00ad: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00d9: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_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_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) Vector3 center = ((Bounds)(ref bounds)).center; Vector3 extents = ((Bounds)(ref bounds)).extents; Vector3[] obj = new Vector3[8] { center + new Vector3(extents.x, extents.y, extents.z), center + new Vector3(extents.x, extents.y, 0f - extents.z), center + new Vector3(extents.x, 0f - extents.y, extents.z), center + new Vector3(extents.x, 0f - extents.y, 0f - extents.z), center + new Vector3(0f - extents.x, extents.y, extents.z), center + new Vector3(0f - extents.x, extents.y, 0f - extents.z), center + new Vector3(0f - extents.x, 0f - extents.y, extents.z), center + new Vector3(0f - extents.x, 0f - extents.y, 0f - extents.z) }; min = new Vector2(float.PositiveInfinity, float.PositiveInfinity); max = new Vector2(float.NegativeInfinity, float.NegativeInfinity); Vector3[] array = (Vector3[])(object)obj; Vector2 val2 = default(Vector2); foreach (Vector3 val in array) { ((Vector2)(ref val2))..ctor(Vector3.Dot(val, axisA), Vector3.Dot(val, axisB)); min = Vector2.Min(min, val2); max = Vector2.Max(max, val2); } } } } namespace RepoValuableParry.Destruction { internal static class ValuableSacrifice { public static SacrificedValuableData Capture(ValuableObject valuable, PhysGrabObject phys) { //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_0081: 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_009f: 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_00a4: 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_00b4: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) GameObject val = (((Object)(object)valuable != (Object)null) ? ((Component)valuable).gameObject : (((Object)(object)phys != (Object)null) ? ((Component)phys).gameObject : null)); Bounds bounds = ParryCapacityCalculator.CombineColliderBounds(val); return new SacrificedValuableData { Name = (((Object)(object)val != (Object)null) ? ((Object)val).name.Replace("(Clone)", "").Trim() : "Valuable"), DollarValue = GameAccess.GetDollarValue(valuable), Mass = ParryCapacityCalculator.GetMass(phys, valuable), Bounds = bounds, Position = (((Object)(object)val != (Object)null) ? val.transform.position : Vector3.zero), Rotation = (((Object)(object)val != (Object)null) ? val.transform.rotation : Quaternion.identity), Scale = (((Object)(object)val != (Object)null) ? val.transform.lossyScale : Vector3.one) }; } public static void DestroyVanilla(ValuableObject valuable, PhysGrabObject phys) { if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } PhysGrabObjectImpactDetector val = (((Object)(object)phys != (Object)null) ? ((Component)phys).GetComponent<PhysGrabObjectImpactDetector>() : (((Object)(object)valuable != (Object)null) ? ((Component)valuable).GetComponent<PhysGrabObjectImpactDetector>() : null)); if ((Object)(object)val == (Object)null) { if ((Object)(object)phys != (Object)null) { Object.Destroy((Object)(object)((Component)phys).gameObject); } else if ((Object)(object)valuable != (Object)null) { Object.Destroy((Object)(object)((Component)valuable).gameObject); } Plugin.LogWarning("Valuable had no PhysGrabObjectImpactDetector; used fallback destroy."); } else { val.destroyDisable = false; val.DestroyObject(true); } } } } namespace RepoValuableParry.DebugTools { internal sealed class DebugCommands : MonoBehaviour { } internal sealed class DebugGizmos : MonoBehaviour { private LineRenderer _attack; private LineRenderer _knockEnemy; private LineRenderer _knockPlayer; private GameObject _boundsBox; private GameObject _contact; private void Awake() { //IL_001b: 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) //IL_0079: 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_00f9: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown //IL_01c5: Unknown result type (might be due to invalid IL or missing references) _attack = MakeLine("AttackLine", new Color(1f, 0.15f, 0.15f, 0.95f), 0.02f); _knockEnemy = MakeLine("EnemyKnock", new Color(0.25f, 0.45f, 1f, 0.95f), 0.025f); _knockPlayer = MakeLine("PlayerKnock", new Color(0.25f, 0.45f, 1f, 0.95f), 0.025f); _boundsBox = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)_boundsBox).name = "ValuableBounds"; _boundsBox.transform.SetParent(((Component)this).transform, false); Object.Destroy((Object)(object)_boundsBox.GetComponent<Collider>()); MeshRenderer component = _boundsBox.GetComponent<MeshRenderer>(); Material val = new Material(Shader.Find("Sprites/Default") ?? Shader.Find("Hidden/InternalErrorShader")); val.color = new Color(0.15f, 1f, 0.25f, 0.18f); ((Renderer)component).material = val; ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; _contact = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)_contact).name = "Contact"; _contact.transform.SetParent(((Component)this).transform, false); _contact.transform.localScale = Vector3.one * 0.12f; Object.Destroy((Object)(object)_contact.GetComponent<Collider>()); MeshRenderer component2 = _contact.GetComponent<MeshRenderer>(); Material val2 = new Material(Shader.Find("Sprites/Default") ?? Shader.Find("Hidden/InternalErrorShader")); val2.color = new Color(1f, 0.92f, 0.15f, 0.9f); ((Renderer)component2).material = val2; SetVisible(visible: false); } private void LateUpdate() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) if ((!ParryConfig.DebugGizmos.Value && !ParryConfig.DebugOverlay.Value) || (Object)(object)ParryManager.Instance == (Object)null) { SetVisible(visible: false); return; } ParryContext lastContext = ParryManager.Instance.LastContext; AttackData lastAttack = ParryManager.Instance.LastAttack; ValuableStats lastStats = ParryManager.Instance.LastStats; if (!((Object)(object)lastAttack.Collider != (Object)null) && !(lastAttack.Origin != Vector3.zero) && lastContext == null) { SetVisible(visible: false); return; } SetVisible(visible: true); Vector3 val = lastContext?.AttackOrigin ?? lastAttack.Origin; Vector3 val2 = lastContext?.ContactPoint ?? lastAttack.ContactPoint; Vector3 b = ((lastContext != null && (Object)(object)lastContext.Player != (Object)null) ? ((Component)lastContext.Player).transform.position : (((Object)(object)SemiFunc.PlayerGetLocal() != (Object)null) ? ((Component)SemiFunc.PlayerGetLocal()).transform.position : val)); Vector3 b2 = ((lastContext != null && (Object)(object)lastContext.Enemy != (Object)null) ? ((Component)lastContext.Enemy).transform.position : (val - Vector3.forward)); SetLine(_attack, val, b); Vector3 size = ((Bounds)(ref lastStats.Bounds)).size; if (((Vector3)(ref size)).sqrMagnitude > 0.0001f) { _boundsBox.transform.position = ((Bounds)(ref lastStats.Bounds)).center; _boundsBox.transform.rotation = Quaternion.identity; _boundsBox.transform.localScale = ((Bounds)(ref lastStats.Bounds)).size; } _contact.transform.position = ((val2 == Vector3.zero) ? ((Bounds)(ref lastStats.Bounds)).center : val2); if (lastContext != null) { SetLine(_knockEnemy, lastContext.ContactPoint, b2); SetLine(_knockPlayer, lastContext.ContactPoint, b); } } private void SetVisible(bool visible) { if ((Object)(object)_attack != (Object)null) { ((Renderer)_attack).enabled = visible; } if ((Object)(object)_knockEnemy != (Object)null) { ((Renderer)_knockEnemy).enabled = visible; } if ((Object)(object)_knockPlayer != (Object)null) { ((Renderer)_knockPlayer).enabled = visible; } if ((Object)(object)_boundsBox != (Object)null) { _boundsBox.SetActive(visible); } if ((Object)(object)_contact != (Object)null) { _contact.SetActive(visible); } } private static void SetLine(LineRenderer lr, Vector3 a, Vector3 b) { //IL_0013: 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) if (!((Object)(object)lr == (Object)null)) { lr.positionCount = 2; lr.SetPosition(0, a); lr.SetPosition(1, b); } } private LineRenderer MakeLine(string name, Color color, float width) { //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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0051: 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_0066: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(((Component)this).transform, false); LineRenderer obj = val.AddComponent<LineRenderer>(); obj.useWorldSpace = true; obj.positionCount = 2; obj.widthMultiplier = width; Material val2 = new Material(Shader.Find("Sprites/Default") ?? Shader.Find("Hidden/InternalErrorShader")); val2.color = color; ((Renderer)obj).material = val2; obj.startColor = color; obj.endColor = color; return obj; } } internal sealed class ParryDebugOverlay : MonoBehaviour { private GUIStyle _box; private GUIStyle _label; private GUIStyle _title; private void OnGUI() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) if (ParryConfig.DebugOverlay != null && ParryConfig.DebugOverlay.Value && !((Object)(object)ParryManager.Instance == (Object)null)) { EnsureStyles(); ParryManager instance = ParryManager.Instance; ValuableStats lastStats = instance.LastStats; AttackData lastAttack = instance.LastAttack; GUI.Box(new Rect(16f, 16f, 340f, 280f), GUIContent.none, _box); float num = 24f; GUI.Label(new Rect(28f, num, 300f, 22f), "VALUABLE PARRY", _title); num += 26f; GUI.Label(new Rect(28f, num, 300f, 20f), "Valuable: " + (string.IsNullOrEmpty(lastStats.Name) ? "-" : lastStats.Name), _label); num += 18f; GUI.Label(new Rect(28f, num, 300f, 20f), $"Mass: {lastStats.Mass:0.00} Area: {lastStats.ProjectedArea:0.00}", _label); num += 18f; GUI.Label(new Rect(28f, num, 300f, 20f), $"Coverage: {lastStats.Coverage:P0} Capacity: {lastStats.Capacity:0.0}", _label); num += 18f; GUI.Label(new Rect(28f, num, 300f, 20f), $"Dollar value (not used): {lastStats.DollarValue:0}", _label); num += 26f; GUI.Label(new Rect(28f, num, 300f, 20f), "Enemy: " + instance.LastEnemyName, _label); num += 18f; GUI.Label(new Rect(28f, num, 300f, 20f), $"Damage: {lastAttack.PlayerDamage} Hit Force: {lastAttack.PhysHitForce:0.00}", _label); num += 18f; GUI.Label(new Rect(28f, num, 300f, 20f), $"Tumble Force: {lastAttack.PlayerTumbleForce:0.00}", _label); num += 18f; GUI.Label(new Rect(28f, num, 300f, 20f), $"Attack Energy: {lastAttack.Energy:0.0}", _label); num += 26f; string text = (instance.LastWouldParry ? "PARRY POSSIBLE / CAPTURED" : ("NO PARRY (" + instance.LastReject.ToString() + ")")); GUI.Label(new Rect(28f, num, 300f, 22f), text, _title); } } private void EnsureStyles() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0029: 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_003b: Expected O, but got Unknown //IL_0046: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown if (_box == null) { _box = new GUIStyle(GUI.skin.box); _label = new GUIStyle(GUI.skin.label) { fontSize = 13 }; _title = new GUIStyle(GUI.skin.label) { fontSize = 14, fontStyle = (FontStyle)1 }; } } } } namespace RepoValuableParry.Core { internal static class GameAccess { private static readonly FieldRef<ValuableObject, float> DollarValueCurrent = AccessTools.FieldRefAccess<ValuableObject, float>("dollarValueCurrent"); private static readonly FieldRef<PlayerAvatar, PlayerTumble> Tumble = AccessTools.FieldRefAccess<PlayerAvatar, PlayerTumble>("tumble"); private static readonly FieldRef<PlayerAvatar, bool> IsLocal = AccessTools.FieldRefAccess<PlayerAvatar, bool>("isLocal"); private static readonly FieldRef<PhysGrabber, PhysGrabObject> GrabbedPhys = AccessTools.FieldRefAccess<PhysGrabber, PhysGrabObject>("grabbedPhysGrabObject"); private static readonly FieldRef<Enemy, EnemyRigidbody> EnemyRb = AccessTools.FieldRefAccess<Enemy, EnemyRigidbody>("Rigidbody"); private static readonly FieldRef<Enemy, bool> HasRb = AccessTools.FieldRefAccess<Enemy, bool>("HasRigidbody"); private static readonly FieldRef<Enemy, EnemyHealth> Health = AccessTools.FieldRefAccess<Enemy, EnemyHealth>("Health"); private static readonly FieldRef<Enemy, bool> HasHealth = AccessTools.FieldRefAccess<Enemy, bool>("HasHealth"); private static readonly FieldRef<Enemy, EnemyStateStunned> Stunned = AccessTools.FieldRefAccess<Enemy, EnemyStateStunned>("StateStunned"); private static readonly FieldRef<Enemy, bool> HasStunned = AccessTools.FieldRefAccess<Enemy, bool>("HasStateStunned"); private static readonly FieldRef<EnemyRigidbody, Rigidbody> ErbRb = AccessTools.FieldRefAccess<EnemyRigidbody, Rigidbody>("rb"); private static readonly FieldRef<PhysGrabObjectImpactDetec