Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of HexiBetterShotgunFixed v1.0.1
HexiBetterShotgun.dll
Decompiled a year agousing System; using System.Collections; 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 BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; 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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("HexiBetterShotgun")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Makes the shotgun fire pellets that individually deal damage")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("HexiBetterShotgun")] [assembly: AssemblyTitle("HexiBetterShotgun")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.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; } } } public class ShotgunConfig { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequestSync; public static HandleNamedMessageDelegate <1>__OnReceiveSync; } private static int numTightPelletsLocal = 3; private static float tightPelletAngleLocal = 2.5f; private static int numLoosePelletsLocal = 7; private static float loosePelletAngleLocal = 10f; private static bool enemiesFriendlyFireLocal = true; public static int numTightPellets = 3; public static float tightPelletAngle = 2.5f; public static int numLoosePellets = 7; public static float loosePelletAngle = 10f; public static bool enemiesFriendlyFire = true; private static void SetValues(int tightCount, float tightSpread, int looseCount, float looseSpread, bool enemiesFriendlyFireState) { numTightPellets = tightCount; tightPelletAngle = tightSpread; numLoosePellets = looseCount; loosePelletAngle = looseSpread; enemiesFriendlyFire = enemiesFriendlyFireState; } private static void SetToLocalValues() { SetValues(numTightPelletsLocal, tightPelletAngleLocal, numLoosePelletsLocal, loosePelletAngleLocal, enemiesFriendlyFireLocal); } public static void LoadConfig(ConfigFile config) { Debug.Log((object)config); numTightPelletsLocal = Math.Clamp(config.Bind<int>("Pellets", "tightPelletCount", 3, "Number of pellets for tight grouping").Value, 0, 100); tightPelletAngleLocal = Mathf.Clamp(config.Bind<float>("Pellets", "tightPelletAngle", 2.5f, "Pellet spread for tight grouping (degrees)").Value, 0f, 90f); numLoosePelletsLocal = Math.Clamp(config.Bind<int>("Pellets", "loosePelletCount", 7, "Number of pellets for loose grouping").Value, 0, 100); loosePelletAngleLocal = Mathf.Clamp(config.Bind<float>("Pellets", "loosePelletAngle", 10f, "Pellet spread for loose grouping (degrees)").Value, 0f, 90f); enemiesFriendlyFireLocal = config.Bind<bool>("Enemies", "enemiesFriendlyFire", true, "Nutcracker can kill other enemies").Value; SetToLocalValues(); } public static byte[] GetSettings() { byte[] array = new byte[18] { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; Array.Copy(BitConverter.GetBytes(numTightPelletsLocal), 0, array, 1, 4); Array.Copy(BitConverter.GetBytes(tightPelletAngleLocal), 0, array, 5, 4); Array.Copy(BitConverter.GetBytes(numLoosePelletsLocal), 0, array, 9, 4); Array.Copy(BitConverter.GetBytes(loosePelletAngleLocal), 0, array, 13, 4); Array.Copy(BitConverter.GetBytes(enemiesFriendlyFireLocal), 0, array, 17, 1); return array; } public static void SetSettings(byte[] data) { byte b = data[0]; byte b2 = b; if (b2 == 1) { numTightPellets = BitConverter.ToInt32(data, 1); tightPelletAngle = BitConverter.ToSingle(data, 5); numLoosePellets = BitConverter.ToInt32(data, 9); loosePelletAngle = BitConverter.ToSingle(data, 13); enemiesFriendlyFire = BitConverter.ToBoolean(data, 17); return; } throw new Exception("Invalid version byte"); } private static bool IsHost() { return NetworkManager.Singleton.IsHost; } public static void OnRequestSync(ulong clientID, FastBufferReader reader) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (!IsHost()) { return; } Debug.Log((object)("SHOTGUN: Sending config to client " + clientID)); byte[] settings = GetSettings(); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(settings.Length, (Allocator)2, settings.Length); try { ((FastBufferWriter)(ref val)).WriteBytes(settings, -1, 0); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("HexiShotgun_OnReceiveConfigSync", clientID, val, (NetworkDelivery)2); } catch (Exception ex) { Debug.LogError((object)("SHOTGUN: Failed to send config: " + ex)); } finally { ((FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong clientID, FastBufferReader reader) { Debug.Log((object)"SHOTGUN: Received config from host"); byte[] settings = new byte[18]; try { ((FastBufferReader)(ref reader)).ReadBytes(ref settings, 18, 0); SetSettings(settings); } catch (Exception ex) { Debug.LogError((object)("SHOTGUN: Failed to receive config: " + ex)); SetToLocalValues(); } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] private static void ServerConnect() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown if (IsHost()) { Debug.Log((object)"SHOTGUN: Started hosting, using local settings"); SetToLocalValues(); CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; object obj = <>O.<0>__OnRequestSync; if (obj == null) { HandleNamedMessageDelegate val = OnRequestSync; <>O.<0>__OnRequestSync = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("HexiShotgun_OnRequestConfigSync", (HandleNamedMessageDelegate)obj); return; } Debug.Log((object)"SHOTGUN: Connected to server, requesting settings"); CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager; object obj2 = <>O.<1>__OnReceiveSync; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnReceiveSync; <>O.<1>__OnReceiveSync = val2; obj2 = (object)val2; } customMessagingManager2.RegisterNamedMessageHandler("HexiShotgun_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2); FastBufferWriter val3 = default(FastBufferWriter); ((FastBufferWriter)(ref val3))..ctor(0, (Allocator)2, 0); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("HexiShotgun_OnRequestConfigSync", 0uL, val3, (NetworkDelivery)2); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] private static void ServerDisconnect() { Debug.Log((object)"SHOTGUN: Server disconnect"); SetToLocalValues(); } } namespace BetterShotgun { [BepInPlugin("HexiBetterShotgun", "HexiBetterShotgun", "1.0.1")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("HexiBetterShotgun"); private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin HexiBetterShotgun is loaded!"); ShotgunConfig.LoadConfig(((BaseUnityPlugin)this).Config); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Config loaded"); harmony.PatchAll(typeof(ShotgunPatch)); harmony.PatchAll(typeof(ShotgunConfig)); } } internal class ShotgunPatch { [HarmonyPatch(typeof(ShotgunItem), "ShootGun")] [HarmonyPrefix] private static bool ReplaceShotgunCode(ShotgunItem __instance, Vector3 shotgunPosition, Vector3 shotgunForward) { //IL_0002: 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) NewShotgunHandler.ShootGun(__instance, shotgunPosition, shotgunForward); return false; } [HarmonyPatch(typeof(StartOfRound), "ChooseNewRandomMapSeed")] [HarmonyPostfix] private static void UpdateShotgunSeed(StartOfRound __instance) { NewShotgunHandler.ShotgunRandom = new Random(__instance.randomMapSeed); Debug.Log((object)("Shotgun seed: " + __instance.randomMapSeed)); } } internal class FadeOutLine : MonoBehaviour { private const float lifetime = 0.4f; private const float width = 0.02f; private static readonly Color col = new Color(1f, 0f, 0f); private float alive = 0f; private LineRenderer line; public Vector3 start; public Vector3 end; private static readonly Material mat = new Material(Shader.Find("Legacy Shaders/Particles/Alpha Blended Premultiply")); public void Prep() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_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) float num = Vector3.Distance(start, end); float num2 = (30f - num) / 30f; line = ((Component)this).gameObject.AddComponent<LineRenderer>(); line.startColor = col; line.endColor = col * num2 + Color.black * (1f - num2); line.startWidth = 0.02f; line.endWidth = num2 * 0.02f; line.SetPositions((Vector3[])(object)new Vector3[2] { start, end }); ((Renderer)line).material = mat; } private void Update() { //IL_006f: 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_0096: 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_00c2: Unknown result type (might be due to invalid IL or missing references) alive += Time.deltaTime; if (alive >= 0.4f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } line.startColor = new Color(col.r, col.g, col.b, (0.4f - alive) / 0.4f); line.endColor = new Color(line.endColor.r, line.endColor.g, line.endColor.b, (0.4f - alive) / 0.4f); } } public class Counter<T> { public T item; public int count; } public class CountHandler { public List<Counter<PlayerControllerB>> player = new List<Counter<PlayerControllerB>>(); public List<Counter<EnemyAI>> enemy = new List<Counter<EnemyAI>>(); public List<Counter<IHittable>> other = new List<Counter<IHittable>>(); public void AddPlayerToCount(PlayerControllerB p) { if (player.Any((Counter<PlayerControllerB> i) => (Object)(object)i.item == (Object)(object)p)) { player.First((Counter<PlayerControllerB> i) => (Object)(object)i.item == (Object)(object)p).count++; } else { player.Add(new Counter<PlayerControllerB> { item = p, count = 1 }); } } public void AddEnemyToCount(EnemyAI ai) { if (enemy.Any((Counter<EnemyAI> i) => (Object)(object)i.item == (Object)(object)ai)) { enemy.First((Counter<EnemyAI> i) => (Object)(object)i.item == (Object)(object)ai).count++; } else { enemy.Add(new Counter<EnemyAI> { item = ai, count = 1 }); } } public void AddOtherToCount(IHittable hit) { if (other.Any((Counter<IHittable> i) => i.item == hit)) { other.First((Counter<IHittable> i) => i.item == hit).count++; } else { other.Add(new Counter<IHittable> { item = hit, count = 1 }); } } } internal class NewShotgunHandler { public const float range = 30f; private static readonly int PLAYER_HIT_MASK = StartOfRound.Instance.collidersRoomMaskDefaultAndPlayers | 0x80000; private static readonly int ENEMY_HIT_MASK = StartOfRound.Instance.collidersRoomMaskDefaultAndPlayers; public static Random ShotgunRandom = new Random(0); private static IEnumerator DelayedEarsRinging(float effectSeverity) { yield return (object)new WaitForSeconds(0.6f); SoundManager.Instance.earsRingingTimer = effectSeverity; } private static void VisualiseShot(Vector3 start, Vector3 end) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Trail Visual"); FadeOutLine fadeOutLine = val.AddComponent<FadeOutLine>(); fadeOutLine.start = start; fadeOutLine.end = end; fadeOutLine.Prep(); } public static void ShootGun(ShotgunItem gun, Vector3 shotgunPosition, Vector3 shotgunForward) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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_0249: Unknown result type (might be due to invalid IL or missing references) //IL_025e: 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_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: 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_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0217: 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_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: 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_032b: Unknown result type (might be due to invalid IL or missing references) //IL_032f: 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) //IL_077c: Unknown result type (might be due to invalid IL or missing references) //IL_077e: Unknown result type (might be due to invalid IL or missing references) //IL_0788: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_07c7: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_070f: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Unknown result type (might be due to invalid IL or missing references) //IL_06d1: 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_0537: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) bool flag = ((GrabbableObject)gun).isHeld && (Object)(object)((GrabbableObject)gun).playerHeldBy != (Object)null; if (flag) { shotgunPosition += ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.up * 0.25f; } bool flag2 = flag && (Object)(object)((GrabbableObject)gun).playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController; if (flag2) { ((GrabbableObject)gun).playerHeldBy.playerBodyAnimator.SetTrigger("ShootShotgun"); } RoundManager.PlayRandomClip(((Component)gun).GetComponent<ShotgunItem>().gunShootAudio, ((Component)gun).GetComponent<ShotgunItem>().gunShootSFX, true, 1f, 1840, 1000); WalkieTalkie.TransmitOneShotAudio(((Component)gun).GetComponent<ShotgunItem>().gunShootAudio, ((Component)gun).GetComponent<ShotgunItem>().gunShootSFX[0], 1f); gun.gunShootParticle.Play(true); gun.isReloading = false; gun.shellsLoaded = Mathf.Clamp(gun.shellsLoaded - 1, 0, 2); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null) { return; } Vector3[] array = (Vector3[])(object)new Vector3[ShotgunConfig.numTightPellets + ShotgunConfig.numLoosePellets]; State state = Random.state; Random.InitState(ShotgunRandom.Next()); for (int i = 0; i < ShotgunConfig.numTightPellets + ShotgunConfig.numLoosePellets; i++) { float num = ((i < ShotgunConfig.numTightPellets) ? ShotgunConfig.tightPelletAngle : ShotgunConfig.loosePelletAngle); Vector3 val = Random.onUnitSphere; float num2 = num * Mathf.Sqrt(Random.value); if (Vector3.Angle(shotgunForward, val) < num2) { val *= -1f; } Vector3 val2 = Vector3.RotateTowards(shotgunForward, val, num2 * MathF.PI / 180f, 0f); array[i] = val2; } Random.state = state; float num3 = Vector3.Distance(((Component)localPlayerController).transform.position, ((Component)gun.shotgunRayPoint).transform.position); float num4 = 0f; if (num3 < 5f) { num4 = 0.8f; HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num3 < 15f) { num4 = 0.5f; HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num3 < 23f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } if (num4 > 0f && SoundManager.Instance.timeSinceEarsStartedRinging > 16f && !flag) { ((MonoBehaviour)gun).StartCoroutine(DelayedEarsRinging(num4)); } CountHandler countHandler = new CountHandler(); Ray val4 = default(Ray); IHittable val6 = default(IHittable); EnemyAI val9 = default(EnemyAI); foreach (Vector3 val3 in array) { ((Ray)(ref val4))..ctor(shotgunPosition, val3); RaycastHit[] array2 = ((!ShotgunConfig.enemiesFriendlyFire) ? Physics.RaycastAll(val4, 30f, flag ? PLAYER_HIT_MASK : ENEMY_HIT_MASK, (QueryTriggerInteraction)2) : Physics.RaycastAll(val4, 30f, PLAYER_HIT_MASK, (QueryTriggerInteraction)2)); gun.enemyColliders = array2; Array.Sort(array2, (RaycastHit x, RaycastHit y) => ((RaycastHit)(ref x)).distance.CompareTo(((RaycastHit)(ref y)).distance)); Vector3 val5 = shotgunPosition + val3 * 30f; Debug.Log((object)("SHOTGUN: RaycastAll hit " + array2.Length + " things (" + flag + "," + flag2 + ")")); for (int k = 0; k < array2.Length; k++) { GameObject gameObject = ((Component)((RaycastHit)(ref array2[k])).transform).gameObject; if (gameObject.TryGetComponent<IHittable>(ref val6)) { if (val6 == ((GrabbableObject)gun).playerHeldBy) { continue; } EnemyAI val7 = null; EnemyAICollisionDetect val8 = (EnemyAICollisionDetect)(object)((val6 is EnemyAICollisionDetect) ? val6 : null); if (val8 != null) { val7 = val8.mainScript; } if ((Object)(object)val7 != (Object)null && ((!flag && !ShotgunConfig.enemiesFriendlyFire) || val7.isEnemyDead || val7.enemyHP <= 0 || !val7.enemyType.canDie)) { continue; } if (val6 is PlayerControllerB) { countHandler.AddPlayerToCount((PlayerControllerB)(object)((val6 is PlayerControllerB) ? val6 : null)); } else if ((Object)(object)val7 != (Object)null) { countHandler.AddEnemyToCount(val7); } else { if (!flag) { continue; } countHandler.AddOtherToCount(val6); } val5 = ((RaycastHit)(ref array2[k])).point; Debug.Log((object)("SHOTGUN: Hit [" + ((object)val6)?.ToString() + "] (" + (k + 1) + "@" + Vector3.Distance(shotgunPosition, val5) + ")")); break; } if (((Component)((RaycastHit)(ref array2[k])).collider).TryGetComponent<EnemyAI>(ref val9)) { if (!flag || val9.isEnemyDead || val9.enemyHP <= 0 || !val9.enemyType.canDie) { continue; } countHandler.AddEnemyToCount(val9); val5 = ((RaycastHit)(ref array2[k])).point; Debug.Log((object)("SHOTGUN: Backup hit [" + ((object)val9)?.ToString() + "] (" + (k + 1) + "@" + Vector3.Distance(shotgunPosition, val5) + ")")); break; } val5 = ((RaycastHit)(ref array2[k])).point; Debug.Log((object)("SHOTGUN: Wall [" + ((object)gameObject)?.ToString() + "] (" + (k + 1) + "@" + Vector3.Distance(shotgunPosition, val5) + ")")); break; } VisualiseShot(shotgunPosition, val5); } countHandler.player.ForEach(delegate(Counter<PlayerControllerB> p) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) int num7 = p.count * 20; Debug.Log((object)("SHOTGUN: Hit " + ((object)p.item)?.ToString() + " with " + p.count + " pellets for " + num7 + " damage")); p.item.DamagePlayer(num7, true, true, (CauseOfDeath)7, 0, false, shotgunForward); }); countHandler.enemy.ForEach(delegate(Counter<EnemyAI> e) { int num6 = e.count / 2 + 1; Debug.Log((object)("SHOTGUN: Hit " + ((object)e.item)?.ToString() + " with " + e.count + " pellets for " + num6 + " damage")); e.item.HitEnemy(num6, ((GrabbableObject)gun).playerHeldBy, true, -1); }); countHandler.other.ForEach(delegate(Counter<IHittable> o) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) int num5 = o.count / 2 + 1; Debug.Log((object)("SHOTGUN: Hit " + ((object)o.item)?.ToString() + " with " + o.count + " pellets for " + num5 + " damage")); o.item.Hit(num5, shotgunForward, ((GrabbableObject)gun).playerHeldBy, true, -1); }); ((Ray)(ref val4))..ctor(shotgunPosition, shotgunForward); RaycastHit val10 = default(RaycastHit); if (Physics.Raycast(val4, ref val10, 30f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { ((Component)gun.gunBulletsRicochetAudio).transform.position = ((Ray)(ref val4)).GetPoint(((RaycastHit)(ref val10)).distance - 0.5f); gun.gunBulletsRicochetAudio.Play(); } } } public static class PluginInfo { public const string PLUGIN_GUID = "HexiBetterShotgun"; public const string PLUGIN_NAME = "HexiBetterShotgun"; public const string PLUGIN_VERSION = "1.0.1"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }