Please disclose if any significant portion of your mod was created 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 CookandEatPeopleMod v1.0.3
plugins/fayemoddinggroup.CEPM/LC.CEPM.dll
Decompiled 5 months 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 GameNetcodeStuff; using HarmonyLib; using LC.CEPM.CEPMCore; using LC.CEPM.CEPMCore.ItemBehaviours; using LC.CEPM.CEPMCore.UnityAssetManager; using LC.CEPM.CEPMLoggingUtils; using LC.CEPM.GamePatches; using LC.CEPM.NetcodePatcher; using LethalLib.Modules; using Microsoft.CodeAnalysis; 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("LC.CEPM")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+7e441b72a0f86e65928938630c51c50bbbd59be8")] [assembly: AssemblyProduct("LC.CEPM")] [assembly: AssemblyTitle("LC.CEPM")] [assembly: AssemblyVersion("1.0.0.0")] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace LC.CEPM.GamePatches { public class BurnPlayer : MonoBehaviour { [CompilerGenerated] private sealed class <Torch>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerControllerB instance; public int damagePerTick; public float time; public float tickTime; private float <startTime>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Torch>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; instance.DamagePlayer(damagePerTick, true, true, (CauseOfDeath)13, 6, false, default(Vector3)); } else { <>1__state = -1; if (torching) { goto IL_010c; } fire.SetActive(true); torching = true; <startTime>5__1 = Time.realtimeSinceStartup; } if (Time.realtimeSinceStartup - <startTime>5__1 < time) { <>2__current = (object)new WaitForSeconds(tickTime); <>1__state = 1; return true; } if ((Object)(object)instance == (Object)(object)GameNetworkManager.Instance.localPlayerController && !instance.isPlayerDead) { instance.KillPlayer(Vector3.zero, true, (CauseOfDeath)13, 6, default(Vector3)); } fire.SetActive(false); torching = false; goto IL_010c; IL_010c: return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static Logger PlayerLogger = new Logger(); private static bool torching; private static GameObject fire; private static GameObject justSpawnedBody; private static bool InstanceIsLocal(PlayerControllerB instance) { if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return false; } return instance.playerClientId == GameNetworkManager.Instance.localPlayerController.playerClientId; } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] [HarmonyPostfix] private static void start_postfix(PlayerControllerB __instance) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) if (!PlayerLogger.HasInit() && InstanceIsLocal(__instance)) { PlayerLogger.Init("PLAYER"); PlayerLogger.Log("Hooked PlayerControllerB Update method successfully."); fire = Object.Instantiate<GameObject>(CEPMAssets.particleAsset); fire.transform.parent = ((Component)__instance).transform; fire.transform.localPosition = Vector3.zero; fire.SetActive(false); } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void upd_postfix(PlayerControllerB __instance) { } [IteratorStateMachine(typeof(<Torch>d__7))] private static IEnumerator Torch(PlayerControllerB instance, int damagePerTick, float time = 6f, float tickTime = 0.25f) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Torch>d__7(0) { instance = instance, damagePerTick = damagePerTick, time = time, tickTime = tickTime }; } } } namespace LC.CEPM.CEPMLoggingUtils { public class Logger { public Color defaultLoggingColour = Color.white; public Color defaultWarningColour = Color.yellow; public Color defaultErrorColour = Color.red; private bool init = false; private List<string> output = new List<string>(); public string loggerUID; public bool HasInit() { return init; } public List<string> LoggerOutput() { return output; } private void _init(string uid, Color defaultColour, Color errorColour, Color warningColour) { //IL_0016: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (!init) { init = true; defaultLoggingColour = defaultColour; defaultWarningColour = warningColour; defaultErrorColour = errorColour; loggerUID = uid; Log("Logger Initialised"); } } public void Init(string uid) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) _init(uid, defaultLoggingColour, defaultErrorColour, defaultWarningColour); } public Logger() { }//IL_0001: 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_000c: 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_001c: Unknown result type (might be due to invalid IL or missing references) public Logger(string uid) { //IL_0001: 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_000c: 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_001c: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) _init(uid, Color.white, Color.red, Color.yellow); } public Logger(string uid, Color defaultColour) { //IL_0001: 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_000c: 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_001c: 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_003e: 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) _init(uid, defaultColour, Color.red, Color.yellow); } public Logger(string uid, Color defaultColour, Color errorColour) { //IL_0001: 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_000c: 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_001c: 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_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) _init(uid, defaultColour, errorColour, Color.yellow); } public Logger(string uid, Color defaultColour, Color errorColour, Color warningColour) { //IL_0001: 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_000c: 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_001c: 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_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) _init(uid, defaultColour, errorColour, warningColour); } public Logger(string uid, Color[] colours) { //IL_0001: 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_000c: 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_001c: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) _init(uid, colours[0], colours[1], colours[2]); } public string Log(object obj, Color c) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (!init) { return null; } try { string text = LoggingUtils.Colour(obj, c); text = "[" + loggerUID + "] " + obj; output.Add(text); Debug.Log((object)text); return text; } catch (Exception ex) { Debug.LogError((object)ex); return "STRINGERROR"; } } public string Log(object obj) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) _ = init; return Log(obj, defaultLoggingColour); } public string Error(object obj) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) _ = init; return Log("[ERROR] " + obj, defaultErrorColour); } public string Warning(object obj) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) _ = init; return Log("[WARNING] " + obj, defaultWarningColour); } } public static class LoggingUtils { private static byte Byte(float v) { return (byte)(v * Mathf.Clamp01(v)); } private static string ToHexString(Color c) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) return $"#{Byte(c.r):X2}{Byte(c.g):X2}{Byte(c.b):X2}"; } public static string Colour(object str, Color c) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return $"$<color={ToHexString(c)}>{str}</color>"; } } } namespace LC.CEPM.CEPMCore { public class CEPMAssets { public static GameObject particleAsset; public static Item flamethrowerAsset; } [BepInPlugin("CookAndEatPeopleMod.fayemoddinggroup", "CookAndEatPeopleMod", "1.0.0")] public class CEPMBase : BaseUnityPlugin { public readonly Harmony harmony = new Harmony("CookAndEatPeopleMod"); public static Logger BaseLogger = new Logger("CEPM"); public static Logger PropLogger = new Logger("PROPS"); public static CEPMBase instance { get; private set; } private void Awake() { NetcodePatcher(); AssetBundleLoader.LoadBundles(); CEPMAssets.particleAsset = AssetBundleLoader.LoadAsset<GameObject>("Assets/CEPM/PlayerFire.prefab"); CEPMAssets.flamethrowerAsset = AssetBundleLoader.LoadAsset<Item>("Assets/CEPM/FlamethrowerItem.asset"); RegisterFlamethrowerItem(); harmony.PatchAll(typeof(BurnPlayer)); } private void RegisterFlamethrowerItem() { GameObject spawnPrefab = CEPMAssets.flamethrowerAsset.spawnPrefab; Flamethrower flamethrower = spawnPrefab.AddComponent<Flamethrower>(); ((GrabbableObject)flamethrower).grabbable = true; ((GrabbableObject)flamethrower).itemProperties = CEPMAssets.flamethrowerAsset; NetworkPrefabs.RegisterNetworkPrefab(spawnPrefab); Utilities.FixMixerGroups(spawnPrefab); Items.RegisterShopItem(CEPMAssets.flamethrowerAsset, 500); } private void NetcodePatcher() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } public class CEPMInfo { public const string name = "CookAndEatPeopleMod"; public const string authname = "fayemoddinggroup"; public const string longGuid = "CookAndEatPeopleMod.fayemoddinggroup"; public const string guid = "CEPM"; public const string version = "1.0.0"; public const string StartupString = "CookAndEatPeopleMod Initialising..."; public static string AssemblyLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); } } namespace LC.CEPM.CEPMCore.UnityAssetManager { public static class AssetBundleLoader { private static Logger ABLogger = new Logger("ABLOADER"); public static Dictionary<string, AssetBundle> loadedBundles = new Dictionary<string, AssetBundle>(); public static T LoadAsset<T>(string path) where T : Object { foreach (KeyValuePair<string, AssetBundle> loadedBundle in loadedBundles) { AssetBundle value = loadedBundle.Value; T val = value.LoadAsset<T>(path); if ((Object)(object)val != (Object)null) { ABLogger.Log("Found " + typeof(T)?.ToString() + " '" + ((Object)val).name + "' in bundle " + ((Object)value).name + " and successfully loaded it."); return val; } } ABLogger.Error(typeof(T)?.ToString() + " asset was not found in any bundle. Usage of this unloaded variable will cause errors."); return default(T); } public static void LoadBundles(string bundlePath = "assets/bundles") { string text = Path.Combine(CEPMInfo.AssemblyLocation, bundlePath); DirectoryInfo directoryInfo = new DirectoryInfo(text); FileInfo[] files = directoryInfo.GetFiles(); FileInfo[] array = files; foreach (FileInfo fileInfo in array) { AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(text, fileInfo.Name)); if (!Object.op_Implicit((Object)(object)val)) { ABLogger.Error("Tried loading file " + fileInfo.Name + " as AssetBundle but failed unexpectedly! Skipping..."); continue; } ABLogger.Log("Loaded file " + fileInfo.Name + " as AssetBundle successfully!"); ((Object)val).name = fileInfo.Name; loadedBundles.Add(((Object)val).name, val); } } } } namespace LC.CEPM.CEPMCore.ItemBehaviours { internal class Flamethrower : PhysicsProp { [CompilerGenerated] private sealed class <>c__DisplayClass26_0 { public Flamethrower <>4__this; public bool outOfChargeAtStart; internal bool <startFiringAnim>b__0() { return !<>4__this.inUse || (<>4__this.OutOfCharge() && <>4__this.inUse && !outOfChargeAtStart) || (Object)(object)((GrabbableObject)<>4__this).playerHeldBy == (Object)null; } internal bool <startFiringAnim>b__1() { return !<>4__this.inUse; } } [CompilerGenerated] private sealed class <DamageEntitiesOverTime>d__16 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Flamethrower <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DamageEntitiesOverTime>d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; <>4__this.DamageEntitiesInPathServerRPC(<>4__this.firePlaying); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; case 2: <>1__state = -1; break; } <>2__current = (object)new WaitForSeconds(<>4__this.TimeBetweenDamageTicks); <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <VolumeIncrease>d__25 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public AudioSource audioSource; public float time; public float start; public float end; public Flamethrower <>4__this; private float <elapsedTime>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <VolumeIncrease>d__25(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <elapsedTime>5__1 = 0f; audioSource.volume = start; break; case 1: <>1__state = -1; break; } if (<elapsedTime>5__1 < time) { <elapsedTime>5__1 += Time.deltaTime; audioSource.volume = Mathf.Lerp(start, end, <elapsedTime>5__1 / time); <>2__current = null; <>1__state = 1; return true; } audioSource.volume = end; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <startFiringAnim>d__26 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int random; public Flamethrower <>4__this; private <>c__DisplayClass26_0 <>8__1; private float <time>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <startFiringAnim>d__26(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass26_0(); <>8__1.<>4__this = <>4__this; <>8__1.outOfChargeAtStart = <>4__this.OutOfCharge(); <time>5__2 = random / 10; ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.VolumeIncrease(<>4__this.gasAudio)); <>4__this.gasAudio.Play(); ((GrabbableObject)<>4__this).playerHeldBy.activatingItem = true; <>4__this.preFireParticles.Play(); <>2__current = (object)new WaitForSeconds((float)random / 10f); <>1__state = 1; return true; case 1: <>1__state = -1; if (<>4__this.inUse && !<>4__this.OutOfCharge() && random > <>4__this.failChanceOutOf10 && !<>4__this.OutOfCharge()) { <>4__this.oneShotAudio.Play(); ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.VolumeIncrease(<>4__this.flameAudio)); <>4__this.gasAudio.volume = 0.2f; <>4__this.flameAudio.Play(); <>4__this.fireParticles.Play(); <>4__this.firePlaying = true; } <>2__current = (object)new WaitUntil((Func<bool>)(() => !<>8__1.<>4__this.inUse || (<>8__1.<>4__this.OutOfCharge() && <>8__1.<>4__this.inUse && !<>8__1.outOfChargeAtStart) || (Object)(object)((GrabbableObject)<>8__1.<>4__this).playerHeldBy == (Object)null)); <>1__state = 2; return true; case 2: <>1__state = -1; <>4__this.flameAudio.Stop(); <>4__this.fireParticles.Stop(); <>4__this.preFireParticles.Stop(); if (<>4__this.firePlaying) { <>4__this.postFireParticles.Play(); } <>4__this.firePlaying = false; if (((GrabbableObject)<>4__this).playerHeldBy.isPlayerDead) { <>4__this.inUse = false; } if (<>4__this.inUse) { <>4__this.gasAudio.volume = 1f; } <>2__current = (object)new WaitUntil((Func<bool>)(() => !<>8__1.<>4__this.inUse)); <>1__state = 3; return true; case 3: <>1__state = -1; <>4__this.gasAudio.Stop(); ((GrabbableObject)<>4__this).playerHeldBy.activatingItem = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private ParticleSystem preFireParticles; private ParticleSystem fireParticles; private ParticleSystem postFireParticles; private AudioSource gasAudio; private AudioSource flameAudio; private AudioSource oneShotAudio; private Coroutine firingCoroutine; private bool inUse; private RaycastHit[] enemyColliders; private int failChanceOutOf10 = 1; private float flamethrowerRange = 7f; public int DamagePerTick = 15; public float TimeBetweenDamageTicks = 0.3f; private bool damageSwitch = true; private bool firePlaying = false; public override void Update() { ((GrabbableObject)this).Update(); DischargeBattery(); if (OutOfCharge()) { gasAudio.pitch = 1.5f; } else { gasAudio.pitch = 1f; } } [IteratorStateMachine(typeof(<DamageEntitiesOverTime>d__16))] private IEnumerator DamageEntitiesOverTime() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DamageEntitiesOverTime>d__16(0) { <>4__this = this }; } [ServerRpc(RequireOwnership = false)] private void DamageEntitiesInPathServerRPC(bool isFiring) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2050656317u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isFiring, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2050656317u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; DamageEntitiesInPathClientRPC(isFiring); } } } [ClientRpc] private void DamageEntitiesInPathClientRPC(bool isFiring) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: 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_01b3: 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_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2667894221u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isFiring, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2667894221u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!((GrabbableObject)this).isHeld || !isFiring || (Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null || (Object)(object)localPlayerController == (Object)null) { return; } Vector3 position = ((Component)this).transform.position; float num = Vector3.Distance(position, ((Component)localPlayerController).transform.position); if (num < 5f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num < 25f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } Vector3 forward = ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward; Vector3 val3 = localPlayerController.playerCollider.ClosestPoint(position); enemyColliders = (RaycastHit[])(object)new RaycastHit[10]; Ray val4 = default(Ray); ((Ray)(ref val4))..ctor(position - forward * 10f, forward); int num2 = Physics.SphereCastNonAlloc(val4, flamethrowerRange, enemyColliders, 15f, 524288, (QueryTriggerInteraction)2); List<EnemyAI> list = new List<EnemyAI>(); RaycastHit val5 = default(RaycastHit); IHittable val6 = default(IHittable); for (int i = 0; i < num2; i++) { if (!Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref enemyColliders[i])).transform).GetComponent<EnemyAICollisionDetect>())) { continue; } EnemyAI mainScript = ((Component)((RaycastHit)(ref enemyColliders[i])).transform).GetComponent<EnemyAICollisionDetect>().mainScript; if (Physics.Linecast(position, ((RaycastHit)(ref enemyColliders[i])).point, ref val5, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) || !((Component)((RaycastHit)(ref enemyColliders[i])).transform).TryGetComponent<IHittable>(ref val6)) { continue; } damageSwitch = !damageSwitch; if (damageSwitch) { float num3 = Vector3.Distance(position, ((RaycastHit)(ref enemyColliders[i])).point); EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref enemyColliders[i])).collider).GetComponent<EnemyAICollisionDetect>(); if ((!((Object)(object)component != (Object)null) || (!((Object)(object)component.mainScript == (Object)null) && !list.Contains(component.mainScript))) && val6.Hit(1, forward, ((GrabbableObject)this).playerHeldBy, true, -1) && (Object)(object)component != (Object)null) { list.Add(component.mainScript); } } } RaycastHit val7 = default(RaycastHit); PlayerControllerB val8 = default(PlayerControllerB); if (Physics.Linecast(position, val3, ref val7, StartOfRound.Instance.collidersAndRoomMaskAndPlayers, (QueryTriggerInteraction)1) && Vector3.Angle(forward, val3 - position) < 20f && num <= flamethrowerRange && ((Component)((RaycastHit)(ref val7)).transform).TryGetComponent<PlayerControllerB>(ref val8) && (Object)(object)val8 == (Object)(object)localPlayerController && (Object)(object)val8 != (Object)(object)((GrabbableObject)this).playerHeldBy) { CEPMBase.PropLogger.Log("Hit player! Distance: '" + num + "', Range: '" + flamethrowerRange + "', Angle: '" + Vector3.Angle(forward, val3 - position) + "', Player: '" + ((Object)val8).name); localPlayerController.DamagePlayer(DamagePerTick, true, true, (CauseOfDeath)13, 6, false, default(Vector3)); } } private void DischargeBattery() { if (firePlaying && ((GrabbableObject)this).isHeld && ((GrabbableObject)this).insertedBattery.charge > 0f) { Battery insertedBattery = ((GrabbableObject)this).insertedBattery; insertedBattery.charge -= 0.1f * Time.deltaTime; } } public override void Start() { ((GrabbableObject)this).Start(); gasAudio = ((Component)((Component)this).gameObject.transform.Find("AudioSources/Gas")).GetComponent<AudioSource>(); flameAudio = ((Component)((Component)this).gameObject.transform.Find("AudioSources/Fire")).GetComponent<AudioSource>(); oneShotAudio = ((Component)((Component)this).gameObject.transform.Find("AudioSources/Oneshot")).GetComponent<AudioSource>(); preFireParticles = ((Component)((Component)this).gameObject.transform.Find("Flamethrower/Particles/PreFireParticle")).GetComponent<ParticleSystem>(); postFireParticles = ((Component)((Component)this).gameObject.transform.Find("Flamethrower/Particles/PostFireParticle")).GetComponent<ParticleSystem>(); fireParticles = ((Component)((Component)this).gameObject.transform.Find("Flamethrower/Particles/FireParticle")).GetComponent<ParticleSystem>(); ((MonoBehaviour)this).StartCoroutine(DamageEntitiesOverTime()); ((GrabbableObject)this).insertedBattery.charge = 1f; } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); CEPMBase.PropLogger.Log("(Client " + GameNetworkManager.Instance.localPlayerController.playerClientId + ") Trying to send ServerRpc instruction..."); StartFireServerRPC(used, buttonDown); } [ServerRpc(RequireOwnership = false)] private void StartFireServerRPC(bool used, bool buttonDown) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_0083: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1780036370u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref used, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref buttonDown, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1780036370u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; CEPMBase.PropLogger.Log("(Server) Recieved instruction to distribute to all clients"); Random random = new Random(); int num = random.Next(1, 10); StartFireClientRPC(used, buttonDown, num); } } } [ClientRpc] private void StartFireClientRPC(bool used, bool buttonDown, int num) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_0083: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2714157603u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref used, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref buttonDown, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, num); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2714157603u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; CEPMBase.PropLogger.Log("(Client " + GameNetworkManager.Instance.localPlayerController.playerClientId + ") Recieved instruction"); if ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) { return; } inUse = buttonDown; if (buttonDown) { if (firingCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(firingCoroutine); } if (((GrabbableObject)this).insertedBattery.charge == 0f) { inUse = false; } firingCoroutine = ((MonoBehaviour)this).StartCoroutine(startFiringAnim(num)); } } private bool OutOfCharge() { return ((GrabbableObject)this).insertedBattery.charge <= 0f; } [IteratorStateMachine(typeof(<VolumeIncrease>d__25))] private IEnumerator VolumeIncrease(AudioSource audioSource, float time = 0.3f, float start = 0f, float end = 1f) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <VolumeIncrease>d__25(0) { <>4__this = this, audioSource = audioSource, time = time, start = start, end = end }; } [IteratorStateMachine(typeof(<startFiringAnim>d__26))] private IEnumerator startFiringAnim(int random) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <startFiringAnim>d__26(0) { <>4__this = this, random = random }; } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2050656317u, new RpcReceiveHandler(__rpc_handler_2050656317), "DamageEntitiesInPathServerRPC"); ((NetworkBehaviour)this).__registerRpc(2667894221u, new RpcReceiveHandler(__rpc_handler_2667894221), "DamageEntitiesInPathClientRPC"); ((NetworkBehaviour)this).__registerRpc(1780036370u, new RpcReceiveHandler(__rpc_handler_1780036370), "StartFireServerRPC"); ((NetworkBehaviour)this).__registerRpc(2714157603u, new RpcReceiveHandler(__rpc_handler_2714157603), "StartFireClientRPC"); ((PhysicsProp)this).__initializeRpcs(); } private static void __rpc_handler_2050656317(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0044: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool isFiring = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isFiring, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((Flamethrower)(object)target).DamageEntitiesInPathServerRPC(isFiring); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2667894221(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0044: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool isFiring = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isFiring, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((Flamethrower)(object)target).DamageEntitiesInPathClientRPC(isFiring); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1780036370(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool used = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref used, default(ForPrimitives)); bool buttonDown = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref buttonDown, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((Flamethrower)(object)target).StartFireServerRPC(used, buttonDown); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2714157603(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool used = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref used, default(ForPrimitives)); bool buttonDown = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref buttonDown, default(ForPrimitives)); int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); target.__rpc_exec_stage = (__RpcExecStage)1; ((Flamethrower)(object)target).StartFireClientRPC(used, buttonDown, num); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "Flamethrower"; } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace LC.CEPM.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }