Decompiled source of HeadBreak v1.1.0
HeadBreak.dll
Decompiled 2 weeks 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.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using HarmonyLib; using HeadBreakerMod; using Il2Cpp; using Il2CppActiveRagdoll; using Il2CppHurricaneVR.Framework.Core; using Il2CppHurricaneVR.Framework.Core.Grabbers; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using MelonLoader; using MelonLoader.Preferences; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Core), "HeadBreakerMod", "1.5.2", "YourName", null)] [assembly: MelonGame("Kubunautilus", "BrutalistickVR")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("HeadBreak")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("HeadBreak")] [assembly: AssemblyTitle("HeadBreak")] [assembly: AssemblyVersion("1.0.0.0")] namespace HeadBreakerMod; public static class Cfg { private static MelonPreferences_Category category; private static bool isRegistered; private static bool isInternalSaving; public static MelonPreferences_Entry<bool> Enabled; public static MelonPreferences_Entry<int> WallClimbMode; public static MelonPreferences_Entry<bool> EnableCombinedDamage; public static MelonPreferences_Entry<bool> VerboseLogging; public static MelonPreferences_Entry<bool> EnableWallSmash; public static MelonPreferences_Entry<bool> EnableHeavyWeaponBreak; public static MelonPreferences_Entry<bool> EnableLightWeaponBreak; public static MelonPreferences_Entry<bool> EnableThrownObjectBreak; public static MelonPreferences_Entry<bool> EnableFistBreak; public static MelonPreferences_Entry<bool> EnableButtstockGripBreak; public static MelonPreferences_Entry<bool> EnableHeadbuttBreak; public static MelonPreferences_Entry<bool> EnableKickBreak; public static MelonPreferences_Entry<int> WallSmashMaxHits; public static MelonPreferences_Entry<float> WallSmashBaseChance; public static MelonPreferences_Entry<float> WallSmashChanceAddPerHit; public static MelonPreferences_Entry<float> WallSmashHardBonusChance; public static MelonPreferences_Entry<float> WallSmashGrabbedMinSpeed; public static MelonPreferences_Entry<float> WallSmashHardSpeed; public static MelonPreferences_Entry<float> WallSmashGrabbedMinDelta; public static MelonPreferences_Entry<float> WallSmashFreeMinSpeed; public static MelonPreferences_Entry<float> WallSmashFreeMinDelta; public static MelonPreferences_Entry<float> WallContactRadius; public static MelonPreferences_Entry<int> HeavyWeaponMaxHits; public static MelonPreferences_Entry<float> HeavyWeaponBaseChance; public static MelonPreferences_Entry<float> HeavyWeaponChanceAddPerHit; public static MelonPreferences_Entry<float> HeavyWeaponMinSpeed; public static MelonPreferences_Entry<float> HeavyWeaponMinDelta; public static MelonPreferences_Entry<float> ThrownObjectHeavySpeed; public static MelonPreferences_Entry<int> LightHitMaxHits; public static MelonPreferences_Entry<int> LightHitStartChanceFromHit; public static MelonPreferences_Entry<float> LightHitBaseChance; public static MelonPreferences_Entry<float> LightHitChanceAddPerHit; public static MelonPreferences_Entry<float> LightHitMinSpeed; public static MelonPreferences_Entry<float> LightHitMinDelta; public static MelonPreferences_Entry<float> HeadbuttMinSpeed; public static MelonPreferences_Entry<float> HeadbuttRadius; public static MelonPreferences_Entry<int> KickMaxHits; public static MelonPreferences_Entry<float> KickBaseChance; public static MelonPreferences_Entry<float> KickChanceAddPerHit; public static MelonPreferences_Entry<float> KickHeadMaxDistance; public static MelonPreferences_Entry<bool> AlsoFractureJaw; public static MelonPreferences_Entry<bool> EnableGoreParticles; public static MelonPreferences_Entry<bool> EnableMiniHitGore; public static MelonPreferences_Entry<float> ActiveCheckRadius; public static bool FastEnabled = true; public static int FastWallClimbMode = 0; public static bool FastCombinedDamage = true; public static bool FastVerbose = true; public static bool FastEnableWallSmash = true; public static bool FastEnableHeavyWeapon = true; public static bool FastEnableLightWeapon = true; public static bool FastEnableThrownObject = true; public static bool FastEnableFist = true; public static bool FastEnableButtstockGrip = true; public static bool FastEnableHeadbutt = true; public static bool FastEnableKick = true; public static int FastWallMaxHits = 2; public static float FastWallBaseChance = 0.6f; public static float FastWallChanceStep = 0.4f; public static float FastWallHardBonus = 0.2f; public static float FastWallGrabMinSpeed = 6.8f; public static float FastWallHardSpeed = 9f; public static float FastWallGrabMinDelta = 5f; public static float FastWallFreeMinSpeed = 10f; public static float FastWallFreeMinDelta = 6f; public static float FastWallContactRadius = 0.135f; public static int FastHeavyMaxHits = 3; public static float FastHeavyBaseChance = 0.4f; public static float FastHeavyChanceStep = 0.3f; public static float FastHeavyMinSpeed = 8.5f; public static float FastHeavyMinDelta = 3.5f; public static float FastThrownHeavySpeed = 7.5f; public static int FastLightMaxHits = 4; public static int FastLightStartRollHit = 3; public static float FastLightBaseChance = 0f; public static float FastLightChanceStep = 0.25f; public static float FastLightMinSpeed = 4.5f; public static float FastLightMinDelta = 2f; public static float FastHeadbuttMinSpeed = 1.6f; public static float FastHeadbuttRadius = 0.25f; public static float FastHeadbuttRadiusSqr = 0.0625f; public static float FastHeadbuttResetRadiusSqr = 0.1024f; public static int FastKickMaxHits = 1; public static float FastKickBaseChance = 1f; public static float FastKickChanceStep = 1f; public static float FastKickMaxDist = 0.38f; public static bool FastFractureJaw = true; public static bool FastGoreParticles = true; public static bool FastMiniHitGore = true; public static float FastActiveRadiusSqr = 196f; private static T Get<T>(MelonPreferences_Entry<T> entry, T fallback) { return (entry != null) ? entry.Value : fallback; } public static void Register() { if (isRegistered && category != null) { SyncCache(); return; } try { category = MelonPreferences.CreateCategory("HeadBreakerMod", "HeadBreakerMod Settings"); Enabled = category.CreateEntry<bool>("Enabled", true, "Включить мод HeadBreaker", (string)null, false, false, (ValueValidator)null, (string)null); WallClimbMode = category.CreateEntry<int>("WallClimbMode", 0, "Режим стен: 0 = Auto, 1 = С модом WallClimb, 2 = Без мода WallClimb", (string)null, false, false, (ValueValidator)null, (string)null); EnableCombinedDamage = category.CreateEntry<bool>("EnableCombinedDamage", true, "Суммировать ли прогресс травмы от разных типов ударов (например, кулаки + стена)", (string)null, false, false, (ValueValidator)null, (string)null); VerboseLogging = category.CreateEntry<bool>("VerboseLogging", true, "Выводить логи ударов и шансов в консоль MelonLoader", (string)null, false, false, (ValueValidator)null, (string)null); EnableWallSmash = category.CreateEntry<bool>("EnableWallSmash", true, "Разрешить дробление головы от ударов об стены/пол/лестницы", (string)null, false, false, (ValueValidator)null, (string)null); EnableHeavyWeaponBreak = category.CreateEntry<bool>("EnableHeavyWeaponBreak", true, "Разрешить дробление головы от сильных ударов дробящим оружием", (string)null, false, false, (ValueValidator)null, (string)null); EnableLightWeaponBreak = category.CreateEntry<bool>("EnableLightWeaponBreak", true, "Разрешить накопление урона от слабых ударов дробящим оружием", (string)null, false, false, (ValueValidator)null, (string)null); EnableThrownObjectBreak = category.CreateEntry<bool>("EnableThrownObjectBreak", true, "Разрешить дробление головы от брошенных предметов", (string)null, false, false, (ValueValidator)null, (string)null); EnableFistBreak = category.CreateEntry<bool>("EnableFistBreak", true, "Разрешить дробление головы серией ударов кулаками/ладонями", (string)null, false, false, (ValueValidator)null, (string)null); EnableButtstockGripBreak = category.CreateEntry<bool>("EnableButtstockGripBreak", true, "Разрешить дробление головы ударами прикладом и рукоятью оружия", (string)null, false, false, (ValueValidator)null, (string)null); EnableHeadbuttBreak = category.CreateEntry<bool>("EnableHeadbuttBreak", true, "Разрешить дробление головы ударами об голову (VR-шлем) игрока", (string)null, false, false, (ValueValidator)null, (string)null); EnableKickBreak = category.CreateEntry<bool>("EnableKickBreak", true, "Разрешить дробление головы пинком ноги", (string)null, false, false, (ValueValidator)null, (string)null); WallSmashMaxHits = category.CreateEntry<int>("WallSmashMaxHits", 2, "Сколько ударов об стену гарантированно (100%) раскалывают голову", (string)null, false, false, (ValueValidator)null, (string)null); WallSmashBaseChance = category.CreateEntry<float>("WallSmashBaseChance", 0.6f, "Базовый шанс расколоть голову с 1-го удара об стену (0.0 - 1.0)", (string)null, false, false, (ValueValidator)null, (string)null); WallSmashChanceAddPerHit = category.CreateEntry<float>("WallSmashChanceAddPerHit", 0.4f, "Прибавка к шансу за каждый следующий удар об стену (0.0 - 1.0)", (string)null, false, false, (ValueValidator)null, (string)null); WallSmashHardBonusChance = category.CreateEntry<float>("WallSmashHardBonusChance", 0.2f, "Доп. бонус к шансу при очень сильном ударе об стену (0.0 - 1.0)", (string)null, false, false, (ValueValidator)null, (string)null); WallSmashGrabbedMinSpeed = category.CreateEntry<float>("WallSmashGrabbedMinSpeed", 6.8f, "Мин. скорость головы для удара об стену в захвате (м/с)", (string)null, false, false, (ValueValidator)null, (string)null); WallSmashHardSpeed = category.CreateEntry<float>("WallSmashHardSpeed", 9f, "Скорость головы для бонуса сильного удара об стену (м/с)", (string)null, false, false, (ValueValidator)null, (string)null); WallSmashGrabbedMinDelta = category.CreateEntry<float>("WallSmashGrabbedMinDelta", 5f, "Мин. гашение скорости головы при ударе об стену в захвате (м/с)", (string)null, false, false, (ValueValidator)null, (string)null); WallSmashFreeMinSpeed = category.CreateEntry<float>("WallSmashFreeMinSpeed", 10f, "Мин. скорость для удара об стену в свободном полёте (м/с)", (string)null, false, false, (ValueValidator)null, (string)null); WallSmashFreeMinDelta = category.CreateEntry<float>("WallSmashFreeMinDelta", 6f, "Мин. гашение скорости об стену в свободном полёте (м/с)", (string)null, false, false, (ValueValidator)null, (string)null); WallContactRadius = category.CreateEntry<float>("WallContactRadius", 0.135f, "Макс. дистанция от центра головы до поверхности стены при контакте (м)", (string)null, false, false, (ValueValidator)null, (string)null); HeavyWeaponMaxHits = category.CreateEntry<int>("HeavyWeaponMaxHits", 3, "Сколько сильных ударов оружием гарантированно (100%) раскалывают голову", (string)null, false, false, (ValueValidator)null, (string)null); HeavyWeaponBaseChance = category.CreateEntry<float>("HeavyWeaponBaseChance", 0.4f, "Базовый шанс расколоть голову с 1-го сильного удара оружием (0.0 - 1.0)", (string)null, false, false, (ValueValidator)null, (string)null); HeavyWeaponChanceAddPerHit = category.CreateEntry<float>("HeavyWeaponChanceAddPerHit", 0.3f, "Прибавка к шансу за каждый следующий сильный удар оружием (0.0 - 1.0)", (string)null, false, false, (ValueValidator)null, (string)null); HeavyWeaponMinSpeed = category.CreateEntry<float>("HeavyWeaponMinSpeed", 8.5f, "Мин. скорость сильного удара дробящим оружием (м/с)", (string)null, false, false, (ValueValidator)null, (string)null); HeavyWeaponMinDelta = category.CreateEntry<float>("HeavyWeaponMinDelta", 3.5f, "Мин. отклик головы при сильном ударе оружием (м/с)", (string)null, false, false, (ValueValidator)null, (string)null); ThrownObjectHeavySpeed = category.CreateEntry<float>("ThrownObjectHeavySpeed", 7.5f, "Мин. скорость брошенного предмета для сильного удара (м/с)", (string)null, false, false, (ValueValidator)null, (string)null); LightHitMaxHits = category.CreateEntry<int>("LightHitMaxHits", 4, "Сколько слабых ударов (кулак/приклад/голова) гарантированно раскалывают череп", (string)null, false, false, (ValueValidator)null, (string)null); LightHitStartChanceFromHit = category.CreateEntry<int>("LightHitStartChanceFromHit", 3, "С какого по счёту слабого удара начинает работать рандомный шанс", (string)null, false, false, (ValueValidator)null, (string)null); LightHitBaseChance = category.CreateEntry<float>("LightHitBaseChance", 0f, "Базовый шанс расколоть голову на 1-м слабом ударе (0.0 - 1.0)", (string)null, false, false, (ValueValidator)null, (string)null); LightHitChanceAddPerHit = category.CreateEntry<float>("LightHitChanceAddPerHit", 0.25f, "Прибавка к шансу за каждый слабый удар (0.0 - 1.0)", (string)null, false, false, (ValueValidator)null, (string)null); LightHitMinSpeed = category.CreateEntry<float>("LightHitMinSpeed", 4.5f, "Мин. скорость руки для зачёта слабого удара (м/с)", (string)null, false, false, (ValueValidator)null, (string)null); LightHitMinDelta = category.CreateEntry<float>("LightHitMinDelta", 2f, "Мин. отклик головы для зачёта слабого удара (м/с)", (string)null, false, false, (ValueValidator)null, (string)null); HeadbuttMinSpeed = category.CreateEntry<float>("HeadbuttMinSpeed", 1.6f, "Мин. скорость сближения голов для удара об голову игрока (м/с)", (string)null, false, false, (ValueValidator)null, (string)null); HeadbuttRadius = category.CreateEntry<float>("HeadbuttRadius", 0.25f, "Радиус контакта головы врага с головой игрока (м)", (string)null, false, false, (ValueValidator)null, (string)null); KickMaxHits = category.CreateEntry<int>("KickMaxHits", 1, "Сколько пинков ногой по голове гарантированно раскалывают череп (1 = ваншот)", (string)null, false, false, (ValueValidator)null, (string)null); KickBaseChance = category.CreateEntry<float>("KickBaseChance", 1f, "Базовый шанс расколоть голову с 1-го пинка ногой (0.0 - 1.0)", (string)null, false, false, (ValueValidator)null, (string)null); KickChanceAddPerHit = category.CreateEntry<float>("KickChanceAddPerHit", 1f, "Прибавка к шансу за каждый следующий пинок ногой (0.0 - 1.0)", (string)null, false, false, (ValueValidator)null, (string)null); KickHeadMaxDistance = category.CreateEntry<float>("KickHeadMaxDistance", 0.38f, "Макс. дистанция от точки пинка до головы (м)", (string)null, false, false, (ValueValidator)null, (string)null); AlsoFractureJaw = category.CreateEntry<bool>("AlsoFractureJaw", true, "Дробить челюсть (Jaw) вместе с головой", (string)null, false, false, (ValueValidator)null, (string)null); EnableGoreParticles = category.CreateEntry<bool>("EnableGoreParticles", true, "Спавнить эффекты крови и мяса при взрыве головы", (string)null, false, false, (ValueValidator)null, (string)null); EnableMiniHitGore = category.CreateEntry<bool>("EnableMiniHitGore", true, "Спавнить малые брызги крови при выдержанных ударах", (string)null, false, false, (ValueValidator)null, (string)null); ActiveCheckRadius = category.CreateEntry<float>("ActiveCheckRadius", 14f, "Радиус вокруг игрока для физической проверки голов (м, оптимизация FPS)", (string)null, false, false, (ValueValidator)null, (string)null); isRegistered = true; SyncCache(); isInternalSaving = true; MelonPreferences.Save(); isInternalSaving = false; } catch { isInternalSaving = false; } } public static void SyncCache() { if (!isRegistered || category == null) { return; } try { FastEnabled = Get(Enabled, fallback: true); FastWallClimbMode = Get(WallClimbMode, 0); FastCombinedDamage = Get(EnableCombinedDamage, fallback: true); FastVerbose = Get(VerboseLogging, fallback: true); FastEnableWallSmash = Get(EnableWallSmash, fallback: true); FastEnableHeavyWeapon = Get(EnableHeavyWeaponBreak, fallback: true); FastEnableLightWeapon = Get(EnableLightWeaponBreak, fallback: true); FastEnableThrownObject = Get(EnableThrownObjectBreak, fallback: true); FastEnableFist = Get(EnableFistBreak, fallback: true); FastEnableButtstockGrip = Get(EnableButtstockGripBreak, fallback: true); FastEnableHeadbutt = Get(EnableHeadbuttBreak, fallback: true); FastEnableKick = Get(EnableKickBreak, fallback: true); FastWallMaxHits = Mathf.Max(1, Get(WallSmashMaxHits, 2)); FastWallBaseChance = Mathf.Clamp01(Get(WallSmashBaseChance, 0.6f)); FastWallChanceStep = Mathf.Clamp01(Get(WallSmashChanceAddPerHit, 0.4f)); FastWallHardBonus = Mathf.Clamp01(Get(WallSmashHardBonusChance, 0.2f)); FastWallGrabMinSpeed = Mathf.Max(0.5f, Get(WallSmashGrabbedMinSpeed, 6.8f)); FastWallHardSpeed = Mathf.Max(FastWallGrabMinSpeed, Get(WallSmashHardSpeed, 9f)); FastWallGrabMinDelta = Mathf.Max(0.2f, Get(WallSmashGrabbedMinDelta, 5f)); FastWallFreeMinSpeed = Mathf.Max(1f, Get(WallSmashFreeMinSpeed, 10f)); FastWallFreeMinDelta = Mathf.Max(0.5f, Get(WallSmashFreeMinDelta, 6f)); FastWallContactRadius = Mathf.Clamp(Get(WallContactRadius, 0.135f), 0.08f, 0.3f); FastHeavyMaxHits = Mathf.Max(1, Get(HeavyWeaponMaxHits, 3)); FastHeavyBaseChance = Mathf.Clamp01(Get(HeavyWeaponBaseChance, 0.4f)); FastHeavyChanceStep = Mathf.Clamp01(Get(HeavyWeaponChanceAddPerHit, 0.3f)); FastHeavyMinSpeed = Mathf.Max(1f, Get(HeavyWeaponMinSpeed, 8.5f)); FastHeavyMinDelta = Mathf.Max(0.2f, Get(HeavyWeaponMinDelta, 3.5f)); FastThrownHeavySpeed = Mathf.Max(1f, Get(ThrownObjectHeavySpeed, 7.5f)); FastLightMaxHits = Mathf.Max(1, Get(LightHitMaxHits, 4)); FastLightStartRollHit = Mathf.Max(1, Get(LightHitStartChanceFromHit, 3)); FastLightBaseChance = Mathf.Clamp01(Get(LightHitBaseChance, 0f)); FastLightChanceStep = Mathf.Clamp01(Get(LightHitChanceAddPerHit, 0.25f)); FastLightMinSpeed = Mathf.Max(0.5f, Get(LightHitMinSpeed, 4.5f)); FastLightMinDelta = Mathf.Max(0.1f, Get(LightHitMinDelta, 2f)); FastHeadbuttMinSpeed = Mathf.Max(0.4f, Get(HeadbuttMinSpeed, 1.6f)); FastHeadbuttRadius = Mathf.Clamp(Get(HeadbuttRadius, 0.25f), 0.12f, 0.45f); FastHeadbuttRadiusSqr = FastHeadbuttRadius * FastHeadbuttRadius; float num = FastHeadbuttRadius + 0.07f; FastHeadbuttResetRadiusSqr = num * num; FastKickMaxHits = Mathf.Max(1, Get(KickMaxHits, 1)); FastKickBaseChance = Mathf.Clamp01(Get(KickBaseChance, 1f)); FastKickChanceStep = Mathf.Clamp01(Get(KickChanceAddPerHit, 1f)); FastKickMaxDist = Mathf.Max(0.15f, Get(KickHeadMaxDistance, 0.38f)); FastFractureJaw = Get(AlsoFractureJaw, fallback: true); FastGoreParticles = Get(EnableGoreParticles, fallback: true); FastMiniHitGore = Get(EnableMiniHitGore, fallback: true); float num2 = Mathf.Max(3f, Get(ActiveCheckRadius, 14f)); FastActiveRadiusSqr = num2 * num2; } catch { } } public static bool IsSavingInternally() { return isInternalSaving; } } public class Core : MelonMod { private sealed class CachedColliderInfo { public bool isSharpBlade; public bool isFirearmOrGripPart; public bool hasBluntForceManager; public bool isNamedBlunt; public bool isStaticWallSurface; public bool isDynamicBody; public Rigidbody attachedRb; public GameObject rootObj; public HVRGrabbable grabbable; } public sealed class EnemyHeadTrack { public int stickId; public StickHealth stickHealth; public Transform enemyRoot; public GameObject headObj; public GameObject jawObj; public Rigidbody headRb; public ColliderBridge headBridge; public Vector3 prevVelocity; public Vector3 currentVelocity; public float lastDeltaSpeed; public float spawnGraceUntil; public float recentPeakHeadSpeed; public Vector3 recentPeakHeadVel; public float recentPeakTimestamp; public HashSet<int> enemyColliderIds; public HashSet<IntPtr> enemyGrabbablePtrs; public Rigidbody[] bodyPartRbs; public string[] bodyPartNames; public bool isGrabbedByLeft; public bool isGrabbedByRight; public bool isGrabbedByPlayer; public float lastGrabbedTime; public bool inHeadbuttContact; public int wallSmashCount; public int heavyHitCount; public int lightHitCount; public int kickHitCount; public float accumulatedTrauma; public float lastHitRegisteredTime; public float slashImmunityUntil; } private const float TRAUMA_BREAK_THRESHOLD = 0.999f; private const float HIT_REGISTER_COOLDOWN = 0.22f; private const float SLASH_IMMUNITY_DURATION = 0.35f; private const float GRAB_MEMORY_DURATION = 0.65f; private const float PEAK_SPEED_WINDOW = 0.045f; private const float MIN_WALL_IMPACT_DOT = 0.35f; private const float HIT_DETECTED_HEAVY_DAMAGE = 24f; private const float HEAD_CRUSH_DAMAGE = 250f; private const float HEAD_MATCH_MAX_DISTANCE = 0.28f; private const float HEAD_OVERLAP_RADIUS = 0.2f; private const float CHUNK_SCATTER_RADIUS = 0.45f; private const float CHUNK_SCATTER_FORCE_MIN = 3f; private const float CHUNK_SCATTER_FORCE_MAX = 7f; private const float FALLBACK_SCAN_INTERVAL = 2.5f; private const string SOUND_FOLDER_NAME = "HeadBreakerSounds"; private const string SOUND_FILE_NAME = "HeadBreak.wav"; private static string headBreakSoundPath; private const int SND_ASYNC = 1; private const int SND_NODEFAULT = 2; private const int SND_FILENAME = 131072; public static Core Instance; private bool isWallClimbActive; private Transform playerRig; private Transform playerHeadTransform; private HVRHandGrabber leftHand; private HVRHandGrabber rightHand; private Rigidbody leftHandRb; private Rigidbody rightHandRb; private Vector3 leftHandPos; private Vector3 rightHandPos; private Vector3 playerHeadPos; private Vector3 leftHandVelocity; private Vector3 rightHandVelocity; private Vector3 playerHeadVelocity; private Vector3 prevLeftHandPos; private Vector3 prevRightHandPos; private Vector3 prevPlayerHeadPos; private bool leftIsGrabbing; private bool rightIsGrabbing; private IntPtr leftGrabbedPtr; private IntPtr rightGrabbedPtr; private Transform leftGrabbedRoot; private Transform rightGrabbedRoot; private bool leftHoldingWall; private bool rightHoldingWall; private bool leftHoldingSharp; private bool rightHoldingSharp; private float fallbackScanTimer; private bool initialScanDone; private GameObject savedBloodPrefab; private GameObject savedFleshPrefab; private bool bloodPrefabsSearched; private static readonly HashSet<int> playerColliderIds = new HashSet<int>(); private static readonly HashSet<int> leftHandColliderIds = new HashSet<int>(); private static readonly HashSet<int> rightHandColliderIds = new HashSet<int>(); private static readonly HashSet<int> playerHeadColliderIds = new HashSet<int>(); private static readonly Dictionary<int, CachedColliderInfo> colliderCache = new Dictionary<int, CachedColliderInfo>(256); private static readonly Dictionary<int, EnemyHeadTrack> trackedHeads = new Dictionary<int, EnemyHeadTrack>(32); private static readonly List<EnemyHeadTrack> activeTracksList = new List<EnemyHeadTrack>(32); private static readonly HashSet<int> brokenSticks = new HashSet<int>(); private static readonly Dictionary<int, MemberInfo> memberCache = new Dictionary<int, MemberInfo>(); private static readonly string[] PURE_SHARP_BLADE_KEYWORDS = new string[24] { "katana", "knife", "dagger", "sword", "zweihander", "claw", "machete", "scythe", "rapier", "sabre", "saber", "kunai", "shuriken", "chainsaw", "scalpel", "stiletto", "assassin", "wakizashi", "tanto", "odachi", "claymore", "bayonet", "kukri", "mahitoblade" }; private static readonly string[] FIREARM_BUTTSTOCK_KEYWORDS = new string[16] { "shotgun", "rifle", "pistol", "revolver", "smg", "carbine", "stock", "buttstock", "pumpgrabbable", "receiver", "glock", "deagle", "ak47", "m4", "mp5", "uzi" }; private static readonly string[] BLUNT_WEAPON_KEYWORDS = new string[17] { "hammer", "crowbar", "mace", "club", "bat", "maul", "flail", "morningstar", "sledge", "wrench", "shovel", "baton", "tonfa", "nunchaku", "staff", "mallet", "warhammer" }; [DllImport("winmm.dll", SetLastError = true)] private static extern bool PlaySound(string szSound, IntPtr hMod, int fFlags); public override void OnEarlyInitializeMelon() { Instance = this; Cfg.Register(); } public override void OnInitializeMelon() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown Instance = this; Cfg.Register(); DetectWallClimbMode(); ((MelonBase)this).LoggerInstance.Msg("HeadBreakerMod v1.5.2 загружен. Режим стен: " + (isWallClimbActive ? "WithWallClimb" : "WithoutWallClimb") + ". Конфиг: UserData/MelonPreferences.cfg"); InitSound(); try { Harmony harmony = new Harmony("HeadBreakerMod.Patches"); PatchCombatMethods(harmony); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("HeadBreakerMod: ошибка Harmony: " + ex.Message); } } public override void OnPreferencesSaved() { if (Cfg.IsSavingInternally()) { return; } try { Cfg.SyncCache(); DetectWallClimbMode(); if (colliderCache != null) { colliderCache.Clear(); } } catch { } } public override void OnPreferencesLoaded() { try { Cfg.SyncCache(); DetectWallClimbMode(); if (colliderCache != null) { colliderCache.Clear(); } } catch { } } private void DetectWallClimbMode() { switch (Cfg.FastWallClimbMode) { case 1: isWallClimbActive = true; return; case 2: isWallClimbActive = false; return; } isWallClimbActive = false; try { foreach (MelonMod registeredMelon in MelonTypeBase<MelonMod>.RegisteredMelons) { if (registeredMelon != null && ((MelonBase)registeredMelon).Info != null && ((MelonBase)registeredMelon).Info.Name != null && ((MelonBase)registeredMelon).Info.Name.IndexOf("WallClimb", StringComparison.OrdinalIgnoreCase) >= 0) { isWallClimbActive = true; return; } } if (FindType("WallClimbMod") != null) { isWallClimbActive = true; } } catch { } } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) Cfg.Register(); Cfg.SyncCache(); DetectWallClimbMode(); trackedHeads.Clear(); activeTracksList.Clear(); brokenSticks.Clear(); playerColliderIds.Clear(); leftHandColliderIds.Clear(); rightHandColliderIds.Clear(); playerHeadColliderIds.Clear(); colliderCache.Clear(); playerRig = null; playerHeadTransform = null; leftHand = null; rightHand = null; leftHandRb = null; rightHandRb = null; leftHandPos = Vector3.zero; rightHandPos = Vector3.zero; playerHeadPos = Vector3.zero; leftHandVelocity = Vector3.zero; rightHandVelocity = Vector3.zero; playerHeadVelocity = Vector3.zero; leftIsGrabbing = false; rightIsGrabbing = false; leftGrabbedPtr = IntPtr.Zero; rightGrabbedPtr = IntPtr.Zero; leftGrabbedRoot = null; rightGrabbedRoot = null; leftHoldingWall = false; rightHoldingWall = false; leftHoldingSharp = false; rightHoldingSharp = false; fallbackScanTimer = 0.6f; initialScanDone = false; bloodPrefabsSearched = false; if (sceneName == "MainMenuScene") { return; } GameObject val = GameObject.Find("Hexa4Rig26.10.23"); if ((Object)(object)val == (Object)null) { return; } playerRig = val.transform; Transform obj = val.transform.Find("Physics LeftHand"); leftHand = ((obj != null) ? ((Component)obj).GetComponent<HVRHandGrabber>() : null); Transform obj2 = val.transform.Find("Physics RightHand"); rightHand = ((obj2 != null) ? ((Component)obj2).GetComponent<HVRHandGrabber>() : null); Camera val2 = Camera.main; if ((Object)(object)val2 == (Object)null) { val2 = val.GetComponentInChildren<Camera>(true); } if ((Object)(object)val2 != (Object)null) { playerHeadTransform = ((Component)val2).transform; prevPlayerHeadPos = playerHeadTransform.position; playerHeadPos = prevPlayerHeadPos; } if ((Object)(object)leftHand != (Object)null) { leftHandRb = ((Component)leftHand).GetComponent<Rigidbody>(); if ((Object)(object)leftHandRb == (Object)null) { leftHandRb = ((Component)leftHand).GetComponentInParent<Rigidbody>(); } prevLeftHandPos = ((Component)leftHand).transform.position; leftHandPos = prevLeftHandPos; } if ((Object)(object)rightHand != (Object)null) { rightHandRb = ((Component)rightHand).GetComponent<Rigidbody>(); if ((Object)(object)rightHandRb == (Object)null) { rightHandRb = ((Component)rightHand).GetComponentInParent<Rigidbody>(); } prevRightHandPos = ((Component)rightHand).transform.position; rightHandPos = prevRightHandPos; } BuildPlayerColliderCache(val); } private void BuildPlayerColliderCache(GameObject rig) { if ((Object)(object)rig == (Object)null) { return; } try { Collider[] array = Il2CppArrayBase<Collider>.op_Implicit(rig.GetComponentsInChildren<Collider>(true)); if (array != null) { foreach (Collider val in array) { if (!((Object)(object)val == (Object)null)) { int instanceID = ((Object)val).GetInstanceID(); playerColliderIds.Add(instanceID); string name = ((Object)((Component)val).gameObject).name; string text = LayerMask.LayerToName(((Component)val).gameObject.layer); if (text == "PlayerHead" || name.IndexOf("Head", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("Camera", StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)(object)playerHeadTransform != (Object)null && ((Component)val).transform.IsChildOf(playerHeadTransform))) { playerHeadColliderIds.Add(instanceID); } } } } if ((Object)(object)leftHand != (Object)null) { Collider[] array2 = Il2CppArrayBase<Collider>.op_Implicit(((Component)leftHand).GetComponentsInChildren<Collider>(true)); if (array2 != null) { for (int j = 0; j < array2.Length; j++) { if ((Object)(object)array2[j] != (Object)null) { leftHandColliderIds.Add(((Object)array2[j]).GetInstanceID()); } } } } if (!((Object)(object)rightHand != (Object)null)) { return; } Collider[] array3 = Il2CppArrayBase<Collider>.op_Implicit(((Component)rightHand).GetComponentsInChildren<Collider>(true)); if (array3 == null) { return; } for (int k = 0; k < array3.Length; k++) { if ((Object)(object)array3[k] != (Object)null) { rightHandColliderIds.Add(((Object)array3[k]).GetInstanceID()); } } } catch { } } public override void OnFixedUpdate() { //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) if (!Cfg.FastEnabled || (Object)(object)playerRig == (Object)null) { return; } float fixedDeltaTime = Time.fixedDeltaTime; UpdateHandVelocitiesAndGrabCache(fixedDeltaTime); fallbackScanTimer -= fixedDeltaTime; if (fallbackScanTimer <= 0f) { fallbackScanTimer = 2.5f; if (!initialScanDone) { initialScanDone = true; ScanEnemies(); } if (!bloodPrefabsSearched) { SaveBloodPrefabs(); } if (colliderCache.Count > 800) { colliderCache.Clear(); } } int count = activeTracksList.Count; if (count == 0) { return; } float unscaledTime = Time.unscaledTime; Vector3 val = (((Object)(object)playerHeadTransform != (Object)null) ? playerHeadPos : (((Object)(object)leftHand != (Object)null && (Object)(object)rightHand != (Object)null) ? ((leftHandPos + rightHandPos) * 0.5f) : playerRig.position)); float fastActiveRadiusSqr = Cfg.FastActiveRadiusSqr; bool flag = Cfg.FastEnableHeadbutt && ((Vector3)(ref playerHeadVelocity)).sqrMagnitude >= Cfg.FastHeadbuttMinSpeed * 0.5f * (Cfg.FastHeadbuttMinSpeed * 0.5f); for (int num = count - 1; num >= 0; num--) { EnemyHeadTrack enemyHeadTrack = activeTracksList[num]; if (enemyHeadTrack == null || (Object)(object)enemyHeadTrack.stickHealth == (Object)null || (Object)(object)enemyHeadTrack.headObj == (Object)null || (Object)(object)enemyHeadTrack.headRb == (Object)null || brokenSticks.Contains(enemyHeadTrack.stickId)) { if (enemyHeadTrack != null) { trackedHeads.Remove(enemyHeadTrack.stickId); } int index = activeTracksList.Count - 1; activeTracksList[num] = activeTracksList[index]; activeTracksList.RemoveAt(index); } else if (Time.time < enemyHeadTrack.spawnGraceUntil) { enemyHeadTrack.prevVelocity = enemyHeadTrack.headRb.velocity; enemyHeadTrack.currentVelocity = enemyHeadTrack.prevVelocity; enemyHeadTrack.lastDeltaSpeed = 0f; } else if (!leftIsGrabbing && !rightIsGrabbing && !flag && unscaledTime - enemyHeadTrack.lastGrabbedTime > 0.65f && enemyHeadTrack.headRb.IsSleeping()) { enemyHeadTrack.prevVelocity = Vector3.zero; enemyHeadTrack.currentVelocity = Vector3.zero; enemyHeadTrack.lastDeltaSpeed = 0f; enemyHeadTrack.inHeadbuttContact = false; } else { enemyHeadTrack.prevVelocity = enemyHeadTrack.currentVelocity; Vector3 val2 = (enemyHeadTrack.currentVelocity = enemyHeadTrack.headRb.velocity); Vector3 val3 = val2 - enemyHeadTrack.prevVelocity; float num2 = (enemyHeadTrack.lastDeltaSpeed = ((Vector3)(ref val3)).magnitude); float magnitude = ((Vector3)(ref enemyHeadTrack.prevVelocity)).magnitude; if (magnitude >= enemyHeadTrack.recentPeakHeadSpeed || unscaledTime - enemyHeadTrack.recentPeakTimestamp > 0.045f) { enemyHeadTrack.recentPeakHeadSpeed = magnitude; enemyHeadTrack.recentPeakHeadVel = enemyHeadTrack.prevVelocity; enemyHeadTrack.recentPeakTimestamp = unscaledTime; } Vector3 val4 = ((enemyHeadTrack.recentPeakHeadSpeed > magnitude) ? enemyHeadTrack.recentPeakHeadVel : enemyHeadTrack.prevVelocity); val3 = val2 - val4; float num3 = Mathf.Max(num2, ((Vector3)(ref val3)).magnitude); if (leftIsGrabbing || rightIsGrabbing || flag || enemyHeadTrack.inHeadbuttContact || !(num3 < Cfg.FastLightMinDelta)) { Vector3 worldCenterOfMass = enemyHeadTrack.headRb.worldCenterOfMass; val3 = worldCenterOfMass - val; if (!(((Vector3)(ref val3)).sqrMagnitude > fastActiveRadiusSqr)) { UpdateTrackGrabState(enemyHeadTrack, worldCenterOfMass, unscaledTime); if ((!Cfg.FastEnableHeadbutt || !((Object)(object)playerHeadTransform != (Object)null) || !CheckProximityHeadbutt(enemyHeadTrack, worldCenterOfMass, val4, val2, unscaledTime)) && num3 >= Cfg.FastLightMinDelta) { CheckHeadPhysicsImpact(enemyHeadTrack, worldCenterOfMass, val4, val2, num3, unscaledTime); } } } } } } private void UpdateHandVelocitiesAndGrabCache(float dt) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_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_004b: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) if (dt <= 0.0001f) { return; } if ((Object)(object)playerHeadTransform != (Object)null) { Vector3 position = playerHeadTransform.position; playerHeadVelocity = (position - prevPlayerHeadPos) / dt; prevPlayerHeadPos = position; playerHeadPos = position; } else { Camera main = Camera.main; if ((Object)(object)main != (Object)null) { playerHeadTransform = ((Component)main).transform; prevPlayerHeadPos = playerHeadTransform.position; playerHeadPos = prevPlayerHeadPos; } playerHeadVelocity = Vector3.zero; } Vector3 velocity; Vector3 val2; if ((Object)(object)leftHand != (Object)null) { Vector3 position2 = ((Component)leftHand).transform.position; Vector3 val = (position2 - prevLeftHandPos) / dt; prevLeftHandPos = position2; leftHandPos = position2; if ((Object)(object)leftHandRb != (Object)null) { velocity = leftHandRb.velocity; if (((Vector3)(ref velocity)).sqrMagnitude > ((Vector3)(ref val)).sqrMagnitude) { val2 = leftHandRb.velocity; goto IL_012e; } } val2 = val; goto IL_012e; } leftHandVelocity = Vector3.zero; leftIsGrabbing = false; leftGrabbedPtr = IntPtr.Zero; leftGrabbedRoot = null; leftHoldingWall = false; leftHoldingSharp = false; goto IL_02ad; IL_02ad: Vector3 val4; if ((Object)(object)rightHand != (Object)null) { Vector3 position3 = ((Component)rightHand).transform.position; Vector3 val3 = (position3 - prevRightHandPos) / dt; prevRightHandPos = position3; rightHandPos = position3; if ((Object)(object)rightHandRb != (Object)null) { velocity = rightHandRb.velocity; if (((Vector3)(ref velocity)).sqrMagnitude > ((Vector3)(ref val3)).sqrMagnitude) { val4 = rightHandRb.velocity; goto IL_0335; } } val4 = val3; goto IL_0335; } rightHandVelocity = Vector3.zero; rightIsGrabbing = false; rightGrabbedPtr = IntPtr.Zero; rightGrabbedRoot = null; rightHoldingWall = false; rightHoldingSharp = false; return; IL_012e: leftHandVelocity = val2; leftIsGrabbing = ((HVRGrabberBase)leftHand).IsGrabbing; if (leftIsGrabbing) { try { HVRGrabbable grabbedTarget = ((HVRGrabberBase)leftHand).GrabbedTarget; if ((Object)(object)grabbedTarget != (Object)null) { if (((Il2CppObjectBase)grabbedTarget).Pointer != leftGrabbedPtr) { leftGrabbedPtr = ((Il2CppObjectBase)grabbedTarget).Pointer; leftGrabbedRoot = ((Component)grabbedTarget).transform.root; leftHoldingWall = grabbedTarget.Stationary; Collider componentInChildren = ((Component)leftGrabbedRoot).GetComponentInChildren<Collider>(); leftHoldingSharp = !leftHoldingWall && (Object)(object)componentInChildren != (Object)null && !playerColliderIds.Contains(((Object)componentInChildren).GetInstanceID()) && IsSharpBladeColliderCached(componentInChildren, ((Object)componentInChildren).GetInstanceID()); } } else { leftGrabbedPtr = IntPtr.Zero; leftGrabbedRoot = null; leftHoldingWall = false; leftHoldingSharp = false; } } catch { leftGrabbedPtr = IntPtr.Zero; leftGrabbedRoot = null; leftHoldingWall = false; leftHoldingSharp = false; } } else { leftGrabbedPtr = IntPtr.Zero; leftGrabbedRoot = null; leftHoldingWall = false; leftHoldingSharp = false; } goto IL_02ad; IL_0335: rightHandVelocity = val4; rightIsGrabbing = ((HVRGrabberBase)rightHand).IsGrabbing; if (rightIsGrabbing) { try { HVRGrabbable grabbedTarget2 = ((HVRGrabberBase)rightHand).GrabbedTarget; if ((Object)(object)grabbedTarget2 != (Object)null) { if (((Il2CppObjectBase)grabbedTarget2).Pointer != rightGrabbedPtr) { rightGrabbedPtr = ((Il2CppObjectBase)grabbedTarget2).Pointer; rightGrabbedRoot = ((Component)grabbedTarget2).transform.root; rightHoldingWall = grabbedTarget2.Stationary; Collider componentInChildren2 = ((Component)rightGrabbedRoot).GetComponentInChildren<Collider>(); rightHoldingSharp = !rightHoldingWall && (Object)(object)componentInChildren2 != (Object)null && !playerColliderIds.Contains(((Object)componentInChildren2).GetInstanceID()) && IsSharpBladeColliderCached(componentInChildren2, ((Object)componentInChildren2).GetInstanceID()); } } else { rightGrabbedPtr = IntPtr.Zero; rightGrabbedRoot = null; rightHoldingWall = false; rightHoldingSharp = false; } return; } catch { rightGrabbedPtr = IntPtr.Zero; rightGrabbedRoot = null; rightHoldingWall = false; rightHoldingSharp = false; return; } } rightGrabbedPtr = IntPtr.Zero; rightGrabbedRoot = null; rightHoldingWall = false; rightHoldingSharp = false; } private bool CheckProximityHeadbutt(EnemyHeadTrack track, Vector3 enemyHeadPos, Vector3 preImpactVel, Vector3 curVel, float now) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_009c: 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_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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_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) //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_0166: 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) Vector3 val = enemyHeadPos - playerHeadPos; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude > Cfg.FastHeadbuttResetRadiusSqr) { track.inHeadbuttContact = false; return false; } if (sqrMagnitude > Cfg.FastHeadbuttRadiusSqr || track.inHeadbuttContact) { return false; } if (now - track.lastHitRegisteredTime < 0.22f || now < track.slashImmunityUntil) { return false; } Vector3 val2 = ((sqrMagnitude > 0.0001f) ? ((Vector3)(ref val)).normalized : playerHeadTransform.forward); float num = Vector3.Dot(playerHeadVelocity - curVel, val2); float num2 = Vector3.Dot(playerHeadVelocity - preImpactVel, val2); float num3 = 0f; if (track.isGrabbedByPlayer) { Vector3 grabbingHandVelocityVector = GetGrabbingHandVelocityVector(track); num3 = Vector3.Dot(playerHeadVelocity - grabbingHandVelocityVector, val2); } float num4 = Mathf.Max(num, Mathf.Max(num2, num3)); if (num4 < Cfg.FastHeadbuttMinSpeed) { return false; } track.inHeadbuttContact = true; try { if (!track.headRb.isKinematic) { track.headRb.WakeUp(); float num5 = Mathf.Clamp(num4 * 0.7f, 1.5f, 4.2f); track.headRb.AddForce(val2 * num5, (ForceMode)2); } } catch { } Vector3 impactPoint = Vector3.Lerp(playerHeadPos, enemyHeadPos, 0.55f); RegisterLightHeadHit(track, impactPoint, val2, "PlayerHeadbutt"); return true; } private void UpdateTrackGrabState(EnemyHeadTrack track, Vector3 headPos, float now) { //IL_0061: 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) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) if (!leftIsGrabbing && !rightIsGrabbing) { track.isGrabbedByLeft = false; track.isGrabbedByRight = false; track.isGrabbedByPlayer = false; return; } Vector3 val; int num; if (leftIsGrabbing && !leftHoldingWall && (Object)(object)leftHand != (Object)null && (Object)(object)leftGrabbedRoot == (Object)null) { val = leftHandPos - headPos; num = ((((Vector3)(ref val)).sqrMagnitude <= 0.7225f) ? 1 : 0); } else { num = 0; } bool flag = (byte)num != 0; int num2; if (rightIsGrabbing && !rightHoldingWall && (Object)(object)rightHand != (Object)null && (Object)(object)rightGrabbedRoot == (Object)null) { val = rightHandPos - headPos; num2 = ((((Vector3)(ref val)).sqrMagnitude <= 0.7225f) ? 1 : 0); } else { num2 = 0; } bool flag2 = (byte)num2 != 0; track.isGrabbedByLeft = leftIsGrabbing && !leftHoldingWall && ((leftGrabbedPtr != IntPtr.Zero && track.enemyGrabbablePtrs != null && track.enemyGrabbablePtrs.Contains(leftGrabbedPtr)) || ((Object)(object)leftGrabbedRoot != (Object)null && (Object)(object)leftGrabbedRoot == (Object)(object)track.enemyRoot) || flag); track.isGrabbedByRight = rightIsGrabbing && !rightHoldingWall && ((rightGrabbedPtr != IntPtr.Zero && track.enemyGrabbablePtrs != null && track.enemyGrabbablePtrs.Contains(rightGrabbedPtr)) || ((Object)(object)rightGrabbedRoot != (Object)null && (Object)(object)rightGrabbedRoot == (Object)(object)track.enemyRoot) || flag2); track.isGrabbedByPlayer = track.isGrabbedByLeft || track.isGrabbedByRight; if (track.isGrabbedByPlayer) { track.lastGrabbedTime = now; } } private void CheckHeadPhysicsImpact(EnemyHeadTrack track, Vector3 headPos, Vector3 preImpactVel, Vector3 curVel, float headDeceleration, float now) { //IL_0641: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_0669: Unknown result type (might be due to invalid IL or missing references) //IL_066e: Unknown result type (might be due to invalid IL or missing references) //IL_0673: 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_06a7: Unknown result type (might be due to invalid IL or missing references) //IL_06ac: Unknown result type (might be due to invalid IL or missing references) //IL_06d4: Unknown result type (might be due to invalid IL or missing references) //IL_06cb: Unknown result type (might be due to invalid IL or missing references) //IL_06dd: Unknown result type (might be due to invalid IL or missing references) //IL_06e2: Unknown result type (might be due to invalid IL or missing references) //IL_06e6: Unknown result type (might be due to invalid IL or missing references) //IL_06eb: Unknown result type (might be due to invalid IL or missing references) //IL_076b: Unknown result type (might be due to invalid IL or missing references) //IL_076c: Unknown result type (might be due to invalid IL or missing references) //IL_071e: Unknown result type (might be due to invalid IL or missing references) //IL_071f: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_07b6: Unknown result type (might be due to invalid IL or missing references) //IL_07bb: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Unknown result type (might be due to invalid IL or missing references) //IL_05fc: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_07cb: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_081e: Unknown result type (might be due to invalid IL or missing references) //IL_0808: Unknown result type (might be due to invalid IL or missing references) //IL_080d: Unknown result type (might be due to invalid IL or missing references) //IL_0835: Unknown result type (might be due to invalid IL or missing references) //IL_0839: Unknown result type (might be due to invalid IL or missing references) //IL_083a: Unknown result type (might be due to invalid IL or missing references) //IL_0827: Unknown result type (might be due to invalid IL or missing references) //IL_082c: Unknown result type (might be due to invalid IL or missing references) //IL_0830: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) if (now - track.lastHitRegisteredTime < 0.22f || now < track.slashImmunityUntil) { return; } float magnitude = ((Vector3)(ref preImpactVel)).magnitude; bool flag = track.isGrabbedByPlayer || now - track.lastGrabbedTime <= 0.65f; float num = (track.isGrabbedByPlayer ? GetGrabbingHandSpeedForTrack(track) : 0f); float num2 = (flag ? Mathf.Max(magnitude, num * 0.85f) : magnitude); Collider[] array = Il2CppArrayBase<Collider>.op_Implicit((Il2CppArrayBase<Collider>)(object)Physics.OverlapSphere(headPos, 0.2f)); if (array == null || array.Length == 0) { return; } foreach (Collider val in array) { if (!((Object)(object)val == (Object)null) && !val.isTrigger) { int instanceID = ((Object)val).GetInstanceID(); if ((track.enemyColliderIds == null || !track.enemyColliderIds.Contains(instanceID)) && !playerColliderIds.Contains(instanceID) && IsSharpBladeColliderCached(val, instanceID)) { track.slashImmunityUntil = now + 0.35f; return; } } } if (Cfg.FastEnableWallSmash) { float fastWallContactRadius = Cfg.FastWallContactRadius; foreach (Collider val2 in array) { if ((Object)(object)val2 == (Object)null || val2.isTrigger) { continue; } int instanceID2 = ((Object)val2).GetInstanceID(); if ((track.enemyColliderIds != null && track.enemyColliderIds.Contains(instanceID2)) || playerColliderIds.Contains(instanceID2)) { continue; } CachedColliderInfo orBuildColliderInfo = GetOrBuildColliderInfo(val2, instanceID2); if (orBuildColliderInfo == null || !orBuildColliderInfo.isStaticWallSurface) { continue; } Vector3 val3 = val2.ClosestPoint(headPos); Vector3 val4 = val3 - headPos; float magnitude2 = ((Vector3)(ref val4)).magnitude; if (magnitude2 > fastWallContactRadius) { continue; } Vector3 val5 = ((magnitude2 > 0.001f) ? (val4 / magnitude2) : ((((Vector3)(ref preImpactVel)).sqrMagnitude > 0.01f) ? ((Vector3)(ref preImpactVel)).normalized : Vector3.forward)); float num3 = ((((Vector3)(ref preImpactVel)).sqrMagnitude > 0.05f) ? Vector3.Dot(((Vector3)(ref preImpactVel)).normalized, val5) : 0f); if (magnitude2 > 0.04f && num3 < 0.35f) { continue; } if (flag) { if (num2 >= Cfg.FastWallGrabMinSpeed && headDeceleration >= Cfg.FastWallGrabMinDelta) { RegisterWallSmashHit(track, val3, val5, num2, "StaticWallSmash_Grabbed"); return; } } else if (magnitude >= Cfg.FastWallFreeMinSpeed && headDeceleration >= Cfg.FastWallFreeMinDelta) { RegisterWallSmashHit(track, val3, val5, magnitude, "StaticWallSmash_Free"); return; } } } foreach (Collider val6 in array) { if ((Object)(object)val6 == (Object)null || val6.isTrigger) { continue; } int instanceID3 = ((Object)val6).GetInstanceID(); if (track.enemyColliderIds != null && track.enemyColliderIds.Contains(instanceID3)) { continue; } Vector3 val7; if (playerColliderIds.Contains(instanceID3)) { if (Cfg.FastEnableHeadbutt && playerHeadColliderIds.Contains(instanceID3)) { val7 = playerHeadVelocity - preImpactVel; float num4 = ((Vector3)(ref val7)).magnitude; if (track.isGrabbedByPlayer) { num4 = Mathf.Max(num4, num); } if (num4 >= Cfg.FastHeadbuttMinSpeed && headDeceleration >= Cfg.FastLightMinDelta * 0.7f) { track.inHeadbuttContact = true; val7 = headPos - playerHeadPos; Vector3 val8; if (!(((Vector3)(ref val7)).sqrMagnitude > 0.001f)) { val8 = Vector3.forward; } else { val7 = headPos - playerHeadPos; val8 = ((Vector3)(ref val7)).normalized; } Vector3 impactDir = val8; RegisterLightHeadHit(track, headPos, impactDir, "PlayerHeadbutt"); break; } } else { if (!Cfg.FastEnableFist) { continue; } bool flag2 = leftHandColliderIds.Contains(instanceID3); bool flag3 = rightHandColliderIds.Contains(instanceID3); if ((flag2 || flag3) && (!flag2 || (!track.isGrabbedByLeft && !leftIsGrabbing)) && (!flag3 || (!track.isGrabbedByRight && !rightIsGrabbing))) { if ((flag2 && leftHoldingSharp) || (flag3 && rightHoldingSharp)) { track.slashImmunityUntil = now + 0.35f; break; } float num5 = (flag2 ? ((Vector3)(ref leftHandVelocity)).magnitude : ((Vector3)(ref rightHandVelocity)).magnitude); if (num5 >= Cfg.FastLightMinSpeed && headDeceleration >= Cfg.FastLightMinDelta) { RegisterLightHeadHit(track, headPos, GetDominantHandDirection(), "FistPunch"); break; } } } continue; } CachedColliderInfo orBuildColliderInfo2 = GetOrBuildColliderInfo(val6, instanceID3); if (orBuildColliderInfo2 == null || orBuildColliderInfo2.isStaticWallSurface) { continue; } float num9; float num10; ? val9; if (IsBluntWeaponOrPropCached(val6, orBuildColliderInfo2, out var weaponRb, out var isHeldOrKinematicBlunt)) { if (!isHeldOrKinematicBlunt && !Cfg.FastEnableThrownObject) { continue; } float num6 = 0f; if ((Object)(object)weaponRb != (Object)null) { val7 = weaponRb.velocity; num6 = ((Vector3)(ref val7)).magnitude; try { val7 = weaponRb.GetPointVelocity(headPos); float magnitude3 = ((Vector3)(ref val7)).magnitude; if (magnitude3 > num6) { num6 = magnitude3; } } catch { } } if (isHeldOrKinematicBlunt) { num6 = Mathf.Max(num6, GetWeaponHandSpeed(orBuildColliderInfo2, headPos, 1.25f)); } float num7; if (!((Object)(object)weaponRb != (Object)null)) { num7 = num6; } else { val7 = weaponRb.velocity - track.prevVelocity; num7 = ((Vector3)(ref val7)).magnitude; } float num8 = num7; num9 = Mathf.Max(num6, num8); num10 = (isHeldOrKinematicBlunt ? Cfg.FastHeavyMinSpeed : Cfg.FastThrownHeavySpeed); if ((Object)(object)weaponRb != (Object)null) { val7 = weaponRb.velocity; if (((Vector3)(ref val7)).sqrMagnitude > 0.1f) { val7 = weaponRb.velocity; val9 = ((Vector3)(ref val7)).normalized; goto IL_06eb; } } val9 = ((((Vector3)(ref curVel)).sqrMagnitude > 0.1f) ? ((Vector3)(ref curVel)).normalized : GetDominantHandDirection()); goto IL_06eb; } if (!Cfg.FastEnableButtstockGrip || !IsButtstockOrGripCached(val6, orBuildColliderInfo2, out var itemRb)) { continue; } float num11; if (!((Object)(object)itemRb != (Object)null)) { num11 = 0f; } else { val7 = itemRb.velocity; num11 = ((Vector3)(ref val7)).magnitude; } float num12 = num11; num12 = Mathf.Max(num12, GetWeaponHandSpeed(orBuildColliderInfo2, headPos, 0.85f)); if (!(num12 >= Cfg.FastLightMinSpeed) || !(headDeceleration >= Cfg.FastLightMinDelta)) { continue; } Vector3 val10; if ((Object)(object)itemRb != (Object)null) { val7 = itemRb.velocity; if (((Vector3)(ref val7)).sqrMagnitude > 0.1f) { val7 = itemRb.velocity; val10 = ((Vector3)(ref val7)).normalized; goto IL_0835; } } val10 = GetDominantHandDirection(); goto IL_0835; IL_0835: Vector3 impactDir2 = val10; RegisterLightHeadHit(track, headPos, impactDir2, "ButtstockOrGrip"); break; IL_06eb: Vector3 impactDir3 = (Vector3)val9; if (num9 >= num10 && headDeceleration >= Cfg.FastHeavyMinDelta) { if (!isHeldOrKinematicBlunt || Cfg.FastEnableHeavyWeapon) { RegisterHeavyHeadHit(track, headPos, impactDir3, isHeldOrKinematicBlunt ? "HeavyBluntWeapon" : "ThrownObject"); break; } } else if (isHeldOrKinematicBlunt && Cfg.FastEnableLightWeapon && num9 >= Cfg.FastLightMinSpeed && headDeceleration >= Cfg.FastLightMinDelta) { RegisterLightHeadHit(track, headPos, impactDir3, "LightBluntWeapon"); break; } } } public void RegisterWallSmashHit(EnemyHeadTrack track, Vector3 impactPoint, Vector3 impactDir, float impactSpeed, string source) { //IL_0134: 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_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) if (!Cfg.FastEnableWallSmash || track == null || brokenSticks.Contains(track.stickId)) { return; } float unscaledTime = Time.unscaledTime; if (unscaledTime < track.slashImmunityUntil || unscaledTime - track.lastHitRegisteredTime < 0.22f) { return; } track.lastHitRegisteredTime = unscaledTime; track.wallSmashCount++; int fastWallMaxHits = Cfg.FastWallMaxHits; float num = 1f / (float)fastWallMaxHits; track.accumulatedTrauma += num; float num2 = Cfg.FastWallBaseChance + (float)(track.wallSmashCount - 1) * Cfg.FastWallChanceStep; if (impactSpeed >= Cfg.FastWallHardSpeed) { num2 += Cfg.FastWallHardBonus; } if (track.wallSmashCount >= fastWallMaxHits) { num2 = 1f; } num2 = Mathf.Clamp01(num2); bool flag = track.wallSmashCount >= fastWallMaxHits; bool flag2 = Cfg.FastCombinedDamage && track.accumulatedTrauma >= 0.999f; bool flag3 = num2 > 0f && Random.value <= num2; if (flag || flag2 || flag3) { BreakEnemyHead(track, impactPoint, impactDir, $"{source} (Удар об стену #{track.wallSmashCount}/{fastWallMaxHits}, скорость {impactSpeed:F1}м/с, шанс {num2 * 100f:F0}%)"); return; } if (Cfg.FastVerbose) { ((MelonBase)this).LoggerInstance.Msg($"[HeadBreaker] Удар об стену #{track.wallSmashCount}/{fastWallMaxHits} выдержан ({source}, шанс был {num2 * 100f:F0}%), травма: {track.accumulatedTrauma:F2}/1.00"); } if (Cfg.FastMiniHitGore) { SpawnMiniHitGore(impactPoint, ((Object)(object)track.headObj != (Object)null) ? track.headObj.transform.rotation : Quaternion.identity); } } public void RegisterHeavyHeadHit(EnemyHeadTrack track, Vector3 impactPoint, Vector3 impactDir, string source) { //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) if (track == null || brokenSticks.Contains(track.stickId)) { return; } float unscaledTime = Time.unscaledTime; if (unscaledTime < track.slashImmunityUntil || unscaledTime - track.lastHitRegisteredTime < 0.22f) { return; } track.lastHitRegisteredTime = unscaledTime; track.heavyHitCount++; int fastHeavyMaxHits = Cfg.FastHeavyMaxHits; float num = 1f / (float)fastHeavyMaxHits; track.accumulatedTrauma += num; float num2 = Cfg.FastHeavyBaseChance + (float)(track.heavyHitCount - 1) * Cfg.FastHeavyChanceStep; if (track.heavyHitCount >= fastHeavyMaxHits) { num2 = 1f; } num2 = Mathf.Clamp01(num2); bool flag = track.heavyHitCount >= fastHeavyMaxHits; bool flag2 = Cfg.FastCombinedDamage && track.accumulatedTrauma >= 0.999f; bool flag3 = num2 > 0f && Random.value <= num2; if (flag || flag2 || flag3) { BreakEnemyHead(track, impactPoint, impactDir, $"{source} (Сильный удар #{track.heavyHitCount}/{fastHeavyMaxHits}, шанс {num2 * 100f:F0}%)"); return; } if (Cfg.FastVerbose) { ((MelonBase)this).LoggerInstance.Msg($"[HeadBreaker] Сильный удар #{track.heavyHitCount}/{fastHeavyMaxHits} выдержан ({source}, шанс был {num2 * 100f:F0}%), травма: {track.accumulatedTrauma:F2}/1.00"); } if (Cfg.FastMiniHitGore) { SpawnMiniHitGore(impactPoint, ((Object)(object)track.headObj != (Object)null) ? track.headObj.transform.rotation : Quaternion.identity); } } public void RegisterLightHeadHit(EnemyHeadTrack track, Vector3 impactPoint, Vector3 impactDir, string source) { //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) if (track == null || brokenSticks.Contains(track.stickId)) { return; } float unscaledTime = Time.unscaledTime; if (unscaledTime < track.slashImmunityUntil || unscaledTime - track.lastHitRegisteredTime < 0.22f) { return; } track.lastHitRegisteredTime = unscaledTime; track.lightHitCount++; int fastLightMaxHits = Cfg.FastLightMaxHits; float num = 1f / (float)fastLightMaxHits; track.accumulatedTrauma += num; float num2 = 0f; if (track.lightHitCount >= Cfg.FastLightStartRollHit) { num2 = Cfg.FastLightBaseChance + (float)(track.lightHitCount - 1) * Cfg.FastLightChanceStep; } if (track.lightHitCount >= fastLightMaxHits) { num2 = 1f; } num2 = Mathf.Clamp01(num2); bool flag = track.lightHitCount >= fastLightMaxHits; bool flag2 = Cfg.FastCombinedDamage && track.accumulatedTrauma >= 0.999f; bool flag3 = num2 > 0f && Random.value <= num2; if (flag || flag2 || flag3) { BreakEnemyHead(track, impactPoint, impactDir, $"{source} (Слабый удар #{track.lightHitCount}/{fastLightMaxHits}, шанс {num2 * 100f:F0}%)"); return; } if (Cfg.FastVerbose) { ((MelonBase)this).LoggerInstance.Msg($"[HeadBreaker] Слабый удар #{track.lightHitCount}/{fastLightMaxHits} ({source}, шанс {num2 * 100f:F0}%): накоплено {track.accumulatedTrauma:F2}/1.00"); } if (Cfg.FastMiniHitGore) { SpawnMiniHitGore(impactPoint, ((Object)(object)track.headObj != (Object)null) ? track.headObj.transform.rotation : Quaternion.identity); } } public void RegisterKickHeadHit(EnemyHeadTrack track, Vector3 impactPoint, Vector3 impactDir) { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) if (!Cfg.FastEnableKick || track == null || brokenSticks.Contains(track.stickId)) { return; } float unscaledTime = Time.unscaledTime; if (unscaledTime - track.lastHitRegisteredTime < 0.11f) { return; } track.lastHitRegisteredTime = unscaledTime; track.kickHitCount++; int fastKickMaxHits = Cfg.FastKickMaxHits; float num = 1f / (float)fastKickMaxHits; track.accumulatedTrauma += num; float num2 = Cfg.FastKickBaseChance + (float)(track.kickHitCount - 1) * Cfg.FastKickChanceStep; if (track.kickHitCount >= fastKickMaxHits) { num2 = 1f; } num2 = Mathf.Clamp01(num2); bool flag = track.kickHitCount >= fastKickMaxHits; bool flag2 = Cfg.FastCombinedDamage && track.accumulatedTrauma >= 0.999f; bool flag3 = num2 > 0f && Random.value <= num2; if (flag || flag2 || flag3) { BreakEnemyHead(track, impactPoint, impactDir, $"KickHeadHit (Пинок #{track.kickHitCount}/{fastKickMaxHits}, шанс {num2 * 100f:F0}%)"); return; } if (Cfg.FastVerbose) { ((MelonBase)this).LoggerInstance.Msg($"[HeadBreaker] Пинок по голове #{track.kickHitCount}/{fastKickMaxHits} выдержан (шанс был {num2 * 100f:F0}%), травма: {track.accumulatedTrauma:F2}/1.00"); } if (Cfg.FastMiniHitGore) { SpawnMiniHitGore(impactPoint, ((Object)(object)track.headObj != (Object)null) ? track.headObj.transform.rotation : Quaternion.identity); } } private static void PatchCombatMethods(Harmony harmony) { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown Type type = FindType("StickHealth"); Type type2 = FindType("ColliderBridge"); if (type != null) { MethodInfo methodInfo = FindMethod(type, "Start", 0, 0) ?? FindMethod(type, "Awake", 0, 0); if (methodInfo != null) { harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(Core), "StickHealthStartPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo2 = FindMethod(type, "HitDetected", 5, 5); if (methodInfo2 != null) { harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(Core), "HitDetectedPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } if (type2 != null) { MethodInfo methodInfo3 = FindMethod(type2, "ColBridgeSlashed", 6, 7); if (methodInfo3 != null) { harmony.Patch((MethodBase)methodInfo3, new HarmonyMethod(typeof(Core), "ColBridgeSlashedPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo4 = FindMethod(type2, "KickedByPlayer", 3, 3); if (methodInfo4 != null) { harmony.Patch((MethodBase)methodInfo4, (HarmonyMethod)null, new HarmonyMethod(typeof(Core), "KickedByPlayerPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } } public static void StickHealthStartPostfix(object __instance) { try { if (Instance != null && __instance != null) { StickHealth val = (StickHealth)((__instance is StickHealth) ? __instance : null); if ((Object)(object)val != (Object)null) { Instance.GetOrCreateTrack(val); } } } catch { } } public static void ColBridgeSlashedPrefix(object __instance) { try { if (!Cfg.FastEnabled || Instance == null || __instance == null) { return; } ColliderBridge val = (ColliderBridge)((__instance is ColliderBridge) ? __instance : null); if ((Object)(object)val == (Object)null) { return; } StickHealth componentInParent = ((Component)val).GetComponentInParent<StickHealth>(); if (!((Object)(object)componentInParent == (Object)null)) { EnemyHeadTrack orCreateTrack = Instance.GetOrCreateTrack(componentInParent); if (orCreateTrack != null) { orCreateTrack.slashImmunityUntil = Time.unscaledTime + 0.35f; } } } catch { } } public static void HitDetectedPostfix(object __instance, object[] __args) { //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_0815: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Unknown result type (might be due to invalid IL or missing references) //IL_07c4: Unknown result type (might be due to invalid IL or missing references) //IL_07c6: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: 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_01c5: 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_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: 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_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Unknown result type (might be due to invalid IL or missing references) //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Unknown result type (might be due to invalid IL or missing references) //IL_0862: Unknown result type (might be due to invalid IL or missing references) //IL_0864: Unknown result type (might be due to invalid IL or missing references) //IL_0752: Unknown result type (might be due to invalid IL or missing references) //IL_0754: Unknown result type (might be due to invalid IL or missing references) //IL_0759: Unknown result type (might be due to invalid IL or missing references) //IL_0681: Unknown result type (might be due to invalid IL or missing references) //IL_06e6: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: Unknown result type (might be due to invalid IL or missing references) try { if (!Cfg.FastEnabled || Instance == null || __instance == null || __args == null) { return; } StickHealth val = (StickHealth)((__instance is StickHealth) ? __instance : null); if ((Object)(object)val == (Object)null) { return; } int instanceID = ((Object)val).GetInstanceID(); if (brokenSticks.Contains(instanceID)) { return; } float num = ((__args.Length != 0) ? ToFloat(__args[0]) : 0f); object obj = ((__args.Length > 1) ? __args[1] : null); object obj2 = ((__args.Length > 3) ? __args[3] : null); object contactObj = ((__args.Length > 4) ? __args[4] : null); string text = ((obj2 != null) ? obj2.ToString() : ""); EnemyHeadTrack orCreateTrack = Instance.GetOrCreateTrack(val); if (orCreateTrack == null || (Object)(object)orCreateTrack.headObj == (Object)null) { return; } float unscaledTime = Time.unscaledTime; if (text.Contains("Slash") || text.Contains("Sharp") || text.Contains("Stab") || text.Contains("Cut") || text.Contains("Pierce")) { orCreateTrack.slashImmunityUntil = unscaledTime + 0.35f; } else { if (text.Contains("Bullet") || text.Contains("Dismember") || unscaledTime < orCreateTrack.slashImmunityUntil || unscaledTime - orCreateTrack.lastHitRegisteredTime < 0.22f) { return; } Vector3 value = Vector3.zero; Collider val2 = null; Vector3 val3 = Vector3.zero; bool flag = false; Collision val4 = (Collision)((obj is Collision) ? obj : null); if (val4 != null) { value = val4.relativeVelocity; val2 = val4.collider; try { if (val4.contactCount > 0) { ContactPoint contact = val4.GetContact(0); val3 = ((ContactPoint)(ref contact)).point; flag = ((Vector3)(ref val3)).sqrMagnitude > 0.0001f; } } catch { } } else { TryGetVector3Member(obj, "relativeVelocity", out value); } int num2 = (((Object)(object)val2 != (Object)null) ? ((Object)val2).GetInstanceID() : 0); if ((Object)(object)val2 != (Object)null && orCreateTrack.enemyColliderIds != null && orCreateTrack.enemyColliderIds.Contains(num2)) { return; } Vector3 point = Vector3.zero; Vector3 normal = Vector3.zero; bool flag2 = TryGetContactInfo(contactObj, out point, out normal); if (!flag2 && flag) { point = val3; flag2 = true; } if (!IsHeadHitFast(orCreateTrack, __args, val2, point, flag2)) { return; } if ((Object)(object)val2 != (Object)null && !playerColliderIds.Contains(num2) && Instance.IsSharpBladeColliderCached(val2, num2)) { orCreateTrack.slashImmunityUntil = unscaledTime + 0.35f; return; } Vector3 position = orCreateTrack.headObj.transform.position; Vector3 impactPoint = (flag2 ? point : position); Vector3 impactDir = ((((Vector3)(ref value)).sqrMagnitude > 0.01f) ? ((Vector3)(ref value)).normalized : ((((Vector3)(ref normal)).sqrMagnitude > 0.01f) ? normal : Instance.GetDominantHandDirection())); float magnitude = ((Vector3)(ref value)).magnitude; float nearestHandSpeed = Instance.GetNearestHandSpeed(position, 1.15f); float num3 = Mathf.Max(magnitude, nearestHandSpeed); float lastDeltaSpeed = orCreateTrack.lastDeltaSpeed; Vector3 val5 = orCreateTrack.currentVelocity - orCreateTrack.recentPeakHeadVel; float num4 = Mathf.Max(lastDeltaSpeed, ((Vector3)(ref val5)).magnitude); if ((Object)(object)val2 != (Object)null && playerHeadColliderIds.Contains(num2)) { if (Cfg.FastEnableHeadbutt) { val5 = Instance.playerHeadVelocity - orCreateTrack.prevVelocity; float num5 = Mathf.Max(magnitude, ((Vector3)(ref val5)).magnitude); if (num5 >= Cfg.FastHeadbuttMinSpeed) { orCreateTrack.inHeadbuttContact = true; Instance.RegisterLightHeadHit(orCreateTrack, impactPoint, impactDir, "HitDetected_PlayerHeadbutt"); } } return; } CachedColliderInfo cachedColliderInfo = (((Object)(object)val2 != (Object)null && !playerColliderIds.Contains(num2)) ? Instance.GetOrBuildColliderInfo(val2, num2) : null); if (cachedColliderInfo != null && cachedColliderInfo.isStaticWallSurface) { if (!Cfg.FastEnableWallSmash) { return; } Vector3 val6 = val2.ClosestPoint(position); if (Vector3.Distance(val6, position) > Cfg.FastWallContactRadius * 1.25f) { return; } bool flag3 = orCreateTrack.isGrabbedByPlayer || unscaledTime - orCreateTrack.lastGrabbedTime <= 0.65f; float num6 = Mathf.Max(magnitude, orCreateTrack.recentPeakHeadSpeed); if (flag3) { num6 = Mathf.Max(num6, Instance.GetGrabbingHandSpeedForTrack(orCreateTrack) * 0.85f); } if (flag3) { if (num6 >= Cfg.FastWallGrabMinSpeed && (num4 >= Cfg.FastWallGrabMinDelta || magnitude >= Cfg.FastWallGrabMinSpeed)) { Instance.RegisterWallSmashHit(orCreateTrack, impactPoint, impactDir, num6, "HitDetected_StaticWallSmash"); } } else if (num6 >= Cfg.FastWallFreeMinSpeed && (num4 >= Cfg.FastWallFreeMinDelta || num >= 28.800001f)) { Instance.RegisterWallSmashHit(orCreateTrack, impactPoint, impactDir, num6, "HitDetected_StaticWallFree"); } return; } bool flag4 = (Object)(object)val2 != (Object)null && leftHandColliderIds.Contains(num2); bool flag5 = (Object)(object)val2 != (Object)null && rightHandColliderIds.Contains(num2); if (text.Contains("Hand") || flag4 || flag5) { if (!Cfg.FastEnableFist || (flag4 && (orCreateTrack.isGrabbedByLeft || Instance.leftIsGrabbing)) || (flag5 && (orCreateTrack.isGrabbedByRight || Instance.rightIsGrabbing))) { return; } if (!flag4 && !flag5 && orCreateTrack.isGrabbedByPlayer) { if (!Instance.HasFreePunchingHandNearHead(orCreateTrack, position, out var freeHandSpeed)) { return; } num3 = freeHandSpeed; } if ((!flag4 || !Instance.leftHoldingSharp) && (!flag5 || !Instance.rightHoldingSharp) && num3 >= Cfg.FastLightMinSpeed) { Instance.RegisterLightHeadHit(orCreateTrack, impactPoint, impactDir, "HitDetected_Fist"); } } else { if (cachedColliderInfo == null) { return; } Rigidbody itemRb; if (Instance.IsBluntWeaponOrPropCached(val2, cachedColliderInfo, out var weaponRb, out var isHeldOrKinematicBlunt)) { if (!isHeldOrKinematicBlunt && !Cfg.FastEnableThrownObject) { return; } if ((Object)(object)weaponRb != (Object)null) { try { val5 = weaponRb.GetPointVelocity(position); float magnitude2 = ((Vector3)(ref val5)).magnitude; if (magnitude2 > num3) { num3 = magnitude2; } } catch { } } float num7 = (isHeldOrKinematicBlunt ? Cfg.FastHeavyMinSpeed : Cfg.FastThrownHeavySpeed); if (num3 >= num7 || num >= 24f) { if (!isHeldOrKinematicBlunt || Cfg.FastEnableHeavyWeapon) { Instance.RegisterHeavyHeadHit(orCreateTrack, impactPoint, impactDir, isHeldOrKinematicBlunt ? "HitDetected_BluntHeavy" : "HitDetected_ThrownObject"); } } else if (isHeldOrKinematicBlunt && Cfg.FastEnableLightWeapon && (num3 >= Cfg.FastLightMinSpeed || num >= 3f)) { Instance.RegisterLightHeadHit(orCreateTrack, impactPoint, impactDir, "HitDetected_BluntLight"); } } else if (Cfg.FastEnableButtstockGrip && Instance.IsButtstockOrGripCached(val2, cachedColliderInfo, out itemRb) && num3 >= Cfg.FastLightMinSpeed) { Instance.RegisterLightHeadHit(orCreateTrack, impactPoint, impactDir, "HitDetected_ButtstockOrGrip"); } } } } catch { } } public static void KickedByPlayerPostfix(object __instance, object[] __args) { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: 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_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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) try { if (!Cfg.FastEnabled || !Cfg.FastEnableKick || Instance == null || __instance == null || __args == null || __args.Length < 3) { return; } ColliderBridge val = (ColliderBridge)((__instance is ColliderBridge) ? __instance : null); if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null) { return; } StickHealth componentInParent = ((Component)val).GetComponentInParent<StickHealth>(); if ((Object)(object)componentInParent == (Object)null || brokenSticks.Contains(((Object)componentInParent).GetInstanceID())) { return; } EnemyHeadTrack orCreateTrack = Instance.GetOrCreateTrack(componentInParent); if (orCreateTrack == null || (Object)(object)orCreateTrack.headObj == (Object)null) { return; } Vector3 val2 = ToVector3(__args[1]); Vector3 val3 = ToVector3(__args[2]); bool flag = IsHeadOrJawBridge(val) || ((Object)((Component)val).gameObject).name == "Neck"; bool flag2 = ((Vector3)(ref val2)).sqrMagnitude > 0.0001f && Vector3.Distance(val2, orCreateTrack.headObj.transform.position) <= Cfg.FastKickMaxDist; if (flag || flag2) { Vector3 normalized; if (!(((Vector3)(ref val3)).sqrMagnitude > 0.01f)) { Vector3 val4 = orCreateTrack.headObj.transform.position - (((Object)(object)Instance.playerRig != (Object)null) ? Instance.playerRig.position : Vector3.zero); normalized = ((Vector3)(ref val4)).normalized; } else { normalized = ((Vector3)(ref val3)).normalized; } Vector3 impactDir = normalized; Instance.RegisterKickHeadHit(orCreateTrack, (((Vector3)(ref val2)).sqrMagnitude > 0.0001f) ? val2 : orCreateTrack.headObj.transform.position, impactDir); } } catch { } } public void BreakEnemyHead(EnemyHeadTrack track, Vector3 impactPoint, Vector3 impactDir, string reason) { //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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) if (track != null && !((Object)(object)track.stickHealth == (Object)null) && !((Object)(object)track.headObj == (Object)null) && brokenSticks.Add(track.stickId)) { GameObject headObj = track.headObj; Vector3 position = headObj.transform.position; Quaternion rotation = headObj.transform.rotation; if (Cfg.FastVerbose) { ((MelonBase)this).LoggerInstance.Msg("[HeadBreaker] ГОЛОВА РАЗДРОБЛЕНА! Причина: " + reason); } FractureHeadPart(headObj); if (Cfg.FastFractureJaw && (Object)(object)track.jawObj != (Object)null) { FractureHeadPart(track.jawObj); } ApplyFatalHeadDismember(track.stickHealth, track.headBridge, headObj); if (Cfg.FastGoreParticles) { SpawnHeadBreakGore(position, rotation); } PlayWav(headBreakSoundPath);