Decompiled source of U75 modpack v1.5.2
BepInEx/plugins/CoilHeadMod.dll
Decompiled 4 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("CoilHeadMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CoilHeadMod")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("acc7c5fe-9136-45ea-b4a1-4a6c3d8aad65")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace CoilHeadMod { public class NetworkHandler : NetworkBehaviour { [ServerRpc(RequireOwnership = false)] public void TPCoilServerRpc(SpringManAI __instance, ref bool ___hasStopped, Vector3 pos, bool isPassiveTP) { //IL_000b: 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_0067: Unknown result type (might be due to invalid IL or missing references) Plugin instance = Plugin.instance; Vector3 val = pos; instance.DebugLog("Received TP Rpc " + ((object)(Vector3)(ref val)).ToString()); if (isPassiveTP && Random.value <= Plugin.instance.aggroChance / 100f) { ((EnemyAI)__instance).currentBehaviourStateIndex = 1; } else { ((EnemyAI)__instance).currentBehaviourStateIndex = 0; } NavMeshAgent component = ((Component)__instance).gameObject.GetComponent<NavMeshAgent>(); component.Warp(pos); } } [BepInPlugin("CoilHeadMod.Lusacan1", "CoilTeleport", "1.0.0.0")] public class Plugin : BaseUnityPlugin { public const string modGUID = "CoilHeadMod.Lusacan1"; public const string modName = "CoilTeleport"; public const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("CoilHeadMod.Lusacan1"); public float tpChance; public float tpMin; public float tpMax; public float tpTimer; public float aggroChance; public bool debugCoil; public bool bigLogs; public bool hasSpawned = false; public bool hasStopped = false; public float nextTPChance = 0f; public float lastEncounter = 0f; public EnemyType coilHead; public ManualLogSource LogSource; public RoundManager rm; public GameObject netManagerPrefab; public NetworkHandler netHandler; public static Plugin instance; private void Awake() { 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); } } } instance = this; string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "netcode"); AssetBundle val = AssetBundle.LoadFromFile(text); netManagerPrefab = val.LoadAsset<GameObject>("Assets/NetworkManager/NetworkManager.prefab"); netManagerPrefab.AddComponent<NetworkHandler>(); netHandler = netManagerPrefab.GetComponent<NetworkHandler>(); LogSource = Logger.CreateLogSource("CoilHeadMod.Lusacan1"); DebugLog("Loaded version (1.0.0.0)"); string text2 = "Teleport"; ConfigEntry<float> val2 = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "Teleport Chance", 33.3f, "The chance for the coil head to teleport when you look away (1-100)\nset to -1 to disable"); tpChance = val2.Value; ConfigEntry<float> val3 = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "Minimum Cooldown", 1f, "Minimum time between the chances of the coil head teleporting away"); tpMin = val3.Value; ConfigEntry<float> val4 = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "Maximum Cooldown", 10f, "Maximum time between the chances of the coil head teleporting away"); tpMax = val4.Value; text2 = "Passive Teleport"; ConfigEntry<float> val5 = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "Timer to Teleport", 20f, "After this many seconds without encountering a player the coil head will teleport\nset to -1 to disable"); tpTimer = val5.Value; ConfigEntry<float> val6 = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "Chance to Chase", 50f, "The chance for the coil head to chase a player after passively teleporting"); aggroChance = val6.Value; text2 = "Debug"; ConfigEntry<bool> val7 = ((BaseUnityPlugin)this).Config.Bind<bool>(text2, "Debug Coil", true, "Spawn a coil inside the dungeon before landing"); debugCoil = val7.Value; ConfigEntry<bool> val8 = ((BaseUnityPlugin)this).Config.Bind<bool>(text2, "Ingame Logs", true, "Displays a HUD tip for mod logs"); bigLogs = val8.Value; harmony.PatchAll(); } public void DebugLog(string txt) { LogSource.LogMessage((object)txt); if (Object.op_Implicit((Object)(object)HUDManager.Instance) && bigLogs) { HUDManager.Instance.DisplayTip("CoilHeadMod.Lusacan1", txt, false, false, "LC_Tip1"); } } } } namespace CoilHeadMod.Patches { [HarmonyPatch(typeof(EnemyVent))] internal class EnemyVent_Patch { [HarmonyPostfix] [HarmonyPatch("Start")] private static void SpawnDebugCoil(EnemyVent __instance) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.instance.hasSpawned && Plugin.instance.debugCoil) { Plugin.instance.hasSpawned = true; Plugin.instance.rm.SpawnEnemyGameObject(__instance.floorNode.position, __instance.floorNode.eulerAngles.y, __instance.enemyTypeIndex, Plugin.instance.coilHead); Plugin.instance.DebugLog("Spawned debug coil <3"); } } } [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatcher { [HarmonyPostfix] [HarmonyPatch("Start")] private static void AddToPrefabs(ref GameNetworkManager __instance) { ((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(Plugin.instance.netManagerPrefab); } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManager_Patch { [HarmonyPostfix] [HarmonyPatch("Start")] private static void StartFunc(RoundManager __instance) { Plugin.instance.rm = __instance; Plugin.instance.coilHead = GetEnemies().Find((SpawnableEnemyWithRarity x) => ((Object)x.enemyType).name == "SpringMan").enemyType; Plugin.instance.hasSpawned = false; } private static List<SpawnableEnemyWithRarity> GetEnemies() { //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) Scene activeScene = SceneManager.GetActiveScene(); GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects(); List<SpawnableEnemyWithRarity> result = null; GameObject[] array = rootGameObjects; foreach (GameObject val in array) { if (((Object)val).name == "Environment") { result = val.GetComponentInChildren<Terminal>().moonsCatalogueList.SelectMany((SelectableLevel x) => x.Enemies, (SelectableLevel k, SpawnableEnemyWithRarity v) => v).ToList(); } } return result; } } [HarmonyPatch(typeof(SpringManAI))] internal class SpringManAI_Patch { [HarmonyPrefix] [HarmonyPatch("Update")] private static void CoilLogic(ref bool ___hasStopped) { Plugin.instance.hasStopped = ___hasStopped; } [HarmonyPostfix] [HarmonyPatch("Update")] private static void LateCoilLogic(SpringManAI __instance, ref bool ___hasStopped) { float num = Time.timeSinceLevelLoad - Plugin.instance.lastEncounter; if (Plugin.instance.tpTimer >= 0f && num > Plugin.instance.tpTimer) { TPCoil(__instance, ref ___hasStopped, isPassiveTP: true); } if (!Plugin.instance.hasStopped) { return; } Plugin.instance.lastEncounter = Time.timeSinceLevelLoad; if (Plugin.instance.hasStopped == ___hasStopped) { return; } Plugin.instance.LogSource.LogMessage((object)"CoilHeadMod.Lusacan1 Player looked away"); if (Time.timeSinceLevelLoad >= Plugin.instance.nextTPChance) { Plugin.instance.nextTPChance = Time.timeSinceLevelLoad + Random.value * (Plugin.instance.tpMax - Plugin.instance.tpMin) + Plugin.instance.tpMin; if (Random.value <= Plugin.instance.tpChance / 100f) { TPCoil(__instance, ref ___hasStopped, isPassiveTP: false); } } } private static void TPCoil(SpringManAI __instance, ref bool ___hasStopped, bool isPassiveTP) { //IL_003e: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) Plugin.instance.lastEncounter = Time.timeSinceLevelLoad; GameObject[] array = GameObject.FindGameObjectsWithTag("EnemySpawn"); EnemyVent component = array[Random.Range(0, array.Length - 1)].GetComponent<EnemyVent>(); Vector3 randomNavMeshPositionInRadius = Plugin.instance.rm.GetRandomNavMeshPositionInRadius(component.floorNode.position, 50f, default(NavMeshHit)); Plugin.instance.DebugLog("Sent TP Rpc"); Plugin.instance.netHandler.TPCoilServerRpc(__instance, ref ___hasStopped, randomNavMeshPositionInRadius, isPassiveTP); } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatcher { [HarmonyPostfix] [HarmonyPatch("Start")] private static void spawnNetManager(StartOfRound __instance) { if (((NetworkBehaviour)__instance).IsHost) { GameObject val = Object.Instantiate<GameObject>(Plugin.instance.netManagerPrefab); val.GetComponent<NetworkObject>().Spawn(false); } } } }
BepInEx/plugins/CoilHeadStare.dll
Decompiled 4 days agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using TDP.CoilHeadStare.Patch; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("CoilHeadStare")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CoilHeadStare")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9d96f0c2-6393-4d02-99d7-34538a0dad5c")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace TDP.CoilHeadStare { [BepInPlugin("TDP.CoilHeadStare", "CoilHeadStare", "1.0.6")] public class ModBase : BaseUnityPlugin { private const string modGUID = "TDP.CoilHeadStare"; private const string modName = "CoilHeadStare"; private const string modVersion = "1.0.6"; private Harmony harmony; internal static ModBase instance; internal ManualLogSource mls; public static ConfigEntry<float> config_timeUntilStare; public static ConfigEntry<float> config_maxStareDistance; public static ConfigEntry<float> config_turnHeadSpeed; public static ConfigEntry<bool> config_shovelReact; private void Awake() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown if ((Object)(object)instance == (Object)null) { instance = this; } else { Object.Destroy((Object)(object)this); } ConfigFile(); harmony = new Harmony("TDP.CoilHeadStare"); harmony.PatchAll(typeof(CoilHeadPatch)); mls = Logger.CreateLogSource("TDP.CoilHeadStare"); mls.LogInfo((object)"CoilHeadStare 1.0.6 loaded."); } private void ConfigFile() { config_timeUntilStare = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Time Until Stare", 8f, "Time between moving and looking at closest player (in seconds)"); config_maxStareDistance = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Max Stare Distance", 6f, "Coilhead will only stare at players closer than this (for reference: coilhead's height is ca. 4)"); config_turnHeadSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Head Turn Speed", 0.3f, "The speed at which the head turns towards the player"); config_shovelReact = ((BaseUnityPlugin)this).Config.Bind<bool>("CoilHeadStare", "Head Bounce on Shovel Hit", true, "Should the coilhead spring wobble when hit with a shovel (or with anything else)"); Stare.timeUntilStare = config_timeUntilStare.Value; Stare.maxStareDistance = config_maxStareDistance.Value; Stare.turnHeadSpeed = config_turnHeadSpeed.Value; CoilHeadPatch.shovelReact = config_shovelReact.Value; } } } namespace TDP.CoilHeadStare.Patch { internal class CoilHeadPatch { public static bool shovelReact; [HarmonyPatch(typeof(EnemyAI), "Start")] [HarmonyPostfix] [HarmonyPriority(200)] private static void StartPostFix(EnemyAI __instance) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown if (__instance is SpringManAI) { Debug.Log((object)"CoilHead found. Adding stare script."); Stare stare = ((Component)__instance).gameObject.AddComponent<Stare>(); stare.Initialize((SpringManAI)__instance); } } [HarmonyPatch(typeof(EnemyAI), "HitEnemy")] [HarmonyPrefix] public static void HitEnemyPreFix(EnemyAI __instance) { if (shovelReact) { __instance.creatureAnimator.SetTrigger("springBoing"); } } } public class Stare : MonoBehaviour { private SpringManAI coilHeadInstance; public static float timeUntilStare; public static float maxStareDistance; public static float turnHeadSpeed; private Transform head; private float timeSinceMoving; private bool isTurningHead; private PlayerControllerB stareTarget; public void Initialize(SpringManAI instance) { Debug.Log((object)"Initializing Stare on Coil Head."); coilHeadInstance = instance; if ((Object)(object)coilHeadInstance == (Object)null) { Debug.LogError((object)"Coil Head instance missing. Harmony Patch failed?"); } head = FindChildren(((Component)coilHeadInstance).transform, "springBone.002").Last(); if ((Object)(object)head != (Object)null) { head = head.GetChild(head.childCount - 1); } if ((Object)(object)head == (Object)null) { Debug.LogError((object)"CoilHeadStare could not find head transform. Destroying script. (Coil Head should be unaffected by this)"); Object.Destroy((Object)(object)this); } else { Debug.Log((object)("CoilHeadStare found head transform: " + ((Object)head).name)); } } private List<Transform> FindChildren(Transform parent, string name) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown List<Transform> list = new List<Transform>(); foreach (Transform item in parent) { Transform val = item; if (((Object)val).name == name) { list.Add(val); } else { list.AddRange(FindChildren(val, name)); } } return list; } private void Start() { Debug.Log((object)"Coil Head stare initialization successful. \nNote: If a reskin is being used and the head does not turn it is most likely incompatible."); } private void Update() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)coilHeadInstance == (Object)null) { return; } if ((Object)(object)head == (Object)null) { Debug.LogError((object)"CoilHeadStare head transform missing. Destroying script."); Object.Destroy((Object)(object)this); return; } if (!isTurningHead) { stareTarget = ((EnemyAI)coilHeadInstance).GetClosestPlayer(false, false, false); } if (!((Object)(object)stareTarget == (Object)null)) { Vector3 val = ((Component)stareTarget.gameplayCamera).transform.position - head.position; float num = Vector3.Distance(head.position, ((Component)((EnemyAI)coilHeadInstance).GetClosestPlayer(false, false, false)).transform.position); if ((double)((EnemyAI)coilHeadInstance).creatureAnimator.GetFloat("walkSpeed") > 0.01 || num > maxStareDistance || Vector3.Angle(head.forward, val) < 5f) { timeSinceMoving = 0f; } else { timeSinceMoving += Time.deltaTime; } if (timeSinceMoving > timeUntilStare) { isTurningHead = true; } else { isTurningHead = false; } if (isTurningHead) { head.forward = Vector3.RotateTowards(head.forward, val, turnHeadSpeed * Time.deltaTime, 0f); } } } } }
BepInEx/plugins/ImmortalSnail.dll
Decompiled 4 days agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using GameNetcodeStuff; using ImmortalSnail.NetcodePatcher; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalLib.Modules; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("ImmortalSnail")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Escape from an incredibly slow snail that instantly kills you upon contact.")] [assembly: AssemblyFileVersion("0.7.1.0")] [assembly: AssemblyInformationalVersion("0.7.1")] [assembly: AssemblyProduct("ImmortalSnail")] [assembly: AssemblyTitle("ImmortalSnail")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.7.1.0")] [module: UnverifiableCode] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace ImmortalSnail { internal class ConfigManager { public static void setupLethalConfig() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0028: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0050: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0071: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0092: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown ConfigEntry<float> configSize = Plugin.configSize; FloatSliderOptions val = new FloatSliderOptions(); ((BaseRangeOptions<float>)val).Min = 75f; ((BaseRangeOptions<float>)val).Max = 225f; FloatSliderConfigItem val2 = new FloatSliderConfigItem(configSize, val); ConfigEntry<float> configSpeed = Plugin.configSpeed; FloatSliderOptions val3 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val3).Min = 0.1f; ((BaseRangeOptions<float>)val3).Max = 2f; FloatSliderConfigItem val4 = new FloatSliderConfigItem(configSpeed, val3); ConfigEntry<int> configMaxSnails = Plugin.configMaxSnails; IntSliderOptions val5 = new IntSliderOptions(); ((BaseRangeOptions<int>)val5).Min = 0; ((BaseRangeOptions<int>)val5).Max = 10; IntSliderConfigItem val6 = new IntSliderConfigItem(configMaxSnails, val5); ConfigEntry<int> configRarity = Plugin.configRarity; IntSliderOptions val7 = new IntSliderOptions(); ((BaseRangeOptions<int>)val7).Min = 0; ((BaseRangeOptions<int>)val7).Max = 100; IntSliderConfigItem val8 = new IntSliderConfigItem(configRarity, val7); BoolCheckBoxConfigItem val9 = new BoolCheckBoxConfigItem(Plugin.configGoOutside, false); BoolCheckBoxConfigItem val10 = new BoolCheckBoxConfigItem(Plugin.configEnterShip, false); BoolCheckBoxConfigItem val11 = new BoolCheckBoxConfigItem(Plugin.configGary, true); BoolCheckBoxConfigItem val12 = new BoolCheckBoxConfigItem(Plugin.configCanExplode, false); BoolCheckBoxConfigItem val13 = new BoolCheckBoxConfigItem(Plugin.configExplosionKillOthers, false); BoolCheckBoxConfigItem val14 = new BoolCheckBoxConfigItem(Plugin.configShowTarget, false); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val6); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val8); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val9); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val10); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val11); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val12); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val13); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val14); } } [BepInPlugin("ImmortalSnail", "ImmortalSnail", "0.7.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static AssetBundle bundle; public static ConfigEntry<float> configSize; public static ConfigEntry<float> configSpeed; public static ConfigEntry<int> configMaxSnails; public static ConfigEntry<int> configRarity; public static ConfigEntry<bool> configGoOutside; public static ConfigEntry<bool> configEnterShip; public static ConfigEntry<bool> configGary; public static ConfigEntry<bool> configCanExplode; public static ConfigEntry<bool> configExplosionKillOthers; public static ConfigEntry<bool> configShowTarget; private void Awake() { //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading a mod by swAAn\n\n _\n ,-\"\" \"\".\n ,' ____ `.\n ,' ,' `. `._\n (`. _..--.._ ,' ,' \\ \\\n (`-.\\ .-\"\" \"\"' / ( d _b\n (`._ `-\"\" ,._ ( `-( \\\n <_ ` ( <`< \\ `-._\\\n <`- (__< < :\n (__ (_<_< ;\n `~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"\n __,._\n / _ \\\n | 6 \\ \\ oo\n \\___/ .|__||\n __,..=\" ^ . , \" ,\\\n<.__________________/"); NetcodePatcher(); configSize = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Scale", 100f, "The size of the snail."); configSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Speed", 0.5f, "The speed of the snail."); configMaxSnails = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Max Snails", 4, "The maximum number of snails that can spawn in a round."); configRarity = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Rarity", 80, "Honestly not sure exactly how this works, but a higher \"Rarity\" will make the snail more likely to spawn."); configGoOutside = ((BaseUnityPlugin)this).Config.Bind<bool>("Pathing", "Can Go Outside", true, "If enabled, allows the snail to exit the factory and chase players outside."); configEnterShip = ((BaseUnityPlugin)this).Config.Bind<bool>("Pathing", "Can Enter Ship", true, "If enabled, allows the snail to target players that are in the ship room."); configGary = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Gary Mode", false, "Snail is reskinned to look like Spongebob's faithful pet snail, Gary!"); configCanExplode = ((BaseUnityPlugin)this).Config.Bind<bool>("Explosions", "Can Explode", true, "Snail creates an explosion when killing player."); configExplosionKillOthers = ((BaseUnityPlugin)this).Config.Bind<bool>("Explosions", "Explosions Kill Other Players", false, "If enabled, snail explosion will kill other players in explosion radius."); configShowTarget = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Show Target on Scan", true, "If enabled, shows the targeted player when scanned."); if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig")) { ConfigManager.setupLethalConfig(); } string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); bundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "immortalsnail")); if ((Object)(object)bundle == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load asset bundle."); return; } EnemyType val = bundle.LoadAsset<EnemyType>("ImmortalSnail.EnemyType"); if ((Object)(object)val == (Object)null || (Object)(object)val.enemyPrefab == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Snail Failed to load properly."); return; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Configuring Snail."); if (configGary.Value) { val.enemyPrefab = bundle.LoadAsset<GameObject>("gary_snail.prefab"); } val.enemyPrefab.AddComponent<SnailAI>(); ((EnemyAI)val.enemyPrefab.GetComponent<SnailAI>()).enemyType = val; val.enemyPrefab.GetComponentInChildren<EnemyAICollisionDetect>().mainScript = (EnemyAI)(object)val.enemyPrefab.GetComponent<SnailAI>(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Applying User-Defined Configuration Settings"); Transform transform = val.enemyPrefab.transform; transform.localScale *= configSize.Value / 100f; val.enemyPrefab.GetComponent<NavMeshAgent>().speed = configSpeed.Value; val.MaxCount = configMaxSnails.Value; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Registering Snail as Enemy"); LevelTypes val2 = (LevelTypes)(-1); SpawnType val3 = (SpawnType)0; TerminalNode val4 = ScriptableObject.CreateInstance<TerminalNode>(); val4.displayText = "The Immortal Snail\n\nDanger level: 50%\n\nThe following is a recitation of the events that transpired on [REDACTED] to the best of my memory. This is my experience with the entity and I swear to do right by the company and describe it as best I can. There were four of us out on a routine scrap-job, absolutely nothing was out of the ordinary before [REDACTED] spotted it. We laughed our asses off. Half the things in here will make you soil your hazmat suit on the spot, and then there's this thing, moving at, well you know. We had our fun, but ultimately moved on and forgot about the thing. Me and the boys went our separate ways and decided to rendezvous at the ship. Three of us returned, but [REDACTED] was missing. We all decided to go back in and investigate. The place was silent. We thought things might have taken a turn for the worse, so we decided to split up and either guide [REDACTED] back to ship, or at least recover his remains. As often happens, I found myself lost. Turning the corners of this elaborate labyrinth, I finally found what was left of [REDACTED]. It was unusual, I'd never seen a coworker left in such a state. Reality struck as I turned a corner and found another comrade waiting on the ground for me, and then another. I made the heartbreaking decision to leave my comrades behind. I was almost free, when I find staring at me from the front entrance the same snail I'd seen before. I saw red. I beat that thing as ruthlessly as I could (with my shovel), entirely imprinting my rage on its presumably fragile shell. I expected to find a small puddle where the snail once stood, but the it was unaffected. It moved towards me at the same agitating pace it did before. The aftermath is a blur. Sometimes I wonder if I even made it back to the ship at all.\n\n"; val4.clearPreviousText = true; val4.maxCharactersToType = 2000; val4.creatureName = "The Immortal Snail"; val4.creatureFileID = 1738; TerminalKeyword val5 = TerminalUtils.CreateTerminalKeyword("snail", false, (CompatibleNoun[])null, val4, (TerminalKeyword)null, false); NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); Enemies.RegisterEnemy(val, configRarity.Value, val2, val3, val4, val5); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ImmortalSnail 0.7.1 is loaded!"); } 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); } } } } } internal class SnailAI : EnemyAI { private float timeAtLastUsingEntrance; public override void Start() { base.enemyHP = 1; ((EnemyAI)this).Start(); RefreshTargetServerRpc(); } public override void OnCollideWithPlayer(Collider other) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)"Snail collided with a player, but player was null."); return; } ((EnemyAI)this).OnCollideWithPlayer(other); if (Object.op_Implicit((Object)(object)base.targetPlayer) && component.playerClientId == base.targetPlayer.playerClientId) { KillPlayerServerRpc((int)component.playerClientId); } } public override void DoAIInterval() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.targetPlayer == (Object)null || base.targetPlayer.isPlayerDead || !base.targetPlayer.isPlayerControlled || (base.targetPlayer.isInHangarShipRoom && !Plugin.configEnterShip.Value) || (!base.targetPlayer.isInsideFactory && !Plugin.configGoOutside.Value)) { RefreshTargetServerRpc(); } if (base.movingTowardsTargetPlayer) { if (isInTargetPlayerArea()) { base.destination = RoundManager.Instance.GetNavMeshPosition(((Component)base.targetPlayer).transform.position, RoundManager.Instance.navHit, 2.7f, -1); } else { SetDestinationToOtherArea(); } base.agent.SetDestination(base.destination); base.agent.isStopped = false; } else { base.agent.isStopped = true; } } private void SetDestinationToOtherArea() { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) Transform nearbyExitTransform = getNearbyExitTransform(); if (Object.op_Implicit((Object)(object)nearbyExitTransform) && Time.realtimeSinceStartup - timeAtLastUsingEntrance > 3f) { if (((NetworkBehaviour)this).IsOwner) { ((Behaviour)base.agent).enabled = false; ((Component)this).transform.position = nearbyExitTransform.position; ((Behaviour)base.agent).enabled = true; } else { ((Component)this).transform.position = nearbyExitTransform.position; } timeAtLastUsingEntrance = Time.realtimeSinceStartup; base.isOutside = !base.isOutside; base.destination = RoundManager.Instance.GetNavMeshPosition(((Component)base.targetPlayer).transform.position, RoundManager.Instance.navHit, 2.7f, -1); } else { base.destination = RoundManager.Instance.GetNavMeshPosition(getNearestExitTransform().position, RoundManager.Instance.navHit, 2.7f, -1); } } [ServerRpc(RequireOwnership = false)] public void RefreshTargetServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3872618423u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3872618423u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; PlayerControllerB val3 = null; float num = float.MaxValue; for (int i = 0; i < allPlayerScripts.Length; i++) { if (!((Object)(object)allPlayerScripts[i] == (Object)null) && !allPlayerScripts[i].isPlayerDead && allPlayerScripts[i].isPlayerControlled && (!allPlayerScripts[i].isInHangarShipRoom || Plugin.configEnterShip.Value) && (allPlayerScripts[i].isInsideFactory || Plugin.configGoOutside.Value)) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)allPlayerScripts[i]).transform.position); if (num2 < num) { val3 = allPlayerScripts[i]; num = num2; } } } if ((Object)(object)val3 == (Object)null) { base.targetPlayer = null; base.movingTowardsTargetPlayer = false; RefreshTargetClientRpc(-1); return; } ((EnemyAI)this).SetMovingTowardsTargetPlayer(val3); if (Plugin.configShowTarget.Value) { ((Component)this).gameObject.GetComponentInChildren<ScanNodeProperties>().subText = "Current Target : " + val3.playerUsername; } RefreshTargetClientRpc((int)val3.playerClientId); } [ClientRpc] public void RefreshTargetClientRpc(int playerId) { //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_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3607601761u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3607601761u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } if (playerId == -1) { base.targetPlayer = null; base.movingTowardsTargetPlayer = false; return; } PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId]; ((EnemyAI)this).SetMovingTowardsTargetPlayer(val3); if (Plugin.configShowTarget.Value) { ((Component)this).gameObject.GetComponentInChildren<ScanNodeProperties>().subText = "Current Target: " + val3.playerUsername; } } [ServerRpc(RequireOwnership = false)] public void KillPlayerServerRpc(int playerId) { //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_0071: 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_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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(144219085u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 144219085u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { if (Plugin.configCanExplode.Value) { Explode(playerId, Plugin.configExplosionKillOthers.Value); } else { StartOfRound.Instance.allPlayerScripts[playerId].KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 0); } KillPlayerClientRpc(playerId, Plugin.configCanExplode.Value, Plugin.configExplosionKillOthers.Value); RefreshTargetServerRpc(); } } [ClientRpc] public void KillPlayerClientRpc(int playerId, bool explode, bool killOthers) { //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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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) //IL_00ab: 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_011b: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1023255967u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref explode, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref killOthers, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1023255967u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { if (explode) { Explode(playerId, killOthers); } else { StartOfRound.Instance.allPlayerScripts[playerId].KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 0); } } } private Transform getNearbyExitTransform() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(false); EntranceTeleport[] array2 = array; foreach (EntranceTeleport val in array2) { if (!(Vector3.Distance(((Component)this).transform.position, val.entrancePoint.position) < 1f)) { continue; } EntranceTeleport[] array3 = array; foreach (EntranceTeleport val2 in array3) { if (val2.isEntranceToBuilding != val.isEntranceToBuilding && val2.entranceId == val.entranceId) { return val2.entrancePoint; } } } return null; } private Transform getNearestExitTransform() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(false); Transform result = null; float num = float.MaxValue; EntranceTeleport[] array2 = array; foreach (EntranceTeleport val in array2) { float num2 = Vector3.Distance(((Component)this).transform.position, val.entrancePoint.position); if (num2 < num) { result = val.entrancePoint; num = num2; } } return result; } private bool isInTargetPlayerArea() { return (base.targetPlayer.isInsideFactory && !base.isOutside) || (!base.targetPlayer.isInsideFactory && base.isOutside); } private void Explode(int playerId, bool killOthers) { //IL_002d: 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_000d: Unknown result type (might be due to invalid IL or missing references) if (killOthers) { Landmine.SpawnExplosion(((Component)this).transform.position, true, 5.7f, 6.4f); return; } Landmine.SpawnExplosion(((Component)this).transform.position, true, 0f, 0f); StartOfRound.Instance.allPlayerScripts[playerId].KillPlayer(GetBodyVelocity(playerId), true, (CauseOfDeath)3, 0); } private Vector3 GetBodyVelocity(int playerId) { //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_006d: 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_0071: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)StartOfRound.Instance.allPlayerScripts[playerId].gameplayCamera).transform.position; position -= ((Component)this).transform.position; position *= 80f; return position / Vector3.Distance(((Component)StartOfRound.Instance.allPlayerScripts[playerId].gameplayCamera).transform.position, ((Component)this).transform.position); } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_SnailAI() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3872618423u, new RpcReceiveHandler(__rpc_handler_3872618423)); NetworkManager.__rpc_func_table.Add(3607601761u, new RpcReceiveHandler(__rpc_handler_3607601761)); NetworkManager.__rpc_func_table.Add(144219085u, new RpcReceiveHandler(__rpc_handler_144219085)); NetworkManager.__rpc_func_table.Add(1023255967u, new RpcReceiveHandler(__rpc_handler_1023255967)); } private static void __rpc_handler_3872618423(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((SnailAI)(object)target).RefreshTargetServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3607601761(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)2; ((SnailAI)(object)target).RefreshTargetClientRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_144219085(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((SnailAI)(object)target).KillPlayerServerRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1023255967(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_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) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); bool explode = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref explode, default(ForPrimitives)); bool killOthers = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref killOthers, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((SnailAI)(object)target).KillPlayerClientRpc(playerId, explode, killOthers); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "SnailAI"; } } public static class PluginInfo { public const string PLUGIN_GUID = "ImmortalSnail"; public const string PLUGIN_NAME = "ImmortalSnail"; public const string PLUGIN_VERSION = "0.7.1"; } } namespace ImmortalSnail.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
BepInEx/plugins/LCOffice.dll
Decompiled 4 days ago
The result has been truncated due to the large size, download it to view full contents!
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.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using LCOffice.Patches; using LethalLevelLoader; using LethalLib.Modules; using LethalNetworkAPI; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Animations; using UnityEngine.Animations.Rigging; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LcOffice")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LcOffice")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8ee335db-0cbe-470c-8fbc-69263f01b35a")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LCOffice { [BepInPlugin("Piggy.LCOffice", "LCOffice", "1.0.24")] public class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { public static float spawnTimer; [HarmonyPatch("SpawnScrapInLevel")] [HarmonyPrefix] private static bool SetItemSpawnPoints(ref RuntimeDungeon ___dungeonGenerator) { //IL_003c: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) if (((Object)___dungeonGenerator.Generator.DungeonFlow).name != "OfficeDungeonFlow") { return true; } RoundManager instance = RoundManager.Instance; Vector3 position = GameObject.Find("LevelGenerationRoot").transform.position; Object.Instantiate<GameObject>(extLevelGeneration, new Vector3(position.x - 130f, position.y, position.z - 130f), Quaternion.Euler(0f, 0f, 0f)); dungeonGenerator = GameObject.Find("A_DungeonGenerator").GetComponent<RuntimeDungeon>(); instance.SpawnSyncedProps(); if ((Object)(object)GameObject.Find("OfficeTeleport(Clone)") != (Object)null) { EntranceTeleport component = GameObject.Find("OfficeTeleport(Clone)").GetComponent<EntranceTeleport>(); component.entranceId = 40; } if ((Object)(object)GameObject.Find("OfficeOutsideTeleport(Clone)") != (Object)null) { EntranceTeleport component2 = GameObject.Find("OfficeOutsideTeleport(Clone)").GetComponent<EntranceTeleport>(); component2.entranceId = 40; } return true; } } private const string modGUID = "Piggy.LCOffice"; private const string modName = "LCOffice"; private const string modVersion = "1.0.24"; private readonly Harmony harmony = new Harmony("Piggy.LCOffice"); private static Plugin Instance; public static ManualLogSource mls; public static AssetBundle Bundle; public static AudioClip ElevatorOpen; public static AudioClip ElevatorClose; public static AudioClip ElevatorUp; public static AudioClip ElevatorDown; public static AudioClip stanleyVoiceline1; public static AudioClip bossaLullaby; public static AudioClip shopTheme; public static AudioClip saferoomTheme; public static AudioClip cootieTheme; public static AudioClip garageDoorSlam; public static AudioClip garageSlide; public static AudioClip floorOpen; public static AudioClip floorClose; public static AudioClip footstep1; public static AudioClip footstep2; public static AudioClip footstep3; public static AudioClip footstep4; public static AudioClip dogEatItem; public static AudioClip bigGrowl; public static AudioClip enragedScream; public static AudioClip dogSprint; public static AudioClip ripPlayerApart; public static AudioClip cry1; public static AudioClip dogHowl; public static AudioClip stomachGrowl; public static AudioClip eatenExplode; public static AudioClip dogSneeze; public static GameObject shrimpPrefab; public static GameObject elevatorManager; public static GameObject storagePrefab; public static GameObject socketPrefab; public static GameObject socketInteractPrefab; public static GameObject insideCollider; public static EnemyType shrimpEnemy; public static GameObject officeRoundSystem; public static GameObject extLevelGeneration; public static ExtendedDungeonFlow officeExtendedDungeonFlow; public static DungeonArchetype officeArchetype; public static DungeonArchetype officeArchetype_A; public static DungeonFlow officeDungeonFlow; public static DungeonFlow officeDungeonFlow_A; public static TerminalNode shrimpTerminalNode; public static TerminalKeyword shrimpTerminalKeyword; public static Item coinItem; public static GameObject coinPrefab; public static Item toolBoxItem; public static GameObject toolBoxPrefab; public static Item screwDriverItem; public static GameObject screwDriverPrefab; public static Item laptopItem; public static GameObject laptopPrefab; public static Item wrenchItem; public static GameObject wrenchPrefab; public static RuntimeDungeon dungeonGenerator; public static string PluginDirectory; private ConfigEntry<bool> configGuaranteedOffice; private ConfigEntry<int> configOfficeRarity; private ConfigEntry<string> configMoons; private ConfigEntry<int> shrimpSpawnWeight; private ConfigEntry<int> configLengthOverride; private ConfigEntry<bool> configEnableScraps; public static bool setKorean; public static float musicVolume; public static Item bottleItem; public static Item goldencupItem; public static ItemGroup itemGroupGeneral; public static ItemGroup itemGroupTabletop; public static ItemGroup itemGroupSmall; private void Awake() { //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Expected O, but got Unknown //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Expected O, but got Unknown //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Expected O, but got Unknown //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Expected O, but got Unknown //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Expected O, but got Unknown //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Expected O, but got Unknown //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Expected O, but got Unknown //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Expected O, but got Unknown //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Expected O, but got Unknown //IL_0592: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Expected O, but got Unknown //IL_0626: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } PluginDirectory = ((BaseUnityPlugin)this).Info.Location; mls = Logger.CreateLogSource("Piggy.LCOffice"); mls.LogInfo((object)"LC_Office is loaded!"); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); Bundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "lcoffice")); if ((Object)(object)Bundle == (Object)null) { mls.LogError((object)"Failed to load Office Dungeon assets."); return; } officeDungeonFlow = Bundle.LoadAsset<DungeonFlow>("OfficeDungeonFlow.asset"); officeArchetype = Bundle.LoadAsset<DungeonArchetype>("OfficeArchetype.asset"); extLevelGeneration = Bundle.LoadAsset<GameObject>("ExtLevelGeneration.prefab"); configOfficeRarity = ((BaseUnityPlugin)this).Config.Bind<int>("General", "OfficeRarity", 40, new ConfigDescription("How rare it is for the office to be chosen. Higher values increases the chance of spawning the office.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 300), Array.Empty<object>())); configGuaranteedOffice = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "OfficeGuaranteed", false, new ConfigDescription("If enabled, the office will be effectively guaranteed to spawn. Only recommended for debugging/sightseeing purposes.", (AcceptableValueBase)null, Array.Empty<object>())); configMoons = ((BaseUnityPlugin)this).Config.Bind<string>("General", "OfficeMoonsList", "free", new ConfigDescription("The moon(s) that the office can spawn on, in the form of a comma separated list of selectable level names (e.g. \"TitanLevel,RendLevel,DineLevel\")\nNOTE: These must be the internal data names of the levels (all vanilla moons are \"MoonnameLevel\", for modded moon support you will have to find their name if it doesn't follow the convention).\nThe following strings: \"all\", \"vanilla\", \"modded\", \"paid\", \"free\", \"none\" are dynamic presets which add the dungeon to that specified group (string must only contain one of these, or a manual moon name list).\nDefault dungeon generation size is balanced around the dungeon scale multiplier of Titan (2.35), moons with significantly different dungeon size multipliers (see Lethal Company wiki for values) may result in dungeons that are extremely small/large.", (AcceptableValueBase)null, Array.Empty<object>())); configLengthOverride = ((BaseUnityPlugin)this).Config.Bind<int>("General", "OfficeLengthOverride", -1, new ConfigDescription(string.Format("If not -1, overrides the office length to whatever you'd like. Adjusts how long/large the dungeon generates.\nBe *EXTREMELY* careful not to set this too high (anything too big on a moon with a high dungeon size multipier can cause catastrophic problems, like crashing your computer or worse)\nFor reference, the default value for the current version [{0}] is {1}. If it's too big, make this lower e.g. 6, if it's too small use something like 10 (or higher, but don't go too crazy with it).", "1.0.4", officeDungeonFlow.Length.Min), (AcceptableValueBase)null, Array.Empty<object>())); configEnableScraps = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "OfficeCustomScrap", true, new ConfigDescription("When enabled, enables custom scrap spawning.", (AcceptableValueBase)null, Array.Empty<object>())); musicVolume = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ElevatorMusicVolume", 100f, "Set the volume of music played in the elevator. (0 - 100)").Value; shrimpSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn", "ShrimpSpawnWeight", 5, new ConfigDescription("Sets the shrimp spawn weight for every moons.", (AcceptableValueBase)null, Array.Empty<object>())); setKorean = ((BaseUnityPlugin)this).Config.Bind<bool>("Translation", "Enable Korean", false, "Set language to Korean.").Value; if (configLengthOverride.Value == -1) { officeDungeonFlow.Length.Min = 6; officeDungeonFlow.Length.Max = 8; } else { mls.LogInfo((object)$"Office length override has been set to {configLengthOverride.Value}. Be careful with this value."); officeDungeonFlow.Length.Min = configLengthOverride.Value; officeDungeonFlow.Length.Max = configLengthOverride.Value; } ExtendedDungeonFlow val = ScriptableObject.CreateInstance<ExtendedDungeonFlow>(); val.contentSourceName = "LC Office"; val.dungeonFlow = officeDungeonFlow; val.dungeonDefaultRarity = 0; int num = (configGuaranteedOffice.Value ? 99999 : configOfficeRarity.Value); switch (configMoons.Value.ToLower()) { case "all": val.dynamicLevelTagsList.Add(new StringWithRarity("Vanilla", num)); val.dynamicLevelTagsList.Add(new StringWithRarity("Custom", num)); mls.LogInfo((object)"Registered Office dungeon for all moons."); break; case "vanilla": val.dynamicLevelTagsList.Add(new StringWithRarity("Lethal Company", num)); mls.LogInfo((object)"Registered Office dungeon for all vanilla moons."); break; case "modded": val.dynamicLevelTagsList.Add(new StringWithRarity("Custom", num)); mls.LogInfo((object)"Registered Office dungeon for all modded moons."); break; case "paid": val.dynamicRoutePricesList.Add(new Vector2WithRarity(new Vector2(1f, 9999f), num)); mls.LogInfo((object)"Registered Office dungeon for all paid moons."); break; case "free": val.dynamicRoutePricesList.Add(new Vector2WithRarity(new Vector2(0f, 0f), num)); mls.LogInfo((object)"Registered Office dungeon for all free moons."); break; default: { mls.LogInfo((object)"Registering Office dungeon for predefined moon list."); string[] array = configMoons.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); List<StringWithRarity> list = new List<StringWithRarity>(); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[1] { '@' }, StringSplitOptions.RemoveEmptyEntries); int num2 = array2.Length; int result; if (num2 > 2) { mls.LogError((object)("Invalid setup for moon rarity config: " + array[i] + ". Skipping.")); } else if (num2 == 1) { mls.LogInfo((object)$"Registering Office dungeon for moon {array[i]} at default rarity {num}"); list.Add(new StringWithRarity(array[i], num)); } else if (!int.TryParse(array2[1], out result)) { mls.LogError((object)("Failed to parse rarity value for moon " + array2[0] + ": " + array2[1] + ". Skipping.")); } else { mls.LogInfo((object)$"Registering Office dungeon for moon {array[i]} at default rarity {num}"); list.Add(new StringWithRarity(array2[0], result)); } } val.manualPlanetNameReferenceList = list; break; } } val.dungeonSizeMin = 1f; val.dungeonSizeMax = 1f; val.dungeonSizeLerpPercentage = 0f; PatchedContent.RegisterExtendedDungeonFlow(val); shrimpPrefab = Bundle.LoadAsset<GameObject>("Shrimp.prefab"); shrimpEnemy = Bundle.LoadAsset<EnemyType>("ShrimpEnemy.asset"); elevatorManager = Bundle.LoadAsset<GameObject>("ElevatorSystem.prefab"); storagePrefab = Bundle.LoadAsset<GameObject>("DepositPlace.prefab"); socketPrefab = Bundle.LoadAsset<GameObject>("ElevatorSocket.prefab"); socketInteractPrefab = Bundle.LoadAsset<GameObject>("LungPlacement.prefab"); officeRoundSystem = Bundle.LoadAsset<GameObject>("OfficeRoundSystem.prefab"); insideCollider = Bundle.LoadAsset<GameObject>("InsideCollider.prefab"); bossaLullaby = Bundle.LoadAsset<AudioClip>("bossa_lullaby_refiltered.ogg"); shopTheme = Bundle.LoadAsset<AudioClip>("shop_refiltered.ogg"); saferoomTheme = Bundle.LoadAsset<AudioClip>("saferoom_refiltered.ogg"); ElevatorOpen = Bundle.LoadAsset<AudioClip>("ElevatorOpen.ogg"); ElevatorClose = Bundle.LoadAsset<AudioClip>("ElevatorClose.ogg"); ElevatorDown = Bundle.LoadAsset<AudioClip>("ElevatorDown.ogg"); ElevatorUp = Bundle.LoadAsset<AudioClip>("ElevatorUp.ogg"); garageDoorSlam = Bundle.LoadAsset<AudioClip>("GarageDoorSlam.ogg"); garageSlide = Bundle.LoadAsset<AudioClip>("GarageDoorSlide1.ogg"); floorOpen = Bundle.LoadAsset<AudioClip>("FloorOpen.ogg"); floorClose = Bundle.LoadAsset<AudioClip>("FloorClosed.ogg"); footstep1 = Bundle.LoadAsset<AudioClip>("Footstep1.ogg"); footstep2 = Bundle.LoadAsset<AudioClip>("Footstep2.ogg"); footstep3 = Bundle.LoadAsset<AudioClip>("Footstep3.ogg"); footstep4 = Bundle.LoadAsset<AudioClip>("Footstep4.ogg"); dogEatItem = Bundle.LoadAsset<AudioClip>("DogEatObject.ogg"); bigGrowl = Bundle.LoadAsset<AudioClip>("BigGrowl.ogg"); enragedScream = Bundle.LoadAsset<AudioClip>("DogRage.ogg"); dogSprint = Bundle.LoadAsset<AudioClip>("DogSprint.ogg"); ripPlayerApart = Bundle.LoadAsset<AudioClip>("RipPlayerApart.ogg"); cry1 = Bundle.LoadAsset<AudioClip>("Cry1.ogg"); dogHowl = Bundle.LoadAsset<AudioClip>("DogHowl.ogg"); stomachGrowl = Bundle.LoadAsset<AudioClip>("StomachGrowl.ogg"); eatenExplode = Bundle.LoadAsset<AudioClip>("eatenExplode.ogg"); dogSneeze = Bundle.LoadAsset<AudioClip>("Sneeze.ogg"); stanleyVoiceline1 = Bundle.LoadAsset<AudioClip>("stanley.ogg"); shrimpTerminalNode = Bundle.LoadAsset<TerminalNode>("ShrimpFile.asset"); shrimpTerminalKeyword = Bundle.LoadAsset<TerminalKeyword>("shrimpTK.asset"); if (!setKorean) { shrimpTerminalNode.displayText = "Shrimp\r\n\r\nSigurd’s Danger Level: 60%\r\n\r\n\nScientific name: Canispiritus-Artemus\r\n\r\nShrimps are dog-like creatures, known to be the first tenant of the Upturned Inn. For the most part, he is relatively friendly to humans, following them around, curiously stalking them. Unfortunately, their passive temperament comes with a dangerously vicious hunger.\r\nDue to the nature of their biology, he has a much more unique stomach organ than most other creatures. The stomach lining is flexible, yet hardy, allowing a Shrimp to digest and absorb the nutrients from anything, biological or not, so long as it isn’t too large.\r\n\r\nHowever, this evolutionary adaptation was most likely a result of their naturally rapid metabolism. He uses nutrients so quickly that he needs to eat multiple meals a day to survive. The time between these meals are inconsistent, as the rate of caloric consumption is variable. This can range from hours to even minutes and causes the shrimp to behave monstrously if he has not eaten for a while.\r\n\r\nKnown to live in abandoned buildings, shrimp can often be seen in large abandoned factories or offices scavenging for scrap metal, to eat. That isn’t to say he can’t be found elsewhere. He is usually a lone hunters and expert trackers out of necessity.\r\n\r\nSigurd’s Note:\r\nIf this guy spots you, you’ll want to drop something you’re holding and let him eat it. It’s either you or that piece of scrap on you.\r\n\r\nit’s best to avoid letting him spot you. I swear… it’s almost like his eyes are staring into your soul.\r\nI never want to see one of these guys behind me again.\r\n\r\n\r\nIK: <i>Sir, don't be sad! Shrimp didn't hate you.\r\nhe was just... hungry.</i>\r\n\r\n"; shrimpTerminalNode.creatureName = "Shrimp"; shrimpTerminalKeyword.word = "shrimp"; } else { shrimpTerminalNode.displayText = "쉬림프\r\n\r\n시구르드의 위험 수준: 60%\r\n\r\n\n학명: 카니스피리투스-아르테무스\r\n\r\n쉬림프는 개를 닮은 생명체로 Upturned Inn의 첫 번째 세입자로 알려져 있습니다. 평소에는 상대적으로 우호적이며, 호기심을 가지고 인간을 따라다닙니다. 불행하게도 그는 위험할 정도로 굉장한 식욕을 가지고 있습니다.\r\n생물학적 특성으로 인해, 그는 대부분의 다른 생물보다 훨씬 더 독특한 위장 기관을 가지고 있습니다. 위 내막은 유연하면서도 견고하기 때문에 어떤 물체라도 영양분을 소화하고 흡수할 수 있습니다.\r\n그러나 이러한 진화적 적응은 자연적으로 빠른 신진대사의 결과일 가능성이 높습니다. 그는 영양분을 너무 빨리 사용하기 때문에 생존하려면 하루에 여러 끼를 먹어야 합니다.\r\n칼로리 소비율이 다양하기 때문에 식사 사이의 시간이 일정하지 않습니다. 이는 몇 시간에서 몇 분까지 지속될 수 있으며, 쉬림프가 오랫동안 무언가를 먹지 않으면 매우 포악해지며 따라다니던 사람을 쫒습니다.\r\n\r\n버려진 건물에 사는 것으로 알려진 쉬림프는 버려진 공장이나 사무실에서 폐철물을 찾아다니는 것으로 발견할 수 있습니다. 그렇다고 다른 곳에서 그를 찾을 수 없다는 말은 아닙니다. 그는 일반적으로 고독한 사냥꾼이며, 때로는 전문적인 추적자가 되기도 합니다.\r\n\r\n시구르드의 노트: 이 녀석이 으르렁거리는 소리를 듣게 된다면, 먹이를 줄 수 있는 무언가를 가지고 있기를 바라세요. 아니면 당신이 이 녀석의 식사가 될 거예요.\r\n맹세컨대... 마치 당신의 영혼을 들여다보는 것 같아요. 다시는 내 뒤에서 이 녀석을 보고 싶지 않아요.\r\n\r\n\r\nIK: <i>손님, 슬퍼하지 마세요! 쉬림프는 당신을 싫어하지 않는답니다.\r\n걔는 그냥... 배고플 뿐이에요.</i>\r\n\r\n"; shrimpTerminalNode.creatureName = "쉬림프"; shrimpTerminalKeyword.word = "쉬림프"; } Enemies.RegisterEnemy(shrimpEnemy, shrimpSpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, shrimpTerminalNode, shrimpTerminalKeyword); socketInteractPrefab.AddComponent<ElevatorSystem>(); shrimpPrefab.AddComponent<ShrimpAI>(); elevatorManager.AddComponent<ElevatorSystem>(); officeRoundSystem.AddComponent<OfficeRoundSystem>(); insideCollider.AddComponent<ElevatorSystem>(); insideCollider.AddComponent<ElevatorCollider>(); NetworkPrefabs.RegisterNetworkPrefab(shrimpPrefab); NetworkPrefabs.RegisterNetworkPrefab(elevatorManager); NetworkPrefabs.RegisterNetworkPrefab(storagePrefab); NetworkPrefabs.RegisterNetworkPrefab(socketInteractPrefab); NetworkPrefabs.RegisterNetworkPrefab(officeRoundSystem); NetworkPrefabs.RegisterNetworkPrefab(insideCollider); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[LC_Office] Successfully loaded assets!"); harmony.PatchAll(typeof(Plugin)); harmony.PatchAll(typeof(PlayerControllerBPatch)); harmony.PatchAll(typeof(GrabbableObjectPatch)); harmony.PatchAll(typeof(TerminalPatch)); harmony.PatchAll(typeof(StartOfRoundPatch)); harmony.PatchAll(typeof(GameNetworkManagerPatch)); } } } namespace LCOffice.Patches { public class PlaceableLungProp : MonoBehaviour { } public class SetPosOfNetworkObject : MonoBehaviour { public Transform originPos; private void Start() { } private void LateUpdate() { } } public class PlaceLung : NetworkBehaviour { public static bool emergencyPowerRequires; public static bool emergencyCheck; public static bool lungPlaced; } [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { [HarmonyPostfix] [HarmonyPatch("Disconnect")] private static void Disconnect_Prefix() { } } public class OfficeRoundSystem : NetworkBehaviour { public bool isOffice; public bool isChecked; public bool isDungeonOfficeChecked; public static OfficeRoundSystem Instance { get; private set; } private void Awake() { Instance = this; } private void Start() { SceneManager.sceneLoaded += ResetStaticVariable; } private void LateUpdate() { if (!isChecked && TimeOfDay.Instance.currentDayTimeStarted && (Object)(object)RoundManager.Instance.dungeonGenerator != (Object)null) { if (((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name == "OfficeDungeonFlow") { isOffice = true; } else { isOffice = false; } if (!isDungeonOfficeChecked) { ((MonoBehaviour)this).StartCoroutine(CheckOfficeElevator()); if (isOffice && ((NetworkBehaviour)this).IsServer) { NetworkObject component = Object.Instantiate<GameObject>(Plugin.insideCollider).GetComponent<NetworkObject>(); component.Spawn(false); } isDungeonOfficeChecked = true; } } if (isChecked && !TimeOfDay.Instance.currentDayTimeStarted) { if (!isOffice || ((NetworkBehaviour)this).IsServer) { } isOffice = false; isChecked = false; isDungeonOfficeChecked = false; } } private void ResetStaticVariable(Scene scene, LoadSceneMode mode) { PlaceLung.emergencyPowerRequires = false; PlaceLung.emergencyCheck = false; PlaceLung.lungPlaced = false; ElevatorSystem.elevatorFloor.Value = 1; ElevatorSystem.isElevatorClosed = false; ElevatorSystem.spawnShrimpBool.Value = false; ElevatorSystem.isSetupEnd = false; } private IEnumerator CheckOfficeElevator() { yield return (object)new WaitForSeconds(7f); isChecked = true; SetKorean(); } private void SetKorean() { InteractTrigger[] array = Object.FindObjectsOfType<InteractTrigger>(); InteractTrigger[] array2 = array; foreach (InteractTrigger val in array2) { if (Plugin.setKorean) { if (val.hoverTip == "Open : [LMB]") { val.hoverTip = "열기 : [LMB]"; } else if (val.hoverTip == "Open : [E]") { val.hoverTip = "열기 : [E]"; } if (val.hoverTip == "Use door : [LMB]") { val.hoverTip = "문 사용하기 : [LMB]"; } else if (val.hoverTip == "Use door : [E]") { val.hoverTip = "문 사용하기 : [E]"; } if (val.hoverTip == "Go to the 1st floor : [LMB]") { val.hoverTip = "1층으로 이동하기 : [LMB]"; } else if (val.hoverTip == "Go to the 1st floor : [E]") { val.hoverTip = "1층으로 이동하기 : [E]"; } if (val.hoverTip == "Go to the 2nd floor : [LMB]") { val.hoverTip = "2층으로 이동하기 : [LMB]"; } else if (val.hoverTip == "Go to the 2nd floor : [E]") { val.hoverTip = "2층으로 이동하기 : [E]"; } if (val.hoverTip == "Go to the 3rd floor : [LMB]") { val.hoverTip = "3층으로 이동하기 : [LMB]"; } else if (val.hoverTip == "Go to the 3rd floor : [E]") { val.hoverTip = "3층으로 이동하기 : [E]"; } if (val.hoverTip == "Place Apparatus : [LMB]") { val.hoverTip = "장치 설치하기 : [LMB]"; } else if (val.hoverTip == "Place Apparatus : [E]") { val.hoverTip = "장치 설치하기 : [E]"; } if (val.hoverTip == "Store item : [LMB]") { val.hoverTip = "아이템 보관하기 : [LMB]"; } else if (val.hoverTip == "Store item : [E]") { val.hoverTip = "아이템 보관하기 : [E]"; } if (val.hoverTip == "Climb : [LMB]") { val.hoverTip = "오르기 : [LMB]"; } else if (val.hoverTip == "Climb : [E]") { val.hoverTip = "오르기 : [E]"; } if (val.hoverTip == "Flush: [LMB]") { val.hoverTip = "물 내리기: [LMB]"; } else if (val.hoverTip == "Flush: [E]") { val.hoverTip = "물 내리기: [E]"; } if (val.disabledHoverTip == "[Not holding Apparatus]") { val.disabledHoverTip = "[장치를 들고 있지 않음]"; } } } } } public class ShrimpCollider : MonoBehaviour { } public class ShrimpAI : EnemyAI { public float networkPosDistance; public Vector3 prevPosition; public float stuckDetectionTimer; public float prevPositionDistance; public AISearchRoutine roamMap = new AISearchRoutine(); private Vector3 spawnPosition; public PlayerControllerB hittedPlayer; [PublicNetworkVariable] public static LethalNetworkVariable<bool> KillingPlayerBool = new LethalNetworkVariable<bool>("KillingPlayerBool"); [PublicNetworkVariable] public static LethalNetworkVariable<int> SelectNode = new LethalNetworkVariable<int>("SelectNode"); [PublicNetworkVariable] public static LethalNetworkVariable<float> shrimpVelocity = new LethalNetworkVariable<float>("shrimpVelocity"); [PublicNetworkVariable] public static LethalNetworkVariable<float> hungerValue = new LethalNetworkVariable<float>("hungerValue"); [PublicNetworkVariable] public static LethalNetworkVariable<bool> isHitted = new LethalNetworkVariable<bool>("isHitted"); [PublicNetworkVariable] public static LethalNetworkVariable<Vector3> networkPosition = new LethalNetworkVariable<Vector3>("networkPosition"); [PublicNetworkVariable] public static LethalNetworkVariable<Vector3> networkRotation = new LethalNetworkVariable<Vector3>("networkRotation"); public static LethalNetworkVariable<ulong> networkTargetPlayer = new LethalNetworkVariable<ulong>("networkTargetPlayer"); public bool isKillingPlayer; public bool isSeenPlayer; public bool isEnraging; public bool isAngered; public bool canBeMoved; public bool isRunning; public bool dogRandomWalk; public float footStepTime; public float randomVal; public bool isTargetAvailable; public float networkTargetPlayerDistance; public float nearestItemDistance; public bool isNearestItem; public List<GameObject> droppedItems = new List<GameObject>(); public GameObject nearestDroppedItem; public Transform dogHead; public Ray lookRay; public Transform lookTarget; public BoxCollider[] allBoxCollider; public Transform IdleTarget; public bool isIdleTargetAvailable; public bool forceChangeTarget; public Rig lookRig; public Light lungLight; public bool ateLung; public bool isSatisfied; public float satisfyValue; public Transform leftEye; public Transform rightEye; public Transform shrimpEye; public Transform mouth; public GameObject shrimpKillTrigger; public Transform bittenObjectHolder; public float searchingForObjectTimer; private Vector3 scaleOfEyesNormally; public AudioSource mainAudio; public AudioSource voiceAudio; public AudioSource voice2Audio; public AudioSource dogMusic; public AudioSource sprintAudio; public Vector3 originalMouthScale; public float scaredBackingAway; public Ray backAwayRay; private RaycastHit hitInfo; private RaycastHit hitInfoB; public float followTimer; public EnemyBehaviourState roamingState; public EnemyBehaviourState followingPlayer; public EnemyBehaviourState enragedState; public List<EnemyBehaviourState> tempEnemyBehaviourStates; public List<SkinnedMeshRenderer> skinnedMeshRendererList; public List<MeshRenderer> meshRendererList; private float timeSinceLookingAtNoise; private Vector3 lookAtNoise; private void Awake() { base.agent = ((Component)this).GetComponent<NavMeshAgent>(); } public override void Start() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Expected O, but got Unknown networkTargetPlayer.Value = 123456uL; KillingPlayerBool.Value = false; SelectNode.Value = 0; shrimpVelocity.Value = 0f; hungerValue.Value = 0f; isHitted.Value = false; ((Component)((Component)this).transform.GetChild(0)).GetComponent<EnemyAICollisionDetect>().mainScript = (EnemyAI)(object)this; base.enemyType = Plugin.shrimpEnemy; base.skinnedMeshRenderers = ((Component)this).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>(); base.meshRenderers = ((Component)this).gameObject.GetComponentsInChildren<MeshRenderer>(); base.thisNetworkObject = ((Component)this).gameObject.GetComponentInChildren<NetworkObject>(); base.serverPosition = ((Component)this).transform.position; base.thisEnemyIndex = RoundManager.Instance.numberOfEnemiesInScene; RoundManager instance = RoundManager.Instance; instance.numberOfEnemiesInScene++; base.allAINodes = GameObject.FindGameObjectsWithTag("AINode"); base.path1 = new NavMeshPath(); mouth = GameObject.Find("ShrimpMouth").transform; leftEye = GameObject.Find("ShrimpLeftEye").transform; rightEye = GameObject.Find("ShrimpRightEye").transform; shrimpKillTrigger = GameObject.Find("ShrimpKillTrigger"); base.creatureAnimator = ((Component)((Component)this).transform.GetChild(0).GetChild(1)).gameObject.GetComponent<Animator>(); base.creatureAnimator.SetTrigger("Walk"); mainAudio = GameObject.Find("ShrimpMainAudio").GetComponent<AudioSource>(); voiceAudio = GameObject.Find("ShrimpGrowlAudio").GetComponent<AudioSource>(); voice2Audio = GameObject.Find("ShrimpAngerAudio").GetComponent<AudioSource>(); lookRig = GameObject.Find("ShrimpLookAtPlayer").GetComponent<Rig>(); lungLight = GameObject.Find("LungFlash").GetComponent<Light>(); lungLight.intensity = 0f; AudioSource[] componentsInChildren = ((Component)((Component)this).transform).GetComponentsInChildren<AudioSource>(); AudioSource[] array = componentsInChildren; foreach (AudioSource val in array) { val.outputAudioMixerGroup = GameObject.Find("StatusEffectAudio").GetComponent<AudioSource>().outputAudioMixerGroup; } lookTarget = GameObject.Find("Shrimp_Look_target").transform; dogHead = GameObject.Find("ShrimpLookPoint").transform; bittenObjectHolder = GameObject.Find("BittenObjectHolder").transform; shrimpEye = GameObject.Find("ShrimpEye").transform; scaleOfEyesNormally = leftEye.localScale; originalMouthScale = mouth.localScale; voice2Audio.clip = Plugin.dogSprint; voice2Audio.Play(); base.creatureVoice = voice2Audio; base.creatureSFX = voice2Audio; base.eye = shrimpEye; SetupBehaviour(); tempEnemyBehaviourStates.Add(roamingState); tempEnemyBehaviourStates.Add(followingPlayer); tempEnemyBehaviourStates.Add(enragedState); base.enemyBehaviourStates = tempEnemyBehaviourStates.ToArray(); spawnPosition = ((Component)this).transform.position; roamMap = new AISearchRoutine(); ItemElevatorCheck[] array2 = Object.FindObjectsOfType<ItemElevatorCheck>(); ItemElevatorCheck[] array3 = array2; foreach (ItemElevatorCheck itemElevatorCheck in array3) { itemElevatorCheck.shrimpAI = this; } if (Plugin.setKorean) { ((Component)((Component)this).transform.GetChild(1)).GetComponent<ScanNodeProperties>().headerText = "쉬림프"; } ShrimpAI[] array4 = Object.FindObjectsOfType<ShrimpAI>(); ShrimpAI[] array5 = array4; foreach (ShrimpAI shrimpAI in array5) { if ((Object)(object)shrimpAI != (Object)(object)this) { Object.Destroy((Object)(object)((Component)shrimpAI).gameObject); } } } public IEnumerator stunnedTimer(PlayerControllerB playerWhoHit) { if (!(scaredBackingAway > 0f)) { isHitted.Value = false; hittedPlayer = playerWhoHit; base.agent.speed = 0f; base.creatureAnimator.SetTrigger("Recoil"); mainAudio.PlayOneShot(Plugin.cry1, 1f); yield return (object)new WaitForSeconds(0.5f); scaredBackingAway = 2f; yield return (object)new WaitForSeconds(2f); hittedPlayer = null; } } private void StunTest() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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) if (scaredBackingAway > 0f) { if (((Behaviour)base.agent).enabled && ((NetworkBehaviour)this).IsOwner) { lookTarget.position = Vector3.Lerp(lookTarget.position, ((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, true, 0, false).position, 10f * Time.deltaTime); base.agent.SetDestination(((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, true, 0, false).position); } scaredBackingAway -= Time.deltaTime; } } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, false); if (hungerValue.Value < 60f && scaredBackingAway <= 0f) { isHitted.Value = true; } } public void FootStepSound() { randomVal = Random.Range(0, 20); if (randomVal < 5f) { mainAudio.PlayOneShot(Plugin.footstep1, Random.Range(0.8f, 1f)); } else if (randomVal < 10f) { mainAudio.PlayOneShot(Plugin.footstep2, Random.Range(0.8f, 1f)); } else if (randomVal < 15f) { mainAudio.PlayOneShot(Plugin.footstep3, Random.Range(0.8f, 1f)); } else if (randomVal < 20f) { mainAudio.PlayOneShot(Plugin.footstep4, Random.Range(0.8f, 1f)); } } private IEnumerator DogSatisfied() { yield return (object)new WaitForSeconds(2f); canBeMoved = true; networkTargetPlayer.Value = 123456uL; } public override void Update() { //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_07c7: Unknown result type (might be due to invalid IL or missing references) //IL_07d1: Unknown result type (might be due to invalid IL or missing references) //IL_0770: Unknown result type (might be due to invalid IL or missing references) //IL_0786: Unknown result type (might be due to invalid IL or missing references) //IL_078b: Unknown result type (might be due to invalid IL or missing references) //IL_078f: Unknown result type (might be due to invalid IL or missing references) //IL_07a5: Unknown result type (might be due to invalid IL or missing references) //IL_07aa: Unknown result type (might be due to invalid IL or missing references) //IL_082e: Unknown result type (might be due to invalid IL or missing references) //IL_0838: Unknown result type (might be due to invalid IL or missing references) //IL_0848: Unknown result type (might be due to invalid IL or missing references) //IL_0803: Unknown result type (might be due to invalid IL or missing references) //IL_0860: Unknown result type (might be due to invalid IL or missing references) //IL_0865: Unknown result type (might be due to invalid IL or missing references) //IL_0869: Unknown result type (might be due to invalid IL or missing references) //IL_0873: Unknown result type (might be due to invalid IL or missing references) //IL_0883: Unknown result type (might be due to invalid IL or missing references) //IL_0888: Unknown result type (might be due to invalid IL or missing references) //IL_090d: Unknown result type (might be due to invalid IL or missing references) //IL_0913: Unknown result type (might be due to invalid IL or missing references) //IL_0923: Unknown result type (might be due to invalid IL or missing references) //IL_093a: Unknown result type (might be due to invalid IL or missing references) //IL_0940: Unknown result type (might be due to invalid IL or missing references) //IL_0950: Unknown result type (might be due to invalid IL or missing references) //IL_098a: Unknown result type (might be due to invalid IL or missing references) //IL_0990: Unknown result type (might be due to invalid IL or missing references) //IL_099a: Unknown result type (might be due to invalid IL or missing references) //IL_09aa: Unknown result type (might be due to invalid IL or missing references) //IL_09c1: Unknown result type (might be due to invalid IL or missing references) //IL_09c7: Unknown result type (might be due to invalid IL or missing references) //IL_09d1: Unknown result type (might be due to invalid IL or missing references) //IL_09e1: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Unknown result type (might be due to invalid IL or missing references) //IL_065a: Unknown result type (might be due to invalid IL or missing references) //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_0661: Unknown result type (might be due to invalid IL or missing references) //IL_0669: Unknown result type (might be due to invalid IL or missing references) //IL_066e: Unknown result type (might be due to invalid IL or missing references) //IL_0672: Unknown result type (might be due to invalid IL or missing references) //IL_067e: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Unknown result type (might be due to invalid IL or missing references) //IL_068b: Unknown result type (might be due to invalid IL or missing references) //IL_068f: Unknown result type (might be due to invalid IL or missing references) //IL_06f3: Unknown result type (might be due to invalid IL or missing references) //IL_06f8: Unknown result type (might be due to invalid IL or missing references) timeSinceLookingAtNoise += Time.deltaTime; footStepTime += Time.deltaTime * shrimpVelocity.Value / 8f; if (footStepTime > 0.5f) { FootStepSound(); footStepTime = 0f; } if (!isSatisfied) { CheckPlayer(); } if (networkTargetPlayer.Value != 123456) { } base.creatureAnimator.SetFloat("walkSpeed", Mathf.Clamp(shrimpVelocity.Value / 5f, 0f, 3f)); base.creatureAnimator.SetFloat("runSpeed", Mathf.Clamp(shrimpVelocity.Value / 2.7f, 3f, 4f)); SetByHunger(); if (networkTargetPlayer.Value != 123456) { EatItem(); } CheckTargetAvailable(); if (isHitted.Value) { ((MonoBehaviour)this).StartCoroutine(stunnedTimer(LethalNetworkExtensions.GetPlayerController(networkTargetPlayer.Value))); } if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).SyncPositionToClients(); } else { ((EnemyAI)this).SetClientCalculatingAI(false); } if (ateLung) { lungLight.intensity = Mathf.Lerp(lungLight.intensity, 1500f, Time.deltaTime * 10f); } if (satisfyValue >= 21f && !isSatisfied) { mainAudio.PlayOneShot(Plugin.dogSneeze); canBeMoved = false; ((MonoBehaviour)this).StartCoroutine(DogSatisfied()); isSatisfied = true; } if (isSatisfied && satisfyValue > 0f) { satisfyValue -= Time.deltaTime; isSeenPlayer = false; } if (satisfyValue <= 0f && isSatisfied) { isSatisfied = false; satisfyValue = 0f; } if (networkTargetPlayer.Value == 123456 && !isNearestItem && (Object)(object)base.targetNode == (Object)null) { int num = Random.Range(1, base.allAINodes.Length); if (Vector3.Distance(((Component)this).transform.position, base.allAINodes[num].transform.position) > 5f && SelectNode.Value != num && ((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsOwner) { SelectNode.Value = num; } } else if (networkTargetPlayer.Value == 123456 && !isNearestItem && (Object)(object)base.targetNode != (Object)null) { int num2 = Random.Range(1, base.allAINodes.Length); if (Vector3.Distance(((Component)this).transform.position, base.allAINodes[SelectNode.Value].transform.position) < 1f && SelectNode.Value != num2 && ((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsOwner) { SelectNode.Value = num2; } } if (stuckDetectionTimer > 3.5f) { int num3 = Random.Range(1, base.allAINodes.Length); if (Vector3.Distance(((Component)this).transform.position, base.allAINodes[num3].transform.position) > 5f && SelectNode.Value != num3) { if (((NetworkBehaviour)this).IsOwner) { SelectNode.Value = num3; } stuckDetectionTimer = 0f; } else if (Vector3.Distance(((Component)this).transform.position, base.allAINodes[num3].transform.position) > 5f) { stuckDetectionTimer = 0f; } } Vector3 velocity; if ((networkTargetPlayer.Value == 123456 && !isNearestItem) || isSatisfied) { if (timeSinceLookingAtNoise < 2f && scaredBackingAway <= 0f && networkTargetPlayer.Value == 123456) { lookRig.weight = Mathf.Lerp(lookRig.weight, 1f, Time.deltaTime); lookTarget.position = Vector3.Lerp(lookTarget.position, lookAtNoise, 10f * Time.deltaTime); } else if (scaredBackingAway <= 0f) { lookRig.weight = Mathf.Lerp(lookRig.weight, 0f, Time.deltaTime); } if ((Object)(object)base.targetNode != (Object)null) { if (((Behaviour)base.agent).enabled && ((NetworkBehaviour)this).IsOwner) { base.agent.SetDestination(base.targetNode.position); } if (shrimpVelocity.Value < 0.5f) { stuckDetectionTimer += Time.deltaTime; } else { stuckDetectionTimer = 0f; } Vector3 val = ((Component)this).transform.position - prevPosition; velocity = base.agent.velocity; float num4 = Vector3.Angle(val, ((Vector3)(ref velocity)).normalized); velocity = base.agent.velocity; if (Vector3.Angle(val, ((Vector3)(ref velocity)).normalized) > 30f) { Plugin.mls.LogInfo((object)("angle diff: " + num4 + ", " + "30" + " rad.")); } prevPosition = ((Component)this).transform.position; } } base.targetNode = base.allAINodes[SelectNode.Value].transform; if (networkTargetPlayer.Value != 123456 || isNearestItem) { dogRandomWalk = false; stuckDetectionTimer = 0f; } Quaternion rotation; if (((NetworkBehaviour)this).IsOwner) { networkPosition.Value = ((Component)this).transform.position; LethalNetworkVariable<Vector3> obj = networkRotation; rotation = ((Component)this).transform.rotation; obj.Value = ((Quaternion)(ref rotation)).eulerAngles; LethalNetworkVariable<float> obj2 = shrimpVelocity; velocity = base.agent.velocity; obj2.Value = ((Vector3)(ref velocity)).sqrMagnitude; } else { networkPosDistance = Vector3.Distance(((Component)this).transform.position, networkPosition.Value); if (networkPosDistance > 3f) { ((Component)this).transform.position = networkPosition.Value; Plugin.mls.LogWarning((object)"Force the shrimp to change position."); } else { ((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, networkPosition.Value, Time.deltaTime * 10f); } Transform transform = ((Component)this).transform; rotation = ((Component)this).transform.rotation; transform.rotation = Quaternion.Euler(Vector3.Lerp(((Quaternion)(ref rotation)).eulerAngles, networkRotation.Value, Time.deltaTime * 10f)); if (networkPosDistance > 15f) { Plugin.mls.LogFatal((object)"Shrimp spawned successfully, but the current position is VERY far from the network position. This error typically occurs when network quality is low or the server is experiencing heavy traffic."); } } if (networkTargetPlayer.Value != 123456) { isTargetAvailable = true; } if (hungerValue.Value < 55f) { leftEye.localScale = Vector3.Lerp(leftEye.localScale, scaleOfEyesNormally, 20f * Time.deltaTime); rightEye.localScale = Vector3.Lerp(rightEye.localScale, scaleOfEyesNormally, 20f * Time.deltaTime); } else if (hungerValue.Value > 55f) { leftEye.localScale = Vector3.Lerp(leftEye.localScale, scaleOfEyesNormally * 0.4f, 20f * Time.deltaTime); rightEye.localScale = Vector3.Lerp(rightEye.localScale, scaleOfEyesNormally * 0.4f, 20f * Time.deltaTime); } base.creatureAnimator.SetBool("DogRandomWalk", dogRandomWalk); if (canBeMoved && !isRunning) { base.creatureAnimator.SetBool("Running", false); base.agent.speed = 5.5f; base.agent.acceleration = 7f; base.agent.angularSpeed = 150f; } else if (!canBeMoved && !isRunning) { base.creatureAnimator.SetBool("Running", false); base.agent.speed = 0f; base.agent.angularSpeed = 0f; } if (isRunning) { base.creatureAnimator.SetBool("Running", true); base.agent.speed = Mathf.Lerp(base.agent.speed, 15f, Time.deltaTime * 2f); base.agent.angularSpeed = 10000f; base.agent.acceleration = 50f; } StunTest(); } private IEnumerator SyncRotation() { Transform transform = ((Component)this).transform; Quaternion rotation = ((Component)this).transform.rotation; transform.rotation = Quaternion.Euler(Vector3.Lerp(((Quaternion)(ref rotation)).eulerAngles, networkRotation.Value, Time.deltaTime * 10f)); yield return (object)new WaitForSeconds(1f); } private float CalculateRotationDifference(Vector3 rotation1, Vector3 rotation2) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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) //IL_0010: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.Euler(rotation1); Quaternion val2 = Quaternion.Euler(rotation2); return Quaternion.Angle(val, val2); } private void CheckPlayer() { //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForPlayer(40f, 40, 2); if ((Object)(object)val != (Object)null && networkTargetPlayer.Value == 123456 && !isKillingPlayer) { if (!isSeenPlayer) { mainAudio.PlayOneShot(Plugin.dogHowl); base.creatureAnimator.SetTrigger("Walk"); isSeenPlayer = true; } networkTargetPlayer.Value = LethalNetworkExtensions.GetClientId(val); } if (droppedItems.Count > 0 && (Object)(object)nearestDroppedItem == (Object)null) { FindNearestItem(); } if (networkTargetPlayer.Value != 123456) { if (!isNearestItem && scaredBackingAway <= 0f) { if (hungerValue.Value > 55f) { lookRay = new Ray(dogHead.position, ((Component)LethalNetworkExtensions.GetPlayerController(networkTargetPlayer.Value)).transform.position - dogHead.position); lookTarget.position = Vector3.Lerp(lookTarget.position, ((Ray)(ref lookRay)).GetPoint(3f), 30f * Time.deltaTime); } else { lookTarget.position = Vector3.Lerp(lookTarget.position, ((Component)LethalNetworkExtensions.GetPlayerController(networkTargetPlayer.Value).lowerSpine).transform.position, 6f * Time.deltaTime); } } base.agent.autoBraking = true; lookRig.weight = Mathf.Lerp(lookRig.weight, 1f, Time.deltaTime); dogRandomWalk = false; if (!isSeenPlayer) { mainAudio.PlayOneShot(Plugin.dogHowl, 1f); } isSeenPlayer = true; } if (!isRunning && !isNearestItem) { base.agent.stoppingDistance = 4.5f; } else { base.agent.stoppingDistance = 0.5f; } if (!isNearestItem) { } } private void SetByHunger() { //IL_05a9: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) if (hungerValue.Value < 66f) { if (isSeenPlayer && !isTargetAvailable && ((NetworkBehaviour)this).IsOwner) { LethalNetworkVariable<float> obj = hungerValue; obj.Value += Time.deltaTime * 0.09f; } else if (isSeenPlayer && isTargetAvailable && ((NetworkBehaviour)this).IsOwner) { LethalNetworkVariable<float> obj2 = hungerValue; obj2.Value += Time.deltaTime; } } if (hungerValue.Value > 55f && hungerValue.Value < 60f) { voiceAudio.pitch = Mathf.Lerp(voiceAudio.pitch, 1f, 45f * Time.deltaTime); voiceAudio.volume = Mathf.Lerp(voiceAudio.volume, 1f, 125f * Time.deltaTime); voiceAudio.loop = true; voiceAudio.clip = Plugin.stomachGrowl; if (!voiceAudio.isPlaying) { voiceAudio.Play(); } } else if (hungerValue.Value < 63f && hungerValue.Value >= 60f && !isEnraging) { voiceAudio.pitch = Mathf.Lerp(voiceAudio.pitch, 0.8f, 45f * Time.deltaTime); voiceAudio.volume = Mathf.Lerp(voiceAudio.volume, 1f, 125f * Time.deltaTime); isEnraging = true; voiceAudio.clip = Plugin.bigGrowl; if (!voiceAudio.isPlaying) { voiceAudio.Play(); } } else if (hungerValue.Value < 63f && hungerValue.Value > 60f && isEnraging) { voiceAudio.pitch = Mathf.Lerp(voiceAudio.pitch, 1f, 45f * Time.deltaTime); voiceAudio.volume = Mathf.Lerp(voiceAudio.volume, 1f, 125f * Time.deltaTime); if (!isNearestItem) { canBeMoved = false; } } else if (hungerValue.Value < 55f) { voiceAudio.pitch = Mathf.Lerp(voiceAudio.pitch, 0f, 45f * Time.deltaTime); voiceAudio.volume = Mathf.Lerp(voiceAudio.volume, 0f, 125f * Time.deltaTime); } else if (hungerValue.Value > 63f && !isAngered) { if (!isNearestItem && !isKillingPlayer && base.stunNormalizedTimer <= 0f) { canBeMoved = true; } voiceAudio.clip = Plugin.enragedScream; voiceAudio.Play(); isEnraging = false; isAngered = true; } else if (hungerValue.Value > 65f) { base.openDoorSpeedMultiplier = 1.5f; isRunning = true; voice2Audio.volume = Mathf.Lerp(voice2Audio.volume, 1f, 125f * Time.deltaTime); } else if (hungerValue.Value > 63f) { voiceAudio.pitch = Mathf.Lerp(voiceAudio.pitch, 0.8f, 45f * Time.deltaTime); mouth.localScale = Vector3.Lerp(mouth.localScale, new Vector3(0.005590725f, 0.01034348f, 0.02495567f), 30f * Time.deltaTime); } if (hungerValue.Value < 60f) { isEnraging = false; isAngered = false; if (!isNearestItem && !isKillingPlayer && base.stunNormalizedTimer <= 0f) { canBeMoved = true; } } if (hungerValue.Value < 66f) { isRunning = false; base.openDoorSpeedMultiplier = 0.3f; } if (hungerValue.Value < 63f) { mouth.localScale = Vector3.Lerp(mouth.localScale, originalMouthScale, 20f * Time.deltaTime); voice2Audio.volume = Mathf.Lerp(voice2Audio.volume, 0f, 125f * Time.deltaTime); isRunning = false; } if (hungerValue.Value > 64f && networkTargetPlayerDistance < 2f && !isKillingPlayer && networkTargetPlayer.Value != 123456 && LethalNetworkExtensions.GetPlayerController(networkTargetPlayer.Value).isCameraDisabled) { KillingPlayerBool.Value = true; } if (KillingPlayerBool.Value && networkTargetPlayer.Value != 123456) { if (!LethalNetworkExtensions.GetPlayerController(networkTargetPlayer.Value).isCameraDisabled) { ((MonoBehaviour)this).StartCoroutine(KillPlayer(LethalNetworkExtensions.GetPlayerController(networkTargetPlayer.Value))); KillingPlayerBool.Value = false; } else if (LethalNetworkExtensions.GetPlayerController(networkTargetPlayer.Value).isCameraDisabled) { ((MonoBehaviour)this).StartCoroutine(KillPlayerInOtherClient(LethalNetworkExtensions.GetPlayerController(networkTargetPlayer.Value))); } } if (isKillingPlayer) { canBeMoved = false; } } private void EatItem() { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_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_0089: 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) //IL_009f: 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_00bf: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)nearestDroppedItem != (Object)null) { if (isNearestItem && !nearestDroppedItem.GetComponent<GrabbableObject>().isHeld) { if (hungerValue.Value < 55f) { lookRay = new Ray(dogHead.position, nearestDroppedItem.transform.position - dogHead.position); lookTarget.position = Vector3.Lerp(lookTarget.position, ((Ray)(ref lookRay)).GetPoint(1.8f), 6f * Time.deltaTime); } else { lookTarget.position = Vector3.Lerp(lookTarget.position, nearestDroppedItem.transform.position, 6f * Time.deltaTime); } if (((Behaviour)base.agent).enabled && ((NetworkBehaviour)this).IsOwner) { base.agent.SetDestination(nearestDroppedItem.transform.position); } nearestItemDistance = Vector3.Distance(((Component)this).transform.position, nearestDroppedItem.transform.position); if (nearestItemDistance < 1.35f) { canBeMoved = false; isRunning = false; nearestDroppedItem.transform.SetParent(((Component)this).transform, true); if ((Object)(object)nearestDroppedItem.GetComponent<LungProp>() != (Object)null) { satisfyValue += 30f; if (((NetworkBehaviour)this).IsOwner) { LethalNetworkVariable<float> obj = hungerValue; obj.Value -= 50f; } ateLung = true; ((Behaviour)nearestDroppedItem.GetComponentInChildren<Light>()).enabled = false; } else if ((Object)(object)nearestDroppedItem.GetComponent<StunGrenadeItem>() != (Object)null) { StunGrenadeItem component = nearestDroppedItem.GetComponent<StunGrenadeItem>(); component.hasExploded = true; ((MonoBehaviour)this).StartCoroutine(EatenFlashbang()); } base.creatureAnimator.SetTrigger("eat"); mainAudio.PlayOneShot(Plugin.dogEatItem); isNearestItem = false; nearestItemDistance = 500f; if (nearestDroppedItem.GetComponent<GrabbableObject>().itemProperties.weight > 1f) { satisfyValue += Mathf.Clamp(nearestDroppedItem.GetComponent<GrabbableObject>().itemProperties.weight - 1f, 0f, 100f) * 150f; if (((NetworkBehaviour)this).IsOwner) { LethalNetworkVariable<float> obj2 = hungerValue; obj2.Value -= Mathf.Clamp(nearestDroppedItem.GetComponent<GrabbableObject>().itemProperties.weight - 1f, 0f, 100f) * 230f; } } else { satisfyValue += 6f; if (((NetworkBehaviour)this).IsOwner) { LethalNetworkVariable<float> obj3 = hungerValue; obj3.Value -= 12f; } } GrabbableObject component2 = nearestDroppedItem.GetComponent<GrabbableObject>(); component2.grabbable = false; component2.grabbableToEnemies = false; component2.deactivated = true; if ((Object)(object)component2.radarIcon != (Object)null) { Object.Destroy((Object)(object)((Component)component2.radarIcon).gameObject); } MeshRenderer[] componentsInChildren = ((Component)component2).gameObject.GetComponentsInChildren<MeshRenderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)componentsInChildren[i]); } Collider[] componentsInChildren2 = ((Component)component2).gameObject.GetComponentsInChildren<Collider>(); for (int j = 0; j < componentsInChildren2.Length; j++) { Object.Destroy((Object)(object)componentsInChildren2[j]); } droppedItems.Remove(nearestDroppedItem); nearestDroppedItem = null; } else if (!isKillingPlayer && base.stunNormalizedTimer <= 0f) { canBeMoved = true; } } else if (networkTargetPlayer.Value != 123456 && !isSatisfied) { nearestDroppedItem = null; nearestItemDistance = 3000f; isNearestItem = false; } } if (base.stunNormalizedTimer > 0f) { canBeMoved = false; base.creatureAnimator.SetBool("Stun", true); } else { base.creatureAnimator.SetBool("Stun", false); } } private void CheckTargetAvailable() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) if ((networkTargetPlayerDistance <= 12f || Object.op_Implicit((Object)(object)((EnemyAI)this).CheckLineOfSightForPlayer(40f, 40, -1))) && !isNearestItem && !isKillingPlayer && scaredBackingAway <= 0f) { followTimer = 10f; canBeMoved = true; } if (networkTargetPlayer.Value != 123456) { networkTargetPlayerDistance = Vector3.Distance(((Component)this).transform.position, ((Component)LethalNetworkExtensions.GetPlayerController(networkTargetPlayer.Value)).transform.position); } else { networkTargetPlayerDistance = 3000f; } if ((followTimer > 0f || networkTargetPlayerDistance < 10f) && !isSatisfied && isTargetAvailable && scaredBackingAway <= 0f && !isNearestItem && ((Behaviour)base.agent).enabled && ((NetworkBehaviour)this).IsOwner) { if (networkTargetPlayerDistance > 2.1f) { base.agent.SetDestination(((Component)LethalNetworkExtensions.GetPlayerController(networkTargetPlayer.Value)).transform.position); } else if (hungerValue.Value < 55f) { BackAway(); } } if (((networkTargetPlayer.Value != 123456 && networkTargetPlayerDistance > 12f) || !Object.op_Implicit((Object)(object)((EnemyAI)this).CheckLineOfSightForPlayer(40f, 30, -1))) && followTimer > 0f) { followTimer -= Time.deltaTime; } if (networkTargetPlayer.Value == 123456) { followTimer = 10f; } if (followTimer <= 0f) { networkTargetPlayer.Value = 123456uL; isTargetAvailable = false; } } private bool IsPlayerVisible(PlayerControllerB player) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)player).transform.position - ((Component)this).transform.position; float num = Vector3.Angle(((Component)this).transform.forward, val); if (num < 35f && Physics.Raycast(((Component)this).transform.position, val, 120f, LayerMask.NameToLayer("Player"))) { return true; } return false; } private void FindNearestItem() { //IL_001f: 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) foreach (GameObject droppedItem in droppedItems) { float num = Vector3.Distance(((Component)this).transform.position, droppedItem.transform.position); if (num < float.PositiveInfinity && num < 30f && !droppedItem.GetComponent<GrabbableObject>().isHeld) { nearestDroppedItem = droppedItem; isNearestItem = true; return; } } isNearestItem = false; } public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot = 0, int noiseID = 0) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_00a5: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID); float num = Vector3.Distance(noisePosition, ((Component)this).transform.position); if (!(num > 15f)) { if (Physics.Linecast(base.eye.position, noisePosition, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { noiseLoudness /= 2f; } if (!((double)(noiseLoudness / num) <= 0.045) && timeSinceLookingAtNoise > 5f) { timeSinceLookingAtNoise = 0f; lookAtNoise = noisePosition; } } } private void BackAway() { //IL_001b: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_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_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_0272: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) base.agent.destination = ((Component)LethalNetworkExtensions.GetPlayerController(networkTargetPlayer.Value)).transform.position; Vector3 position = ((Component)LethalNetworkExtensions.GetPlayerController(networkTargetPlayer.Value)).transform.position; position.y = ((Component)this).transform.position.y; Vector3 val = position - ((Component)this).transform.position; backAwayRay = new Ray(((Component)this).transform.position, val * -1f); if (Physics.Raycast(backAwayRay, ref hitInfo, 60f, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { if (((RaycastHit)(ref hitInfo)).distance < 4f) { if (Physics.Linecast(((Component)this).transform.position, ((RaycastHit)(ref hitInfo)).point + Vector3.Cross(val, Vector3.up) * 25.5f, ref hitInfoB, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { float distance = ((RaycastHit)(ref hitInfoB)).distance; if (Physics.Linecast(((Component)this).transform.position, ((RaycastHit)(ref hitInfo)).point + Vector3.Cross(val, Vector3.up) * -25.5f, ref hitInfoB, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { float distance2 = ((RaycastHit)(ref hitInfoB)).distance; if (Mathf.Abs(distance - distance2) < 5f) { base.agent.destination = ((RaycastHit)(ref hitInfo)).point + Vector3.Cross(val, Vector3.up) * -4.5f; } else if (distance < distance2) { base.agent.destination = ((RaycastHit)(ref hitInfo)).point + Vector3.Cross(val, Vector3.up) * -4.5f; } else { base.agent.destination = ((RaycastHit)(ref hitInfo)).point + Vector3.Cross(val, Vector3.up) * 4.5f; } } } } else { base.agent.destination = ((RaycastHit)(ref hitInfo)).point; } } else { base.agent.destination = ((Ray)(ref backAwayRay)).GetPoint(2.3f); } base.agent.stoppingDistance = 0.2f; Quaternion val2 = Quaternion.Slerp(((Component)this).transform.rotation, Quaternion.LookRotation(val), 3f * Time.deltaTime); ((Component)this).transform.eulerAngles = new Vector3(0f, ((Quaternion)(ref val2)).eulerAngles.y, 0f); base.agent.speed = 8f; base.creatureAnimator.SetFloat("walkSpeed", -2.2f); } private IEnumerator EatenFlashbang() { yield return (object)new WaitForSeconds(2f); mainAudio.PlayOneShot(Plugin.eatenExplode); } private void KillPlayerTrigger(PlayerControllerB killPlayer) { if (!killPlayer.isCameraDisabled) { ((MonoBehaviour)this).StartCoroutine(KillPlayer(killPlayer)); } else { ((MonoBehaviour)this).StartCoroutine(KillPlayerInOtherClient(killPlayer)); } } private IEnumerator KillPlayer(PlayerControllerB killPlayer) { hungerValue.Value = 0f; yield return (object)new WaitForSeconds(0.05f); isKillingPlayer = true; base.creatureAnimator.SetTrigger("RipObject"); mainAudio.PlayOneShot(Plugin.ripPlayerApart); if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)killPlayer) { killPlayer.KillPlayer(Vector3.zero, true, (CauseOfDeath)6, 0); } yield return (object)new WaitForSeconds(0.1f); if ((Object)(object)killPlayer.deadBody == (Object)null) { Debug.Log((object)"Shrimp: Player body was not spawned or found within 0.5 seconds."); killPlayer.inAnimationWithEnemy = null; isKillingPlayer = false; KillingPlayerBool.Value = false; } else { TakeBodyInMouth(killPlayer.deadBody); yield return (object)new WaitForSeconds(4.4f); base.creatureAnimator.SetTrigger("eat"); mainAudio.PlayOneShot(Plugin.dogEatItem); ((Component)killPlayer.deadBody).gameObject.SetActive(false); yield return (object)new WaitForSeconds(2f); isKillingPlayer = false; } } private IEnumerator KillPlayerInOtherClient(PlayerControllerB killPlayer) { hungerValue.Value = 0f; yield return (object)new WaitForSeconds(0.05f); isKillingPlayer = true; base.creatureAnimator.SetTrigger("RipObject"); mainAudio.PlayOneShot(Plugin.ripPlayerApart); yield return (object)new WaitForSeconds(0.1f); if ((Object)(object)killPlayer.deadBody == (Object)null) { Debug.Log((object)"Shrimp: Player body was not spawned or found within 0.5 seconds."); killPlayer.inAnimationWithEnemy = null; isKillingPlayer = false; KillingPlayerBool.Value = false; } else { TakeBodyInMouth(killPlayer.deadBody); yield return (object)new WaitForSeconds(4.4f); base.creatureAnimator.SetTrigger("eat"); mainAudio.PlayOneShot(Plugin.dogEatItem); ((Component)killPlayer.deadBody).gameObject.SetActive(false); yield return (object)new WaitForSeconds(2f); isKillingPlayer = false; } } private void TakeBodyInMouth(DeadBodyInfo body) { body.attachedTo = bittenObjectHolder; body.attachedLimb = body.bodyParts[5]; body.matchPositionExactly = true; } private void SetupBehaviour() { roamingState.name = "Roaming"; roamingState.boolValue = true; followingPlayer.name = "Following"; followingPlayer.boolValue = true; enragedState.name = "Enraged"; enragedState.boolValue = true; } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatch { [HarmonyPrefix] [HarmonyPatch("Start")] private static void Start_Prefix(Terminal __instance, ref List<TerminalNode> ___enemyFiles) { ___enemyFiles.Add(Plugin.shrimpTerminalNode); TerminalKeyword defaultVerb = __instance.terminalNodes.allKeywords.First((TerminalKeyword x) => x.word == "info"); TerminalKeyword shrimpTerminalKeyword = Plugin.shrimpTerminalKeyword; shrimpTerminalKeyword.defaultVerb = defaultVerb; } } public class AnotherInterior : MonoBehaviour { public RuntimeDungeon dungeonGenerator; private void Awake() { dungeonGenerator = ((Component)this).GetComponent<RuntimeDungeon>(); dungeonGenerator.Generator.currentArchetype = Plugin.officeArchetype_A; dungeonGenerator.Generator.DungeonFlow = Plugin.officeDungeonFlow_A; } private void Start() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown RoundManager instance = RoundManager.Instance; Vector3 position = GameObject.Find("LevelGenerationRoot").transform.position; GameObject root = Object.Instantiate<GameObject>(new GameObject(), new Vector3(position.x - 130f, position.y, position.z - 130f), Quaternion.Euler(0f, 0f, 0f)); dungeonGenerator.Root = root; dungeonGenerator.Generator.ShouldRandomizeSeed = false; dungeonGenerator.Generator.Seed = instance.LevelRandom.Next(); Debug.Log((object)$"GenerateNewFloor(). Map generator's random seed: {dungeonGenerator.Generator.Seed}"); float lengthMultiplier = instance.currentLevel.factorySizeMultiplier * instance.mapSizeMultiplier; dungeonGenerator.Generator.LengthMultiplier = lengthMultiplier; dungeonGenerator.Generator.currentArchetype = Plugin.officeArchetype_A; dungeonGenerator.Generator.DungeonFlow = Plugin.officeDungeonFlow_A; if ((Object)(object)dungeonGenerator.Generator.currentArchetype == (Object)(object)Plugin.officeArchetype_A && (Object)(object)dungeonGenerator.Generator.DungeonFlow == (Object)(object)Plugin.officeDungeonFlow_A) { dungeonGenerator.Generate(); } } private void FixedUpdate() { dungeonGenerator.Generator.currentArchetype = Plugin.officeArchetype_A; dungeonGenerator.Generator.DungeonFlow = Plugin.officeDungeonFlow_A; } } public class CameraCulling : MonoBehaviour { public Transform player; public Camera camera; public Transform cullPos; public float fps = 25f; private float elapsed; private void Start() { player = ((Component)StartOfRound.Instance.localPlayerController).transform; camera = ((Component)this).GetComponent<Camera>(); ((Behaviour)camera).enabled = false; cullPos = GameObject.Find("FacilityCameraMonitor").transform; fps = 20f; } private void Update() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { return; } float num = Vector3.Distance(cullPos.position, player.position); if (num <= 10f) { elapsed += Time.deltaTime; if (elapsed > 1f / fps) { elapsed = 0f; camera.Render(); } } } } public class TrapRoomTrigger : NetworkBehaviour { public LethalClientMessage<bool> SendTrapFloorTrigger = new LethalClientMessage<bool>("SendTrapFloorTrigger", (Action<bool>)null, (Action<bool, ulong>)null); public LethalClientMessage<bool> SendTrapDeactivate = new LethalClientMessage<bool>("SendTrapDeactivate", (Action<bool>)null, (Action<bool, ulong>)null); public AudioSource floorAudioSource; public AudioSource floorAudioSource2; public AudioSource doorAudioSource; public Animator roomAnimator; public bool isPlayed; public bool isPlayedOnce; public bool isDeactivated; public PlayerControllerB[] players; public float Timer; private void SendTrapFloorTriggerSync(bool value, ulong id) { if (value && !isPlayed) { isPlayed = true; } else if (!value && isPlayed) { isPlayed = false; } } private void SendTrapDeactivateSync(bool value, ulong id) { if (value && !isDeactivated) { isDeactivated = true; } else if (!value && isDeactivated) { isDeactivated = false; } } private void Start() { SendTrapFloorTrigger.OnReceivedFromClient += SendTrapFloorTriggerSync; SendTrapDeactivate.OnReceivedFromClient += SendTrapDeactivateSync; roomAnimator = GameObject.Find("TrapDoorAnimator").GetComponent<Animator>(); floorAudioSource = GameObject.Find("Floor1").GetComponent<AudioSource>(); floorAudioSource2 = GameObject.Find("Floor2").GetComponent<AudioSource>(); doorAudioSource = GameObject.Find("DoorSlam").GetComponent<AudioSource>(); ((UnityEvent<PlayerControllerB>)(object)GameObject.Find("TrapTrigger").GetComponent<InteractTrigger>().onInteract).AddListener((UnityAction<PlayerControllerB>)TriggerTrap); ((UnityEvent<PlayerControllerB>)(object)GameObject.Find("IgnoreFallDamagePlayer").GetComponent<InteractTrigger>().onInteract).AddListener((UnityAction<PlayerControllerB>)IgnoreFallDamage); ((UnityEvent<PlayerControllerB>)(object)((Component)this).GetComponent<TerminalAccessibleObject>().terminalCodeEvent).AddListener((UnityAction<PlayerControllerB>)DeactivateTrap); } private void Update() { if (isPlayed && !isPlayedOnce && !isDeactivated) { ((MonoBehaviour)this).StartCoroutine(ActivateTrap()); isPlayed = false; isPlayedOnce = true; } if (!isPlayed && isDeactivated && isPlayedOnce) { ((MonoBehaviour)this).StartCoroutine(DeactivateTrapCoroutine()); isDeactivated = false; } } public void TriggerTrap(PlayerControllerB playerControllerB) { SendTrapFloorTrigger.SendAllClients(true, true, false); } public void IgnoreFallDamage(PlayerControllerB playerControllerB) { playerControllerB.fallValue -= 5f; } public void DeactivateTrap(PlayerControllerB playerControllerB) { SendTrapDeactivate.SendAllClients(true, true, false); } private IEnumerator ActivateTrap() { roomAnimator.SetBool("open", true); doorAudioSource.PlayOneShot(Plugin.garageDoorSlam); yield return (object)new WaitForSeconds(3f); doorAudioSource.PlayOneShot(Plugin.floorOpen); } private IEnumerator DeactivateTrapCoroutine() { roomAnimator.SetBool("unlock", true); doorAudioSource.PlayOneShot(Plugin.floorClose); yield return (object)new WaitForSeconds(1f); doorAudioSource.PlayOneShot(Plugin.garageSlide); } } public class ElevatorMusic : MonoBehaviour { public AudioSource audioSource; public int currentMusic; public float musicPlayTimer; private void Start() { audioSource = ((Component)this).GetComponent<AudioSource>(); audioSource.PlayOneShot(Plugin.bossaLullaby); musicPlayTimer = 0f; currentMusic = 1; audioSource.volume = 0.4f * (Plugin.musicVolume / 100f); } private void Update() { if (audioSource.isPlaying) { return; } musicPlayTimer += Time.deltaTime; if (musicPlayTimer > 0.5f) { if (currentMusic == 0) { audioSource.PlayOneShot(Plugin.bossaLullaby); musicPlayTimer = 0f; currentMusic++; } else if (currentMusic == 1) { audioSource.PlayOneShot(Plugin.shopTheme); musicPlayTimer = 0f; currentMusic++; } else if (currentMusic == 2) { audioSource.PlayOneShot(Plugin.saferoomTheme); musicPlayTimer = 0f; currentMusic = 0; } } } } public class ElevatorCollider : NetworkBehaviour { public Bounds checkBounds; public LethalClientMessage<bool> SendInElevator = new LethalClientMessage<bool>("SendInElevator", (Action<bool>)null, (Action<bool, ulong>)IsInElevatorSync); public List<BoxCollider> allColliders = new List<BoxCollider>(); public List<GameObject> bottomDoors = new List<GameObject>(); public bool bottomIsAlive; public Transform storageParent; public Transform lungPlacement; public Transform colliderPos; public Transform elevatorTransform; public ConstraintSource constraintSource; public ElevatorSystem elevatorSystem; public Vector3 tempTargetFloorPosition; public Vector3 tempStartFallingPosition; private static void IsInElevatorSync(bool value, ulong id) { if (value) { ((Component)LethalNetworkExtensions.GetPlayerController(id)).GetComponent<PlayerElevatorCheck>().wasInElevator = true; ((Component)LethalNetworkExtensions.GetPlayerController(id)).GetComponent<PlayerElevatorCheck>().isInElevatorNotOwner = true; } else { ((Component)LethalNetworkExtensions.GetPlayerController(id)).GetComponent<PlayerElevatorCheck>().isInElevatorNotOwner = false; } } private void Start() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) bottomDoors.Add(GameObject.Find("OfficeBtmDoor1")); bottomDoors.Add(GameObject.Find("OfficeBtmDoor2")); bottomDoors.Add(GameObject.Find("OfficeBtmDoor3")); bottomDoors.Add(GameObject.Find("OfficeBtmDoor4")); elevatorTransform = GameObject.Find("StartRoomElevator").transform; ((Bounds)(ref checkBounds)).size = new Vector3(4.9f, 17f, 4.9f); GameObject[] allPlayerObjects = StartOfRound.Instance.allPlayerObjects; foreach (GameObject val in allPlayerObjects) { allColliders.Add(val.GetComponent<BoxCollider>()); } colliderPos = GameObject.Find("InsideColliderPos").transform; if (GameObject.Find("OfficeTopDoor").transform.childCount == 0 || ((Object)GameObject.Find("OfficeTopDoor").transform.GetChild(0)).name != "OfficeDoorBlocker(Clone)") { Object.Destroy((Object)(object)GameObject.Find("NotionUpOff")); } else { Object.Destroy((Object)(object)GameObject.Find("NotionUpOn")); } if (GameObject.Find("OfficeMidDoor").transform.childCount == 0 || ((Object)GameObject.Find("OfficeMidDoor").transform.GetChild(0)).name != "OfficeDoorBlocker(Clone)") { Object.Destroy((Object)(object)GameObject.Find("NotionMidOff")); } else { Object.Destroy((Object)(object)GameObject.Find("NotionMidOn")); } foreach (GameObject bottomDoor in bottomDoors) { if (bottomDoor.transform.childCount > 0 && ((Object)bottomDoor.transform.GetChild(0)).name != "OfficeDoorBlocker(Clone)") { bottomIsAlive = true; } if (bottomDoor.transform.childCount == 0) { bottomIsAlive = true; } } if (bottomIsAlive) { Object.Destroy((Object)(object)GameObject.Find("NotionDownOff")); } else { Object.Destroy((Object)(object)GameObject.Find("NotionDownOn")); } } private void Update() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) if (!OfficeRoundSystem.Instance.isOffice) { return; } if ((Object)(object)colliderPos != (Object)null) { ((Component)this).transform.position = colliderPos.position; ((Component)this).transform.rotation = colliderPos.rotation; ((Bounds)(ref checkBounds)).center = colliderPos.position; } else { colliderPos = GameObject.Find("InsideColliderPos").transform; } if ((Object)(object)storageParent == (Object)null && (Object)(object)GameObject.Find("ElevatorStorage(Clone)") != (Object)null) { storageParent = GameObject.Find("ElevatorStorage(Clone)").transform; } if ((Object)(object)elevatorSystem == (Object)null) { elevatorSystem = Object.FindObjectOfType<ElevatorSystem>(); ItemElevatorCheck[] array = Object.FindObjectsOfType<ItemElevatorCheck>(); foreach (ItemElevatorCheck itemElevatorCheck in array) { itemElevatorCheck.elevatorCollider = this; } } allColliders.RemoveAll((BoxCollider item) => (Object)(object)item == (Object)null || !((Component)item).gameObject.activeInHierarchy); foreach (BoxCollider allCollider in allColliders) { if (((Bounds)(ref checkBounds)).Intersects(((Collider)allCollider).bounds)) { if (((Component)allCollider).gameObject.tag == "Player") { PlayerControllerB component = ((Component)allCollider).GetComponent<PlayerControllerB>(); PlayerElevatorCheck component2 = ((Component)allCollider).GetComponent<PlayerElevatorCheck>(); if ((Object)(object)component2.elevatorCollider == (Object)null) { component2.elevatorCollider = this; } if (!((Component)allCollider).GetComponent<PlayerElevatorCheck>().isInElevatorB && !component.isCameraDisabled && !StartOfRound.Instance.shipIsLeaving) { ((Component)allCollider).transform.SetParent(((Component)this).transform); SendInElevator.SendAllClients(true, true, false); component2.wasInElevator = true; component2.isInElevatorB = true; } } else if (((Component)allCollider).gameObject.tag == "PhysicsProp") { GrabbableObject component3 = ((Component)allCollider).GetComponent<GrabbableObject>(); ItemElevatorCheck component4 = ((Component)allCollider).GetComponent<ItemElevatorCheck>(); if ((Object)(object)component3.playerHeldBy != (Object)null && ((Component)component3.playerHeldBy).GetComponent<PlayerElevatorCheck>().isInElevatorB && component3.isHeld) { tempTargetFloorPosition = ((Component)component3.playerHeldBy).transform.localPosition; tempStartFallingPosition = ((Component)component3.playerHeldBy).transform.parent.InverseTransformPoint(((Component)component3).transform.position); } if (!component4.isInElevatorB && !component3.isHeld && (Object)(object)((Component)allCollider).transform.parent != (Object)(object)storageParent) { component4.isInElevatorB = true; ((Component)allCollider).transform.SetParent(((Component)this).transform, true); component3.targetFloorPosition = tempTargetFloorPosition; component3.startFallingPosition = tempStartFallingPosition; } } continue; } if (((Component)allCollider).gameObject.tag == "Player") { if (((Component)allCollider).GetComponent<PlayerElevatorCheck>().isInElevatorB) { ((Component)allCollider).transform.SetParent(StartOfRound.Instance.playersContainer, true); SendInElevator.SendAllClients(false, true, false); ((Component)allCollider).GetComponent<PlayerElevatorCheck>().isInElevatorB = false; } else if (((Component)allCollider).GetComponent<PlayerElevatorCheck>().isInElevatorB && ((Component)allCollider).GetComponent<PlayerControllerB>().isCameraDisabled && !((Component)allCollider).GetComponent<PlayerElevatorCheck>().isInElevatorNotOwner) { ((Component)allCollider).transform.SetParent((Transform)null, true); ((Component)allCollider).GetComponent<PlayerElevatorCheck>().isInElevatorB = false; } } if ((Object)(object)((Component)allCollider).GetComponent<PlayerControllerB>() != (Object)null) { PlayerControllerB component5 = ((Component)allCollider).GetComponent<PlayerControllerB>(); PlayerElevatorCheck component6 = ((Component)allCollider).GetComponent<PlayerElevatorCheck>(); if (!component6.isInElevatorB && component5.isCameraDisabled && component6.isInElevatorNotOwner) { ((Component)allCollider).transform.SetParent(((Component)this).transform, true); component6.isInElevatorB = true; component6.wasInElevator = true; } else if (component6.isInElevatorB && component5.isCameraDisabled && !component6.isInElevatorNotOwner) { ((Component)allCollider).transform.SetParent((Transform)null, true); component6.isInElevatorB = false; } } } } } public class ElevatorSystem : NetworkBehaviour { public static LethalNetworkVariable<int> elevatorFloor = new LethalNetworkVariable<int>("elevatorFloor"); public static bool isElevatorClosed; public float elevatorTimer; public static LethalNetworkVariable<bool> spawnShrimpBool = new LethalNetworkVariable<bool>("spawnShrimpBool"); public static LethalClientEvent ElevatorUpTriggerEvent = new LethalClientEvent("elevatorUpTriggerEvent", (Action)null, (Action<ulong>)ElevatorTriggerUp); public static LethalClientEvent ElevatorMidTriggerEvent = new LethalClientEvent("elevatorMidTriggerEvent", (Action)null, (Action<ulong>)ElevatorTriggerMid); public static LethalClientEvent ElevatorDownTriggerEvent = new LethalClientEvent("elevatorDownTriggerEvent", (Action)null, (Action<ulong>)ElevatorTriggerDown); public static List<InteractTrigger> upButtons = new List<InteractTrigger>(); public static List<InteractTrigger> midButtons = new List<InteractTrigger>(); public static List<InteractTrigger> downButtons = new List<InteractTrigger>(); public static Animator doorAnimator; public Animator elevatorScreenDoorAnimator; public static Animator animator; public AudioSource audioSource; public static List<Animator> panelAnimators = new List<Animator>(); public List<Animator> buttonLightAnimators = new List<Animator>(); public bool performanceCheck; public GameObject storageObject; public Transform storagePos; public static bool isSetupEnd; private void Start() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) spawnShrimpBool.Value = false; ((Component)this).transform.position = new Vector3(0f, 200f, 0f); isSetupEnd = false; } private void LateUpdate() { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_0593: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_06fe: Unknown result type (might be due to invalid IL or missing references) //IL_0703: Unknown result type (might be due to invalid IL or missing references) //IL_0746: Unknown result type (might be due to invalid IL or missing references) //IL_074b: Unknown result type (might be due to invalid IL or missing references) //IL_07c9: Unknown result type (might be due to invalid IL or missing references) //IL_07ce: Unknown result type (might be due to invalid IL or missing references) //IL_0811: Unknown result type (might be due to invalid IL or missing references) //IL_0816: Unknown result type (might be due to invalid IL or missing references) //IL_0894: Unknown result type (might be due to invalid IL or missing references) //IL_0899: Unknown result type (might be due to invalid IL or missing references) //IL_08dc: Unknown result type (might be due to invalid IL or missing references) //IL_08e1: Unknown result type (might be due to invalid IL or missing references) if (!TimeOfDay.Instance.currentDayTimeStarted && ((NetworkBehaviour)this).IsServer) { if (panelAnimators.Count != 0) { panelAnimators.Clear(); } isSetupEnd = false; Object.Destroy((Object)(object)((Component)this).gameObject); } else { Setup(); } if (!OfficeRoundSystem.Instance.isOffice) { return; } if ((Object)(object)storageObject == (Object)null) { storageObject = GameObject.Find("ElevatorStorage(Clone)"); } else { storageObject.transform.position = storagePos.position; } if ((Object)(object)storagePos == (Object)null) { storagePos = GameObject.Find("SpawnStorage").transform; } AnimatorStateInfo currentAnimatorStateInfo; if (isElevatorClosed) { if (doorAnimator.GetBool("closed")) { audioSource.PlayOneShot(Plugin.ElevatorClose); } elevatorScreenDoorAnimator.SetBool("open", false); doorAnimator.SetBool("closed", false); } else { if (!doorAnimator.GetBool("closed")) { audioSource.PlayOneShot(Plugin.ElevatorOpen); } if (elevatorFloor.Value == 1) { currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime > 0.4f) { currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0); if (((AnimatorSt
BepInEx/plugins/LethalPresents.dll
Decompiled 4 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On; 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("LethalPresents")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("LethalPresents mod")] [assembly: AssemblyFileVersion("1.0.4.0")] [assembly: AssemblyInformationalVersion("1.0.4")] [assembly: AssemblyProduct("LethalPresents")] [assembly: AssemblyTitle("LethalPresents")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalPresents { [BepInPlugin("LethalPresents", "LethalPresents", "1.0.4")] public class LethalPresentsPlugin : BaseUnityPlugin { public static ManualLogSource mls; private static int spawnChance = 5; private static string[] disabledEnemies = new string[0]; private static bool IsAllowlist = false; private static bool ShouldSpawnMines = false; private static bool ShouldSpawnTurrets = false; private static bool ShouldSpawnBees = false; private static bool isHost => ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost; private static SelectableLevel currentLevel => RoundManager.Instance.currentLevel; internal static T GetPrivateField<T>(object instance, string fieldName) { FieldInfo field = instance.GetType().GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic); return (T)field.GetValue(instance); } private void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown mls = Logger.CreateLogSource("LethalPresents"); mls.LogInfo((object)"Plugin LethalPresents is loaded!"); loadConfig(); RoundManager.AdvanceHourAndSpawnNewBatchOfEnemies += new hook_AdvanceHourAndSpawnNewBatchOfEnemies(updateCurrentLevelInfo); GiftBoxItem.OpenGiftBoxServerRpc += new hook_OpenGiftBoxServerRpc(spawnRandomEntity); } private void updateCurrentLevelInfo(orig_AdvanceHourAndSpawnNewBatchOfEnemies orig, RoundManager self) { orig.Invoke(self); mls.LogInfo((object)"List of spawnable enemies (inside):"); currentLevel.Enemies.ForEach(delegate(SpawnableEnemyWithRarity e) { mls.LogInfo((object)((Object)e.enemyType).name); }); mls.LogInfo((object)"List of spawnable enemies (outside):"); currentLevel.OutsideEnemies.ForEach(delegate(SpawnableEnemyWithRarity e) { mls.LogInfo((object)((Object)e.enemyType).name); }); } private void loadConfig() { spawnChance = ((BaseUnityPlugin)this).Config.Bind<int>("General", "SpawnChance", 5, "Chance of spawning an enemy when opening a present [0-100]").Value; disabledEnemies = ((BaseUnityPlugin)this).Config.Bind<string>("General", "EnemyBlocklist", "", "Enemy blocklist separated by , and without whitespaces").Value.Split(","); IsAllowlist = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "IsAllowlist", false, "Turns blocklist into allowlist, blocklist must contain at least one inside and one outside enemy, use at your own risk").Value; ShouldSpawnMines = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShouldSpawnMines", true, "Add mines to the spawn pool").Value; ShouldSpawnTurrets = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShouldSpawnTurrets", true, "Add turrets to the spawn pool").Value; if (IsAllowlist) { mls.LogInfo((object)"Only following enemies can spawn from the gift:"); } else { mls.LogInfo((object)"Following enemies wont be spawned from the gift:"); } string[] array = disabledEnemies; foreach (string text in array) { mls.LogInfo((object)text); } } private void spawnRandomEntity(orig_OpenGiftBoxServerRpc orig, GiftBoxItem self) { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)self).NetworkManager; if (networkManager == null || !networkManager.IsListening) { orig.Invoke(self); return; } int privateField = GetPrivateField<int>(self, "__rpc_exec_stage"); mls.LogInfo((object)("IsServer:" + networkManager.IsServer + " IsHost:" + networkManager.IsHost + " __rpc_exec_stage:" + privateField)); if (privateField != 1 || !isHost) { orig.Invoke(self); return; } int num = Random.Range(1, 100); mls.LogInfo((object)("Player's fortune:" + num)); if (num >= spawnChance) { orig.Invoke(self); return; } chooseAndSpawnEnemy(((GrabbableObject)self).isInFactory, ((Component)self).transform.position, ((Component)self.previousPlayerHeldBy).transform.position); orig.Invoke(self); } private static void chooseAndSpawnEnemy(bool inside, Vector3 pos, Vector3 player_pos) { //IL_000b: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_033d: 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_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) ManualLogSource obj = mls; Vector3 val = player_pos; obj.LogInfo((object)("Player pos " + ((object)(Vector3)(ref val)).ToString())); List<SpawnableEnemyWithRarity> list = currentLevel.Enemies.Where((SpawnableEnemyWithRarity e) => disabledEnemies.Contains(((Object)e.enemyType).name) ? IsAllowlist : (!IsAllowlist)).ToList(); List<SpawnableEnemyWithRarity> list2 = currentLevel.OutsideEnemies.Where((SpawnableEnemyWithRarity e) => disabledEnemies.Contains(((Object)e.enemyType).name) ? IsAllowlist : (!IsAllowlist)).ToList(); int num = Random.Range(1, 2 + (list2.Count + list.Count) / 2); if (num == 2 && !ShouldSpawnMines) { num = 1; } if (num == 1 && !ShouldSpawnTurrets) { num = 2; } if (num == 2 && !ShouldSpawnMines) { num = 3; } switch (num) { case 1: { SpawnableMapObject[] spawnableMapObjects2 = currentLevel.spawnableMapObjects; foreach (SpawnableMapObject val4 in spawnableMapObjects2) { if (!((Object)(object)val4.prefabToSpawn.GetComponentInChildren<Turret>() == (Object)null)) { pos -= Vector3.up * 1.8f; GameObject val5 = Object.Instantiate<GameObject>(val4.prefabToSpawn, pos, Quaternion.identity); val5.transform.position = pos; Transform transform = val5.transform; val = player_pos - pos; transform.forward = ((Vector3)(ref val)).normalized; val5.GetComponent<NetworkObject>().Spawn(true); ManualLogSource obj3 = mls; val = pos; obj3.LogInfo((object)("Tried spawning a turret at " + ((object)(Vector3)(ref val)).ToString())); break; } } return; } case 2: { SpawnableMapObject[] spawnableMapObjects = currentLevel.spawnableMapObjects; foreach (SpawnableMapObject val2 in spawnableMapObjects) { if (!((Object)(object)val2.prefabToSpawn.GetComponentInChildren<Landmine>() == (Object)null)) { pos -= Vector3.up * 1.8f; GameObject val3 = Object.Instantiate<GameObject>(val2.prefabToSpawn, pos, Quaternion.identity); val3.transform.position = pos; val3.transform.forward = new Vector3(1f, 0f, 0f); val3.GetComponent<NetworkObject>().Spawn(true); ManualLogSource obj2 = mls; val = pos; obj2.LogInfo((object)("Tried spawning a mine at " + ((object)(Vector3)(ref val)).ToString())); break; } } return; } } SpawnableEnemyWithRarity val6; if (inside) { if (list.Count < 1) { mls.LogInfo((object)"Cant spawn enemy - no other enemies present to copy from"); return; } val6 = list[Random.Range(0, list.Count - 1)]; } else { if (list2.Count < 1) { mls.LogInfo((object)"Cant spawn enemy - no other enemies present to copy from"); return; } val6 = list2[Random.Range(0, list2.Count - 1)]; } pos += Vector3.up * 0.25f; ManualLogSource obj4 = mls; string enemyName = val6.enemyType.enemyName; val = pos; obj4.LogInfo((object)("Spawning " + enemyName + " at " + ((object)(Vector3)(ref val)).ToString())); SpawnEnemy(val6, pos, 0f); } private static void SpawnEnemy(SpawnableEnemyWithRarity enemy, Vector3 pos, float rot) { //IL_0006: 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) RoundManager.Instance.SpawnEnemyGameObject(pos, rot, -1, enemy.enemyType); } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalPresents"; public const string PLUGIN_NAME = "LethalPresents"; public const string PLUGIN_VERSION = "1.0.4"; } }
BepInEx/plugins/Locker.dll
Decompiled 4 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Locker.MonoBehaviours; using Locker.NetcodePatcher; using Unity.Netcode; using UnityEngine; using UnityEngine.VFX; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Locker")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Locker")] [assembly: AssemblyCopyright("Copyright © zealsprince 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("335007C9-7068-4DF7-85B3-B406E9795203")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.8.0.0")] [module: UnverifiableCode] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Locker { internal class Assets { public enum LoadStatusCode : ushort { Success, Failed, Exists } public static AssetBundle Bundle; public static Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>(); public static readonly Dictionary<string, string> Manifest = new Dictionary<string, string> { { "locker", "assets/exported/locker/enemies/locker.prefab" }, { "lockerenemy", "assets/exported/locker/enemies/lockerenemy.asset" } }; public static LoadStatusCode Load() { if ((Object)(object)Bundle != (Object)null) { return LoadStatusCode.Exists; } string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Locker"); Bundle = AssetBundle.LoadFromFile(text); if ((Object)(object)Bundle == (Object)null) { Plugin.logger.LogInfo((object)("Failed to load asset bundle from path: " + text)); return LoadStatusCode.Failed; } Plugin.logger.LogInfo((object)("Loaded asset bundle from path: " + text)); string[] allAssetNames = Bundle.GetAllAssetNames(); foreach (string text2 in allAssetNames) { Plugin.logger.LogDebug((object)("Found asset: " + text2)); } foreach (KeyValuePair<string, string> item in Manifest) { Prefabs.Add(item.Key, Bundle.LoadAsset<GameObject>(item.Value)); } return LoadStatusCode.Success; } public static GameObject SpawnPrefab(string name, Vector3 position) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) try { if (Prefabs.ContainsKey(name)) { Plugin.logger.LogDebug((object)("Loading prefab '" + name + "'")); return Object.Instantiate<GameObject>(Prefabs[name], position, Quaternion.identity); } Plugin.logger.LogWarning((object)("Prefab " + name + " not found!")); } catch (Exception ex) when (ex is ArgumentException || ex is NullReferenceException) { Plugin.logger.LogError((object)ex.Message); } return null; } public static GameObject Get(string name) { if (Prefabs.ContainsKey(name)) { return Prefabs[name]; } return null; } } public class Config { public static ConfigEntry<int> LockerSpawnWeight; public static ConfigEntry<string> LockerSpawnLevels; public static void Load() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown LockerSpawnWeight = Plugin.config.Bind<int>("Spawning", "LockerSpawnWeight", 25, new ConfigDescription("What is the chance of the Locker spawning - higher values make it more common", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 300), Array.Empty<object>())); } } [BepInPlugin("com.zealsprince.locker", "Locker", "0.8.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string ModGUID = "com.zealsprince.locker"; public const string ModName = "Locker"; public const string ModVersion = "0.8.0"; public static ManualLogSource logger; public static ConfigFile config; private readonly Harmony harmony = new Harmony("com.zealsprince.locker"); private void Awake() { logger = ((BaseUnityPlugin)this).Logger; config = ((BaseUnityPlugin)this).Config; Config.Load(); if (Assets.Load() != 0) { return; } EnemyType val = Assets.Bundle.LoadAsset<EnemyType>("assets/exported/locker/enemies/lockerenemy.asset"); TerminalNode val2 = Assets.Bundle.LoadAsset<TerminalNode>("assets/exported/locker/enemies/lockerterminalnode.asset"); TerminalKeyword val3 = Assets.Bundle.LoadAsset<TerminalKeyword>("assets/exported/locker/enemies/lockerterminalkeyword.asset"); NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); Enemies.RegisterEnemy(val, Config.LockerSpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, val2, val3); try { 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); } } } } catch (Exception) { } harmony.PatchAll(); } } } namespace Locker.Patches { [HarmonyPatch(typeof(HUDManager))] internal class HUDManagerPatches { [HarmonyPostfix] [HarmonyPatch("PingScan_performed")] private static void InterruptChargeItem() { if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { LockerAI[] array = Object.FindObjectsByType<LockerAI>((FindObjectsSortMode)0); LockerAI[] array2 = array; foreach (LockerAI lockerAI in array2) { lockerAI.PlayerScan(GameNetworkManager.Instance.localPlayerController); } } } } } namespace Locker.MonoBehaviours { public class LockerAI : EnemyAI { public enum LockerState : ushort { Debug, Dormant, Activating, Chasing, Resetting, Consuming } public static readonly int CreatureID = 176; private static readonly Color eyeColorDormant = Color.black; private static readonly Color eyeColorScan = Color.cyan; private static readonly Color eyeColorDetect = new Color(1f, 0.4f, 0f); private static readonly Color eyeColorChase = Color.red; private AudioSource audioSource; private Animator animationController; private Material eyeMaterial; private Light internalLight; private List<Light> scrapeLights; private VisualEffect[] visualEffects; private static VFXExposedProperty chaseVFXBeginTrigger; private static VFXExposedProperty chaseVFXEndTrigger; private static readonly string chaseVFXBeginTriggerName = "BeginChase"; private static readonly string chaseVFXEndTriggerName = "EndChase"; private static VFXExposedProperty consumeVFXBeginTrigger; private static VFXExposedProperty consumeVFXEndTrigger; private static readonly string consumeVFXBeginTriggerName = "BeginConsume"; private static readonly string consumeVFXEndTriggerName = "EndConsume"; private LockerState lastState; private Vector3 targetLocation; private Quaternion targetRotation; private float currentRotationSpeed = 0f; private readonly float maxRotationSpeed = 90f; private float currentSpeed = 0f; private readonly float maxSpeed = 1.2f; private Color currentEyeColor = eyeColorDormant; private float currentEyeIntensity = 0f; private float activationTimer = 0f; private readonly float activationDuration = 1.5f; private readonly float activationSpinWindup = 0.45f; private float consumeTimer = 0f; private readonly float consumeDuration = 2.2f; private readonly float consumeBloodWindup = 1f; private bool consumeBloodTriggered = false; private float resetTimer = 0f; private readonly float resetDuration = 1f; private PlayerControllerB playerScanning; private bool playerScanned = false; private float playerScannedTimer = 0f; private float playerScannedDuration = 0f; private Vector3 lastPosition = Vector3.zero; [Header("Locker")] public LockerState State; public bool DebugToCamera = false; public AudioClip AudioClipPing; public AudioClip AudioClipActivate; public AudioClip AudioClipChase; public AudioClip AudioClipReset; public AudioClip AudioClipConsume; public override void Start() { //IL_006f: 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) //IL_0123: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); audioSource = ((Component)this).GetComponent<AudioSource>(); animationController = ((Component)this).GetComponent<Animator>(); SkinnedMeshRenderer componentInChildren = ((Component)this).gameObject.GetComponentInChildren<SkinnedMeshRenderer>(); Material[] materials = ((Renderer)componentInChildren).materials; foreach (Material val in materials) { if (((Object)val).name.ToLower().Contains("eye")) { eyeMaterial = val; eyeMaterial.SetColor("_EmissiveColor", currentEyeColor); break; } } scrapeLights = new List<Light>(); Light[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren<Light>(); Light[] array = componentsInChildren; foreach (Light val2 in array) { if (((Object)((Component)val2).gameObject).name == "InternalLight") { internalLight = val2; continue; } scrapeLights.Add(val2); ((Behaviour)val2).enabled = false; } internalLight.intensity = 0f; ((Behaviour)internalLight).enabled = true; targetLocation = Vector3.zero; visualEffects = ((Component)this).gameObject.GetComponentsInChildren<VisualEffect>(); chaseVFXBeginTrigger.name = chaseVFXBeginTriggerName; chaseVFXEndTrigger.name = chaseVFXEndTriggerName; consumeVFXBeginTrigger.name = consumeVFXBeginTriggerName; consumeVFXEndTrigger.name = consumeVFXEndTriggerName; SwitchState(LockerState.Dormant); } public override void DoAIInterval() { //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); LockerState state = State; LockerState lockerState = state; if (lockerState != LockerState.Dormant) { return; } PlayerControllerB val = null; float num = float.PositiveInfinity; PlayerControllerB[] allPlayersInLineOfSight = ((EnemyAI)this).GetAllPlayersInLineOfSight(360f, 15, (Transform)null, -1f, -1); if (allPlayersInLineOfSight == null || allPlayersInLineOfSight.Length == 0) { return; } PlayerControllerB[] array = allPlayersInLineOfSight; foreach (PlayerControllerB val2 in array) { bool flag = false; if ((Object)(object)val2.pocketedFlashlight != (Object)null && val2.pocketedFlashlight.isBeingUsed) { flag = true; } if (!flag) { continue; } Vector3 val3 = ((Component)this).transform.position - ((Component)val2).transform.position; float num2 = Vector3.Angle(((Component)val2).transform.forward, val3); if (Mathf.Abs(num2) < 30f) { float num3 = Vector3.Distance(((Component)val2).transform.position, ((Component)this).transform.position); if (num3 < num) { num = num3; val = val2; } } } if ((Object)(object)val != (Object)null) { TargetServerRpc(((Component)val).transform.position - ((Component)val).transform.forward * 2f); } } public override void Update() { //IL_0025: 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) //IL_0094: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0359: 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_036f: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (DebugToCamera) { DebugToCamera = false; TargetServerRpc(((Component)Camera.main).transform.position); } if (State != lastState) { SwitchState(State); lastState = State; } switch (State) { case LockerState.Dormant: currentEyeColor = Color.Lerp(currentEyeColor, eyeColorDormant, Time.deltaTime); currentEyeIntensity = Mathf.Lerp(currentEyeIntensity, 0f, Time.deltaTime); internalLight.intensity = Mathf.Lerp(internalLight.intensity, 0f, Time.deltaTime * 8f); break; case LockerState.Activating: if (activationTimer > activationSpinWindup) { currentRotationSpeed = Mathf.Lerp(currentRotationSpeed, maxRotationSpeed, Time.deltaTime / Mathf.Abs(maxRotationSpeed - currentRotationSpeed)); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, targetRotation, Time.deltaTime * currentRotationSpeed * 4f); } currentEyeColor = Color.Lerp(currentEyeColor, eyeColorDetect, Time.deltaTime); currentEyeIntensity = Mathf.Lerp(currentEyeIntensity, 100000f, Time.deltaTime); internalLight.intensity = Mathf.Lerp(internalLight.intensity, 40000f, Time.deltaTime / 4f); break; case LockerState.Chasing: { currentEyeColor = Color.Lerp(currentEyeColor, eyeColorChase, Time.deltaTime); currentEyeIntensity = Mathf.Lerp(currentEyeIntensity, 500000f, Time.deltaTime * 2f); Quaternion val2 = targetRotation * Quaternion.Euler(Vector3.back * 8f); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, Time.deltaTime * 4f); internalLight.intensity = Mathf.Lerp(internalLight.intensity, 20000f, Time.deltaTime); foreach (Light scrapeLight in scrapeLights) { scrapeLight.intensity = Mathf.Lerp(scrapeLight.intensity + (float)Random.Range(-3000, 3000), 4000f, Time.deltaTime * 2f); } break; } case LockerState.Resetting: case LockerState.Consuming: if (consumeTimer > consumeBloodWindup && !consumeBloodTriggered) { VisualEffect[] array = visualEffects; foreach (VisualEffect val in array) { val.SendEvent(consumeVFXBeginTrigger.name); } consumeBloodTriggered = true; } ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, targetRotation, Time.deltaTime * 10f); currentEyeColor = Color.Lerp(currentEyeColor, eyeColorChase, Time.deltaTime); currentEyeIntensity = Mathf.Lerp(currentEyeIntensity, 0f, Time.deltaTime); internalLight.intensity = Mathf.Lerp(internalLight.intensity, 0f, Time.deltaTime * 2f); foreach (Light scrapeLight2 in scrapeLights) { scrapeLight2.intensity = Mathf.Lerp(scrapeLight2.intensity, 0f, Time.deltaTime * 8f); } break; } eyeMaterial.SetColor("_EmissiveColor", currentEyeColor * currentEyeIntensity); } private void FixedUpdate() { //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0235: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: 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_00ba: 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) switch (State) { case LockerState.Dormant: { PlayerControllerB closestPlayer = ((EnemyAI)this).GetClosestPlayer(false, true, true); if ((Object)(object)closestPlayer != (Object)null && Mathf.Abs(((Component)closestPlayer).transform.position.y - ((Component)this).transform.position.y) + 2f > 2f && (double)Vector3.Distance(((Component)closestPlayer).transform.position, ((Component)this).transform.position) < 1.7) { TargetServerRpc(((Component)closestPlayer).transform.position - ((Component)closestPlayer).transform.forward); } else { if (!playerScanned) { break; } playerScannedTimer += Time.fixedDeltaTime; if (playerScannedTimer > playerScannedDuration) { Vector3 val = ((Component)this).transform.position - ((Component)playerScanning).transform.position; float num = Vector3.Angle(((Component)playerScanning).transform.forward, val); if (Mathf.Abs(num) < playerScanning.gameplayCamera.fieldOfView) { audioSource.PlayOneShot(AudioClipPing, 1.5f); playerScanning.JumpToFearLevel(0.2f, true); currentEyeColor = eyeColorScan; TargetServerRpc(((Component)playerScanning).transform.position - ((Component)playerScanning).transform.forward * 3f); } playerScanned = false; playerScannedTimer = 0f; playerScannedDuration = 0f; } } break; } case LockerState.Activating: activationTimer += Time.fixedDeltaTime; if (activationTimer > activationDuration) { SwitchState(LockerState.Chasing); } break; case LockerState.Chasing: if ((double)Vector3.Distance(lastPosition, ((Component)this).transform.position) < 0.01) { SwitchState(LockerState.Resetting); } lastPosition = ((Component)this).transform.position; currentSpeed = Mathf.Lerp(currentSpeed, maxSpeed, Time.fixedDeltaTime); ((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, targetLocation, currentSpeed); if (Vector3.Distance(((Component)this).transform.position, targetLocation) < 0.1f) { SwitchState(LockerState.Resetting); } break; case LockerState.Consuming: consumeTimer += Time.fixedDeltaTime; if (consumeTimer > consumeDuration) { SwitchState(LockerState.Dormant); } break; case LockerState.Resetting: resetTimer += Time.fixedDeltaTime; if (resetTimer > resetDuration) { SwitchState(LockerState.Dormant); } break; } } private void OnCollisionEnter(Collision collision) { LockerState state = State; LockerState lockerState = state; if (lockerState == LockerState.Chasing) { } } private void OnTriggerEnter(Collider collider) { LockerState state = State; LockerState lockerState = state; if (lockerState == LockerState.Chasing) { PlayerControllerB component = ((Component)collider).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null) { ConsumeServerRpc(component.playerClientId); } } } public void SwitchState(LockerState state) { //IL_0075: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) State = state; if (state == lastState) { return; } activationTimer = 0f; consumeTimer = 0f; resetTimer = 0f; switch (state) { case LockerState.Debug: TargetServerRpc(new Vector3((float)Random.Range(-25, 25), ((Component)this).transform.position.y, (float)Random.Range(-25, 25))); MonoBehaviour.print((object)$"Set current debug Locker target to: {targetLocation}"); break; case LockerState.Dormant: { audioSource.loop = false; currentSpeed = 0f; currentRotationSpeed = 0f; foreach (Light scrapeLight in scrapeLights) { scrapeLight.intensity = 0f; ((Behaviour)scrapeLight).enabled = false; } animationController.SetTrigger("Deactivate"); animationController.SetBool("Chasing", false); VisualEffect[] array2 = visualEffects; foreach (VisualEffect val4 in array2) { val4.SendEvent(consumeVFXEndTrigger.name); val4.SendEvent(chaseVFXEndTrigger.name); } consumeBloodTriggered = false; break; } case LockerState.Activating: audioSource.PlayOneShot(AudioClipActivate); animationController.SetTrigger("Activate"); break; case LockerState.Chasing: { lastPosition = Vector3.zero; audioSource.pitch = 1f; audioSource.clip = AudioClipChase; audioSource.loop = true; audioSource.Play(); animationController.SetTrigger("OpenDoors"); foreach (Light scrapeLight2 in scrapeLights) { ((Behaviour)scrapeLight2).enabled = true; } animationController.SetTrigger("Chase"); animationController.SetBool("Chasing", true); VisualEffect[] array3 = visualEffects; foreach (VisualEffect val5 in array3) { val5.SendEvent(chaseVFXBeginTrigger.name); } break; } case LockerState.Resetting: case LockerState.Consuming: { audioSource.Stop(); audioSource.loop = false; ((Component)this).transform.rotation = targetRotation * Quaternion.Euler(Vector3.forward * 20f); animationController.SetBool("Chasing", false); animationController.SetTrigger("CloseDoors"); VisualEffect[] array = visualEffects; foreach (VisualEffect val in array) { val.SendEvent(chaseVFXEndTrigger.name); } if (state == LockerState.Consuming) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position) < 5f) { val2.JumpToFearLevel(1f, true); } } audioSource.PlayOneShot(AudioClipConsume); break; } PlayerControllerB[] allPlayerScripts2 = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val3 in allPlayerScripts2) { if (Vector3.Distance(((Component)this).transform.position, ((Component)val3).transform.position) < 3f) { val3.JumpToFearLevel(0.8f, true); } } audioSource.PlayOneShot(AudioClipReset); break; } } lastState = state; } [ServerRpc(RequireOwnership = false)] public void TargetServerRpc(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_00ca: 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(1376494596u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1376494596u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { TargetClientRpc(position); } } } [ClientRpc] public void TargetClientRpc(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_00c9: 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) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2965016992u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2965016992u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !(Mathf.Abs(position.y - ((Component)this).transform.position.y) > 3f) && !(Mathf.Abs(position.y - ((Component)this).transform.position.y) < 0f)) { position.y = ((Component)this).transform.position.y; if (State == LockerState.Dormant || State == LockerState.Debug) { targetLocation = position; targetRotation = Quaternion.LookRotation(targetLocation - ((Component)this).transform.position); targetRotation *= Quaternion.Euler(Vector3.up * 90f); SwitchState(LockerState.Activating); } } } [ServerRpc(RequireOwnership = false)] public void ConsumeServerRpc(ulong clientid) { //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_0071: 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) 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(2082259863u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientid); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2082259863u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ConsumeClientRpc(clientid); } } } [ClientRpc] public void ConsumeClientRpc(ulong id) { //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_0071: 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_0101: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2705739593u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, id); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2705739593u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && State == LockerState.Chasing) { PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; if (StartOfRound.Instance.localPlayerController.playerClientId == id) { localPlayerController.bleedingHeavily = true; localPlayerController.KillPlayer(Vector3.zero, true, (CauseOfDeath)8, 1); } SwitchState(LockerState.Consuming); } } public void PlayerScan(PlayerControllerB player) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (State != LockerState.Dormant && State != 0) { return; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)player).transform.position); if (num < 90f && !Physics.Linecast(((Component)this).transform.position, ((Component)player).transform.position, StartOfRound.Instance.collidersAndRoomMask)) { playerScanning = player; if (!playerScanned) { playerScanned = true; playerScannedTimer = 0f; playerScannedDuration = num / 30f; } else if (playerScannedDuration - playerScannedTimer < num / 30f) { playerScannedDuration = num / 30f; } } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_LockerAI() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1376494596u, new RpcReceiveHandler(__rpc_handler_1376494596)); NetworkManager.__rpc_func_table.Add(2965016992u, new RpcReceiveHandler(__rpc_handler_2965016992)); NetworkManager.__rpc_func_table.Add(2082259863u, new RpcReceiveHandler(__rpc_handler_2082259863)); NetworkManager.__rpc_func_table.Add(2705739593u, new RpcReceiveHandler(__rpc_handler_2705739593)); } private static void __rpc_handler_1376494596(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; ((LockerAI)(object)target).TargetServerRpc(position); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2965016992(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)2; ((LockerAI)(object)target).TargetClientRpc(position); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2082259863(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) { ulong clientid = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientid); target.__rpc_exec_stage = (__RpcExecStage)1; ((LockerAI)(object)target).ConsumeServerRpc(clientid); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2705739593(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) { ulong id = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref id); target.__rpc_exec_stage = (__RpcExecStage)2; ((LockerAI)(object)target).ConsumeClientRpc(id); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "LockerAI"; } } } namespace Locker.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
BepInEx/plugins/Malfunctions.dll
Decompiled 4 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalNetworkAPI; using Malfunctions.Helpers; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.VFX; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Malfunctions")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Malfunctions")] [assembly: AssemblyCopyright("Copyright © zealsprince 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8c966d9e-bf7c-4f8b-a94b-b87b3b65b941")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Malfunctions { internal class Assets { public enum LoadStatusCode : ushort { Success, Failed, Exists } public static AssetBundle Bundle; public static Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>(); public static readonly Dictionary<string, string> Manifest = new Dictionary<string, string> { { "sparks", "assets/exported/malfunctions/effects/sparks.prefab" } }; public static LoadStatusCode Load() { if ((Object)(object)Bundle != (Object)null) { return LoadStatusCode.Exists; } string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Malfunctions"); Bundle = AssetBundle.LoadFromFile(text); if ((Object)(object)Bundle == (Object)null) { Plugin.logger.LogInfo((object)("Failed to load asset bundle from path: " + text)); return LoadStatusCode.Failed; } Plugin.logger.LogInfo((object)("Loaded asset bundle from path: " + text)); string[] allAssetNames = Bundle.GetAllAssetNames(); foreach (string text2 in allAssetNames) { Plugin.logger.LogDebug((object)("Loaded asset: " + text2)); } foreach (KeyValuePair<string, string> item in Manifest) { Prefabs.Add(item.Key, Bundle.LoadAsset<GameObject>(item.Value)); } return LoadStatusCode.Success; } public static GameObject SpawnPrefab(string name, Vector3 position) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) try { if (Prefabs.ContainsKey(name)) { Plugin.logger.LogDebug((object)("Loading prefab '" + name + "'")); return Object.Instantiate<GameObject>(Prefabs[name], position, Quaternion.identity); } Plugin.logger.LogWarning((object)("Prefab " + name + " not found!")); } catch (Exception ex) when (ex is ArgumentException || ex is NullReferenceException) { Plugin.logger.LogError((object)ex.Message); } return null; } } public class Config { public static ConfigEntry<double> MalfunctionChanceNavigation; public static ConfigEntry<double> MalfunctionChanceTeleporter; public static ConfigEntry<double> MalfunctionChanceDistortion; public static ConfigEntry<double> MalfunctionChanceDoor; public static ConfigEntry<double> MalfunctionChanceLever; public static ConfigEntry<double> MalfunctionChancePower; public static ConfigEntry<int> MalfunctionPassedDaysNavigation; public static ConfigEntry<int> MalfunctionPassedDaysTeleporter; public static ConfigEntry<int> MalfunctionPassedDaysDistortion; public static ConfigEntry<int> MalfunctionPassedDaysDoor; public static ConfigEntry<int> MalfunctionPassedDaysLever; public static ConfigEntry<int> MalfunctionPassedDaysPower; public static ConfigEntry<bool> MalfunctionPenaltyEnabled; public static ConfigEntry<bool> MalfunctionPenaltyOnly; public static ConfigEntry<double> MalfunctionPenaltyMultiplier; public static ConfigEntry<bool> MalfunctionPowerBlockLever; public static ConfigEntry<double> MalfunctionPowerBlockLeverChance; public static ConfigEntry<bool> MalfunctionMiscAllowConsecutive; public static void Load() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Expected O, but got Unknown //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Expected O, but got Unknown //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Expected O, but got Unknown //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Expected O, but got Unknown //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Expected O, but got Unknown //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Expected O, but got Unknown //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Expected O, but got Unknown //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Expected O, but got Unknown //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Expected O, but got Unknown //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Expected O, but got Unknown //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Expected O, but got Unknown //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Expected O, but got Unknown //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Expected O, but got Unknown MalfunctionChanceNavigation = Plugin.config.Bind<double>("Chances", "MalfunctionChanceNavigation", 7.5, new ConfigDescription("Set the chance of the navigation malfunction happening - this will force the ship to route to a random moon with no regard to cost", (AcceptableValueBase)(object)new AcceptableValueRange<double>(0.0, 100.0), Array.Empty<object>())); MalfunctionChanceTeleporter = Plugin.config.Bind<double>("Chances", "MalfunctionChanceTeleporter", 7.5, new ConfigDescription("Set the chance of the teleporter malfunction happening - this will cause teleporters to disable themselves either at landing or after a random interval into the match", (AcceptableValueBase)(object)new AcceptableValueRange<double>(0.0, 100.0), Array.Empty<object>())); MalfunctionChanceDistortion = Plugin.config.Bind<double>("Chances", "MalfunctionChanceDistortion", 5.0, new ConfigDescription("Set the chance of the distortion malfunction happening - this will cause the map and terminal displays as well as walkies to become unusable either at landing or after a random interval into the match", (AcceptableValueBase)(object)new AcceptableValueRange<double>(0.0, 100.0), Array.Empty<object>())); MalfunctionChanceDoor = Plugin.config.Bind<double>("Chances", "MalfunctionChanceDoor", 3.0, new ConfigDescription("Set the chance of the door malfunction happening - this will disable ship door controls either at landing or after a random interval into the match", (AcceptableValueBase)(object)new AcceptableValueRange<double>(0.0, 100.0), Array.Empty<object>())); MalfunctionChanceLever = Plugin.config.Bind<double>("Chances", "MalfunctionChanceLever", 3.0, new ConfigDescription("Set the chance of the lever malfunction happening - this will disable ship lever after a random but announced delay", (AcceptableValueBase)(object)new AcceptableValueRange<double>(0.0, 100.0), Array.Empty<object>())); MalfunctionChancePower = Plugin.config.Bind<double>("Chances", "MalfunctionChancePower", 1.5, new ConfigDescription("Set the chance of the power malfunction happening - this will make the entire ship to go dark after landing, disabling battery charging, door controls, terminal and map displays", (AcceptableValueBase)(object)new AcceptableValueRange<double>(0.0, 100.0), Array.Empty<object>())); MalfunctionPassedDaysNavigation = Plugin.config.Bind<int>("Passed Days", "MalfunctionPassedDaysNavigation", 3, new ConfigDescription("Set how many days must have passed for the navigation malfunction to enable", (AcceptableValueBase)null, Array.Empty<object>())); MalfunctionPassedDaysTeleporter = Plugin.config.Bind<int>("Passed Days", "MalfunctionPassedDaysTeleporter", 11, new ConfigDescription("Set how many days must have passed for the teleporter malfunction to enable", (AcceptableValueBase)null, Array.Empty<object>())); MalfunctionPassedDaysDistortion = Plugin.config.Bind<int>("Passed Days", "MalfunctionPassedDaysDistortion", 3, new ConfigDescription("Set how many days must have passed for the distortion malfunction to enable", (AcceptableValueBase)null, Array.Empty<object>())); MalfunctionPassedDaysDoor = Plugin.config.Bind<int>("Passed Days", "MalfunctionPassedDaysDoor", 7, new ConfigDescription("Set how many days must have passed for the door malfunction to enable", (AcceptableValueBase)null, Array.Empty<object>())); MalfunctionPassedDaysLever = Plugin.config.Bind<int>("Passed Days", "MalfunctionPassedDaysLever", 0, new ConfigDescription("Set how many days must have passed for the lever malfunction to enable", (AcceptableValueBase)null, Array.Empty<object>())); MalfunctionPassedDaysPower = Plugin.config.Bind<int>("Passed Days", "MalfunctionPassedDaysPower", 11, new ConfigDescription("Set how many days must have passed for the power malfunction to enable", (AcceptableValueBase)null, Array.Empty<object>())); MalfunctionPenaltyEnabled = Plugin.config.Bind<bool>("Penalty", "MalfunctionPenaltyEnabled", true, new ConfigDescription("Enable the penalty system that increases malfunction chances after not recovering a player", (AcceptableValueBase)null, Array.Empty<object>())); MalfunctionPenaltyOnly = Plugin.config.Bind<bool>("Penalty", "MalfunctionPenaltyOnly", false, new ConfigDescription("Only enable malfunctions when a player has not been recovered", (AcceptableValueBase)null, Array.Empty<object>())); MalfunctionPenaltyMultiplier = Plugin.config.Bind<double>("Penalty", "MalfunctionPenaltyMultiplier", 2.0, new ConfigDescription("Set the multiplier on triggering a malfunction after not recovering a player", (AcceptableValueBase)null, Array.Empty<object>())); MalfunctionPowerBlockLever = Plugin.config.Bind<bool>("Power Malfunction", "MalfunctionPowerBlockLever", true, new ConfigDescription("Enable a chance of pulling the lever and taking off blocking when the power malfunction is active", (AcceptableValueBase)null, Array.Empty<object>())); MalfunctionPowerBlockLeverChance = Plugin.config.Bind<double>("Power Malfunction", "MalfunctionPowerBlockLeverChance", 50.0, new ConfigDescription("Chance that pulling the lever will not cause take-off", (AcceptableValueBase)(object)new AcceptableValueRange<double>(0.0, 100.0), Array.Empty<object>())); MalfunctionMiscAllowConsecutive = Plugin.config.Bind<bool>("Mmiscellaneous", "MalfunctionMiscAllowConsecutive", false, new ConfigDescription("Allow malfunctions to trigger consecutively - by default if a malfunction is triggered it can not repeat the next day", (AcceptableValueBase)null, Array.Empty<object>())); } } internal class Malfunction { public bool Active; public bool Notified; public bool RollSucceeded; protected List<GameObject> effects; public Malfunction() { Active = false; Notified = false; RollSucceeded = false; effects = new List<GameObject>(); } public void AssignChild(GameObject child) { effects.Add(child); } public void DestroyChildren() { foreach (GameObject effect in effects) { Object.Destroy((Object)(object)effect); } effects.Clear(); } public virtual void Reset() { Active = false; Notified = false; DestroyChildren(); } } internal class MalfunctionWithTrigger : Malfunction { public bool Triggered; public MalfunctionWithTrigger() { Triggered = false; } public override void Reset() { base.Reset(); Triggered = false; } } internal class MalfunctionWithDelay : MalfunctionWithTrigger { public int Delay; public MalfunctionWithDelay() { Delay = 0; } public override void Reset() { base.Reset(); Delay = 0; } } internal class State { public static Malfunction MalfunctionNavigation; public static MalfunctionWithDelay MalfunctionTeleporter; public static MalfunctionWithDelay MalfunctionDistortion; public static MalfunctionWithDelay MalfunctionDoor; public static MalfunctionWithDelay MalfunctionLever; public static MalfunctionWithDelay MalfunctionPower; public static void Load() { MalfunctionNavigation = new Malfunction(); MalfunctionTeleporter = new MalfunctionWithDelay(); MalfunctionDistortion = new MalfunctionWithDelay(); MalfunctionDoor = new MalfunctionWithDelay(); MalfunctionLever = new MalfunctionWithDelay(); MalfunctionPower = new MalfunctionWithDelay(); } public static void Reset() { MalfunctionNavigation.Reset(); MalfunctionTeleporter.Reset(); MalfunctionDistortion.Reset(); MalfunctionDoor.Reset(); MalfunctionLever.Reset(); MalfunctionPower.Reset(); } } [BepInPlugin("com.zealsprince.malfunctions", "Malfunctions", "1.8.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string ModGUID = "com.zealsprince.malfunctions"; public const string ModName = "Malfunctions"; public const string ModVersion = "1.8.2"; public static ManualLogSource logger; public static ConfigFile config; private readonly Harmony harmony = new Harmony("com.zealsprince.malfunctions"); private void Awake() { logger = ((BaseUnityPlugin)this).Logger; config = ((BaseUnityPlugin)this).Config; Config.Load(); if (Assets.Load() == Assets.LoadStatusCode.Success) { State.Load(); harmony.PatchAll(); } } } } namespace Malfunctions.Patches { [HarmonyPatch(typeof(HangarShipDoor))] internal class HangarShipDoorPatches { private static float lockdownTime; [HarmonyPostfix] [HarmonyPatch("Update")] private static void OverwriteDoorPower(HangarShipDoor __instance) { if (!State.MalfunctionPower.Active && State.MalfunctionDoor.Active && State.MalfunctionDoor.Triggered) { __instance.doorPower = 1f; lockdownTime = (lockdownTime + Time.deltaTime) % 6f; ((TMP_Text)__instance.doorPowerDisplay).text = ((lockdownTime > 3f) ? "LOCKED" : "OPEN 10PM") ?? ""; } } } [HarmonyPatch(typeof(StartMatchLever))] internal class StartMatchLeverPatches { [HarmonyPrefix] [HarmonyPatch("PullLever")] private static bool InterruptPullLever(StartMatchLever __instance) { if (State.MalfunctionPower.Active && State.MalfunctionPower.Triggered) { if (Config.MalfunctionPowerBlockLever.Value && State.MalfunctionPower.Delay != 0) { ((TMP_Text)HUDManager.Instance.globalNotificationText).text = "SHIP CORE DEPLETION:\nAWAIT 12AM EMERGENCY AUTOPILOT"; HUDManager.Instance.globalNotificationAnimator.SetTrigger("TriggerNotif"); HUDManager.Instance.UIAudio.PlayOneShot(HUDManager.Instance.radiationWarningAudio, 1f); return false; } } else if (State.MalfunctionLever.Active && State.MalfunctionLever.Triggered) { ((TMP_Text)HUDManager.Instance.globalNotificationText).text = "SHIP LEVER HYDRAULICS JAM:\nAWAIT 12AM EMERGENCY AUTOPILOT"; HUDManager.Instance.globalNotificationAnimator.SetTrigger("TriggerNotif"); HUDManager.Instance.UIAudio.PlayOneShot(HUDManager.Instance.radiationWarningAudio, 1f); return false; } return true; } } [HarmonyPatch(typeof(WalkieTalkie))] internal class WalkieTalkiePatches { [HarmonyPrefix] [HarmonyPatch("ItemActivate")] private static bool InterruptItemActivate(WalkieTalkie __instance) { if (State.MalfunctionDistortion.Active && State.MalfunctionDistortion.Triggered) { __instance.thisAudio.PlayOneShot(__instance.playerDieOnWalkieTalkieSFX); ((GrabbableObject)__instance).UseUpBatteries(); return false; } return true; } } [HarmonyPatch(typeof(ShipLights))] internal class ShipLightsPatches { [HarmonyPrefix] [HarmonyPatch("ToggleShipLights")] private static bool InterruptToggleShipLights() { if (State.MalfunctionPower.Active && State.MalfunctionPower.Triggered) { return false; } return true; } } [HarmonyPatch(typeof(ItemCharger))] internal class ItemChargerPatches { [HarmonyPrefix] [HarmonyPatch("ChargeItem")] private static bool InterruptChargeItem() { if (State.MalfunctionPower.Active && State.MalfunctionPower.Triggered) { return false; } return true; } } [HarmonyPatch(typeof(ManualCameraRenderer))] internal class ManualCameraRendererPatches { [HarmonyPrefix] [HarmonyPatch("SwitchScreenButton")] private static bool InterruptSwitchScreenButton() { if ((State.MalfunctionPower.Active && State.MalfunctionPower.Triggered) || (State.MalfunctionDistortion.Active && State.MalfunctionDistortion.Triggered)) { return false; } return true; } [HarmonyPrefix] [HarmonyPatch("SwitchRadarTargetClientRpc")] private static bool InterruptSwitchCameraView() { if ((State.MalfunctionPower.Active && State.MalfunctionPower.Triggered) || (State.MalfunctionDistortion.Active && State.MalfunctionDistortion.Triggered)) { return false; } return true; } } [HarmonyPatch(typeof(ShipTeleporter))] internal class ShipTeleporterPatches { [HarmonyPrefix] [HarmonyPatch("PressTeleportButtonOnLocalClient")] private static bool InterruptPressTeleportButton(ShipTeleporter __instance) { if ((State.MalfunctionTeleporter.Active && State.MalfunctionTeleporter.Triggered) || (State.MalfunctionPower.Active && State.MalfunctionPower.Triggered)) { __instance.buttonAnimator.SetTrigger("press"); __instance.buttonAudio.PlayOneShot(__instance.buttonPressSFX); return false; } return true; } [HarmonyPostfix] [HarmonyPatch("PressTeleportButtonOnLocalClient")] private static void RandomizePressTeleportButton() { if (State.MalfunctionDistortion.Active && State.MalfunctionDistortion.Triggered) { PlayerControllerB[] array = (from player in Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0) where player.isPlayerControlled select player).ToArray(); if (array.Length != 0) { StartOfRound.Instance.mapScreen.targetedPlayer = array[Random.Range(0, array.Length)]; } } } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatches { [HarmonyPrefix] [HarmonyPatch("LoadNewNodeIfAffordable")] private static bool BlockMoonConfirmNode(Terminal __instance, TerminalNode node) { if (State.MalfunctionNavigation.Active && node.buyRerouteToMoon > -1) { node.displayText = "ROUTE TABLE OFFSET: NAVIGATION ERROR\n\nIT IS ADVISED TO LAND THE SHIP TO ALLOW RECALIBRATION OF SYSTEMS AND RESTORATION OF FUNCTIONALITY\n\n"; node.terminalEvent = "ERROR"; __instance.PlayTerminalAudioServerRpc(3); __instance.LoadNewNode(node); return false; } return true; } } [HarmonyPatch(typeof(TimeOfDay))] internal class TimeOfDayPatches { [HarmonyPostfix] [HarmonyPatch("Update")] private static void CheckMalfunctionTeleporterTrigger(TimeOfDay __instance) { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) if (!State.MalfunctionPower.Active && State.MalfunctionTeleporter.Active && !State.MalfunctionTeleporter.Triggered && __instance.currentDayTimeStarted && __instance.hour >= 1 + State.MalfunctionTeleporter.Delay) { Plugin.logger.LogDebug((object)"Triggered teleporter malfunction!"); State.MalfunctionTeleporter.Triggered = true; if (!State.MalfunctionTeleporter.Notified) { ((TMP_Text)HUDManager.Instance.globalNotificationText).text = "SHIP TELEPORTER MALFUNCTION:\nTIMEOUT FROM ATOMIC MISALIGNMENT"; HUDManager.Instance.globalNotificationAnimator.SetTrigger("TriggerNotif"); HUDManager.Instance.UIAudio.PlayOneShot(HUDManager.Instance.radiationWarningAudio, 1f); State.MalfunctionTeleporter.Notified = true; } ShipTeleporter val = Object.FindObjectOfType<ShipTeleporter>(); if ((Object)(object)val == (Object)null) { Plugin.logger.LogError((object)"Failed to find a teleporter object."); return; } GameObject val2 = Assets.SpawnPrefab("sparks", ((Component)val).transform.position); val2.transform.SetParent(((Component)val).transform, true); State.MalfunctionTeleporter.AssignChild(val2); } } [HarmonyPostfix] [HarmonyPatch("Update")] private static void CheckMalfunctionDistortionTrigger(TimeOfDay __instance) { //IL_010d: Unknown result type (might be due to invalid IL or missing references) if (!State.MalfunctionPower.Active && State.MalfunctionDistortion.Active && !State.MalfunctionDistortion.Triggered && __instance.currentDayTimeStarted && __instance.hour >= 1 + State.MalfunctionDistortion.Delay) { Plugin.logger.LogDebug((object)"Triggered distortion malfunction!"); State.MalfunctionDistortion.Triggered = true; if (!State.MalfunctionDistortion.Notified) { ((TMP_Text)HUDManager.Instance.globalNotificationText).text = "SHIP COMS DISTURBANCE:\nELECTROMAGNETIC ANOMALY"; HUDManager.Instance.globalNotificationAnimator.SetTrigger("TriggerNotif"); HUDManager.Instance.UIAudio.PlayOneShot(HUDManager.Instance.radiationWarningAudio, 1f); State.MalfunctionDistortion.Notified = true; } __instance.playersManager.mapScreen.SwitchScreenOn(false); Terminal val = Object.FindObjectOfType<Terminal>(); if ((Object)(object)val == (Object)null) { Plugin.logger.LogError((object)"Failed to find the terminal object."); return; } val.terminalTrigger.interactable = false; GameObject val2 = Assets.SpawnPrefab("sparks", ((Component)val).transform.position); val2.transform.SetParent(((Component)val).transform, true); State.MalfunctionDistortion.AssignChild(val2); } } [HarmonyPostfix] [HarmonyPatch("Update")] private static void CheckMalfunctionDoorTrigger(TimeOfDay __instance) { //IL_0142: Unknown result type (might be due to invalid IL or missing references) if (!State.MalfunctionPower.Active && State.MalfunctionDoor.Active && !State.MalfunctionDoor.Triggered) { if (!__instance.currentDayTimeStarted || __instance.hour < 1 + State.MalfunctionDoor.Delay || __instance.hour >= 16) { return; } Plugin.logger.LogDebug((object)"Triggered door malfunction!"); State.MalfunctionDoor.Triggered = true; if (!State.MalfunctionDoor.Notified) { ((TMP_Text)HUDManager.Instance.globalNotificationText).text = "SHIP DOOR LOCK FAIL:\nCRACKDOWN PROTOCOL ACTIVE"; HUDManager.Instance.globalNotificationAnimator.SetTrigger("TriggerNotif"); HUDManager.Instance.UIAudio.PlayOneShot(HUDManager.Instance.radiationWarningAudio, 1f); State.MalfunctionDoor.Notified = true; } HangarShipDoor val = Object.FindAnyObjectByType<HangarShipDoor>(); if ((Object)(object)val != (Object)null) { val.SetDoorClosed(); val.PlayDoorAnimation(true); } GameObject val2 = GameObject.Find("HangarDoorButtonPanel"); if ((Object)(object)val2 == (Object)null) { Plugin.logger.LogError((object)"Failed to find door panel object."); return; } InteractTrigger[] componentsInChildren = val2.GetComponentsInChildren<InteractTrigger>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].interactable = false; } GameObject val3 = Assets.SpawnPrefab("sparks", val2.transform.position); val3.transform.SetParent(val2.transform, true); State.MalfunctionDoor.AssignChild(val3); } else { if (State.MalfunctionPower.Active || !State.MalfunctionDoor.Active || !State.MalfunctionDoor.Triggered || __instance.hour < 16) { return; } State.MalfunctionDoor.Triggered = false; HangarShipDoor val4 = Object.FindAnyObjectByType<HangarShipDoor>(); if ((Object)(object)val4 != (Object)null) { val4.SetDoorOpen(); val4.PlayDoorAnimation(false); } GameObject val5 = GameObject.Find("HangarDoorButtonPanel"); if ((Object)(object)val5 != (Object)null) { InteractTrigger[] componentsInChildren = val5.GetComponentsInChildren<InteractTrigger>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].interactable = true; } } } } [HarmonyPostfix] [HarmonyPatch("Update")] private static void CheckMalfunctionLeverTrigger(TimeOfDay __instance) { //IL_0174: Unknown result type (might be due to invalid IL or missing references) if (State.MalfunctionPower.Active || State.MalfunctionDoor.Active || !State.MalfunctionLever.Active) { return; } if (!State.MalfunctionLever.Notified && __instance.currentDayTimeStarted && __instance.hour >= 3 + State.MalfunctionLever.Delay && __instance.hour < 16) { Plugin.logger.LogDebug((object)"Notified lever malfunction!"); int num = State.MalfunctionLever.Delay; if (num == 0) { num = 12; } ((TMP_Text)HUDManager.Instance.globalNotificationText).text = $"MANUAL HYDRAULICS FAILURE IMMINENT:\nLEAVE BEFORE {num}PM OR AWAIT AUTOPILOT"; HUDManager.Instance.globalNotificationAnimator.SetTrigger("TriggerNotif"); HUDManager.Instance.UIAudio.PlayOneShot(HUDManager.Instance.radiationWarningAudio, 1f); State.MalfunctionLever.Notified = true; } else if (!State.MalfunctionLever.Triggered && __instance.currentDayTimeStarted && __instance.hour >= 6 + State.MalfunctionLever.Delay && __instance.hour < 16) { Plugin.logger.LogDebug((object)"Triggered lever malfunction!"); State.MalfunctionLever.Triggered = true; StartMatchLever val = Object.FindObjectOfType<StartMatchLever>(); if ((Object)(object)val == (Object)null) { Plugin.logger.LogError((object)"Failed to find lever device object."); return; } val.triggerScript.disabledHoverTip = "[The lever is jammed]"; GameObject val2 = Assets.SpawnPrefab("sparks", ((Component)val).transform.position); val2.transform.SetParent(((Component)val).transform, true); State.MalfunctionLever.AssignChild(val2); } } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatches { public class MalfunctionNavigationNetworkData { public bool result; public int levelId; public MalfunctionNavigationNetworkData(bool result, int levelId) { this.result = result; this.levelId = levelId; } } public class MalfunctionTeleporterNetworkData { public bool result; public int delay; public MalfunctionTeleporterNetworkData(bool result, int delay) { this.result = result; this.delay = delay; } } public class MalfunctionDistortionNetworkData { public bool result; public int delay; public MalfunctionDistortionNetworkData(bool result, int delay) { this.result = result; this.delay = delay; } } public class MalfunctionDoorNetworkData { public bool result; public int delay; public MalfunctionDoorNetworkData(bool result, int delay) { this.result = result; this.delay = delay; } } public class MalfunctionLeverNetworkData { public bool result; public int delay; public MalfunctionLeverNetworkData(bool result, int delay) { this.result = result; this.delay = delay; } } public class MalfunctionPowerNetworkData { public bool result; public bool blockResult; public MalfunctionPowerNetworkData(bool result, bool blockResult) { this.result = result; this.blockResult = blockResult; } } private static GameObject elevatorPanelScreen; private static GameObject floodlight1; private static GameObject floodlight2; private static Material floodlightMaterial; private static bool hadUnrecoveredDeadPlayers; private static string originalLeverDisableTooltip = ""; public static LethalClientEvent MalfunctionResetNetworkClientMessage = new LethalClientEvent("MALFUNCTION_RESET", (Action)null, (Action<ulong>)null); public static LethalServerMessage<MalfunctionNavigationNetworkData> MalfunctionNavigationNetworkServerMessage = new LethalServerMessage<MalfunctionNavigationNetworkData>("MALFUNCTION_NAVIGATION", (Action<MalfunctionNavigationNetworkData, ulong>)null); public static LethalClientMessage<MalfunctionNavigationNetworkData> MalfunctionNavigationNetworkClientMessage = new LethalClientMessage<MalfunctionNavigationNetworkData>("MALFUNCTION_NAVIGATION", (Action<MalfunctionNavigationNetworkData>)null, (Action<MalfunctionNavigationNetworkData, ulong>)null); public static LethalServerMessage<MalfunctionTeleporterNetworkData> MalfunctionTeleporterNetworkServerMessage = new LethalServerMessage<MalfunctionTeleporterNetworkData>("MALFUNCTION_TELEPORTER", (Action<MalfunctionTeleporterNetworkData, ulong>)null); public static LethalClientMessage<MalfunctionTeleporterNetworkData> MalfunctionTeleporterNetworkClientMessage = new LethalClientMessage<MalfunctionTeleporterNetworkData>("MALFUNCTION_TELEPORTER", (Action<MalfunctionTeleporterNetworkData>)null, (Action<MalfunctionTeleporterNetworkData, ulong>)null); public static LethalServerMessage<MalfunctionDistortionNetworkData> MalfunctionDistortionNetworkServerMessage = new LethalServerMessage<MalfunctionDistortionNetworkData>("MALFUNCTION_DISTORTION", (Action<MalfunctionDistortionNetworkData, ulong>)null); public static LethalClientMessage<MalfunctionDistortionNetworkData> MalfunctionDistortionNetworkClientMessage = new LethalClientMessage<MalfunctionDistortionNetworkData>("MALFUNCTION_DISTORTION", (Action<MalfunctionDistortionNetworkData>)null, (Action<MalfunctionDistortionNetworkData, ulong>)null); public static LethalServerMessage<MalfunctionDoorNetworkData> MalfunctionDoorNetworkServerMessage = new LethalServerMessage<MalfunctionDoorNetworkData>("MALFUNCTION_DOOR", (Action<MalfunctionDoorNetworkData, ulong>)null); public static LethalClientMessage<MalfunctionDoorNetworkData> MalfunctionDoorNetworkClientMessage = new LethalClientMessage<MalfunctionDoorNetworkData>("MALFUNCTION_DOOR", (Action<MalfunctionDoorNetworkData>)null, (Action<MalfunctionDoorNetworkData, ulong>)null); public static LethalServerMessage<MalfunctionLeverNetworkData> MalfunctionLeverNetworkServerMessage = new LethalServerMessage<MalfunctionLeverNetworkData>("MALFUNCTION_LEVER", (Action<MalfunctionLeverNetworkData, ulong>)null); public static LethalClientMessage<MalfunctionLeverNetworkData> MalfunctionLeverNetworkClientMessage = new LethalClientMessage<MalfunctionLeverNetworkData>("MALFUNCTION_LEVER", (Action<MalfunctionLeverNetworkData>)null, (Action<MalfunctionLeverNetworkData, ulong>)null); public static LethalServerMessage<MalfunctionPowerNetworkData> MalfunctionPowerNetworkServerMessage = new LethalServerMessage<MalfunctionPowerNetworkData>("MALFUNCTION_POWER", (Action<MalfunctionPowerNetworkData, ulong>)null); public static LethalClientMessage<MalfunctionPowerNetworkData> MalfunctionPowerNetworkClientMessage = new LethalClientMessage<MalfunctionPowerNetworkData>("MALFUNCTION_POWER", (Action<MalfunctionPowerNetworkData>)null, (Action<MalfunctionPowerNetworkData, ulong>)null); public static bool NetworkHandlersRegistered = false; public static void MalfunctionResetNetworkHandler() { Plugin.logger.LogDebug((object)"Received networking malfunction reset broadcast!"); RestoreAfterMalfunctions(); } public static void MalfunctionNavigationNetworkHandler(MalfunctionNavigationNetworkData message) { Plugin.logger.LogDebug((object)$"Received network message for malfunction navigation roll result: {message.result} (levelId: {message.levelId})"); HandleRollNavigation(message.result, message.levelId); } public static void MalfunctionTeleporterNetworkHandler(MalfunctionTeleporterNetworkData message) { Plugin.logger.LogDebug((object)$"Received network message for malfunction teleporter roll result: {message.result} (Delay: {message.delay})"); HandleRollTeleporter(message.result, message.delay); } public static void MalfunctionDistortionNetworkHandler(MalfunctionDistortionNetworkData message) { Plugin.logger.LogDebug((object)$"Received network message for malfunction distortion roll result: {message.result} (Delay: {message.delay})"); HandleRollDistortion(message.result, message.delay); } public static void MalfunctionDoorNetworkHandler(MalfunctionDoorNetworkData message) { Plugin.logger.LogDebug((object)$"Received network message for malfunction door roll result: {message.result} (Delay: {message.delay})"); HandleRollDoor(message.result, message.delay); } public static void MalfunctionLeverNetworkHandler(MalfunctionLeverNetworkData message) { Plugin.logger.LogDebug((object)$"Received network message for malfunction lever roll result: {message.result} (Delay: {message.delay})"); HandleRollLever(message.result, message.delay); } public static void MalfunctionPowerNetworkHandler(MalfunctionPowerNetworkData message) { Plugin.logger.LogDebug((object)$"Received network message for malfunction power roll result: {message.result} (Block lever: {message.blockResult})"); HandleRollPower(message.result, message.blockResult); } [HarmonyPostfix] [HarmonyPatch("Start")] public static void RegisterNetworkHandlers() { if (!NetworkHandlersRegistered) { MalfunctionResetNetworkClientMessage.OnReceived += MalfunctionResetNetworkHandler; MalfunctionNavigationNetworkClientMessage.OnReceived += MalfunctionNavigationNetworkHandler; MalfunctionTeleporterNetworkClientMessage.OnReceived += MalfunctionTeleporterNetworkHandler; MalfunctionDistortionNetworkClientMessage.OnReceived += MalfunctionDistortionNetworkHandler; MalfunctionDoorNetworkClientMessage.OnReceived += MalfunctionDoorNetworkHandler; MalfunctionLeverNetworkClientMessage.OnReceived += MalfunctionLeverNetworkHandler; MalfunctionPowerNetworkClientMessage.OnReceived += MalfunctionPowerNetworkHandler; NetworkHandlersRegistered = true; Plugin.logger.LogDebug((object)"Registered network handlers!"); } } [HarmonyPrefix] [HarmonyPatch("EndOfGame")] private static void CheckDeadPlayers(StartOfRound __instance, int bodiesInsured) { int num = __instance.connectedPlayersAmount + 1 - __instance.livingPlayers; if (num > bodiesInsured) { hadUnrecoveredDeadPlayers = true; Plugin.logger.LogDebug((object)$"There were unrecovered players! (Players: {__instance.connectedPlayersAmount + 1} / Dead: {num} / Recovered: {bodiesInsured})"); } else { hadUnrecoveredDeadPlayers = false; Plugin.logger.LogDebug((object)$"All players are alive or recovered! (Players: {__instance.connectedPlayersAmount + 1} / Dead: {num} / Recovered: {bodiesInsured})"); } } [HarmonyPostfix] [HarmonyPatch("ReviveDeadPlayers")] private static void RollMalfunctions(StartOfRound __instance) { RestoreAfterMalfunctions(); if (Config.MalfunctionMiscAllowConsecutive.Value) { State.Reset(); } int num = (int)(DateTime.Parse(DateTime.UtcNow.ToString("yyyy-MM-dd")) - new DateTime(1970, 1, 1)).TotalSeconds; int num2 = __instance.randomMapSeed + num; Random random = new Random(num2); Plugin.logger.LogDebug((object)$"Got random synced seed: {num2}"); Plugin.logger.LogDebug((object)$"Elapsed days: {__instance.gameStats.daysSpent} / Days to next deadline: {TimeOfDay.Instance.daysUntilDeadline}"); if (!((NetworkBehaviour)__instance).IsServer) { return; } double num3 = random.NextDouble() * 100.0; double num4 = random.NextDouble() * 100.0; double num5 = random.NextDouble() * 100.0; double num6 = random.NextDouble() * 100.0; double num7 = random.NextDouble() * 100.0; double num8 = random.NextDouble() * 100.0; double num9 = 1.0; if (Config.MalfunctionPenaltyEnabled.Value) { Plugin.logger.LogDebug((object)"Penalty multiplier active. Checking for unrecovered players."); if (hadUnrecoveredDeadPlayers) { num9 = Config.MalfunctionPenaltyMultiplier.Value; Plugin.logger.LogDebug((object)"Had unrecovered players. Increasing malfunction multiplier for this round."); } else if (Config.MalfunctionPenaltyOnly.Value) { num9 = 0.0; Plugin.logger.LogDebug((object)"No unrecovered players. Setting probability to zero as penalty mode only is enabled."); } } bool flag = Config.MalfunctionChanceNavigation.Value != 0.0 && num3 < Config.MalfunctionChanceNavigation.Value * num9; bool flag2 = Config.MalfunctionChanceTeleporter.Value != 0.0 && num4 < Config.MalfunctionChanceTeleporter.Value * num9; bool flag3 = Config.MalfunctionChanceDistortion.Value != 0.0 && num5 < Config.MalfunctionChanceDistortion.Value * num9; bool flag4 = Config.MalfunctionChanceDoor.Value != 0.0 && num8 < Config.MalfunctionChanceDoor.Value * num9; bool flag5 = Config.MalfunctionChanceLever.Value != 0.0 && num7 < Config.MalfunctionChanceLever.Value * num9; bool flag6 = Config.MalfunctionChancePower.Value != 0.0 && num6 < Config.MalfunctionChancePower.Value * num9; Plugin.logger.LogDebug((object)string.Format("Malfunction Navigation Roll: {0} < {1} ({2})", num3, Config.MalfunctionChanceNavigation.Value * num9, flag ? "SUCCESS" : "FAIL")); Plugin.logger.LogDebug((object)string.Format("Malfunction Teleporter Roll: {0} < {1} ({2})", num4, Config.MalfunctionChanceTeleporter.Value * num9, flag2 ? "SUCCESS" : "FAIL")); Plugin.logger.LogDebug((object)string.Format("Malfunction Distortion Roll: {0} < {1} ({2})", num5, Config.MalfunctionChanceDistortion.Value * num9, flag3 ? "SUCCESS" : "FAIL")); Plugin.logger.LogDebug((object)string.Format("Malfunction Door Roll: {0} < {1} ({2})", num8, Config.MalfunctionChanceDoor.Value * num9, flag4 ? "SUCCESS" : "FAIL")); Plugin.logger.LogDebug((object)string.Format("Malfunction Lever Roll: {0} < {1} ({2})", num7, Config.MalfunctionChanceLever.Value * num9, flag5 ? "SUCCESS" : "FAIL")); Plugin.logger.LogDebug((object)string.Format("Malfunction Power Roll: {0} < {1} ({2})", num6, Config.MalfunctionChancePower.Value * num9, flag6 ? "SUCCESS" : "FAIL")); double num10 = random.NextDouble() * 100.0; bool flag7 = Config.MalfunctionPowerBlockLeverChance.Value != 0.0 && num10 < Config.MalfunctionPowerBlockLeverChance.Value; Plugin.logger.LogDebug((object)string.Format("Malfunction Power - Block Lever Roll : {0} < {1} ({2})", num10, Config.MalfunctionPowerBlockLeverChance.Value, flag7 ? "SUCCESS" : "FAIL")); if (StartOfRound.Instance.gameStats.daysSpent <= Config.MalfunctionPassedDaysNavigation.Value) { Plugin.logger.LogDebug((object)$"Blocking navigation malfunction because elapsed days hasn't passed required threshold: {StartOfRound.Instance.gameStats.daysSpent} / {Config.MalfunctionPassedDaysNavigation.Value}"); flag = false; } SelectableLevel[] array = StartOfRound.Instance.levels.Where((SelectableLevel level) => ((Object)level).name != "CompanyBuildingLevel").ToArray(); SelectableLevel val = random.NextFromCollection(array); if (flag) { SelectableLevel[] array2 = array; foreach (SelectableLevel val2 in array2) { Plugin.logger.LogDebug((object)$"Level ID: {val2.levelID} / Level Name: {((Object)val2).name}"); } Plugin.logger.LogDebug((object)$"Selected Level ID: {val.levelID}"); } MalfunctionNavigationNetworkServerMessage.SendAllClients(new MalfunctionNavigationNetworkData(flag, val.levelID), true); if (StartOfRound.Instance.gameStats.daysSpent <= Config.MalfunctionPassedDaysTeleporter.Value) { Plugin.logger.LogDebug((object)$"Blocking teleporter malfunction because elapsed days hasn't passed required threshold: {StartOfRound.Instance.gameStats.daysSpent} / {Config.MalfunctionPassedDaysTeleporter.Value}"); flag2 = false; } int delay = 1 + random.Next(11); MalfunctionTeleporterNetworkServerMessage.SendAllClients(new MalfunctionTeleporterNetworkData(flag2, delay), true); if (StartOfRound.Instance.gameStats.daysSpent <= Config.MalfunctionPassedDaysDistortion.Value) { Plugin.logger.LogDebug((object)$"Blocking distortion malfunction because elapsed days hasn't passed required threshold: {StartOfRound.Instance.gameStats.daysSpent} / {Config.MalfunctionPassedDaysDistortion.Value}"); flag3 = false; } int delay2 = random.Next(12); MalfunctionDistortionNetworkServerMessage.SendAllClients(new MalfunctionDistortionNetworkData(flag3, delay2), true); if (StartOfRound.Instance.gameStats.daysSpent <= Config.MalfunctionPassedDaysDoor.Value) { Plugin.logger.LogDebug((object)$"Blocking door malfunction because elapsed days hasn't passed required threshold: {StartOfRound.Instance.gameStats.daysSpent} / {Config.MalfunctionPassedDaysDoor.Value}"); flag4 = false; } int delay3 = 4 + random.Next(8); MalfunctionDoorNetworkServerMessage.SendAllClients(new MalfunctionDoorNetworkData(flag4, delay3), true); if (StartOfRound.Instance.gameStats.daysSpent <= Config.MalfunctionPassedDaysLever.Value) { Plugin.logger.LogDebug((object)$"Blocking lever malfunction because elapsed days hasn't passed required threshold: {StartOfRound.Instance.gameStats.daysSpent} / {Config.MalfunctionPassedDaysLever.Value}"); flag5 = false; } int delay4 = random.Next(4); MalfunctionLeverNetworkServerMessage.SendAllClients(new MalfunctionLeverNetworkData(flag5, delay4), true); if (StartOfRound.Instance.gameStats.daysSpent <= Config.MalfunctionPassedDaysPower.Value) { Plugin.logger.LogDebug((object)$"Blocking power malfunction because elapsed days hasn't passed required threshold: {StartOfRound.Instance.gameStats.daysSpent} / {Config.MalfunctionPassedDaysPower.Value}"); flag6 = false; } MalfunctionPowerNetworkServerMessage.SendAllClients(new MalfunctionPowerNetworkData(flag6, flag7), true); } private static void RestoreAfterMalfunctions() { StartMatchLever val = Object.FindObjectOfType<StartMatchLever>(); if ((Object)(object)val == (Object)null) { Plugin.logger.LogError((object)"Failed to find lever device object."); } else { val.triggerScript.disabledHoverTip = originalLeverDisableTooltip; } Terminal val2 = Object.FindObjectOfType<Terminal>(); if ((Object)(object)val2 != (Object)null) { val2.terminalTrigger.interactable = true; } GameObject obj = elevatorPanelScreen; if (obj != null) { obj.SetActive(true); } GameObject val3 = GameObject.Find("HangarDoorButtonPanel"); if ((Object)(object)val3 != (Object)null) { InteractTrigger[] componentsInChildren = val3.GetComponentsInChildren<InteractTrigger>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].interactable = true; } } if ((Object)(object)floodlight1 != (Object)null && (Object)(object)floodlight2 != (Object)null) { Light[] componentsInChildren2 = floodlight1.GetComponentsInChildren<Light>(true); Light[] componentsInChildren3 = floodlight2.GetComponentsInChildren<Light>(true); Light[] array = componentsInChildren2; for (int i = 0; i < array.Length; i++) { ((Behaviour)array[i]).enabled = true; } array = componentsInChildren3; for (int i = 0; i < array.Length; i++) { ((Behaviour)array[i]).enabled = true; } MeshRenderer component = floodlight1.GetComponent<MeshRenderer>(); MeshRenderer component2 = floodlight2.GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null) { Material[] materials = ((Renderer)component).materials; materials[2] = floodlightMaterial; ((Renderer)component).materials = materials; ((Renderer)component2).materials = materials; } } } private static void HandleRollNavigation(bool result, int level) { if (State.MalfunctionNavigation.Active || (TimeOfDay.Instance.daysUntilDeadline < 2 && !Config.MalfunctionMiscAllowConsecutive.Value)) { State.MalfunctionNavigation.Reset(); } else if (((Object)StartOfRound.Instance.currentLevel).name != "CompanyBuildingLevel" && TimeOfDay.Instance.daysUntilDeadline >= 2 && result) { StartOfRound.Instance.ChangeLevel(level); State.MalfunctionNavigation.Active = true; } } private static void HandleRollTeleporter(bool result, int delay) { if (State.MalfunctionTeleporter.Active || TimeOfDay.Instance.daysUntilDeadline < 2) { State.MalfunctionTeleporter.Reset(); } else if (!State.MalfunctionPower.Active && ((Object)StartOfRound.Instance.currentLevel).name != "CompanyBuildingLevel" && TimeOfDay.Instance.daysUntilDeadline >= 2 && result) { if ((Object)(object)Object.FindObjectOfType<ShipTeleporter>() != (Object)null) { State.MalfunctionTeleporter.Delay = delay; State.MalfunctionTeleporter.Active = true; Plugin.logger.LogDebug((object)$"Teleporter malfunction will trigger at {7 + State.MalfunctionTeleporter.Delay}:00"); } else { Plugin.logger.LogDebug((object)"Didn't find a teleporter! Skipping teleporter malfunction."); } } } public static void HandleRollDistortion(bool result, int delay) { if (State.MalfunctionDistortion.Active || TimeOfDay.Instance.daysUntilDeadline < 2) { State.MalfunctionDistortion.Reset(); } else if (!State.MalfunctionPower.Active && ((Object)StartOfRound.Instance.currentLevel).name != "CompanyBuildingLevel" && TimeOfDay.Instance.daysUntilDeadline >= 2 && result) { State.MalfunctionDistortion.Delay = delay; State.MalfunctionDistortion.Active = true; Plugin.logger.LogDebug((object)$"Distortion malfunction will trigger at {7 + State.MalfunctionDistortion.Delay}:00"); } } public static void HandleRollDoor(bool result, int delay) { if (State.MalfunctionDoor.Active || TimeOfDay.Instance.daysUntilDeadline < 2) { State.MalfunctionDoor.Reset(); } else if (!State.MalfunctionPower.Active && ((Object)StartOfRound.Instance.currentLevel).name != "CompanyBuildingLevel" && TimeOfDay.Instance.daysUntilDeadline >= 2 && result) { elevatorPanelScreen = GameObject.Find("ElevatorPanelScreen"); State.MalfunctionDoor.Delay = delay; State.MalfunctionDoor.Active = true; Plugin.logger.LogDebug((object)$"Door malfunction will trigger at {7 + State.MalfunctionDoor.Delay}:00"); } } public static void HandleRollLever(bool result, int delay) { if (State.MalfunctionLever.Active || TimeOfDay.Instance.daysUntilDeadline < 2) { State.MalfunctionLever.Reset(); } else if (!State.MalfunctionPower.Active && !State.MalfunctionDoor.Active && ((Object)StartOfRound.Instance.currentLevel).name != "CompanyBuildingLevel" && TimeOfDay.Instance.daysUntilDeadline >= 2 && result) { State.MalfunctionLever.Delay = delay; State.MalfunctionLever.Active = true; Plugin.logger.LogDebug((object)$"Lever malfunction will trigger at {12 + State.MalfunctionLever.Delay}:00"); } } public static void HandleRollPower(bool result, bool blockLever) { if (State.MalfunctionPower.Active || TimeOfDay.Instance.daysUntilDeadline < 2) { State.MalfunctionPower.Reset(); } else { if (!(((Object)StartOfRound.Instance.currentLevel).name != "CompanyBuildingLevel") || TimeOfDay.Instance.daysUntilDeadline < 2 || !result) { return; } elevatorPanelScreen = GameObject.Find("ElevatorPanelScreen"); State.MalfunctionPower.Active = true; if (Config.MalfunctionPowerBlockLever.Value && blockLever) { State.MalfunctionPower.Delay = 1; StartMatchLever val = Object.FindObjectOfType<StartMatchLever>(); if ((Object)(object)val == (Object)null) { Plugin.logger.LogError((object)"Failed to find lever device object."); } else { val.triggerScript.disabledHoverTip = "[There is no power to the hydraulics system]"; } } else { State.MalfunctionPower.Delay = 0; } } } [HarmonyPostfix] [HarmonyPatch("SetMapScreenInfoToCurrentLevel")] [HarmonyAfter(new string[] { "jamil.corporate_restructure", "WeatherTweaks" })] private static void OverwriteMapScreenInfo(StartOfRound __instance) { //IL_0121: Unknown result type (might be due to invalid IL or missing references) StartMatchLever val = Object.FindObjectOfType<StartMatchLever>(); if ((Object)(object)val == (Object)null) { Plugin.logger.LogError((object)"Failed to find lever device object."); } else { originalLeverDisableTooltip = val.triggerScript.disabledHoverTip; } if (((Object)__instance.currentLevel).name != "CompanyBuildingLevel" && State.MalfunctionNavigation.Active && !State.MalfunctionNavigation.Notified) { ((TMP_Text)HUDManager.Instance.globalNotificationText).text = "SHIP NAVIGATION MALFUNCTION:\nROUTE TABLE OFFSET ERROR"; HUDManager.Instance.globalNotificationAnimator.SetTrigger("TriggerNotif"); HUDManager.Instance.UIAudio.PlayOneShot(HUDManager.Instance.radiationWarningAudio, 1f); State.MalfunctionNavigation.Notified = true; ((TMP_Text)__instance.screenLevelDescription).text = "SHIP NAVIGATION MALFUNCTION\nOrbiting: Unknown\nWeather: Unknown\nBE ADVISED THE ROUTE TABLE WILL RECALIBRATE AFTER LANDING"; ((Behaviour)__instance.screenLevelVideoReel).enabled = false; __instance.screenLevelVideoReel.clip = null; ((Component)__instance.screenLevelVideoReel).gameObject.SetActive(false); __instance.screenLevelVideoReel.Stop(); if ((Object)(object)val == (Object)null) { Plugin.logger.LogError((object)"Failed to find lever device object."); return; } GameObject val2 = Assets.SpawnPrefab("sparks", ((Component)val).transform.position); val2.transform.SetParent(((Component)val).transform, true); State.MalfunctionNavigation.AssignChild(val2); } } [HarmonyPostfix] [HarmonyPatch("openingDoorsSequence")] private static void TriggerPowerMalfunction(StartOfRound __instance) { //IL_0178: Unknown result type (might be due to invalid IL or missing references) if (!State.MalfunctionPower.Active) { return; } Plugin.logger.LogDebug((object)"Triggered power malfunction!"); State.MalfunctionPower.Triggered = true; if (State.MalfunctionPower.Notified) { return; } if ((Object)(object)floodlight1 != (Object)null && (Object)(object)floodlight2 != (Object)null) { Light[] componentsInChildren = floodlight1.GetComponentsInChildren<Light>(true); Light[] componentsInChildren2 = floodlight2.GetComponentsInChildren<Light>(true); Light[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { ((Behaviour)array[i]).enabled = false; } array = componentsInChildren2; for (int i = 0; i < array.Length; i++) { ((Behaviour)array[i]).enabled = false; } MeshRenderer component = floodlight1.GetComponent<MeshRenderer>(); MeshRenderer component2 = floodlight2.GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null) { Material[] materials = ((Renderer)component).materials; materials[2] = ((Renderer)component).materials[0]; ((Renderer)component).materials = materials; ((Renderer)component2).materials = materials; } } Terminal val = Object.FindObjectOfType<Terminal>(); if ((Object)(object)val != (Object)null) { val.terminalTrigger.interactable = false; } GameObject obj = elevatorPanelScreen; if (obj != null) { obj.SetActive(false); } GameObject val2 = GameObject.Find("HangarDoorButtonPanel"); if ((Object)(object)val2 != (Object)null) { InteractTrigger[] componentsInChildren3 = val2.GetComponentsInChildren<InteractTrigger>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { componentsInChildren3[i].interactable = false; } } __instance.PowerSurgeShip(); Object.FindObjectOfType<StormyWeather>(true).PlayThunderEffects(((Component)val).transform.position, val.terminalAudio); ((TMP_Text)HUDManager.Instance.globalNotificationText).text = "SHIP CORE SURGE:\nRUNNING ON EMERGENCY POWER"; HUDManager.Instance.globalNotificationAnimator.SetTrigger("TriggerNotif"); HUDManager.Instance.UIAudio.PlayOneShot(HUDManager.Instance.radiationWarningAudio, 1f); State.MalfunctionPower.Notified = true; } [HarmonyPostfix] [HarmonyPatch("OnShipLandedMiscEvents")] private static void CaptureFloodlights() { if (!((Object)(object)floodlightMaterial == (Object)null)) { return; } floodlight1 = GameObject.Find("Floodlight1"); floodlight2 = GameObject.Find("Floodlight2"); if ((Object)(object)floodlight1 == (Object)null || (Object)(object)floodlight2 == (Object)null) { Plugin.logger.LogWarning((object)"Failed to capture floodlight gameobjects!"); return; } MeshRenderer component = floodlight1.GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null) { floodlightMaterial = ((Renderer)component).materials[2]; } } [HarmonyPostfix] [HarmonyPatch("Start")] private static void Reset() { State.Reset(); } } } namespace Malfunctions.MonoBehaviours { public class Sparks : MonoBehaviour { public float delayMin = 0.5f; public float delayMax = 10f; public float maxIntensity = 40000f; private float currentIntensity; private float now; private float next; private bool sentStop; private AudioSource audioSource; private Light pointLight; private VisualEffect visualEffect; private static VFXExposedProperty beginBurstTrigger; private static VFXExposedProperty stopBurstTrigger; private void Start() { beginBurstTrigger.name = "BeginBurst"; stopBurstTrigger.name = "StopBurst"; audioSource = ((Component)this).GetComponent<AudioSource>(); pointLight = ((Component)this).GetComponent<Light>(); visualEffect = ((Component)this).GetComponent<VisualEffect>(); GameObject val = GameObject.Find("Player"); Camera val2 = ((!((Object)(object)val == (Object)null)) ? val.GetComponentInChildren<Camera>() : Object.FindAnyObjectByType<Camera>()); ((Component)val2).gameObject.tag = "MainCamera"; } private void Update() { now = Time.time; if (now > next) { next = now + Random.Range(delayMin, delayMax); sentStop = false; ((Behaviour)pointLight).enabled = true; currentIntensity = maxIntensity; audioSource.pitch = Random.Range(0.7f, 2f); audioSource.Play(); visualEffect.SendEvent(beginBurstTrigger.name); } else if (!sentStop) { visualEffect.SendEvent(stopBurstTrigger.name); sentStop = true; } pointLight.intensity = currentIntensity; currentIntensity = Mathf.Lerp(currentIntensity, 0f, Time.deltaTime * 100f); } } } namespace Malfunctions.Helpers { public static class RandomHelper { public static TSource NextFromCollection<TSource>(this Random rand, IList<TSource> collection) { int index = rand.Next(collection.Count()); return collection[index]; } } }
BepInEx/plugins/MaskedEnemyRework.dll
Decompiled 4 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using MaskedEnemyRework.Patches; using Microsoft.CodeAnalysis; using MoreCompany; using MoreCompany.Cosmetics; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MaskedEnemyRework")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Lethal Company Mod")] [assembly: AssemblyFileVersion("3.1.990.0")] [assembly: AssemblyInformationalVersion("3.1.990")] [assembly: AssemblyProduct("MaskedEnemyRework")] [assembly: AssemblyTitle("MaskedEnemyRework")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.1.990.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MaskedEnemyRework { [BepInPlugin("MaskedEnemyRework", "MaskedEnemyRework", "3.1.990")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("MaskedEnemyRework"); private static Plugin Instance; internal ManualLogSource logger; public static List<int> PlayerMimicList; public static int PlayerMimicIndex; private ConfigEntry<bool> RemoveMasksConfig; private ConfigEntry<bool> RevealMasksConfig; private ConfigEntry<bool> ShowMaskedNamesConfig; private ConfigEntry<bool> RemoveZombieArmsConfig; private ConfigEntry<bool> UseSpawnRarityConfig; private ConfigEntry<int> SpawnRarityConfig; private ConfigEntry<bool> CanSpawnOutsideConfig; private ConfigEntry<int> MaxSpawnCountConfig; private ConfigEntry<bool> ZombieApocalypeModeConfig; private ConfigEntry<bool> UseVanillaSpawnsConfig; private ConfigEntry<bool> DontTouchMimickingPlayerConfig; private ConfigEntry<int> ZombieApocalypeRandomChanceConfig; private ConfigEntry<int> MaxZombiesZombieConfig; private ConfigEntry<float> InsideEnemySpawnCurveConfig; private ConfigEntry<float> MiddayInsideEnemySpawnCurveConfig; private ConfigEntry<float> StartOutsideEnemySpawnCurveConfig; private ConfigEntry<float> MidOutsideEnemySpawnCurveConfig; private ConfigEntry<float> EndOutsideEnemySpawnCurveConfig; public static bool RemoveMasks; public static bool RevealMasks; public static bool ShowMaskedNames; public static bool RemoveZombieArms; public static bool UseSpawnRarity; public static int SpawnRarity; public static bool CanSpawnOutside; public static int MaxSpawnCount; public static int MaxZombies; public static bool ZombieApocalypseMode; public static bool UseVanillaSpawns; public static bool DontTouchMimickingPlayer; public static int RandomChanceZombieApocalypse; public static float InsideEnemySpawnCurve; public static float MiddayInsideEnemySpawnCurve; public static float StartOutsideEnemySpawnCurve; public static float MidOutsideEnemySpawnCurve; public static float EndOutsideEnemySpawnCurve; public static int InitialPlayerCount; public static SpawnableEnemyWithRarity maskedPrefab; public static SpawnableEnemyWithRarity flowerPrefab; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } PlayerMimicList = new List<int>(); PlayerMimicIndex = 0; InitialPlayerCount = 0; ShowMaskedNamesConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Show Masked Usernames", false, "Will show username of player being mimicked."); RemoveMasksConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Remove Mask From Masked Enemy", true, "Whether or not the Masked Enemy has a mask on."); RevealMasksConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Reveal Mask When Attacking", false, "The enemy would reveal their mask permanently after trying to attack someone. Mask would be off until the attempt to attack is made"); RemoveZombieArmsConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Remove Zombie Arms", true, "Remove the animation where the Masked raise arms like a zombie."); UseVanillaSpawnsConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Use Vanilla Spawns", false, "Ignores anything else in this mod. Only uses the above settings from this config. Will not spawn on all moons. will ignore EVERYTHING in the config below this point."); DontTouchMimickingPlayerConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Dont Touch MaskedPlayerEnemy.mimickingPlayer", false, "Experimental. Give control to other mods (like qwbarch-Mirage) to set which players are impersonated."); UseSpawnRarityConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawns", "Use Spawn Rarity", false, "Use custom spawn rate from config. If this is false, the masked spawns at the same rate as the Bracken. If true, will spawn at whatever rarity is given in Spawn Rarity config option"); SpawnRarityConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Spawns", "Spawn Rarity", 15, "The rarity for the Masked Enemy to spawn. The higher the number, the more likely to spawn. Can go to 1000000000, any higher will break. Use Spawn Rarity must be set to True"); CanSpawnOutsideConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawns", "Allow Masked To Spawn Outside", false, "Whether the Masked Enemy can spawn outside the building"); MaxSpawnCountConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Spawns", "Max Number of Masked", 2, "Max Number of possible masked to spawn in one level"); ZombieApocalypeModeConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Zombie Apocalypse Mode", "Zombie Apocalypse Mode", false, "Only spawns Masked! Make sure to crank up the Max Spawn Count in this config! Would also recommend bringing a gun (mod), a shovel works fine too though.... This mode does not play nice with other mods that affect spawn rates. Disable those before playing for best results"); MaxZombiesZombieConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Zombie Apocalypse Mode", "Max Number of Masked in Zombie Apocalypse", 2, "Max Number of possible masked to spawn in Zombie Apocalypse"); ZombieApocalypeRandomChanceConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Zombie Apocalypse Mode", "Random Zombie Apocalypse Mode", -1, "[Must Be Whole Number] The percent chance from 1 to 100 that a day could contain a zombie apocalypse. Put at -1 to never have the chance arise and don't have Only Spawn Masked turned on"); InsideEnemySpawnCurveConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Zombie Apocalypse Mode", "StartOfDay Inside Masked Spawn Curve", 0.1f, "Spawn curve for masked inside, start of the day. Crank this way up for immediate action. More info in the readme"); MiddayInsideEnemySpawnCurveConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Zombie Apocalypse Mode", "Midday Inside Masked Spawn Curve", 500f, "Spawn curve for masked inside, midday."); StartOutsideEnemySpawnCurveConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Zombie Apocalypse Mode", "StartOfDay Masked Outside Spawn Curve", -30f, "Spawn curve for outside masked, start of the day."); MidOutsideEnemySpawnCurveConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Zombie Apocalypse Mode", "Midday Outside Masked Spawn Curve", -30f, "Spawn curve for outside masked, midday."); EndOutsideEnemySpawnCurveConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Zombie Apocalypse Mode", "EOD Outside Masked Spawn Curve", 10f, "Spawn curve for outside masked, end of day"); RemoveMasks = RemoveMasksConfig.Value; ShowMaskedNames = ShowMaskedNamesConfig.Value; RevealMasks = RevealMasksConfig.Value; UseVanillaSpawns = UseVanillaSpawnsConfig.Value; DontTouchMimickingPlayer = DontTouchMimickingPlayerConfig.Value; RemoveZombieArms = RemoveZombieArmsConfig.Value; UseSpawnRarity = UseSpawnRarityConfig.Value; CanSpawnOutside = CanSpawnOutsideConfig.Value; MaxSpawnCount = MaxSpawnCountConfig.Value; SpawnRarity = SpawnRarityConfig.Value; ZombieApocalypseMode = ZombieApocalypeModeConfig.Value; MaxZombies = MaxZombiesZombieConfig.Value; InsideEnemySpawnCurve = InsideEnemySpawnCurveConfig.Value; MiddayInsideEnemySpawnCurve = MiddayInsideEnemySpawnCurveConfig.Value; StartOutsideEnemySpawnCurve = StartOutsideEnemySpawnCurveConfig.Value; MidOutsideEnemySpawnCurve = MidOutsideEnemySpawnCurveConfig.Value; EndOutsideEnemySpawnCurve = EndOutsideEnemySpawnCurveConfig.Value; RandomChanceZombieApocalypse = ZombieApocalypeRandomChanceConfig.Value; logger = Logger.CreateLogSource("MaskedEnemyRework"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MaskedEnemyRework is loaded! Woohoo!"); harmony.PatchAll(typeof(Plugin)); harmony.PatchAll(typeof(GetMaskedPrefabForLaterUse)); harmony.PatchAll(typeof(MaskedVisualRework)); harmony.PatchAll(typeof(MaskedSpawnSettings)); } } public static class PluginInfo { public const string PLUGIN_GUID = "MaskedEnemyRework"; public const string PLUGIN_NAME = "MaskedEnemyRework"; public const string PLUGIN_VERSION = "3.1.990"; } } namespace MaskedEnemyRework.Patches { [HarmonyPatch] internal class GetMaskedPrefabForLaterUse { [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPostfix] private static void SavesPrefabForLaterUse(ref SelectableLevel[] ___moonsCatalogueList) { ManualLogSource val = Logger.CreateLogSource("MaskedEnemyRework"); SelectableLevel[] array = ___moonsCatalogueList; for (int i = 0; i < array.Length; i++) { foreach (SpawnableEnemyWithRarity enemy in array[i].Enemies) { if (enemy.enemyType.enemyName == "Masked") { val.LogInfo((object)"Found Masked!"); Plugin.maskedPrefab = enemy; } else if (enemy.enemyType.enemyName == "Flowerman") { Plugin.flowerPrefab = enemy; val.LogInfo((object)"Found Flowerman!"); } } } } [HarmonyPatch(typeof(PlayerControllerB), "SetHoverTipAndCurrentInteractTrigger")] [HarmonyPrefix] private static void LookingAtMasked(ref PlayerControllerB __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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) if (!Plugin.ShowMaskedNames) { return; } Ray val = default(Ray); ((Ray)(ref val))..ctor(((Component)__instance.gameplayCamera).transform.position, ((Component)__instance.gameplayCamera).transform.forward); LayerMask val2 = LayerMask.op_Implicit(524288); RaycastHit val3 = default(RaycastHit); if (!__instance.isFreeCamera && Physics.Raycast(val, ref val3, 5f, LayerMask.op_Implicit(val2))) { EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref val3)).collider).gameObject.GetComponent<EnemyAICollisionDetect>(); if (Object.op_Implicit((Object)(object)component)) { ((Component)component.mainScript).gameObject.GetComponent<MaskedPlayerEnemy>(); } } } } [HarmonyPatch(typeof(RoundManager))] internal class MaskedSpawnSettings { [HarmonyPatch("BeginEnemySpawning")] [HarmonyPrefix] private static void UpdateSpawnRates(ref SelectableLevel ___currentLevel) { //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Expected O, but got Unknown //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Expected O, but got Unknown //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Expected O, but got Unknown if (Plugin.UseVanillaSpawns) { return; } ManualLogSource val = Logger.CreateLogSource("MaskedEnemyRework"); val.LogInfo((object)"Starting Round Manager"); Predicate<SpawnableEnemyWithRarity> match = (SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "Masked"; Predicate<SpawnableEnemyWithRarity> match2 = (SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "Flowerman"; try { SpawnableEnemyWithRarity maskedPrefab = Plugin.maskedPrefab; SpawnableEnemyWithRarity val2 = ___currentLevel.Enemies.Find(match2) ?? Plugin.flowerPrefab; int num = 0; foreach (SpawnableEnemyWithRarity item in ___currentLevel.Enemies.FindAll(match)) { num -= item.enemyType.MaxCount * item.enemyType.PowerLevel; } ___currentLevel.Enemies.RemoveAll(match); ___currentLevel.Enemies.Add(maskedPrefab); if (Plugin.CanSpawnOutside) { ___currentLevel.OutsideEnemies.RemoveAll(match); ___currentLevel.OutsideEnemies.Add(maskedPrefab); ___currentLevel.DaytimeEnemies.RemoveAll(match); ___currentLevel.DaytimeEnemies.Add(maskedPrefab); } maskedPrefab.enemyType.PowerLevel = 1; maskedPrefab.enemyType.probabilityCurve = val2.enemyType.probabilityCurve; maskedPrefab.enemyType.isOutsideEnemy = Plugin.CanSpawnOutside; if (Plugin.ZombieApocalypseMode | (StartOfRound.Instance.randomMapSeed % 100 < Plugin.RandomChanceZombieApocalypse)) { val.LogInfo((object)"ZOMBIE APOCALYPSE"); maskedPrefab.enemyType.MaxCount = Plugin.MaxZombies; maskedPrefab.rarity = 1000000; Plugin.RandomChanceZombieApocalypse = -1; ___currentLevel.enemySpawnChanceThroughoutDay = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, Plugin.InsideEnemySpawnCurve), new Keyframe(0.5f, Plugin.MiddayInsideEnemySpawnCurve) }); ___currentLevel.daytimeEnemySpawnChanceThroughDay = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 7f), new Keyframe(0.5f, 7f) }); ___currentLevel.outsideEnemySpawnChanceThroughDay = new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, Plugin.StartOutsideEnemySpawnCurve), new Keyframe(20f, Plugin.MidOutsideEnemySpawnCurve), new Keyframe(21f, Plugin.EndOutsideEnemySpawnCurve) }); } else { val.LogInfo((object)"no zombies :("); maskedPrefab.enemyType.MaxCount = Plugin.MaxSpawnCount; maskedPrefab.rarity = (Plugin.UseSpawnRarity ? Plugin.SpawnRarity : val2.rarity); } num += maskedPrefab.enemyType.MaxCount * maskedPrefab.enemyType.PowerLevel; val.LogInfo((object)$"Adjusting power levels: [maxEnemyPowerCount: {___currentLevel.maxEnemyPowerCount}+{num}, maxDaytimeEnemyPowerCount: {___currentLevel.maxDaytimeEnemyPowerCount}+{num}, maxOutsideEnemyPowerCount: {___currentLevel.maxOutsideEnemyPowerCount}+{num}]"); SelectableLevel obj = ___currentLevel; obj.maxEnemyPowerCount += num; SelectableLevel obj2 = ___currentLevel; obj2.maxDaytimeEnemyPowerCount += num; SelectableLevel obj3 = ___currentLevel; obj3.maxOutsideEnemyPowerCount += num; } catch (Exception ex) { val.LogInfo((object)ex); } } } [HarmonyPatch(typeof(MaskedPlayerEnemy))] internal class MaskedVisualRework { private static IEnumerator coroutine; [HarmonyPatch("Start")] [HarmonyBefore(new string[] { "AdvancedCompany" })] [HarmonyPostfix] private static void ReformVisuals(ref MaskedPlayerEnemy __instance) { //IL_005b: 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_008e: Unknown result type (might be due to invalid IL or missing references) ManualLogSource val = Logger.CreateLogSource("MaskedEnemyRework"); if (!Plugin.DontTouchMimickingPlayer) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; int num = StartOfRound.Instance.ClientPlayerList.Count; if (num == 0) { num = 1; val.LogError((object)"Player count was zero"); } if (Plugin.PlayerMimicList.Count <= 1 || Plugin.InitialPlayerCount != num) { Plugin.InitialPlayerCount = num; State state = Random.state; Random.InitState(1234); for (int i = 0; i < 50; i++) { Plugin.PlayerMimicList.Add(Random.Range(0, num)); } Random.state = state; } int num2 = Plugin.PlayerMimicList[Plugin.PlayerMimicIndex % 50] % num; Plugin.PlayerMimicIndex++; if ((Object)(object)__instance.mimickingPlayer == (Object)null) { __instance.mimickingPlayer = allPlayerScripts[num2]; } __instance.SetSuit(__instance.mimickingPlayer.currentSuitID); } if (Plugin.RemoveMasks || Plugin.RevealMasks) { ((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskComedy")).gameObject.SetActive(false); ((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskTragedy")).gameObject.SetActive(false); } if (Chainloader.PluginInfos.ContainsKey("me.swipez.melonloader.morecompany") && !Chainloader.PluginInfos.ContainsKey("com.potatoepet.AdvancedCompany")) { MoreCompanyPatch.ApplyCosmetics(__instance); } } [HarmonyPatch("SetHandsOutClientRpc")] [HarmonyPrefix] private static void MaskAndArmsReveal(ref bool setOut, ref MaskedPlayerEnemy __instance) { GameObject gameObject = ((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskComedy")).gameObject; if (Plugin.RevealMasks && !gameObject.activeSelf && ((EnemyAI)__instance).currentBehaviourStateIndex == 1) { Logger.CreateLogSource("MaskedEnemyRework"); IEnumerator enumerator = FadeInAndOut(gameObject, fadeIn: true, 1f); ((MonoBehaviour)__instance).StartCoroutine(enumerator); } if (Plugin.RemoveZombieArms) { setOut = false; } } [HarmonyPatch("SetEnemyOutside")] [HarmonyPostfix] [HarmonyPriority(300)] private static void HideCosmeticsIfMarked(ref MaskedPlayerEnemy __instance) { if (Chainloader.PluginInfos.ContainsKey("me.swipez.melonloader.morecompany") && !Chainloader.PluginInfos.ContainsKey("com.potatoepet.AdvancedCompany")) { MoreCompanyPatch.ApplyCosmetics(__instance); } } [HarmonyPatch("DoAIInterval")] [HarmonyPostfix] private static void HideRevealedMask(ref MaskedPlayerEnemy __instance) { if (Plugin.RevealMasks && (Object)(object)((EnemyAI)__instance).targetPlayer == (Object)null) { GameObject gameObject = ((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskComedy")).gameObject; if (gameObject.activeSelf) { IEnumerator enumerator = FadeInAndOut(gameObject, fadeIn: false, 1f); ((MonoBehaviour)__instance).StartCoroutine(enumerator); } } } [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdateMaskName(ref MaskedPlayerEnemy __instance) { } private static IEnumerator FadeInAndOut(GameObject mask, bool fadeIn, float duration) { float counter = 0f; mask.SetActive(true); float startLoc; float endLoc; if (fadeIn) { startLoc = 0.095f; endLoc = 0.215f; } else { startLoc = 0.215f; endLoc = 0.095f; } while (counter < duration) { counter += Time.deltaTime; float num = Mathf.Lerp(startLoc, endLoc, counter / duration); mask.transform.localPosition = new Vector3(-0.009f, 0.143f, num); yield return null; } if (!fadeIn) { mask.SetActive(false); } } } internal class MoreCompanyPatch { public static void ApplyCosmetics(MaskedPlayerEnemy masked) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) if (!MainClass.showCosmetics || MainClass.playerIdsAndCosmetics.Count == 0) { return; } Transform val = ((Component)masked).transform.Find("ScavengerModel").Find("metarig"); CosmeticApplication component = ((Component)val).GetComponent<CosmeticApplication>(); if (Object.op_Implicit((Object)(object)component)) { component.ClearCosmetics(); Object.Destroy((Object)(object)component); } List<string> list = MainClass.playerIdsAndCosmetics[(int)masked.mimickingPlayer.playerClientId]; component = ((Component)val).gameObject.AddComponent<CosmeticApplication>(); foreach (string item in list) { component.ApplyCosmetic(item, true); } foreach (CosmeticInstance spawnedCosmetic in component.spawnedCosmetics) { Transform transform = ((Component)spawnedCosmetic).transform; transform.localScale *= 0.38f; } } } internal class RemoveZombieArms { [HarmonyPatch(typeof(MaskedPlayerEnemy), "SetHandsOutClientRpc")] [HarmonyPrefix] private static void RemoveArms(ref bool setOut) { if (Plugin.RemoveZombieArms) { setOut = false; } } } }
BepInEx/plugins/RollingGiant/RollingGiant.dll
Decompiled 4 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using RollingGiant; using RollingGiant.Patches; using RollingGiant.Settings; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Pool; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RollingGiant")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+9c97ebf1cb02f050d1774ba039eca4d54fbcb93b")] [assembly: AssemblyProduct("RollingGiant")] [assembly: AssemblyTitle("RollingGiant")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<RollingGiantAiType>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedValueEquals<RollingGiantAiType>(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RollingGiant { public class NetworkHandler : NetworkBehaviour { private static readonly List<RollingGiantAiType> _aiTypes = Enum.GetValues(typeof(RollingGiantAiType)).Cast<RollingGiantAiType>().Take(Enum.GetValues(typeof(RollingGiantAiType)).Length - 1) .ToList(); private NetworkVariable<RollingGiantAiType> _aiType = new NetworkVariable<RollingGiantAiType>(RollingGiantAiType.RandomlyMoveWhileLooking, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private static InputAction _gotoPreviousAiType; private static InputAction _gotoNextAiType; private static InputAction _reloadConfig; public static NetworkHandler Instance { get; private set; } public static RollingGiantAiType AiType => Instance._aiType.Value; public override void OnNetworkSpawn() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { if (Object.op_Implicit((Object)(object)Instance)) { ((Component)Instance).gameObject.GetComponent<NetworkObject>().Despawn(true); } _aiType.Value = CustomConfig.AiType.GetFirst(); } Instance = this; InputAction gotoPreviousAiType = _gotoPreviousAiType; if (gotoPreviousAiType != null) { gotoPreviousAiType.Disable(); } InputAction gotoPreviousAiType2 = _gotoPreviousAiType; if (gotoPreviousAiType2 != null) { gotoPreviousAiType2.Dispose(); } _gotoPreviousAiType = new InputAction("gotoPreviousAiType", (InputActionType)1, CustomConfig.GotoPreviousAiTypeKey.Value, (string)null, (string)null, (string)null); _gotoPreviousAiType.Enable(); InputAction gotoNextAiType = _gotoNextAiType; if (gotoNextAiType != null) { gotoNextAiType.Disable(); } InputAction gotoNextAiType2 = _gotoNextAiType; if (gotoNextAiType2 != null) { gotoNextAiType2.Dispose(); } _gotoNextAiType = new InputAction("gotoNextAiType", (InputActionType)1, CustomConfig.GotoNextAiTypeKey.Value, (string)null, (string)null, (string)null); _gotoNextAiType.Enable(); InputAction reloadConfig = _reloadConfig; if (reloadConfig != null) { reloadConfig.Disable(); } InputAction reloadConfig2 = _reloadConfig; if (reloadConfig2 != null) { reloadConfig2.Dispose(); } _reloadConfig = new InputAction("reloadConfig", (InputActionType)1, CustomConfig.ReloadConfigKey.Value, (string)null, (string)null, (string)null); _reloadConfig.Enable(); ((NetworkBehaviour)this).OnNetworkSpawn(); } public void SetAiType(RollingGiantAiType aiType) { if (((NetworkBehaviour)this).IsServer || ((NetworkBehaviour)this).IsHost) { SetNewAiType(aiType, showTip: false); } } private void Update() { if (!((NetworkBehaviour)this).IsServer && !((NetworkBehaviour)this).IsHost) { return; } if (_gotoPreviousAiType.WasPressedThisFrame()) { int num = _aiTypes.IndexOf(_aiType.Value) - 1; if (num < 0) { num = _aiTypes.Count - 1; } SetNewAiType(_aiTypes[num]); } else if (_gotoNextAiType.WasPressedThisFrame()) { int num2 = _aiTypes.IndexOf(_aiType.Value) + 1; if (num2 >= _aiTypes.Count) { num2 = 0; } SetNewAiType(_aiTypes[num2]); } else if (_reloadConfig.WasPressedThisFrame()) { Plugin.Config.Reload(); SyncedInstance<CustomConfig>.Instance.Reload(); _aiType.Value = CustomConfig.AiType.GetFirst(); SetNewAiType(_aiType.Value); HUDManager.Instance.DisplayTip("Config reloaded", $"Ai defaulted to {_aiType.Value}", false, false, "LC_Tip1"); } } private void SetNewAiType(RollingGiantAiType aiType, bool showTip = true) { RollingGiantAiType value = _aiType.Value; _aiType.Value = aiType; CustomConfig.SetCurrentAi(); EmitSharedServerSettingsClientRpc(); if (Object.op_Implicit((Object)(object)HUDManager.Instance) && value != aiType && showTip) { HUDManager.Instance.DisplayTip("Rolling Giant AI changed", aiType.ToString(), false, false, "LC_Tip1"); } Plugin.Log.LogMessage((object)$"Rolling Giant AI changed: {aiType}"); } [ClientRpc] private void EmitSharedServerSettingsClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_007c: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4257552972u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4257552972u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { CustomConfig.RequestSync(); } } } protected override void __initializeVariables() { if (_aiType == null) { throw new Exception("NetworkHandler._aiType cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_aiType).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_aiType, "_aiType"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_aiType); ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_NetworkHandler() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(4257552972u, new RpcReceiveHandler(__rpc_handler_4257552972)); } private static void __rpc_handler_4257552972(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((NetworkHandler)(object)target).EmitSharedServerSettingsClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "NetworkHandler"; } } [BepInPlugin("nomnomab.rollinggiant", "Rolling Giant", "2.5.2")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "nomnomab.rollinggiant"; public const string PluginName = "Rolling Giant"; public const string PluginVersion = "2.5.2"; private const int SaveFileVersion = 11; public static string PluginDirectory; public static AssetBundle Bundle; public static EnemyType EnemyTypeInside; public static EnemyType EnemyTypeOutside; public static EnemyType EnemyTypeOutsideDaytime; public static TerminalNode EnemyTerminalNode; public static TerminalKeyword EnemyTerminalKeyword; public static AudioClip WalkSound; public static AudioClip[] StopSounds; public static GameObject PlayerRagdoll; public static Item PosterItem; public static Material BlackAndWhiteMaterial; internal static ManualLogSource Log; public static CustomConfig CustomConfig { get; private set; } public static ConfigFile Config { get; private set; } private void Awake() { Config = ((BaseUnityPlugin)this).Config; Log = ((BaseUnityPlugin)this).Logger; PluginDirectory = ((BaseUnityPlugin)this).Info.Location; LoadSettings(); RemoveOldSettings(); LoadAssets(); LoadNetWeaver(); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin RollingGiant is loaded!"); } private void LoadNetWeaver() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); foreach (Type type in types) { try { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } catch { Log.LogWarning((object)("NetWeaver is skipping " + type.FullName)); } } } private void LoadSettings() { CustomConfig = new CustomConfig(((BaseUnityPlugin)this).Config); } private void RemoveOldSettings() { int value = ((BaseUnityPlugin)this).Config.Bind<int>("z_Ignore", "__version", 0, "The version of this config file. Do not change this.").Value; if (value != 11) { Log.LogMessage((object)$"Removing old settings... ({value} != {11})"); string configFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath; string destFileName = configFilePath + ".bak"; File.Copy(configFilePath, destFileName, overwrite: true); File.WriteAllText(configFilePath, ""); ((BaseUnityPlugin)this).Config.Reload(); CustomConfig.Reload(setValues: false); ((BaseUnityPlugin)this).Config.Bind<int>("z_Ignore", "__version", 11, (ConfigDescription)null).Value = 11; CustomConfig.AssignFromSaved(); ((BaseUnityPlugin)this).Config.Save(); } else { Log.LogMessage((object)$"Settings version is up to date ({value} == {11})"); } } private void LoadAssets() { //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) try { Bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(PluginDirectory) ?? throw new Exception("Failed to get directory name!"), "rollinggiant")); EnemyTypeInside = Bundle.LoadAsset<EnemyType>("Assets/RollingGiant/Data/RollingGiant_EnemyType.asset"); EnemyTypeOutside = Bundle.LoadAsset<EnemyType>("Assets/RollingGiant/Data/RollingGiant_EnemyType_Outside.asset"); EnemyTypeOutsideDaytime = Bundle.LoadAsset<EnemyType>("Assets/RollingGiant/Data/RollingGiant_EnemyType_Outside_Daytime.asset"); EnemyTypeInside.MaxCount = CustomConfig.MaxPerLevel; EnemyTypeOutside.MaxCount = CustomConfig.MaxPerLevel; EnemyTypeOutsideDaytime.MaxCount = CustomConfig.MaxPerLevel; NetworkPatches.RegisterPrefab(EnemyTypeInside.enemyPrefab); NetworkPatches.RegisterPrefab(EnemyTypeOutside.enemyPrefab); NetworkPatches.RegisterPrefab(EnemyTypeOutsideDaytime.enemyPrefab); EnemyTerminalNode = Bundle.LoadAsset<TerminalNode>("Assets/RollingGiant/Data/RollingGiant_TerminalNode.asset"); EnemyTerminalKeyword = Bundle.LoadAsset<TerminalKeyword>("Assets/RollingGiant/Data/RollingGiant_TerminalKeyword.asset"); } catch (Exception arg) { Log.LogError((object)$"Failed to load asset bundle! {arg}"); } try { WalkSound = Bundle.LoadAsset<AudioClip>("Assets/RollingGiant/Audio/MovingLoop.wav"); StopSounds = (AudioClip[])(object)new AudioClip[5]; for (int i = 0; i < 5; i++) { StopSounds[i] = Bundle.LoadAsset<AudioClip>($"Assets/RollingGiant/Audio/Stopped{i + 1}.wav"); } PlayerRagdoll = Bundle.LoadAsset<GameObject>("Assets/RollingGiant/PlayerRagdollRollingGiant Variant.prefab"); PlayerRagdoll.AddComponent<RollingGiantDeadBody>(); PosterItem = Bundle.LoadAsset<Item>("Assets/RollingGiant/Data/RollingGiant_PosterItem.asset"); Item posterItem = PosterItem; posterItem.rotationOffset += new Vector3(45f, 0f, 0f); Item posterItem2 = PosterItem; posterItem2.positionOffset += new Vector3(-0.1f, -0.12f, 0.15f); Object.Destroy((Object)(object)PosterItem.spawnPrefab.GetComponent<PhysicsProp>()); PosterItem.spawnPrefab.AddComponent<Poster>().Init(); NetworkPatches.RegisterPrefab(PosterItem.spawnPrefab); BlackAndWhiteMaterial = Bundle.LoadAsset<Material>("Assets/RollingGiant/Materials/RollingGiant_Gray.mat"); } catch (Exception arg2) { Log.LogError((object)$"Failed to load assets! {arg2}"); } } } [Flags] public enum RollingGiantAiType { [Description("Coilhead AI")] Coilhead = 1, [Description("Move when player is looking at it")] InverseCoilhead = 2, [Description("Randomly move while the player is looking at it")] RandomlyMoveWhileLooking = 4, [Description("If the player looks at it for too long it doesn't stop chasing")] LookingTooLongKeepsAgro = 8, [Description("Once the player is noticed, the Rolling Giant will follow the player constantly")] FollowOnceAgro = 0x10, [Description("Once the player sees the Rolling Giant, it will chase the player after a timer")] OnceSeenAgroAfterTimer = 0x20, [Description("Will put all AI types into the selection for you")] All = 0x3F } public static class RollingGiantAiTypeExtensions { public static RollingGiantAiType GetFirst(this RollingGiantAiType aiType) { RollingGiantAiType[] array = Enum.GetValues(typeof(RollingGiantAiType)).Cast<RollingGiantAiType>().ToArray(); for (int i = 0; i < array.Length - 1; i++) { RollingGiantAiType rollingGiantAiType = array[i]; if ((aiType & rollingGiantAiType) == rollingGiantAiType) { return rollingGiantAiType; } } return aiType; } public static RollingGiantAiType GetRandom(this RollingGiantAiType aiType, int seedOffset) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) List<RollingGiantAiType> list = default(List<RollingGiantAiType>); PooledObject<List<RollingGiantAiType>> val = CollectionPool<List<RollingGiantAiType>, RollingGiantAiType>.Get(ref list); try { RollingGiantAiType[] array = Enum.GetValues(typeof(RollingGiantAiType)).Cast<RollingGiantAiType>().ToArray(); for (int i = 0; i < array.Length - 1; i++) { RollingGiantAiType rollingGiantAiType = array[i]; if ((aiType & rollingGiantAiType) == rollingGiantAiType) { list.Add(rollingGiantAiType); } } if (list.Count == 1) { return aiType; } RollingGiantAiType rollingGiantAiType2 = aiType; if (Object.op_Implicit((Object)(object)NetworkHandler.Instance)) { rollingGiantAiType2 = NetworkHandler.AiType; list.Remove(rollingGiantAiType2); } Random random = new Random(StartOfRound.Instance.randomMapSeed + seedOffset); int index = random.Next(0, list.Count); if (list.Count > 1) { rollingGiantAiType2 = list[index]; Plugin.Log.LogInfo((object)$"Selected AI type: {rollingGiantAiType2}"); } else if (list.Count == 0) { rollingGiantAiType2 = array[random.Next(0, array.Length - 1)]; Plugin.Log.LogInfo((object)$"Selected AI type: {rollingGiantAiType2}"); } else { rollingGiantAiType2 = list[0]; Plugin.Log.LogInfo((object)$"Selected initial AI type: {rollingGiantAiType2}"); } return rollingGiantAiType2; } finally { ((IDisposable)val).Dispose(); } } public static int AiTypesCount(this RollingGiantAiType aiType) { int num = 0; RollingGiantAiType[] array = Enum.GetValues(typeof(RollingGiantAiType)).Cast<RollingGiantAiType>().ToArray(); for (int i = 0; i < array.Length - 1; i++) { RollingGiantAiType rollingGiantAiType = array[i]; if ((aiType & rollingGiantAiType) == rollingGiantAiType) { num++; } } return num; } } public class Poster : PhysicsProp { public void Init() { ((GrabbableObject)this).grabbable = true; ((GrabbableObject)this).itemProperties = Plugin.PosterItem; ((GrabbableObject)this).isInFactory = true; ((GrabbableObject)this).mainObjectRenderer = ((Component)this).GetComponent<MeshRenderer>(); ((GrabbableObject)this).grabbableToEnemies = true; } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } protected internal override string __getTypeName() { return "Poster"; } } public class RollingGiantAI : EnemyAI { private const float ROAMING_AUDIO_PERCENT = 0.4f; [SerializeField] private AISearchRoutine _searchForPlayers; [SerializeField] private Collider _mainCollider; [SerializeField] private AudioClip[] _stopNoises; private AudioSource _rollingSFX; private NetworkVariable<float> _velocity = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private NetworkVariable<float> _waitTimer = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private NetworkVariable<float> _moveTimer = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private NetworkVariable<float> _lookTimer = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private NetworkVariable<float> _agroTimer = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private float _timeSinceHittingPlayer; private bool _wantsToChaseThisClient; private bool _hasEnteredChaseState; private bool _wasStopped; private bool _wasFeared; private bool _isAgro; private float _lastSpeed; private bool _tooBig; private static RollingGiantAiType _aiType => NetworkHandler.AiType; private static SharedAiSettings _sharedAiSettings => CustomConfig.SharedAiSettings; private static void LogInfo(object message) { } private static float NextDouble() { if (!Object.op_Implicit((Object)(object)RoundManager.Instance) || RoundManager.Instance.LevelRandom == null) { return Random.value; } return (float)RoundManager.Instance.LevelRandom.NextDouble(); } public override void Start() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); Init(((Component)this).transform.localScale.x); if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsOwner) { AssignInitData_LocalClient(); } LogInfo($"Rolling giant spawned with ai type: {NetworkHandler.AiType}, owner? {((NetworkBehaviour)this).IsOwner}"); } private void Init(float scale) { base.agent = ((Component)this).gameObject.GetComponentInChildren<NavMeshAgent>(); _rollingSFX = ((Component)((Component)this).transform.Find("RollingSFX")).GetComponent<AudioSource>(); AudioMixerGroup outputAudioMixerGroup = SoundManager.Instance.diageticMixer.outputAudioMixerGroup; _rollingSFX.outputAudioMixerGroup = outputAudioMixerGroup; base.creatureVoice.outputAudioMixerGroup = outputAudioMixerGroup; base.creatureSFX.outputAudioMixerGroup = outputAudioMixerGroup; _rollingSFX.loop = true; _rollingSFX.clip = Plugin.WalkSound; float time = NextDouble() * Plugin.WalkSound.length; _rollingSFX.time = time; _rollingSFX.pitch = Mathf.Lerp(1.1f, 0.8f, Mathf.InverseLerp(0.9f, 1.2f, scale)); _rollingSFX.volume = 0f; _rollingSFX.Play(); base.isOutside = base.enemyType.isOutsideEnemy || base.enemyType.isDaytimeEnemy; if (base.isOutside) { base.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode"); } } public void ResetValues() { if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) { _waitTimer.Value = 0f; _moveTimer.Value = 0f; _lookTimer.Value = 0f; _agroTimer.Value = 0f; ((EnemyAI)this).SwitchToBehaviourState(0); EndChasingPlayer_ClientRpc(); ResetValues_ClientRpc(); } } [ClientRpc] private void ResetValues_ClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_007c: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1389605656u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1389605656u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { _isAgro = false; _wasStopped = false; _wasFeared = false; } } } public override void DaytimeEnemyLeave() { ((EnemyAI)this).DaytimeEnemyLeave(); Renderer[] componentsInChildren = ((Component)((Component)this).transform).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { if (!(((Object)val).name == "object_3")) { val.sharedMaterial = Plugin.BlackAndWhiteMaterial; } } _mainCollider.isTrigger = true; } public override void DoAIInterval() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) if (base.daytimeEnemyLeaving) { _mainCollider.isTrigger = true; return; } ((EnemyAI)this).DoAIInterval(); if (StartOfRound.Instance.livingPlayers == 0 || base.isEnemyDead) { return; } switch (base.currentBehaviourStateIndex) { case 0: { if (!((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId); break; } if (!_searchForPlayers.inProgress) { ((EnemyAI)this).StartSearch(((Component)this).transform.position, _searchForPlayers); LogInfo($"[DoAIInterval::{NetworkHandler.AiType}] StartSearch({((Component)this).transform.position}, _searchForPlayers)"); break; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!val.isPlayerDead && ((NetworkBehaviour)val).IsSpawned && base.isOutside != val.isInsideFactory && (base.isOutside || ((EnemyAI)this).PlayerIsTargetable(val, false, false))) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position); bool flag = num < (float)(base.isOutside ? 90 : 30); if (!Physics.Linecast(((Component)this).transform.position + Vector3.up * 0.5f, ((Component)val.gameplayCamera).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault) && flag) { ((EnemyAI)this).SwitchToBehaviourState(1); LogInfo($"[DoAIInterval::{NetworkHandler.AiType}] SwitchToBehaviourState(1), found {val?.playerUsername} at distance {num}m"); return; } } } if (base.isOutside) { PlayerControllerB closestPlayer = ((EnemyAI)this).GetClosestPlayer(false, false, false); if (Object.op_Implicit((Object)(object)closestPlayer) && !Physics.Linecast(((Component)this).transform.position + Vector3.up * 0.5f, ((Component)closestPlayer.gameplayCamera).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault) && Vector3.Distance(((Component)this).transform.position, ((Component)closestPlayer).transform.position) < (float)(base.isOutside ? 90 : 30)) { base.targetPlayer = closestPlayer; ((EnemyAI)this).SwitchToBehaviourState(1); LogInfo($"[DoAIInterval::{NetworkHandler.AiType}] ClosestPlayer! SwitchToBehaviourState(1), found {base.targetPlayer?.playerUsername}"); } } break; } case 1: if (!((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f)) { base.movingTowardsTargetPlayer = false; if (!_searchForPlayers.inProgress) { ((EnemyAI)this).SwitchToBehaviourState(0); LogInfo($"[DoAIInterval::{NetworkHandler.AiType}] lost player; StartSearch({((Component)this).transform.position}, _searchForPlayers)"); } } else if (_searchForPlayers.inProgress) { ((EnemyAI)this).StopSearch(_searchForPlayers, true); base.movingTowardsTargetPlayer = true; LogInfo($"[DoAIInterval::{NetworkHandler.AiType}] StopSearch(_searchForPlayers), found {base.targetPlayer?.playerUsername}"); } break; } } public override void Update() { //IL_0041: 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_0069: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) if (base.daytimeEnemyLeaving) { _mainCollider.isTrigger = true; _rollingSFX.volume = 0f; return; } Vector3 velocity2; if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) { NetworkVariable<float> velocity = _velocity; velocity2 = base.agent.velocity; velocity.Value = ((Vector3)(ref velocity2)).magnitude; } ((EnemyAI)this).Update(); if (base.isEnemyDead) { return; } velocity2 = base.agent.velocity; _lastSpeed = ((Vector3)(ref velocity2)).magnitude; CalculateAgentSpeed(); _timeSinceHittingPlayer += Time.deltaTime; _mainCollider.isTrigger = _velocity.Value > 0.01f; float value = _velocity.Value; if (value > 0.1f) { _rollingSFX.volume = Mathf.Lerp(0f, Mathf.Clamp01(0.4f * value + 0.05f), value / _sharedAiSettings.moveSpeed); } else { _rollingSFX.volume = Mathf.Lerp(_rollingSFX.volume, 0f, Time.deltaTime); } GameNetworkManager instance = GameNetworkManager.Instance; PlayerControllerB localPlayerController = instance.localPlayerController; if (_wasStopped && !_wasFeared && localPlayerController.HasLineOfSightToPosition(base.eye.position, 70f, 25, -1f)) { _wasFeared = true; float num = Vector3.Distance(((Component)this).transform.position, ((Component)localPlayerController).transform.position); if (num < 4f) { instance.localPlayerController.JumpToFearLevel(0.9f, true); } else if (num < 9f) { instance.localPlayerController.JumpToFearLevel(0.4f, true); } if (_lastSpeed > 1f) { RoundManager.PlayRandomClip(base.creatureVoice, _stopNoises, false, 1f, 0); } } switch (base.currentBehaviourStateIndex) { case 0: if (_hasEnteredChaseState) { _hasEnteredChaseState = false; _wantsToChaseThisClient = false; _wasStopped = false; _wasFeared = false; base.agent.speed = 0f; if (_aiType != RollingGiantAiType.OnceSeenAgroAfterTimer) { _isAgro = false; if (((NetworkBehaviour)this).IsOwner) { _agroTimer.Value = 0f; } } if (((NetworkBehaviour)this).IsOwner) { _waitTimer.Value = 0f; _moveTimer.Value = 0f; _lookTimer.Value = 0f; } } if (((NetworkBehaviour)this).IsOwner && ((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f) && !_wantsToChaseThisClient) { _wantsToChaseThisClient = true; BeginChasingPlayer_ServerRpc((int)base.targetPlayer.playerClientId); LogInfo($"[Update::{NetworkHandler.AiType}] began chasing local player {base.targetPlayer?.playerUsername}"); } break; case 1: { if (!_hasEnteredChaseState) { _hasEnteredChaseState = true; _wantsToChaseThisClient = false; _wasStopped = false; _wasFeared = false; if (_aiType != RollingGiantAiType.OnceSeenAgroAfterTimer) { _isAgro = false; if (((NetworkBehaviour)this).IsOwner) { _agroTimer.Value = 0f; } } if (((NetworkBehaviour)this).IsOwner) { _waitTimer.Value = 0f; _moveTimer.Value = 0f; _lookTimer.Value = 0f; } } if (base.stunNormalizedTimer > 0f) { break; } PlayerControllerB targetPlayer = base.targetPlayer; if (((NetworkBehaviour)this).IsOwner) { if (!base.isOutside && !((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f)) { ((EnemyAI)this).SwitchToBehaviourState(0); EndChasingPlayer_ServerRpc(); LogInfo($"[Update::{NetworkHandler.AiType}] not in range; SwitchToBehaviourState(0)"); break; } if (base.isOutside && !((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f)) { PlayerControllerB closestPlayer = ((EnemyAI)this).GetClosestPlayer(false, false, false); if (!Object.op_Implicit((Object)(object)closestPlayer)) { ((EnemyAI)this).SwitchToBehaviourState(0); EndChasingPlayer_ServerRpc(); LogInfo($"[Update::{NetworkHandler.AiType}] not in range; SwitchToBehaviourState(0)"); break; } base.targetPlayer = closestPlayer; } if (_wasStopped && _sharedAiSettings.rotateToLookAtPlayer && _lookTimer.Value >= _sharedAiSettings.delayBeforeLookingAtPlayer) { Vector3 position = ((Component)base.targetPlayer).transform.position; Vector3 position2 = ((Component)this).transform.position; Vector3 val = position - position2; val.y = 0f; ((Vector3)(ref val)).Normalize(); Quaternion val2 = Quaternion.LookRotation(val); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, val2, Time.deltaTime / _sharedAiSettings.lookAtPlayerDuration); } } RollingGiantAiType aiType = NetworkHandler.AiType; PlayerControllerB closestPlayer2; switch (aiType) { case RollingGiantAiType.Coilhead: if (AmIBeingLookedAt(out closestPlayer2)) { _wasStopped = true; return; } break; case RollingGiantAiType.InverseCoilhead: if (!AmIBeingLookedAt(out closestPlayer2) && _isAgro && CheckLineOfSightToAnyPlayer()) { _wasStopped = true; return; } break; case RollingGiantAiType.RandomlyMoveWhileLooking: if (AmIBeingLookedAt(out closestPlayer2) && _moveTimer.Value <= 0f) { _wasStopped = true; return; } break; case RollingGiantAiType.LookingTooLongKeepsAgro: if (AmIBeingLookedAt(out closestPlayer2) && _agroTimer.Value < 1f) { _wasStopped = true; return; } break; case RollingGiantAiType.OnceSeenAgroAfterTimer: if (_isAgro && _agroTimer.Value > 0f) { _wasStopped = true; return; } break; default: Plugin.Log.LogWarning((object)$"Unknown ai type: {aiType}"); break; case RollingGiantAiType.FollowOnceAgro: break; } _wasStopped = false; _wasFeared = false; if (((NetworkBehaviour)this).IsOwner && (Object)(object)targetPlayer != (Object)(object)base.targetPlayer) { ((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer); LogInfo($"[Update::{NetworkHandler.AiType}] SetMovingTowardsTargetPlayer, player {base.targetPlayer?.playerUsername}"); } break; } } } private static float SmoothLerp(float a, float b, float t) { return a + t * t * (b - a); } public override void OnCollideWithPlayer(Collider other) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (base.daytimeEnemyLeaving) { return; } ((EnemyAI)this).OnCollideWithPlayer(other); if (!(_timeSinceHittingPlayer < 0.6f)) { PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if (Object.op_Implicit((Object)(object)val) && (!_tooBig || !val.isInHangarShipRoom)) { _timeSinceHittingPlayer = 0.2f; int num = StartOfRound.Instance.playerRagdolls.IndexOf(Plugin.PlayerRagdoll); val.DamagePlayer(90, true, true, (CauseOfDeath)4, num, false, default(Vector3)); base.agent.speed = 0f; GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(1f, true); } } } private void CalculateAgentSpeed() { if (base.stunNormalizedTimer >= 0f) { base.agent.speed = 0f; base.agent.acceleration = 200f; } else if (base.currentBehaviourStateIndex == 0) { MoveAccelerate(); } else { if (base.currentBehaviourStateIndex != 1) { return; } if (((NetworkBehaviour)this).IsOwner && !IsAgentOnNavMesh(((Component)base.agent).gameObject)) { MoveAccelerate(); LogInfo($"[CalculateAgentSpeed::{NetworkHandler.AiType}] not on navmesh"); return; } PlayerControllerB closestPlayer; bool flag = AmIBeingLookedAt(out closestPlayer); if (((NetworkBehaviour)this).IsOwner) { if (flag) { NetworkVariable<float> lookTimer = _lookTimer; lookTimer.Value += Time.deltaTime; } else { _lookTimer.Value = 0f; } } RollingGiantAiType aiType = NetworkHandler.AiType; switch (aiType) { case RollingGiantAiType.Coilhead: if (flag) { MoveDecelerate(); } else { MoveAccelerate(); } break; case RollingGiantAiType.InverseCoilhead: if (!flag && _isAgro && CheckLineOfSightToAnyPlayer()) { MoveDecelerate(); break; } MoveAccelerate(); _isAgro = true; break; case RollingGiantAiType.RandomlyMoveWhileLooking: if (flag) { if (_waitTimer.Value <= 0f && _moveTimer.Value <= 0f) { GenerateWaitTime(); } if (_waitTimer.Value > 0f && _moveTimer.Value <= 0f) { MoveDecelerate(); if (((NetworkBehaviour)this).IsOwner) { LogInfo($"_waitTimer: {_waitTimer.Value}"); NetworkVariable<float> waitTimer = _waitTimer; waitTimer.Value -= Time.deltaTime; if (_waitTimer.Value <= 0f) { GenerateMoveTime(); } } break; } } MoveAccelerate(); if (_moveTimer.Value > 0f && ((NetworkBehaviour)this).IsOwner) { LogInfo($"_moveTimer: {_moveTimer.Value}"); NetworkVariable<float> moveTimer = _moveTimer; moveTimer.Value -= Time.deltaTime; if (_moveTimer.Value <= 0f) { GenerateWaitTime(); } } break; case RollingGiantAiType.LookingTooLongKeepsAgro: if (!_isAgro) { if (flag) { if (((NetworkBehaviour)this).IsOwner) { NetworkVariable<float> agroTimer2 = _agroTimer; agroTimer2.Value += Time.deltaTime / _sharedAiSettings.lookTimeBeforeAgro; } LogInfo($"[Update::{NetworkHandler.AiType}] _agroTimer: {_agroTimer.Value}"); if (_agroTimer.Value >= 1f) { _isAgro = true; LogInfo($"[Update::{NetworkHandler.AiType}] got agro"); } MoveDecelerate(); } else { if (((NetworkBehaviour)this).IsOwner) { _agroTimer.Value = Mathf.Lerp(_agroTimer.Value, 0f, Time.deltaTime / (_sharedAiSettings.lookTimeBeforeAgro * 1.5f)); LogInfo($"[Update::{NetworkHandler.AiType}] _agroTimer: {_agroTimer.Value}"); } MoveAccelerate(); } } else { MoveAccelerate(); } break; case RollingGiantAiType.FollowOnceAgro: if (!_isAgro && flag) { _isAgro = true; MoveDecelerate(); LogInfo($"[Update::{NetworkHandler.AiType}] got agro"); } else { MoveAccelerate(); } break; case RollingGiantAiType.OnceSeenAgroAfterTimer: if (!_isAgro) { if (flag) { _isAgro = true; LogInfo($"[Update::{NetworkHandler.AiType}] got agro"); if (((NetworkBehaviour)this).IsOwner) { _agroTimer.Value = Mathf.Lerp(_sharedAiSettings.waitTimeMin, _sharedAiSettings.waitTimeMax, NextDouble()); } MoveDecelerate(); break; } } else if (_agroTimer.Value > 0f) { LogInfo($"[Update::{NetworkHandler.AiType}] _agroTimer: {_agroTimer.Value}"); if (((NetworkBehaviour)this).IsOwner) { NetworkVariable<float> agroTimer = _agroTimer; agroTimer.Value -= Time.deltaTime; } if (_agroTimer.Value <= 0f) { LogInfo($"[Update::{NetworkHandler.AiType}] chasing time"); } MoveDecelerate(); break; } MoveAccelerate(); break; default: Plugin.Log.LogWarning((object)$"Unknown ai type: {aiType}"); break; } } } private void MoveAccelerate() { base.agent.speed = ((_sharedAiSettings.moveAcceleration == 0f) ? _sharedAiSettings.moveSpeed : Mathf.Lerp(base.agent.speed, _sharedAiSettings.moveSpeed, Time.deltaTime / _sharedAiSettings.moveAcceleration)); base.agent.acceleration = Mathf.Lerp(base.agent.acceleration, 200f, Time.deltaTime); } private void MoveDecelerate() { base.agent.speed = ((_sharedAiSettings.moveDeceleration == 0f) ? 0f : Mathf.Lerp(base.agent.speed, 0f, Time.deltaTime / _sharedAiSettings.moveDeceleration)); base.agent.acceleration = 200f; } private bool AmIBeingLookedAt(out PlayerControllerB closestPlayer) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; float num = float.MaxValue; closestPlayer = null; PlayerControllerB[] array = allPlayerScripts; foreach (PlayerControllerB val in array) { if ((base.isOutside || ((EnemyAI)this).PlayerIsTargetable(val, false, false)) && !val.isPlayerDead && ((NetworkBehaviour)val).IsSpawned && val.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1.6f, 68f, 60, -1f)) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position); if (num2 < num) { num = num2; closestPlayer = val; } } } return Object.op_Implicit((Object)(object)closestPlayer); } private bool CheckLineOfSightTo(PlayerControllerB player) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)player)) { return ((EnemyAI)this).HasLineOfSightToPosition(((Component)player.gameplayCamera).transform.position, 68f, 60, -1f); } return false; } private bool CheckLineOfSightToAnyPlayer() { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (((NetworkBehaviour)val).IsSpawned && !val.isPlayerDead && CheckLineOfSightTo(val)) { return true; } } return false; } private bool IsAgentOnNavMesh(GameObject agentObject) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) Vector3 position = agentObject.transform.position; NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(position, ref val, 3f, -1) && Mathf.Approximately(position.x, ((NavMeshHit)(ref val)).position.x) && Mathf.Approximately(position.z, ((NavMeshHit)(ref val)).position.z)) { return position.y >= ((NavMeshHit)(ref val)).position.y; } return false; } [ServerRpc(RequireOwnership = false)] private void BeginChasingPlayer_ServerRpc(int playerId) { //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_0071: 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) 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(913739805u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 913739805u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { BeginChasingPlayer_ClientRpc(playerId); } } } [ClientRpc] private void BeginChasingPlayer_ClientRpc(int playerId) { //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_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2111596117u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2111596117u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1); PlayerControllerB movingTowardsTargetPlayer = StartOfRound.Instance.allPlayerScripts[playerId]; ((EnemyAI)this).SetMovingTowardsTargetPlayer(movingTowardsTargetPlayer); } } } [ServerRpc(RequireOwnership = false)] private void EndChasingPlayer_ServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_007c: 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(3771085912u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3771085912u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { EndChasingPlayer_ClientRpc(); } } } [ClientRpc] private void EndChasingPlayer_ClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_007c: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1947504516u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1947504516u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { base.movingTowardsTargetPlayer = false; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); } } } private void GenerateWaitTime() { if (((NetworkBehaviour)this).IsOwner) { float value = Mathf.Lerp(_sharedAiSettings.waitTimeMin, _sharedAiSettings.waitTimeMax, NextDouble()); _waitTimer.Value = value; } } private void GenerateAgroTime() { if (((NetworkBehaviour)this).IsOwner) { _agroTimer.Value = _sharedAiSettings.lookTimeBeforeAgro; } } private void GenerateMoveTime() { if (((NetworkBehaviour)this).IsOwner) { float value = Mathf.Lerp(_sharedAiSettings.randomMoveTimeMin, _sharedAiSettings.randomMoveTimeMax, NextDouble()); _moveTimer.Value = value; } } [ServerRpc(RequireOwnership = false)] private void AssignInitData_ServerRpc(float scale) { //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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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(2584131514u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref scale, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2584131514u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { AssignAgentData(scale); ((Component)base.agent).transform.localScale = Vector3.one * scale; AssignInitData_ClientRpc(scale); } } } private void AssignInitData_LocalClient() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0062: Unknown result type (might be due to invalid IL or missing references) CustomConfig instance = SyncedInstance<CustomConfig>.Instance; Vector2 val = (base.isOutside ? new Vector2(instance.GiantScaleOutsideMin, instance.GiantScaleOutsideMax) : new Vector2(instance.GiantScaleInsideMin, instance.GiantScaleInsideMax)); float num = Mathf.Lerp(val.x, val.y, NextDouble()); AssignAgentData(num); ((Component)base.agent).transform.localScale = Vector3.one * num; AssignInitData_ServerRpc(num); } [ClientRpc] private void AssignInitData_ClientRpc(float scale) { //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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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 != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3644677666u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref scale, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3644677666u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { base.updatePositionThreshold = float.MaxValue; AssignAgentData(scale); ((Component)base.agent).transform.localScale = Vector3.one * scale; } } } private void AssignAgentData(float scale) { Init(scale); if (scale >= 1.2f) { int areaMask = base.agent.areaMask; areaMask &= ~(1 << NavMesh.GetAreaFromName("SmallSpace")); areaMask &= ~(1 << NavMesh.GetAreaFromName("MediumSpace")); areaMask &= ~(1 << NavMesh.GetAreaFromName("Climb")); areaMask &= ~(1 << NavMesh.GetAreaFromName("PlayerShip")); base.agent.areaMask = areaMask; _tooBig = true; } } protected override void __initializeVariables() { if (_velocity == null) { throw new Exception("RollingGiantAI._velocity cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_velocity).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_velocity, "_velocity"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_velocity); if (_waitTimer == null) { throw new Exception("RollingGiantAI._waitTimer cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_waitTimer).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_waitTimer, "_waitTimer"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_waitTimer); if (_moveTimer == null) { throw new Exception("RollingGiantAI._moveTimer cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_moveTimer).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_moveTimer, "_moveTimer"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_moveTimer); if (_lookTimer == null) { throw new Exception("RollingGiantAI._lookTimer cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_lookTimer).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_lookTimer, "_lookTimer"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_lookTimer); if (_agroTimer == null) { throw new Exception("RollingGiantAI._agroTimer cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_agroTimer).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_agroTimer, "_agroTimer"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_agroTimer); ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_RollingGiantAI() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1389605656u, new RpcReceiveHandler(__rpc_handler_1389605656)); NetworkManager.__rpc_func_table.Add(913739805u, new RpcReceiveHandler(__rpc_handler_913739805)); NetworkManager.__rpc_func_table.Add(2111596117u, new RpcReceiveHandler(__rpc_handler_2111596117)); NetworkManager.__rpc_func_table.Add(3771085912u, new RpcReceiveHandler(__rpc_handler_3771085912)); NetworkManager.__rpc_func_table.Add(1947504516u, new RpcReceiveHandler(__rpc_handler_1947504516)); NetworkManager.__rpc_func_table.Add(2584131514u, new RpcReceiveHandler(__rpc_handler_2584131514)); NetworkManager.__rpc_func_table.Add(3644677666u, new RpcReceiveHandler(__rpc_handler_3644677666)); } private static void __rpc_handler_1389605656(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((RollingGiantAI)(object)target).ResetValues_ClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_913739805(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((RollingGiantAI)(object)target).BeginChasingPlayer_ServerRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2111596117(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)2; ((RollingGiantAI)(object)target).BeginChasingPlayer_ClientRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3771085912(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((RollingGiantAI)(object)target).EndChasingPlayer_ServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1947504516(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((RollingGiantAI)(object)target).EndChasingPlayer_ClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2584131514(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) { float scale = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref scale, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((RollingGiantAI)(object)target).AssignInitData_ServerRpc(scale); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3644677666(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) { float scale = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref scale, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((RollingGiantAI)(object)target).AssignInitData_ClientRpc(scale); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "RollingGiantAI"; } } public class RollingGiantDeadBody : MonoBehaviour { } public static class Utility { public static object InvokeNotOverride(this MethodInfo methodInfo, object targetObject, params object[] arguments) { ParameterInfo[] parameters = methodInfo.GetParameters(); if (parameters.Length == 0) { if (arguments != null && arguments.Length != 0) { throw new Exception("Arguments cont doesn't match"); } } else if (parameters.Length != arguments.Length) { throw new Exception("Arguments cont doesn't match"); } Type returnType = null; if (methodInfo.ReturnType != typeof(void)) { returnType = methodInfo.ReturnType; } Type type = targetObject.GetType(); DynamicMethod dynamicMethod = new DynamicMethod("", returnType, new Type[2] { type, typeof(object) }, type); ILGenerator iLGenerator = dynamicMethod.GetILGenerator(); iLGenerator.Emit(OpCodes.Ldarg_0); for (int i = 0; i < parameters.Length; i++) { ParameterInfo obj = parameters[i]; iLGenerator.Emit(OpCodes.Ldarg_1); iLGenerator.Emit(OpCodes.Ldc_I4_S, i); iLGenerator.Emit(OpCodes.Ldelem_Ref); Type parameterType = obj.ParameterType; if (parameterType.IsPrimitive) { iLGenerator.Emit(OpCodes.Unbox_Any, parameterType); } else if (!(parameterType == typeof(object))) { iLGenerator.Emit(OpCodes.Castclass, parameterType); } } iLGenerator.Emit(OpCodes.Call, methodInfo); iLGenerator.Emit(OpCodes.Ret); return dynamicMethod.Invoke(null, new object[2] { targetObject, arguments }); } } public static class PluginInfo { public const string PLUGIN_GUID = "RollingGiant"; public const string PLUGIN_NAME = "RollingGiant"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace RollingGiant.Settings { public struct SharedAiSettings : INetworkSerializable { public float moveSpeed; public float moveAcceleration; public float moveDeceleration; public bool rotateToLookAtPlayer; public float delayBeforeLookingAtPlayer; public float lookAtPlayerDuration; public float waitTimeMin; public float waitTimeMax; public float randomMoveTimeMin; public float randomMoveTimeMax; public float lookTimeBeforeAgro; public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter { //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) //IL_0020: 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) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0062: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) ((BufferSerializer<float>*)(&serializer))->SerializeValue<float>(ref moveSpeed, default(ForPrimitives)); ((BufferSerializer<float>*)(&serializer))->SerializeValue<float>(ref moveAcceleration, default(ForPrimitives)); ((BufferSerializer<float>*)(&serializer))->SerializeValue<float>(ref moveDeceleration, default(ForPrimitives)); ((BufferSerializer<bool>*)(&serializer))->SerializeValue<bool>(ref rotateToLookAtPlayer, default(ForPrimitives)); ((BufferSerializer<float>*)(&serializer))->SerializeValue<float>(ref delayBeforeLookingAtPlayer, default(ForPrimitives)); ((BufferSerializer<float>*)(&serializer))->SerializeValue<float>(ref lookAtPlayerDuration, default(ForPrimitives)); ((BufferSerializer<float>*)(&serializer))->SerializeValue<float>(ref waitTimeMin, default(ForPrimitives)); ((BufferSerializer<float>*)(&serializer))->SerializeValue<float>(ref waitTimeMax, default(ForPrimitives)); ((BufferSerializer<float>*)(&serializer))->SerializeValue<float>(ref randomMoveTimeMin, default(ForPrimitives)); ((BufferSerializer<float>*)(&serializer))->SerializeValue<float>(ref randomMoveTimeMax, default(ForPrimitives)); ((BufferSerializer<float>*)(&serializer))->SerializeValue<float>(ref lookTimeBeforeAgro, default(ForPrimitives)); } public override string ToString() { return $"moveSpeed: {moveSpeed}, moveAcceleration: {moveAcceleration}, moveDeceleration: {moveDeceleration}, rotateToLookAtPlayer: {rotateToLookAtPlayer}, delayBeforeLookingAtPlayer: {delayBeforeLookingAtPlayer}, lookAtPlayerDuration: {lookAtPlayerDuration}, waitTimeMin: {waitTimeMin}, waitTimeMax: {waitTimeMax}, randomMoveTimeMin: {randomMoveTimeMin}, randomMoveTimeMax: {randomMoveTimeMax}, lookTimeBeforeAgro: {lookTimeBeforeAgro}"; } } [Serializable] public class CustomConfig : SyncedInstance<CustomConfig> { public const string ROLLINGGIANT_ONREQUESTCONFIGSYNC = "RollingGiant_OnRequestConfigSync"; public const string ROLLINGGIANT_ONRECEIVECONFIGSYNC = "RollingGiant_OnReceiveConfigSync"; private static ConfigFile _config; public const string Name1 = "1. General Settings"; public const string Name2 = "2. AI Settings"; public const string AiTypeDescription = "The AI type of the Rolling Giant.\n(Putting multiple will randomly choose between them each time you land on a moon)"; public const string AiTypeChangeOnHourIntervalDescription = "If the AI type should change every X hours. This will affect already spawned Rolling Giants!\nIf set to 0 it will not change.\nWill pick from the values set in AiType."; public const string MoveSpeedDescription = "The speed of the Rolling Giant in m/s²."; public const string MoveAccelerationDescription = "How long it takes the Rolling Giant to get to its movement speed. in seconds"; public const string MoveDecelerationDescription = "How long it takes the Rolling Giant to stop moving in seconds."; public const string RotateToLookAtPlayerDescription = "If the Rolling Giant should rotate to look at the player."; public const string DelayBeforeLookingAtPlayerDescription = "The delay before the Rolling Giant looks at the player in seconds."; public const string LookAtPlayerDurationDescription = "The duration the Rolling Giant looks at the player in seconds."; public static SharedAiSettings SharedAiSettings { get; private set; } public static ConfigEntry<string> GotoPreviousAiTypeKey { get; private set; } public static ConfigEntry<string> GotoNextAiTypeKey { get; private set; } public static ConfigEntry<string> ReloadConfigKey { get; private set; } public static ConfigEntry<string> SpawnInEntry { get; private set; } public static ConfigEntry<int> SpawnInOutsideChanceEntry { get; private set; } public static ConfigEntry<bool> SpawnInAnyEntry { get; private set; } public static ConfigEntry<int> SpawnInAnyChanceEntry { get; private set; } public static ConfigEntry<int> SpawnInAnyOutsideChanceEntry { get; private set; } public static ConfigEntry<bool> CanSpawnInsideEntry { get; private set; } public static ConfigEntry<bool> CanSpawnOutsideEntry { get; private set; } public static ConfigEntry<bool> DisableOutsideAtNightEntry { get; private set; } public static ConfigEntry<int> MaxPerLevelEntry { get; private set; } public static ConfigEntry<string> SpawnPosterInEntry { get; private set; } public float GiantScaleInsideMin { get; private set; } public float GiantScaleInsideMax { get; private set; } public float GiantScaleOutsideMin { get; private set; } public float GiantScaleOutsideMax { get; private set; } public static string SpawnIn { get; private set; } public static int SpawnInOutsideChance { get; private set; } public static bool SpawnInAny { get; private set; } public static int SpawnInAnyChance { get; private set; } public static int SpawnInAnyOutsideChance { get; private set; } public static bool CanSpawnInside { get; private set; } public static bool CanSpawnOutside { get; private set; } public static bool DisableOutsideAtNight { get; private set; } public static int MaxPerLevel { get; private set; } public static string SpawnPosterIn { get; private set; } public static RollingGiantAiType AiType { get; internal set; } public static int AiTypeChangeOnHourInterval { get; private set; } public float MoveSpeed { get; private set; } public float MoveAcceleration { get; private set; } public float MoveDeceleration { get; private set; } public bool RotateToLookAtPlayer { get; private set; } public float DelayBeforeLookingAtPlayer { get; private set; } public float LookAtPlayerDuration { get; private set; } public float RandomlyMoveWhenLooking_WaitTimeMin { get; private set; } public float RandomlyMoveWhenLooking_WaitTimeMax { get; private set; } public float RandomlyMoveWhenLooking_RandomMoveTimeMin { get; private set; } public float RandomlyMoveWhenLooking_RandomMoveTimeMax { get; private set; } public float LookingTooLongKeepsAgro_LookTimeBeforeAgro { get; private set; } public float OnceSeenAgroAfterTimer_WaitTimeMin { get; private set; } public float OnceSeenAgroAfterTimer_WaitTimeMax { get; private set; } public static ConfigEntry<float> GiantScaleInsideMinEntry { get; private set; } public static ConfigEntry<float> GiantScaleInsideMaxEntry { get; private set; } public static ConfigEntry<float> GiantScaleOutsideMinEntry { get; private set; } public static ConfigEntry<float> GiantScaleOutsideMaxEntry { get; private set; } public static ConfigEntry<RollingGiantAiType> AiTypeEntry { get; private set; } public static ConfigEntry<float> MoveSpeedEntry { get; private set; } public static ConfigEntry<float> MoveAccelerationEntry { get; private set; } public static ConfigEntry<float> MoveDecelerationEntry { get; private set; } public static ConfigEntry<bool> RotateToLookAtPlayerEntry { get; private set; } public static ConfigEntry<float> DelayBeforeLookingAtPlayerEntry { get; private set; } public static ConfigEntry<float> LookAtPlayerDurationEntry { get; private set; } public static ConfigEntry<float> RandomlyMoveWhenLooking_WaitTimeMinEntry { get; private set; } public static ConfigEntry<float> RandomlyMoveWhenLooking_WaitTimeMaxEntry { get; private set; } public static ConfigEntry<float> RandomlyMoveWhenLooking_RandomMoveTimeMinEntry { get; private set; } public static ConfigEntry<float> RandomlyMoveWhenLooking_RandomMoveTimeMaxEntry { get; private set; } public static ConfigEntry<float> LookingTooLongKeepsAgro_LookTimeBeforeAgroEntry { get; private set; } public static ConfigEntry<float> OnceSeenAgroAfterTimer_WaitTimeMinEntry { get; private set; } public static ConfigEntry<float> OnceSeenAgroAfterTimer_WaitTimeMaxEntry { get; private set; } public CustomConfig(ConfigFile config) { _config = config; InitInstance(this); Reload(); } public void Save() { if (_config == null) { throw new NullReferenceException("Config is null."); } _config.Save(); } public void AssignFromSaved() { GiantScaleInsideMinEntry.Value = GiantScaleInsideMin; GiantScaleInsideMaxEntry.Value = GiantScaleInsideMax; GiantScaleOutsideMinEntry.Value = GiantScaleOutsideMin; GiantScaleOutsideMaxEntry.Value = GiantScaleOutsideMax; SpawnInEntry.Value = SpawnIn; SpawnInOutsideChanceEntry.Value = SpawnInAnyOutsideChance; SpawnInAnyEntry.Value = SpawnInAny; SpawnInAnyChanceEntry.Value = SpawnInAnyChance; SpawnInAnyOutsideChanceEntry.Value = SpawnInAnyOutsideChance; CanSpawnInsideEntry.Value = CanSpawnInside; CanSpawnOutsideEntry.Value = CanSpawnOutside; DisableOutsideAtNightEntry.Value = DisableOutsideAtNight; MaxPerLevelEntry.Value = MaxPerLevel; SpawnPosterInEntry.Value = SpawnPosterIn; AiTypeEntry.Value = AiType; AiTypeChangeOnHourInterval = AiTypeChangeOnHourInterval; MoveSpeedEntry.Value = MoveSpeed; MoveAccelerationEntry.Value = MoveAcceleration; MoveDecelerationEntry.Value = MoveDeceleration; RotateToLookAtPlayerEntry.Value = RotateToLookAtPlayer; DelayBeforeLookingAtPlayerEntry.Value = DelayBeforeLookingAtPlayer; LookAtPlayerDurationEntry.Value = LookAtPlayerDuration; RandomlyMoveWhenLooking_WaitTimeMinEntry.Value = RandomlyMoveWhenLooking_WaitTimeMin; RandomlyMoveWhenLooking_WaitTimeMaxEntry.Value = RandomlyMoveWhenLooking_WaitTimeMax; RandomlyMoveWhenLooking_RandomMoveTimeMinEntry.Value = RandomlyMoveWhenLooking_RandomMoveTimeMin; RandomlyMoveWhenLooking_RandomMoveTimeMaxEntry.Value = RandomlyMoveWhenLooking_RandomMoveTimeMax; LookingTooLongKeepsAgro_LookTimeBeforeAgroEntry.Value = LookingTooLongKeepsAgro_LookTimeBeforeAgro; OnceSeenAgroAfterTimer_WaitTimeMinEntry.Value = OnceSeenAgroAfterTimer_WaitTimeMin; OnceSeenAgroAfterTimer_WaitTimeMaxEntry.Value = OnceSeenAgroAfterTimer_WaitTimeMax; } public void Reload(bool setValues = true) { GiantScaleInsideMinEntry = _config.Bind<float>("1. General Settings", "GiantScaleInsideMin", 0.9f, "The min scale of the Rolling Giant inside.\nThis is a multiplier, so 0.5 is half as large."); GiantScaleInsideMaxEntry = _config.Bind<float>("1. General Settings", "GiantScaleInsideMax", 1.1f, "The max scale of the Rolling Giant inside.\nThis is a multiplier, so 2 is twice as large."); GiantScaleOutsideMinEntry = _config.Bind<float>("1. General Settings", "GiantScaleOutsideMin", 0.9f, "The min scale of the Rolling Giant outside.\nThis is a multiplier, so 0.5 is half as large."); GiantScaleOutsideMaxEntry = _config.Bind<float>("1. General Settings", "GiantScaleOutsideMax", 1.1f, "The max scale of the Rolling Giant outside.\nThis is a multiplier, so 2 is twice as large."); SpawnInEntry = _config.Bind<string>("1. General Settings", "SpawnIn", "Vow:45,March:45,Rend:54,Dine:65,Offense:45,Titan:65", "Where the Rolling Giant can spawn.\nSeparate each level with a comma, and put a chance (no decimals) separated by a colon.\nVanilla caps at 100, but you can go farther.\nThis chance is also a weight, not a percentage.\nHigher chance = higher chance to get picked\nThe names are what you see in the terminal\nExample: Vow:6,March:10"); SpawnInOutsideChanceEntry = _config.Bind<int>("1. General Settings", "SpawnInOutsideChance", 45, "The chance for the Rolling Giant to spawn outside.\nIs used alongside SpawnIn.\nThis is a weight, not a percentage.\nHigher chance = higher chance to get picked"); SpawnInAnyEntry = _config.Bind<bool>("1. General Settings", "SpawnInAny", false, "If the Rolling Giant can spawn in any level."); SpawnInAnyChanceEntry = _config.Bind<int>("1. General Settings", "SpawnInAnyChance", 45, "The chance for the Rolling Giant to spawn in any level.\nRequires SpawnInAny to be enabled!\nThis is a weight, not a percentage.\nHigher chance = higher chance to get picked"); SpawnInAnyOutsideChanceEntry = _config.Bind<int>("1. General Settings", "SpawnInAnyOutsideChance", 45, "The chance for the Rolling Giant to spawn outside when spawning in any level.\nRequires SpawnInAny to be enabled!\nThis is a weight, not a percentage.\nHigher chance = higher chance to get picked"); CanSpawnInsideEntry = _config.Bind<bool>("1. General Settings", "CanSpawnInside", true, "If the Rolling Giant can spawn inside."); CanSpawnOutsideEntry = _config.Bind<bool>("1. General Settings", "CanSpawnOutside", false, "If the Rolling Giant can spawn outside."); DisableOutsideAtNightEntry = _config.Bind<bool>("1. General Settings", "DisableOutsideAtNight", false, "If the Rolling Giant will turn off if it is outside at night."); MaxPerLevelEntry = _config.Bind<int>("1. General Settings", "MaxPerLevel", 3, "The maximum amount of Rolling Giants that can spawn in a level."); SpawnPosterInEntry = _config.Bind<string>("1. General Settings", "SpawnPosterIn", "Vow:12,March:12,Rend:12,Dine:12,Offense:12,Titan:12", "Where the Rolling Giant poster scrap can spawn.\nSeparate each level with a comma, and put a chance separated by a colon.\nVanilla caps at 100, but you can go farther.\nThis chance is also a weight, not a percentage.\nHigher chance = higher chance to get picked\nThe names are what you see in the terminal\nExample: Vow:12,March:12,Rend:12,Dine:12,Offense:12,Titan:12"); if (GotoPreviousAiTypeKey == null) { GotoPreviousAiTypeKey = _config.Bind<string>("Host", "GotoPreviousAiTypeKey", "<Keyboard>/numpad7", "The key to go to the previous AI type. This uses Unity's New Input System's key-bind names.\nhttps://docs.unity3d.com/Packages/[email protected]/manual/Controls.html#control-paths"); } if (GotoNextAiTypeKey == null) { GotoNextAiTypeKey = _config.Bind<string>("Host", "GotoNextAiTypeKey", "<Keyboard>/numpad8", "The key to go to the next AI type. This uses Unity's New Input System's key-bind names.\nhttps://docs.unity3d.com/Packages/[email protected]/manual/Controls.html#control-paths"); } if (ReloadConfigKey == null) { ReloadConfigKey = _config.Bind<string>("Host", "ReloadConfigKey", "<Keyboard>/numpad9", "The key to reload the config. Does not update spawn conditions. This uses Unity's New Input System's key-bind names.\nhttps://docs.unity3d.com/Packages/[email protected]/manual/Controls.html#control-paths"); } string text = "The AI type of the Rolling Giant.\n(Putting multiple will randomly choose between them each time you land on a moon)"; foreach (object value in Enum.GetValues(typeof(RollingGiantAiType))) { string arg = GetAttributeOfType<DescriptionAttribute>((Enum)value)?.Description ?? "No description found."; text += $"\n{value}: {arg}"; } AiTypeEntry = _config.Bind<RollingGiantAiType>("2. AI Settings", "AiType", RollingGiantAiType.RandomlyMoveWhileLooking, text); AiTypeChangeOnHourInterval = _config.Bind<int>("2. AI Settings", "AiTypeChangeOnHourInterval", 0, "If the AI type should change every X hours. This will affect already spawned Rolling Giants!\nIf set to 0 it will not change.\nWill pick from the values set in AiType.").Value; MoveSpeedEntry = _config.Bind<float>("2. AI Settings", "MoveSpeed", 6f, "The speed of the Rolling Giant in m/s²."); MoveAccelerationEntry = _config.Bind<float>("2. AI Settings", "MoveAcceleration", 2f, "How long it takes the Rolling Giant to get to its movement speed. in seconds"); MoveDecelerationEntry = _config.Bind<float>("2. AI Settings", "MoveDeceleration", 0.5f, "How long it takes the Rolling Giant to stop moving in seconds."); RotateToLookAtPlayerEntry = _config.Bind<bool>("2. AI Settings", "RotateToLookAtPlayer", true, "If the Rolling Giant should rotate to look at the player."); DelayBeforeLookingAtPlayerEntry = _config.Bind<float>("2. AI Settings", "DelayBeforeLookingAtPlayer", 2f, "The delay before the Rolling Giant looks at the player in seconds."); LookAtPlayerDurationEntry = _config.Bind<float>("2. AI Settings", "LookAtPlayerDuration", 3f, "The duration the Rolling Giant looks at the player in seconds."); RandomlyMoveWhenLooking_WaitTimeMinEntry = _config.Bind<float>("AI.RandomlyMoveWhenLooking", "WaitTimeMin", 1f, "The minimum duration in seconds that the Rolling Giant waits before moving again."); RandomlyMoveWhenLooking_WaitTimeMaxEntry = _config.Bind<float>("AI.RandomlyMoveWhenLooking", "WaitTimeMax", 3f, "The maximum duration in seconds that the Rolling Giant waits before moving again."); RandomlyMoveWhenLooking_RandomMoveTimeMinEntry = _config.Bind<float>("AI.RandomlyMoveWhenLooking", "RandomMoveTimeMin", 1f, "The minimum duration in seconds that the Rolling Giant moves for."); RandomlyMoveWhenLooking_RandomMoveTimeMaxEntry = _config.Bind<float>("AI.RandomlyMoveWhenLooking", "RandomMoveTimeMax", 3f, "The maximum duration in seconds that the Rolling Giant moves for."); LookingTooLongKeepsAgro_LookTimeBeforeAgroEntry = _config.Bind<float>("AI.LookingTooLongKeepsAgro", "LookTimeBeforeAgro", 12f, "How long the player can look at the Rolling Giant before it starts chasing in seconds."); OnceSeenAgroAfterTimer_WaitTimeMinEntry = _config.Bind<float>("AI.OnceSeenAgroAfterTimer", "WaitTimeMin", 15f, "The minimum duration in seconds the Rolling Giant waits before chasing the player."); OnceSeenAgroAfterTimer_WaitTimeMaxEntry = _config.Bind<float>("AI.OnceSeenAgroAfterTimer", "WaitTimeMax", 30f, "The minimum duration in seconds the Rolling Giant waits before chasing the player."); if (setValues) { GiantScaleInsideMin = GiantScaleInsideMinEntry.Value; GiantScaleInsideMax = GiantScaleInsideMaxEntry.Value; GiantScaleOutsideMin = GiantScaleOutsideMinEntry.Value; GiantScaleOutsideMax = GiantScaleOutsideMaxEntry.Value; SpawnIn = SpawnInEntry.Value; SpawnInOutsideChance = SpawnInOutsideChanceEntry.Value; SpawnInAny = SpawnInAnyEntry.Value; SpawnInAnyChance = SpawnInAnyChanceEntry.Value; SpawnInAnyOutsideChance = SpawnInAnyOutsideChanceEntry.Value; CanSpawnInside = CanSpawnInsideEntry.Value; CanSpawnOutside = CanSpawnOutsideEntry.Value; DisableOutsideAtNight = DisableOutsideAtNightEntry.Value; MaxPerLevel = MaxPerLevelEntry.Value; SpawnPosterIn = SpawnPosterInEntry.Value; AiType = AiTypeEntry.Value; AiTypeChangeOnHourInterval = AiTypeChangeOnHourInterval; MoveSpeed = MoveSpeedEntry.Value; MoveAcceleration = MoveAccelerationEntry.Value; MoveDeceleration = MoveDecelerationEntry.Value; RotateToLookAtPlayer = RotateToLookAtPlayerEntry.Value; DelayBeforeLookingAtPlayer = DelayBeforeLookingAtPlayerEntry.Value; LookAtPlayerDuration = LookAtPlayerDurationEntry.Value; RandomlyMoveWhenLooking_WaitTimeMin = RandomlyMoveWhenLooking_WaitTimeMinEntry.Value; RandomlyMoveWhenLooking_WaitTimeMax = RandomlyMoveWhenLooking_WaitTimeMaxEntry.Value; RandomlyMoveWhenLooking_RandomMoveTimeMin = RandomlyMoveWhenLooking_RandomMoveTimeMinEntry.Value; RandomlyMoveWhenLooking_RandomMoveTimeMax = RandomlyMoveWhenLooking_RandomMoveTimeMaxEntry.Value; LookingTooLongKeepsAgro_LookTimeBeforeAgro = LookingTooLongKeepsAgro_LookTimeBeforeAgroEntry.Value; OnceSeenAgroAfterTimer_WaitTimeMin = OnceSeenAgroAfterTimer_WaitTimeMinEntry.Value; OnceSeenAgroAfterTimer_WaitTimeMax = OnceSeenAgroAfterTimer_WaitTimeMaxEntry.Value; SetCurrentAi(); } Plugin.Log.LogInfo((object)"Config reloaded."); } private static T GetAttributeOfType<T>(Enum enumVal) where T : Attribute { object[] customAttributes = enumVal.GetType().GetMember(enumVal.ToString())[0].GetCustomAttributes(typeof(T), inherit: false); if (customAttributes.Length == 0) { return null; } return (T)customAttributes[0]; } public static SharedAiSettings GetSharedAiSettings() { SharedAiSettings result = default(SharedAiSettings); result.moveSpeed = SyncedInstance<CustomConfig>.Instance.MoveSpeed; result.moveAcceleration = SyncedInstance<CustomConfig>.Instance.MoveAcceleration; result.moveDeceleration = SyncedInstance<CustomConfig>.Instance.MoveDeceleration; result.rotateToLookAtPlayer = SyncedInstance<CustomConfig>.Instance.RotateToLookAtPlayer; result.delayBeforeLookingAtPlayer = SyncedInstance<CustomConfig>.Instance.DelayBeforeLookingAtPlayer; result.lookAtPlayerDuration = SyncedInstance<CustomConfig>.Instance.LookAtPlayerDuration; return result; } public static void RequestSync() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<CustomConfig>.IsClient) { Plugin.Log.LogError((object)"Config sync error: Not a client."); return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(SyncedInstance<CustomConfig>.IntSize, (Allocator)2, -1); try { SyncedInstance<CustomConfig>.MessageManager.SendNamedMessage("RollingGiant_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); Plugin.Log.LogInfo((object)"Config sync request sent."); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnRequestSync(ulong clientId, FastBufferReader _) { //IL_0056: 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_0077: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<CustomConfig>.IsHost) { Plugin.Log.LogError((object)"Config sync error: Not a host."); return; } Plugin.Log.LogInfo((object)$"Config sync request received from client: {clientId}"); byte[] array = SyncedInstance<CustomConfig>.SerializeToBytes(SyncedInstance<CustomConfig>.Instance); int num = array.Length; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(num + SyncedInstance<CustomConfig>.IntSize, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0); SyncedInstance<CustomConfig>.MessageManager.SendNamedMessage("RollingGiant_OnReceiveConfigSync", clientId, val, (NetworkDelivery)4); Plugin.Log.LogInfo((object)$"Config sync sent to client: {clientId}"); } catch (Exception arg) { Plugin.Log.LogError((object)$"Error occurred syncing config with client: {clientId}\n{arg}"); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong _, FastBufferReader reader) { //IL_0024: 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) if (!((FastBufferReader)(ref reader)).TryBeginRead(SyncedInstance<CustomConfig>.IntSize)) { Plugin.Log.LogError((object)"Config sync error: Could not begin reading buffer."); return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (!((FastBufferReader)(ref reader)).TryBeginRead(num)) { Plugin.Log.LogError((object)"Config sync error: Host could not sync."); return; } byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); SyncedInstance<CustomConfig>.SyncInstance(data); SetCurrentAi(); Plugin.Log.LogInfo((object)"Successfully synced config with host."); } public static void SetCurrentAi() { if (!Object.op_Implicit((Object)(object)NetworkHandler.Instance)) { return; } RollingGiantAiType aiType = NetworkHandler.AiType; SharedAiSettings sharedAiSettings; switch (aiType) { case RollingGiantAiType.Coilhead: sharedAiSettings = GetSharedAiSettings(); break; case RollingGiantAiType.InverseCoilhead: sharedAiSettings = GetSharedAiSettings(); break; case RollingGiantAiType.RandomlyMoveWhileLooking: { SharedAiSettings sharedAiSettings2 = GetSharedAiSettings(); sharedAiSettings2.waitTimeMin = SyncedInstance<CustomConfig>.Instance.RandomlyMoveWhenLooking_WaitTimeMin; sharedAiSettings2.waitTimeMax = SyncedInstance<CustomConfig>.Instance.RandomlyMoveWhenLooking_WaitTimeMax; sharedAiSettings2.randomMoveTimeMin = SyncedInstance<CustomConfig>.Instance.RandomlyMoveWhenLooking_RandomMoveTimeMin; sharedAiSettings2.randomMoveTimeMax = SyncedInstance<CustomConfig>.Instance.RandomlyMoveWhenLooking_RandomMoveTimeMax; sharedAiSettings = sharedAiSettings2; break; } case RollingGiantAiType.LookingTooLongKeepsAgro: { SharedAiSettings sharedAiSettings2 = GetSharedAiSettings(); sharedAiSettings2.lookTimeBeforeAgro = SyncedInstance<CustomConfig>.Instance.LookingTooLongKeepsAgro_LookTimeBeforeAgro; sharedAiSettings = sharedAiSettings2; break; } case RollingGiantAiType.FollowOnceAgro: sharedAiSettings = GetSharedAiSettings(); break; case RollingGiantAiType.OnceSeenAgroAfterTimer: { SharedAiSettings sharedAiSettings2 = GetSharedAiSettings(); sharedAiSettings2.waitTimeMin = SyncedInstance<CustomConfig>.Instance.OnceSeenAgroAfterTimer_WaitTimeMin; sharedAiSettings2.waitTimeMax = SyncedInstance<CustomConfig>.Instance.OnceSeenAgroAfterTimer_WaitTimeMax; sharedAiSettings = sharedAiSettings2; break; } default: sharedAiSettings = GetSharedAiSettings(); break; } SharedAiSettings = sharedAiSettings; Plugin.Log.LogInfo((object)$"[{aiType}]: {SharedAiSettings}"); if ((!NetworkManager.Singleton.IsHost && !NetworkManager.Singleton.IsServer) || !Object.op_Implicit((Object)(object)RoundManager.Instance)) { return; } List<EnemyAI> spawnedEnemies = RoundManager.Instance.SpawnedEnemies; if (spawnedEnemies == null) { return; } Plugin.Log.LogInfo((object)"Resetting all rolling giants!"); foreach (EnemyAI item in spawnedEnemies) { if (item is RollingGiantAI rollingGiantAI) { rollingGiantAI.ResetValues(); } } } } public class GeneralSettings { public const string Name = "1. General Settings"; public ConfigEntry<float> ChanceForGiant; public ConfigEntry<float> GiantScaleMin; public ConfigEntry<float> GiantScaleMax; public ConfigEntry<bool> SpawnInAllLevels; public ConfigEntry<bool> SpawnInLevelsWithCoilHead; public ConfigEntry<bool> SpawnInside; public ConfigEntry<bool> SpawnDaytime; public ConfigEntry<bool> SpawnOutside; public ConfigEntry<int> Version; public ConfigEntry<string> GotoPreviousAiTypeKey; public ConfigEntry<string> GotoNextAiTypeKey; public GeneralSettings(ConfigFile configFile) { ChanceForGiant = configFile.Bind<float>("1. General Settings", "ChanceForGiant", 0.4f, "0.0-1.0: Chance for a Rolling Giant to spawn. Higher means more chances for a Rolling Giant."); GiantScaleMin = configFile.Bind<float>("1. General Settings", "GiantScaleMin", 1f, "The minimum scale of the Rolling Giant."); GiantScaleMax = configFile.Bind<float>("1. General Settings", "GiantScaleMax", 1f, "The maximum scale of the Rolling Giant."); SpawnInAllLevels = configFile.Bind<bool>("1. General Settings", "SpawnInAllLevels", false, "If the Rolling Giant should spawn in all levels."); SpawnInLevelsWithCoilHead = configFile.Bind<bool>("1. General Settings", "SpawnInLevelsWithCoilHead", true, "If the Rolling Giant should spawn in levels with a Coilhead."); SpawnInside = configFile.Bind<bool>("1. General Settings", "SpawnInside", true, "If the Rolling Giant should spawn inside."); SpawnDaytime = configFile.Bind<bool>("1. General Settings", "SpawnDaytime", false, "If the Rolling Giant should spawn during the day."); SpawnOutside = configFile.Bind<bool>("1. General Settings", "SpawnOutside", false, "If the Rolling Giant should spawn outside."); Version = configFile.Bind<int>("z_Ignore", "__version", 0, "The version of this config file. Do not change this."); GotoPreviousAiTypeKey = configFile.Bind<string>("Dev", "GotoPreviousAiTypeKey", "<Keyboard>/numpad7", "The key to go to the previous AI type. This uses Unity's New Input System's key-bind names."); GotoNextAiTypeKey = configFile.Bind<string>("Dev", "GotoNextAiTypeKey", "<Keyboard>/numpad9", "The key to go to the next AI type. This uses Unity's New Input System's key-bind names."); } public float GetRandomScale(Random rng) { float num = (float)rng.NextDouble(); float value = GiantScaleMin.Value; float value2 = GiantScaleMax.Value; return Mathf.Lerp(value, value2, num); } } [Serializable] public class SyncedInstance<T> { [NonSerialized] protected static int IntSize = 4; internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager; internal static bool IsClient => NetworkManager.Singleton.IsClient; internal static bool IsHost => NetworkManager.Singleton.IsHost; public static T Default { get; private set; } public static T Instance { get; private set; } public static bool Synced { get; internal set; } protected void InitInstance(T instance) { Default = instance; Instance = instance; IntSize = 4; } internal static void SyncInstance(byte[] data) { Instance = DeserializeFromBytes(data); Synced = true; } internal static void RevertSync() { Instance = Default; Synced = f
BepInEx/plugins/Snowlance.SoThisIsImmortalSnail.dll
Decompiled 4 days agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using ImmortalSnail; using LCSoundTool; using Microsoft.CodeAnalysis; using SoThisIsImmortalSnail; 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: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: AssemblyCompany("Snowlance.SoThisIsImmortalSnail")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+dc8111b331b16e38a3ad6e3ff61b36912c65e465")] [assembly: AssemblyProduct("SoThisIsImmortalSnail")] [assembly: AssemblyTitle("Snowlance.SoThisIsImmortalSnail")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.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; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class SnailMusicController : MonoBehaviour { public SnailAI SnailInstance; public void Update() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) SoThisIsImmortalSnailBase.LoggerInstance.LogDebug((object)"SnailMusicController.Update"); if (!SoThisIsImmortalSnailBase.configPlayWhenLookingAtSnail.Value) { return; } if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)SnailInstance).transform.position, 70f, SoThisIsImmortalSnailBase.configDistance.Value, -1f)) { if (!((EnemyAI)SnailInstance).creatureSFX.isPlaying) { ((EnemyAI)SnailInstance).creatureSFX.Play(); } } else if (SoThisIsImmortalSnailBase.configPauseWhenNotLooking.Value) { ((EnemyAI)SnailInstance).creatureSFX.Pause(); } else { ((EnemyAI)SnailInstance).creatureSFX.Stop(); } } } namespace SoThisIsImmortalSnail { [BepInPlugin("Snowlance.SoThisIsImmortalSnail", "SoThisIsImmortalSnail", "1.0.0")] public class SoThisIsImmortalSnailBase : BaseUnityPlugin { private const string modGUID = "Snowlance.SoThisIsImmortalSnail"; private const string modName = "SoThisIsImmortalSnail"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("Snowlance.SoThisIsImmortalSnail"); public static ConfigEntry<float> configVolume; public static ConfigEntry<bool> configPlayWhenLookingAtSnail; public static ConfigEntry<int> configDistance; public static ConfigEntry<bool> configPauseWhenNotLooking; public static AudioClip christmasMusic; public static SoThisIsImmortalSnailBase PluginInstance { get; private set; } public static ManualLogSource LoggerInstance { get; private set; } private void Awake() { if ((Object)(object)PluginInstance == (Object)null) { PluginInstance = this; } LoggerInstance = ((BaseUnityPlugin)PluginInstance).Logger; LoggerInstance.LogDebug((object)"Plugin SoThisIsImmortalSnail loaded successfully."); configVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "MusicVolume", 1f, "Volume of the music. Must be between 0 and 1."); configPlayWhenLookingAtSnail = ((BaseUnityPlugin)this).Config.Bind<bool>("Looking Mechanic", "PlayWhenLookingAtSnail", true, "Play the music only when the player is looking at the snail. Everything below this only works if this is set to true."); configDistance = ((BaseUnityPlugin)this).Config.Bind<int>("Looking Mechanic", "Distance", 50, "Play the music only when the player is looking at a certain distance of the snail."); configPauseWhenNotLooking = ((BaseUnityPlugin)this).Config.Bind<bool>("Looking Mechanic", "PauseWhenNotLooking", true, "Wether to pause the music when not looking at the snail, or stop it and start it over again when looking again. true = Pause, false = Stop."); christmasMusic = SoundTool.GetAudioClip(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "christmasMusic.wav"); LoggerInstance.LogDebug((object)$"Loaded christmasMusic: {christmasMusic}"); harmony.PatchAll(); LoggerInstance.LogInfo((object)"Snowlance.SoThisIsImmortalSnail v1.0.0 has loaded!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Snowlance.SoThisIsImmortalSnail"; public const string PLUGIN_NAME = "SoThisIsImmortalSnail"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace SoThisIsImmortalSnail.Patches { [HarmonyPatch(typeof(SnailAI))] internal class SnailAIPatch { private static ManualLogSource LoggerInstance = SoThisIsImmortalSnailBase.LoggerInstance; [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(SnailAI __instance) { ((EnemyAI)__instance).creatureSFX = ((Component)__instance).gameObject.AddComponent<AudioSource>(); ((EnemyAI)__instance).creatureSFX.clip = SoThisIsImmortalSnailBase.christmasMusic; ((EnemyAI)__instance).creatureSFX.loop = true; ((EnemyAI)__instance).creatureSFX.volume = 1f; ((EnemyAI)__instance).creatureSFX.spatialBlend = 1f; SnailMusicController snailMusicController = ((Component)__instance).gameObject.AddComponent<SnailMusicController>(); snailMusicController.SnailInstance = __instance; if (!SoThisIsImmortalSnailBase.configPlayWhenLookingAtSnail.Value) { ((EnemyAI)__instance).creatureSFX.Play(); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }