using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UsefulZapGun.Methods; using UsefulZapGun.NetcodePatcher; using UsefulZapGun.Network; using UsefulZapGun.Patches; using UsefulZapGun.Patches.Enemy; using UsefulZapGun.Patches.Items; using UsefulZapGun.Scripts.Hazards; using UsefulZapGun.Scripts.Items; [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("UsefulZapGun")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+085d5e4e38fb1f77575eb33d24979a5af097bd22")] [assembly: AssemblyProduct("UsefulZapGun")] [assembly: AssemblyTitle("UsefulZapGun")] [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 UsefulZapGun { public class UZGConfig { private static ConfigFile cfg; public static ConfigEntry enableLogging; public static ConfigEntry zapgunPrice; public static ConfigEntry enableDifficultyMultiplierPatch; public static ConfigEntry distanceDivider; public static ConfigEntry enemyListString; public static Dictionary> multiplayerDict = new Dictionary>(); public static List enemyList; public static Dictionary> timeDict = new Dictionary>(); public static ConfigEntry enableExplosion; public static ConfigEntry setForestGiantsOnFire; public static ConfigEntry timeToStartAFire; public static ConfigEntry evaporateBlob; public static ConfigEntry timeToEvaporate; public static ConfigEntry enableDOTEnemy; public static ConfigEntry enableDOTPlayers; public static ConfigEntry zapDamage; public static ConfigEntry zapDamageToPlayer; public static ConfigEntry zapTimeToDamage; public static ConfigEntry enableItemCharging; public static ConfigEntry chargeLifeTime; public static ConfigEntry enableWeaponCharging; public static ConfigEntry needForShovelCharge; public static ConfigEntry enableZapHazards; public static ConfigEntry timeNeedForTurretDisable; public static ConfigEntry spiketrapZapNeeded; internal static void ConfigSetup(ConfigFile PluginConfig) { cfg = PluginConfig; enableLogging = cfg.Bind("General", "Enable logging", true, (ConfigDescription)null); zapgunPrice = cfg.Bind("General", "Zap gun price", 400, (ConfigDescription)null); enableDifficultyMultiplierPatch = cfg.Bind("General", "Enable Difficulty Multiplier Patch", true, "Formula: result = vanilaValue * Distance(localPlayer, enemy)/distanceDivider"); distanceDivider = cfg.Bind("General", "Distance Divider", 5f, (ConfigDescription)null); setForestGiantsOnFire = cfg.Bind("Enemies", "Set forest giants on fire", true, (ConfigDescription)null); timeToStartAFire = cfg.Bind("Enemies", "Time to start a fire", 3f, (ConfigDescription)null); evaporateBlob = cfg.Bind("Enemies", "Evaporate blob", true, (ConfigDescription)null); enemyListString = cfg.Bind("Enemies", "Enemy list", "Red Locust Bees,Butler Bees", (ConfigDescription)null); enableExplosion = cfg.Bind("Enemies", "Enable enemy explosion", true, (ConfigDescription)null); enableDOTEnemy = cfg.Bind("DOT", "Damage enemy with zap", false, (ConfigDescription)null); enableDOTPlayers = cfg.Bind("DOT", "Damage players with zap", false, (ConfigDescription)null); zapDamage = cfg.Bind("DOT", "Zapgun damage to enemy", 1, (ConfigDescription)null); zapDamageToPlayer = cfg.Bind("DOT", "Zapgun damage to player", 10, (ConfigDescription)null); zapTimeToDamage = cfg.Bind("DOT", "Time to damage (seconds)", 1f, (ConfigDescription)null); enemyList = enemyListString.Value.Split(',').ToList(); enableItemCharging = cfg.Bind("Items", "Enable equipment charging", true, "Charging ratio: chargeMultiplier * (Time.deltaTime / item.itemProperties.batteryUsage)"); enableWeaponCharging = cfg.Bind("Weapon", "Enable weapon charging", true, "x2 damage for charged weapon (shovel, stop sign, mace (code rebirth), etc."); chargeLifeTime = cfg.Bind("Weapon", "Time until charge runs out", 15f, (ConfigDescription)null); needForShovelCharge = cfg.Bind("Weapon", "Zap gun charge% for charged state", 33f, (ConfigDescription)null); enableZapHazards = cfg.Bind("Hazards", "Enable hazard zap", true, (ConfigDescription)null); timeNeedForTurretDisable = cfg.Bind("Hazards", "Time need for turret", 3f, (ConfigDescription)null); spiketrapZapNeeded = cfg.Bind("Hazards", "Zaps before deactivating the spiketrap", 2, (ConfigDescription)null); CheckConfig(); } private static void CheckConfig() { enemyList.Remove("Bruce"); if (zapDamage.Value <= 0) { zapDamage.Value = 1; } } internal static void CreateAndCheckConfigEntryForItem(Item item, float multiplayer) { ConfigEntry value = cfg.Bind("Items", item.itemName + ": charge multiplayer", multiplayer, (ConfigDescription)null); multiplayerDict.TryAdd(item, value); } internal static void CreateAndCheckConfigEntryForEnemy(EnemyType enemy, float time) { ConfigEntry val = cfg.Bind("Enemies", enemy.enemyName + ": time needed for explosion", time, (ConfigDescription)null); if (val.Value <= 0f) { val.Value = 1f; } timeDict.TryAdd(enemy, val); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("mborsh.UsefulZapGun", "UsefulZapGun", "0.6.0")] public class Plugin : BaseUnityPlugin { internal enum spamType { info, message, warning, debug, error, fatal } private const string modGUID = "mborsh.UsefulZapGun"; private const string modName = "UsefulZapGun"; private const string modVersion = "0.6.0"; private readonly Harmony harmony = new Harmony("mborsh.UsefulZapGun"); private static ManualLogSource mls; private static Plugin Instance; internal static bool enemiesAndItemsFound; private static string sAssemblyLocation; public static AssetBundle mainAssetBundle; private static ConfigFile cfg; private static 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); } } } } private void Awake() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown NetcodePatcher(); Instance = this; mls = Logger.CreateLogSource("UsefulZapGun"); mls = ((BaseUnityPlugin)this).Logger; sAssemblyLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); mainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(sAssemblyLocation, "zapgunnetworkobject")); cfg = new ConfigFile(Path.Combine(Paths.ConfigPath, "mborsh.UsefulZapGun.cfg"), true); UZGConfig.ConfigSetup(cfg); mls.LogInfo((object)"UsefulZapGun 0.6.0 loaded. Patching."); PatchAllStuff(); } internal static void SpamLog(string message, spamType type) { if (UZGConfig.enableLogging.Value) { switch (type) { case spamType.info: mls.LogInfo((object)message); break; case spamType.message: mls.LogMessage((object)message); break; case spamType.warning: mls.LogWarning((object)message); break; case spamType.debug: mls.LogDebug((object)message); break; case spamType.error: mls.LogError((object)message); break; case spamType.fatal: mls.LogFatal((object)message); break; } } } private void PatchAllStuff() { harmony.PatchAll(typeof(GameNetworkManagerPatch)); harmony.PatchAll(typeof(MenuManagerPatch)); harmony.PatchAll(typeof(PlayerControllerBPatch)); harmony.PatchAll(typeof(TerminalPatch)); harmony.PatchAll(typeof(EnemyAICollisionDetectPatch)); harmony.PatchAll(typeof(EnemyAIPatch)); harmony.PatchAll(typeof(PatcherToolPatch)); if (UZGConfig.enableZapHazards.Value) { harmony.PatchAll(typeof(MapHazardsPatch)); } if (UZGConfig.enableWeaponCharging.Value) { harmony.PatchAll(typeof(ShovelPatch)); } if (UZGConfig.enableItemCharging.Value) { harmony.PatchAll(typeof(GrabbableObjectPatch)); } } } } namespace UsefulZapGun.Scripts.Items { internal class ConductiveShockableScript : MonoBehaviour, IShockableWithGun { [CompilerGenerated] private sealed class d__8 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PatcherTool zapgun; public PlayerControllerB shockedByPlayer; public ConductiveShockableScript <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; case 2: <>1__state = -1; zapgun.StopShockingAnomalyOnClient(true); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 3; return true; case 3: <>1__state = -1; shockedByPlayer.DamagePlayer(15, true, true, (CauseOfDeath)11, 0, false, default(Vector3)); 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 GrabbableObject itemScript; private void Start() { itemScript = ((Component)this).GetComponent(); } public bool CanBeShocked() { return (Object)(object)itemScript.playerHeldBy == (Object)null; } public float GetDifficultyMultiplier() { return 0f; } public NetworkObject GetNetworkObject() { return ((NetworkBehaviour)itemScript).NetworkObject; } public Vector3 GetShockablePosition() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) return ((Component)itemScript).transform.position + new Vector3(0f, 0.2f, 0f); } public Transform GetShockableTransform() { return ((Component)this).transform; } public void ShockWithGun(PlayerControllerB shockedByPlayer) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown Plugin.SpamLog("Shock conductive item (" + itemScript.itemProperties.itemName + ")", Plugin.spamType.message); if (!((Object)(object)shockedByPlayer != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { itemScript.grabbable = false; PatcherTool zapgun = (PatcherTool)shockedByPlayer.currentlyHeldObjectServer; ((MonoBehaviour)this).StartCoroutine(WaitFrameAndDamage(zapgun, shockedByPlayer)); } } [IteratorStateMachine(typeof(d__8))] private IEnumerator WaitFrameAndDamage(PatcherTool zapgun, PlayerControllerB shockedByPlayer) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__8(0) { <>4__this = this, zapgun = zapgun, shockedByPlayer = shockedByPlayer }; } public void StopShockingWithGun() { itemScript.grabbable = true; } } internal class EquipmentShockableScript : MonoBehaviour, IShockableWithGun { [CompilerGenerated] private sealed class d__11 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PatcherTool zapgun; public GrabbableObject item; public EquipmentShockableScript <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (item.insertedBattery.empty) { item.insertedBattery.empty = false; } break; case 1: { <>1__state = -1; Battery insertedBattery = item.insertedBattery; insertedBattery.charge += <>4__this.chargeMultiplier * (Time.deltaTime / item.itemProperties.batteryUsage); break; } } if (item.insertedBattery.charge < 1f) { <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; } zapgun.StopShockingAnomalyOnClient(true); 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 GrabbableObject itemScript; private float chargeMultiplier; private Coroutine chargeCoroutine; private void Start() { itemScript = ((Component)this).GetComponent(); string itemName = itemScript.itemProperties.itemName; chargeMultiplier = UZGConfig.multiplayerDict[itemScript.itemProperties].Value; } public bool CanBeShocked() { return itemScript.insertedBattery.charge < 1f && (Object)(object)itemScript.playerHeldBy == (Object)null; } public float GetDifficultyMultiplier() { return 0.3f; } public NetworkObject GetNetworkObject() { return ((NetworkBehaviour)itemScript).NetworkObject; } public Vector3 GetShockablePosition() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) return ((Component)itemScript).transform.position + new Vector3(0f, 0.2f, 0f); } public Transform GetShockableTransform() { return ((Component)this).transform; } public void ShockWithGun(PlayerControllerB shockedByPlayer) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown Plugin.SpamLog("Shock item with battery (" + itemScript.itemProperties.itemName + ")", Plugin.spamType.message); itemScript.grabbable = false; PatcherTool zapgun = (PatcherTool)shockedByPlayer.currentlyHeldObjectServer; chargeCoroutine = ((MonoBehaviour)this).StartCoroutine(ChargeItem(zapgun, itemScript)); } public void StopShockingWithGun() { ((MonoBehaviour)this).StopCoroutine(chargeCoroutine); itemScript.grabbable = true; Plugin.SpamLog($"charge = {itemScript.insertedBattery.charge}", Plugin.spamType.debug); itemScript.SyncBatteryServerRpc((int)(itemScript.insertedBattery.charge * 100f)); } [IteratorStateMachine(typeof(d__11))] private IEnumerator ChargeItem(PatcherTool zapgun, GrabbableObject item) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__11(0) { <>4__this = this, zapgun = zapgun, item = item }; } } internal class WeaponShockableScript : MonoBehaviour, IShockableWithGun { [CompilerGenerated] private sealed class d__13 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PatcherTool zapgun; public WeaponShockableScript <>4__this; private float 5__1; private NetworkObjectReference 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = ((GrabbableObject)zapgun).insertedBattery.charge - <>4__this.batteryChargeNeedUntilChargedState; break; case 1: <>1__state = -1; break; } if (((GrabbableObject)zapgun).insertedBattery.charge > 0f && ((GrabbableObject)zapgun).insertedBattery.charge >= 5__1) { <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; } 5__2 = new NetworkObjectReference(<>4__this.GetNetworkObject()); GameNetworkManagerPatch.hostNetHandler.SyncShovelDamageServerRpc(5__2); zapgun.StopShockingAnomalyOnClient(true); 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 d__12 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PatcherTool zapgun; public PlayerControllerB shockedByPlayer; public WeaponShockableScript <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; case 2: <>1__state = -1; zapgun.StopShockingAnomalyOnClient(true); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 3; return true; case 3: <>1__state = -1; shockedByPlayer.DamagePlayer(15, true, true, (CauseOfDeath)11, 0, false, default(Vector3)); 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 d__14 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float seconds; public WeaponShockableScript <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(seconds); <>1__state = 1; return true; case 1: { <>1__state = -1; <>4__this.charged = false; Shovel itemScript = <>4__this.itemScript; itemScript.shovelHitForce /= 2; 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 Shovel itemScript; private bool charged; private Coroutine chargeCoroutine; private float batteryChargeNeedUntilChargedState; private void Start() { itemScript = ((Component)this).GetComponent(); charged = false; batteryChargeNeedUntilChargedState = UZGConfig.needForShovelCharge.Value / 100f; } public bool CanBeShocked() { return (Object)(object)((GrabbableObject)itemScript).playerHeldBy == (Object)null && !charged; } public float GetDifficultyMultiplier() { return 0.3f; } public NetworkObject GetNetworkObject() { return ((NetworkBehaviour)itemScript).NetworkObject; } public Vector3 GetShockablePosition() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) return ((Component)itemScript).transform.position + new Vector3(0f, 0.2f, 0f); } public Transform GetShockableTransform() { return ((Component)this).transform; } public void ShockWithGun(PlayerControllerB shockedByPlayer) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown Plugin.SpamLog("Shock weapon (" + ((GrabbableObject)itemScript).itemProperties.itemName + ")", Plugin.spamType.message); PatcherTool zapgun = (PatcherTool)shockedByPlayer.currentlyHeldObjectServer; if (charged) { WaitFrameAndDamage(zapgun, shockedByPlayer); return; } chargeCoroutine = ((MonoBehaviour)this).StartCoroutine(ChargeWeapon(zapgun)); ((GrabbableObject)itemScript).grabbable = false; } public void StopShockingWithGun() { if (chargeCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(chargeCoroutine); } ((GrabbableObject)itemScript).grabbable = true; } [IteratorStateMachine(typeof(d__12))] private IEnumerator WaitFrameAndDamage(PatcherTool zapgun, PlayerControllerB shockedByPlayer) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0) { <>4__this = this, zapgun = zapgun, shockedByPlayer = shockedByPlayer }; } [IteratorStateMachine(typeof(d__13))] private IEnumerator ChargeWeapon(PatcherTool zapgun) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0) { <>4__this = this, zapgun = zapgun }; } [IteratorStateMachine(typeof(d__14))] private IEnumerator WaitUntilChargeRunsOut(float seconds) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__14(0) { <>4__this = this, seconds = seconds }; } internal void SyncDamageOnLocalClient(float seconds = 0f) { charged = true; Shovel obj = itemScript; obj.shovelHitForce *= 2; ((MonoBehaviour)this).StartCoroutine(WaitUntilChargeRunsOut(seconds)); } } } namespace UsefulZapGun.Scripts.Hazards { internal class LandmineShockableScript : MonoBehaviour, IShockableWithGun { private Landmine mineScript; private bool isShocked; private void Start() { mineScript = ((Component)this).GetComponent(); } public bool CanBeShocked() { return !mineScript.hasExploded && !isShocked; } public float GetDifficultyMultiplier() { return 0f; } public NetworkObject GetNetworkObject() { return ((NetworkBehaviour)mineScript).NetworkObject; } public Vector3 GetShockablePosition() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) return ((Component)mineScript).transform.position + new Vector3(0f, 0.5f, 0f); } public Transform GetShockableTransform() { return ((Component)this).transform; } public void ShockWithGun(PlayerControllerB shockedByPlayer) { Plugin.SpamLog("Shock landmine", Plugin.spamType.message); isShocked = (Object)(object)shockedByPlayer != (Object)(object)GameNetworkManager.Instance.localPlayerController; } public void StopShockingWithGun() { mineScript.ExplodeMineServerRpc(); } } internal class SpiketrapShockableScript : MonoBehaviour, IShockableWithGun { [CompilerGenerated] private sealed class d__13 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PatcherTool zapgun; public SpiketrapShockableScript <>4__this; private NetworkObjectReference 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; if (zapgun.shockedTargetScript == <>4__this && ((GrabbableObject)zapgun).isBeingUsed && <>4__this.localPlayer) { 5__1 = new NetworkObjectReference(<>4__this.GetNetworkObject()); GameNetworkManagerPatch.hostNetHandler.SyncZapCountServerRpc(5__1, <>4__this.zapCount + 1); zapgun.StopShockingAnomalyOnClient(true); } 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(); } } internal int zapCount; private SpikeRoofTrap spikeScript; private Coroutine coroutine; private bool localPlayer; private void Start() { zapCount = 0; spikeScript = ((Component)((Component)this).transform.parent.Find("Trigger")).GetComponent(); } public bool CanBeShocked() { return spikeScript.trapActive && !localPlayer; } public float GetDifficultyMultiplier() { return 0.4f; } public NetworkObject GetNetworkObject() { return ((NetworkBehaviour)spikeScript).NetworkObject; } public Vector3 GetShockablePosition() { //IL_0007: 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_000f: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.position; } public Transform GetShockableTransform() { return ((Component)this).transform; } public void ShockWithGun(PlayerControllerB shockedByPlayer) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown Plugin.SpamLog("Shock spiketrap", Plugin.spamType.message); PatcherTool zapgun = (PatcherTool)shockedByPlayer.currentlyHeldObjectServer; coroutine = ((MonoBehaviour)this).StartCoroutine(WaitAndStopShocking(zapgun)); localPlayer = (Object)(object)shockedByPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController; } public void StopShockingWithGun() { if (coroutine != null) { ((MonoBehaviour)this).StopCoroutine(coroutine); } localPlayer = false; } internal void SyncCanShockOnLocalClient(bool sync) { spikeScript.trapActive = sync; ((Behaviour)((Component)this).GetComponent()).enabled = sync; } [IteratorStateMachine(typeof(d__13))] private IEnumerator WaitAndStopShocking(PatcherTool zapgun) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0) { <>4__this = this, zapgun = zapgun }; } } internal class TurretShockableScript : MonoBehaviour, IShockableWithGun { [CompilerGenerated] private sealed class d__11 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerControllerB player; public TurretShockableScript <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0040: 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_0072: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.turretScript.turretMode = (TurretMode)3; <>4__this.turretScript.EnterBerserkModeServerRpc((int)player.playerClientId); <>2__current = (object)new WaitForSeconds(10.4f); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; case 2: <>1__state = -1; <>4__this.turretScript.turretMode = (TurretMode)0; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 3; return true; case 3: <>1__state = -1; <>4__this.turretScript.ToggleTurretServerRpc(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(); } } [CompilerGenerated] private sealed class d__10 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PatcherTool zapgun; public PlayerControllerB player; public TurretShockableScript <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(UZGConfig.timeNeedForTurretDisable.Value); <>1__state = 1; return true; case 1: <>1__state = -1; if (zapgun.shockedTargetScript == <>4__this && ((GrabbableObject)zapgun).isBeingUsed) { ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.BerserkAndDisable(player)); } 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 Turret turretScript; private Coroutine coroutine; private void Start() { turretScript = ((Component)this).GetComponent(); } public bool CanBeShocked() { return turretScript.turretActive; } public float GetDifficultyMultiplier() { return 0.9f; } public NetworkObject GetNetworkObject() { return ((NetworkBehaviour)turretScript).NetworkObject; } public Vector3 GetShockablePosition() { //IL_0007: 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_000f: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.position; } public Transform GetShockableTransform() { return ((Component)this).transform; } public void ShockWithGun(PlayerControllerB shockedByPlayer) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown Plugin.SpamLog("Shock turret", Plugin.spamType.message); PatcherTool zapgun = (PatcherTool)shockedByPlayer.currentlyHeldObjectServer; coroutine = ((MonoBehaviour)this).StartCoroutine(Wait(zapgun, shockedByPlayer)); } public void StopShockingWithGun() { if (coroutine != null) { ((MonoBehaviour)this).StopCoroutine(coroutine); } } [IteratorStateMachine(typeof(d__10))] private IEnumerator Wait(PatcherTool zapgun, PlayerControllerB player) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__10(0) { <>4__this = this, zapgun = zapgun, player = player }; } [IteratorStateMachine(typeof(d__11))] private IEnumerator BerserkAndDisable(PlayerControllerB player) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__11(0) { <>4__this = this, player = player }; } } } namespace UsefulZapGun.Patches { internal class GameNetworkManagerPatch { internal static GameObject netHandler; internal static UZGNetwork hostNetHandler; [HarmonyPrefix] [HarmonyPatch(typeof(StartOfRound), "Start")] public static void SpawnNetworkHandler() { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { GameObject val = Object.Instantiate(netHandler); val.GetComponent().Spawn(false); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Start")] public static void FindNetworkHandler() { hostNetHandler = Object.FindAnyObjectByType(); Plugin.SpamLog("hostNetHandler found", Plugin.spamType.debug); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] private static void AddPrefabsToNetwork() { netHandler = Plugin.mainAssetBundle.LoadAsset("zapgunnetworkobject.prefab"); netHandler.AddComponent(); NetworkManager.Singleton.AddNetworkPrefab(netHandler); } } internal class MapHazardsPatch { [HarmonyPostfix] [HarmonyPatch(typeof(Turret), "Start")] private static void TurretStartPatch(ref Turret __instance) { ((Component)__instance).gameObject.AddComponent(); } [HarmonyPostfix] [HarmonyPatch(typeof(Landmine), "Start")] private static void LandmineStartPatch(ref Landmine __instance) { ((Component)__instance).gameObject.AddComponent(); } [HarmonyPostfix] [HarmonyPatch(typeof(SpikeRoofTrap), "Start")] private static void SpiketrapStartPatch(ref SpikeRoofTrap __instance) { GameObject gameObject = ((Component)__instance).gameObject; gameObject = ((Component)gameObject.transform.parent.Find("Spot Light")).gameObject; BoxCollider val = gameObject.AddComponent(); ((Collider)val).isTrigger = true; gameObject.AddComponent(); gameObject.layer = 21; ((Component)gameObject.transform.parent).gameObject.layer = 21; ((Component)gameObject.transform.parent.parent).gameObject.layer = 21; ((Component)gameObject.transform.parent.parent.parent).gameObject.layer = 21; } } internal class MenuManagerPatch { [HarmonyPostfix] [HarmonyPatch(typeof(MenuManager), "Start")] private static void FindAllEnemiesPatch() { if (Plugin.enemiesAndItemsFound) { return; } EnemyType[] array = Resources.FindObjectsOfTypeAll(); EnemyType[] array2 = array; foreach (EnemyType val in array2) { if (!string.IsNullOrEmpty(val.enemyName)) { Plugin.SpamLog(val.enemyName + " has been found!", Plugin.spamType.message); if (UZGConfig.enemyList.Contains(val.enemyName)) { UZGConfig.CreateAndCheckConfigEntryForEnemy(val, 3f); val.canBeStunned = true; val.canBeDestroyed = true; Plugin.SpamLog(val.enemyName + " can be stunned and destoyed now!", Plugin.spamType.info); } } } Plugin.SpamLog("---------------------------------------------------------", Plugin.spamType.message); if (UZGConfig.enableItemCharging.Value) { Item[] array3 = Resources.FindObjectsOfTypeAll(); Item[] array4 = array3; foreach (Item val2 in array4) { if (val2.requiresBattery && !string.IsNullOrEmpty(val2.itemName)) { UZGConfig.CreateAndCheckConfigEntryForItem(val2, val2.batteryUsage / 22f); Plugin.SpamLog(val2.itemName + " has been found!", Plugin.spamType.message); } } } Plugin.enemiesAndItemsFound = true; } } internal class PlayerControllerBPatch { [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "IShockableWithGun.ShockWithGun")] private static void ShockWithGunPatch(ref PlayerControllerB __instance, PlayerControllerB shockedByPlayer) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) Plugin.SpamLog("Shock Player", Plugin.spamType.message); if (UZGConfig.enableDOTPlayers.Value) { NetworkBehaviourReference val = default(NetworkBehaviourReference); ((NetworkBehaviourReference)(ref val))..ctor((NetworkBehaviour)(object)__instance); GameNetworkManagerPatch.hostNetHandler.DOTPlayerServerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)__instance), (int)shockedByPlayer.playerClientId); } } } internal class TerminalPatch { [HarmonyPostfix] [HarmonyPatch(typeof(Terminal), "Awake")] [HarmonyPriority(200)] private static void AwakePatch(ref Terminal __instance) { Item[] buyableItemsList = __instance.buyableItemsList; foreach (Item val in buyableItemsList) { if (val.itemName == "Zap gun") { val.creditsWorth = UZGConfig.zapgunPrice.Value; Plugin.SpamLog("Zap gun price: " + val.creditsWorth, Plugin.spamType.message); break; } } } } } namespace UsefulZapGun.Patches.Items { internal class GrabbableObjectPatch { [HarmonyPostfix] [HarmonyPatch(typeof(GrabbableObject), "Start")] private static void StartPatch(ref GrabbableObject __instance) { if (!(__instance is Shovel)) { EquipmentShockableScript equipmentShockableScript = default(EquipmentShockableScript); ConductiveShockableScript conductiveShockableScript = default(ConductiveShockableScript); if (__instance.itemProperties.requiresBattery && !((Component)__instance).gameObject.TryGetComponent(ref equipmentShockableScript) && __instance.itemProperties.requiresBattery) { ((Component)__instance).gameObject.AddComponent(); } else if (!((Component)__instance).gameObject.TryGetComponent(ref conductiveShockableScript) && __instance.itemProperties.isConductiveMetal) { ((Component)__instance).gameObject.AddComponent(); } } } } internal class PatcherToolPatch { [HarmonyPostfix] [HarmonyPatch(typeof(PatcherTool), "BeginShockingAnomalyOnClient")] private static void AddZapGun(ref PatcherTool __instance) { ZapGunMethods.zapGuns.Add(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(PatcherTool), "StopShockingAnomalyOnClient")] private static void RemoveZapGun(ref PatcherTool __instance) { if (!ZapGunMethods.zapGuns.Remove(__instance)) { Plugin.SpamLog($"Couldn't remove the zap gun! networkObjectID: {((NetworkBehaviour)__instance).NetworkObjectId}", Plugin.spamType.warning); } } [HarmonyPostfix] [HarmonyPatch(typeof(PatcherTool), "Start")] private static void StartPatch(ref int ___anomalyMask) { ___anomalyMask = 2621512; } } internal class ShovelPatch { [HarmonyPostfix] [HarmonyPatch(typeof(GrabbableObject), "Start")] private static void StartPatch(ref GrabbableObject __instance) { WeaponShockableScript weaponShockableScript = default(WeaponShockableScript); if (__instance is Shovel && !((Component)__instance).gameObject.TryGetComponent(ref weaponShockableScript)) { ((Component)__instance).gameObject.AddComponent(); } } } } namespace UsefulZapGun.Patches.Enemy { internal class EnemyAICollisionDetectPatch { [HarmonyPostfix] [HarmonyPatch(typeof(EnemyAICollisionDetect), "IShockableWithGun.ShockWithGun")] private static void ShockWithGunPatch(ref EnemyAICollisionDetect __instance, PlayerControllerB shockedByPlayer) { //IL_0082: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown Plugin.SpamLog("Shock Enemy", Plugin.spamType.message); if (UZGConfig.timeDict.ContainsKey(__instance.mainScript.enemyType) && UZGConfig.enableExplosion.Value) { ZapGunMethods.WaitAndExplode(__instance, __instance.mainScript, UZGConfig.timeDict[__instance.mainScript.enemyType].Value); return; } NetworkBehaviourReference enemyNBRef = default(NetworkBehaviourReference); ((NetworkBehaviourReference)(ref enemyNBRef))..ctor((NetworkBehaviour)(object)__instance.mainScript); NetworkBehaviourReference playerWhoHitNBRef = default(NetworkBehaviourReference); ((NetworkBehaviourReference)(ref playerWhoHitNBRef))..ctor((NetworkBehaviour)(object)shockedByPlayer); GameNetworkManagerPatch.hostNetHandler.DOTEnemyServerRpc(enemyNBRef, playerWhoHitNBRef); if (__instance.mainScript is ForestGiantAI && UZGConfig.setForestGiantsOnFire.Value && !UZGConfig.timeDict.ContainsKey(__instance.mainScript.enemyType)) { ZapGunMethods.StartFire(__instance, (ForestGiantAI)__instance.mainScript); } else if (__instance.mainScript is BlobAI && UZGConfig.evaporateBlob.Value && !UZGConfig.timeDict.ContainsKey(__instance.mainScript.enemyType)) { ZapGunMethods.StartEvaporation(__instance, (BlobAI)__instance.mainScript); } } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyAICollisionDetect), "IShockableWithGun.GetDifficultyMultiplier")] private static void GetDifficultyMultiplierPatch(ref EnemyAICollisionDetect __instance, ref float __result) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) if (UZGConfig.enableDifficultyMultiplierPatch.Value && UZGConfig.distanceDivider.Value != 0f) { Plugin.SpamLog("GetDifficultyMultilier before = " + __result, Plugin.spamType.debug); __result *= Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)__instance.mainScript).transform.position) / UZGConfig.distanceDivider.Value; Plugin.SpamLog("GetDifficultyMultilier after = " + __result, Plugin.spamType.debug); } } } internal class EnemyAIPatch { [HarmonyPostfix] [HarmonyPatch(typeof(EnemyAI), "KillEnemyServerRpc")] private static void KillEnemyServerRpcPatch(ref EnemyAI __instance) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown foreach (PatcherTool zapGun in ZapGunMethods.zapGuns) { EnemyAICollisionDetect val = (EnemyAICollisionDetect)zapGun.shockedTargetScript; if (((GrabbableObject)zapGun).isBeingUsed && (Object)(object)val.mainScript == (Object)(object)__instance) { zapGun.StopShockingAnomalyOnClient(true); } } } } } namespace UsefulZapGun.Network { internal class UZGNetwork : NetworkBehaviour { internal PatcherTool zapgun; [ServerRpc(RequireOwnership = false)] internal void BlowUpEnemyServerRpc(NetworkObjectReference enemyNORef) { //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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2089966051u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enemyNORef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2089966051u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref enemyNORef)).TryGet(ref val3, (NetworkManager)null)) { if (!UZGConfig.enemyList.Contains(((Component)val3).GetComponent().enemyType.enemyName)) { Plugin.SpamLog("The client is trying to send an enemy that is not in the config!!!", Plugin.spamType.error); } else if (UZGConfig.enableExplosion.Value) { Vector3 position = ((Component)val3).gameObject.transform.position; EnemyAI component = ((Component)val3).gameObject.GetComponent(); if (component.enemyType.canDie) { component.KillEnemyServerRpc(false); } else { component.KillEnemyServerRpc(true); } BlowUpEnemyClientRpc(position); } } else { Plugin.SpamLog("The client is trying to send a non-existent enemy!!!", Plugin.spamType.error); } } [ClientRpc] private void BlowUpEnemyClientRpc(Vector3 position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1035235681u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1035235681u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ((MonoBehaviour)this).StartCoroutine(ZapGunMethods.ExplodeNextFrame(position)); } } } [ServerRpc(RequireOwnership = false)] internal void SyncShovelDamageServerRpc(NetworkObjectReference shovelNORef) { //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_011e: 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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3194388427u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref shovelNORef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3194388427u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref shovelNORef)).TryGet(ref val3, (NetworkManager)null)) { if (!UZGConfig.enableWeaponCharging.Value) { Plugin.SpamLog("The client is trying to charge a weapon!!!", Plugin.spamType.error); return; } WeaponShockableScript component = ((Component)val3).gameObject.GetComponent(); SyncShovelDamageClientRpc(shovelNORef, UZGConfig.chargeLifeTime.Value); } else { Plugin.SpamLog("The client is trying to send a non-existent shovel!!!", Plugin.spamType.error); } } [ClientRpc] private void SyncShovelDamageClientRpc(NetworkObjectReference shovelNORef, float seconds) { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1596931241u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref shovelNORef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref seconds, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1596931241u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); ((NetworkObjectReference)(ref shovelNORef)).TryGet(ref val3, (NetworkManager)null); ((Component)val3).GetComponent().SyncDamageOnLocalClient(seconds); } } } [ClientRpc] private void SyncCanShockSpikeClientRpc(NetworkObjectReference obj, bool canShock) { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1887262031u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref obj, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref canShock, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1887262031u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null); SpiketrapShockableScript componentInChildren = ((Component)val3).GetComponentInChildren(); componentInChildren.SyncCanShockOnLocalClient(canShock); } } } [ServerRpc(RequireOwnership = false)] internal void SyncZapCountServerRpc(NetworkObjectReference obj, int zapCount) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(23251114u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref obj, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, zapCount); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 23251114u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (zapCount >= UZGConfig.spiketrapZapNeeded.Value) { SyncCanShockSpikeClientRpc(obj, canShock: false); } SyncZapCountClientRpc(obj, zapCount); } } [ClientRpc] private void SyncZapCountClientRpc(NetworkObjectReference obj, int zapCount) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2552547060u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref obj, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, zapCount); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2552547060u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null); SpiketrapShockableScript componentInChildren = ((Component)val3).GetComponentInChildren(); if (componentInChildren.zapCount > zapCount) { SyncZapCountServerRpc(obj, componentInChildren.zapCount + 1); } else { componentInChildren.zapCount = zapCount; } } } [ServerRpc(RequireOwnership = false)] internal void DOTPlayerServerRpc(NetworkBehaviourReference playerNBRef, int playerWhoHit) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2387514609u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref playerNBRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, playerWhoHit); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2387514609u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val3 = default(PlayerControllerB); if (((NetworkBehaviourReference)(ref playerNBRef)).TryGet(ref val3, (NetworkManager)null)) { if (!UZGConfig.enableDOTPlayers.Value || UZGConfig.zapDamageToPlayer.Value == 0) { return; } foreach (PatcherTool zapGun in ZapGunMethods.zapGuns) { if (((GrabbableObject)zapGun).isBeingUsed && zapGun.shockedTargetScript == val3) { zapgun = zapGun; } } ((MonoBehaviour)this).StartCoroutine(DOT.DOTPlayer(val3, playerWhoHit, UZGConfig.zapDamageToPlayer.Value, UZGConfig.zapTimeToDamage.Value, zapgun)); } else { Plugin.SpamLog("Can't find targetedPlayer!!!", Plugin.spamType.error); } } [ServerRpc(RequireOwnership = false)] internal void DOTEnemyServerRpc(NetworkBehaviourReference enemyNBRef, NetworkBehaviourReference playerWhoHitNBRef) { //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) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2311549797u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enemyNBRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref playerWhoHitNBRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2311549797u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; EnemyAI val3 = default(EnemyAI); if (((NetworkBehaviourReference)(ref enemyNBRef)).TryGet(ref val3, (NetworkManager)null)) { PlayerControllerB playerWhoHit = default(PlayerControllerB); if (((NetworkBehaviourReference)(ref playerWhoHitNBRef)).TryGet(ref playerWhoHit, (NetworkManager)null)) { if (!UZGConfig.enableDOTEnemy.Value) { return; } EnemyAICollisionDetect componentInChildren = ((Component)val3).GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null) { Plugin.SpamLog("Can't find EnemyAICollisionDetect!!!", Plugin.spamType.error); return; } foreach (PatcherTool zapGun in ZapGunMethods.zapGuns) { if (((GrabbableObject)zapGun).isBeingUsed && zapGun.shockedTargetScript == componentInChildren) { zapgun = zapGun; } } ((MonoBehaviour)this).StartCoroutine(DOT.DOTEnemy(componentInChildren, playerWhoHit, UZGConfig.zapDamage.Value, UZGConfig.zapTimeToDamage.Value, zapgun)); } else { Plugin.SpamLog("Can't find playerWhoHit!!!", Plugin.spamType.error); } } else { Plugin.SpamLog("The client is trying to send a non-existent enemy!!!", Plugin.spamType.error); } } protected override void __initializeVariables() { ((NetworkBehaviour)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 //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2089966051u, new RpcReceiveHandler(__rpc_handler_2089966051), "BlowUpEnemyServerRpc"); ((NetworkBehaviour)this).__registerRpc(1035235681u, new RpcReceiveHandler(__rpc_handler_1035235681), "BlowUpEnemyClientRpc"); ((NetworkBehaviour)this).__registerRpc(3194388427u, new RpcReceiveHandler(__rpc_handler_3194388427), "SyncShovelDamageServerRpc"); ((NetworkBehaviour)this).__registerRpc(1596931241u, new RpcReceiveHandler(__rpc_handler_1596931241), "SyncShovelDamageClientRpc"); ((NetworkBehaviour)this).__registerRpc(1887262031u, new RpcReceiveHandler(__rpc_handler_1887262031), "SyncCanShockSpikeClientRpc"); ((NetworkBehaviour)this).__registerRpc(23251114u, new RpcReceiveHandler(__rpc_handler_23251114), "SyncZapCountServerRpc"); ((NetworkBehaviour)this).__registerRpc(2552547060u, new RpcReceiveHandler(__rpc_handler_2552547060), "SyncZapCountClientRpc"); ((NetworkBehaviour)this).__registerRpc(2387514609u, new RpcReceiveHandler(__rpc_handler_2387514609), "DOTPlayerServerRpc"); ((NetworkBehaviour)this).__registerRpc(2311549797u, new RpcReceiveHandler(__rpc_handler_2311549797), "DOTEnemyServerRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2089966051(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_004f: 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) { NetworkObjectReference enemyNORef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemyNORef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((UZGNetwork)(object)target).BlowUpEnemyServerRpc(enemyNORef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1035235681(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); target.__rpc_exec_stage = (__RpcExecStage)1; ((UZGNetwork)(object)target).BlowUpEnemyClientRpc(position); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3194388427(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_004f: 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) { NetworkObjectReference shovelNORef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref shovelNORef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((UZGNetwork)(object)target).SyncShovelDamageServerRpc(shovelNORef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1596931241(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_006a: 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) { NetworkObjectReference shovelNORef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref shovelNORef, default(ForNetworkSerializable)); float seconds = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref seconds, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((UZGNetwork)(object)target).SyncShovelDamageClientRpc(shovelNORef, seconds); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1887262031(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_006a: 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) { NetworkObjectReference obj = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref obj, default(ForNetworkSerializable)); bool canShock = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref canShock, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((UZGNetwork)(object)target).SyncCanShockSpikeClientRpc(obj, canShock); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_23251114(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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference obj = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref obj, default(ForNetworkSerializable)); int zapCount = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref zapCount); target.__rpc_exec_stage = (__RpcExecStage)1; ((UZGNetwork)(object)target).SyncZapCountServerRpc(obj, zapCount); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2552547060(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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference obj = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref obj, default(ForNetworkSerializable)); int zapCount = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref zapCount); target.__rpc_exec_stage = (__RpcExecStage)1; ((UZGNetwork)(object)target).SyncZapCountClientRpc(obj, zapCount); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2387514609(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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference playerNBRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref playerNBRef, default(ForNetworkSerializable)); int playerWhoHit = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoHit); target.__rpc_exec_stage = (__RpcExecStage)1; ((UZGNetwork)(object)target).DOTPlayerServerRpc(playerNBRef, playerWhoHit); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2311549797(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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) { NetworkBehaviourReference enemyNBRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemyNBRef, default(ForNetworkSerializable)); NetworkBehaviourReference playerWhoHitNBRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref playerWhoHitNBRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((UZGNetwork)(object)target).DOTEnemyServerRpc(enemyNBRef, playerWhoHitNBRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "UZGNetwork"; } } } namespace UsefulZapGun.Methods { internal class DOT { [CompilerGenerated] private sealed class d__1 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public EnemyAICollisionDetect enemyAICol; public PlayerControllerB playerWhoHit; public int force; public float time; public PatcherTool zapgun; private IHittable 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0046: 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: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = (IHittable)(object)enemyAICol; break; case 1: <>1__state = -1; break; } if (zapgun.shockedTargetScript == enemyAICol && ((GrabbableObject)zapgun).isBeingUsed) { 5__1.Hit(force, ((Component)enemyAICol).transform.position, playerWhoHit, false, -1); <>2__current = (object)new WaitForSeconds(time); <>1__state = 1; return true; } 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 d__0 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerControllerB player; public int playerWhoHit; public int damageToPlayer; public float time; public PatcherTool zapgun; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__0(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (zapgun.shockedTargetScript == player && ((GrabbableObject)zapgun).isBeingUsed) { player.DamagePlayerFromOtherClientServerRpc(damageToPlayer, ((Component)player).transform.position, playerWhoHit); <>2__current = (object)new WaitForSeconds(time); <>1__state = 1; return true; } 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(); } } [IteratorStateMachine(typeof(d__0))] internal static IEnumerator DOTPlayer(PlayerControllerB player, int playerWhoHit, int damageToPlayer, float time, PatcherTool zapgun) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__0(0) { player = player, playerWhoHit = playerWhoHit, damageToPlayer = damageToPlayer, time = time, zapgun = zapgun }; } [IteratorStateMachine(typeof(d__1))] internal static IEnumerator DOTEnemy(EnemyAICollisionDetect enemyAICol, PlayerControllerB playerWhoHit, int force, float time, PatcherTool zapgun) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(0) { enemyAICol = enemyAICol, playerWhoHit = playerWhoHit, force = force, time = time, zapgun = zapgun }; } } internal class ZapGunMethods { [CompilerGenerated] private sealed class d__8 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BlobAI enemyScript; public PatcherTool zapgun; public EnemyAICollisionDetect enemyCol; private float 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = 1f; goto IL_0112; case 1: { <>1__state = -1; Transform transform = ((Component)enemyScript).transform; transform.localScale -= new Vector3(0.01f, 0.01f, 0.01f); if (zapgun.shockedTargetScript != enemyCol || !((GrabbableObject)zapgun).isBeingUsed) { Plugin.SpamLog("Stop zapping blob!", Plugin.spamType.debug); ((MonoBehaviour)StartOfRound.Instance).StopCoroutine(coroutine); } goto IL_0112; } case 2: { <>1__state = -1; if (((EnemyAI)enemyScript).enemyType.canDie) { ((EnemyAI)enemyScript).KillEnemyServerRpc(false); } else { ((EnemyAI)enemyScript).KillEnemyServerRpc(true); } return false; } IL_0112: if (5__1 > 0f) { 5__1 = ((Component)enemyScript).gameObject.transform.localScale.y; Plugin.SpamLog($"blob Y scale: {5__1}", Plugin.spamType.debug); <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } zapgun.StopShockingAnomalyOnClient(true); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; 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 d__2 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Vector3 position; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; Landmine.SpawnExplosion(position, true, 0f, 5f, 20, 3f, (GameObject)null, 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(); } } [CompilerGenerated] private sealed class d__4 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PatcherTool zapgun; public EnemyAICollisionDetect enemyCol; public EnemyAI enemyScript; public float time; private NetworkObjectReference 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; goto IL_00cb; case 1: <>1__state = -1; time -= 0.1f; Plugin.SpamLog($"time = {time}", Plugin.spamType.debug); if (!((GrabbableObject)zapgun).isBeingUsed || zapgun.shockedTargetScript != enemyCol) { Plugin.SpamLog("Stop charging explosion!", Plugin.spamType.debug); ((MonoBehaviour)StartOfRound.Instance).StopCoroutine(coroutine); } goto IL_00cb; case 2: { <>1__state = -1; 5__1 = new NetworkObjectReference(((NetworkBehaviour)enemyScript).NetworkObject); GameNetworkManagerPatch.hostNetHandler.BlowUpEnemyServerRpc(5__1); return false; } IL_00cb: if (time > 0f) { <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } zapgun.StopShockingAnomalyOnClient(true); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; 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 d__6 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ForestGiantAI enemyScript; public PatcherTool zapgun; public EnemyAICollisionDetect enemyCol; private float