using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Agents;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using CConsole.Commands;
using CConsole.Interop;
using CullingSystem;
using Enemies;
using EnemyHitboxView.Components;
using EnemyHitboxView.Utils;
using FluffyUnderware.DevTools.Extensions;
using GameData;
using Gear;
using HarmonyLib;
using IRF;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("EnemyHitboxView")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.0+gite20d59b-main.e20d59b26016a3b325dcd88e08ce15fa9d325870")]
[assembly: AssemblyProduct("EnemyHitboxView")]
[assembly: AssemblyTitle("EnemyHitboxView")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace EnemyHitboxView
{
[BepInPlugin("JarheadHME.EnemyHitboxView", "EnemyHitboxView", "1.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class EntryPoint : BasePlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static OnCommandUsedDelegate <>9__1_0;
public static OnCommandUsedDelegate <>9__1_1;
public static OnCommandUsedDelegate <>9__1_2;
public static OnCommandUsedDelegate <>9__1_3;
internal void <Load>b__1_0(in CustomCmdContext context, string[] args)
{
if (args.Length != 0 && bool.TryParse(args[0], out var result))
{
EnemyBackMulti.ShowVectors = result;
}
else
{
EnemyBackMulti.ShowVectors = !EnemyBackMulti.ShowVectors;
}
context.Log($"DisplayEnemyBackMulti: {EnemyBackMulti.ShowVectors}");
}
internal void <Load>b__1_1(in CustomCmdContext context, string[] args)
{
if (args.Length != 0 && bool.TryParse(args[0], out var result))
{
EnemyLimbHitboxes.ShowHitboxes = result;
}
else
{
EnemyLimbHitboxes.ShowHitboxes = !EnemyLimbHitboxes.ShowHitboxes;
}
context.Log($"DisplayEnemyHitboxes: {EnemyLimbHitboxes.ShowHitboxes}");
}
internal void <Load>b__1_2(in CustomCmdContext context, string[] args)
{
if (args.Length != 0 && bool.TryParse(args[0], out var result))
{
EnemyMeleeHitboxes.ShowHitboxes = result;
}
else
{
EnemyMeleeHitboxes.ShowHitboxes = !EnemyMeleeHitboxes.ShowHitboxes;
}
context.Log($"DisplayEnemyMeleeHitboxes: {EnemyMeleeHitboxes.ShowHitboxes}");
}
internal void <Load>b__1_3(in CustomCmdContext context, string[] args)
{
if (args.Length != 0 && bool.TryParse(args[0], out var result))
{
PlayerMeleeHitboxes.ShowHitboxes = result;
}
else
{
PlayerMeleeHitboxes.ShowHitboxes = !PlayerMeleeHitboxes.ShowHitboxes;
}
context.Log($"DisplayPlayerMeleeHitboxes: {PlayerMeleeHitboxes.ShowHitboxes}");
}
}
private Harmony _Harmony = null;
public override void Load()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected O, but got Unknown
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Expected O, but got Unknown
//IL_0145: 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_017f: 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_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Expected O, but got Unknown
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Expected O, but got Unknown
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Expected O, but got Unknown
ClassInjector.RegisterTypeInIl2Cpp<EnemyLimbHitboxes>();
ClassInjector.RegisterTypeInIl2Cpp<EnemyHitboxCuller>();
ClassInjector.RegisterTypeInIl2Cpp<EnemyMeleeHitboxes>();
ClassInjector.RegisterTypeInIl2Cpp<EnemyBackMulti>();
ClassInjector.RegisterTypeInIl2Cpp<PlayerMeleeHitboxes>();
_Harmony = new Harmony("EnemyHitboxView.Harmony");
_Harmony.PatchAll();
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin has loaded with ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_Harmony.GetPatchedMethods().Count());
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" patches!");
}
Logger.Info(val);
CustomCommandSetting val2 = default(CustomCommandSetting);
val2.Command = "DisplayEnemyBackMulti";
val2.Description = "Show the vectors involved in the back multi calculation. Enemy's forward is green, enemy's chest is blue.";
val2.Usage = "DisplayEnemyBackMulti [true/false]";
val2.Category = (CategoryType)2;
val2.MinArgumentCount = 0;
CustomCommandSetting val3 = val2;
object obj = <>c.<>9__1_0;
if (obj == null)
{
OnCommandUsedDelegate val4 = delegate(in CustomCmdContext context, string[] args)
{
if (args.Length != 0 && bool.TryParse(args[0], out var result4))
{
EnemyBackMulti.ShowVectors = result4;
}
else
{
EnemyBackMulti.ShowVectors = !EnemyBackMulti.ShowVectors;
}
context.Log($"DisplayEnemyBackMulti: {EnemyBackMulti.ShowVectors}");
};
<>c.<>9__1_0 = val4;
obj = (object)val4;
}
CustomCommands.Register(val3, (OnCommandUsedDelegate)obj);
val2 = default(CustomCommandSetting);
val2.Command = "DisplayEnemyHitboxes";
val2.Description = "Show spheres and capsules on enemies to mark their (approximate) hitboxes. Normal hitboxes are green, weakpoints are red, and armor is grey.";
val2.Usage = "DisplayEnemyHitboxes [true/false]";
val2.Category = (CategoryType)2;
val2.MinArgumentCount = 0;
CustomCommandSetting val5 = val2;
object obj2 = <>c.<>9__1_1;
if (obj2 == null)
{
OnCommandUsedDelegate val6 = delegate(in CustomCmdContext context, string[] args)
{
if (args.Length != 0 && bool.TryParse(args[0], out var result3))
{
EnemyLimbHitboxes.ShowHitboxes = result3;
}
else
{
EnemyLimbHitboxes.ShowHitboxes = !EnemyLimbHitboxes.ShowHitboxes;
}
context.Log($"DisplayEnemyHitboxes: {EnemyLimbHitboxes.ShowHitboxes}");
};
<>c.<>9__1_1 = val6;
obj2 = (object)val6;
}
CustomCommands.Register(val5, (OnCommandUsedDelegate)obj2);
val2 = default(CustomCommandSetting);
val2.Command = "DisplayEnemyMeleeHitboxes";
val2.Description = "Show spheres to mark enemy's melee hitboxes.";
val2.Usage = "DisplayEnemyMeleeHitboxes [true/false]";
val2.Category = (CategoryType)2;
val2.MinArgumentCount = 0;
CustomCommandSetting val7 = val2;
object obj3 = <>c.<>9__1_2;
if (obj3 == null)
{
OnCommandUsedDelegate val8 = delegate(in CustomCmdContext context, string[] args)
{
if (args.Length != 0 && bool.TryParse(args[0], out var result2))
{
EnemyMeleeHitboxes.ShowHitboxes = result2;
}
else
{
EnemyMeleeHitboxes.ShowHitboxes = !EnemyMeleeHitboxes.ShowHitboxes;
}
context.Log($"DisplayEnemyMeleeHitboxes: {EnemyMeleeHitboxes.ShowHitboxes}");
};
<>c.<>9__1_2 = val8;
obj3 = (object)val8;
}
CustomCommands.Register(val7, (OnCommandUsedDelegate)obj3);
val2 = default(CustomCommandSetting);
val2.Command = "DisplayPlayerMeleeHitboxes";
val2.Description = "Show spheres to mark player's melee hitboxes.";
val2.Usage = "DisplayPlayerMeleeHitboxes [true/false]";
val2.Category = (CategoryType)6;
val2.MinArgumentCount = 0;
CustomCommandSetting val9 = val2;
object obj4 = <>c.<>9__1_3;
if (obj4 == null)
{
OnCommandUsedDelegate val10 = delegate(in CustomCmdContext context, string[] args)
{
if (args.Length != 0 && bool.TryParse(args[0], out var result))
{
PlayerMeleeHitboxes.ShowHitboxes = result;
}
else
{
PlayerMeleeHitboxes.ShowHitboxes = !PlayerMeleeHitboxes.ShowHitboxes;
}
context.Log($"DisplayPlayerMeleeHitboxes: {PlayerMeleeHitboxes.ShowHitboxes}");
};
<>c.<>9__1_3 = val10;
obj4 = (object)val10;
}
CustomCommands.Register(val9, (OnCommandUsedDelegate)obj4);
}
public override bool Unload()
{
_Harmony.UnpatchSelf();
return ((BasePlugin)this).Unload();
}
}
internal static class Logger
{
private static readonly ManualLogSource _Logger;
static Logger()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
_Logger = new ManualLogSource("EnemyHitboxView");
Logger.Sources.Add((ILogSource)(object)_Logger);
}
private static string Format(object msg)
{
return msg.ToString();
}
public static void Info(BepInExInfoLogInterpolatedStringHandler handler)
{
_Logger.LogInfo(handler);
}
public static void Info(string str)
{
_Logger.LogMessage((object)str);
}
public static void Info(object data)
{
_Logger.LogMessage((object)Format(data));
}
public static void Debug(BepInExDebugLogInterpolatedStringHandler handler)
{
_Logger.LogDebug(handler);
}
public static void Debug(string str)
{
_Logger.LogDebug((object)str);
}
public static void Debug(object data)
{
_Logger.LogDebug((object)Format(data));
}
public static void Error(BepInExErrorLogInterpolatedStringHandler handler)
{
_Logger.LogError(handler);
}
public static void Error(string str)
{
_Logger.LogError((object)str);
}
public static void Error(object data)
{
_Logger.LogError((object)Format(data));
}
public static void Fatal(BepInExFatalLogInterpolatedStringHandler handler)
{
_Logger.LogFatal(handler);
}
public static void Fatal(string str)
{
_Logger.LogFatal((object)str);
}
public static void Fatal(object data)
{
_Logger.LogFatal((object)Format(data));
}
public static void Warn(BepInExWarningLogInterpolatedStringHandler handler)
{
_Logger.LogWarning(handler);
}
public static void Warn(string str)
{
_Logger.LogWarning((object)str);
}
public static void Warn(object data)
{
_Logger.LogWarning((object)Format(data));
}
[Conditional("DEBUG")]
public static void DebugOnly(object data)
{
_Logger.LogDebug((object)Format(data));
}
}
[GeneratedCode("VersionInfoGenerator", "2.1.3+git35c0c2a-master")]
[CompilerGenerated]
internal static class VersionInfo
{
public const string RootNamespace = "EnemyHitboxView";
public const string Version = "1.1.0";
public const string VersionPrerelease = null;
public const string VersionMetadata = "gite20d59b-main";
public const string SemVer = "1.1.0+gite20d59b-main";
public const string GitRevShort = "e20d59b";
public const string GitRevLong = "e20d59b26016a3b325dcd88e08ce15fa9d325870";
public const string GitBranch = "main";
public const string GitTag = null;
public const int GitCommitsSinceTag = 0;
public const bool GitIsDirty = false;
}
}
namespace EnemyHitboxView.Utils
{
internal static class Extensions
{
public static bool TryCastAtHome<T, O>(this T InComp, out O OutComp) where T : Il2CppObjectBase where O : Il2CppObjectBase
{
OutComp = ((Il2CppObjectBase)InComp).TryCast<O>();
return OutComp != null;
}
public static Vector3 Multiply(this Vector3 arg1, Vector3 arg2)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
arg1.x *= arg2.x;
arg1.y *= arg2.y;
arg1.z *= arg2.z;
return arg1;
}
}
}
namespace EnemyHitboxView.Patches
{
[HarmonyPatch]
internal class EnemyAgent_Patch
{
[HarmonyPatch(typeof(EnemyAgent), "Setup")]
[HarmonyPostfix]
public static void Setup_Patch(EnemyAgent __instance)
{
CheckAndAddLimbHitboxComponents(__instance);
if ((Object)(object)((Component)__instance).gameObject.GetComponent<EnemyHitboxCuller>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<EnemyHitboxCuller>();
}
if ((Object)(object)((Component)__instance).gameObject.GetComponent<EnemyBackMulti>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<EnemyBackMulti>().enemy = __instance;
}
if ((Object)(object)((Component)__instance).gameObject.GetComponent<EnemyMeleeHitboxes>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<EnemyMeleeHitboxes>().enemy = __instance;
}
}
public static void CheckAndAddLimbHitboxComponents(EnemyAgent __instance)
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
bool flag = default(bool);
foreach (Dam_EnemyDamageLimb item in (Il2CppArrayBase<Dam_EnemyDamageLimb>)(object)__instance.Damage.DamageLimbs)
{
GameObject gameObject = ((Component)item).gameObject;
if ((Object)(object)gameObject.GetComponent<EnemyLimbHitboxes>() != (Object)null)
{
break;
}
Collider component = gameObject.GetComponent<Collider>();
if ((Object)(object)component == (Object)null)
{
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(50, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Damage Limb ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)gameObject).name);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" on enemy ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(__instance.EnemyDataID);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((GameDataBlockBase<EnemyDataBlock>)(object)__instance.EnemyData).name);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") doesn't have a collider?");
}
Logger.Warn(val);
}
else
{
EnemyLimbHitboxes enemyLimbHitboxes = gameObject.AddComponent<EnemyLimbHitboxes>();
enemyLimbHitboxes.Setup(item, component);
}
}
}
}
[HarmonyPatch]
internal class MeleeWeaponFirstPerson_Patch
{
[HarmonyPatch(typeof(MeleeWeaponFirstPerson), "Setup")]
[HarmonyPostfix]
public static void Setup_Patch(MeleeWeaponFirstPerson __instance)
{
if ((Object)(object)((Component)__instance).gameObject.GetComponent<PlayerMeleeHitboxes>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<PlayerMeleeHitboxes>().melee = __instance;
}
}
}
}
namespace EnemyHitboxView.Components
{
internal class EnemyBackMulti : MonoBehaviour
{
public static bool ShowVectors = false;
public static Vector3 floorOffset = Vector3.up;
public EnemyAgent enemy;
public LineRenderer forward;
public LineRenderer chest;
public void Start()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject();
forward = val.AddComponent<LineRenderer>();
((Renderer)forward).material.color = Color.green;
forward.SetWidth(0.1f, 0.1f);
GameObject val2 = new GameObject();
chest = val2.AddComponent<LineRenderer>();
((Renderer)chest).material.color = Color.blue;
chest.SetWidth(0.1f, 0.1f);
}
public void OnDestroy()
{
if ((Object)(object)forward != (Object)null)
{
ObjectExt.Destroy((Object)(object)((Component)forward).gameObject);
}
if ((Object)(object)chest != (Object)null)
{
ObjectExt.Destroy((Object)(object)((Component)chest).gameObject);
}
}
public void Update()
{
//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_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: 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_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: 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_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)enemy == (Object)null) && !((Object)(object)forward == (Object)null) && !((Object)(object)chest == (Object)null))
{
if (!ShowVectors || !((Agent)enemy).Alive || !enemy.EnemyBalancingData.AllowDamgeBonusFromBehind)
{
forward.positionCount = 0;
chest.positionCount = 0;
((Renderer)forward).enabled = false;
((Renderer)chest).enabled = false;
return;
}
((Renderer)forward).enabled = true;
Vector3 val = ((Agent)enemy).Forward;
forward.positionCount = 2;
forward.SetPosition(0, enemy.Position + floorOffset);
forward.SetPosition(1, enemy.Position + floorOffset + val);
((Renderer)chest).enabled = true;
Vector3 val2 = (((Object)(object)enemy.ModelRef.m_chestBone == (Object)null) ? ((Component)enemy.Damage).transform.forward : (enemy.ModelRef.m_chestBone.up * -1f));
chest.positionCount = 2;
chest.SetPosition(0, enemy.Position + floorOffset);
chest.SetPosition(1, enemy.Position + floorOffset + val2);
}
}
}
internal class EnemyLimbHitboxes : MonoBehaviour
{
public static Dictionary<eLimbDamageType, Color> TypeToColor = new Dictionary<eLimbDamageType, Color>
{
{
(eLimbDamageType)0,
Color.green
},
{
(eLimbDamageType)1,
Color.red
},
{
(eLimbDamageType)2,
Color.grey
}
};
public static bool ShowHitboxes = false;
public static bool DoUpdate = true;
public List<Renderer> m_renderers = new List<Renderer>();
public Material m_material;
public Transform m_dummyTransform;
private Dam_EnemyDamageLimb m_limb;
private Collider m_collider;
private FleshBulbs m_bulbController = null;
private Transform HitboxRoot;
public void Setup(Dam_EnemyDamageLimb limb, Collider collider)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: 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_00d5: Expected O, but got Unknown
m_limb = limb;
m_collider = collider;
m_dummyTransform = new GameObject("Hitbox Dummy Obj").transform;
m_dummyTransform.parent = ((Component)m_limb).transform;
m_dummyTransform.localRotation = Quaternion.identity;
m_dummyTransform.localPosition = Vector3.zero;
FleshBulbLimb component = ((Component)limb).gameObject.GetComponent<FleshBulbLimb>();
if ((Object)(object)component != (Object)null)
{
m_bulbController = component.m_fleshBulbController;
}
SphereCollider OutComp2;
if (collider.TryCastAtHome<Collider, CapsuleCollider>(out CapsuleCollider OutComp))
{
SetupAsCapsule(OutComp);
}
else if (collider.TryCastAtHome<Collider, SphereCollider>(out OutComp2))
{
SetupAsSphere(OutComp2);
}
else
{
if (!collider.TryCastAtHome<Collider, BoxCollider>(out BoxCollider OutComp3))
{
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(27, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("UNSUPPORTED COLLIDER TYPE: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Type>(((object)collider).GetType());
}
Logger.Error(val);
Object.Destroy((Object)(object)this);
return;
}
SetupAsBox(OutComp3);
}
foreach (Renderer renderer in m_renderers)
{
renderer.material = m_material;
Object.Destroy((Object)(object)((Component)renderer).gameObject.GetComponent<Collider>());
}
((Object)((Component)HitboxRoot).gameObject).name = ((Object)((Component)m_limb).gameObject).name + " - " + ((Object)((Component)HitboxRoot).gameObject).name;
((Component)HitboxRoot).transform.parent = ((Component)m_limb.m_base.Owner).transform;
}
public void SetupAsBox(BoxCollider bc)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
Transform transform = ((Component)m_limb).transform;
m_dummyTransform.localPosition = bc.center;
GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
val.transform.localScale = bc.size.Multiply(transform.lossyScale);
HitboxRoot = val.transform;
Renderer component = val.GetComponent<Renderer>();
m_material = component.material;
m_renderers.Add(component);
}
public void SetupAsSphere(SphereCollider sc)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
Transform transform = ((Component)m_limb).transform;
m_dummyTransform.localPosition = sc.center;
Vector3 lossyScale = transform.lossyScale;
float num = sc.radius * 2f * Mathf.Max(new float[3] { lossyScale.x, lossyScale.y, lossyScale.z });
GameObject val = GameObject.CreatePrimitive((PrimitiveType)0);
val.transform.localScale = new Vector3(num, num, num);
Renderer component = val.GetComponent<Renderer>();
m_material = component.material;
m_renderers.Add(component);
HitboxRoot = val.transform;
}
public void SetupAsCapsule(CapsuleCollider cap)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: 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_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
Transform transform = ((Component)m_limb).transform;
m_dummyTransform.localPosition = cap.center;
Vector3 lossyScale = transform.lossyScale;
float num = cap.radius * 2f;
float num2 = cap.height / 2f;
switch (cap.direction)
{
case 0:
m_dummyTransform.localRotation = Quaternion.Euler(0f, 0f, 90f);
num *= Mathf.Max(lossyScale.y, lossyScale.z);
num2 *= lossyScale.x;
break;
case 1:
num *= Mathf.Max(lossyScale.x, lossyScale.z);
num2 *= lossyScale.y;
break;
case 2:
m_dummyTransform.localRotation = Quaternion.Euler(90f, 0f, 0f);
num *= Mathf.Max(lossyScale.x, lossyScale.y);
num2 *= lossyScale.z;
break;
}
num2 = Mathf.Max(0f, num2 - num / 2f);
HitboxRoot = new GameObject("Capsule").transform;
GameObject val = GameObject.CreatePrimitive((PrimitiveType)2);
val.transform.parent = HitboxRoot;
val.transform.localRotation = Quaternion.identity;
val.transform.localPosition = Vector3.zero;
val.transform.localScale = new Vector3(num, num2, num);
GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)0);
((Object)val2).name = "CapsuleTop";
val2.transform.parent = HitboxRoot;
val2.transform.localRotation = Quaternion.identity;
val2.transform.localPosition = new Vector3(0f, num2, 0f);
val2.transform.localScale = new Vector3(num, num, num);
GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)0);
((Object)val3).name = "CapsuleBottom";
val3.transform.parent = HitboxRoot;
val3.transform.localRotation = Quaternion.identity;
val3.transform.localPosition = new Vector3(0f, 0f - num2, 0f);
val3.transform.localScale = new Vector3(num, num, num);
Renderer component = val.GetComponent<Renderer>();
m_material = component.material;
m_renderers.Add(component);
m_renderers.Add(val2.GetComponent<Renderer>());
m_renderers.Add(val3.GetComponent<Renderer>());
}
public void OnDisable()
{
foreach (Renderer renderer in m_renderers)
{
renderer.enabled = false;
((Component)renderer).gameObject.SetActive(false);
}
}
public void Update()
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
if (!DoUpdate || !m_limb.m_base.Owner.MovingCuller.IsShown)
{
return;
}
m_material.color = TypeToColor[m_limb.m_type];
foreach (Renderer renderer in m_renderers)
{
renderer.enabled = ShowHitboxes;
GameObject gameObject = ((Component)renderer).gameObject;
gameObject.SetActive(m_collider.enabled && ShowHitboxes);
}
if ((Object)(object)m_bulbController != (Object)null)
{
m_bulbController.ForceRenderingOff = ShowHitboxes;
}
HitboxRoot.position = m_dummyTransform.position;
HitboxRoot.rotation = m_dummyTransform.rotation;
}
}
internal class EnemyHitboxCuller : MonoBehaviour
{
private EnemyAgent m_agent;
private InstancedRenderFeature[] m_allIRFs;
public void Start()
{
m_agent = ((Component)this).GetComponent<EnemyAgent>();
m_allIRFs = Il2CppArrayBase<InstancedRenderFeature>.op_Implicit(((Component)this).GetComponentsInChildren<InstancedRenderFeature>());
}
public void LateUpdate()
{
Enumerator<Renderer> enumerator = ((C_CullBucket)m_agent.MovingCuller.Culler).Renderers.GetEnumerator();
while (enumerator.MoveNext())
{
Renderer current = enumerator.Current;
current.enabled = !EnemyLimbHitboxes.ShowHitboxes;
}
InstancedRenderFeature[] allIRFs = m_allIRFs;
foreach (InstancedRenderFeature val in allIRFs)
{
((Behaviour)val).enabled = !EnemyLimbHitboxes.ShowHitboxes;
}
}
}
internal class EnemyMeleeHitboxes : MonoBehaviour
{
public static bool ShowHitboxes;
public EnemyAgent enemy;
public Renderer left;
public Renderer right;
public void Start()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.CreatePrimitive((PrimitiveType)0);
val.GetComponent<Collider>().enabled = false;
left = val.GetComponent<Renderer>();
left.material.color = Color.red;
((Component)left).transform.position = Vector3.zero;
GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)0);
val2.GetComponent<Collider>().enabled = false;
right = val2.GetComponent<Renderer>();
right.material.color = Color.red;
((Component)right).transform.position = Vector3.zero;
}
public void OnDestroy()
{
if ((Object)(object)left != (Object)null)
{
ObjectExt.Destroy((Object)(object)((Component)left).gameObject);
}
if ((Object)(object)right != (Object)null)
{
ObjectExt.Destroy((Object)(object)((Component)right).gameObject);
}
}
public void Update()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: 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)
if (!((Object)(object)enemy == (Object)null) && !((Object)(object)left == (Object)null) && !((Object)(object)right == (Object)null))
{
ES_StrikerMelee strikerMelee = enemy.Locomotion.StrikerMelee;
float num = (Clock.Time - strikerMelee.m_startTime) * strikerMelee.m_animSpeed;
bool flag = strikerMelee.m_attackData.DamageStart < num && num < strikerMelee.m_attackData.DamageEnd;
if (!ShowHitboxes || !((Agent)enemy).Alive || !flag)
{
left.enabled = false;
right.enabled = false;
return;
}
left.enabled = true;
right.enabled = true;
((Component)left).transform.localScale = new Vector3(strikerMelee.m_damageRad, strikerMelee.m_damageRad, strikerMelee.m_damageRad);
((Component)right).transform.localScale = new Vector3(strikerMelee.m_damageRad, strikerMelee.m_damageRad, strikerMelee.m_damageRad);
((Component)left).transform.position = enemy.ModelRef.m_leftHandBone.position;
((Component)right).transform.position = enemy.ModelRef.m_rightHandBone.position;
}
}
}
internal class PlayerMeleeHitboxes : MonoBehaviour
{
public static bool ShowHitboxes;
public MeleeWeaponFirstPerson melee;
public Renderer meleeHitbox;
public void Start()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.CreatePrimitive((PrimitiveType)0);
val.GetComponent<Collider>().enabled = false;
meleeHitbox = val.GetComponent<Renderer>();
meleeHitbox.material.color = Color.white;
((Component)meleeHitbox).transform.position = Vector3.zero;
}
public void OnDestroy()
{
if ((Object)(object)meleeHitbox != (Object)null)
{
ObjectExt.Destroy((Object)(object)((Component)meleeHitbox).gameObject);
}
}
public void Update()
{
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)melee == (Object)null || (Object)(object)meleeHitbox == (Object)null)
{
return;
}
MWS_Base currentState = melee.CurrentState;
if (!ShowHitboxes || currentState == null)
{
meleeHitbox.enabled = false;
return;
}
MWS_AttackSwingBase val = ((Il2CppObjectBase)currentState).TryCast<MWS_AttackSwingBase>();
if (val != null && ((MWS_Base)val).m_data.m_damageStartTime < val.m_elapsed && val.m_elapsed <= ((MWS_Base)val).m_data.m_damageEndTime && !val.m_targetsFound)
{
float num = ((ItemEquippable)melee).MeleeArchetypeData.AttackSphereRadius;
Vector3 forward = ((Item)melee).Owner.FPSCamera.Forward;
Vector3 val2 = melee.ModelData.m_damageRefAttack.position - ((Item)melee).Owner.FPSCamera.Position;
float num2 = Vector3.Dot(forward, ((Vector3)(ref val2)).normalized);
if ((double)num2 > 0.5)
{
num *= 1f + num2 * melee.m_attackDamageSphereDotScale;
}
((Component)meleeHitbox).transform.localScale = new Vector3(num, num, num);
((Component)meleeHitbox).transform.position = ((MWS_Base)val).m_data.m_damageRef.position;
meleeHitbox.enabled = true;
}
else
{
MWS_Push val3 = ((Il2CppObjectBase)currentState).TryCast<MWS_Push>();
if (val3 != null && ((MWS_Base)val3).m_data.m_damageStartTime < val3.m_elapsed && val3.m_elapsed <= ((MWS_Base)val3).m_data.m_damageEndTime && !val3.m_damageDone)
{
float pushDamageSphereRadius = ((ItemEquippable)melee).MeleeArchetypeData.PushDamageSphereRadius;
((Component)meleeHitbox).transform.localScale = new Vector3(pushDamageSphereRadius, pushDamageSphereRadius, pushDamageSphereRadius);
((Component)meleeHitbox).transform.position = ((MWS_Base)val3).m_data.m_damageRef.position;
meleeHitbox.enabled = true;
}
else
{
meleeHitbox.enabled = false;
}
}
}
}
}