Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of HitboxViewerMod v1.5.4
SillyHitboxViewer.dll
Decompiled a year agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HG.Reflection; using KinematicCharacterController; using On.RoR2; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.Projectile; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SillyHitboxViewer")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+aa8ef4b1ba8bc68b7f54a8cfede973c12ee1b1ea")] [assembly: AssemblyProduct("SillyHitboxViewer")] [assembly: AssemblyTitle("SillyHitboxViewer")] [assembly: AssemblyVersion("1.0.0.0")] namespace SillyHitboxViewer; public class HitboxGroupRevealer : MonoBehaviour { private HitboxRevealer _hitboxPrefab; private HitboxRevealer[] _revealers; private bool _isMerc; private int _revealBufferCount; private bool _revealed; public HitBoxGroup hitboxGroup { get; set; } public void init(HitBoxGroup hitboxGroup_, HitboxRevealer hitboxPrefab_, GameObject attacker) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected I4, but got Unknown hitboxGroup = hitboxGroup_; _hitboxPrefab = hitboxPrefab_; if (Object.op_Implicit((Object)(object)attacker)) { CharacterBody component = attacker.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { _isMerc = checkMerc((int)component.bodyIndex); } } if (Object.op_Implicit((Object)(object)((Component)hitboxGroup_).GetComponent<ProjectileDotZone>())) { _isMerc = true; } initVisaulizinators(); } private bool checkMerc(int index) { return Utils.cfg_softenedCharacters.Contains(index); } private void initVisaulizinators() { _revealers = new HitboxRevealer[hitboxGroup.hitBoxes.Length]; for (int i = 0; i < hitboxGroup.hitBoxes.Length; i++) { HitboxRevealer hitboxRevealer = Object.Instantiate<HitboxRevealer>(_hitboxPrefab); hitboxRevealer.init(boxType.HIT, ((Component)hitboxGroup.hitBoxes[i]).transform, _isMerc); _revealers[i] = hitboxRevealer; } } public void reveal(bool active) { if (active) { _revealBufferCount = 3; } if (_revealed != active) { _revealed = active; for (int i = 0; i < _revealers.Length; i++) { _revealers[i]?.show(active); } } } private void FixedUpdate() { if (_revealBufferCount == 0) { reveal(active: false); } _revealBufferCount--; } private void OnDestroy() { reveal(active: false); for (int i = 0; i < _revealers.Length; i++) { Object.Destroy((Object)(object)((Component)_revealers[i]).gameObject); } } } public enum boxType { HIT, BLAST, BULLET, BULLET_THIN, BULLET_POINT, HURT } public class HitboxRevealer : MonoBehaviour { public static bool cfg_MercSoften; public static float cfg_BoxAlpha = 0.22f; public static float cfg_BulletAlpha = 0.32f; public static float cfg_HurtAlpha = 0.22f; public static float cfg_BlastShowTime = 0.2f; public static float cfg_BulletShowTime = 0.5f; public static bool cfg_ColorfulBullets = false; public static bool cfg_UniformBullets = false; public static float randomTimer; public static bool showingAnyBoxes = true; public static bool showingHitBoxes = true; public static bool showingHurtBoxes = true; public static bool showingKinos = true; public static bool bulletModeEnabled = false; [SerializeField] private Renderer rend; private MaterialPropertyBlock _matProperties; private Color _matColor; private Transform _overlapAttackTransform; private bool spher; private void Awake() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown _matProperties = new MaterialPropertyBlock(); rend.GetPropertyBlock(_matProperties); rend.enabled = false; } private float getBoxAlpha(boxType box) { return box switch { boxType.BLAST => cfg_BoxAlpha, boxType.BULLET => cfg_BulletAlpha, boxType.BULLET_THIN => cfg_BulletAlpha * 1.5f, boxType.BULLET_POINT => cfg_BulletAlpha * 2f, boxType.HURT => cfg_HurtAlpha, _ => cfg_BoxAlpha, }; } public HitboxRevealer init(boxType box, Transform boxParentTransform, bool isMerc = false) { //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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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) _overlapAttackTransform = boxParentTransform; ((Component)this).transform.parent = boxParentTransform; ((Component)this).transform.localPosition = Vector3.zero; ((Component)this).transform.localRotation = Quaternion.identity; ((Component)this).transform.localScale = Vector3.one; if (VRCompat.enabled && box == boxType.HIT) { ((Component)this).transform.parent = null; } float a = getBoxAlpha(box); float num = 0.6f; float num2 = 0f; float num3 = 1f; if (isMerc && cfg_MercSoften) { a = 0.12f; num = 0.4f; num2 = 0.35f; num3 = 0.9f; } if (box == boxType.BULLET || box == boxType.BULLET_THIN || box == boxType.BULLET_POINT) { if (!cfg_ColorfulBullets) { num2 = randomTimer * 10000f - (float)(int)(randomTimer * 10000f); num3 = num2; } if (cfg_UniformBullets) { num2 = 0.5f; num3 = num2; } } _matColor = Random.ColorHSV(num2, num3, 0.5f, 0.5f, num, num); _matColor.a = a; _matProperties.SetColor("_Color", _matColor); rend.SetPropertyBlock(_matProperties); return this; } public void show(bool active) { active &= showingAnyBoxes && showingHitBoxes; if (Object.op_Implicit((Object)(object)rend)) { rend.enabled = active; } } private void FixedUpdate() { //IL_0034: 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) if (VRCompat.enabled && rend.enabled && Object.op_Implicit((Object)(object)_overlapAttackTransform)) { ((Component)this).transform.position = _overlapAttackTransform.position; ((Component)this).transform.rotation = _overlapAttackTransform.rotation; } } public HitboxRevealer initKino(Transform capsuleTransform, CapsuleCollider capsuleCollider) { return initHurtbox(capsuleTransform, capsuleCollider, kino: true); } public HitboxRevealer initHurtbox(Transform capsuleTransform, CapsuleCollider capsuleCollider, bool kino = false) { //IL_0012: 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_0084: 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) init(boxType.HURT, capsuleTransform); ((Component)this).transform.localPosition = capsuleCollider.center; ((Component)this).transform.localScale = new Vector3(capsuleCollider.radius * 2f, capsuleCollider.height / 2f, capsuleCollider.radius * 2f); switch (capsuleCollider.direction) { case 0: ((Component)this).transform.localEulerAngles = new Vector3(0f, 0f, 90f); break; case 2: ((Component)this).transform.localEulerAngles = new Vector3(90f, 0f, 0f); break; } if (kino) { kinoShow(active: true); } else { hurtboxShow(active: true); } return this; } public HitboxRevealer initHurtbox(Transform sphereTransform, SphereCollider sphereCollider) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) init(boxType.HURT, sphereTransform); spher = true; ((Component)this).transform.localPosition = sphereCollider.center; ((Component)this).transform.localScale = Vector3.one * sphereCollider.radius * 2f; hurtboxShow(active: true); return this; } public HitboxRevealer initHurtbox(Transform boxTransform, BoxCollider boxCollider) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) init(boxType.HURT, boxTransform); ((Component)this).transform.localPosition = boxCollider.center; ((Component)this).transform.localScale = boxCollider.size; hurtboxShow(active: true); return this; } public void hurtboxShow(bool active) { active &= showingAnyBoxes && showingHurtBoxes; if (Object.op_Implicit((Object)(object)rend)) { rend.enabled = active; } } public void kinoShow(bool active) { active &= showingAnyBoxes && showingKinos; if (Object.op_Implicit((Object)(object)rend)) { rend.enabled = active; } } private void OnDestroy() { if (spher) { Utils.LogWarning("oy i die (a sphere (just to be clear))"); } } public HitboxRevealer initBlastBox(Vector3 blastPosition, float radius) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) init(boxType.BLAST, null); ((Component)this).transform.position = blastPosition; ((Component)this).transform.localScale = Vector3.one * radius * 2f; blastboxShow(active: true, cfg_BlastShowTime); return this; } public void blastboxShow(bool active, float showTime) { active &= showingAnyBoxes && showingHitBoxes; if (Object.op_Implicit((Object)(object)rend)) { rend.enabled = active; } ((MonoBehaviour)this).StartCoroutine(timedRemoveBlast(showTime)); } private IEnumerator timedRemoveBlast(float killTime) { yield return (object)new WaitForFixedUpdate(); yield return (object)new WaitForFixedUpdate(); _matColor *= 0.69f; _matColor.a *= 1.449f; _matProperties.SetColor("_Color", _matColor); rend.SetPropertyBlock(_matProperties); yield return (object)new WaitForSeconds(killTime); if (Object.op_Implicit((Object)(object)((Component)this).gameObject)) { Object.Destroy((Object)(object)((Component)this).gameObject); } } public HitboxRevealer initBulletBox(Vector3 origin, Vector3 normal, float distance, float radius) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) init((radius == 0f) ? boxType.BULLET_THIN : boxType.BULLET, null); radius = Mathf.Max(radius, 0.05f); ((Component)this).transform.position = origin; ((Component)this).transform.LookAt(((Component)this).transform.TransformPoint(normal), Vector3.up); ((Component)this).transform.localScale = new Vector3(radius * 2f, radius * 2f, distance); blastboxShow(active: true, cfg_BulletShowTime); return this; } public HitboxRevealer initBulletPoint(Vector3 position, float radius) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) init(boxType.BULLET_POINT, null); ((Component)this).transform.position = position; ((Component)this).transform.localScale = Vector3.one * radius * 2f; bulletPointBoxShow(active: true, bulletModeEnabled ? 100f : (cfg_BulletShowTime * 2.5f), cfg_BulletShowTime * 1.5f); return this; } public void bulletPointBoxShow(bool active, float showTime, float shrinkTime) { active &= showingAnyBoxes && showingHitBoxes; if (Object.op_Implicit((Object)(object)rend)) { rend.enabled = active; } ((MonoBehaviour)this).StartCoroutine(timedRemoveBulletPoint(showTime, shrinkTime)); } private IEnumerator timedRemoveBulletPoint(float killTime, float shrinkTime) { yield return (object)new WaitForFixedUpdate(); yield return (object)new WaitForFixedUpdate(); _matColor *= 0.69f; _matColor.a *= 1.449f; _matProperties.SetColor("_Color", _matColor); rend.SetPropertyBlock(_matProperties); if (!bulletModeEnabled) { shrinkTime = killTime; } yield return (object)new WaitForSeconds(shrinkTime); float shrink = ((Component)this).transform.localScale.x * 0.4f; ((Component)this).transform.localScale = Vector3.one * Mathf.Max(shrink, 0.1f); if (killTime < shrinkTime) { Utils.LogError("can't wait for a negative time retard"); } yield return (object)new WaitForSeconds(killTime - shrinkTime); if (Object.op_Implicit((Object)(object)((Component)this).gameObject)) { Object.Destroy((Object)(object)((Component)this).gameObject); } } public void kill() { if (Object.op_Implicit((Object)(object)((Component)this).gameObject)) { ((MonoBehaviour)this).StopAllCoroutines(); Object.Destroy((Object)(object)((Component)this).gameObject); } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.TheTimeSweeper.HitboxViewer", "Silly Hitbox Viewer", "1.5.4")] public class HitboxViewerMod : BaseUnityPlugin { public static HitboxViewerMod instance; public static ManualLogSource log; private List<HitboxGroupRevealer> _hitboxGroupRevealers = new List<HitboxGroupRevealer>(); private Queue<HitboxRevealer> _revealerPool = new Queue<HitboxRevealer>(); private static int hitPoolStart = 50; private static int totalPool = 0; private Queue<HitboxRevealer> _blastPool = new Queue<HitboxRevealer>(); private static int blastPoolStart = 50; private List<HitboxRevealer> _hurtboxRevealers = new List<HitboxRevealer>(); private List<HitboxRevealer> _kinoRevealers = new List<HitboxRevealer>(); private List<HitboxRevealer> _bulletHitPointRevealers = new List<HitboxRevealer>(); private HitboxRevealer _hitboxBoxPrefab; private HitboxRevealer _hitboxNotBoxPrefab; private HitboxRevealer _hitboxNotBoxPrefabSmol; private HitboxRevealer _hitboxNotBoxPrefabTall; private HitboxRevealer _hitboxNotBoxPrefabTallFlat; private HitboxRevealer _hitboxNotBoxPrefabTallFlatSmol; private void Awake() { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown instance = this; log = ((BaseUnityPlugin)this).Logger; log.LogWarning((object)"uh1"); populateAss(); Utils.doConfig(); log.LogWarning((object)"uh2"); Utils.doHitbox.SettingChanged += DoHitbox_SettingChanged; Utils.doHurtbox.SettingChanged += DoHurtbox_SettingChanged; Utils.doKinos.SettingChanged += DoKinos_SettingChanged; log.LogWarning((object)"uh3"); setShowingHitboxes(Utils.cfg_doHitbox); setShowingHurtboxes(Utils.cfg_doHurtbox, showAll: false); setShowingKinos(Utils.cfg_doKinos, showAll: false); log.LogWarning((object)"uh4"); if (RiskOfOptionsCompat.enabled) { RiskOfOptionsCompat.doOptions(); } log.LogWarning((object)"uh5"); BodyCatalog.Init += new hook_Init(BodyCatalog_Init); OverlapAttack.Fire += new hook_Fire(OverlapAttack_Fire); BlastAttack.Fire += new hook_Fire(BlastAttack_Fire); HurtBox.Awake += new hook_Awake(HurtBox_Awake); BulletAttack.FireSingle += new hook_FireSingle(BulletAttack_FireSingle); BulletAttack.InitBulletHitFromRaycastHit += new hook_InitBulletHitFromRaycastHit(BulletAttack_InitBulletHitFromRaycastHit); CharacterMotor.Awake += new hook_Awake(CharacterMotor_Awake); } private void DoHitbox_SettingChanged(object sender, EventArgs e) { setShowingHitboxes(Utils.cfg_doHitbox); } private void DoHurtbox_SettingChanged(object sender, EventArgs e) { setShowingHurtboxes(Utils.cfg_doHurtbox, showAll: true); } private void DoKinos_SettingChanged(object sender, EventArgs e) { setShowingKinos(Utils.cfg_doKinos, showAll: true); } private void populateAss() { AssetBundle val = null; using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SillyHitboxViewer.sillyhitbox")) { val = AssetBundle.LoadFromStream(stream); } _hitboxBoxPrefab = LoadHitboxAss(val, "hitboxPreviewInator"); _hitboxNotBoxPrefab = LoadHitboxAss(val, "hitboxPreviewInatorSphere"); _hitboxNotBoxPrefabSmol = LoadHitboxAss(val, "hitboxPreviewInatorSphereSmol"); _hitboxNotBoxPrefabTall = LoadHitboxAss(val, "hitboxPreviewInatorCapsule"); _hitboxNotBoxPrefabTallFlat = LoadHitboxAss(val, "hitboxPreviewInatorCylinder"); _hitboxNotBoxPrefabTallFlatSmol = LoadHitboxAss(val, "hitboxPreviewInatorCylinderSmol"); RiskOfOptionsCompat.icon = val.LoadAsset<Sprite>("hitboxIcon"); } private static HitboxRevealer LoadHitboxAss(AssetBundle MainAss, string assString) { GameObject obj = MainAss.LoadAsset<GameObject>(assString); HitboxRevealer hitboxRevealer = ((obj != null) ? obj.GetComponent<HitboxRevealer>() : null); if ((Object)(object)hitboxRevealer == (Object)null) { log.LogError((object)("unable to load prefab, " + assString + ", from the bundle. Timesweeper did an oops")); } return (hitboxRevealer != null) ? ((Component)hitboxRevealer).GetComponent<HitboxRevealer>() : null; } [ConCommand(/*Could not decode attribute arguments.*/)] private static void ShowHitbox(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ShowHitboxes(args); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void ShowHitboxes(ConCommandArgs args) { int? num = ((ConCommandArgs)(ref args)).TryGetArgInt(0); Debug.LogWarning((object)((ConCommandArgs)(ref args)).Count); if (((ConCommandArgs)(ref args)).Count > 0 && !num.HasValue) { Debug.LogError((object)"ya dun goofed it. Pass in 1 to enable Hitboxes, 0 to disable, or pass in nothing to toggle"); return; } bool hitboxConfig = ((((ConCommandArgs)(ref args)).Count <= 0) ? (!HitboxRevealer.showingHitBoxes) : (num.GetValueOrDefault() == 1)); Utils.setHitboxConfig(hitboxConfig); Utils.Log($"showing hitboxes option set to {num.GetValueOrDefault() == 1}", chat: true); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void ShowHurtbox(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ShowHurtboxes(args); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void ShowHurtboxes(ConCommandArgs args) { int? num = ((ConCommandArgs)(ref args)).TryGetArgInt(0); if (((ConCommandArgs)(ref args)).Count > 0 && !num.HasValue) { Debug.LogError((object)"ya dun fucked up. Pass in 1 to enable Hurtboxes, 0 to disable, or pass in nothing to toggle"); return; } bool hurtboxConfig = ((((ConCommandArgs)(ref args)).Count <= 0) ? (!HitboxRevealer.showingHurtBoxes) : (num.GetValueOrDefault() == 1)); Utils.setHurtboxConfig(hurtboxConfig); Utils.Log($"showing hurtboxes option set to {num.GetValueOrDefault() == 1}", chat: true); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void ShowKino(ConCommandArgs args) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ShowKinos(args); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void ShowKinos(ConCommandArgs args) { int? num = ((ConCommandArgs)(ref args)).TryGetArgInt(0); if (((ConCommandArgs)(ref args)).Count > 0 && !num.HasValue) { Debug.LogError((object)"ya dun fucked up. Pass in 1 to enable Hurtboxes, 0 to disable, or pass in nothing to toggle"); return; } bool kinoConfig = ((((ConCommandArgs)(ref args)).Count <= 0) ? (!HitboxRevealer.showingKinos) : (num.GetValueOrDefault() == 1)); Utils.setKinoConfig(kinoConfig); Utils.Log($"showing Character Motors option set to {num.GetValueOrDefault() == 1}", chat: true); } public static void setShowingHitboxes(bool set) { HitboxRevealer.showingHitBoxes = set; } public static void setShowingHurtboxes(bool set, bool showAll) { HitboxRevealer.showingHurtBoxes = set; if (showAll) { instance.bindShowAllHurtboxes(); } } public static void setShowingKinos(bool set, bool showAll) { HitboxRevealer.showingKinos = set; if (showAll) { instance.bindShowAllKinos(); } } private IEnumerator BodyCatalog_Init(orig_Init orig) { IEnumerator result = orig.Invoke(); Utils.setSoftenedCharacters(); return result; } private bool OverlapAttack_Fire(orig_Fire orig, OverlapAttack self, List<HurtBox> hitResults) { bool result = orig.Invoke(self, hitResults); HitboxGroupRevealer hitboxGroupRevealer = _hitboxGroupRevealers.Find((HitboxGroupRevealer revealer) => (Object)(object)revealer != (Object)null && (Object)(object)revealer.hitboxGroup == (Object)(object)self.hitBoxGroup); if ((Object)(object)hitboxGroupRevealer == (Object)null) { if ((Object)(object)self.hitBoxGroup == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"could not show hitbox. hitboxgroup is null"); return result; } hitboxGroupRevealer = ((Component)self.hitBoxGroup).gameObject.AddComponent<HitboxGroupRevealer>(); _hitboxGroupRevealers.Add(hitboxGroupRevealer); hitboxGroupRevealer.init(self.hitBoxGroup, _hitboxBoxPrefab, self.attacker); } hitboxGroupRevealer.reveal(active: true); return result; } private Result BlastAttack_Fire(orig_Fire orig, BlastAttack self) { //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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) Result result = orig.Invoke(self); if (!Utils.cfg_showLogsVerbose) { Object.Instantiate<HitboxRevealer>((self.radius < 0.1f) ? _hitboxNotBoxPrefabSmol : _hitboxNotBoxPrefab).initBlastBox(self.position, self.radius); return result; } HitboxRevealer hitboxRevealer = Object.Instantiate<HitboxRevealer>((self.radius < 0.1f) ? _hitboxNotBoxPrefabSmol : _hitboxNotBoxPrefab).initBlastBox(self.position, self.radius); return result; } private void BulletAttack_FireSingle(orig_FireSingle orig, BulletAttack self, Vector3 normal, int muzzleIndex) { //IL_0003: 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_0032: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, normal, muzzleIndex); Object.Instantiate<HitboxRevealer>((self.radius < 0.1f) ? _hitboxNotBoxPrefabTallFlatSmol : _hitboxNotBoxPrefabTallFlat).initBulletBox(self.origin, normal, self.maxDistance, self.radius); } private void BulletAttack_InitBulletHitFromRaycastHit(orig_InitBulletHitFromRaycastHit orig, BulletAttack self, ref BulletHit bulletHit, Vector3 origin, Vector3 direction, ref RaycastHit raycastHit) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, ref bulletHit, origin, direction, ref raycastHit); if (!(Vector3.Distance(self.origin, bulletHit.point) < 0.5f)) { if (!HitboxRevealer.bulletModeEnabled) { Object.Instantiate<HitboxRevealer>((self.radius < 0.1f) ? _hitboxNotBoxPrefabSmol : _hitboxNotBoxPrefab).initBulletPoint(bulletHit.point, self.radius); } _bulletHitPointRevealers.Add(Object.Instantiate<HitboxRevealer>(_hitboxNotBoxPrefabSmol).initBulletPoint(bulletHit.point, 0.1f)); } } private void HurtBox_Awake(orig_Awake orig, HurtBox self) { orig.Invoke(self); if (!Utils.cfg_unDynamicHurtboxes || (HitboxRevealer.showingAnyBoxes && HitboxRevealer.showingHurtBoxes)) { if (self.collider is CapsuleCollider) { List<HitboxRevealer> hurtboxRevealers = _hurtboxRevealers; HitboxRevealer hitboxRevealer = Object.Instantiate<HitboxRevealer>(_hitboxNotBoxPrefabTall); Transform transform = ((Component)self.collider).transform; Collider collider = self.collider; hurtboxRevealers.Add(hitboxRevealer.initHurtbox(transform, (CapsuleCollider)(object)((collider is CapsuleCollider) ? collider : null))); } if (self.collider is SphereCollider) { List<HitboxRevealer> hurtboxRevealers2 = _hurtboxRevealers; HitboxRevealer hitboxRevealer2 = Object.Instantiate<HitboxRevealer>(_hitboxNotBoxPrefab); Transform transform2 = ((Component)self.collider).transform; Collider collider2 = self.collider; hurtboxRevealers2.Add(hitboxRevealer2.initHurtbox(transform2, (SphereCollider)(object)((collider2 is SphereCollider) ? collider2 : null))); Utils.LogWarning("intititating " + ((Object)((Component)self.hurtBoxGroup).gameObject).name); } if (self.collider is BoxCollider) { List<HitboxRevealer> hurtboxRevealers3 = _hurtboxRevealers; HitboxRevealer hitboxRevealer3 = Object.Instantiate<HitboxRevealer>(_hitboxBoxPrefab); Transform transform3 = ((Component)self.collider).transform; Collider collider3 = self.collider; hurtboxRevealers3.Add(hitboxRevealer3.initHurtbox(transform3, (BoxCollider)(object)((collider3 is BoxCollider) ? collider3 : null))); } } } private void CharacterMotor_Awake(orig_Awake orig, CharacterMotor self) { orig.Invoke(self); if (!Utils.cfg_unDynamicHurtboxes || (HitboxRevealer.showingAnyBoxes && HitboxRevealer.showingKinos)) { _kinoRevealers.Add(Object.Instantiate<HitboxRevealer>(_hitboxNotBoxPrefabTall).initKino(((Component)((BaseCharacterController)self).Motor.Capsule).transform, ((BaseCharacterController)self).Motor.Capsule)); } } private void Update() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) HitboxRevealer.randomTimer += Time.deltaTime; if (HitboxRevealer.randomTimer > 100f) { HitboxRevealer.randomTimer -= 100f; } if (Input.GetKeyDown(Utils.cfg_toggleKey)) { HitboxRevealer.showingAnyBoxes = !HitboxRevealer.showingAnyBoxes; Utils.Log(HitboxRevealer.showingAnyBoxes ? "hitboxes enabled" : "all hitboxes disabled", chat: true); bindShowAllHurtboxes(); bindClearBulletPoints(); } if (Input.GetKeyDown(Utils.cfg_bulletModeKey)) { HitboxRevealer.bulletModeEnabled = !HitboxRevealer.bulletModeEnabled; Utils.Log(HitboxRevealer.bulletModeEnabled ? "Lingering Bullet Mode Enabled" : "Lingering Bullets disabaled", chat: true); bindClearBulletPoints(); } if (!Utils.cfg_useDebug) { return; } if (Object.op_Implicit((Object)(object)Console.instance) && ((Behaviour)Console.instance).enabled) { for (int i = 0; i < LocalUserManager.readOnlyLocalUsersList.Count; i++) { if (LocalUserManager.readOnlyLocalUsersList[i] != null && Object.op_Implicit((Object)(object)LocalUserManager.readOnlyLocalUsersList[i].currentNetworkUser) && ((NetworkBehaviour)LocalUserManager.readOnlyLocalUsersList[i].currentNetworkUser).localPlayerAuthority && LocalUserManager.readOnlyLocalUsersList[i].isUIFocused) { return; } } } if (Input.GetKeyDown((KeyCode)105)) { if (Time.timeScale == 0f) { setTimeScale(Time.timeScale + 0.1f); } else { setTimeScale(Time.timeScale + 0.5f); } } if (Input.GetKeyDown((KeyCode)107)) { setTimeScale(Time.timeScale - 0.1f); } if (Input.GetKeyDown((KeyCode)111)) { setTimeScale(1f); } if (Input.GetKeyDown((KeyCode)108)) { setTimeScale(0f); } if (Input.GetKeyDown((KeyCode)112)) { string text = ""; int count = _revealerPool.Count; for (int j = 1; j <= _revealerPool.Count; j++) { HitboxRevealer hitboxRevealer = _revealerPool.Dequeue(); text += $"\nhitbox {(Object)(object)hitboxRevealer != (Object)null}, {j} revealers checked"; _revealerPool.Enqueue(hitboxRevealer); } Utils.LogReadout($"hitbox pool count: {count}:{text}"); text = ""; count = _blastPool.Count; for (int k = 1; k <= _blastPool.Count; k++) { HitboxRevealer hitboxRevealer = _blastPool.Dequeue(); text += $"\nblastbox {(Object)(object)hitboxRevealer != (Object)null}, {k} revealers checked"; _blastPool.Enqueue(hitboxRevealer); } Utils.LogReadout($"blast pool count: {count}:{text}"); } } private void bindClearBulletPoints() { if (HitboxRevealer.showingAnyBoxes && HitboxRevealer.bulletModeEnabled) { return; } for (int i = 0; i < _bulletHitPointRevealers.Count; i++) { HitboxRevealer hitboxRevealer = _bulletHitPointRevealers[i]; if ((Object)(object)hitboxRevealer != (Object)null) { hitboxRevealer.kill(); } } _bulletHitPointRevealers = new List<HitboxRevealer>(); } public void bindShowAllHurtboxes() { bool active = HitboxRevealer.showingAnyBoxes && HitboxRevealer.showingHurtBoxes; for (int num = _hurtboxRevealers.Count - 1; num >= 0; num--) { if ((Object)(object)_hurtboxRevealers[num] == (Object)null) { _hurtboxRevealers.RemoveAt(num); } else { _hurtboxRevealers[num].hurtboxShow(active); } } } public void bindShowAllKinos() { bool active = HitboxRevealer.showingAnyBoxes && HitboxRevealer.showingKinos; for (int num = _kinoRevealers.Count - 1; num >= 0; num--) { if ((Object)(object)_kinoRevealers[num] == (Object)null) { _kinoRevealers.RemoveAt(num); } else { _kinoRevealers[num].kinoShow(active); } } } private void setTimeScale(float tim) { Time.timeScale = tim; Utils.Log($"set tim: {Time.timeScale}", chat: true); } private void createPool(int poolStart, Queue<HitboxRevealer> poolQueue, bool blast) { for (int i = 0; i < poolStart; i++) { createPooledRevealer(poolQueue, blast); } } private void createPooledRevealer(Queue<HitboxRevealer> poolQueue, bool blast) { HitboxRevealer item = Object.Instantiate<HitboxRevealer>(blast ? _hitboxNotBoxPrefab : _hitboxBoxPrefab, ((Component)this).transform); poolQueue.Enqueue(item); } public HitboxRevealer requestPooledHitboxRevealer() { return requestPooledRevealer(_revealerPool, blast: false); } public HitboxRevealer requestPooledBlastRevealer() { return requestPooledRevealer(_blastPool, blast: true); } private HitboxRevealer requestPooledRevealer(Queue<HitboxRevealer> poolQueue, bool blast) { if (poolQueue.Count <= 0) { instance.createPooledRevealer(poolQueue, blast); Utils.LogWarning("requestPooledRevealer: pool full. adding revealer to total"); } HitboxRevealer hitboxRevealer = poolQueue.Dequeue(); if ((Object)(object)hitboxRevealer == (Object)null) { Utils.LogWarning("requestPooledRevealer: pooled revealer is null. trying again"); return requestPooledRevealer(poolQueue, blast); } return hitboxRevealer; } public void returnPooledHitboxRevealers(HitboxRevealer[] revs) { for (int i = 0; i < revs.Length; i++) { returnPooledRevealer(revs[i], _revealerPool); } } public void returnPooledBlastRevealer(HitboxRevealer rev) { returnPooledRevealer(rev, _blastPool); } private void returnPooledRevealers(HitboxRevealer[] revs, Queue<HitboxRevealer> poolQueue) { for (int i = 0; i < revs.Length; i++) { returnPooledRevealer(revs[i], poolQueue); } } private void returnPooledRevealer(HitboxRevealer rev, Queue<HitboxRevealer> poolQueue) { ((Component)rev).transform.parent = ((Component)instance).transform; poolQueue.Enqueue(rev); } public void removeHitBoxGroupRevealer(HitboxGroupRevealer rev) { _hitboxGroupRevealers.Remove(rev); } } public static class RiskOfOptionsCompat { private static bool? _enabled; public static Sprite icon; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); } return _enabled.Value; } } public static void doOptions() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown ModSettingsManager.SetModIcon(icon); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Utils.doHitbox)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Utils.doHurtbox)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Utils.doKinos)); } public static void hitboxBoolEvent(bool active) { HitboxViewerMod.setShowingHitboxes(!active); } public static void hurtboxBoolEvent(bool active) { HitboxViewerMod.setShowingHurtboxes(!active, showAll: true); } } public class Utils { public static bool cfg_useDebug; public static bool cfg_showLogsVerbose; public static ConfigEntry<bool> doHitbox; public static ConfigEntry<bool> doHurtbox; public static ConfigEntry<bool> doKinos; public static KeyCode cfg_toggleKey; public static KeyCode cfg_bulletModeKey; public static string defaultSoftenedCharacters = "MercBody, MinerBody, MiniMushroomBody, NemesisEnforcerBody, NemesisEnforcerBossBody, UrsaBody, "; public static string cfg_softenedCharactersString; public static List<int> cfg_softenedCharacters = new List<int>(); public static bool cfg_unDynamicHurtboxes; public static bool cfg_doHitbox => doHitbox.Value; public static bool cfg_doHurtbox => doHurtbox.Value; public static bool cfg_doKinos => doKinos.Value; public static void Log(object log, bool chat, bool overrideDebug = true) { if (cfg_useDebug || overrideDebug) { HitboxViewerMod.log.LogMessage(log); if (chat) { Chat.AddMessage(log.ToString()); } } } public static void LogError(object log) { HitboxViewerMod.log.LogError(log); } public static void LogReadout(object log) { if (cfg_showLogsVerbose) { Log(log, chat: false, overrideDebug: false); } } public static void LogWarning(object log) { if (cfg_showLogsVerbose) { HitboxViewerMod.log.LogWarning(log); } } public static void setHitboxConfig(bool set) { doHitbox.Value = set; } public static void setHurtboxConfig(bool set) { doHurtbox.Value = set; } internal static void setKinoConfig(bool set) { doKinos.Value = set; } public static void doConfig() { //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) doHitbox = ((BaseUnityPlugin)HitboxViewerMod.instance).Config.Bind<bool>("0. General", "Show Hitboxes", true, "Show Hitboxes.\n"); doHurtbox = ((BaseUnityPlugin)HitboxViewerMod.instance).Config.Bind<bool>("0. General", "Show Hurtboxes", false, "Show Hurtboxes.\n"); doKinos = ((BaseUnityPlugin)HitboxViewerMod.instance).Config.Bind<bool>("0. General", "Show Character Motors", false, "Show the capsule your character uses to interact with the environment/other characters.\n"); HitboxRevealer.cfg_BoxAlpha = ((BaseUnityPlugin)HitboxViewerMod.instance).Config.Bind<float>("1. OverlapAttack hitboxes (melee and some projectiles)", "OverlapAttack hitbox alpha", 0.22f, "0-1. Around 0.22 is ok. don't make it higher if you have epilepsy\n").Value; HitboxRevealer.cfg_MercSoften = ((BaseUnityPlugin)HitboxViewerMod.instance).Config.Bind<bool>("1. OverlapAttack hitboxes (melee and some projectiles)", "Tone down merc", true, "Make merc's hitboxes lighter cause he's a crazy fool (and might actually hurt your eyes)\n - overrides alpha brightness to 0.1 and keeps colors cool blue-ish range\n").Value; cfg_softenedCharactersString = ((BaseUnityPlugin)HitboxViewerMod.instance).Config.Bind<string>("1. OverlapAttack hitboxes (melee and some projectiles)", "Toned-down characters", "MercBody, MinerBody, MiniMushroomBody", "The wacky characters who need softening, separated by commas.\n - In addition to these, the following characters are always on the list: " + defaultSoftenedCharacters + "\n - Character's internal names are: CommandoBody, HuntressBody, ToolbotBody, EngiBody, MageBody, MercBody, TreebotBody, LoaderBody, CrocoBody, Captainbody\n - Use the DebugToolkit mod's body_list command to see a complete list (including enemies and moddeds)\n").Value; HitboxRevealer.cfg_BlastShowTime = ((BaseUnityPlugin)HitboxViewerMod.instance).Config.Bind<float>("2. Blastattack hitboxes (hitspheres?)", "BlastAttack visual time", 0.2f, "the amount of time blast hitboxes show up (their actual damage happens in one frame)\n").Value; HitboxRevealer.cfg_BulletAlpha = ((BaseUnityPlugin)HitboxViewerMod.instance).Config.Bind<float>("3. BulletAttack hitboxes (hitcylinders?)", "BulletAttack hitbox alpha", 0.14f, "0=1. lil brighter than the others, usually\nif a bullet has 0 radius, this gets increased a bit\n point of contact of the bullet is a little brighter\n").Value; HitboxRevealer.cfg_BulletShowTime = ((BaseUnityPlugin)HitboxViewerMod.instance).Config.Bind<float>("3. BulletAttack hitboxes (hitcylinders?)", "BulletAttack visual time", 0.4f, "the amount of time bullet rays show (their actual damage happens in one frame)\n").Value; cfg_bulletModeKey = ((BaseUnityPlugin)HitboxViewerMod.instance).Config.Bind<KeyCode>("3. BulletAttack hitboxes (hitcylinders?)", "Bullet point linger mode keybind", (KeyCode)47, "key to toggle bullet point mode\nin this mode, bullet hit points will linger indefinitely\ntoggle it off to clear them\n").Value; HitboxRevealer.cfg_ColorfulBullets = ((BaseUnityPlugin)HitboxViewerMod.instance).Config.Bind<bool>("3. BulletAttack hitboxes (hitcylinders?)", "Colorful bullets!", false, "if true, each individual bullet cylinder will be a random color.\nWhen false bullets fired on the same frame will be the same color\n").Value; HitboxRevealer.cfg_UniformBullets = ((BaseUnityPlugin)HitboxViewerMod.instance).Config.Bind<bool>("3. BulletAttack hitboxes (hitcylinders?)", "Not colorful bullets!", false, "Overrides colorful Bullets! config. all bullet attacks will be the same color so they don't look like Dippin Dots everywhere\n").Value; HitboxRevealer.cfg_HurtAlpha = ((BaseUnityPlugin)HitboxViewerMod.instance).Config.Bind<float>("4. Hurtboxes", "Hurtbox capsule/box alpha", 0.169f, "0-1. Around 0.16 is ok.\n").Value; cfg_unDynamicHurtboxes = ((BaseUnityPlugin)HitboxViewerMod.instance).Config.Bind<bool>("4. Hurtboxes", "optimized Hurtboxes", false, "tl;dr: Set to false for development, as it's more useful. Set to true for casual play, as it's more optimized.\n - When set to false, when characters spawn, hurtboxes and their objects will always be initialized for them, so they can be revealed and hidden at will.\n - When set to true, when characters spawn, hurtbox objects will only be initialized if hurtboxes are enabled.\n - Avoids creating unnecessary hurtboxes, but can't reveal hurtboxes on previously spawned enemies, if that makes sense.\n").Value; cfg_toggleKey = ((BaseUnityPlugin)HitboxViewerMod.instance).Config.Bind<KeyCode>("5. be safe", "Hitbox toggle Keybind", (KeyCode)59, "press this key to toggle disabling hitbox viewer on and off in game. Use to override current settings\n").Value; cfg_useDebug = ((BaseUnityPlugin)HitboxViewerMod.instance).Config.Bind<bool>("5. be safe", "debug", false, "welcom 2m y twisted mind\ntimescale hotkeys on I, K, O, and L. press quote key to disable\n").Value; cfg_showLogsVerbose = ((BaseUnityPlugin)HitboxViewerMod.instance).Config.Bind<bool>("5. be safe", "extra logs", false, "like a lot of extra logs\n").Value; } public static void setSoftenedCharacters() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected I4, but got Unknown if (!HitboxRevealer.cfg_MercSoften) { return; } cfg_softenedCharactersString = defaultSoftenedCharacters + cfg_softenedCharactersString; cfg_softenedCharactersString = cfg_softenedCharactersString.Replace(" ", ""); string[] array = cfg_softenedCharactersString.Split(','); string text = ""; foreach (string text2 in array) { int num = (int)BodyCatalog.FindBodyIndex(text2); if (num != -1 && !cfg_softenedCharacters.Contains(num)) { cfg_softenedCharacters.Add(num); text += $"\nbodyIndex: {num}: {text2}"; } } if (!string.IsNullOrEmpty(text)) { HitboxViewerMod.log.LogMessage((object)("Toning down hitboxes for" + text)); } else { HitboxViewerMod.log.LogWarning((object)"No characters found to tone down hitboxes, make sure you've typed their names right in the config"); } } public static Vector3 retardTransformTest(Transform transform, Vector3 normal, Vector3 transformwhatever) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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) if (Input.GetKey((KeyCode)263)) { transformwhatever = transform.TransformDirection(normal); } if (Input.GetKey((KeyCode)264)) { transformwhatever = transform.InverseTransformDirection(normal); } if (Input.GetKey((KeyCode)260)) { transformwhatever = transform.TransformVector(normal); } if (Input.GetKey((KeyCode)261)) { transformwhatever = transform.InverseTransformVector(normal); } if (Input.GetKey((KeyCode)257)) { transformwhatever = transform.TransformPoint(normal); } if (Input.GetKey((KeyCode)258)) { transformwhatever = transform.InverseTransformVector(normal); } return transformwhatever; } } public static class VRCompat { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.DrBibop.VRAPI"); } return _enabled.Value; } } public static bool IsLocalVRPlayer(CharacterBody body) { return enabled && (Object)(object)body == (Object)(object)LocalUserManager.GetFirstLocalUser().cachedBody; } }