using 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 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 = "")]
[assembly: AssemblyCompany("HexiBetterShotgun")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Makes the shotgun fire pellets that individually deal damage")]
[assembly: AssemblyFileVersion("0.3.3.0")]
[assembly: AssemblyInformationalVersion("0.3.3")]
[assembly: AssemblyProduct("HexiBetterShotgun")]
[assembly: AssemblyTitle("HexiBetterShotgun")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.3.3.0")]
[module: UnverifiableCode]
public class ShotgunConfig
{
private static int numTightPelletsLocal = 3;
private static float tightPelletAngleLocal = 2.5f;
private static int numLoosePelletsLocal = 7;
private static float loosePelletAngleLocal = 10f;
public static int numTightPellets = 3;
public static float tightPelletAngle = 2.5f;
public static int numLoosePellets = 7;
public static float loosePelletAngle = 10f;
private static void SetValues(int tightCount, float tightSpread, int looseCount, float looseSpread)
{
numTightPellets = tightCount;
tightPelletAngle = tightSpread;
numLoosePellets = looseCount;
loosePelletAngle = looseSpread;
}
private static void SetToLocalValues()
{
SetValues(numTightPelletsLocal, tightPelletAngleLocal, numLoosePelletsLocal, loosePelletAngleLocal);
}
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);
SetToLocalValues();
}
public static byte[] GetSettings()
{
byte[] array = new byte[17]
{
1, 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);
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);
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[17];
try
{
((FastBufferReader)(ref reader)).ReadBytes(ref settings, 17, 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_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
if (IsHost())
{
Debug.Log((object)"SHOTGUN: Started hosting, using local settings");
SetToLocalValues();
NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("HexiShotgun_OnRequestConfigSync", new HandleNamedMessageDelegate(OnRequestSync));
}
else
{
Debug.Log((object)"SHOTGUN: Connected to server, requesting settings");
NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("HexiShotgun_OnReceiveConfigSync", new HandleNamedMessageDelegate(OnReceiveSync));
FastBufferWriter val = default(FastBufferWriter);
((FastBufferWriter)(ref val))..ctor(0, (Allocator)2, 0);
NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("HexiShotgun_OnRequestConfigSync", 0uL, val, (NetworkDelivery)2);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")]
private static void ServerDisconnect()
{
Debug.Log((object)"SHOTGUN: Server disconnect");
SetToLocalValues();
}
}
namespace BetterShotgun;
[BepInPlugin("HexiBetterShotgun", "HexiBetterShotgun", "0.3.3")]
[BepInProcess("Lethal Company.exe")]
public class Plugin : BaseUnityPlugin
{
private Harmony h;
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin HexiBetterShotgun is loaded!");
ShotgunConfig.LoadConfig(((BaseUnityPlugin)this).Config);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Config loaded");
h = Harmony.CreateAndPatchAll(typeof(ShotgunPatch), (string)null);
h.PatchAll(typeof(ShotgunConfig));
}
private void OnDestroy()
{
h.UnpatchSelf();
}
}
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_004b: 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_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: 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_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: 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_031c: Unknown result type (might be due to invalid IL or missing references)
//IL_0321: Unknown result type (might be due to invalid IL or missing references)
//IL_0325: 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_032d: Unknown result type (might be due to invalid IL or missing references)
//IL_0736: Unknown result type (might be due to invalid IL or missing references)
//IL_0738: Unknown result type (might be due to invalid IL or missing references)
//IL_0742: Unknown result type (might be due to invalid IL or missing references)
//IL_0781: Unknown result type (might be due to invalid IL or missing references)
//IL_0372: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_037a: Unknown result type (might be due to invalid IL or missing references)
//IL_037f: Unknown result type (might be due to invalid IL or missing references)
//IL_0384: Unknown result type (might be due to invalid IL or missing references)
//IL_06c8: Unknown result type (might be due to invalid IL or missing references)
//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
//IL_0642: Unknown result type (might be due to invalid IL or missing references)
//IL_0647: Unknown result type (might be due to invalid IL or missing references)
//IL_068a: Unknown result type (might be due to invalid IL or missing references)
//IL_068b: Unknown result type (might be due to invalid IL or missing references)
//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
//IL_060d: Unknown result type (might be due to invalid IL or missing references)
//IL_060e: Unknown result type (might be due to invalid IL or missing references)
//IL_0539: Unknown result type (might be due to invalid IL or missing references)
//IL_053a: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB playerHeldBy = ((GrabbableObject)gun).playerHeldBy;
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(gun.gunShootAudio, gun.gunShootSFX, true, 1f, 1840);
WalkieTalkie.TransmitOneShotAudio(gun.gunShootAudio, gun.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 = Physics.RaycastAll(val4, 30f, flag ? PLAYER_HIT_MASK : ENEMY_HIT_MASK, (QueryTriggerInteraction)2);
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 || 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);
});
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);
});
((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();
}
}
}
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));
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "HexiBetterShotgun";
public const string PLUGIN_NAME = "HexiBetterShotgun";
public const string PLUGIN_VERSION = "0.3.3";
}