Decompiled source of Emergency Dice Updated v1.12.3
DicePoltergeistCompat.dll
Decompiled a week agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using MysteryDice; using MysteryDice.Dice; using Poltergeist; using Poltergeist.GhostInteractibles; 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("DicePoltergeistCompat")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Dice Poltergeist Compatibility")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DicePoltergeistCompat")] [assembly: AssemblyTitle("DicePoltergeistCompat")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] internal class <Module> { static <Module>() { } } 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 DicePoltergeistCompat { internal class DiceGhostInteractible : NetworkedInteractible { private DieBehaviour dice; protected override void DoSetup() { dice = ((Component)this).GetComponentInParent<DieBehaviour>(); } public override float GetCost() { return Plugin.energyUsage.Value; } public override float Interact(Transform playerTransform) { if ((Object)(object)StartOfRound.Instance == (Object)null) { return 0f; } if (SpectatorCamController.instance.Power < ((NetworkedInteractible)this).GetCost()) { return 0f; } if ((Object)(object)dice == (Object)null || dice.isRolling || !((GrabbableObject)dice).grabbable || StartOfRound.Instance.inShipPhase || !StartOfRound.Instance.shipHasLanded || (Object)(object)((GrabbableObject)dice).playerHeldBy != (Object)null) { return 0f; } RollDiceServerRpc(((NetworkBehaviour)dice).NetworkObject.NetworkObjectId, Array.IndexOf(StartOfRound.Instance.allPlayerScripts, SpectatorCamController.instance.ClientPlayer)); return ((NetworkedInteractible)this).GetCost(); } [ServerRpc(RequireOwnership = true)] private void RollDiceServerRpc(ulong diceId, int playerID) { if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(diceId, out var value)) { DieBehaviour component = ((Component)value).GetComponent<DieBehaviour>(); if (!((Object)(object)component == (Object)null) && !component.isRolling && ((GrabbableObject)component).grabbable && !((Object)(object)((GrabbableObject)component).playerHeldBy != (Object)null) && !StartOfRound.Instance.inShipPhase && StartOfRound.Instance.shipHasLanded) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerID]; ((MonoBehaviour)component).StartCoroutine(component.doStuff(7510501, val)); } } } public override string GetTipText() { return (SpectatorCamController.instance.Power < ((NetworkedInteractible)this).GetCost()) ? $"Not Enough Power ({((NetworkedInteractible)this).GetCost():F0})" : $"Roll Dice : [{PoltergeistCustomInputs.GetInteractString()}] ({((NetworkedInteractible)this).GetCost():F0})"; } } [BepInPlugin("Slayer6409.DicePoltergeistCompat", "DicePoltergeistCompat", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static AssetBundle LoadedAssets; public static GameObject GhostInteractiblePrefab; private readonly Harmony harmony = new Harmony("Slayer6409.DicePoltergeistCompat"); public static ConfigEntry<bool> poltergeistEnabled; public static ConfigEntry<float> energyUsage; private void Awake() { if (!Chainloader.PluginInfos.ContainsKey("coderCleric.Poltergeist")) { MysteryDice.CustomLogger.LogInfo((object)"Poltergeist not found disabling Poltergeist Compatability"); return; } LoadedAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "mysterydicepoltergeistcompat")); GhostInteractiblePrefab = LoadedAssets.LoadAsset<GameObject>("GhostInteractiblePrefab"); poltergeistEnabled = MysteryDice.BepInExConfig.Bind<bool>("Poltergeist", "Enabled", true, "If poltergeist compatability is enabled"); if (poltergeistEnabled.Value) { energyUsage = MysteryDice.BepInExConfig.Bind<float>("Poltergeist", "Energy Usage", 51f, "How much energy it takes to roll dice"); NetworkPrefabs.RegisterNetworkPrefab(GhostInteractiblePrefab); NetcodeWeaver(); harmony.PatchAll(); } } private static void NetcodeWeaver() { try { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } catch (Exception ex) { Debug.Log((object)ex); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "DicePoltergeistCompat"; public const string PLUGIN_NAME = "DicePoltergeistCompat"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace DicePoltergeistCompat.Patches { [HarmonyPatch(typeof(DieBehaviour), "Start")] internal class DieBehaviourPatch { private static void Postfix(DieBehaviour __instance) { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { GameObject val = Object.Instantiate<GameObject>(Plugin.GhostInteractiblePrefab, ((Component)__instance).transform); val.GetComponent<NetworkObject>().Spawn(false); val.transform.parent = ((Component)__instance).transform; } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
DiceTwitchIntegration.dll
Decompiled a week agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using Microsoft.CodeAnalysis; using MysteryDice; using MysteryDice.Effects; using MysteryDice.Patches; using UnityEngine; using com.github.zehsteam.TwitchChatAPI; using com.github.zehsteam.TwitchChatAPI.Objects; [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("DiceTwitchIntegration")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Twitch Integration for The Dice Mod")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DiceTwitchIntegration")] [assembly: AssemblyTitle("DiceTwitchIntegration")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] internal class <Module> { static <Module>() { } } 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 DiceTwitchIntegration { public class ConfigManager { public static void SetupLethalConfig() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(TwitchHandler.enableSubs); IntInputFieldConfigItem val2 = new IntInputFieldConfigItem(TwitchHandler.cheerMin); IntInputFieldConfigItem val3 = new IntInputFieldConfigItem(TwitchHandler.cheerGood); IntInputFieldConfigItem val4 = new IntInputFieldConfigItem(TwitchHandler.cheerAwful); IntInputFieldConfigItem val5 = new IntInputFieldConfigItem(TwitchHandler.cheerGreat); IntInputFieldConfigItem val6 = new IntInputFieldConfigItem(TwitchHandler.cheerMixed); IntInputFieldConfigItem val7 = new IntInputFieldConfigItem(TwitchHandler.cheerBad); BoolCheckBoxConfigItem val8 = new BoolCheckBoxConfigItem(TwitchHandler.enableCheer); BoolCheckBoxConfigItem val9 = new BoolCheckBoxConfigItem(TwitchHandler.enableRaid); BoolCheckBoxConfigItem val10 = new BoolCheckBoxConfigItem(TwitchHandler.enableChatEvents); IntInputFieldConfigItem val11 = new IntInputFieldConfigItem(TwitchHandler.chattersMin); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val3); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val5); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val6); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val7); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val8); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val9); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val10); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val11); } } [BepInPlugin("Slayer6409.DiceTwitchIntegration", "Dice Twitch Integration", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private const string modGUID = "Slayer6409.DiceTwitchIntegration"; private const string modName = "Dice Twitch Integration"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("Slayer6409.DiceTwitchIntegration"); public static bool LethalConfigPresent; private void Awake() { if (MysteryDice.TwitchEnabled.Value && Chainloader.PluginInfos.ContainsKey("com.github.zehsteam.TwitchChatAPI")) { if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig")) { LethalConfigPresent = true; } MysteryDice.CustomLogger.LogInfo((object)"Dice Twitch Integration has been loaded!"); TwitchHandler.doConfigStuff(); TwitchHandler.Initialize(); harmony.PatchAll(); if (LethalConfigPresent) { ConfigManager.SetupLethalConfig(); } } } } public class TwitchHandler { public static ConfigEntry<bool> enableSubs; public static ConfigEntry<bool> enableCheer; public static ConfigEntry<int> cheerMin; public static ConfigEntry<int> cheerGood; public static ConfigEntry<int> cheerGreat; public static ConfigEntry<int> cheerAwful; public static ConfigEntry<int> cheerBad; public static ConfigEntry<int> cheerMixed; public static ConfigEntry<bool> enableRaid; public static ConfigEntry<bool> enableChatEvents; public static ConfigEntry<int> chattersMin; public static HashSet<string> evnt = new HashSet<string>(); public static bool hasRan = false; public static void Initialize() { try { API.OnMessage += OnMessageHandler; API.OnCheer += OnCheerHandler; API.OnSub += OnSubHandler; API.OnRaid += OnRaidHandler; Application.quitting += delegate { API.OnMessage -= OnMessageHandler; API.OnCheer -= OnCheerHandler; API.OnSub -= OnSubHandler; API.OnRaid -= OnRaidHandler; }; } catch (Exception arg) { MysteryDice.CustomLogger.LogError((object)$"Failed to initialize TwitchIntegrationManager. {arg}"); } } public static void doConfigStuff() { enableSubs = MysteryDice.BepInExConfig.Bind<bool>("Twitch", "Enable Sub", true, "If Twitch Subscription events are enabled"); enableCheer = MysteryDice.BepInExConfig.Bind<bool>("Twitch", "Enable Cheer", true, "If Twitch Cheer events are enabled"); enableChatEvents = MysteryDice.BepInExConfig.Bind<bool>("Twitch", "Enable Chat Events", true, "If Twitch Chat events are enabled "); chattersMin = MysteryDice.BepInExConfig.Bind<int>("Twitch", "Chatters Min", 5, "How many Chatters are required for an event to start"); enableRaid = MysteryDice.BepInExConfig.Bind<bool>("Twitch", "Enable Raids", true, "If Twitch Raid events are enabled (Experimental so off by default)"); cheerMin = MysteryDice.BepInExConfig.Bind<int>("Twitch", "Cheer Min", 50, "How many bits required before a dice event is triggered"); cheerGreat = MysteryDice.BepInExConfig.Bind<int>("Twitch", "Cheer Great", 1, "The ones digit for spawning a Great Effect"); cheerGood = MysteryDice.BepInExConfig.Bind<int>("Twitch", "Cheer Good", 2, "The ones digit for spawning a Good Effect"); cheerMixed = MysteryDice.BepInExConfig.Bind<int>("Twitch", "Cheer Mixed", 3, "The ones digit for spawning a Mixed Effect"); cheerBad = MysteryDice.BepInExConfig.Bind<int>("Twitch", "Cheer Bad", 4, "The ones digit for spawning a Bad Effect"); cheerAwful = MysteryDice.BepInExConfig.Bind<int>("Twitch", "Cheer Awful", 5, "The ones digit for spawning a Awful Effect"); } public static void OnMessageHandler(TwitchMessage message) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_01de: 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) TwitchUser user = ((TwitchMessage)(ref message)).User; if (((TwitchUser)(ref user)).Username == "slayer6409") { string text = ((TwitchMessage)(ref message)).Message.ToUpper(); if (((TwitchMessage)(ref message)).Message.ToUpper().Contains("RANDOM") && ((TwitchMessage)(ref message)).Message.ToUpper().Contains("DICE")) { if (text.Contains("GOOD")) { Networker.Instance.QueueSelectTypeServerRPC((EffectType)3, "twitch"); } else if (text.Contains("BAD")) { Networker.Instance.QueueSelectTypeServerRPC((EffectType)1, "twitch"); } else if (text.Contains("AWFUL")) { Networker.Instance.QueueSelectTypeServerRPC((EffectType)0, "twitch"); } else if (text.Contains("GREAT")) { Networker.Instance.QueueSelectTypeServerRPC((EffectType)4, "twitch"); } else if (text.Contains("MIXED")) { Networker.Instance.QueueSelectTypeServerRPC((EffectType)2, "twitch"); } else { Networker.Instance.QueueRandomDiceEffectServerRPC("Twitch"); } } else if (((TwitchMessage)(ref message)).Message.ToUpper() == "SUPERTEST") { Test(); } } if (enableChatEvents.Value && ((TwitchMessage)(ref message)).Message.ToUpper().StartsWith("!EVENT")) { Debug.Log((object)"test"); if (evnt.Count == 0) { Misc.SafeTipMessage("Dice Twitch event started", $"{chattersMin.Value - 1} more users needed to trigger an event! Do !event to join the event!"); } HashSet<string> hashSet = evnt; user = ((TwitchMessage)(ref message)).User; hashSet.Add(((TwitchUser)(ref user)).Username); if (evnt.Count >= chattersMin.Value && !hasRan) { ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(waitReset()); } } } public static IEnumerator waitReset() { hasRan = true; Networker.Instance.QueueRandomDiceEffectServerRPC("Twitch chatters:"); yield return (object)new WaitForSeconds(120f); evnt = new HashSet<string>(); hasRan = false; } public static void Test() { Misc.SpawnEnemyForced(GetEnemies.Lasso, 4, true, false); } private static void OnSubHandler(TwitchSubEvent subEvent) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Invalid comparison between Unknown and I4 //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Invalid comparison between Unknown and I4 if (enableSubs.Value) { TwitchUser user = ((TwitchEvent)subEvent).User; string displayName = ((TwitchUser)(ref user)).DisplayName; int num = 0; if ((int)subEvent.Tier == 1) { num = 1; } else if ((int)subEvent.Tier == 2) { num = 2; } else if ((int)subEvent.Tier == 3) { num = 3; } if ((int)subEvent.SubType == 3) { num *= subEvent.GiftCount; } for (int i = 0; i < num; i++) { Networker.Instance.QueueRandomDiceEffectServerRPC("Twitch:" + displayName); } } } private static void OnCheerHandler(TwitchCheerEvent cheerEvent) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) TwitchUser user = ((TwitchEvent)cheerEvent).User; string displayName = ((TwitchUser)(ref user)).DisplayName; if (enableCheer.Value && cheerEvent.CheerAmount >= cheerMin.Value) { int num = cheerEvent.CheerAmount % 10; if (num == cheerAwful.Value) { Networker.Instance.QueueSelectTypeServerRPC((EffectType)0, displayName); } else if (num == cheerGood.Value) { Networker.Instance.QueueSelectTypeServerRPC((EffectType)3, displayName); } else if (num == cheerGreat.Value) { Networker.Instance.QueueSelectTypeServerRPC((EffectType)4, displayName); } else if (num == cheerBad.Value) { Networker.Instance.QueueSelectTypeServerRPC((EffectType)1, displayName); } else if (num == cheerMixed.Value) { Networker.Instance.QueueSelectTypeServerRPC((EffectType)2, displayName); } else { Networker.Instance.QueueRandomDiceEffectServerRPC("Twitch:" + displayName); } } } private static void OnRaidHandler(TwitchRaidEvent raidEvent) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) TwitchUser user = ((TwitchEvent)raidEvent).User; string displayName = ((TwitchUser)(ref user)).DisplayName; if (enableRaid.Value) { int num = raidEvent.ViewerCount / 5; if (num > 5) { num = 5; } for (int i = 0; i < num; i++) { Networker.Instance.QueueRandomDiceEffectServerRPC("Twitch:" + displayName); } } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "DiceTwitchIntegration"; public const string PLUGIN_NAME = "DiceTwitchIntegration"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
DiceWeatherRegistryCompat.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using DiceWeatherRegistryCompat.Effects; using HarmonyLib; using Microsoft.CodeAnalysis; using MysteryDice; using MysteryDice.Dice; using MysteryDice.Effects; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using WeatherRegistry; [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("DiceWeatherRegistryCompat")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Dice Weather Registry Compatibility")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DiceWeatherRegistryCompat")] [assembly: AssemblyTitle("DiceWeatherRegistryCompat")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] internal class <Module> { static <Module>() { } } 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 DiceWeatherRegistryCompat { public class Networker : NetworkBehaviour { public static Networker Instance; public override void OnNetworkSpawn() { Instance = this; MysteryDice.CustomLogger.LogInfo((object)"WeatherReg OnNetworkSpawn"); ((NetworkBehaviour)this).OnNetworkSpawn(); if (!((NetworkBehaviour)this).IsServer) { } } [ServerRpc(RequireOwnership = false)] public void SetWeatherServerRpc(string weather) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3171511287u, val, (RpcDelivery)0); bool flag = weather != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(weather, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3171511287u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { string weather2 = weather; WeatherController.ChangeCurrentWeather(WeatherManager.Weathers.Find((Weather x) => ((Object)x).name == weather2)); } } [ServerRpc(RequireOwnership = false)] public void AddWeatherServerRpc(string weather) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2812204045u, val, (RpcDelivery)0); bool flag = weather != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(weather, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2812204045u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { string weather2 = weather; WeatherController.AddWeatherEffect(WeatherManager.Weathers.Find((Weather x) => ((Object)x).name == weather2)); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_Networker() { //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 NetworkManager.__rpc_func_table.Add(3171511287u, new RpcReceiveHandler(__rpc_handler_3171511287)); NetworkManager.__rpc_func_table.Add(2812204045u, new RpcReceiveHandler(__rpc_handler_2812204045)); } private static void __rpc_handler_3171511287(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string weatherServerRpc = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref weatherServerRpc, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((Networker)(object)target).SetWeatherServerRpc(weatherServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2812204045(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string weather = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref weather, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((Networker)(object)target).AddWeatherServerRpc(weather); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "Networker"; } } [BepInPlugin("Slayer6409.DiceWeatherRegistryCompat", "DiceWeatherRegistryCompat", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__5_0; public static UnityAction <>9__5_1; internal void <addButtons>b__5_0() { DebugMenuStuff.clearMainViewport(); setWeather(); } internal void <addButtons>b__5_1() { DebugMenuStuff.clearMainViewport(); AddWeather(); } } public static AssetBundle LoadedAssets; public static GameObject NetworkerPrefab; private readonly Harmony harmony = new Harmony("Slayer6409.DiceWeatherRegistryCompat"); private void Awake() { if (!Chainloader.PluginInfos.ContainsKey("mrov.WeatherRegistry")) { MysteryDice.CustomLogger.LogInfo((object)"WeatherRegistry not found disabling WeatherRegistry Compatability"); return; } LoadedAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "mysterydiceweatherregcompat")); NetworkerPrefab = LoadedAssets.LoadAsset<GameObject>("Networker"); NetworkerPrefab.AddComponent<Networker>(); DebugMenuStuff.OnDebugMenuOpen += debugMenuOpened; DieBehaviour.SteveNames.Add(new AddWeather().Name); MysteryDice.RegisterNewEffect((IEffect)(object)new AddWeather(), false, false); DieBehaviour.SteveNames.Add(new ClearWeather().Name); MysteryDice.RegisterNewEffect((IEffect)(object)new ClearWeather(), false, false); DieBehaviour.SteveNames.Add(new RandomWeather().Name); MysteryDice.RegisterNewEffect((IEffect)(object)new RandomWeather(), false, false); NetcodeWeaver(); harmony.PatchAll(); } private void debugMenuOpened() { DebugMenuStuff.OnSpecialFunctionsAdded += addButtons; } private void addButtons(Transform scrollContent) { //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_0057: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown GameObject val = Object.Instantiate<GameObject>(MysteryDice.DebugSubButtonPrefab, scrollContent); TMP_Text component = ((Component)val.transform.GetChild(0)).GetComponent<TMP_Text>(); component.text = "Set Weather"; Button component2 = val.GetComponent<Button>(); ButtonClickedEvent onClick = component2.onClick; object obj = <>c.<>9__5_0; if (obj == null) { UnityAction val2 = delegate { DebugMenuStuff.clearMainViewport(); setWeather(); }; <>c.<>9__5_0 = val2; obj = (object)val2; } ((UnityEvent)onClick).AddListener((UnityAction)obj); GameObject val3 = Object.Instantiate<GameObject>(MysteryDice.DebugSubButtonPrefab, scrollContent); TMP_Text component3 = ((Component)val3.transform.GetChild(0)).GetComponent<TMP_Text>(); component3.text = "Add Weather"; Button component4 = val3.GetComponent<Button>(); ButtonClickedEvent onClick2 = component4.onClick; object obj2 = <>c.<>9__5_1; if (obj2 == null) { UnityAction val4 = delegate { DebugMenuStuff.clearMainViewport(); AddWeather(); }; <>c.<>9__5_1 = val4; obj2 = (object)val4; } ((UnityEvent)onClick2).AddListener((UnityAction)obj2); } public static void AddWeather() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown List<string> weathers = WeatherRegistryCompat.getWeathers(); foreach (string weather in weathers) { GameObject val = Object.Instantiate<GameObject>(MysteryDice.DebugMenuButtonPrefab, DebugMenuStuff.mainScrollContent); TMP_Text component = ((Component)val.transform.GetChild(0)).GetComponent<TMP_Text>(); component.text = weather; Button component2 = val.GetComponent<Button>(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { Networker.Instance.AddWeatherServerRpc(weather); DebugMenuStuff.CloseSelectMenu(false); }); } } public static void setWeather() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown List<string> weathers = WeatherRegistryCompat.getWeathers(); foreach (string weather in weathers) { GameObject val = Object.Instantiate<GameObject>(MysteryDice.DebugMenuButtonPrefab, DebugMenuStuff.mainScrollContent); TMP_Text component = ((Component)val.transform.GetChild(0)).GetComponent<TMP_Text>(); component.text = weather; Button component2 = val.GetComponent<Button>(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { Networker.Instance.SetWeatherServerRpc(weather); DebugMenuStuff.CloseSelectMenu(false); }); } } private static void NetcodeWeaver() { try { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } catch (Exception ex) { Debug.Log((object)ex); } } } public class WeatherRegistryCompat : MonoBehaviour { public static List<string> getWeathers() { List<string> list = new List<string>(); foreach (Weather weather in WeatherManager.Weathers) { list.Add(((Object)weather).name); } return list; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "DiceWeatherRegistryCompat"; public const string PLUGIN_NAME = "DiceWeatherRegistryCompat"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace DiceWeatherRegistryCompat.Patches { [HarmonyPatch(typeof(GameNetworkManager))] public class GameNetworkManagerPatch { [HarmonyPostfix] [HarmonyPatch("Start")] public static void AddPrefab(ref GameNetworkManager __instance) { ((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(Plugin.NetworkerPrefab); } } [HarmonyPatch(typeof(StartOfRound))] public class StartOfRoundPatch { [HarmonyPostfix] [HarmonyPatch("Start")] public static void InstantiateNetworker(StartOfRound __instance) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { GameObject val = Object.Instantiate<GameObject>(Plugin.NetworkerPrefab, Vector3.zero, Quaternion.identity); val.GetComponent<NetworkObject>().Spawn(true); } } } } namespace DiceWeatherRegistryCompat.Effects { public class AddWeather : IEffect { public string Name => "Add Weather"; public EffectType Outcome => (EffectType)0; public bool ShowDefaultTooltip => false; public string Tooltip => "Adds a weather to the day"; public void Use() { List<string> list = WeatherRegistryCompat.getWeathers().ToList(); Networker.Instance.AddWeatherServerRpc(list[Random.Range(0, list.Count)]); } } internal class ClearWeather : IEffect { public string Name => "Clear Weather"; public EffectType Outcome => (EffectType)4; public bool ShowDefaultTooltip => false; public string Tooltip => "Sunshiny Day"; public void Use() { Networker.Instance.SetWeatherServerRpc("None"); } } internal class RandomWeather : IEffect { public string Name => "Random Weather"; public EffectType Outcome => (EffectType)1; public bool ShowDefaultTooltip => false; public string Tooltip => "New weather time!"; public void Use() { List<string> list = WeatherRegistryCompat.getWeathers().ToList(); Networker.Instance.SetWeatherServerRpc(list[Random.Range(0, list.Count)]); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
MysteryDice.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BombCollar; using CodeRebirth.src; using CodeRebirth.src.Content.Enemies; using CodeRebirth.src.Content.Maps; using CodeRebirthLib; using CodeRebirthLib.ContentManagement.Enemies; using CodeRebirthLib.ContentManagement.MapObjects; using DiversityRemastered; using DiversityRemastered.Misc; using GameNetcodeStuff; using HarmonyLib; using JetBrains.Annotations; using KaimiraGames; using LethalCompanyInputUtils.Api; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalLib.Modules; using Microsoft.CodeAnalysis; using MoreCompany.Cosmetics; using MysteryDice; using MysteryDice.CompatThings; using MysteryDice.Dice; using MysteryDice.Effects; using MysteryDice.Extensions; using MysteryDice.Patches; using MysteryDice.Visual; using Newtonsoft.Json; using PathfindingLib.Jobs; using PathfindingLib.Utilities; using Surfaced; using TMPro; using TooManyEmotes; using TooManyEmotes.Props; using TooManyEmotes.UI; using Unity.Jobs; using Unity.Mathematics; using Unity.Netcode; using Unity.Netcode.Components; using UnityEngine; using UnityEngine.AI; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Experimental.AI; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("CodeRebirth")] [assembly: IgnoresAccessChecksTo("Surfaced")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class TargetRandomPlayer : MonoBehaviour { private NavMeshAgent agent; private PlayerControllerB target; public void Start() { agent = ((Component)this).gameObject.GetComponent<NavMeshAgent>(); target = Misc.GetRandomAlivePlayer(); } public void Update() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null || target.isPlayerDead) { target = Misc.GetRandomAlivePlayer(); } agent.SetDestination(((Component)target).transform.position); } } public class FindPathThroughTeleportsOperation : PathfindingOperation { private EntranceTeleport[] entranceTeleports; private PooledFindPathJob[] FindDestinationJobs; private PooledFindPathJob? FindDirectPathToDestinationJob; private PooledFindPathJob[] FindEntrancePointJobs; public FindPathThroughTeleportsOperation(IEnumerable<EntranceTeleport> entrancePoints, Vector3 startPos, Vector3 endPos, NavMeshAgent agent) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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) FindDirectPathToDestinationJob = JobPools.GetFindPathJob(); ((FindPathJob)(ref FindDirectPathToDestinationJob.Job)).Initialize(startPos, endPos, agent); JobHandle val = IJobExtensions.ScheduleByRef<FindPathJob>(ref FindDirectPathToDestinationJob.Job, default(JobHandle)); entranceTeleports = entrancePoints.ToArray(); FindEntrancePointJobs = (PooledFindPathJob[])(object)new PooledFindPathJob[entranceTeleports.Length]; FindDestinationJobs = (PooledFindPathJob[])(object)new PooledFindPathJob[entranceTeleports.Length]; for (int i = 0; i < entranceTeleports.Length; i++) { EntranceTeleport val2 = entranceTeleports[i]; if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.exitPoint == (Object)null) && !((Object)(object)val2.entrancePoint == (Object)null)) { PooledFindPathJob findPathJob = JobPools.GetFindPathJob(); PooledFindPathJob findPathJob2 = JobPools.GetFindPathJob(); ((FindPathJob)(ref findPathJob.Job)).Initialize(startPos, val2.entrancePoint.position, agent); ((FindPathJob)(ref findPathJob2.Job)).Initialize(val2.exitPoint.position, endPos, agent); val = IJobExtensions.ScheduleByRef<FindPathJob>(ref findPathJob.Job, val); val = IJobExtensions.ScheduleByRef<FindPathJob>(ref findPathJob2.Job, val); FindEntrancePointJobs[i] = findPathJob; FindDestinationJobs[i] = findPathJob2; } } } public override void Dispose() { if (FindDirectPathToDestinationJob != null) { JobPools.ReleaseFindPathJob(FindDirectPathToDestinationJob); FindDirectPathToDestinationJob = null; } PooledFindPathJob[] findEntrancePointJobs = FindEntrancePointJobs; foreach (PooledFindPathJob val in findEntrancePointJobs) { if (val != null) { JobPools.ReleaseFindPathJob(val); } } PooledFindPathJob[] findDestinationJobs = FindDestinationJobs; foreach (PooledFindPathJob val2 in findDestinationJobs) { if (val2 != null) { JobPools.ReleaseFindPathJob(val2); } } entranceTeleports = Array.Empty<EntranceTeleport>(); FindEntrancePointJobs = Array.Empty<PooledFindPathJob>(); FindDestinationJobs = Array.Empty<PooledFindPathJob>(); } public bool TryGetShortestPath(out bool foundPath, out float totalDistance, out EntranceTeleport? entranceTeleport) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Invalid comparison between Unknown and I4 //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Invalid comparison between Unknown and I4 //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Invalid comparison between Unknown and I4 //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Invalid comparison between Unknown and I4 totalDistance = -1f; float num = float.MaxValue; foundPath = false; entranceTeleport = null; if (FindDirectPathToDestinationJob == null) { return false; } PathQueryStatus result = PathQueryStatusExtensions.GetResult(((FindPathJob)(ref FindDirectPathToDestinationJob.Job)).GetStatus()); if ((int)result == 536870912) { return false; } if ((int)result == 1073741824) { num = ((FindPathJob)(ref FindDirectPathToDestinationJob.Job)).GetPathLength(); foundPath = true; } for (int i = 0; i < FindEntrancePointJobs.Length; i++) { if ((Object)(object)entranceTeleports[i] == (Object)null || FindEntrancePointJobs[i] == null || FindDestinationJobs[i] == null) { continue; } PathQueryStatus result2 = PathQueryStatusExtensions.GetResult(((FindPathJob)(ref FindEntrancePointJobs[i].Job)).GetStatus()); PathQueryStatus result3 = PathQueryStatusExtensions.GetResult(((FindPathJob)(ref FindDestinationJobs[i].Job)).GetStatus()); if ((int)result2 == 536870912) { return false; } if ((int)result3 == 536870912) { return false; } if ((int)result2 != int.MinValue && (int)result3 != int.MinValue) { float pathLength = ((FindPathJob)(ref FindEntrancePointJobs[i].Job)).GetPathLength(); float pathLength2 = ((FindPathJob)(ref FindDestinationJobs[i].Job)).GetPathLength(); float num2 = pathLength2 + pathLength; if (num2 < num) { entranceTeleport = entranceTeleports[i]; num = num2; foundPath = true; } } } Dispose(); totalDistance = num; return true; } public override bool HasDisposed() { return FindDirectPathToDestinationJob == null; } } public abstract class PathfindingOperation : IDisposable { public abstract void Dispose(); public abstract bool HasDisposed(); ~PathfindingOperation() { Dispose(); } } public class Blinking : MonoBehaviour { public float BlinkingTime; private float BlinkingTimer = 0f; private GameObject GlowSign; private GameObject NormalSign; private bool Stop = false; public bool Glow { get; private set; } private void Start() { BlinkingTime = 0.5f; Glow = false; NormalSign = ((Component)((Component)this).transform.Find("Emergency Sign")).gameObject; GlowSign = ((Component)((Component)this).transform.Find("Emergency Sign Glowing")).gameObject; } public void HideSigns() { Stop = true; NormalSign.SetActive(false); GlowSign.SetActive(false); } private void Update() { if (Stop) { return; } BlinkingTimer -= Time.deltaTime; if (BlinkingTimer <= 0f) { BlinkingTimer = BlinkingTime; if (Glow) { Glow = false; NormalSign.SetActive(true); GlowSign.SetActive(false); } else { Glow = true; NormalSign.SetActive(false); GlowSign.SetActive(true); } } } } public class ColorGradient : MonoBehaviour { public Renderer CubeRenderer; public Renderer MoonRenderer; public Renderer SunRenderer; public Color NightColor = new Color(0.40392157f, 33f / 85f, 0.8862745f); public Color DayColor = new Color(1f, 0.81960785f, 0f); private float ColorTimer = 0f; private void Start() { CubeRenderer = ((Component)this).GetComponent<Renderer>(); SunRenderer = ((Component)((Component)this).transform.Find("Sun")).GetComponent<Renderer>(); MoonRenderer = ((Component)((Component)this).transform.Find("Moon")).GetComponent<Renderer>(); } private void Update() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //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_00ce: 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) //IL_0124: 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_017a: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) ColorTimer -= Time.deltaTime; if (!(ColorTimer >= 0f)) { ColorTimer = 1f; Color val = DayColor + (NightColor - DayColor) * TimeOfDay.Instance.normalizedTimeOfDay; CubeRenderer.material.SetColor("_BaseColor", val); CubeRenderer.material.SetColor("_EmissiveColor", val * 3f); float normalizedTimeOfDay = TimeOfDay.Instance.normalizedTimeOfDay; float num = 1f - normalizedTimeOfDay; MoonRenderer.material.SetColor("_BaseColor", new Color(1f, 1f, 1f, normalizedTimeOfDay)); SunRenderer.material.SetColor("_BaseColor", new Color(1f, 1f, 1f, num)); MoonRenderer.material.SetColor("_UnlitColor", new Color(1f, 1f, 1f, normalizedTimeOfDay)); SunRenderer.material.SetColor("_UnlitColor", new Color(1f, 1f, 1f, num)); MoonRenderer.material.SetColor("_MainColor", new Color(1f, 1f, 1f, normalizedTimeOfDay)); SunRenderer.material.SetColor("_MainColor", new Color(1f, 1f, 1f, num)); } } } public class CycleSigns : MonoBehaviour { private class DiceVisuals { public Sprite Sprite; public Color ModelColor; public Color EmissionColor; public float Emission; public DiceVisuals(Sprite sprite, Color color, Color emissionColor, float emission) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Sprite = sprite; ModelColor = color; EmissionColor = emissionColor; Emission = emission; } } public float CycleTime = 1f; private float CurrentTimer = 0f; private int CurrentSprite = 0; private bool Stop = false; private SpriteRenderer SignSpriteRenderer; private SpriteRenderer SignSpriteRenderer2; private Renderer DiceRenderer; private List<DiceVisuals> Visuals = new List<DiceVisuals>(); private void Start() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) Visuals.Add(new DiceVisuals(global::MysteryDice.MysteryDice.WarningJester, Color.yellow, Color.yellow, 100f)); Visuals.Add(new DiceVisuals(global::MysteryDice.MysteryDice.WarningBracken, Color.yellow, Color.yellow, 100f)); Visuals.Add(new DiceVisuals(global::MysteryDice.MysteryDice.WarningDeath, Color.red, Color.red, 100f)); Visuals.Add(new DiceVisuals(global::MysteryDice.MysteryDice.WarningLuck, Color.green, Color.green, 300f)); SignSpriteRenderer = ((Component)((Component)this).transform.Find("Emergency Sign")).gameObject.GetComponent<SpriteRenderer>(); SignSpriteRenderer2 = ((Component)((Component)this).transform.Find("Emergency Sign2")).gameObject.GetComponent<SpriteRenderer>(); DiceRenderer = ((Component)this).gameObject.GetComponent<Renderer>(); } private void Update() { if (!Stop) { CurrentTimer -= Time.deltaTime; if (CurrentTimer <= 0f) { CurrentTimer = CycleTime; CycleSprite(); } } } private void CycleSprite() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) CurrentSprite++; if (CurrentSprite >= Visuals.Count) { CurrentSprite = 0; } SignSpriteRenderer.sprite = Visuals[CurrentSprite].Sprite; SignSpriteRenderer2.sprite = Visuals[CurrentSprite].Sprite; DiceRenderer.material.SetColor("_BaseColor", Visuals[CurrentSprite].ModelColor); DiceRenderer.material.SetColor("_EmissiveColor", Visuals[CurrentSprite].EmissionColor * Visuals[CurrentSprite].Emission); } public void HideSigns() { Stop = true; ((Renderer)((Component)SignSpriteRenderer).GetComponent<SpriteRenderer>()).enabled = false; ((Renderer)((Component)SignSpriteRenderer2).GetComponent<SpriteRenderer>()).enabled = false; } } namespace KaimiraGames { public class WeightedList<T> : IEnumerable<T>, IEnumerable { private readonly List<T> _list = new List<T>(); private readonly List<int> _weights = new List<int>(); private readonly List<int> _probabilities = new List<int>(); private readonly List<int> _alias = new List<int>(); private readonly Random _rand; private int _totalWeight; private bool _areAllProbabilitiesIdentical = false; private int _minWeight; private int _maxWeight; public WeightErrorHandlingType BadWeightErrorHandling { get; set; } = WeightErrorHandlingType.SetWeightToOne; public int TotalWeight => _totalWeight; public int MinWeight => _minWeight; public int MaxWeight => _maxWeight; public IReadOnlyList<T> Items => _list.AsReadOnly(); public T this[int index] => _list[index]; public int Count => _list.Count; public WeightedList(Random rand = null) { _rand = rand ?? new Random(); } public WeightedList(ICollection<WeightedListItem<T>> listItems, Random rand = null) { _rand = rand ?? new Random(); foreach (WeightedListItem<T> listItem in listItems) { _list.Add(listItem._item); _weights.Add(listItem._weight); } Recalculate(); } public T Next() { if (Count == 0) { return default(T); } int index = _rand.Next(Count); if (_areAllProbabilitiesIdentical) { return _list[index]; } int num = _rand.Next(_totalWeight); return (num < _probabilities[index]) ? _list[index] : _list[_alias[index]]; } public void AddWeightToAll(int weight) { if (weight + _minWeight <= 0 && BadWeightErrorHandling == WeightErrorHandlingType.ThrowExceptionOnAdd) { throw new ArgumentException($"Subtracting {-1 * weight} from all items would set weight to non-positive for at least one element."); } for (int i = 0; i < Count; i++) { _weights[i] = FixWeight(_weights[i] + weight); } Recalculate(); } public void SubtractWeightFromAll(int weight) { AddWeightToAll(weight * -1); } public void SetWeightOfAll(int weight) { if (weight <= 0 && BadWeightErrorHandling == WeightErrorHandlingType.ThrowExceptionOnAdd) { throw new ArgumentException("Weight cannot be non-positive."); } for (int i = 0; i < Count; i++) { _weights[i] = FixWeight(weight); } Recalculate(); } public IEnumerator<T> GetEnumerator() { return _list.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return _list.GetEnumerator(); } public void Add(T item, int weight) { _list.Add(item); _weights.Add(FixWeight(weight)); Recalculate(); } public void Add(ICollection<WeightedListItem<T>> listItems) { foreach (WeightedListItem<T> listItem in listItems) { _list.Add(listItem._item); _weights.Add(FixWeight(listItem._weight)); } Recalculate(); } public void Clear() { _list.Clear(); _weights.Clear(); Recalculate(); } public void Contains(T item) { _list.Contains(item); } public int IndexOf(T item) { return _list.IndexOf(item); } public void Insert(int index, T item, int weight) { _list.Insert(index, item); _weights.Insert(index, FixWeight(weight)); Recalculate(); } public void Remove(T item) { int index = IndexOf(item); RemoveAt(index); Recalculate(); } public void RemoveAt(int index) { _list.RemoveAt(index); _weights.RemoveAt(index); Recalculate(); } public void SetWeight(T item, int newWeight) { SetWeightAtIndex(IndexOf(item), FixWeight(newWeight)); } public int GetWeightOf(T item) { return GetWeightAtIndex(IndexOf(item)); } public void SetWeightAtIndex(int index, int newWeight) { _weights[index] = FixWeight(newWeight); Recalculate(); } public int GetWeightAtIndex(int index) { return _weights[index]; } public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("WeightedList<"); stringBuilder.Append(typeof(T).Name); stringBuilder.Append(">: TotalWeight:"); stringBuilder.Append(TotalWeight); stringBuilder.Append(", Min:"); stringBuilder.Append(_minWeight); stringBuilder.Append(", Max:"); stringBuilder.Append(_maxWeight); stringBuilder.Append(", Count:"); stringBuilder.Append(Count); stringBuilder.Append(", {"); for (int i = 0; i < _list.Count; i++) { stringBuilder.Append(_list[i].ToString()); stringBuilder.Append(":"); stringBuilder.Append(_weights[i].ToString()); if (i < _list.Count - 1) { stringBuilder.Append(", "); } } stringBuilder.Append("}"); return stringBuilder.ToString(); } private void Recalculate() { _totalWeight = 0; _areAllProbabilitiesIdentical = false; _minWeight = 0; _maxWeight = 0; bool flag = true; _alias.Clear(); _probabilities.Clear(); List<int> list = new List<int>(Count); List<int> list2 = new List<int>(Count); List<int> list3 = new List<int>(Count); foreach (int weight in _weights) { if (flag) { _minWeight = (_maxWeight = weight); flag = false; } _minWeight = ((weight < _minWeight) ? weight : _minWeight); _maxWeight = ((_maxWeight < weight) ? weight : _maxWeight); _totalWeight += weight; list.Add(weight * Count); _alias.Add(0); _probabilities.Add(0); } if (_minWeight == _maxWeight) { _areAllProbabilitiesIdentical = true; return; } for (int i = 0; i < Count; i++) { if (list[i] < _totalWeight) { list2.Add(i); } else { list3.Add(i); } } while (list2.Count > 0 && list3.Count > 0) { int index = list2[list2.Count - 1]; list2.RemoveAt(list2.Count - 1); int num = list3[list3.Count - 1]; list3.RemoveAt(list3.Count - 1); _probabilities[index] = list[index]; _alias[index] = num; int num3 = (list[num] = list[num] + list[index] - _totalWeight); if (num3 < _totalWeight) { list2.Add(num); } else { list3.Add(num); } } while (list3.Count > 0) { int index2 = list3[list3.Count - 1]; list3.RemoveAt(list3.Count - 1); _probabilities[index2] = _totalWeight; } } internal static int FixWeightSetToOne(int weight) { return (weight <= 0) ? 1 : weight; } internal static int FixWeightExceptionOnAdd(int weight) { if (weight > 0) { return weight; } throw new ArgumentException("Weight cannot be non-positive"); } private int FixWeight(int weight) { return (BadWeightErrorHandling == WeightErrorHandlingType.ThrowExceptionOnAdd) ? FixWeightExceptionOnAdd(weight) : FixWeightSetToOne(weight); } } public readonly struct WeightedListItem<T> { internal readonly T _item; internal readonly int _weight; public WeightedListItem(T item, int weight) { _item = item; _weight = weight; } } public enum WeightErrorHandlingType { SetWeightToOne, ThrowExceptionOnAdd } } namespace MysteryDice { internal class ConfigManager { public static void addConfig(ConfigEntry<bool> config) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(config, true); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val); } public static void setupLethalConfig() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0028: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0050: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0078: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_00a0: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00c8: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_00f1: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown //IL_011a: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown //IL_013c: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown //IL_015e: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_0180: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //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_0193: Expected O, but got Unknown //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_01a2: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Expected O, but got Unknown //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_01c4: Expected O, but got Unknown //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Expected O, but got Unknown //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Expected O, but got Unknown //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown //IL_01e6: Expected O, but got Unknown //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Expected O, but got Unknown //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Expected O, but got Unknown //IL_0208: Expected O, but got Unknown //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Expected O, but got Unknown //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Expected O, but got Unknown //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Expected O, but got Unknown //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Expected O, but got Unknown //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Expected O, but got Unknown //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Expected O, but got Unknown //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Expected O, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Expected O, but got Unknown //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Expected O, but got Unknown //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Expected O, but got Unknown //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Expected O, but got Unknown //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Expected O, but got Unknown //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Expected O, but got Unknown //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Expected O, but got Unknown //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Expected O, but got Unknown //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Expected O, but got Unknown //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Expected O, but got Unknown //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Expected O, but got Unknown //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Expected O, but got Unknown //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Expected O, but got Unknown //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Expected O, but got Unknown //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Expected O, but got Unknown //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Expected O, but got Unknown //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Expected O, but got Unknown //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Expected O, but got Unknown //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Expected O, but got Unknown //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Expected O, but got Unknown //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Expected O, but got Unknown //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Expected O, but got Unknown //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Expected O, but got Unknown //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Expected O, but got Unknown //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Expected O, but got Unknown //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Expected O, but got Unknown //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Expected O, but got Unknown //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Expected O, but got Unknown //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Expected O, but got Unknown //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Expected O, but got Unknown //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Expected O, but got Unknown //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Expected O, but got Unknown //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Expected O, but got Unknown //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Expected O, but got Unknown //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Expected O, but got Unknown //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Expected O, but got Unknown //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Expected O, but got Unknown //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Expected O, but got Unknown //IL_062f: Unknown result type (might be due to invalid IL or missing references) //IL_0636: Expected O, but got Unknown //IL_065b: Unknown result type (might be due to invalid IL or missing references) //IL_0662: Expected O, but got Unknown ConfigEntry<float> minHyperShake = MysteryDice.minHyperShake; FloatSliderOptions val = new FloatSliderOptions(); ((BaseRangeOptions<float>)val).Min = 0f; ((BaseRangeOptions<float>)val).Max = 100f; FloatSliderConfigItem val2 = new FloatSliderConfigItem(minHyperShake, val); ConfigEntry<float> maxHyperShake = MysteryDice.maxHyperShake; FloatSliderOptions val3 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val3).Min = 0f; ((BaseRangeOptions<float>)val3).Max = 100f; FloatSliderConfigItem val4 = new FloatSliderConfigItem(maxHyperShake, val3); ConfigEntry<float> minNeckSpin = MysteryDice.minNeckSpin; FloatSliderOptions val5 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val5).Min = 0f; ((BaseRangeOptions<float>)val5).Max = 100f; FloatSliderConfigItem val6 = new FloatSliderConfigItem(minNeckSpin, val5); ConfigEntry<float> rotationSpeedModifier = MysteryDice.rotationSpeedModifier; FloatSliderOptions val7 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val7).Min = 0f; ((BaseRangeOptions<float>)val7).Max = 100f; FloatSliderConfigItem val8 = new FloatSliderConfigItem(rotationSpeedModifier, val7); ConfigEntry<float> maxNeckSpin = MysteryDice.maxNeckSpin; FloatSliderOptions val9 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val9).Min = 0f; ((BaseRangeOptions<float>)val9).Max = 100f; FloatSliderConfigItem val10 = new FloatSliderConfigItem(maxNeckSpin, val9); ConfigEntry<float> eggExplodeTime = MysteryDice.eggExplodeTime; FloatSliderOptions val11 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val11).Min = 0f; ((BaseRangeOptions<float>)val11).Max = 5f; FloatSliderConfigItem val12 = new FloatSliderConfigItem(eggExplodeTime, val11); ConfigEntry<float> soundVolume = MysteryDice.SoundVolume; FloatSliderOptions val13 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val13).Min = 0f; ((BaseRangeOptions<float>)val13).Max = 1f; FloatSliderConfigItem val14 = new FloatSliderConfigItem(soundVolume, val13); ConfigEntry<int> minNeckBreakTimer = MysteryDice.minNeckBreakTimer; IntSliderOptions val15 = new IntSliderOptions(); ((BaseRangeOptions<int>)val15).Min = 0; ((BaseRangeOptions<int>)val15).Max = 100; IntSliderConfigItem val16 = new IntSliderConfigItem(minNeckBreakTimer, val15); ConfigEntry<int> maxNeckBreakTimer = MysteryDice.maxNeckBreakTimer; IntSliderOptions val17 = new IntSliderOptions(); ((BaseRangeOptions<int>)val17).Min = 0; ((BaseRangeOptions<int>)val17).Max = 100; IntSliderConfigItem val18 = new IntSliderConfigItem(maxNeckBreakTimer, val17); ConfigEntry<int> debugButtonAlpha = MysteryDice.DebugButtonAlpha; IntSliderOptions val19 = new IntSliderOptions(); ((BaseRangeOptions<int>)val19).Min = 0; ((BaseRangeOptions<int>)val19).Max = 100; IntSliderConfigItem val20 = new IntSliderConfigItem(debugButtonAlpha, val19); ConfigEntry<int> debugMenuAccentAlpha = MysteryDice.DebugMenuAccentAlpha; IntSliderOptions val21 = new IntSliderOptions(); ((BaseRangeOptions<int>)val21).Min = 0; ((BaseRangeOptions<int>)val21).Max = 100; IntSliderConfigItem val22 = new IntSliderConfigItem(debugMenuAccentAlpha, val21); ConfigEntry<int> debugMenuBackgroundAlpha = MysteryDice.DebugMenuBackgroundAlpha; IntSliderOptions val23 = new IntSliderOptions(); ((BaseRangeOptions<int>)val23).Min = 0; ((BaseRangeOptions<int>)val23).Max = 100; IntSliderConfigItem val24 = new IntSliderConfigItem(debugMenuBackgroundAlpha, val23); ConfigEntry<int> debugMenuTextAlpha = MysteryDice.DebugMenuTextAlpha; IntSliderOptions val25 = new IntSliderOptions(); ((BaseRangeOptions<int>)val25).Min = 0; ((BaseRangeOptions<int>)val25).Max = 100; IntSliderConfigItem val26 = new IntSliderConfigItem(debugMenuTextAlpha, val25); ConfigEntry<int> debugMenuFavoriteTextAlpha = MysteryDice.DebugMenuFavoriteTextAlpha; IntSliderOptions val27 = new IntSliderOptions(); ((BaseRangeOptions<int>)val27).Min = 0; ((BaseRangeOptions<int>)val27).Max = 100; IntSliderConfigItem val28 = new IntSliderConfigItem(debugMenuFavoriteTextAlpha, val27); IntInputFieldConfigItem val29 = new IntInputFieldConfigItem(MysteryDice.EmergencyDiePrice, true); IntInputFieldConfigItem val30 = new IntInputFieldConfigItem(MysteryDice.brutalStartingScale, false); IntInputFieldConfigItem val31 = new IntInputFieldConfigItem(MysteryDice.brutalMaxScale, false); IntInputFieldConfigItem val32 = new IntInputFieldConfigItem(MysteryDice.brutalScaleType, false); BoolCheckBoxConfigItem val33 = new BoolCheckBoxConfigItem(MysteryDice.DieEmergencyAsScrap, true); IntInputFieldConfigItem val34 = new IntInputFieldConfigItem(BlameGlitch.minNum, false); IntInputFieldConfigItem val35 = new IntInputFieldConfigItem(BlameGlitch.maxNum, false); IntInputFieldConfigItem val36 = new IntInputFieldConfigItem(MysteryDice.hyperShakeTimer, false); IntInputFieldConfigItem val37 = new IntInputFieldConfigItem(MysteryDice.neckRotations, false); TextInputFieldConfigItem val38 = new TextInputFieldConfigItem(MysteryDice.DisplayResults); TextInputFieldConfigItem val39 = new TextInputFieldConfigItem(MysteryDice.debugChat); BoolCheckBoxConfigItem val40 = new BoolCheckBoxConfigItem(BlameGlitch.isInside, false); BoolCheckBoxConfigItem val41 = new BoolCheckBoxConfigItem(BlameGlitch.bothInsideOutside, false); BoolCheckBoxConfigItem val42 = new BoolCheckBoxConfigItem(MysteryDice.pussyMode, false); BoolCheckBoxConfigItem val43 = new BoolCheckBoxConfigItem(MysteryDice.DebugLogging, false); BoolCheckBoxConfigItem val44 = new BoolCheckBoxConfigItem(MysteryDice.randomSpinTime, true); BoolCheckBoxConfigItem val45 = new BoolCheckBoxConfigItem(MysteryDice.chronosUpdatedTimeOfDay, false); BoolCheckBoxConfigItem val46 = new BoolCheckBoxConfigItem(MysteryDice.useDiceOutside, false); BoolCheckBoxConfigItem val47 = new BoolCheckBoxConfigItem(MysteryDice.debugDice, false); BoolCheckBoxConfigItem val48 = new BoolCheckBoxConfigItem(MysteryDice.TwitchEnabled, true); BoolCheckBoxConfigItem val49 = new BoolCheckBoxConfigItem(MysteryDice.CopyrightFree, false); BoolCheckBoxConfigItem val50 = new BoolCheckBoxConfigItem(MysteryDice.allowChatCommands, true); BoolCheckBoxConfigItem val51 = new BoolCheckBoxConfigItem(MysteryDice.useNeckBreakTimer, false); BoolCheckBoxConfigItem val52 = new BoolCheckBoxConfigItem(MysteryDice.debugMenuShowsAll, false); BoolCheckBoxConfigItem val53 = new BoolCheckBoxConfigItem(MysteryDice.debugButton, true); BoolCheckBoxConfigItem val54 = new BoolCheckBoxConfigItem(MysteryDice.BetterDebugMenu, false); BoolCheckBoxConfigItem val55 = new BoolCheckBoxConfigItem(MysteryDice.Bald, false); BoolCheckBoxConfigItem val56 = new BoolCheckBoxConfigItem(MysteryDice.LockDebugUI, false); BoolCheckBoxConfigItem val57 = new BoolCheckBoxConfigItem(BlameGlitch.GlitchedMeteorShower, false); BoolCheckBoxConfigItem val58 = new BoolCheckBoxConfigItem(AlarmCurse.fireAlarm, false); BoolCheckBoxConfigItem val59 = new BoolCheckBoxConfigItem(AlarmCurse.HorribleVersion, false); BoolCheckBoxConfigItem val60 = new BoolCheckBoxConfigItem(MysteryDice.doDiceExplosion, false); BoolCheckBoxConfigItem val61 = new BoolCheckBoxConfigItem(MysteryDice.LoversOnStart, false); BoolCheckBoxConfigItem val62 = new BoolCheckBoxConfigItem(MysteryDice.insideJoke, false); BoolCheckBoxConfigItem val63 = new BoolCheckBoxConfigItem(MysteryDice.DebugMenuClosesAfter, false); BoolCheckBoxConfigItem val64 = new BoolCheckBoxConfigItem(MysteryDice.BrutalMode, false); BoolCheckBoxConfigItem val65 = new BoolCheckBoxConfigItem(MysteryDice.BrutalChat, false); BoolCheckBoxConfigItem val66 = new BoolCheckBoxConfigItem(MysteryDice.debugSpawnOnPlayer, false); BoolCheckBoxConfigItem val67 = new BoolCheckBoxConfigItem(MysteryDice.SuperBrutalMode, false); BoolCheckBoxConfigItem val68 = new BoolCheckBoxConfigItem(MysteryDice.yippeeUse, false); HexColorInputFieldConfigItem val69 = new HexColorInputFieldConfigItem(MysteryDice.DebugMenuTextColor, false); HexColorInputFieldConfigItem val70 = new HexColorInputFieldConfigItem(MysteryDice.DebugMenuFavoriteTextColor, false); HexColorInputFieldConfigItem val71 = new HexColorInputFieldConfigItem(MysteryDice.DebugMenuBackgroundColor, false); HexColorInputFieldConfigItem val72 = new HexColorInputFieldConfigItem(MysteryDice.DebugMenuAccentColor, false); HexColorInputFieldConfigItem val73 = new HexColorInputFieldConfigItem(MysteryDice.DebugButtonColor, false); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val47); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val46); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val64); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val65); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val67); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val30); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val31); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val32); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val69); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val26); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val70); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val28); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val71); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val24); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val72); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val62); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val22); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val73); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val20); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val54); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val45); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val44); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val42); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val51); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val14); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val38); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val49); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val36); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val12); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val63); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val68); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val6); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val10); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val8); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val16); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val18); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val37); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val40); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val41); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val34); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val35); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val52); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val53); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val66); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val39); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val48); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val43); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val55); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val29); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val61); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val33); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val60); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val57); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val58); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val56); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val59); if (MysteryDice.SurfacedPresent) { BoolCheckBoxConfigItem val74 = new BoolCheckBoxConfigItem(Flinger.beybladeMode, false); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val74); } foreach (ConfigEntry<bool> effectConfig in DieBehaviour.effectConfigs) { BoolCheckBoxConfigItem val75 = new BoolCheckBoxConfigItem(effectConfig, true); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val75); } } } internal static class CullFactorySoftCompat { private static readonly bool CullFactoryAvailable; private static readonly MethodInfo RefreshGrabbableMethod; private static readonly MethodInfo RefreshLightMethod; static CullFactorySoftCompat() { if (Chainloader.PluginInfos.TryGetValue("com.fumiko.CullFactory", out var value) && value.Metadata.Version >= new Version(1, 5, 0)) { Type type = Type.GetType("CullFactory.Behaviours.API.DynamicObjectsAPI, CullFactory"); if (type != null) { RefreshGrabbableMethod = type.GetMethod("RefreshGrabbableObjectPosition", BindingFlags.Static | BindingFlags.Public); RefreshLightMethod = type.GetMethod("RefreshLightPosition", BindingFlags.Static | BindingFlags.Public); CullFactoryAvailable = RefreshGrabbableMethod != null && RefreshLightMethod != null; } } } [MethodImpl(MethodImplOptions.NoInlining)] internal static void RefreshGrabbableObjectPosition(GrabbableObject item) { item.EnableItemMeshes(true); if (CullFactoryAvailable) { RefreshGrabbableMethod?.Invoke(null, new object[1] { item }); } } [MethodImpl(MethodImplOptions.NoInlining)] internal static void RefreshLightPosition(Light light) { if (CullFactoryAvailable) { RefreshLightMethod?.Invoke(null, new object[1] { light }); } } } public class IngameKeybinds : LcInputActions { [InputAction("<Keyboard>/numpadMinus", Name = "DebugMenu")] public InputAction DebugMenu { get; set; } = null; [InputAction("<Keyboard>/space", Name = "FlyButton")] public InputAction FlyButton { get; set; } = null; [InputAction("<Keyboard>/ctrl", Name = "FlyDownButton")] public InputAction FlyDownButton { get; set; } = null; } public class Misc { public static Item GetItemByName(string itemName, bool matchCase = true) { StringComparison comparisonType = ((!matchCase) ? StringComparison.OrdinalIgnoreCase : StringComparison.CurrentCulture); foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if (items.itemName.Equals(itemName, comparisonType)) { return items; } } foreach (SpawnableItemWithRarity item in RoundManager.Instance.currentLevel.spawnableScrap) { if (item.spawnableItem.itemName.Equals(itemName, comparisonType)) { return item.spawnableItem; } } return null; } public static void SpawnEnemy(SpawnableEnemyWithRarity enemy, int amount, bool isInside, bool isInvisible = false) { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)Networker.Instance).IsHost) { return; } RoundManager instance = RoundManager.Instance; if (isInside) { if (isInvisible) { for (int i = 0; i < amount; i++) { EnemyVent val = instance.allEnemyVents[Random.Range(0, instance.allEnemyVents.Length)]; GameObject val2 = Object.Instantiate<GameObject>(enemy.enemyType.enemyPrefab, val.floorNode.position, Quaternion.Euler(new Vector3(0f, 0f, 0f))); SetObjectInvisible(val2); val2.GetComponentInChildren<NetworkObject>().Spawn(true); instance.SpawnedEnemies.Add(val2.GetComponent<EnemyAI>()); } } else { for (int j = 0; j < amount; j++) { EnemyVent val3 = instance.allEnemyVents[Random.Range(0, instance.allEnemyVents.Length)]; instance.SpawnEnemyOnServer(val3.floorNode.position, val3.floorNode.eulerAngles.y, instance.currentLevel.Enemies.IndexOf(enemy)); } } } else { for (int k = 0; k < amount; k++) { SpawnOutsideEnemy(enemy); } } } public static void SpawnEnemy(EnemyType enemy, int amount, bool isInside, bool isInvisible = false) { //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_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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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) if (!((NetworkBehaviour)Networker.Instance).IsHost) { return; } RoundManager instance = RoundManager.Instance; Vector3 position = instance.outsideAINodes[Random.Range(0, instance.outsideAINodes.Length)].transform.position; EnemyVent val = instance.allEnemyVents[Random.Range(0, instance.allEnemyVents.Length)]; if (isInside) { position = val.floorNode.position; } for (int i = 0; i < amount; i++) { GameObject val2 = Object.Instantiate<GameObject>(enemy.enemyPrefab, position, Quaternion.Euler(new Vector3(0f, 0f, 0f))); if (isInvisible) { SetObjectInvisible(val2); } val2.GetComponentInChildren<NetworkObject>().Spawn(true); instance.SpawnedEnemies.Add(val2.GetComponent<EnemyAI>()); } } public static bool canDiceYet() { if ((Object)(object)StartOfRound.Instance == (Object)null) { return false; } if (StartOfRound.Instance.inShipPhase || !StartOfRound.Instance.shipHasLanded) { return false; } return true; } public static int playerCount() { int num = 0; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB player in allPlayerScripts) { if (IsPlayerAliveAndControlled(player)) { num++; } } return num; } public static void SetObjectInvisible(GameObject obj) { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = obj.GetComponentsInChildren<Renderer>(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Material[] materials = val.materials; foreach (Material val2 in materials) { val2.shader = Shader.Find("Standard"); val2.SetFloat("_Mode", 3f); val2.SetInt("_SrcBlend", 5); val2.SetInt("_DstBlend", 10); val2.SetInt("_ZWrite", 0); val2.DisableKeyword("_ALPHATEST_ON"); val2.EnableKeyword("_ALPHABLEND_ON"); val2.DisableKeyword("_ALPHAPREMULTIPLY_ON"); val2.renderQueue = 3000; Color color = val2.color; color.a = 0.1f; val2.color = color; } } } public static PlayerControllerB getPlayerBySteamID(ulong steamID) { List<PlayerControllerB> list = new List<PlayerControllerB>(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (IsPlayerReal(val)) { list.Add(val); } } return list.Where((PlayerControllerB x) => x.playerSteamId == steamID).FirstOrDefault(); } public static void SpawnOutsideEnemy(SpawnableEnemyWithRarity enemy) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_007c: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) RoundManager instance = RoundManager.Instance; Random random = new Random(StartOfRound.Instance.randomMapSeed); GameObject[] source = GameObject.FindGameObjectsWithTag("OutsideAINode"); source = source.OrderBy((GameObject x) => Vector3.Distance(x.transform.position, Vector3.zero)).ToArray(); Vector3 position = instance.outsideAINodes[Random.Range(0, instance.outsideAINodes.Length)].transform.position; position = instance.GetRandomNavMeshPositionInBoxPredictable(position, 30f, default(NavMeshHit), random, -1, 1f) + Vector3.up; GameObject val = Object.Instantiate<GameObject>(enemy.enemyType.enemyPrefab, position, Quaternion.Euler(new Vector3(0f, 0f, 0f))); val.GetComponentInChildren<NetworkObject>().Spawn(true); instance.SpawnedEnemies.Add(val.GetComponent<EnemyAI>()); } public static List<GameObject> SpawnEnemy(SpawnableEnemyWithRarity enemy, int amount, bool isInside, bool isInvisible = false, bool returnObject = false) { //IL_0062: 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_007b: Unknown result type (might be due to invalid IL or missing references) List<GameObject> list = new List<GameObject>(); if (!((NetworkBehaviour)Networker.Instance).IsHost) { return list; } RoundManager instance = RoundManager.Instance; if (isInside) { for (int i = 0; i < amount; i++) { EnemyVent val = instance.allEnemyVents[Random.Range(0, instance.allEnemyVents.Length)]; GameObject val2 = Object.Instantiate<GameObject>(enemy.enemyType.enemyPrefab, val.floorNode.position, Quaternion.Euler(new Vector3(0f, 0f, 0f))); if (isInvisible) { SetObjectInvisible(val2); } val2.GetComponentInChildren<NetworkObject>().Spawn(true); instance.SpawnedEnemies.Add(val2.GetComponent<EnemyAI>()); list.Add(val2); } } else { for (int j = 0; j < amount; j++) { list.Add(SpawnOutsideEnemy(enemy, returnObject: true)); } } return list; } public static GameObject SpawnOutsideEnemy(SpawnableEnemyWithRarity enemy, bool returnObject) { //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) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_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) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) List<GameObject> list = new List<GameObject>(); RoundManager instance = RoundManager.Instance; Random random = new Random(StartOfRound.Instance.randomMapSeed); GameObject[] source = GameObject.FindGameObjectsWithTag("OutsideAINode"); source = source.OrderBy((GameObject x) => Vector3.Distance(x.transform.position, Vector3.zero)).ToArray(); Vector3 position = instance.outsideAINodes[Random.Range(0, instance.outsideAINodes.Length)].transform.position; position = instance.GetRandomNavMeshPositionInBoxPredictable(position, 30f, default(NavMeshHit), random, -1, 1f) + Vector3.up; GameObject val = Object.Instantiate<GameObject>(enemy.enemyType.enemyPrefab, position, Quaternion.Euler(new Vector3(0f, 0f, 0f))); val.GetComponentInChildren<NetworkObject>().Spawn(true); instance.SpawnedEnemies.Add(val.GetComponent<EnemyAI>()); return val; } public static void SpawnEnemyForced(SpawnableEnemyWithRarity enemy, int amount, bool isInside, bool isInvisible = false) { if (!RoundManager.Instance.currentLevel.Enemies.Contains(enemy)) { RoundManager.Instance.currentLevel.Enemies.Add(enemy); SpawnEnemy(enemy.enemyType, amount, isInside, isInvisible); RoundManager.Instance.currentLevel.Enemies.Remove(enemy); } else { SpawnEnemy(enemy.enemyType, amount, isInside, isInvisible); } } public static List<GameObject> SpawnEnemyForced2(SpawnableEnemyWithRarity enemy, int amount, bool isInside, bool isInvisible = false, bool returnObject = false) { List<GameObject> list = new List<GameObject>(); if (!RoundManager.Instance.currentLevel.Enemies.Contains(enemy)) { RoundManager.Instance.currentLevel.Enemies.Add(enemy); list = SpawnEnemy(enemy, amount, isInside, isInvisible, returnObject: true); RoundManager.Instance.currentLevel.Enemies.Remove(enemy); } else { list = SpawnEnemy(enemy, amount, isInside, isInvisible, returnObject: true); } return list; } public static float Map(float x, float inMin, float inMax, float outMin, float outMax) { return (x - inMin) * (outMax - outMin) / (inMax - inMin) + outMin; } public static PlayerControllerB GetPlayerByUserID(int userID) { return StartOfRound.Instance.allPlayerScripts[userID]; } public static NetworkObjectReference SpawnEnemyOnServer(Vector3 spawnPosition, float yRot, SpawnableEnemyWithRarity enemy) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) NetworkObjectReference result = default(NetworkObjectReference); if (!((NetworkBehaviour)Networker.Instance).IsServer) { return result; } GameObject val = Object.Instantiate<GameObject>(enemy.enemyType.enemyPrefab, spawnPosition, Quaternion.Euler(new Vector3(0f, yRot, 0f))); val.GetComponentInChildren<NetworkObject>().Spawn(true); RoundManager.Instance.SpawnedEnemies.Add(val.GetComponent<EnemyAI>()); return NetworkObjectReference.op_Implicit(val.GetComponentInChildren<NetworkObject>()); } public static void ChatWrite(string chatMessage) { HUDManager.Instance.lastChatMessage = chatMessage; HUDManager.Instance.PingHUDElement(HUDManager.Instance.Chat, 4f, 1f, 0.2f); if (HUDManager.Instance.ChatMessageHistory.Count >= 4) { ((TMP_Text)HUDManager.Instance.chatText).text.Remove(0, HUDManager.Instance.ChatMessageHistory[0].Length); HUDManager.Instance.ChatMessageHistory.Remove(HUDManager.Instance.ChatMessageHistory[0]); } string item = "<color=#00ffff>" + chatMessage + "</color>"; HUDManager.Instance.ChatMessageHistory.Add(item); ((TMP_Text)HUDManager.Instance.chatText).text = ""; for (int i = 0; i < HUDManager.Instance.ChatMessageHistory.Count; i++) { TextMeshProUGUI chatText = HUDManager.Instance.chatText; ((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n" + HUDManager.Instance.ChatMessageHistory[i]; } } public static trap[] getAllTraps() { List<trap> list = new List<trap>(); List<SpawnableMapObject> list2 = (from x in StartOfRound.Instance.levels.SelectMany((SelectableLevel level) => level.spawnableMapObjects) group x by ((Object)x.prefabToSpawn).name into g select g.First()).ToList(); foreach (SpawnableMapObject item2 in list2) { list.Add(new trap(((Object)item2.prefabToSpawn).name, item2.prefabToSpawn)); } if (MysteryDice.CodeRebirthPresent) { HashSet<string> hashSet = new HashSet<string>(list.Select((trap x) => NormalizeName(x.name))); foreach (trap spawnPrefab in CodeRebirthCheckConfigs.getSpawnPrefabs()) { string item = NormalizeName(spawnPrefab.name); if (!hashSet.Contains(item)) { list.Add(spawnPrefab); hashSet.Add(item); } } } return list.ToArray(); static string NormalizeName(string input) { return new string(input.Where((char c) => !char.IsWhiteSpace(c)).ToArray()).ToLowerInvariant(); } } public static void SafeTipMessage(string title, string body) { try { HUDManager.Instance.DisplayTip(title, body, false, false, "LC_Tip1"); } catch { MysteryDice.CustomLogger.LogWarning((object)"There's a problem with the DisplayTip method. This might have happened due to a new game verison, or some other mod."); try { ChatWrite(title + ": " + body); } catch { MysteryDice.CustomLogger.LogWarning((object)"There's a problem with writing to the chat. This might have happened due to a new game verison, or some other mod."); } } } public static int TotalAlive() { List<PlayerControllerB> list = new List<PlayerControllerB>(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (IsPlayerAliveAndControlled(val)) { list.Add(val); } } return list.Count; } public static bool isPlayerLocal(int userID) { return (Object)(object)StartOfRound.Instance.allPlayerScripts[userID] == (Object)(object)StartOfRound.Instance.localPlayerController; } public static PlayerControllerB GetRandomAlivePlayer(int notThisPlayer = -1) { List<PlayerControllerB> list = new List<PlayerControllerB>(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (IsPlayerAliveAndControlled(val)) { list.Add(val); } } if (list.Count == 1) { return list[0]; } PlayerControllerB val2 = list[Random.Range(0, list.Count)]; if (notThisPlayer != -1) { for (int j = 0; Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val2) == notThisPlayer || j > 10; j++) { val2 = list[Random.Range(0, list.Count)]; } } return val2; } public static int GetRandomPlayerID() { List<PlayerControllerB> list = new List<PlayerControllerB>(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (IsPlayerAliveAndControlled(val)) { list.Add(val); } } return Array.IndexOf(StartOfRound.Instance.allPlayerScripts, list[Random.Range(0, list.Count)]); } public static PlayerControllerB GetRandomPlayer() { List<PlayerControllerB> list = new List<PlayerControllerB>(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (IsPlayerReal(val)) { list.Add(val); } } if (list.Count == 1) { return list[0]; } return list[Random.Range(0, list.Count)]; } public static bool IsPlayerAliveAndControlled(PlayerControllerB player) { return !player.isPlayerDead && player.isPlayerControlled; } public static bool IsPlayerReal(PlayerControllerB player) { return ((Behaviour)player).isActiveAndEnabled || player.isPlayerDead; } public static SpawnableEnemyWithRarity getEnemyByName(string name) { HashSet<SpawnableEnemyWithRarity> hashSet = new HashSet<SpawnableEnemyWithRarity>(); SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { hashSet.UnionWith(val.Enemies); hashSet.UnionWith(val.OutsideEnemies); hashSet.UnionWith(val.DaytimeEnemies); } List<SpawnableEnemyWithRarity> source = (from x in hashSet group x by x.enemyType.enemyName into g select g.First() into x orderby x.enemyType.enemyName select x).ToList(); return ((IEnumerable<SpawnableEnemyWithRarity>)source).FirstOrDefault((Func<SpawnableEnemyWithRarity, bool>)((SpawnableEnemyWithRarity x) => x.enemyType.enemyName == name)); } public static void AdjustWeight(int userID, float factor) { PlayerControllerB val = null; val = StartOfRound.Instance.allPlayerScripts[userID]; if ((Object)(object)val == (Object)null) { MysteryDice.CustomLogger.LogError((object)"Player not found."); return; } float num = 0f; float num2 = 0f; GrabbableObject[] itemSlots = val.ItemSlots; foreach (GrabbableObject val2 in itemSlots) { if (!((Object)(object)val2 == (Object)null) && val2.itemProperties.weight != 0f) { float num3 = Mathf.Clamp(val2.itemProperties.weight - 1f, 0f, 100f); float num4 = Mathf.RoundToInt(num3 * 105f); num4 *= factor; num2 += num4; float num5 = Mathf.Clamp(num4 / 105f + 1f, 1f, 10f); val2.itemProperties.weight = num5; num += num5; } } float num6 = Mathf.Clamp(num2 / 105f + 1f, 1f, 10f); if (num6 != 0f) { val.carryWeight = num6; } } } public class trap { public string name; public GameObject prefab; public trap(string _name, GameObject _prefab) { name = _name; prefab = _prefab; } } public class Consts { public const string Default = "Default"; public const string Experimentation = "Experimentation"; public const string Assurance = "Assurance"; public const string Vow = "Vow"; public const string Offense = "Offense"; public const string March = "March"; public const string Rend = "Rend"; public const string Dine = "Dine"; public const string Titan = "Titan"; public const string Adamance = "Adamance"; public const string Artifice = "Artifice"; public const string Embrion = "Embrion"; } public class CustomEnemyConfig { public string monsterName { get; set; } public EffectType outcome { get; set; } public bool IsInside { get; set; } public int AmountMin { get; set; } public int AmountMax { get; set; } public string customName { get; set; } public string customTooltip { get; set; } } public class CustomItemConfig { public string itemName { get; set; } public EffectType outcome { get; set; } public int AmountMax { get; set; } public string customName { get; set; } public string customTooltip { get; set; } } public class CustomTrapConfig { public string trapName { get; set; } public EffectType outcome { get; set; } public bool IsInside { get; set; } public int AmountMax { get; set; } public bool moving { get; set; } public string customName { get; set; } public string customTooltip { get; set; } } public class CustomConfigs { private ConfigFile configFile; public List<CustomEnemyConfig> EnemyConfigs { get; private set; } = new List<CustomEnemyConfig>(); public List<CustomItemConfig> ItemConfigs { get; private set; } = new List<CustomItemConfig>(); public List<CustomTrapConfig> TrapConfigs { get; private set; } = new List<CustomTrapConfig>(); public CustomConfigs(ConfigFile config) { configFile = config; } public void GenerateConfigs(int numberOfEnemyConfigs, int numberOfItemConfigs, int numberOfTrapConfigs) { for (int i = 1; i <= numberOfEnemyConfigs; i++) { string value = configFile.Bind<string>($"CustomEnemy{i}", "Monster Name", "Locker", $"The name of Custom Enemy{i}\nMake sure to get the EXACT name of the enemy\nYou can use the DebugLogging config and go to a moon to see all enemy names").Value; string value2 = configFile.Bind<string>($"CustomEnemy{i}", "Enemy Display Name", "School Season", "Sets the Display name \"Player Rolled Item Display Name\"").Value; string value3 = configFile.Bind<string>($"CustomEnemy{i}", "Enemy Tooltip Name", "Don't scan them!", "This is the Tooltip that shows on the popup for the dice").Value; bool value4 = configFile.Bind<bool>($"CustomEnemy{i}", "Is Inside", false, $"Does the enemy Spawn inside for Custom{i}").Value; EffectType value5 = configFile.Bind<EffectType>($"CustomEnemy{i}", "Outcome", EffectType.Bad, $"Sets the Outcome for Custom{i}").Value; int value6 = configFile.Bind<int>($"CustomEnemy{i}", "Amount Min", 1, $"Minimum number of enemies to spawn for Custom{i}").Value; int value7 = configFile.Bind<int>($"CustomEnemy{i}", "Amount Max", 5, $"Maximum number of enemies to spawn for Custom{i}").Value; CustomEnemyConfig customEnemyConfig = new CustomEnemyConfig { monsterName = value, outcome = value5, IsInside = value4, AmountMin = value6, AmountMax = value7, customName = value2, customTooltip = value3 }; EnemyConfigs.Add(customEnemyConfig); DieBehaviour.AllEffects.Add(new DynamicEffect(value2 ?? "", customEnemyConfig)); } for (int j = 1; j <= numberOfItemConfigs; j++) { string value8 = configFile.Bind<string>($"CustomItem{j}", "Item Name", "Key", $"The name of Item{j}\nMake sure to get the EXACT name of the Item\nYou can use the DebugLogging config and pick up the item to see it's name").Value; string value9 = configFile.Bind<string>($"CustomItem{j}", "Item Display Name", "Door Opener", "Sets the Display name \"Player Rolled Item Display Name\"").Value; string value10 = configFile.Bind<string>($"CustomItem{j}", "Item Tooltip Name", "They Open Doors!", "This is the Tooltip that shows on the popup for the dice").Value; EffectType value11 = configFile.Bind<EffectType>($"CustomItem{j}", "Outcome", EffectType.Good, $"Sets the Outcome for Custom{j}").Value; int value12 = configFile.Bind<int>($"CustomItem{j}", "Amount Max", 5, $"Maximum number of Items to spawn for Custom{j}").Value; CustomItemConfig customItemConfig = new CustomItemConfig { itemName = value8, outcome = value11, AmountMax = value12, customName = value9, customTooltip = value10 }; ItemConfigs.Add(customItemConfig); DieBehaviour.AllEffects.Add(new DynamicItemEffect(value9 ?? "", customItemConfig)); } for (int k = 1; k <= numberOfTrapConfigs; k++) { string value13 = configFile.Bind<string>($"CustomTrap{k}", "Trap Name", "CageMine", $"The name of Trap{k}\nMake sure to get the EXACT name of the Trap\nYou can use the DebugLogging config and go to a moon to see all SpawnableMapObjects names").Value; string value14 = configFile.Bind<string>($"CustomTrap{k}", "Trap Display Name", "Cage Mines?", "Sets the Display name \"Player Rolled Trap Display Name\"").Value; string value15 = configFile.Bind<string>($"CustomTrap{k}", "Trap Tooltip Name", "It's Gonna Trap Ya", "This is the Tooltip that shows on the popup for the dice").Value; bool value16 = configFile.Bind<bool>($"CustomTrap{k}", "Is Inside", false, $"Does the Trap Spawn inside for Custom{k}").Value; EffectType value17 = configFile.Bind<EffectType>($"CustomTrap{k}", "Outcome", EffectType.Awful, $"Sets the Outcome for Custom{k}").Value; int value18 = configFile.Bind<int>($"CustomTrap{k}", "Amount Max", 5, $"Maximum number of Traps to spawn for Custom{k}").Value; bool value19 = configFile.Bind<bool>($"CustomTrap{k}", "Moving", false, $"Do traps of the type: {k} move").Value; CustomTrapConfig customTrapConfig = new CustomTrapConfig { trapName = value13, outcome = value17, IsInside = value16, moving = value19, AmountMax = value18, customName = value14, customTooltip = value15 }; TrapConfigs.Add(customTrapConfig); MysteryDice.MainRegisterNewEffect(new DynamicTrapEffect(value14 ?? "", customTrapConfig)); } } } internal class DynamicEffect : IEffect { private string name; private CustomEnemyConfig config; public static EnemyType enemy; public string Name => name; public EffectType Outcome => config.outcome; public bool ShowDefaultTooltip => true; public string Tooltip => config.customTooltip; public DynamicEffect(string name, CustomEnemyConfig config) { this.name = name; this.config = config; } public void Use() { Networker.Instance.CustomMonsterServerRPC(config.monsterName, config.AmountMin, config.AmountMax, config.IsInside); } public static void spawnEnemy(string names, int min, int max, bool inside, Vector3 size = default(Vector3)) { string[] array = names.Split(','); string[] array2 = array; foreach (string name in array2) { int num = 0; List<EnemyType> source = GetEnemies.allEnemies.OrderBy((EnemyType x) => x.enemyName).ToList(); enemy = ((IEnumerable<EnemyType>)source).FirstOrDefault((Func<EnemyType, bool>)((EnemyType x) => x.enemyName == name)); if ((Object)(object)enemy == (Object)null) { MysteryDice.CustomLogger.LogWarning((object)("Enemy '" + name + "' not found. Available enemies: " + string.Join(", ", source.Select((EnemyType e) => e.enemyName)))); break; } num = Random.Range(min, max + 1); Misc.SpawnEnemy(enemy, num, inside); } } } internal class DynamicItemEffect : IEffect { private string name; private CustomItemConfig config; public string Name => name; public EffectType Outcome => config.outcome; public bool ShowDefaultTooltip => true; public string Tooltip => config.customTooltip; public DynamicItemEffect(string name, CustomItemConfig config) { this.name = name; this.config = config; } public void Use() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) Networker.Instance.SameScrapServerRPC(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, GameNetworkManager.Instance.localPlayerController), Random.Range(1, config.AmountMax + 1), config.itemName); } } internal class DynamicTrapEffect : IEffect { private string name; private CustomTrapConfig config; public string Name => name; public EffectType Outcome => config.outcome; public bool ShowDefaultTooltip => true; public string Tooltip => config.customTooltip; public DynamicTrapEffect(string name, CustomTrapConfig config) { this.name = name; this.config = config; } public void Use() { Networker.Instance.CustomTrapServerRPC(config.AmountMax, config.trapName, config.IsInside, config.moving); } public static trap getTrap(string name) { trap[] allTraps = Misc.getAllTraps(); trap trap2 = allTraps.FirstOrDefault((trap x) => x.name == name); if (trap2 == null) { trap2 = allTraps.FirstOrDefault((trap x) => x.name == "Landmine"); } return trap2; } public static void spawnTrap(int max, string trapNames, bool inside, float positionOffsetRadius = 5f, bool moving = false, bool useScale = false, Vector3 scale = default(Vector3)) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: 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_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) string[] array = trapNames.Split(','); string[] array2 = array; Vector3 val = default(Vector3); RaycastHit val3 = default(RaycastHit); foreach (string text in array2) { List<Vector3> list = new List<Vector3>(); int num = 0; Random random = new Random(StartOfRound.Instance.randomMapSeed); List<GameObject> list2 = (inside ? RoundManager.Instance.insideAINodes.ToList() : RoundManager.Instance.outsideAINodes.ToList()); int count = list2.Count; if (count == 0) { break; } int num2 = 100; trap trap2 = getTrap(text); int num3 = Random.Range(3, max + 1); while (num < num3) { for (int j = 0; j < count; j++) { if (num >= num3) { break; } Vector3 position = list2[Random.Range(0, count)].transform.position; bool flag = false; for (int k = 0; k < num2; k++) { if (flag) { break; } ((Vector3)(ref val))..ctor((float)(random.NextDouble() * 2.0 - 1.0) * positionOffsetRadius, 0f, (float)(random.NextDouble() * 2.0 - 1.0) * positionOffsetRadius); Vector3 val2 = position + val; if (!Physics.Raycast(val2 + Vector3.up * 10f, Vector3.down, ref val3, 20f)) { continue; } Vector3 point = ((RaycastHit)(ref val3)).point; if (GetShortestDistanceSqr(point, list) >= 1f) { flag = true; GameObject val4 = Object.Instantiate<GameObject>(trap2.prefab, point, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform); list.Add(point); val4.transform.eulerAngles = new Vector3(val4.transform.eulerAngles.x, (float)Random.Range(0, 360), val4.transform.eulerAngles.z); NetworkObject component = val4.GetComponent<NetworkObject>(); component.Spawn(true); num++; if (useScale) { Networker.Instance.setSizeClientRPC(component.NetworkObjectId, scale, Quaternion.identity); } } } if (!flag) { Vector3 val5 = position; Debug.LogWarning((object)("Could not find a valid position for mine at spawn point: " + ((object)(Vector3)(ref val5)).ToString())); } } } if (num > 0 && moving) { Networker.Instance.AddMovingTrapClientRPC(trap2.name); } } } public static float GetShortestDistanceSqr(Vector3 position, List<Vector3> positions) { //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) float num = float.MaxValue; foreach (Vector3 position2 in positions) { Vector3 val = position - position2; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; } } return num; } } [RequireComponent(typeof(NavMeshAgent))] public class SmartAgentNavigator : NetworkBehaviour { [HideInInspector] public bool cantMove; [HideInInspector] public EntranceTeleport lastUsedEntranceTeleport; [HideInInspector] public NavMeshAgent agent = null; [HideInInspector] public bool isOutside = true; [HideInInspector] public List<EntranceTeleport> exitPoints = new List<EntranceTeleport>(); [HideInInspector] public EntranceTeleport? mainEntrance; private readonly float nonAgentMovementSpeed = 10f; private Coroutine? checkPathsRoutine; private MineshaftElevatorController? elevatorScript; private bool inElevator; [HideInInspector] public UnityEvent<bool> OnEnableOrDisableAgent = new UnityEvent<bool>(); [HideInInspector] public UnityEvent<bool> OnEnterOrExitElevator = new UnityEvent<bool>(); [HideInInspector] public UnityEvent<bool> OnUseEntranceTeleport = new UnityEvent<bool>(); [HideInInspector] public PathfindingOperation? pathfindingOperation; private Vector3 pointToGo = Vector3.zero; private bool usingElevator; [SerializeField] private float _nodeRemovalPrecision = 5f; private Coroutine? _searchRoutine; private float _searchRadius = 50f; private readonly List<Vector3> _positionsToSearch = new List<Vector3>(); private readonly List<(Vector3 nodePosition, Vector3 position)> _roamingPointsVectorList = new List<(Vector3, Vector3)>(); public void Awake() { agent = ((Component)this).gameObject.GetComponent<NavMeshAgent>(); } public void SetAllValues(bool isOutside) { this.isOutside = isOutside; exitPoints.Clear(); foreach (EntranceTeleport entrancePoint in Networker.EntrancePoints) { exitPoints.Add(entrancePoint); if (entrancePoint.entranceId == 0 && entrancePoint.isEntranceToBuilding) { mainEntrance = entrancePoint; } } elevatorScript = RoundManager.Instance.currentMineshaftElevator; } public void ResetAllValues() { exitPoints.Clear(); elevatorScript = null; mainEntrance = null; } public void StopAgent() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (((Behaviour)agent).enabled && agent.isOnNavMesh) { agent.ResetPath(); } agent.velocity = Vector3.zero; } public bool DoPathingToDestination(Vector3 destination) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (_searchRoutine != null) { StopSearchRoutine(); } if (cantMove) { return false; } if (!((Behaviour)agent).enabled) { HandleDisabledAgentPathing(); return false; } return GoToDestination(destination); } public bool CheckPathsOngoing() { return checkPathsRoutine != null; } public void CheckPaths<T>(IEnumerable<(T, Vector3)> points, Action<List<(T, float)>> action) { if (CheckPathsOngoing()) { ((MonoBehaviour)this).StopCoroutine(checkPathsRoutine); checkPathsRoutine = null; ClearPathfindingOperation(); } checkPathsRoutine = ((MonoBehaviour)this).StartCoroutine(CheckPathsCoroutine(points, action)); } private IEnumerator CheckPathsCoroutine<T>(IEnumerable<(T, Vector3)> points, Action<List<(T, float)>> action) { MysteryDice.ExtendedLogging($"Checking paths for {points.Count()} objects", (LogLevel)16); List<(T, float)> TList = new List<(T, float)>(); ClearPathfindingOperation(); (T, Vector3)[] array = points.ToArray(); for (int i = 0; i < array.Length; i++) { (T, Vector3) tuple = array[i]; T obj = tuple.Item1; Vector3 point = tuple.Item2; bool pathFound = false; float bestDistance = float.MaxValue; EntranceTeleport entranceTeleport; while (!TryFindViablePath(point, out pathFound, out bestDistance, out entranceTeleport)) { yield return null; } if (pathFound) { TList.Add((obj, bestDistance)); } } ClearPathfindingOperation(); action(TList); checkPathsRoutine = null; } private void HandleDisabledAgentPathing() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0076: 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_008f: 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) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) Vector3 val = pointToGo; float num = 10f; float num2 = Vector3.Distance(((Component)this).transform.position, val); if (Vector3.Distance(((Component)this).transform.position, val) <= 1f) { OnEnableOrDisableAgent.Invoke(true); ((Behaviour)agent).enabled = true; agent.Warp(val); } else { float num3 = Mathf.Clamp01(Vector3.Distance(((Component)this).transform.position, val) / num2); Vector3 val2 = Vector3.MoveTowards(((Component)this).transform.position, val, Time.deltaTime * nonAgentMovementSpeed); val2.y += Mathf.Sin(num3 * MathF.PI) * num; ((Component)this).transform.SetPositionAndRotation(val2, Quaternion.LookRotation(val - ((Component)this).transform.position)); } } private bool DetermineIfNeedToDisableAgent(Vector3 destination) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(((Component)this).transform.position, destination); if (num <= agent.stoppingDistance + 5f) { return false; } NavMeshHit val = default(NavMeshHit); if (!NavMesh.SamplePosition(destination, ref val, 3f, agent.areaMask)) { return false; } Vector3 val2 = FindClosestValidPoint(); agent.SetDestination(val2); if (Vector3.Distance(((Component)agent).transform.position, val2) <= agent.stoppingDistance) { pointToGo = ((NavMeshHit)(ref val)).position; OnEnableOrDisableAgent.Invoke(false); ((Behaviour)agent).enabled = false; MysteryDice.ExtendedLogging($"Pathing to initial destination {destination} failed, going to fallback position {((NavMeshHit)(ref val)).position} instead.", (LogLevel)16); return true; } return false; } public float CanPathToPoint(Vector3 startPos, Vector3 endPos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) NavMeshPath val = new NavMeshPath(); if (!NavMesh.CalculatePath(startPos, endPos, -1, val) || (int)val.status > 0) { return -1f; } float num = 0f; if (val.corners.Length > 1) { for (int i = 1; i < val.corners.Length; i++) { num += Vector3.Distance(val.corners[i - 1], val.corners[i]); } } return num; } public void ClearPathfindingOperation() { pathfindingOperation?.Dispose(); pathfindingOperation = null; } internal T ChangePathfindingOperation<T>(Func<T> provider) where T : PathfindingOperation { PathfindingOperation? obj = pathfindingOperation; if (obj != null && obj.HasDisposed()) { pathfindingOperation = null; } T val = pathfindingOperation as T; if (val == null) { val = provider(); pathfindingOperation?.Dispose(); pathfindingOperation = val; } return val; } public bool TryFindViablePath(Vector3 endPosition, out bool foundPath, out float bestDistance, out EntranceTeleport? entranceTeleport) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) FindPathThroughTeleportsOperation findPathThroughTeleportsOperation = ChangePathfindingOperation(() => new FindPathThroughTeleportsOperation(exitPoints, AgentExtensions.GetPathOrigin(agent), endPosition, agent)); return findPathThroughTeleportsOperation.TryGetShortestPath(out foundPath, out bestDistance, out entranceTeleport); } public bool GoToDestination(Vector3 actualEndPosition) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_0084: 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_00ec: Unknown result type (might be due to invalid IL or missing references) if (TryFindViablePath(actualEndPosition, out bool foundPath, out float _, out EntranceTeleport entranceTeleport)) { if ((Object)(object)entranceTeleport == (Object)null && !foundPath) { if ((Object)(object)elevatorScript != (Object)null) { if (NeedsElevator(actualEndPosition, elevatorScript, out var goingUp)) { usingElevator = true; HandleElevatorActions(elevatorScript, goingUp); return false; } if (!elevatorScript.elevatorFinishedMoving && Vector3.Distance(actualEndPosition, elevatorScript.elevatorInsidePoint.position) < 7f) { return false; } } if ((isOutside && actualEndPosition.y > -50f) || (!isOutside && actualEndPosition.y < -50f)) { DetermineIfNeedToDisableAgent(actualEndPosition); return false; } if ((Object)(object)mainEntrance == (Object)null) { return false; } DoPathingThroughEntrance(mainEntrance); return false; } if ((Object)(object)entranceTeleport == (Objec