Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of TryCompactSomeMod v1.0.1
LC_HandHeldDevice.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LC_HandHeldDevice.Patches; using LethalLib.Modules; 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: AssemblyTitle("LC_HandHeldDevice")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LC_HandHeldDevice")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("2e45d23a-326c-4621-879f-642402b89ccd")] [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 LC_HandHeldDevice { [BepInPlugin("Mellowdy.HandHeldMapMod", "HandHeldMapMod", "1.3.0")] public class HandHeldMapMod : BaseUnityPlugin { private const string modGUID = "Mellowdy.HandHeldMapMod"; private const string modName = "HandHeldMapMod"; private const string modVersion = "1.3.0"; private const string assetName = "map.device"; private const string gameObjectName = "HandHeldMapDevice.prefab"; private readonly Harmony harmony = new Harmony("Mellowdy.HandHeldMapMod"); public static ManualLogSource mls; private static HandHeldMapMod instance; private static string Name = "Hand-held Map"; private static ConfigEntry<int> price; private static ConfigEntry<float> BatteryUsage; private static ConfigEntry<float> TurnOnBatteryUsage; private static ConfigEntry<bool> BatteryFail; private static ConfigEntry<float> FailureBreakPoint; private static ConfigEntry<float> BaseChance; private static ConfigEntry<float> Size; private static ConfigEntry<bool> Light; public static GameObject cameraPrefab; public static Material backUpMaterialOff; public static Material backUpMaterialOn; private void Awake() { //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)instance == (Object)null) { instance = this; } mls = Logger.CreateLogSource("Mellowdy.HandHeldMapMod"); harmony.PatchAll(); price = ((BaseUnityPlugin)this).Config.Bind<int>("Price", "MapPrice", 45, "Credits needed to buy the hand-held map"); BatteryUsage = ((BaseUnityPlugin)this).Config.Bind<float>("Battery", "Battery Charge", 120f, "The amount of time in seconds the map can be active"); TurnOnBatteryUsage = ((BaseUnityPlugin)this).Config.Bind<float>("Battery", "Turn on requirement", 0.05f, "The percent of battery that gets drained when the map gets turned on (0.1 = 10% drain each time its turned on)"); BatteryFail = ((BaseUnityPlugin)this).Config.Bind<bool>("Battery", "Battery Failure", true, "decription"); FailureBreakPoint = ((BaseUnityPlugin)this).Config.Bind<float>("Battery", "Battery Failure Break Point", 0.5f, "The charge breakpoint where the map will begin to glitch and fail to update as often (0.5 = map will start failing at 50% charge)"); BaseChance = ((BaseUnityPlugin)this).Config.Bind<float>("Battery", "Base Chance", 2f, "The base chance for the map to update every second after battery failure"); HandHeldMap.pocketTurnOff = ((BaseUnityPlugin)this).Config.Bind<bool>("Battery", "Turn off when pocketed", true, "Should the map turn off when pocketed or dropped").Value; Size = ((BaseUnityPlugin)this).Config.Bind<float>("Map Properties", "Size", 0.75f, "The size of the map compared to the monitor map in the ship"); Light = ((BaseUnityPlugin)this).Config.Bind<bool>("Map Properties", "Light", false, "If the map should have nightvision like the map in the ship or not"); HandHeldMap.BatteryUsage = BatteryUsage.Value; HandHeldMap.TurnOnBatteryUsage = TurnOnBatteryUsage.Value; HandHeldMap.BatteryFail = BatteryFail.Value; HandHeldMap.FailureBreakPoint = FailureBreakPoint.Value; HandHeldMap.BaseChance = BaseChance.Value; HandHeldMap.Size = Size.Value; HandHeldMap.LightOn = Light.Value; HandHeldMap.ShowEnemies = ((BaseUnityPlugin)this).Config.Bind<bool>("Visibility", "Show Enemies", true, "Should Enemies be shown").Value; HandHeldMap.ShowScrap = ((BaseUnityPlugin)this).Config.Bind<bool>("Visibility", "Show Scrap", true, "Should Scrap be shown").Value; HandHeldMap.ShowPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("Visibility", "Show Players", true, "Should Players be shown").Value; HandHeldMap.ShowDeadPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("Visibility", "Show Dead Players", true, "Should Dead Players be shown").Value; HandHeldMap.ShowDoors = ((BaseUnityPlugin)this).Config.Bind<bool>("Visibility", "Show Doors", true, "Should Doors be shown").Value; HandHeldMap.ShowMines = ((BaseUnityPlugin)this).Config.Bind<bool>("Visibility", "Show Mines", true, "Should Landmines be shown").Value; HandHeldMap.ShowTurrets = ((BaseUnityPlugin)this).Config.Bind<bool>("Visibility", "Show Turrets", true, "Should Turrets be shown").Value; HandHeldMap.resetTime = ((BaseUnityPlugin)this).Config.Bind<float>("Preformance", "Update Rate", 2.5f, "How often the map should update the visibility settings").Value; string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "map.device").Replace("\\", "/"); AssetBundle val = AssetBundle.LoadFromFile(text); Item val2 = val.LoadAsset<Item>("Map.asset"); GameObject val3 = val.LoadAsset<GameObject>("HandHeldMapDevice.prefab"); cameraPrefab = val.LoadAsset<GameObject>("Camera.prefab"); HandHeldMap.turnOn = val.LoadAsset<AudioClip>("On.wav"); HandHeldMap.turnOff = val.LoadAsset<AudioClip>("Off.wav"); HandHeldMap handHeldMap = val3.AddComponent<HandHeldMap>(); ((GrabbableObject)handHeldMap).originalScale = val3.transform.localScale; ((GrabbableObject)handHeldMap).grabbable = true; ((GrabbableObject)handHeldMap).itemProperties = val2; ((GrabbableObject)handHeldMap).floorYRot = -1; val2.spawnPrefab = val3; NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Items.RegisterItem(val2); Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, CreateInfoNode("Hand-heldMapDevice", "Allows easy viewing of the map from anywhere."), price.Value); mls.LogInfo((object)"HandHeldMap mod is active"); } private TerminalNode CreateInfoNode(string name, string description) { TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); val.clearPreviousText = true; ((Object)val).name = name + "InfoNode"; val.displayText = description + "\n\n"; return val; } public static GameObject[] FindAndRemap(int layer) { GameObject[] array = Object.FindObjectsOfType<GameObject>(); List<GameObject> list = new List<GameObject>(); for (int i = 0; i < array.Length; i++) { if (array[i].layer == layer) { list.Add(array[i]); } } if (list.Count == 0) { return null; } return list.ToArray(); } } } namespace LC_HandHeldDevice.Patches { [HarmonyPatch(typeof(GrabbableObject))] internal class GrabbableObjectPatch { [HarmonyPatch("LateUpdate")] [HarmonyPostfix] private static void LootVisibilityOnMapPatch(GrabbableObject __instance) { if (!HandHeldMap.ShowScrap && (Object)(object)__instance != (Object)null && (Object)(object)__instance.radarIcon != (Object)null && (Object)(object)((Component)__instance.radarIcon).gameObject != (Object)null && HandHeldMap.currentlyShowScrap != ((Component)__instance.radarIcon).gameObject.activeSelf) { ((Component)__instance.radarIcon).gameObject.SetActive(HandHeldMap.currentlyShowScrap); } } } public class HandHeldMap : GrabbableObject { private ManualCameraRenderer mcr; private RenderTexture renderTexture; public static AudioClip turnOn; public static AudioClip turnOff; public static float BatteryUsage; public static float TurnOnBatteryUsage; public static bool BatteryFail; public static float FailureBreakPoint; public static float BaseChance; public static float Size = 1f; public static bool LightOn = true; public static bool pocketTurnOff = true; public AudioSource audioSource; public float MaxCharge = 0f; private bool isOn = false; public static bool ShowEnemies; public static bool ShowScrap; public static bool currentlyShowScrap; public static bool ShowPlayers; public static bool ShowDeadPlayers; public static bool ShowDoors; public static bool ShowTurrets; public static bool ShowMines; public bool culled = false; public float cullTimer; public static float resetTime = 2.5f; public static int MaxMaps; public static bool ShouldUpdateOutsideLocalPlayer; public static int MinUpdateDistance; public static int activeMaps; private static ManualCameraRenderer originalMCR = null; public bool isInHand; public override void Start() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //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_00c4: 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_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Expected O, but got Unknown //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Expected O, but got Unknown ((GrabbableObject)this).Start(); activeMaps++; base.insertedBattery = new Battery(false, 1f); MaxCharge = base.insertedBattery.charge; base.itemProperties.batteryUsage = BatteryUsage; try { if ((Object)(object)((Component)this).transform.parent == (Object)null && base.isInShipRoom && base.isInElevator && (Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.elevatorTransform != (Object)null) { ((Component)this).transform.SetParent(StartOfRound.Instance.elevatorTransform, false); base.targetFloorPosition = ((Component)this).transform.localPosition - ((Component)this).transform.parent.position; } base.mainObjectRenderer = ((Component)this).GetComponent<MeshRenderer>(); audioSource = ((Component)this).GetComponent<AudioSource>(); GameObject val = GameObject.Find("CameraMonitorScript"); if ((Object)(object)originalMCR == (Object)null && (Object)(object)val != (Object)null) { originalMCR = val.GetComponent<ManualCameraRenderer>(); } if ((Object)(object)originalMCR == (Object)null) { originalMCR = Object.FindObjectOfType<ManualCameraRenderer>(); } GameObject val2; if ((Object)(object)originalMCR != (Object)null && (Object)(object)originalMCR.cam != (Object)null) { val2 = ((Component)originalMCR.cam).gameObject; } else { val2 = HandHeldMapMod.cameraPrefab; HUDManager.Instance.DisplayTip("HandheldMap", "Failed to load proper camera for the map. Deploying safe guard. If you get this error contact the mod developer to get it fixed.", true, false, "LC_Tip1"); } mcr = ((Component)this).gameObject.AddComponent<ManualCameraRenderer>(); mcr.mesh = base.mainObjectRenderer; GameObject val3 = Object.Instantiate<GameObject>(val2); Camera component = val3.GetComponent<Camera>(); renderTexture = new RenderTexture(((Texture)component.targetTexture).width, ((Texture)component.targetTexture).height, component.targetTexture.depth); mcr.mapCameraLight = val3.GetComponentInChildren<Light>(); mcr.mapCameraAnimator = val3.GetComponentInChildren<Animator>(); mcr.cam = component; mcr.mapCamera = component; component.targetTexture = renderTexture; HandHeldMapMod.mls.LogMessage((object)$"Camera size: {component.orthographicSize}"); component.orthographicSize *= Size; mcr.materialIndex = 0; if ((Object)(object)originalMCR != (Object)null) { mcr.onScreenMat = Object.Instantiate<Material>(originalMCR.onScreenMat); mcr.offScreenMat = originalMCR.offScreenMat; mcr.shipArrowUI = originalMCR.shipArrowUI; mcr.shipArrowPointer = originalMCR.shipArrowPointer; } else { mcr.onScreenMat = Object.Instantiate<Material>(HandHeldMapMod.backUpMaterialOn); mcr.offScreenMat = HandHeldMapMod.backUpMaterialOff; mcr.shipArrowPointer = ((Component)this).transform; mcr.shipArrowUI = new GameObject(); } mcr.onScreenMat.mainTexture = (Texture)(object)renderTexture; TurnOn(on: false); mcr.radarTargets.Clear(); mcr.AddTransformAsTargetToRadar(((Component)this).transform, "You are here", true); } catch (Exception ex) { HUDManager.Instance.DisplayTip("HandheldMap", "Failed to load. " + ex, true, false, "LC_Tip1"); Object.Destroy((Object)(object)((Component)this).gameObject); } } public override void Update() { //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (!base.isHeld || !isInHand || !((Object)(object)base.playerHeldBy != (Object)null) || !((Object)(object)mcr != (Object)null) || !UpdateOtherMaps()) { return; } if ((Object)(object)mcr.mapCameraLight != (Object)null && !((Behaviour)mcr.mapCameraLight).enabled && LightOn) { ((Behaviour)mcr.mapCameraLight).enabled = LightOn; } if ((Object)(object)mcr.cam != (Object)null) { ((Behaviour)mcr.cam).enabled = true; if (base.insertedBattery.charge / MaxCharge < FailureBreakPoint && BatteryFail) { float num = (BaseChance + base.insertedBattery.charge / MaxCharge) * Time.deltaTime; float num2 = Random.Range(0f, 1f); if (num2 <= num) { mcr.cam.Render(); } } else { mcr.cam.Render(); } if ((Object)(object)mcr.targetedPlayer != (Object)(object)base.playerHeldBy) { mcr.targetedPlayer = base.playerHeldBy; } } if (cullTimer <= 0f) { cullTimer = resetTime; bool flag = culled; PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (localPlayerController.isInElevator || localPlayerController.isInHangarShipRoom || Vector3.Distance(((Component)localPlayerController).transform.position, StartOfRound.Instance.elevatorTransform.position) < 10f) { culled = false; } else { culled = true; } CullRelevantGameObjects(!culled); } else { cullTimer -= Time.deltaTime; } } public bool UpdateOtherMaps() { PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; return (Object)(object)base.playerHeldBy == (Object)(object)localPlayerController; } public void TurnOn(bool on) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) bool flag = isOn != on; isOn = on; base.isBeingUsed = on; mcr.SwitchScreenOn(on); if (!flag) { return; } if (on) { audioSource.PlayOneShot(turnOn); if (base.insertedBattery.charge != 1f) { ((MonoBehaviour)this).StartCoroutine((IEnumerator)Drain(1f)); } } else { audioSource.PlayOneShot(turnOff); } RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 10f, 0.65f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); TurnOn(used); } public override void UseUpBatteries() { ((GrabbableObject)this).UseUpBatteries(); TurnOn(on: false); } public override void GrabItem() { mcr.targetedPlayer = base.playerHeldBy; ((GrabbableObject)this).GrabItem(); isInHand = true; ((Behaviour)mcr).enabled = true; ((Behaviour)mcr.cam).enabled = true; } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); isInHand = true; } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); if (pocketTurnOff) { TurnOn(on: false); } isInHand = false; } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); if (pocketTurnOff) { TurnOn(on: false); } isInHand = false; ((Behaviour)mcr).enabled = false; ((Behaviour)mcr.cam).enabled = false; } public override void ChargeBatteries() { ((GrabbableObject)this).ChargeBatteries(); MaxCharge = base.insertedBattery.charge; } public IEnumerator<WaitForEndOfFrame> Drain(float Duration) { float t = 0f; while (t < Duration) { base.insertedBattery.charge = Mathf.Max(base.insertedBattery.charge - MaxCharge * TurnOnBatteryUsage * Time.deltaTime / Duration, 0f); t += Time.deltaTime; yield return new WaitForEndOfFrame(); } } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); renderTexture.Release(); Object.Destroy((Object)(object)((Component)mcr.cam).gameObject); activeMaps--; } public static void CullRelevantGameObjects(bool cull) { //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown if (!ShowEnemies) { EnemyAI[] array = Object.FindObjectsOfType<EnemyAI>(true); EnemyAI[] array2 = array; foreach (EnemyAI val in array2) { GameObject val2 = ((!((Object)(object)((Component)val).transform.parent != (Object)null)) ? FindMapDot(((Component)val).gameObject) : FindMapDot(((Component)((Component)val).transform.parent).gameObject)); if ((Object)(object)val2 != (Object)null) { val2.SetActive(cull); } } } if (!ShowScrap) { currentlyShowScrap = cull; } if (!ShowPlayers) { PlayerControllerB[] array3 = Object.FindObjectsOfType<PlayerControllerB>(true); PlayerControllerB[] array4 = array3; foreach (PlayerControllerB val3 in array4) { Animator mapRadarDotAnimator = val3.mapRadarDotAnimator; if ((Object)(object)mapRadarDotAnimator != (Object)null) { ((Component)mapRadarDotAnimator).gameObject.SetActive(cull); } } } if (!ShowDeadPlayers) { DeadBodyInfo[] array5 = Object.FindObjectsOfType<DeadBodyInfo>(true); DeadBodyInfo[] array6 = array5; foreach (DeadBodyInfo val4 in array6) { ((Component)val4.radarDot).gameObject.SetActive(cull); } } if (!ShowDoors) { GameObject val5 = GameObject.Find("Systems/GameSystems/ItemSystems/MapScreenUIWorldSpace"); if ((Object)(object)val5 != (Object)null) { foreach (Transform item in val5.transform) { Transform val6 = item; ((Component)val6).gameObject.SetActive(cull); } } } if (!ShowMines) { Landmine[] array7 = Object.FindObjectsOfType<Landmine>(true); Landmine[] array8 = array7; foreach (Landmine val7 in array8) { Transform val8 = ((Component)val7).transform.parent.Find("ScanSphere"); if ((Object)(object)val8 != (Object)null) { ((Component)val8).gameObject.SetActive(cull); } } } if (ShowTurrets) { return; } Turret[] array9 = Object.FindObjectsOfType<Turret>(true); Turret[] array10 = array9; foreach (Turret val9 in array10) { foreach (Transform item2 in ((Component)val9).transform.parent.Find("MeshContainer").Find("RotatingRodContainer")) { Transform val10 = item2; if (((Object)val10).name.StartsWith("Plane")) { ((Component)val10).gameObject.SetActive(cull); } } } } private static GameObject FindMapDot(GameObject enemyObject, bool isModel = false) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown foreach (Transform item in enemyObject.transform) { Transform val = item; if (((Object)val).name.StartsWith("MapDot")) { return ((Component)val).gameObject; } if ((!isModel && ((Object)val).name.EndsWith("Model")) || ((Object)val).name.EndsWith("ModelContainer")) { GameObject val2 = FindMapDot(((Component)val).gameObject); if ((Object)(object)val2 != (Object)null) { return val2; } } } return null; } } }
LethalPresents.dll
Decompiled 2 years 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"; } }
LootableMusicTapes.dll
Decompiled 2 years 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 BepInEx; using BepInEx.Logging; using HarmonyLib; using LethalLib.Modules; 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: AssemblyTitle("LootableMusicTapes")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LootableMusicTapes")] [assembly: AssemblyCopyright("Copyright c 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f2b95627-162b-4df4-a33a-0bd7a6bb221b")] [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")] internal class <Module> { static <Module>() { } } namespace LootableMusicTapes; [BepInPlugin("ohotdog.lootablemusictapes", "Lootable Music Tapes", "1.0.1")] public class LootableMusicTapesBase : BaseUnityPlugin { private const string modGUID = "ohotdog.lootablemusictapes"; private const string modName = "Lootable Music Tapes"; private const string modVersion = "1.0.1"; private static string bundlePath = ""; private readonly Harmony harmony = new Harmony("ohotdog.lootablemusictapes"); private static LootableMusicTapesBase Instance; internal ManualLogSource logSource; public static GameObject cassettePlayerPrefab; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logSource = Logger.CreateLogSource("ohotdog.lootablemusictapes"); bundlePath = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "cassetteitem"); Assets.LoadAssetBundle(bundlePath); AssetBundle bundle = Assets.GetBundle(); Item val = bundle.LoadAsset<Item>("cassetteplayeritem"); CassettePlayer cassettePlayer = val.spawnPrefab.AddComponent<CassettePlayer>(); ((GrabbableObject)cassettePlayer).itemProperties = val; ((GrabbableObject)cassettePlayer).itemProperties.creditsWorth = 35; ((GrabbableObject)cassettePlayer).itemProperties.minValue = 25; ((GrabbableObject)cassettePlayer).itemProperties.maxValue = 50; ((GrabbableObject)cassettePlayer).itemProperties.highestSalePercentage = 60; cassettePlayer.insert = bundle.LoadAsset<AudioClip>("walkman-insert"); cassettePlayer.eject = bundle.LoadAsset<AudioClip>("walkman-eject"); cassettePlayer.play = bundle.LoadAsset<AudioClip>("walkman-play"); cassettePlayer.stop = bundle.LoadAsset<AudioClip>("walkman-stop"); cassettePlayer.close = bundle.LoadAsset<AudioClip>("walkman-close"); CassettePlayer.cassetteSongs = new List<AudioClip>(); CreateCassetteItem(0, bundle, "cassettenazareitem", 973, "na-zare", 65, 20, 30, (LevelTypes)2); CreateCassetteItem(1, bundle, "cassettelastchristmasitem", 974, "lastchristmas", 60, 20, 30, (LevelTypes)510); CreateCassetteItem(2, bundle, "cassettestayinaliveitem", 975, "stayinalive", 61, 25, 35, (LevelTypes)8); CreateCassetteItem(3, bundle, "cassettemammasdontitem", 976, "mammasdont", 68, 25, 35, (LevelTypes)4); CreateCassetteItem(4, bundle, "cassetteshadilayitem", 977, "shadilay", 67, 30, 40, (LevelTypes)32); CreateCassetteItem(5, bundle, "cassettehounddogitem", 978, "hounddog", 54, 35, 45, (LevelTypes)4); CreateCassetteItem(6, bundle, "cassettewhitechristmasitem", 979, "whitechristmas", 52, 40, 50, (LevelTypes)256); CreateCassetteItem(7, bundle, "cassettesleepwalkitem", 980, "sleepwalk", 51, 45, 55, (LevelTypes)16); CreateCassetteItem(8, bundle, "cassetteoutoftouchitem", 981, "outoftouch", 45, 50, 60, (LevelTypes)2); CreateCassetteItem(9, bundle, "cassettefeliznavidaditem", 982, "feliznavidad", 43, 55, 65, (LevelTypes)64); CreateCassetteItem(10, bundle, "cassetteitsrainingmenitem", 983, "itsrainingmen", 48, 60, 70, (LevelTypes)8); CreateCassetteItem(11, bundle, "cassettetimeaftertimeitem", 984, "timeaftertime", 45, 65, 75, (LevelTypes)510); CreateCassetteItem(12, bundle, "cassettelivinonaprayeritem", 985, "livinonaprayer", 43, 70, 80, (LevelTypes)32); CreateCassetteItem(13, bundle, "cassetteheartacheitem", 986, "heartache", 41, 75, 85, (LevelTypes)16); CreateCassetteItem(14, bundle, "cassettekletkaitem", 987, "kletka", 40, 80, 90, (LevelTypes)64); CreateCassetteItem(15, bundle, "cassettecountryroadsitem", 988, "countryroads", 35, 85, 95, (LevelTypes)4); CreateCassetteItem(16, bundle, "cassettetotaleclipseitem", 989, "totaleclipse", 27, 90, 100, (LevelTypes)8); CreateCassetteItem(17, bundle, "cassetteineedaheroitem", 990, "ineedahero", 27, 90, 100, (LevelTypes)8); CreateCassetteItem(18, bundle, "cassettedangerzoneitem", 991, "dangerzone", 23, 95, 115, (LevelTypes)256); CreateCassetteItem(19, bundle, "cassetteroundaboutitem", 992, "roundabout", 14, 100, 110, (LevelTypes)2); CreateCassetteItem(20, bundle, "cassettekonchitsyaitem", 993, "konchitsya", 8, 110, 130, (LevelTypes)510); CreateCassetteItem(21, bundle, "cassetteworstbanditem", 994, "worstband", 40, 25, 35, (LevelTypes)510); CreateCassetteItem(22, bundle, "cassettemrsquareitem", 995, "mrsquare", 30, 79, 89, (LevelTypes)4); Items.RegisterShopItem(val, 35); cassettePlayerPrefab = val.spawnPrefab; 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); } } } NetworkPrefabs.RegisterNetworkPrefab(cassettePlayerPrefab); harmony.PatchAll(); logSource.LogInfo((object)"Lootable Music Tapes started successfully!"); } public static void AddNewSong(AudioClip songClip) { CassettePlayer.cassetteSongs.Add(songClip); } public void CreateCassetteItem(int songIndex, AssetBundle assetBundle, string itemAssetName, int cassetteItemId, string assetSongName, int rarity, int minValue, int maxValue, LevelTypes levelType) { //IL_0117: Unknown result type (might be due to invalid IL or missing references) Item val = assetBundle.LoadAsset<Item>(itemAssetName); val.itemId = cassetteItemId; Cassette cassette = val.spawnPrefab.AddComponent<Cassette>(); val.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().minRange = 2; val.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().maxRange = 15; val.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().requiresLineOfSight = true; val.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().nodeType = 2; val.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().creatureScanID = -1; string subText = val.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().subText; ((GrabbableObject)cassette).itemProperties = val; cassette.songIndex = songIndex; AddNewSong(assetBundle.LoadAsset<AudioClip>(assetSongName)); cassette.cassetteName = subText; ((GrabbableObject)cassette).itemProperties.itemName = "Cassette - " + subText; ((GrabbableObject)cassette).itemProperties.minValue = minValue; ((GrabbableObject)cassette).itemProperties.maxValue = maxValue; ((GrabbableObject)cassette).itemProperties.isScrap = true; ((GrabbableObject)cassette).itemProperties.isConductiveMetal = false; ((GrabbableObject)cassette).itemProperties.creditsWorth = maxValue - 5; ((GrabbableObject)cassette).scrapValue = maxValue - 5; NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, rarity, levelType); } } public class Cassette : GrabbableObject { private AudioSource audioSource; public string cassetteName; public int songIndex; public void Awake() { audioSource = ((Component)this).GetComponent<AudioSource>(); base.grabbable = true; base.grabbableToEnemies = true; base.mainObjectRenderer = ((Component)this).GetComponent<MeshRenderer>(); base.itemProperties.toolTips = new string[2] { "Insert into Walkman : [LMB]", "Inspect : [Z]" }; base.customGrabTooltip = "Grab " + base.itemProperties.itemName + " : [E]"; Debug.Log((object)("Cassette " + cassetteName + " has spawned!")); } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0043: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.playerHeldBy == (Object)null || !((NetworkBehaviour)this).IsOwner) { return; } Debug.Log((object)"Casting ray"); RaycastHit val = default(RaycastHit); if (Physics.Raycast(new Ray(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward), ref val, 5f, 832) && ((Component)((RaycastHit)(ref val)).collider).gameObject.layer != 8 && ((Component)((RaycastHit)(ref val)).collider).tag == "PhysicsProp") { CassettePlayer component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<CassettePlayer>(); Debug.Log((object)((object)(RaycastHit)(ref val)).ToString()); Debug.Log((object)((Object)((RaycastHit)(ref val)).transform).name); if ((Object)(object)component != (Object)null && !component.insertedCassette) { component.InsertCassetteSyncWithServer(songIndex); base.playerHeldBy.DiscardHeldObject(true, ((Component)component).GetComponent<NetworkObject>(), default(Vector3), true); } } ((GrabbableObject)this).ItemActivate(used, buttonDown); } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); if ((Object)(object)((Component)this).transform != (Object)null && (Object)(object)((Component)this).transform.parent != (Object)null && (Object)(object)((Component)((Component)this).transform.parent).GetComponent<CassettePlayer>() != (Object)null) { ((Component)((Component)this).transform.parent).GetComponent<CassettePlayer>().EjectCassetteSyncWithServer(); ((Component)this).transform.SetParent(StartOfRound.Instance.propsContainer, true); } } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); ((Component)this).gameObject.SetActive(false); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); ((Component)this).gameObject.SetActive(true); } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected internal override string __getTypeName() { return "Cassette"; } } public class CassettePlayer : GrabbableObject { private AudioSource audioSource; public AudioClip song; public AudioClip insert; public AudioClip eject; public AudioClip stop; public AudioClip play; public AudioClip close; public bool insertedCassette; private RoundManager roundManager; private StartOfRound playersManager; public bool isPlayingMusic; private int timesPlayedWithoutTurningOff; private float noiseInterval; private bool isPlayPressed = false; public static List<AudioClip> cassetteSongs; public NetworkVariable<int> audioIndex = new NetworkVariable<int>(-1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); public int _audioIndex = -1; public static event Action<string> CassetteEvent; public override void OnNetworkSpawn() { _audioIndex = -1; NetworkVariable<int> obj = audioIndex; obj.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnAudioIndexChanged)); ((NetworkBehaviour)this).OnNetworkSpawn(); } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); NetworkVariable<int> obj = audioIndex; obj.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnAudioIndexChanged)); } private void OnAudioIndexChanged(int previous, int current) { _audioIndex = current; if (_audioIndex != -1) { song = cassetteSongs[_audioIndex]; audioSource.PlayOneShot(insert); } else { song = null; audioSource.Stop(); audioSource.PlayOneShot(stop); } } public override void Start() { ((GrabbableObject)this).Start(); insertedCassette = false; audioSource = ((Component)this).GetComponent<AudioSource>(); base.grabbable = true; base.grabbableToEnemies = true; base.mainObjectRenderer = ((Component)this).GetComponent<MeshRenderer>(); base.useCooldown = 0.5f; base.itemProperties.requiresBattery = false; playersManager = Object.FindObjectOfType<StartOfRound>(); roundManager = Object.FindObjectOfType<RoundManager>(); base.customGrabTooltip = "Grab Walkman : [E]"; } private void InsertCassette(int songIndex) { if (!insertedCassette) { insertedCassette = true; _audioIndex = songIndex; if (songIndex != -1) { song = cassetteSongs[_audioIndex]; } if (((NetworkBehaviour)this).IsOwner) { audioIndex.Value = songIndex; } } } public void InsertCassetteSyncWithServer(int songIndex) { if (!insertedCassette) { InsertCassette(songIndex); InsertCassetteServerRpc(songIndex); } } [ServerRpc(RequireOwnership = false)] public void InsertCassetteServerRpc(int songIndex) { //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(720241444u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, songIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 720241444u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { InsertCassetteClientRpc(songIndex); } } } [ClientRpc] public void InsertCassetteClientRpc(int songIndex) { //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(3622550067u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, songIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3622550067u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { InsertCassette(songIndex); } } } private void EjectCassette() { if (insertedCassette) { StartMusic(startMusic: false); insertedCassette = false; _audioIndex = -1; if (((NetworkBehaviour)this).IsOwner) { audioIndex.Value = -1; } song = null; } } public void EjectCassetteSyncWithServer() { if (insertedCassette) { EjectCassette(); EjectCassetteServerRpc(); } } [ServerRpc(RequireOwnership = false)] public void EjectCassetteServerRpc() { //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(1658162722u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1658162722u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { EjectCassetteClientRpc(); } } } [ClientRpc] public void EjectCassetteClientRpc() { //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(3164336292u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3164336292u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { EjectCassette(); } } } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!isPlayingMusic) { StartMusic(startMusic: true); } else { StartMusic(startMusic: false); } } public void StartMusic(bool startMusic, bool pitchDown = false) { if (!insertedCassette) { if (isPlayPressed) { audioSource.PlayOneShot(play); isPlayPressed = false; } else { audioSource.PlayOneShot(stop); isPlayPressed = true; } return; } if (startMusic && !isPlayingMusic) { audioSource.PlayOneShot(play); audioSource.PlayOneShot(song); } else if (isPlayingMusic) { audioSource.Stop(); audioSource.PlayOneShot(stop); timesPlayedWithoutTurningOff = 0; } base.isBeingUsed = startMusic; isPlayingMusic = startMusic; } public override void Update() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (isPlayingMusic) { if (noiseInterval <= 0f) { noiseInterval = 1f; timesPlayedWithoutTurningOff++; roundManager.PlayAudibleNoise(((Component)this).transform.position, 16f, 0.9f, timesPlayedWithoutTurningOff, false, 5); } else { noiseInterval -= Time.deltaTime; } } } protected override void __initializeVariables() { if (audioIndex == null) { throw new Exception("CassettePlayer.audioIndex cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)audioIndex).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)audioIndex, "audioIndex"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)audioIndex); ((GrabbableObject)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_CassettePlayer() { //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(720241444u, new RpcReceiveHandler(__rpc_handler_720241444)); NetworkManager.__rpc_func_table.Add(3622550067u, new RpcReceiveHandler(__rpc_handler_3622550067)); NetworkManager.__rpc_func_table.Add(1658162722u, new RpcReceiveHandler(__rpc_handler_1658162722)); NetworkManager.__rpc_func_table.Add(3164336292u, new RpcReceiveHandler(__rpc_handler_3164336292)); } private static void __rpc_handler_720241444(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 songIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref songIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((CassettePlayer)(object)target).InsertCassetteServerRpc(songIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3622550067(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 songIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref songIndex); target.__rpc_exec_stage = (__RpcExecStage)2; ((CassettePlayer)(object)target).InsertCassetteClientRpc(songIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1658162722(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; ((CassettePlayer)(object)target).EjectCassetteServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3164336292(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; ((CassettePlayer)(object)target).EjectCassetteClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "CassettePlayer"; } } internal class Assets { internal static AssetBundle mainAssetBundle; private static string[] assetNames = new string[0]; internal static void LoadAssetBundle(string assetBundlePath) { if ((Object)(object)mainAssetBundle == (Object)null) { mainAssetBundle = AssetBundle.LoadFromFile(assetBundlePath); } assetNames = mainAssetBundle.GetAllAssetNames(); } internal static AssetBundle GetBundle() { return mainAssetBundle; } }
Peepers.dll
Decompiled 2 years ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using GameNetcodeStuff; using HarmonyLib; using LCPeeper.Properties; using Peepers.NetcodePatcher; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("Peepers")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Adds a new non-lethal monster to the game with unique mechanics and interactions.")] [assembly: AssemblyFileVersion("0.9.6.0")] [assembly: AssemblyInformationalVersion("0.9.6")] [assembly: AssemblyProduct("Peepers")] [assembly: AssemblyTitle("Peepers")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.9.6.0")] [module: UnverifiableCode] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace LCPeeper { [BepInPlugin("x753.Peepers", "Peepers", "0.9.6")] public class Peeper : BaseUnityPlugin { [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().AddNetworkPrefab(PeeperPrefab); } } private const string modGUID = "x753.Peepers"; private const string modName = "Peepers"; private const string modVersion = "0.9.6"; private readonly Harmony harmony = new Harmony("x753.Peepers"); private static Peeper Instance; public static GameObject PeeperPrefab; public static EnemyType PeeperType; public static TerminalNode PeeperFile; public static int PeeperCreatureID = 0; public static List<PeeperAI> PeeperList = new List<PeeperAI>(); public static List<string> ignoreEnemies = new List<string> { "Peeper", "Manticoil", "Docile Locust Bees", "Girl" }; public static float PeeperSpawnChance; public static int PeeperMinGroupSize; public static int PeeperMaxGroupSize; public static float PeeperWeight; private void Awake() { AssetBundle val = AssetBundle.LoadFromMemory(Resources.peeper); PeeperPrefab = val.LoadAsset<GameObject>("Assets/PeeperPrefab.prefab"); PeeperType = val.LoadAsset<EnemyType>("Assets/PeeperType.asset"); PeeperFile = val.LoadAsset<TerminalNode>("Assets/PeeperFile.asset"); if ((Object)(object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Peepers is loaded!"); PeeperSpawnChance = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Rate", "Hourly Spawn Chance (%)", 10f, "Chance of a group of peepers spawning each hour").Value; PeeperMinGroupSize = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Minimum Peeper Group Size", 2, "The minimum number of peepers in a single group").Value; PeeperMaxGroupSize = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Maximum Peeper Group Size", 4, "The maximum number of peepers in a single group").Value; PeeperWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Peeper Settings", "Peeper Weight (lb)", 10f, "The weight of a single peeper in pounds.").Value / 105f; 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); } } } } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(Terminal __instance) { //IL_00c5: 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) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown Terminal val = Object.FindObjectOfType<Terminal>(); if (!Object.op_Implicit((Object)(object)val.enemyFiles.Find((TerminalNode node) => node.creatureName == "Peepers"))) { Peeper.PeeperCreatureID = val.enemyFiles.Count; Peeper.PeeperFile.creatureFileID = Peeper.PeeperCreatureID; val.enemyFiles.Add(Peeper.PeeperFile); TerminalKeyword val2 = val.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info"); TerminalKeyword val3 = ScriptableObject.CreateInstance<TerminalKeyword>(); val3.word = "peepers"; val3.isVerb = false; val3.defaultVerb = val2; List<CompatibleNoun> list = val2.compatibleNouns.ToList(); list.Add(new CompatibleNoun { noun = val3, result = Peeper.PeeperFile }); val2.compatibleNouns = list.ToArray(); List<TerminalKeyword> list2 = val.terminalNodes.allKeywords.ToList(); list2.Add(val3); val.terminalNodes.allKeywords = list2.ToArray(); } } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPatch("AdvanceHourAndSpawnNewBatchOfEnemies")] [HarmonyPrefix] private static void AdvanceHourAndSpawnNewBatchOfEnemiesPatch(RoundManager __instance) { //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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0069: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00a0: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) float num = Random.Range(0f, 100f); if (num > Peeper.PeeperSpawnChance) { return; } GameObject[] array = GameObject.FindGameObjectsWithTag("OutsideAINode"); Vector3 position = array[__instance.AnomalyRandom.Next(0, array.Length)].transform.position; position = __instance.GetRandomNavMeshPositionInRadius(position, 4f, default(NavMeshHit)); int num2 = 0; bool flag = false; for (int i = 0; i < array.Length - 1; i++) { for (int j = 0; j < __instance.spawnDenialPoints.Length; j++) { flag = true; if (Vector3.Distance(position, __instance.spawnDenialPoints[j].transform.position) < 8f) { num2 = (num2 + 1) % array.Length; position = array[num2].transform.position; position = __instance.GetRandomNavMeshPositionInRadius(position, 4f, default(NavMeshHit)); flag = false; break; } } if (flag) { break; } } int num3 = Random.Range(Peeper.PeeperMinGroupSize, Peeper.PeeperMaxGroupSize); for (int k = 0; k <= num3; k++) { RoundManager.Instance.SpawnEnemyGameObject(position, 0f, -1, Peeper.PeeperType); EnemyType peeperType = Peeper.PeeperType; peeperType.numberSpawned++; RoundManager instance = RoundManager.Instance; instance.currentDaytimeEnemyPower++; } } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePatch(ref StartOfRound __instance) { //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) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown SelectableLevel[] levels = __instance.levels; foreach (SelectableLevel val in levels) { if (!val.DaytimeEnemies.Any((SpawnableEnemyWithRarity e) => (Object)(object)e.enemyType == (Object)(object)Peeper.PeeperType)) { int rarity = 0; val.DaytimeEnemies.Add(new SpawnableEnemyWithRarity { enemyType = Peeper.PeeperType, rarity = rarity }); break; } } } [HarmonyPatch("EndOfGame")] [HarmonyPrefix] private static void EndOfGamePatch(StartOfRound __instance, int bodiesInsured = 0, int connectedPlayersOnServer = 0, int scrapCollected = 0) { foreach (PeeperAI peeper in Peeper.PeeperList) { if (peeper.isAttached && (Object)(object)peeper.attachedPlayer != (Object)null && !peeper.attachedPlayer.isPlayerDead) { peeper.IsWeighted = false; } } Peeper.PeeperList = new List<PeeperAI>(); PeeperAI.UsedAttachTargets = new List<Transform>(); } } [HarmonyPatch(typeof(StunGrenadeItem))] internal class StunGrenadeItemPatch { [HarmonyPatch("StunExplosion")] [HarmonyPostfix] private static void StunExplosion(StunGrenadeItem __instance, Vector3 explosionPosition, bool affectAudio, float flashSeverityMultiplier, float enemyStunTime, float flashSeverityDistanceRolloff = 1f, bool isHeldItem = false, PlayerControllerB playerHeldBy = null, PlayerControllerB playerThrownBy = null, float addToFlashSeverity = 0f) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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) //IL_0055: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!(Vector3.Distance(((Component)localPlayerController).transform.position, explosionPosition) < 16f) || (Vector3.Distance(((Component)localPlayerController).transform.position, explosionPosition) > 5f && (!isHeldItem || !((Object)(object)playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)) && Physics.Linecast(explosionPosition + Vector3.up * 0.5f, ((Component)localPlayerController.gameplayCamera).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))) { return; } List<PeeperAI> list = new List<PeeperAI>(Peeper.PeeperList); foreach (PeeperAI item in list) { if ((Object)(object)item.attachedPlayer == (Object)(object)localPlayerController && ((NetworkBehaviour)item).IsOwner) { ((EnemyAI)item).KillEnemyOnOwnerClient(false); } } } } [HarmonyPatch(typeof(SpringManAI))] internal class SpringManAIPatcher { [HarmonyPrefix] [HarmonyPatch("DoAIInterval")] private static void DoAllIntervalPrefix(ref SpringManAI __instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (PeeperAI.HasLineOfSightToPeeper(((Component)__instance).transform.position)) { ((EnemyAI)__instance).currentBehaviourStateIndex = 1; } } [HarmonyTranspiler] [HarmonyPatch("Update")] private static IEnumerable<CodeInstruction> Update_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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 //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown MethodInfo method = typeof(PeeperAI).GetMethod("HasLineOfSightToPeeper", BindingFlags.Static | BindingFlags.Public); MethodInfo method2 = typeof(SpringManAI).GetMethod("get_transform"); MethodInfo method3 = typeof(Transform).GetMethod("get_position"); List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 1; i < list.Count; i++) { if (!(list[i - 1].opcode != OpCodes.Ldc_I4_0) && !(list[i].opcode != OpCodes.Stloc_1)) { list.Insert(i, new CodeInstruction(OpCodes.Or, (object)null)); list.Insert(i, new CodeInstruction(OpCodes.Call, (object)method)); list.Insert(i, new CodeInstruction(OpCodes.Callvirt, (object)method3)); list.Insert(i, new CodeInstruction(OpCodes.Call, (object)method2)); list.Insert(i, new CodeInstruction(OpCodes.Ldarg_0, (object)null)); break; } } return list; } } [HarmonyPatch(typeof(SprayPaintItem))] internal class SprayPaintItemPatch { private static FieldInfo SprayMatIndex = typeof(SprayPaintItem).GetField("sprayCanMatsIndex", BindingFlags.Instance | BindingFlags.NonPublic); [HarmonyPatch("SprayPaintClientRpc")] [HarmonyPrefix] private static void SprayPaintClientRpcPatch(SprayPaintItem __instance, Vector3 sprayPos, Vector3 sprayRot) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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) try { Ray val = default(Ray); ((Ray)(ref val))..ctor(sprayPos, sprayRot); RaycastHit val2 = default(RaycastHit); if (!Physics.Raycast(val, ref val2, 4f, 524288, (QueryTriggerInteraction)2) || !((Object)(object)((RaycastHit)(ref val2)).collider != (Object)null) || !(((Object)((RaycastHit)(ref val2)).collider).name == "PeeperSprayCollider")) { return; } PeeperAI component = ((Component)((Component)((RaycastHit)(ref val2)).collider).transform.parent.parent.parent.parent.parent.parent.parent).GetComponent<PeeperAI>(); if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)(object)component.attachedPlayer)) { ((Renderer)component.peeperMesh).materials[0].color = __instance.sprayCanMats[(int)SprayMatIndex.GetValue(__instance)].color; if (component.isAttached) { component.EjectFromPlayerServerRpc(component.attachedPlayer.actualClientId); } } } catch (Exception) { } } } [HarmonyPatch(typeof(FlashlightItem))] internal class FlashlightItemPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdatePatch(FlashlightItem __instance) { //IL_0031: 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_0041: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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) if (!((NetworkBehaviour)__instance).IsOwner || __instance.flashlightTypeID != 2 || !((GrabbableObject)__instance).isBeingUsed) { return; } Transform transform = ((Component)__instance.flashlightBulb).transform; Ray val = default(Ray); ((Ray)(ref val))..ctor(transform.position, transform.forward); RaycastHit[] array = Physics.RaycastAll(val, 32f, 1 << LayerMask.NameToLayer("ScanNode")); RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val2 = array2[i]; if (!(((Object)((RaycastHit)(ref val2)).collider).name == "PeeperScanNode")) { continue; } float num = Vector3.Angle(-((Ray)(ref val)).direction, ((RaycastHit)(ref val2)).transform.forward); if (num < 55f) { PeeperAI component = ((Component)((RaycastHit)(ref val2)).transform.parent.parent.parent.parent.parent.parent.parent).GetComponent<PeeperAI>(); if ((Object)(object)component.attachedPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { break; } if (((NetworkBehaviour)component).IsOwner) { ((EnemyAI)component).KillEnemyOnOwnerClient(false); } else { component.KillEnemyNetworked(); } } } } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("KillPlayer")] [HarmonyPrefix] private static void KillPlayerPatch(PlayerControllerB __instance, Vector3 bodyVelocity, bool spawnBody = true, CauseOfDeath causeOfDeath = 0, int deathAnimation = 0) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 List<PeeperAI> list = new List<PeeperAI>(Peeper.PeeperList); foreach (PeeperAI item in list) { if ((Object)(object)item.attachedPlayer == (Object)(object)__instance && ((NetworkBehaviour)item).IsOwner) { if ((int)causeOfDeath == 11 || (int)causeOfDeath == 3) { ((EnemyAI)item).KillEnemyOnOwnerClient(false); } else { item.EjectFromPlayerServerRpc(__instance.playerClientId); } } } } [HarmonyPatch("DamagePlayer")] [HarmonyPrefix] private static void DamagePlayerPatch(PlayerControllerB __instance, int damageNumber, bool hasDamageSFX = true, bool callRPC = true, CauseOfDeath causeOfDeath = 0, int deathAnimation = 0, bool fallDamage = false, Vector3 force = default(Vector3)) { List<PeeperAI> list = new List<PeeperAI>(Peeper.PeeperList); foreach (PeeperAI item in list) { if ((Object)(object)item.attachedPlayer == (Object)(object)__instance) { item.EjectFromPlayerServerRpc(__instance.playerClientId); } } } [HarmonyPatch("IShockableWithGun.ShockWithGun")] [HarmonyPrefix] private static void DamagePlayerPatch(PlayerControllerB __instance, PlayerControllerB shockedByPlayer) { List<PeeperAI> list = new List<PeeperAI>(Peeper.PeeperList); foreach (PeeperAI item in list) { if ((Object)(object)item.attachedPlayer == (Object)(object)__instance && ((NetworkBehaviour)item).IsOwner) { ((EnemyAI)item).KillEnemyOnOwnerClient(false); } } } [HarmonyPatch("DropAllHeldItems")] [HarmonyPostfix] private static void DamagePlayeDropAllHeldItemsPatch(PlayerControllerB __instance, bool itemsFall = true, bool disconnecting = false) { if (__instance.carryWeight != 1f) { return; } List<PeeperAI> list = new List<PeeperAI>(Peeper.PeeperList); foreach (PeeperAI item in list) { if ((Object)(object)item.attachedPlayer == (Object)(object)__instance && item.isAttached && !((EnemyAI)item).isEnemyDead) { __instance.carryWeight += Peeper.PeeperWeight; } } } } public class PeeperAI : EnemyAI { [Header("General")] public GameObject creatureModel; public SkinnedMeshRenderer peeperMesh; public ScanNodeProperties scanNode; [Header("AI and Pathfinding")] public AISearchRoutine searchForPlayers; public float maxSearchAndRoamRadius = 100f; public float searchPrecisionValue = 5f; private int sightRange = 30; [Header("Constraints and Transforms")] public Transform attachTargetTransform; public static List<Transform> UsedAttachTargets = new List<Transform>(); public Vector3 attachTargetTranslationOffset; public Vector3 attachTargetRotationOffset; public Transform eyeTransform; public Transform eyeOriginalTransform; public bool isAttached; public PlayerControllerB attachedPlayer; [Header("Colliders and Physics")] public SphereCollider attachCollider; public SphereCollider physicsCollider; public SphereCollider hitboxCollider; public Rigidbody physicsRigidbody; [Header("State Handling and Sync")] public float stateTimer; public float stateTimer2; public int stateCounter; [Header("Audio")] public AudioSource AttachSFXSource; public AudioClip walkSFX; public AudioClip runSFX; public AudioClip[] spotSFX; public AudioClip[] jumpSFX; public AudioClip[] attachSFX; public AudioClip[] deathSFX; public AudioClip[] ejectSFX; public AudioClip[] zapSFX; public AudioClip[] whisperSFX; public static float NextWhisperTime; [Header("Materials")] public Material baseMat; public Material paintedMat; public Material deadMat; public ParticleSystem deathParticles; [Header("Ragdoll")] private bool ragdollFrozen; public Rigidbody[] ragdollRigidbodies; public Collider[] ragdollColliders; private Vector3 agentLocalVelocity; private Vector3 previousPosition; private float velX; private float velZ; private float velXZ; private float footstepTimer; private Vector3 deathDirection = Vector3.zero; private float blinkTimer; private float blinkInterval; private bool isWeightedInternal; public bool IsWeighted { get { return isWeightedInternal; } set { if (value && !isWeightedInternal) { PlayerControllerB obj = attachedPlayer; obj.carryWeight += Peeper.PeeperWeight; } else if (!value && isWeightedInternal) { PlayerControllerB obj2 = attachedPlayer; obj2.carryWeight += 0f - Peeper.PeeperWeight; if (attachedPlayer.carryWeight < 1f) { attachedPlayer.carryWeight = 1f; } } isWeightedInternal = value; } } public override void Start() { ((EnemyAI)this).Start(); searchForPlayers.searchWidth = maxSearchAndRoamRadius; searchForPlayers.searchPrecision = searchPrecisionValue; Peeper.PeeperList.Add(this); AudioMixer diageticMixer = SoundManager.Instance.diageticMixer; base.creatureVoice.outputAudioMixerGroup = diageticMixer.FindMatchingGroups("SFX")[0]; base.creatureSFX.outputAudioMixerGroup = diageticMixer.FindMatchingGroups("SFX")[0]; AttachSFXSource.outputAudioMixerGroup = diageticMixer.FindMatchingGroups("SFX")[0]; scanNode.creatureScanID = Peeper.PeeperCreatureID; SwitchBehaviourState(2); } public override void DoAIInterval() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (base.inSpecialAnimation) { return; } ((EnemyAI)this).DoAIInterval(); if (StartOfRound.Instance.livingPlayers == 0 || base.isEnemyDead) { return; } if (base.currentBehaviourStateIndex != 0) { if (searchForPlayers.inProgress) { ((EnemyAI)this).StopSearch(searchForPlayers, true); base.movingTowardsTargetPlayer = true; } } else if (!searchForPlayers.inProgress) { ((EnemyAI)this).StartSearch(((Component)this).transform.position, searchForPlayers); } } public override void FinishedCurrentSearchRoutine() { ((EnemyAI)this).FinishedCurrentSearchRoutine(); searchForPlayers.searchWidth = Mathf.Clamp(searchForPlayers.searchWidth + 20f, 1f, maxSearchAndRoamRadius); } private void CalculateAnimationDirection() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) agentLocalVelocity = ((Component)this).transform.InverseTransformDirection(Vector3.ClampMagnitude(((Component)this).transform.position - previousPosition, 1f) / (Time.deltaTime * 2f)); velX = Mathf.Lerp(velX, agentLocalVelocity.x, 5f * Time.deltaTime); velZ = Mathf.Lerp(velZ, 0f - agentLocalVelocity.z, 5f * Time.deltaTime); previousPosition = ((Component)this).transform.position; velXZ = Mathf.Sqrt(velX * velX + velZ * velZ); base.creatureAnimator.SetFloat("Speed", velXZ); float num = ((base.currentBehaviourStateIndex != 1 && base.currentBehaviourStateIndex != 5) ? 0.3335f : 0.3f); footstepTimer += Time.deltaTime; if (footstepTimer < num) { return; } footstepTimer = 0f; if ((double)velXZ > 0.15) { if (base.currentBehaviourStateIndex == 1) { PlayCreatureSFX(2); } else { PlayCreatureSFX(1); } } } private void PutCreatureOnGround() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) if (!(base.agent.velocity.y > 5f)) { base.creatureAnimator.SetBool("Grounded", true); base.creatureAnimator.SetBool("Jump", false); Ray val = default(Ray); ((Ray)(ref val))..ctor(((Component)this).transform.position + Vector3.up, Vector3.down); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, ref val2, 2f, LayerMask.GetMask(new string[2] { "Room", "Colliders" }), (QueryTriggerInteraction)1)) { creatureModel.transform.localPosition = new Vector3(0f, 0f - ((RaycastHit)(ref val2)).distance + 1f, 0f); } } } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false) { //IL_0027: 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_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_003f: 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) ((EnemyAI)this).HitEnemy(force, playerWhoHit, false); base.enemyHP -= force; if ((Object)(object)playerWhoHit != (Object)null) { Vector3 val = ((Component)this).transform.position - ((Component)playerWhoHit).transform.position; deathDirection = ((Vector3)(ref val)).normalized; } if (base.enemyHP <= 0 && ((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } public override void SetEnemyStunned(bool setToStunned, float setToStunTime = 1f, PlayerControllerB setStunnedByPlayer = null) { base.enemyHP--; if (base.enemyHP <= 0 && ((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } public void KillEnemyNetworked() { if (((NetworkBehaviour)this).IsServer) { KillEnemyClientRpc(); } else { KillEnemyServerRpc(); } } [ServerRpc(RequireOwnership = false)] public void KillEnemyServerRpc() { //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(1087886824u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1087886824u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { KillEnemyClientRpc(); } } } [ClientRpc] public void KillEnemyClientRpc() { //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(2756874777u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2756874777u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((EnemyAI)this).KillEnemy(false); } } } public override void KillEnemy(bool destroy = false) { //IL_004e: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).KillEnemy(false); base.creatureVoice.Stop(); base.creatureSFX.Stop(); PlayCreatureSFX(5); SwitchBehaviourState(7); base.isEnemyDead = true; Peeper.PeeperList.Remove(this); creatureModel.transform.localPosition = Vector3.zero; if (isAttached && (Object)(object)attachedPlayer != (Object)null) { EjectFromPlayer(attachedPlayer); } Color color = ((Renderer)peeperMesh).material.color; ((Renderer)peeperMesh).materials = (Material[])(object)new Material[1] { deadMat }; ((Renderer)peeperMesh).materials[0].color = color; deathParticles.Play(); ((Behaviour)base.creatureAnimator).enabled = false; physicsRigidbody.isKinematic = true; Rigidbody[] array = ragdollRigidbodies; foreach (Rigidbody val in array) { val.isKinematic = false; if (deathDirection != Vector3.zero) { val.AddForce(15f * deathDirection, (ForceMode)1); } } Collider[] array2 = ragdollColliders; foreach (Collider val2 in array2) { val2.enabled = true; } peeperMesh.SetBlendShapeWeight(0, 0f); peeperMesh.SetBlendShapeWeight(1, 350f); } public void SwitchBehaviourState(int state) { SwitchBehaviourStateLocally(state); SwitchBehaviourStateServerRpc(state); } [ServerRpc(RequireOwnership = false)] public void SwitchBehaviourStateServerRpc(int state) { //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(316864934u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, state); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 316864934u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SwitchBehaviourStateClientRpc(state); } } } [ClientRpc] public void SwitchBehaviourStateClientRpc(int state) { //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(4022924503u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, state); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4022924503u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SwitchBehaviourStateLocally(state); } } } public void SwitchBehaviourStateLocally(int state) { //IL_010d: 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_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Unknown result type (might be due to invalid IL or missing references) //IL_0604: Unknown result type (might be due to invalid IL or missing references) //IL_06b7: Unknown result type (might be due to invalid IL or missing references) //IL_06c8: Unknown result type (might be due to invalid IL or missing references) //IL_06d8: Unknown result type (might be due to invalid IL or missing references) //IL_06e9: Unknown result type (might be due to invalid IL or missing references) //IL_06f9: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Unknown result type (might be due to invalid IL or missing references) //IL_07e4: Unknown result type (might be due to invalid IL or missing references) stateTimer = 0f; stateTimer2 = 0f; stateCounter = 0; switch (state) { case 0: base.targetPlayer = null; base.movingTowardsTargetPlayer = false; base.agent.speed = 2f; base.creatureAnimator.SetBool("Jump", false); base.creatureAnimator.SetBool("Attached", false); base.creatureAnimator.SetBool("Dead", false); base.inSpecialAnimation = false; ((Behaviour)base.agent).enabled = true; base.enemyType.canBeStunned = true; ((Collider)attachCollider).enabled = true; ((Collider)physicsCollider).enabled = false; physicsRigidbody.isKinematic = true; ((Collider)hitboxCollider).enabled = true; hitboxCollider.radius = 0.5f; hitboxCollider.center = new Vector3(0f, 0.5f, 0f); break; case 1: base.agent.speed = 6f; base.creatureAnimator.SetBool("Jump", false); base.creatureAnimator.SetBool("Attached", false); base.creatureAnimator.SetBool("Dead", false); base.inSpecialAnimation = false; ((Behaviour)base.agent).enabled = true; base.enemyType.canBeStunned = true; ((Collider)attachCollider).enabled = true; ((Collider)physicsCollider).enabled = false; physicsRigidbody.isKinematic = true; ((Collider)hitboxCollider).enabled = true; hitboxCollider.radius = 0.5f; hitboxCollider.center = new Vector3(0f, 0.5f, 0f); break; case 2: base.targetPlayer = null; base.movingTowardsTargetPlayer = false; base.agent.speed = 0f; base.creatureAnimator.SetBool("Jump", false); base.creatureAnimator.SetBool("Attached", false); base.creatureAnimator.SetBool("Dead", false); base.creatureAnimator.SetBool("Grounded", true); base.inSpecialAnimation = false; ((Behaviour)base.agent).enabled = true; base.enemyType.canBeStunned = true; ((Collider)attachCollider).enabled = true; ((Collider)physicsCollider).enabled = false; physicsRigidbody.isKinematic = true; ((Collider)hitboxCollider).enabled = true; hitboxCollider.radius = 0.5f; hitboxCollider.center = new Vector3(0f, 0.5f, 0f); break; case 3: { base.agent.speed = 0f; creatureModel.transform.localPosition = Vector3.zero; base.creatureAnimator.SetBool("Jump", true); base.creatureAnimator.SetBool("Attached", false); base.creatureAnimator.SetBool("Dead", false); base.creatureAnimator.SetBool("Grounded", false); base.inSpecialAnimation = true; ((Behaviour)base.agent).enabled = false; base.enemyType.canBeStunned = true; ((Collider)attachCollider).enabled = true; ((Collider)physicsCollider).enabled = true; physicsRigidbody.isKinematic = false; ((Collider)hitboxCollider).enabled = true; hitboxCollider.radius = 2f; hitboxCollider.center = Vector3.zero; SphereCollider obj3 = physicsCollider; ((Collider)obj3).includeLayers = LayerMask.op_Implicit(LayerMask.op_Implicit(((Collider)obj3).includeLayers) & -524289); SphereCollider obj4 = physicsCollider; ((Collider)obj4).excludeLayers = LayerMask.op_Implicit(LayerMask.op_Implicit(((Collider)obj4).excludeLayers) | 0x80000); break; } case 4: base.targetPlayer = null; base.movingTowardsTargetPlayer = false; creatureModel.transform.localPosition = Vector3.zero; base.agent.speed = 0f; base.creatureAnimator.SetBool("Jump", true); base.creatureAnimator.SetBool("Attached", true); base.creatureAnimator.SetBool("Dead", false); base.creatureAnimator.SetBool("Grounded", false); base.inSpecialAnimation = true; ((Behaviour)base.agent).enabled = false; base.enemyType.canBeStunned = false; ((Collider)attachCollider).enabled = false; ((Collider)physicsCollider).enabled = false; physicsRigidbody.isKinematic = true; ((Collider)hitboxCollider).enabled = false; hitboxCollider.radius = 0.5f; hitboxCollider.center = Vector3.zero; NextWhisperTime = Time.time + 10f; break; case 5: base.targetPlayer = null; base.movingTowardsTargetPlayer = false; base.agent.speed = 0f; base.creatureAnimator.SetBool("Jump", false); base.creatureAnimator.SetBool("Attached", false); base.creatureAnimator.SetBool("Dead", false); base.creatureAnimator.SetBool("Grounded", true); base.inSpecialAnimation = false; ((Behaviour)base.agent).enabled = true; base.enemyType.canBeStunned = true; ((Collider)attachCollider).enabled = true; ((Collider)physicsCollider).enabled = false; physicsRigidbody.isKinematic = true; ((Collider)hitboxCollider).enabled = true; hitboxCollider.radius = 0.5f; hitboxCollider.center = new Vector3(0f, 0.5f, 0f); break; case 6: { stateTimer = Random.Range(0f, 1f); base.targetPlayer = null; base.movingTowardsTargetPlayer = false; base.agent.speed = 0f; creatureModel.transform.localPosition = Vector3.zero; base.creatureAnimator.SetBool("Jump", true); base.creatureAnimator.SetBool("Attached", false); base.creatureAnimator.SetBool("Dead", false); base.creatureAnimator.SetBool("Grounded", false); base.inSpecialAnimation = true; ((Behaviour)base.agent).enabled = false; base.enemyType.canBeStunned = true; ((Collider)attachCollider).enabled = false; ((Collider)physicsCollider).enabled = true; physicsRigidbody.isKinematic = false; ((Collider)hitboxCollider).enabled = true; hitboxCollider.radius = 0.5f; hitboxCollider.center = Vector3.zero; SphereCollider obj = physicsCollider; ((Collider)obj).includeLayers = LayerMask.op_Implicit(LayerMask.op_Implicit(((Collider)obj).includeLayers) | 0x80000); SphereCollider obj2 = physicsCollider; ((Collider)obj2).excludeLayers = LayerMask.op_Implicit(LayerMask.op_Implicit(((Collider)obj2).excludeLayers) & -524289); break; } case 7: base.targetPlayer = null; base.movingTowardsTargetPlayer = false; base.agent.speed = 0f; creatureModel.transform.localPosition = Vector3.zero; base.creatureAnimator.SetBool("Jump", false); base.creatureAnimator.SetBool("Attached", false); base.creatureAnimator.SetBool("Dead", true); base.creatureAnimator.SetBool("Grounded", false); base.inSpecialAnimation = true; ((Behaviour)base.agent).enabled = false; base.enemyType.canBeStunned = false; ((Collider)attachCollider).enabled = false; ((Collider)physicsCollider).enabled = false; physicsRigidbody.isKinematic = true; ((Collider)hitboxCollider).enabled = false; hitboxCollider.radius = 0.5f; hitboxCollider.center = Vector3.zero; break; } ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(state); } private void LateUpdate() { //IL_0020: 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_0047: 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_015d: 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_0180: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_01de: 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_01ff: 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_0214: 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_021e: 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_0230: 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_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_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_026c: 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_027e: Unknown result type (might be due to invalid IL or missing references) if (base.isEnemyDead) { return; } if (isAttached) { ((Component)this).transform.position = attachTargetTransform.position; ((Component)this).transform.rotation = attachTargetTransform.rotation; ((Component)this).transform.Rotate(attachTargetRotationOffset); ((Component)this).transform.Translate(0f, 0f, attachTargetTranslationOffset.z, (Space)1); ((Component)this).transform.Translate(0f, attachTargetTranslationOffset.y, 0f, attachTargetTransform); } int currentBehaviourStateIndex = base.currentBehaviourStateIndex; if (currentBehaviourStateIndex == 4) { blinkTimer += Time.deltaTime; if (blinkTimer > blinkInterval) { base.creatureAnimator.SetTrigger("Blink"); blinkInterval = Random.Range(2f, 12f); blinkTimer = 0f; } } if (base.isEnemyDead || (Object)(object)attachedPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { return; } PlayerControllerB val = null; float num = 7f; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (!((Object)(object)val2 == (Object)(object)attachedPlayer)) { float num2 = Vector3.Distance(eyeTransform.position, ((Component)val2.gameplayCamera).transform.position); Vector3 val3 = ((Component)val2).transform.position - eyeTransform.position; float num3 = Vector3.Angle(eyeOriginalTransform.forward, val3); if (num2 < num && num3 < 70f) { val = val2; num = num2; } } } if ((Object)(object)val != (Object)null) { Transform transform = ((Component)val.gameplayCamera).transform; float num4 = Vector3.Distance(eyeTransform.position, transform.position); if (num4 < 7f) { Vector3 val4 = transform.position - eyeTransform.position; Quaternion val5 = Quaternion.LookRotation(val4, eyeTransform.up); Quaternion val6 = Quaternion.RotateTowards(eyeOriginalTransform.rotation, val5, 40f); float num5 = Quaternion.Angle(val5, eyeOriginalTransform.rotation); if (num5 < 90f) { eyeTransform.rotation = Quaternion.RotateTowards(eyeTransform.rotation, val6, 120f * Time.deltaTime); return; } } } eyeTransform.rotation = Quaternion.RotateTowards(eyeTransform.rotation, eyeOriginalTransform.rotation, 20f * Time.deltaTime); } public override void Update() { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_017c: 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_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: 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_03f3: 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_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_0631: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (base.isEnemyDead) { base.currentBehaviourStateIndex = 7; } else if (base.currentBehaviourStateIndex == 0 || base.currentBehaviourStateIndex == 1 || base.currentBehaviourStateIndex == 5) { CalculateAnimationDirection(); } if (base.currentBehaviourStateIndex == 0) { PutCreatureOnGround(); if (!((NetworkBehaviour)this).IsOwner) { return; } stateTimer += Time.deltaTime; if (!(stateTimer < 0.15f)) { stateTimer = 0f; PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForClosestPlayer(70f, sightRange, 3, 0f); if (!((Object)(object)val == (Object)null) && !(Vector3.Distance(base.eye.position, ((Component)val.gameplayCamera).transform.position) > (float)sightRange)) { PlayCreatureSFXServerRpc(0); BeginChasingPlayerServerRpc((int)val.playerClientId); SwitchBehaviourState(1); } } } else if (base.currentBehaviourStateIndex == 1) { PutCreatureOnGround(); if (!((NetworkBehaviour)this).IsOwner) { return; } if (stateTimer2 < 0.5f) { stateTimer2 += Time.deltaTime; return; } if ((Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)base.targetPlayer.playerGlobalHead).transform.position, base.eye.position) < 8f) { Vector3 val2 = ((Component)base.targetPlayer.playerGlobalHead).transform.position - base.eye.position; val2.y = 0f; Vector3 forward = base.eye.forward; forward.y = 0f; if (Vector3.Angle(forward, val2) < 15f) { PlayCreatureSFXServerRpc(3); SwitchBehaviourState(3); JumpAtPlayerServerRpc(base.targetPlayer.playerClientId); return; } } stateTimer += Time.deltaTime; if (stateTimer < 0.15f) { return; } stateTimer = 0f; PlayerControllerB val3 = ((EnemyAI)this).CheckLineOfSightForClosestPlayer(70f, sightRange, 3, 0f); if ((Object)(object)val3 == (Object)null || Vector3.Distance(base.eye.position, ((Component)val3.gameplayCamera).transform.position) > (float)sightRange) { stateCounter++; if (stateCounter >= 8) { stateCounter = 0; SwitchBehaviourState(0); } } else if ((Object)(object)val3 != (Object)(object)GameNetworkManager.Instance.localPlayerController) { BeginChasingPlayerServerRpc((int)val3.playerClientId); } } else if (base.currentBehaviourStateIndex == 2) { PutCreatureOnGround(); if (!((NetworkBehaviour)this).IsOwner) { return; } stateTimer += Time.deltaTime; if (stateTimer > 5.5f) { stateTimer = 0f; if ((Object)(object)base.targetPlayer != (Object)null) { SwitchBehaviourState(1); } else { SwitchBehaviourState(0); } } stateTimer2 += Time.deltaTime; if (!(stateTimer2 < 0.5f)) { stateTimer2 = 0f; PlayerControllerB val4 = ((EnemyAI)this).CheckLineOfSightForClosestPlayer(70f, sightRange, 3, 0f); if (!((Object)(object)val4 == (Object)null) && !(Vector3.Distance(base.eye.position, ((Component)val4.gameplayCamera).transform.position) > (float)sightRange)) { BeginChasingPlayerServerRpc((int)val4.playerClientId); } } } else if (base.currentBehaviourStateIndex == 3) { if (!((NetworkBehaviour)this).IsOwner) { ((Component)this).transform.position = base.serverPosition; return; } ((EnemyAI)this).SyncPositionToClients(); if (stateCounter == 0) { stateTimer += Time.deltaTime; if (stateTimer > 2.5f) { hitboxCollider.radius = 0.5f; SphereCollider obj = physicsCollider; ((Collider)obj).includeLayers = LayerMask.op_Implicit(LayerMask.op_Implicit(((Collider)obj).includeLayers) | 0x80000); SphereCollider obj2 = physicsCollider; ((Collider)obj2).excludeLayers = LayerMask.op_Implicit(LayerMask.op_Implicit(((Collider)obj2).excludeLayers) & -524289); stateCounter = 1; } } stateTimer2 += Time.deltaTime; if (!(stateTimer2 < 5f)) { stateTimer2 = 0f; PlayCreatureSFXServerRpc(0, 0.5f); SwitchBehaviourState(5); } } else if (base.currentBehaviourStateIndex == 4) { if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).SyncPositionToClients(); } stateTimer += Time.deltaTime; if (stateTimer < 1f) { return; } stateTimer = 0f; if (Time.time < NextWhisperTime) { return; } NextWhisperTime = Time.time + 10f; Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 16f, LayerMask.GetMask(new string[1] { "Enemies" }), (QueryTriggerInteraction)2); Collider[] array2 = array; foreach (Collider val5 in array2) { EnemyAI componentInParent = ((Component)val5).gameObject.GetComponentInParent<EnemyAI>(); if ((Object)(object)componentInParent != (Object)null && !Peeper.ignoreEnemies.Contains(componentInParent.enemyType.enemyName)) { PlayCreatureSFXServerRpc(7); NextWhisperTime = Time.time + Random.Range(6f, 12f); return; } } NextWhisperTime = Time.time + 1f; } else if (base.currentBehaviourStateIndex == 5) { PutCreatureOnGround(); if (((NetworkBehaviour)this).IsOwner) { stateTimer += Time.deltaTime; if (!(stateTimer < 1.2f)) { stateTimer = 0f; SwitchBehaviourState(0); } } } else if (base.currentBehaviourStateIndex == 6) { if (!((NetworkBehaviour)this).IsOwner) { ((Component)this).transform.position = base.serverPosition; return; } ((EnemyAI)this).SyncPositionToClients(); stateTimer += Time.deltaTime; if (!(stateTimer < 5f)) { stateTimer = 4.5f; Vector3 velocity = physicsRigidbody.velocity; if (!(((Vector3)(ref velocity)).sqrMagnitude > 10f)) { PlayCreatureSFXServerRpc(0, 0.5f); SwitchBehaviourState(5); } } } else { if (base.currentBehaviourStateIndex != 7 || ragdollFrozen) { return; } stateTimer += Time.deltaTime; if (!(stateTimer < 15f)) { stateTimer = 0f; Rigidbody[] array3 = ragdollRigidbodies; foreach (Rigidbody val6 in array3) { val6.isKinematic = true; ragdollFrozen = true; } } } } [ServerRpc(RequireOwnership = false)] public void JumpAtPlayerServerRpc(ulong playerObjectId) { //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(3297439372u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3297439372u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { JumpAtPlayerClientRpc(playerObjectId); } } } [ClientRpc] public void JumpAtPlayerClientRpc(ulong playerObjectId) { //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(3646752176u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3646752176u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { JumpAtPlayer(StartOfRound.Instance.allPlayerScripts[(int)(IntPtr)checked((long)playerObjectId)]); } } } private void JumpAtPlayer(PlayerControllerB playerScript) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_0144: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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) if (!base.isEnemyDead && !isAttached) { base.agent.speed = 0f; creatureModel.transform.localPosition = Vector3.zero; base.creatureAnimator.SetBool("Jump", true); base.creatureAnimator.SetBool("Attached", false); base.creatureAnimator.SetBool("Dead", false); isAttached = false; base.inSpecialAnimation = true; ((Behaviour)base.agent).enabled = false; base.enemyType.canBeStunned = true; ((Collider)attachCollider).enabled = true; ((Collider)physicsCollider).enabled = true; physicsRigidbody.isKinematic = false; ((Collider)hitboxCollider).enabled = true; hitboxCollider.radius = 2f; Vector3 val = ((Component)playerScript.playerGlobalHead).transform.position; if ((Object)(object)base.targetPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { val += base.targetPlayer.thisController.velocity / 5f; } else if (base.targetPlayer.timeSincePlayerMoving < 0.25f) { val += Vector3.Normalize((base.targetPlayer.serverPlayerPosition - base.targetPlayer.oldPlayerPosition) * 100f); } Rigidbody obj = physicsRigidbody; Vector3 val2 = val - ((Component)this).transform.position + Vector3.up; obj.velocity = 33f * ((Vector3)(ref val2)).normalized; base.creatureAnimator.SetBool("Grounded", false); } } [ServerRpc(RequireOwnership = false)] public void BeginChasingPlayerServerRpc(int playerObjectId) { //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(2492932585u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2492932585u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { BeginChasingPlayerClientRpc(playerObjectId); } } } [ClientRpc] public void BeginChasingPlayerClientRpc(int playerObjectId) { //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(3529258009u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3529258009u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { BeginChasingPlayer(playerObjectId); } } } public void BeginChasingPlayer(int playerObjectId) { PlayerControllerB movingTowardsTargetPlayer = (base.targetPlayer = StartOfRound.Instance.allPlayerScripts[playerObjectId]); if (((NetworkBehaviour)this).OwnerClientId != (ulong)playerObjectId) { ((EnemyAI)this).ChangeOwnershipOfEnemy((ulong)playerObjectId); } ((EnemyAI)this).SetMovingTowardsTargetPlayer(movingTowardsTargetPlayer); } [ServerRpc(RequireOwnership = false)] public void PlayCreatureSFXServerRpc(int index, float volume = 1f) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a4: 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(1656237277u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref volume, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1656237277u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PlayCreatureSFXClientRpc(index, volume); } } } [ClientRpc] public void PlayCreatureSFXClientRpc(int index, float volume = 1f) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a4: 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(2720121576u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref volume, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2720121576u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PlayCreatureSFX(index, volume); } } } private void PlayCreatureSFX(int index, float volume = 1f) { //IL_01e0: Unknown result type (might be due to invalid IL or missing references) base.creatureVoice.pitch = Random.Range(0.8f, 1.1f); AttachSFXSource.pitch = Random.Range(0.9f, 1.05f); switch (index) { case 0: { AudioClip val = spotSFX[Random.Range(0, spotSFX.Length)]; base.creatureVoice.PlayOneShot(val, volume); WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, val, volume); break; } case 1: base.creatureSFX.PlayOneShot(walkSFX, volume * 0.22f); WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, walkSFX, volume * 0.22f); break; case 2: base.creatureSFX.PlayOneShot(runSFX, volume * 0.25f); WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, runSFX, volume * 0.25f); break; case 3: { AudioClip val = jumpSFX[Random.Range(0, jumpSFX.Length)]; base.creatureVoice.PlayOneShot(val, volume); WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, val, volume); break; } case 4: { AudioClip val = attachSFX[0]; AttachSFXSource.PlayOneShot(val, volume); WalkieTalkie.TransmitOneShotAudio(AttachSFXSource, val, volume); break; } case 5: { AudioClip val = deathSFX[Random.Range(0, deathSFX.Length)]; base.creatureVoice.PlayOneShot(val, volume); WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, val, volume); break; } case 6: { AudioClip val = ejectSFX[Random.Range(0, ejectSFX.Length)]; base.creatureVoice.PlayOneShot(val, volume); WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, val, volume); break; } case 7: { AudioClip val = whisperSFX[Random.Range(0, whisperSFX.Length)]; AttachSFXSource.PlayOneShot(val, volume); WalkieTalkie.TransmitOneShotAudio(AttachSFXSource, val, volume); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 18f, 0.6f, 0, false, 0); break; } } } [ServerRpc(RequireOwnership = false)] public void AttachToPlayerServerRpc(ulong playerObjectId) { //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(2592041692u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2592041692u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { AttachToPlayerClientRpc(playerObjectId); } } } [ClientRpc] public void AttachToPlayerClientRpc(ulong playerObjectId) { //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(4096406816u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4096406816u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { AttachToPlayerLocally(StartOfRound.Instance.allPlayerScripts[(int)(IntPtr)checked((long)playerObjectId)]); } } } private void AttachToPlayerLocally(PlayerControllerB playerScript) { //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_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041d: 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_0459: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) if (base.isEnemyDead || isAttached || playerScript.isPlayerDead) { return; } int num = 0; foreach (PeeperAI peeper in Peeper.PeeperList) { if ((Object)(object)peeper.attachedPlayer == (Object)(object)playerScript) { num++; } } if (num >= 10) { return; } isAttached = true; base.targetPlayer = playerScript; attachedPlayer = playerScript; if (!playerScript.isPlayerDead) { IsWeighted = true; } if ((Object)(object)playerScript == (Object)(object)GameNetworkManager.Instance.localPlayerController) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } ((EnemyAI)this).ChangeOwnershipOfEnemy(playerScript.actualClientId); SwitchBehaviourStateLocally(4); PlayCreatureSFX(4); float num2 = 0f; float num3 = 0f; float num4 = 0f; Transform val = null; Random.InitState(base.thisEnemyIndex + StartOfRound.Instance.randomMapSeed); int num5 = Random.Range(0, 11); for (int i = 0; i < 10; i++) { if (num5 == 6) { num5++; } if (!UsedAttachTargets.Contains(attachedPlayer.bodyParts[num5])) { val = ((num5 != 0 || !((Object)(object)attachedPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController)) ? attachedPlayer.bodyParts[num5] : ((Component)attachedPlayer.gameplayCamera).transform); UsedAttachTargets.Add(val); attachTargetTransform = val; break; } num5 = ((num5 != 10) ? (num5 + 1) : 0); } if (!((Object)(object)val == (Object)null)) { switch (num5) { case 0: num2 = Random.Range(-30f, -90f); num3 = Random.Range(80f, 280f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0.35f, 0.2f); break; case 1: num3 = Random.Range(60f, 160f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.075f); break; case 2: num3 = Random.Range(-60f, -160f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.075f); break; case 3: num3 = Random.Range(0f, 160f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.2f); break; case 4: num3 = Random.Range(0f, -160f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.2f); break; case 5: num3 = Random.Range(-30f, 30f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.2f); break; case 7: num3 = Random.Range(0f, 160f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.2f); break; case 8: num3 = Random.Range(0f, -160f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.2f); break; case 9: num3 = Random.Range(160f, 280f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.15f); break; case 10: num3 = Random.Range(-20f, 100f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.15f); break; default: Debug.Log((object)("Peepers have encountered an error when attaching! Report it to the developer! Target Index: " + num5)); break; } attachTargetRotationOffset = new Vector3(num2, num3, num4); creatureModel.transform.localPosition = Vector3.zero; } } [ServerRpc(RequireOwnership = false)] public void EjectFromPlayerServerRpc(ulong playerObjectId) { //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(1104444428u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1104444428u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { EjectFromPlayerClientRpc(playerObjectId); } } } [ClientRpc] public void EjectFromPlayerClientRpc(ulong playerObjectId) { //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(280628075u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 280628075u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { EjectFromPlayer(StartOfRound.Instance.allPlayerScripts[(int)(IntPtr)checked((long)playerObjectId)]); } } } public void EjectFromPlayer(PlayerControllerB playerScript) { //IL_0053: 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_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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (isAttached) { isAttached = false; if (!playerScript.isPlayerDead) { IsWeighted = false; } attachedPlayer = null; UsedAttachTargets.Remove(attachTargetTransform); attachTargetTransform = null; if (!base.isEnemyDead) { SwitchBehaviourStateLocally(6); } Vector3 val = ((Component)playerScript).transform.position - ((Component)this).transform.position; val.y = 0f; val = ((Vector3)(ref val)).normalized; val.y = -1f; physicsRigidbody.AddForce(-10f * val, (ForceMode)1); PlayCreatureSFX(6); } } public static bool HasLineOfSightToPeeper(Vector3 position) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0042: 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_006d: 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) foreach (PeeperAI peeper in Peeper.PeeperList) { if ((Object)(object)peeper != (Object)null) { Vector3 val = position - peeper.eyeTransform.position; float num = Vector3.Angle(peeper.eyeOriginalTransform.forward, val); if (Vector3.Distance(position, peeper.eyeTransform.position) < 10f && num < 60f && !Physics.Linecast(((Component)peeper.eyeTransform).transform.position, position, StartOfRound.Instance.collidersRoomDefaultAndFoliage, (QueryTriggerInteraction)1)) { return true; } } } return false; } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_PeeperAI() { //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 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1087886824u, new RpcReceiveHandler(__rpc_handler_1087886824)); NetworkManager.__rpc_func_table.Add(2756874777u, new RpcReceiveHandler(__rpc_handler_2756874777)); NetworkManager.__rpc_func_table.Add(316864934u, new RpcReceiveHandler(__rpc_handler_316864934)); NetworkManager.__rpc_func_table.Add(4022924503u, new RpcReceiveHandler(__rpc_handler_4022924503)); NetworkManager.__rpc_func_table.Add(3297439372u, new RpcReceiveHandler(__rpc_handler_3297439372)); NetworkManager.__rpc_func_table.Add(3646752176u, new RpcReceiveHandler(__rpc_handler_3646752176)); NetworkManager.__rpc_func_table.Add(2492932585u, new RpcReceiveHandler(__rpc_handler_2492932585)); NetworkManager.__rpc_func_table.Add(3529258009u, new RpcReceiveHandler(__rpc_handler_3529258009)); NetworkManager.__rpc_func_table.Add(1656237277u, new RpcReceiveHandler(__rpc_handler_1656237277)); NetworkManager.__rpc_func_table.Add(2720121576u, new RpcReceiveHandler(__rpc_handler_2720121576)); NetworkManager.__rpc_func_table.Add(2592041692u, new RpcReceiveHandler(__rpc_handler_2592041692)); NetworkManager.__rpc_func_table.Add(4096406816u, new RpcReceiveHandler(__rpc_handler_4096406816)); NetworkManager.__rpc_func_table.Add(1104444428u, new RpcReceiveHandler(__rpc_handler_1104444428)); NetworkManager.__rpc_func_table.Add(280628075u, new RpcReceiveHandler(__rpc_handler_280628075)); } private static void __rpc_handler_1087886824(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; ((PeeperAI)(object)target).KillEnemyServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2756874777(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; ((PeeperAI)(object)target).KillEnemyClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_316864934(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 state = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref state); target.__rpc_exec_stage = (__RpcExecStage)1; ((PeeperAI)(object)target).SwitchBehaviourStateServerRpc(state); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4022924503(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 state = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref state); target.__rpc_exec_stage = (__RpcExecStage)2; ((PeeperAI)(object)target).SwitchBehaviourStateClientRpc(state); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3297439372(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 playerObjectId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)1; ((PeeperAI)(object)target).JumpAtPlayerServerRpc(playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3646752176(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 playerObjectId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)2; ((PeeperAI)(object)target).JumpAtPlayerClientRpc(playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2492932585(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 playerObjectId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)1; ((PeeperAI)(object)target).BeginChasingPlayerServerRpc(playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3529258009(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 playerObjectId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)2; ((PeeperAI)(object)target).BeginChasingPlayerClientRpc(playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1656237277(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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); float volume = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref volume, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PeeperAI)(object)target).PlayCreatureSFXServerRpc(index, volume); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2720121576(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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); float volume = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref volume, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((PeeperAI)(object)target).PlayCreatureSFXClientRpc(index, volume); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2592041692(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 playerObjectId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)1; ((PeeperAI)(object)target).AttachToPlayerServerRpc(playerObjectId);
TZPReworked.dll
Decompiled 2 years agousing System.Diagnostics; 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 TzpLeth.Patches; 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: AssemblyTitle("TZPHealCustom")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TZPHealCustom")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("2ba0eb43-680c-46bc-9c38-f755dcb4f038")] [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 TzpLeth { [BepInPlugin("riverbible.TZPHealCustom", "TZP Healing Custom", "1.0.0")] public class TZPHEAL : BaseUnityPlugin { private const string modGUID = "riverbible.TZPHealCustom"; private const string modName = "TZP Healing Custom"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("riverbible.TZPHealCustom"); private ConfigEntry<bool> configInfiniteFuel; public static bool InfiniteFuel; private ConfigEntry<bool> configShowBatteryIcon; public static bool ShowBatteryIcon; private static TZPHEAL Instance; internal ManualLogSource mls; private ConfigEntry<int> configHealingPercent; public static int HealingPercent; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("riverbible.TZPHealCustom"); mls.LogInfo((object)"TZP HEAL loaded"); harmony.PatchAll(typeof(TZPHEAL)); harmony.PatchAll(typeof(PlayerControllerBPatch)); configInfiniteFuel = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Infinite TZP", false, "Prevent TZP from ever running out."); InfiniteFuel = configInfiniteFuel.Value; configShowBatteryIcon = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Battery Icon", true, "Show a battery icon with the current TZP Fuel"); ShowBatteryIcon = configShowBatteryIcon.Value; configHealingPercent = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Healing Percent", 2, "Determines how much TZP healing will be applied."); HealingPercent = configHealingPercent.Value; } } } namespace TzpLeth.Patches { [HarmonyPatch(typeof(PlayerControllerB))] [HarmonyPatch(typeof(TetraChemicalItem))] internal class PlayerControllerBPatch : GrabbableObject { [HarmonyPatch(typeof(TetraChemicalItem), "Update")] [HarmonyPrefix] private static void PatchBattery(ref Item ___itemProperties, ref Battery ___insertedBattery, ref float ___fuel) { ___itemProperties.requiresBattery = false; ___insertedBattery.charge = ___fuel; ___insertedBattery.empty = false; } [HarmonyPatch(typeof(TetraChemicalItem), "Update")] [HarmonyPostfix] public static void healtzp(ref bool ___emittingGas, ref bool ___isHeld, PlayerControllerB __instance, ref float ___fuel, ref Item ___itemProperties, ref Battery ___insertedBattery) { //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) if (TZPHEAL.InfiniteFuel && (int)(___fuel * 1000f) % 1000 < 500) { ___fuel = 1f; } else if (TZPHEAL.ShowBatteryIcon) { ___itemProperties.requiresBattery = true; ___insertedBattery.charge = ___fuel; ___insertedBattery.empty = false; } if (!(___emittingGas & ___isHeld) || !((NetworkBehaviour)__instance).IsOwner) { return; } int num = (int)(___fuel * 1000f) % 1000; GameNetworkManager.Instance.localPlayerController.inSpecialInteractAnimation = true; if (((NetworkBehaviour)__instance).IsOwner && num % 30 == 0 && GameNetworkManager.Instance.localPlayerController.health < 100) { HUDManager.Instance.DisplayStatusEffect("Healing ... " + (GameNetworkManager.Instance.localPlayerController.health + 1) + "%"); int healingPercent = TZPHEAL.HealingPercent; GameNetworkManager.Instance.localPlayerController.DamagePlayer(-healingPercent, false, true, (CauseOfDeath)0, 0, false, default(Vector3)); if (GameNetworkManager.Instance.localPlayerController.health >= 10 && GameNetworkManager.Instance.localPlayerController.criticallyInjured) { GameNetworkManager.Instance.localPlayerController.MakeCriticallyInjured(false); } HUDManager.Instance.HUDAnimator.ResetTrigger("SmallHit"); } if (GameNetworkManager.Instance.localPlayerController.health >= 99) { HUDManager.Instance.DisplayStatusEffect("Healthy.\nGet to work!"); HUDManager.Instance.statusEffectAnimator.SetTrigger("IndicateStatus"); } GameNetworkManager.Instance.localPlayerController.inSpecialInteractAnimation = false; } } }
YippeeMod.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using YippeeMod.Patches; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("YippeeMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("YippeeMod")] [assembly: AssemblyTitle("YippeeMod")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace YippeeMod { [BepInPlugin("sunnobunno.YippeeMod", "Yippee tbh mod", "1.2.4")] public class YippeeModBase : BaseUnityPlugin { private const string modGUID = "sunnobunno.YippeeMod"; private const string modName = "Yippee tbh mod"; private const string modVersion = "1.2.4"; private readonly Harmony harmony = new Harmony("sunnobunno.YippeeMod"); private static YippeeModBase? Instance; internal ManualLogSource? mls; internal static AudioClip[]? newSFX; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("sunnobunno.YippeeMod"); mls.LogInfo((object)"sunnobunno.YippeeMod is loading."); string location = ((BaseUnityPlugin)Instance).Info.Location; string text = "YippeeMod.dll"; string text2 = location.TrimEnd(text.ToCharArray()); string text3 = text2 + "yippeesound"; AssetBundle val = AssetBundle.LoadFromFile(text3); if ((Object)(object)val == (Object)null) { mls.LogError((object)"Failed to load audio assets!"); return; } newSFX = val.LoadAssetWithSubAssets<AudioClip>("assets/yippee-tbh.mp3"); harmony.PatchAll(typeof(HoarderBugPatch)); mls.LogInfo((object)"sunnobunno.YippeeMod is loaded. Yippee!!!"); } } } namespace YippeeMod.Patches { [HarmonyPatch(typeof(HoarderBugAI))] internal class HoarderBugPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void hoarderBugAudioPatch(ref AudioClip[] ___chitterSFX) { AudioClip[] newSFX = YippeeModBase.newSFX; ___chitterSFX = newSFX; } } }
BepInEx/plugins/GroanTubeScrap.dll
Decompiled 2 years agousing 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 HarmonyLib; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("LaserTweaks")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LaserTweaks")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4963e0ea-7a99-4390-9cae-a4bdd01b6b43")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace GroanTubeScrap { public class Assets { public static AssetBundle MainAssetBundle; public static Item Item; internal static Stream GetEmbededResource(string name) { return Assembly.GetExecutingAssembly().GetManifestResourceStream("GroanTubeScrap." + name); } public static void Init() { MainAssetBundle = AssetBundle.LoadFromStream(GetEmbededResource("groantube.bundle")); Item = MainAssetBundle.LoadAsset<Item>("Assets/Mods/GroanTubeScrap/GroanTube.asset"); } } internal class GroanTubeItem : NoisemakerProp { private bool localState; [Header("Horrible Color Sync")] [Tooltip("Seekers made me do this. Look at implementation of (Item.materialVariants)")] public Material[] altMaterials; public int altSelect = -1; public override int GetItemDataToSave() { return altSelect; } public override void LoadItemSaveData(int saveData) { altSelect = Mathf.Clamp(saveData, 0, altMaterials.Length - 1); Material sharedMaterial = altMaterials[altSelect]; ((Renderer)((GrabbableObject)this).mainObjectRenderer).sharedMaterial = sharedMaterial; } public override void Start() { ((NoisemakerProp)this).Start(); if (((NetworkBehaviour)this).IsOwner && altMaterials.Length != 0) { if (altSelect < 0) { altSelect = Random.Range(0, altMaterials.Length); } ((GrabbableObject)this).SyncBatteryServerRpc(altSelect); } } public override void ChargeBatteries() { if (!(((GrabbableObject)this).insertedBattery.charge < 0f)) { int num = Mathf.RoundToInt(((GrabbableObject)this).insertedBattery.charge * 100f); num = Mathf.Clamp(num, 0, altMaterials.Length - 1); ((GrabbableObject)this).LoadItemSaveData(num); ((GrabbableObject)this).insertedBattery.charge = -1f; } } public override void ItemActivate(bool used, bool buttonDown = true) { if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)) { if (((NetworkBehaviour)this).IsOwner) { buttonDown = !localState; ((GrabbableObject)this).isSendingItemRPC = ((GrabbableObject)this).isSendingItemRPC + 1; ((GrabbableObject)this).ActivateItemServerRpc(false, buttonDown); } OnItemUseLocal(buttonDown); } } private void OnItemUseLocal(bool state) { localState = state; base.triggerAnimator.SetTrigger("Spin"); PlayAudio((!state) ? 1 : 0); } private void PlayAudio(int index) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) AudioClip val = base.noiseSFX[index]; float num = (float)base.noisemakerRandom.Next((int)(base.minLoudness * 100f), (int)(base.maxLoudness * 100f)) / 100f; float pitch = (float)base.noisemakerRandom.Next((int)(base.minPitch * 100f), (int)(base.maxPitch * 100f)) / 100f; base.noiseAudio.pitch = pitch; base.noiseAudio.PlayOneShot(val, num); WalkieTalkie.TransmitOneShotAudio(base.noiseAudio, val, num); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, base.noiseRange, num, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); if (base.minLoudness >= 0.6f && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { ((GrabbableObject)this).playerHeldBy.timeSinceMakingLoudNoise = 0f; } } } [BepInPlugin("Kittenji.GroanTubeScrap", "Groan Tube Scrap", "1.0.0")] public class Loader : BaseUnityPlugin { [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().AddNetworkPrefab(Assets.Item.spawnPrefab); } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePatch(ref StartOfRound __instance) { //IL_00f5: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown SelectableLevel[] levels = __instance.levels; foreach (SelectableLevel val in levels) { if (val.spawnableScrap.Any((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)Assets.Item)) { continue; } int num = SpawnRateOverride.Value; if (num < 1) { SpawnableItemWithRarity val2 = val.spawnableScrap.Find((SpawnableItemWithRarity s) => Object.op_Implicit((Object)(object)s.spawnableItem) && Object.op_Implicit((Object)(object)s.spawnableItem.spawnPrefab) && ((Object)s.spawnableItem.spawnPrefab).name == "RobotToy"); if (val2 != null) { num = val2.rarity; } else if (val.spawnableScrap.Count > 0) { int num2 = int.MaxValue; foreach (SpawnableItemWithRarity item2 in val.spawnableScrap) { if (item2.rarity < num2) { num2 = item2.rarity; } } num = num2; } } num = Mathf.Clamp(num, 1, 100); SpawnableItemWithRarity item = new SpawnableItemWithRarity { spawnableItem = Assets.Item, rarity = num }; val.spawnableScrap.Add(item); } if (!__instance.allItemsList.itemsList.Contains(Assets.Item)) { __instance.allItemsList.itemsList.Add(Assets.Item); } } } private const string modGUID = "Kittenji.GroanTubeScrap"; private readonly Harmony harmony = new Harmony("Kittenji.GroanTubeScrap"); private static ConfigEntry<int> SpawnRateOverride; private const string ItemReferenceName = "RobotToy"; private void Awake() { Assets.Init(); SpawnRateOverride = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Spawn Rate Override", -1, "Override the spawn rate for this item, this affects all moons. By default, it uses the spawn rate of the Toy Cube item so it spawns in coordination with other toys."); harmony.PatchAll(); } } }
BepInEx/plugins/ShipLoot/ShipLoot.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ShipLoot")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("ShipLoot")] [assembly: AssemblyCopyright("Copyright © tinyhoot 2023")] [assembly: ComVisible(false)] [assembly: AssemblyFileVersion("1.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ShipLoot { [BepInPlugin("com.github.tinyhoot.ShipLoot", "ShipLoot", "1.0")] internal class ShipLoot : BaseUnityPlugin { public const string GUID = "com.github.tinyhoot.ShipLoot"; public const string NAME = "ShipLoot"; public const string VERSION = "1.0"; internal static ManualLogSource Log; private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; new Harmony("com.github.tinyhoot.ShipLoot").PatchAll(Assembly.GetExecutingAssembly()); } } } namespace ShipLoot.Patches { [HarmonyPatch] internal class HudManagerPatcher { private static GameObject _totalCounter; private static TextMeshProUGUI _textMesh; private static float _displayTimeLeft; private const float DisplayTime = 5f; [HarmonyPrefix] [HarmonyPatch(typeof(HUDManager), "PingScan_performed")] private static void OnScan(HUDManager __instance, CallbackContext context) { if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && ((CallbackContext)(ref context)).performed && __instance.CanPlayerScan() && !(__instance.playerPingingScan > -0.5f) && (StartOfRound.Instance.inShipPhase || GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom)) { if (!Object.op_Implicit((Object)(object)_totalCounter)) { CopyValueCounter(); } float num = CalculateLootValue(); ((TMP_Text)_textMesh).text = $"SHIP: ${num:F0}"; _displayTimeLeft = 5f; if (!_totalCounter.activeSelf) { ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(ShipLootCoroutine()); } } } private static IEnumerator ShipLootCoroutine() { _totalCounter.SetActive(true); while (_displayTimeLeft > 0f) { float displayTimeLeft = _displayTimeLeft; _displayTimeLeft = 0f; yield return (object)new WaitForSeconds(displayTimeLeft); } _totalCounter.SetActive(false); } private static float CalculateLootValue() { List<GrabbableObject> list = (from obj in GameObject.Find("/Environment/HangarShip").GetComponentsInChildren<GrabbableObject>() where ((Object)obj).name != "ClipboardManual" && ((Object)obj).name != "StickyNoteItem" select obj).ToList(); ShipLoot.Log.LogDebug((object)"Calculating total ship scrap value."); CollectionExtensions.Do<GrabbableObject>((IEnumerable<GrabbableObject>)list, (Action<GrabbableObject>)delegate(GrabbableObject scrap) { ShipLoot.Log.LogDebug((object)$"{((Object)scrap).name} - ${scrap.scrapValue}"); }); return list.Sum((GrabbableObject scrap) => scrap.scrapValue); } private static void CopyValueCounter() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/BottomMiddle/ValueCounter"); if (!Object.op_Implicit((Object)(object)val)) { ShipLoot.Log.LogError((object)"Failed to find ValueCounter object to copy!"); } _totalCounter = Object.Instantiate<GameObject>(val.gameObject, val.transform.parent, false); _totalCounter.transform.Translate(0f, 1f, 0f); Vector3 localPosition = _totalCounter.transform.localPosition; _totalCounter.transform.localPosition = new Vector3(localPosition.x + 50f, -50f, localPosition.z); _textMesh = _totalCounter.GetComponentInChildren<TextMeshProUGUI>(); } } }
BetterShotgunShells.dll
Decompiled 2 years agousing System; using 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 HarmonyLib; using LethalLib.Modules; using UnityEngine; 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("BuyableShells")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BuyableShells")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f1098099-7d96-4f78-bd10-8cf743e1f445")] [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 BuyableShells; [BepInPlugin("SalakStudios.BetterShotgunShells", "BetterShotgunShells", "1.0.2")] public class Plugin : BaseUnityPlugin { private const string modGUID = "SalakStudios.BetterShotgunShells"; private const string modName = "BetterShotgunShells"; private const string modVersion = "1.0.2"; private readonly Harmony harmony = new Harmony("SalakStudios.BetterShotgunShells"); internal static Plugin Instance; public static ManualLogSource mls; public bool added; public static ConfigEntry<int> ShellPrice; public static ConfigEntry<int> ItemRarityRend; public static ConfigEntry<int> ItemRarityDine; public static ConfigEntry<int> ItemRarityTitan; public List<Item> AllItems => Resources.FindObjectsOfTypeAll<Item>().Concat(Object.FindObjectsByType<Item>((FindObjectsInactive)1, (FindObjectsSortMode)1)).ToList(); public Item ShotgunShell => ((IEnumerable<Item>)AllItems).FirstOrDefault((Func<Item, bool>)((Item item) => ((Object)item).name == "GunAmmo")); private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(typeof(Plugin)); mls = Logger.CreateLogSource("SalakStudios.BetterShotgunShells"); mls.LogInfo((object)"BetterShotgunShells Enabled"); SceneManager.sceneLoaded += OnSceneLoaded; ShellPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Price", 80, "How many credits the shotgun shell costs"); ItemRarityRend = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Rarity Rend", 2, "How rare the shell is to find on Rend (Lower = Rarer, Higher = More Common)"); ItemRarityDine = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Rarity Dine", 3, "How rare the shell is to find on Dine (Lower = Rarer, Higher = More Common)"); ItemRarityTitan = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Rarity Titan", 5, "How rare the shell is to find on Titan (Lower = Rarer, Higher = More Common)"); } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (!added && ((Scene)(ref scene)).name == "MainMenu") { added = true; ShotgunShell.itemName = "Shells"; ShotgunShell.creditsWorth = 0; Items.RegisterShopItem(ShotgunShell, ShellPrice.Value); Items.RegisterScrap(ShotgunShell, ItemRarityRend.Value, (LevelTypes)128); Items.RegisterScrap(ShotgunShell, ItemRarityDine.Value, (LevelTypes)256); Items.RegisterScrap(ShotgunShell, ItemRarityTitan.Value, (LevelTypes)512); } } }