Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of dont worry about it pack 4 v1.0.0
BepInEx/plugins/WeatherMultipliers.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("WeatherMultipliers")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Lethal Company mod adding scrap multipliers to moon weather")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: AssemblyProduct("WeatherMultipliers")] [assembly: AssemblyTitle("WeatherMultipliers")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace WeatherMultipliers { [Serializable] public class Config : SyncedInstance<Config> { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequestSync; public static HandleNamedMessageDelegate <1>__OnReceiveSync; } public Dictionary<LevelWeatherType, float> ValueMultipliers = new Dictionary<LevelWeatherType, float>(); private static readonly Dictionary<LevelWeatherType, float> defaultValueMultipliers = new Dictionary<LevelWeatherType, float> { { (LevelWeatherType)1, 1.05f }, { (LevelWeatherType)2, 1.2f }, { (LevelWeatherType)3, 1.15f }, { (LevelWeatherType)4, 1.25f }, { (LevelWeatherType)5, 1.5f } }; public Config(ConfigFile cfg) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) InitInstance(this); foreach (KeyValuePair<LevelWeatherType, float> defaultValueMultiplier in defaultValueMultipliers) { Dictionary<LevelWeatherType, float> valueMultipliers = ValueMultipliers; LevelWeatherType key = defaultValueMultiplier.Key; LevelWeatherType key2 = defaultValueMultiplier.Key; valueMultipliers[key] = cfg.Bind<float>("Multipliers", ((object)(LevelWeatherType)(ref key2)).ToString(), Mathf.Clamp(defaultValueMultiplier.Value, 1f, 1000f), $"Scrap value multiplier for {defaultValueMultiplier.Key} weather").Value; } } public static void RequestSync() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<Config>.IsClient) { return; } Plugin.Logger.LogInfo((object)"Attempting to sync config with host"); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { SyncedInstance<Config>.MessageManager.SendNamedMessage("WeatherMultipliers_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnRequestSync(ulong clientId, FastBufferReader _) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<Config>.IsHost) { return; } Plugin.Logger.LogInfo((object)$"Config sync request received from client: {clientId}"); byte[] array = SyncedInstance<Config>.SerializeToBytes(SyncedInstance<Config>.Instance); int num = array.Length; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(num + SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0); SyncedInstance<Config>.MessageManager.SendNamedMessage("WeatherMultipliers_OnReceiveConfigSync", clientId, val, (NetworkDelivery)4); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error occurred syncing config with client: {clientId}\n{arg}"); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong _, FastBufferReader reader) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (!((FastBufferReader)(ref reader)).TryBeginRead(SyncedInstance<Config>.IntSize)) { Plugin.Logger.LogError((object)"Config sync error: Could not begin reading buffer."); return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (!((FastBufferReader)(ref reader)).TryBeginRead(num)) { Plugin.Logger.LogError((object)"Config sync error: Host could not sync."); return; } byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); SyncedInstance<Config>.SyncInstance(data); Plugin.Logger.LogInfo((object)"Successfully synced config with host."); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void InitializeLocalPlayer() { //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_0063: Expected O, but got Unknown //IL_0021: 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_002c: Expected O, but got Unknown if (SyncedInstance<Config>.IsHost) { CustomMessagingManager messageManager = SyncedInstance<Config>.MessageManager; object obj = <>O.<0>__OnRequestSync; if (obj == null) { HandleNamedMessageDelegate val = OnRequestSync; <>O.<0>__OnRequestSync = val; obj = (object)val; } messageManager.RegisterNamedMessageHandler("WeatherMultipliers_OnRequestConfigSync", (HandleNamedMessageDelegate)obj); SyncedInstance<Config>.Synced = true; return; } SyncedInstance<Config>.Synced = false; CustomMessagingManager messageManager2 = SyncedInstance<Config>.MessageManager; object obj2 = <>O.<1>__OnReceiveSync; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnReceiveSync; <>O.<1>__OnReceiveSync = val2; obj2 = (object)val2; } messageManager2.RegisterNamedMessageHandler("WeatherMultipliers_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2); RequestSync(); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void PlayerLeave() { SyncedInstance<Config>.RevertSync(); } } [Serializable] public class SyncedInstance<T> { [NonSerialized] protected static int IntSize = 4; internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager; internal static bool IsClient => NetworkManager.Singleton.IsClient; internal static bool IsHost => NetworkManager.Singleton.IsHost; public static T Default { get; private set; } public static T Instance { get; private set; } public static bool Synced { get; internal set; } protected void InitInstance(T instance) { Default = instance; Instance = instance; IntSize = 4; } internal static void SyncInstance(byte[] data) { Instance = DeserializeFromBytes(data); Synced = true; } internal static void RevertSync() { Instance = Default; Synced = false; } public static byte[] SerializeToBytes(T val) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream memoryStream = new MemoryStream(); try { binaryFormatter.Serialize(memoryStream, val); return memoryStream.ToArray(); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error serializing instance: {arg}"); return null; } } public static T DeserializeFromBytes(byte[] data) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream serializationStream = new MemoryStream(data); try { return (T)binaryFormatter.Deserialize(serializationStream); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error deserializing instance: {arg}"); return default(T); } } } [BepInPlugin("WeatherMultipliers", "WeatherMultipliers", "1.1.0")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("WeatherMultipliers"); public static Config Config { get; internal set; } internal static ManualLogSource Logger { get; private set; } private void Awake() { Config = new Config(((BaseUnityPlugin)this).Config); Logger = ((BaseUnityPlugin)this).Logger; harmony.PatchAll(); harmony.PatchAll(typeof(Config)); Logger.LogInfo((object)"Plugin WeatherMultipliers is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "WeatherMultipliers"; public const string PLUGIN_NAME = "WeatherMultipliers"; public const string PLUGIN_VERSION = "1.1.0"; } } namespace WeatherMultipliers.patches { [HarmonyPatch(typeof(LungProp), "DisconnectFromMachinery")] public class ApparatusPatch { private static readonly ManualLogSource logger = Logger.CreateLogSource("WeatherMultipliers.ApparatusPatch"); private static void Prefix(LungProp __instance) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) LevelWeatherType currentWeather = __instance.roundManager.currentLevel.currentWeather; if (SyncedInstance<Config>.Instance.ValueMultipliers.ContainsKey(currentWeather)) { float num = SyncedInstance<Config>.Instance.ValueMultipliers[currentWeather]; ((GrabbableObject)__instance).scrapValue = (int)(num * (float)((GrabbableObject)__instance).scrapValue); logger.LogInfo((object)$"Adjusting LungProp (Apparatus) value for weather {currentWeather}: {((GrabbableObject)__instance).scrapValue}"); } } } [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] public class ScrapGeneration { private static readonly ManualLogSource logger = Logger.CreateLogSource("WeatherMultipliers.ScrapGeneration"); private static void Prefix(RoundManager __instance) { //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: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) LevelWeatherType currentWeather = __instance.currentLevel.currentWeather; if (SyncedInstance<Config>.Instance.ValueMultipliers.ContainsKey(currentWeather)) { float num = SyncedInstance<Config>.Instance.ValueMultipliers[__instance.currentLevel.currentWeather]; __instance.scrapValueMultiplier *= num; logger.LogInfo((object)$"Set scrap value multiplier ({num}) for current weather \"{currentWeather}\""); } else { logger.LogInfo((object)$"No weather multiplier found for \"{currentWeather}\""); } } private static void Postfix(RoundManager __instance) { //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: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) LevelWeatherType currentWeather = __instance.currentLevel.currentWeather; if (SyncedInstance<Config>.Instance.ValueMultipliers.ContainsKey(currentWeather)) { float num = SyncedInstance<Config>.Instance.ValueMultipliers[__instance.currentLevel.currentWeather]; __instance.scrapValueMultiplier /= num; logger.LogInfo((object)$"Scrap generated, resetting scrap value multiplier to its original value of {__instance.scrapValueMultiplier}"); } } } }
DeezNuts.dll
Decompiled 2 years 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.Logging; using DeezNuts.Patch; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("DeezNuts")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DeezNuts")] [assembly: AssemblyTitle("DeezNuts")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace DeezNuts { [BepInPlugin("com.fakemarsh.DeezNuts", "DeezNuts", "0.1.0")] [BepInProcess("Lethal Company.exe")] public class Plugin : BaseUnityPlugin { private Harmony harmony = new Harmony("DeezNuts"); public static ManualLogSource logger; public static GameObject deez_nuts_button; public static Item deez_nuts_item; private void Awake() { logger = ((BaseUnityPlugin)this).Logger; logger.LogInfo((object)"Plugin DeezNuts is loaded!"); LoadButton(); harmony.PatchAll(typeof(DeezPatches)); harmony.PatchAll(typeof(NetworkPatches)); } private void LoadButton() { string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "deeznuts"); AssetBundle val = AssetBundle.LoadFromFile(text); GameObject val2 = val.LoadAsset<GameObject>("Assets/DeezNuts/DeezNuts.prefab"); deez_nuts_button = val2; deez_nuts_item = val.LoadAsset<Item>("Assets/DeezNuts/DeezNuts.asset"); logger.LogInfo((object)("custom scrap item loaded into network: " + deez_nuts_item.itemName)); } } public static class PluginInfo { public const string PLUGIN_GUID = "DeezNuts"; public const string PLUGIN_NAME = "DeezNuts"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace DeezNuts.Patch { [HarmonyPatch(typeof(StartOfRound))] internal class DeezPatches { [HarmonyPrefix] [HarmonyPatch("Awake")] public static void DeezNutsButtonPatch(StartOfRound __instance) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown Plugin.logger.LogInfo((object)"inside button patch"); SelectableLevel[] levels = __instance.levels; SelectableLevel[] array = levels; foreach (SelectableLevel val in array) { SpawnableItemWithRarity val2 = new SpawnableItemWithRarity(); val2.spawnableItem = Plugin.deez_nuts_item; val2.rarity = 99; Plugin.logger.LogInfo((object)("Adding deez nuts button into moon " + ((Object)val).name)); val.spawnableScrap.Add(val2); Plugin.logger.LogInfo((object)"\n\n"); } if (!__instance.allItemsList.itemsList.Contains(Plugin.deez_nuts_item)) { __instance.allItemsList.itemsList.Add(Plugin.deez_nuts_item); } } } internal class NetworkPatches { private static GameObject networkPrefab; [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] public static void Init(GameNetworkManager __instance) { Plugin.logger.LogInfo((object)"inside deez nuts network patcher"); if (!((Object)(object)networkPrefab != (Object)null)) { Plugin.logger.LogInfo((object)"we are adding the deez nuts button to the network!"); networkPrefab = Plugin.deez_nuts_button; ((Component)__instance).GetComponent<NetworkManager>().PrefabHandler.AddNetworkPrefab(networkPrefab); } } } }
GamblersMod.dll
Decompiled 2 years agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GamblersMod.Patches; using GamblersMod.Player; using GamblersMod.RoundManagerCustomSpace; using GamblersMod.config; using GameNetcodeStuff; using HarmonyLib; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("GamblersMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("GamblersMod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4389dd08-eb54-4b6f-955c-5f772ecc6fc7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] internal class <Module> { static <Module>() { } } namespace GamblersMod { [BepInPlugin("Junypai.GamblersMod", "Gamblers Mod", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string modGUID = "Junypai.GamblersMod"; public const string modName = "Gamblers Mod"; public const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("Junypai.GamblersMod"); public static Plugin Instance; public static GameObject GamblingMachine; public static AudioClip GamblingJackpotScrapAudio; public static AudioClip GamblingHalveScrapAudio; public static AudioClip GamblingRemoveScrapAudio; public static AudioClip GamblingDoubleScrapAudio; public static AudioClip GamblingTripleScrapAudio; public static AudioClip GamblingDrumrollScrapAudio; public static GameObject GamblingATMMachine; public static AudioClip GamblingMachineMusicAudio; public static GameObject GamblingMachineResultCanvas; public static GambleConfigSettingsSerializable UserConfigSnapshot; public static GambleConfigSettingsSerializable RecentHostConfig; public static GambleConfigSettingsSerializable CurrentUserConfig; public static ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } NetcodeWeaver(); mls = Logger.CreateLogSource("Junypai.GamblersMod"); CurrentUserConfig = new GambleConfigSettingsSerializable(((BaseUnityPlugin)this).Config); RecentHostConfig = new GambleConfigSettingsSerializable(((BaseUnityPlugin)this).Config); UserConfigSnapshot = new GambleConfigSettingsSerializable(((BaseUnityPlugin)this).Config); string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); mls.LogInfo((object)"Loading gambler bundle assets"); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(directoryName, "gamblingmachinebundle")); if (!Object.op_Implicit((Object)(object)val)) { mls.LogError((object)"Unable to load gambler bundle assets"); } else { mls.LogInfo((object)"Gamblers bundle assets successfully loaded"); } GamblingDrumrollScrapAudio = LoadAssetFromAssetBundleAndLogInfo<AudioClip>(val, "drumroll"); GamblingJackpotScrapAudio = LoadAssetFromAssetBundleAndLogInfo<AudioClip>(val, "holyshit"); GamblingHalveScrapAudio = LoadAssetFromAssetBundleAndLogInfo<AudioClip>(val, "cricket"); GamblingRemoveScrapAudio = LoadAssetFromAssetBundleAndLogInfo<AudioClip>(val, "womp"); GamblingMachineMusicAudio = LoadAssetFromAssetBundleAndLogInfo<AudioClip>(val, "machineMusic"); GamblingDoubleScrapAudio = LoadAssetFromAssetBundleAndLogInfo<AudioClip>(val, "doublekill"); GamblingTripleScrapAudio = LoadAssetFromAssetBundleAndLogInfo<AudioClip>(val, "triplekill"); GamblingMachineResultCanvas = LoadAssetFromAssetBundleAndLogInfo<GameObject>(val, "GamblingMachineResultCanvas"); GamblingMachine = LoadAssetFromAssetBundleAndLogInfo<GameObject>(val, "GamblingMachine"); GamblingMachine.AddComponent<GamblingMachine>(); harmony.PatchAll(typeof(Plugin)); harmony.PatchAll(typeof(GameNetworkManagerPatch)); harmony.PatchAll(typeof(PlayerControllerBPatch)); harmony.PatchAll(typeof(RoundManagerPatch)); } private T LoadAssetFromAssetBundleAndLogInfo<T>(AssetBundle bundle, string assetName) where T : Object { T val = bundle.LoadAsset<T>(assetName); if (!Object.op_Implicit((Object)(object)val)) { mls.LogError((object)(assetName + " asset failed to load")); } else { mls.LogInfo((object)(assetName + " asset successfully loaded")); } return val; } private static void NetcodeWeaver() { 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); } } } } } } namespace GamblersMod.RoundManagerCustomSpace { internal class RoundManagerCustom : NetworkBehaviour { public RoundManager RoundManager; public GameObject GamblingMachine; private void Awake() { RoundManager = ((Component)this).GetComponent<RoundManager>(); } [ServerRpc] public void DespawnGamblingMachineServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3258984052u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3258984052u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { GamblingMachine.GetComponent<NetworkObject>().Despawn(true); } } [ServerRpc] public void SpawnGamblingMachineServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2764001088u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2764001088u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Plugin.mls.LogInfo((object)("Attempting to spawn gambling machine at " + ((Object)RoundManager.currentLevel).name)); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(-27.808f, -2.6256f, -9.7409f); GamblingMachine = Object.Instantiate<GameObject>(Plugin.GamblingMachine, val3, Quaternion.Euler(0f, 90f, 0f)); GamblingMachine.tag = "Untagged"; GamblingMachine.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f); GamblingMachine.layer = LayerMask.NameToLayer("InteractableObject"); GamblingMachine.GetComponent<NetworkObject>().Spawn(false); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_RoundManagerCustom() { //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(3258984052u, new RpcReceiveHandler(__rpc_handler_3258984052)); NetworkManager.__rpc_func_table.Add(2764001088u, new RpcReceiveHandler(__rpc_handler_2764001088)); } private static void __rpc_handler_3258984052(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((RoundManagerCustom)(object)target).DespawnGamblingMachineServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2764001088(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((RoundManagerCustom)(object)target).SpawnGamblingMachineServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "RoundManagerCustom"; } } } namespace GamblersMod.Player { internal class PlayerControllerCustom : NetworkBehaviour { private PlayerGamblingUIManager PlayerGamblingUIManager; private PlayerControllerB PlayerControllerOriginal; private void Awake() { PlayerGamblingUIManager = ((Component)this).gameObject.AddComponent<PlayerGamblingUIManager>(); PlayerControllerOriginal = ((Component)this).gameObject.GetComponent<PlayerControllerB>(); } private void Update() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0051: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsOwner) { return; } Camera gameplayCamera = PlayerControllerOriginal.gameplayCamera; Vector3 position = ((Component)gameplayCamera).transform.position; Vector3 forward = ((Component)gameplayCamera).transform.forward; Ray val = default(Ray); ((Ray)(ref val))..ctor(position, forward); float num = 5f; int num2 = 512; RaycastHit val2 = default(RaycastHit); bool flag = Physics.Raycast(val, ref val2, num, num2); if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).collider)) { GameObject gameObject = ((Component)((RaycastHit)(ref val2)).transform).gameObject; if (((Object)gameObject).name.Contains("GamblingMachine")) { PlayerGamblingUIManager.ShowInteractionText(); GrabbableObject val3 = PlayerControllerOriginal.ItemSlots[PlayerControllerOriginal.currentItemSlot]; GamblingMachine component = gameObject.GetComponent<GamblingMachine>(); if (component.isInCooldownPhase()) { PlayerGamblingUIManager.SetInteractionText($"Cooling down... {component.gamblingMachineCurrentCooldown}"); } else { string bindingDisplayString = InputActionRebindingExtensions.GetBindingDisplayString(IngamePlayerSettings.Instance.playerInput.actions.FindAction("Interact", false), 0, (DisplayStringOptions)0); PlayerGamblingUIManager.SetInteractionText("Press " + bindingDisplayString + " to gamble"); } if (Object.op_Implicit((Object)(object)val3)) { PlayerGamblingUIManager.SetInteractionSubText($"Scrap value on hand: ■{val3.scrapValue}"); } else { PlayerGamblingUIManager.SetInteractionSubText("Please hold a scrap on your hand"); } } if (((Object)gameObject).name.Contains("GamblingMachine") && IngamePlayerSettings.Instance.playerInput.actions.FindAction("Interact", false).triggered) { Plugin.mls.LogInfo((object)("Gambling machine was interacted with by: " + PlayerControllerOriginal.playerUsername)); GamblingMachine component2 = gameObject.GetComponent<GamblingMachine>(); handleGamblingMachineInput(component2); } } else { PlayerGamblingUIManager.HideInteractionText(); } } [ServerRpc(RequireOwnership = false)] private void ActivateGamblingMachineServerRPC(NetworkBehaviourReference GambleMachineHitRef, NetworkBehaviourReference scrapBeingGambledRef, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(967784890u, serverRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkBehaviourReference>(ref GambleMachineHitRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkBehaviourReference>(ref scrapBeingGambledRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 967784890u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkBehaviour)this).IsServer) { Plugin.mls.LogMessage((object)("ActivateGamblingMachineServerRPC: Starting gambling machine cooldown phase in the server invoked by: " + serverRpcParams.Receive.SenderClientId)); GamblingMachine gamblingMachine = default(GamblingMachine); if (!((NetworkBehaviourReference)(ref GambleMachineHitRef)).TryGet<GamblingMachine>(ref gamblingMachine, (NetworkManager)null)) { Plugin.mls.LogError((object)"ActivateGamblingMachineServerRPC: Failed to get gambling machine on server side."); return; } int roll = gamblingMachine.RollDice(); ActivateGamblingMachineClientRPC(GambleMachineHitRef, scrapBeingGambledRef, roll); } } [ClientRpc] private void ActivateGamblingMachineClientRPC(NetworkBehaviourReference GambleMachineHitRef, NetworkBehaviourReference scrapBeingGambledRef, int roll) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3996665895u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref GambleMachineHitRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref scrapBeingGambledRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, roll); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3996665895u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } NetworkBehaviourReference scrapBeingGambledRef2 = scrapBeingGambledRef; Plugin.mls.LogInfo((object)"ActivateGamblingMachineClientRPC: Activiating gambling machines on client..."); GamblingMachine GambleMachineHit = default(GamblingMachine); if (!((NetworkBehaviourReference)(ref GambleMachineHitRef)).TryGet<GamblingMachine>(ref GambleMachineHit, (NetworkManager)null)) { Plugin.mls.LogError((object)"ActivateGamblingMachineClientRPC: Failed to get gambling machine on client side."); return; } GambleMachineHit.PlayDrumRoll(); GambleMachineHit.SetRoll(roll); GambleMachineHit.GenerateGamblingOutcomeFromCurrentRoll(); GambleMachineHit.BeginGamblingMachineCooldown(delegate { GrabbableObject val3 = default(GrabbableObject); if (!((NetworkBehaviourReference)(ref scrapBeingGambledRef2)).TryGet<GrabbableObject>(ref val3, (NetworkManager)null)) { Plugin.mls.LogError((object)"ActivateGamblingMachineClientRPC: Failed to get scrap value on client side."); } else { val3.SetScrapValue(GambleMachineHit.GetScrapValueBasedOnGambledOutcome(val3)); GambleMachineHit.PlayGambleResultAudio(); } }); } private void handleGamblingMachineInput(GamblingMachine GamblingMachineHit) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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) GrabbableObject val = PlayerControllerOriginal.ItemSlots[PlayerControllerOriginal.currentItemSlot]; if (Object.op_Implicit((Object)(object)val) && !GamblingMachineHit.isInCooldownPhase()) { Plugin.mls.LogMessage((object)$"Scrap value of {((Object)val).name} on hand: ▊{val.scrapValue}"); ActivateGamblingMachineServerRPC(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)GamblingMachineHit), NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val)); PlayerGamblingUIManager.SetInteractionText($"Cooling down... {GamblingMachineHit.gamblingMachineCurrentCooldown}"); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_PlayerControllerCustom() { //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(967784890u, new RpcReceiveHandler(__rpc_handler_967784890)); NetworkManager.__rpc_func_table.Add(3996665895u, new RpcReceiveHandler(__rpc_handler_3996665895)); } private static void __rpc_handler_967784890(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_008b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference gambleMachineHitRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref gambleMachineHitRef, default(ForNetworkSerializable)); NetworkBehaviourReference scrapBeingGambledRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref scrapBeingGambledRef, default(ForNetworkSerializable)); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((PlayerControllerCustom)(object)target).ActivateGamblingMachineServerRPC(gambleMachineHitRef, scrapBeingGambledRef, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3996665895(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference gambleMachineHitRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref gambleMachineHitRef, default(ForNetworkSerializable)); NetworkBehaviourReference scrapBeingGambledRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref scrapBeingGambledRef, default(ForNetworkSerializable)); int roll = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref roll); target.__rpc_exec_stage = (__RpcExecStage)2; ((PlayerControllerCustom)(object)target).ActivateGamblingMachineClientRPC(gambleMachineHitRef, scrapBeingGambledRef, roll); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PlayerControllerCustom"; } } } namespace GamblersMod.Patches { [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void StartPatch(GameNetworkManager __instance) { Plugin.mls.LogInfo((object)"Adding Gambling machine to network prefab"); NetworkManager.Singleton.AddNetworkPrefab(Plugin.GamblingMachine); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void StartDisconnectPatch() { Plugin.mls.LogInfo((object)"Player disconnected. Resetting the user's configuration settings."); Plugin.CurrentUserConfig = Plugin.UserConfigSnapshot; } } public class PlayerGamblingUIManager : NetworkBehaviour { private GameObject gamblingMachineInteractionTextCanvasObject; private Canvas gamblingMachineInteractionTextCanvas; private GameObject gamblingMachineInteractionTextObject; private GameObject gamblingMachineInteractionScrapInfoTextObject; private Text gamblingMachineInteractionScrapInfoText; private Text gamblingMachineInteractionText; private string interactionName; private string interactionText; private void Awake() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //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_0111: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Expected O, but got Unknown //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) gamblingMachineInteractionTextCanvasObject = new GameObject(); gamblingMachineInteractionTextCanvasObject.transform.parent = ((Component)this).transform; interactionName = "gamblingMachine"; interactionText = "Press E to gamble"; ((Object)gamblingMachineInteractionTextCanvasObject).name = interactionName + "InteractionTextCanvasObject"; gamblingMachineInteractionTextCanvasObject.AddComponent<Canvas>(); gamblingMachineInteractionTextCanvasObject.SetActive(false); gamblingMachineInteractionTextCanvas = gamblingMachineInteractionTextCanvasObject.GetComponent<Canvas>(); gamblingMachineInteractionTextCanvas.renderMode = (RenderMode)0; gamblingMachineInteractionTextCanvasObject.AddComponent<CanvasScaler>(); gamblingMachineInteractionTextCanvasObject.AddComponent<GraphicRaycaster>(); gamblingMachineInteractionTextObject = new GameObject(); ((Object)gamblingMachineInteractionTextObject).name = interactionName + "InteractionTextObject"; gamblingMachineInteractionTextObject.AddComponent<Text>(); Transform transform = gamblingMachineInteractionTextObject.transform; Rect rect = ((Component)gamblingMachineInteractionTextCanvas).GetComponent<RectTransform>().rect; float num = ((Rect)(ref rect)).width / 2f - 20f; rect = ((Component)gamblingMachineInteractionTextCanvas).GetComponent<RectTransform>().rect; transform.localPosition = new Vector3(num, ((Rect)(ref rect)).height / 2f - 50f, 0f); gamblingMachineInteractionText = gamblingMachineInteractionTextObject.GetComponent<Text>(); gamblingMachineInteractionText.text = interactionText; gamblingMachineInteractionText.alignment = (TextAnchor)4; gamblingMachineInteractionText.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); ((Graphic)gamblingMachineInteractionText).rectTransform.sizeDelta = new Vector2(300f, 200f); gamblingMachineInteractionText.fontSize = 26; ((Component)gamblingMachineInteractionText).transform.parent = gamblingMachineInteractionTextCanvasObject.transform; gamblingMachineInteractionScrapInfoTextObject = new GameObject(); ((Object)gamblingMachineInteractionScrapInfoTextObject).name = interactionName + "InteractionScrapInfoTextObject"; gamblingMachineInteractionScrapInfoTextObject.AddComponent<Text>(); Transform transform2 = gamblingMachineInteractionScrapInfoTextObject.transform; rect = ((Component)gamblingMachineInteractionTextCanvas).GetComponent<RectTransform>().rect; float num2 = ((Rect)(ref rect)).width / 2f - 20f; rect = ((Component)gamblingMachineInteractionTextCanvas).GetComponent<RectTransform>().rect; transform2.localPosition = new Vector3(num2, ((Rect)(ref rect)).height / 2f - 100f, 0f); gamblingMachineInteractionScrapInfoText = gamblingMachineInteractionScrapInfoTextObject.GetComponent<Text>(); gamblingMachineInteractionScrapInfoText.text = interactionText; gamblingMachineInteractionScrapInfoText.alignment = (TextAnchor)4; gamblingMachineInteractionScrapInfoText.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); ((Graphic)gamblingMachineInteractionScrapInfoText).rectTransform.sizeDelta = new Vector2(300f, 200f); gamblingMachineInteractionScrapInfoText.fontSize = 15; ((Graphic)gamblingMachineInteractionScrapInfoText).color = Color.green; ((Component)gamblingMachineInteractionScrapInfoText).transform.parent = gamblingMachineInteractionTextCanvasObject.transform; } public void SetInteractionText(string text) { gamblingMachineInteractionText.text = text; } public void SetInteractionSubText(string text) { gamblingMachineInteractionScrapInfoText.text = text; } public void ShowInteractionText() { gamblingMachineInteractionTextCanvasObject.SetActive(true); } public void HideInteractionText() { gamblingMachineInteractionTextCanvasObject.SetActive(false); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "PlayerGamblingUIManager"; } } internal class GamblingMachine : NetworkBehaviour { private int gamblingMachineMaxCooldown = 4; public int gamblingMachineCurrentCooldown = 0; private int jackpotMultiplier; private int tripleMultiplier; private int doubleMultiplier; private float halvedMultiplier; private int jackpotPercentage; private int triplePercentage; private int doublePercentage; private int halvedPercentage; private int removedPercentage; private int zeroMultiplier; private bool isMusicEnabled = true; private float musicVolume = 0.35f; private int rollMinValue; private int rollMaxValue; private int currentRoll = 1; public float currentGamblingOutcomeMultiplier = 1f; public string currentGamblingOutcome = GambleConstants.GamblingOutcome.DEFAULT; private void Awake() { Plugin.mls.LogInfo((object)"GamblingMachine has Awoken"); jackpotMultiplier = Plugin.CurrentUserConfig.configJackpotMultiplier; tripleMultiplier = Plugin.CurrentUserConfig.configTripleMultiplier; doubleMultiplier = Plugin.CurrentUserConfig.configDoubleMultiplier; halvedMultiplier = Plugin.CurrentUserConfig.configHalveMultiplier; zeroMultiplier = Plugin.CurrentUserConfig.configZeroMultiplier; jackpotPercentage = Plugin.CurrentUserConfig.configJackpotChance; triplePercentage = Plugin.CurrentUserConfig.configTripleChance; doublePercentage = Plugin.CurrentUserConfig.configDoubleChance; halvedPercentage = Plugin.CurrentUserConfig.configHalveChance; removedPercentage = Plugin.CurrentUserConfig.configZeroChance; isMusicEnabled = Plugin.CurrentUserConfig.configGamblingMusicEnabled; musicVolume = Plugin.CurrentUserConfig.configGamblingMusicVolume; Plugin.mls.LogInfo((object)$"GamblingMachine: jackpotMultiplier loaded from config: {jackpotMultiplier}"); Plugin.mls.LogInfo((object)$"GamblingMachine: tripleMultiplier loaded from config: {tripleMultiplier}"); Plugin.mls.LogInfo((object)$"GamblingMachine: doubleMultiplier loaded from config: {doubleMultiplier}"); Plugin.mls.LogInfo((object)$"GamblingMachine: halvedMultiplier loaded from config: {halvedMultiplier}"); Plugin.mls.LogInfo((object)$"GamblingMachine: zeroMultiplier loaded from config: {zeroMultiplier}"); Plugin.mls.LogInfo((object)$"GamblingMachine: jackpotPercentage loaded from config: {jackpotPercentage}"); Plugin.mls.LogInfo((object)$"GamblingMachine: triplePercentage loaded from config: {triplePercentage}"); Plugin.mls.LogInfo((object)$"GamblingMachine: doublePercentage loaded from config: {doublePercentage}"); Plugin.mls.LogInfo((object)$"GamblingMachine: halvedPercentage loaded from config: {halvedPercentage}"); Plugin.mls.LogInfo((object)$"GamblingMachine: removedPercentage loaded from config: {removedPercentage}"); Plugin.mls.LogInfo((object)$"GamblingMachine: gamblingMusicEnabled loaded from config: {isMusicEnabled}"); Plugin.mls.LogInfo((object)$"GamblingMachine: gamblingMusicVolume loaded from config: {musicVolume}"); InitAudioSource(); rollMinValue = 1; rollMaxValue = jackpotPercentage + triplePercentage + doublePercentage + halvedPercentage + removedPercentage; } private void Start() { Plugin.mls.LogInfo((object)"GamblingMachine has Started"); } public void GenerateGamblingOutcomeFromCurrentRoll() { bool flag = currentRoll >= rollMinValue && currentRoll <= jackpotPercentage; int num = jackpotPercentage; int num2 = jackpotPercentage + triplePercentage; bool flag2 = currentRoll > num && currentRoll <= num2; int num3 = num2; int num4 = num2 + doublePercentage; bool flag3 = currentRoll > num3 && currentRoll <= num4; int num5 = num4; int num6 = num4 + halvedPercentage; bool flag4 = currentRoll > num5 && currentRoll <= num6; if (flag) { Plugin.mls.LogMessage((object)"Rolled Jackpot"); currentGamblingOutcomeMultiplier = jackpotMultiplier; currentGamblingOutcome = GambleConstants.GamblingOutcome.JACKPOT; } else if (flag2) { Plugin.mls.LogMessage((object)"Rolled Triple"); currentGamblingOutcomeMultiplier = tripleMultiplier; currentGamblingOutcome = GambleConstants.GamblingOutcome.TRIPLE; } else if (flag3) { Plugin.mls.LogMessage((object)"Rolled Double"); currentGamblingOutcomeMultiplier = doubleMultiplier; currentGamblingOutcome = GambleConstants.GamblingOutcome.DOUBLE; } else if (flag4) { Plugin.mls.LogMessage((object)"Rolled Halved"); currentGamblingOutcomeMultiplier = halvedMultiplier; currentGamblingOutcome = GambleConstants.GamblingOutcome.HALVE; } else { Plugin.mls.LogMessage((object)"Rolled Remove"); currentGamblingOutcomeMultiplier = zeroMultiplier; currentGamblingOutcome = GambleConstants.GamblingOutcome.REMOVE; } } public void PlayGambleResultAudio() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00f5: Unknown result type (might be due to invalid IL or missing references) if (currentGamblingOutcome == GambleConstants.GamblingOutcome.JACKPOT) { AudioSource.PlayClipAtPoint(Plugin.GamblingJackpotScrapAudio, ((Component)this).transform.position, 0.6f); } else if (currentGamblingOutcome == GambleConstants.GamblingOutcome.TRIPLE) { AudioSource.PlayClipAtPoint(Plugin.GamblingTripleScrapAudio, ((Component)this).transform.position, 0.6f); } else if (currentGamblingOutcome == GambleConstants.GamblingOutcome.DOUBLE) { AudioSource.PlayClipAtPoint(Plugin.GamblingDoubleScrapAudio, ((Component)this).transform.position, 0.6f); } else if (currentGamblingOutcome == GambleConstants.GamblingOutcome.HALVE) { AudioSource.PlayClipAtPoint(Plugin.GamblingHalveScrapAudio, ((Component)this).transform.position, 0.6f); } else if (currentGamblingOutcome == GambleConstants.GamblingOutcome.REMOVE) { AudioSource.PlayClipAtPoint(Plugin.GamblingRemoveScrapAudio, ((Component)this).transform.position, 0.6f); } } public void PlayDrumRoll() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) AudioSource.PlayClipAtPoint(Plugin.GamblingDrumrollScrapAudio, ((Component)this).transform.position, 0.6f); } public void BeginGamblingMachineCooldown(Action onCountdownFinish) { gamblingMachineCurrentCooldown = gamblingMachineMaxCooldown; ((MonoBehaviour)this).StartCoroutine(CountdownCooldownCoroutine(onCountdownFinish)); } public bool isInCooldownPhase() { return gamblingMachineCurrentCooldown > 0; } private IEnumerator CountdownCooldownCoroutine(Action onCountdownFinish) { Plugin.mls.LogInfo((object)"Start gambling machine cooldown"); while (gamblingMachineCurrentCooldown > 0) { yield return (object)new WaitForSeconds(1f); gamblingMachineCurrentCooldown--; Plugin.mls.LogMessage((object)$"Gambling machine cooldown: {gamblingMachineCurrentCooldown}"); } onCountdownFinish(); Plugin.mls.LogMessage((object)"End gambling machine cooldown"); } public void SetRoll(int newRoll) { currentRoll = newRoll; } public int RollDice() { int result = Random.Range(rollMinValue, rollMaxValue); Plugin.mls.LogMessage((object)$"rollMinValue: {rollMinValue}"); Plugin.mls.LogMessage((object)$"rollMaxValue: {rollMaxValue}"); Plugin.mls.LogMessage((object)$"Roll value: {currentRoll}"); return result; } public int GetScrapValueBasedOnGambledOutcome(GrabbableObject scrap) { return (int)Mathf.Floor((float)scrap.scrapValue * currentGamblingOutcomeMultiplier); } private void InitAudioSource() { if (!isMusicEnabled) { ((Component)this).GetComponent<AudioSource>().Pause(); } ((Component)this).GetComponent<AudioSource>().volume = musicVolume; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "GamblingMachine"; } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("Awake")] [HarmonyPrefix] public static void Awake(PlayerControllerB __instance) { ((Component)__instance).gameObject.AddComponent<PlayerControllerCustom>(); } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] [HarmonyPostfix] public static void ConnectClientToPlayerObjectPatch() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown Plugin.mls.LogInfo((object)"ConnectClientToPlayerObjectPatch"); if (NetworkManager.Singleton.IsHost) { Plugin.mls.LogInfo((object)("Registering host config message handler: Junypai.GamblersMod_" + GambleConstants.ON_HOST_RECIEVES_CLIENT_CONFIG_REQUEST)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Junypai.GamblersMod_" + GambleConstants.ON_HOST_RECIEVES_CLIENT_CONFIG_REQUEST, new HandleNamedMessageDelegate(GambleConfigNetworkHelper.OnHostRecievesClientConfigRequest)); } else { NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Junypai.GamblersMod_" + GambleConstants.ON_CLIENT_RECIEVES_HOST_CONFIG_REQUEST, new HandleNamedMessageDelegate(GambleConfigNetworkHelper.OnClientRecievesHostConfigRequest)); GambleConfigNetworkHelper.StartClientRequestConfigFromHost(); } } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { public static RoundManagerCustom RoundManagerCustom; [HarmonyPatch("Awake")] [HarmonyPostfix] public static void AwakePatch(RoundManager __instance) { Plugin.mls.LogInfo((object)"RoundManagerPatch has awoken"); RoundManagerCustom = ((Component)__instance).gameObject.AddComponent<RoundManagerCustom>(); } [HarmonyPatch("LoadNewLevelWait")] [HarmonyPrefix] public static void LoadNewLevelWaitPatch(RoundManager __instance) { Plugin.mls.LogInfo((object)"FinishGeneratingNewLevelServerRpcPatch was called"); if (__instance.currentLevel.levelID != 3 && Object.op_Implicit((Object)(object)RoundManagerCustom.GamblingMachine)) { Plugin.mls.LogInfo((object)"Despawning gambling machine..."); RoundManagerCustom.DespawnGamblingMachineServerRpc(); } if (__instance.currentLevel.levelID == 3 && !Object.op_Implicit((Object)(object)RoundManagerCustom.GamblingMachine)) { Plugin.mls.LogInfo((object)"Spawning gambling machine..."); RoundManagerCustom.SpawnGamblingMachineServerRpc(); } } } } namespace GamblersMod.config { public class GambleConfigNetworkHelper { public static void OnHostRecievesClientConfigRequest(ulong clientId, FastBufferReader _) { //IL_0061: 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_007f: 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_00cd: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsHost) { return; } Plugin.mls.LogInfo((object)"Host recieved client config request."); Plugin.mls.LogInfo((object)"Serializing host config data..."); byte[] serializedSettings = SerializerHelper.GetSerializedSettings(Plugin.CurrentUserConfig); Plugin.mls.LogInfo((object)"Start writing host config data..."); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(serializedSettings.Length + 4, (Allocator)2, -1); FastBufferWriter val2 = val; try { Plugin.mls.LogInfo((object)"Writing host config data"); int num = serializedSettings.Length; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(serializedSettings, -1, 0); Plugin.mls.LogInfo((object)$"Sending host config data to client with id of {clientId}..."); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Junypai.GamblersMod_" + GambleConstants.ON_CLIENT_RECIEVES_HOST_CONFIG_REQUEST, clientId, val, (NetworkDelivery)4); } finally { ((IDisposable)(FastBufferWriter)(ref val2)).Dispose(); } } public static void StartClientRequestConfigFromHost() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsClient) { Plugin.mls.LogInfo((object)"Client is requesting configuration from host"); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Junypai.GamblersMod_" + GambleConstants.ON_HOST_RECIEVES_CLIENT_CONFIG_REQUEST, 0uL, val, (NetworkDelivery)3); } } public static void OnClientRecievesHostConfigRequest(ulong _, FastBufferReader reader) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) Plugin.mls.LogInfo((object)"Client recieved configuration message from host"); if (!((FastBufferReader)(ref reader)).TryBeginRead(4)) { Plugin.mls.LogError((object)"Could not sync client configuration with host. The stream sent by StartClientRequestConfigFromHost was invalid."); return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (!((FastBufferReader)(ref reader)).TryBeginRead(num)) { Plugin.mls.LogError((object)"Could not sync client configuration with host. Host could not serialize the data."); } byte[] settingsAsBytes = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref settingsAsBytes, num, 0); Plugin.RecentHostConfig = SerializerHelper.GetDeserializedSettings<GambleConfigSettingsSerializable>(settingsAsBytes); Plugin.CurrentUserConfig = Plugin.RecentHostConfig; Plugin.CurrentUserConfig.configGamblingMusicEnabled = Plugin.UserConfigSnapshot.configGamblingMusicEnabled; Plugin.CurrentUserConfig.configGamblingMusicVolume = Plugin.UserConfigSnapshot.configGamblingMusicVolume; ManualLogSource mls = Plugin.mls; mls.LogInfo((object)$"Jackpot chance value from config: {Plugin.CurrentUserConfig.configJackpotChance}"); mls.LogInfo((object)$"Triple chance value from config: {Plugin.CurrentUserConfig.configTripleChance}"); mls.LogInfo((object)$"Double chance value from config: {Plugin.CurrentUserConfig.configDoubleChance}"); mls.LogInfo((object)$"Halve chance value from config: {Plugin.CurrentUserConfig.configHalveChance}"); mls.LogInfo((object)$"Zero chance value from config: {Plugin.CurrentUserConfig.configZeroChance}"); mls.LogInfo((object)$"Jackpot multiplier value from config: {Plugin.CurrentUserConfig.configJackpotMultiplier}"); mls.LogInfo((object)$"Triple multiplier value from config: {Plugin.CurrentUserConfig.configTripleMultiplier}"); mls.LogInfo((object)$"Double multiplier value from config: {Plugin.CurrentUserConfig.configDoubleMultiplier}"); mls.LogInfo((object)$"Halve multiplier value from config: {Plugin.CurrentUserConfig.configHalveMultiplier}"); mls.LogInfo((object)$"Zero multiplier value from config: {Plugin.CurrentUserConfig.configZeroMultiplier}"); mls.LogInfo((object)$"Audio enabled from config: {Plugin.CurrentUserConfig.configGamblingMusicEnabled}"); mls.LogInfo((object)$"Audio volume from config: {Plugin.CurrentUserConfig.configGamblingMusicVolume}"); Plugin.mls.LogInfo((object)"Successfully synced a client with host configuration"); } } public class GambleConstants { [StructLayout(LayoutKind.Sequential, Size = 1)] public struct GamblingOutcome { public static string JACKPOT = "JACKPOT"; public static string TRIPLE = "TRIPLE"; public static string DOUBLE = "DOUBLE"; public static string HALVE = "HALVE"; public static string REMOVE = "REMOVE"; public static string DEFAULT = "DEFAULT"; } public static readonly string GAMBLING_CHANCE_SECTION_KEY = "Gambling Chances"; public static readonly string GAMBLING_MULTIPLIERS_SECTION_KEY = "Gambling Multipliers"; public static readonly string GAMBLING_AUDIO_SECTION_KEY = "Audio"; public static readonly string CONFIG_JACKPOT_CHANCE_KEY = "JackpotChance"; public static readonly string CONFIG_TRIPLE_CHANCE_KEY = "TripleChance"; public static readonly string CONFIG_DOUBLE_CHANCE_KEY = "DoubleChance"; public static readonly string CONFIG_HALVE_CHANCE_KEY = "HalveChance"; public static readonly string CONFIG_ZERO_CHANCE_KEY = "ZeroChance"; public static readonly string CONFIG_JACKPOT_MULTIPLIER = "JackpotMultiplier"; public static readonly string CONFIG_TRIPLE_MULTIPLIER = "TripleMultiplier"; public static readonly string CONFIG_DOUBLE_MULTIPLIER = "DoubleMultiplier"; public static readonly string CONFIG_HALVE_MULTIPLIER = "HalveMultiplier"; public static readonly string CONFIG_ZERO_MULTIPLIER = "ZeroMultiplier"; public static readonly string CONFIG_GAMBLING_MUSIC_ENABLED = "GambleMachineMusicEnabled"; public static readonly string CONFIG_GAMBLING_MUSIC_VOLUME = "GambleMachineMusicVolume"; public static readonly string ON_HOST_RECIEVES_CLIENT_CONFIG_REQUEST = "OnHostRecievesClientConfigRequest"; public static readonly string ON_CLIENT_RECIEVES_HOST_CONFIG_REQUEST = "OnClientRecievesHostConfigRequest"; } [Serializable] public class GambleConfigSettingsSerializable { public int configJackpotChance; public int configTripleChance; public int configDoubleChance; public int configHalveChance; public int configZeroChance; public int configJackpotMultiplier; public int configTripleMultiplier; public int configDoubleMultiplier; public float configHalveMultiplier; public int configZeroMultiplier; public bool configGamblingMusicEnabled; public float configGamblingMusicVolume; public GambleConfigSettingsSerializable(ConfigFile configFile) { configFile.Bind<int>(GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_JACKPOT_CHANCE_KEY, 3, "Chance to roll a jackpot. Ex. If set to 3, you have a 3% chance to get a jackpot. Make sure ALL your chance values add up to 100 or else the math won't make sense!"); configFile.Bind<int>(GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_TRIPLE_CHANCE_KEY, 11, "Chance to roll a triple. Ex. If set to 11, you have a 11% chance to get a triple. Make sure ALL your chance values add up to 100 or else the math won't make sense!"); configFile.Bind<int>(GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_DOUBLE_CHANCE_KEY, 30, "Chance to roll a double. Ex. If set to 27, you have a 27% chance to get a double. Make sure ALL your chance values add up to 100 or else the math won't make sense!"); configFile.Bind<int>(GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_HALVE_CHANCE_KEY, 47, "Chance to roll a halve. Ex. If set to 47, you have a 47% chance to get a halve. Make sure ALL your chance values add up to 100 or else the math won't make sense!"); configFile.Bind<int>(GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_ZERO_CHANCE_KEY, 9, "Chance to roll a zero. Ex. If set to 12, you have a 12% chance to get a zero. Make sure ALL your chance values add up to 100 or else the math won't make sense!"); configFile.Bind<int>(GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_JACKPOT_MULTIPLIER, 10, "Jackpot multiplier"); configFile.Bind<int>(GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_TRIPLE_MULTIPLIER, 3, "Triple multiplier"); configFile.Bind<int>(GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_DOUBLE_MULTIPLIER, 2, "Double multiplier"); configFile.Bind<float>(GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_HALVE_MULTIPLIER, 0.5f, "Halve multiplier"); configFile.Bind<int>(GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_ZERO_MULTIPLIER, 0, "Zero multiplier"); configFile.Bind<bool>(GambleConstants.GAMBLING_AUDIO_SECTION_KEY, GambleConstants.CONFIG_GAMBLING_MUSIC_ENABLED, true, "Enable gambling machine music (CLIENT SIDE)"); configFile.Bind<float>(GambleConstants.GAMBLING_AUDIO_SECTION_KEY, GambleConstants.CONFIG_GAMBLING_MUSIC_VOLUME, 0.35f, "Gambling machine music volume (CLIENT SIDE)"); configJackpotChance = GetConfigFileKeyValue<int>(configFile, GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_JACKPOT_CHANCE_KEY); configTripleChance = GetConfigFileKeyValue<int>(configFile, GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_TRIPLE_CHANCE_KEY); configDoubleChance = GetConfigFileKeyValue<int>(configFile, GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_DOUBLE_CHANCE_KEY); configHalveChance = GetConfigFileKeyValue<int>(configFile, GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_HALVE_CHANCE_KEY); configZeroChance = GetConfigFileKeyValue<int>(configFile, GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_ZERO_CHANCE_KEY); configJackpotMultiplier = GetConfigFileKeyValue<int>(configFile, GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_JACKPOT_MULTIPLIER); configTripleMultiplier = GetConfigFileKeyValue<int>(configFile, GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_TRIPLE_MULTIPLIER); configDoubleMultiplier = GetConfigFileKeyValue<int>(configFile, GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_DOUBLE_MULTIPLIER); configHalveMultiplier = GetConfigFileKeyValue<float>(configFile, GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_HALVE_MULTIPLIER); configZeroMultiplier = GetConfigFileKeyValue<int>(configFile, GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_ZERO_MULTIPLIER); configGamblingMusicEnabled = GetConfigFileKeyValue<bool>(configFile, GambleConstants.GAMBLING_AUDIO_SECTION_KEY, GambleConstants.CONFIG_GAMBLING_MUSIC_ENABLED); configGamblingMusicVolume = GetConfigFileKeyValue<float>(configFile, GambleConstants.GAMBLING_AUDIO_SECTION_KEY, GambleConstants.CONFIG_GAMBLING_MUSIC_VOLUME); LogInitializedConfigsValues(); } private void LogInitializedConfigsValues() { ManualLogSource mls = Plugin.mls; mls.LogInfo((object)$"Jackpot chance value from config: {configJackpotChance}"); mls.LogInfo((object)$"Triple chance value from config: {configTripleChance}"); mls.LogInfo((object)$"Double chance value from config: {configDoubleChance}"); mls.LogInfo((object)$"Halve chance value from config: {configHalveChance}"); mls.LogInfo((object)$"Zero chance value from config: {configZeroChance}"); mls.LogInfo((object)$"Jackpot multiplier value from config: {configJackpotMultiplier}"); mls.LogInfo((object)$"Triple multiplier value from config: {configTripleMultiplier}"); mls.LogInfo((object)$"Double multiplier value from config: {configDoubleMultiplier}"); mls.LogInfo((object)$"Halve multiplier value from config: {configHalveMultiplier}"); mls.LogInfo((object)$"Zero multiplier value from config: {configZeroMultiplier}"); mls.LogInfo((object)$"gambling music enabled from config: {configGamblingMusicEnabled}"); mls.LogInfo((object)$"gambling music volume from config: {configGamblingMusicVolume}"); } private T GetConfigFileKeyValue<T>(ConfigFile configFile, string section, string key) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown ConfigDefinition val = new ConfigDefinition(section, key); Plugin.mls.LogInfo((object)("Getting configuration entry: Section: " + section + " Key: " + key)); ConfigEntry<T> val2 = default(ConfigEntry<T>); if (!configFile.TryGetEntry<T>(val, ref val2)) { Plugin.mls.LogError((object)("Failed to get configuration value. Section: " + section + " Key: " + key)); } return val2.Value; } } internal class SerializerHelper { public static byte[] GetSerializedSettings<T>(T valToSerialize) { MemoryStream memoryStream = new MemoryStream(); BinaryFormatter binaryFormatter = new BinaryFormatter(); try { binaryFormatter.Serialize(memoryStream, valToSerialize); } catch (SerializationException ex) { Plugin.mls.LogError((object)("Config serialization failed: " + ex.Message)); } byte[] result = memoryStream.ToArray(); memoryStream.Close(); return result; } public static T GetDeserializedSettings<T>(byte[] settingsAsBytes) { MemoryStream memoryStream = new MemoryStream(); memoryStream.Write(settingsAsBytes, 0, settingsAsBytes.Length); memoryStream.Seek(0L, SeekOrigin.Begin); BinaryFormatter binaryFormatter = new BinaryFormatter(); try { object obj = binaryFormatter.Deserialize(memoryStream); memoryStream.Close(); return (T)obj; } catch (SerializationException ex) { Plugin.mls.LogError((object)("Config deserialization failed: " + ex.Message)); } memoryStream.Close(); return default(T); } } }
LethalPresents.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalPresents")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("LethalPresents mod")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.3")] [assembly: AssemblyProduct("LethalPresents")] [assembly: AssemblyTitle("LethalPresents")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalPresents { [BepInPlugin("LethalPresents", "LethalPresents", "1.0.3")] public class LethalPresentsPlugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("LethalPresents"); private static bool isHost; private static SelectableLevel currentLevel; public static ManualLogSource mls; private static int spawnChance = 5; private static string[] disabledEnemies = new string[0]; private static bool IsAllowlist = false; private static bool ShouldSpawnMines = false; private static bool ShouldSpawnTurrets = false; private void Awake() { mls = Logger.CreateLogSource("LethalPresents"); mls.LogInfo((object)"Plugin LethalPresents is loaded!"); loadConfig(); harmony.PatchAll(typeof(LethalPresentsPlugin)); } private void loadConfig() { spawnChance = ((BaseUnityPlugin)this).Config.Bind<int>("General", "SpawnChance", 5, "Chance of spawning an enemy when opening a present [0-100]").Value; disabledEnemies = ((BaseUnityPlugin)this).Config.Bind<string>("General", "EnemyBlocklist", "", "Enemy blocklist separated by , and without whitespaces").Value.Split(","); IsAllowlist = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "IsAllowlist", false, "Turns blocklist into allowlist, blocklist must contain at least one inside and one outside enemy, use at your own risk").Value; ShouldSpawnMines = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShouldSpawnMines", true, "Add mines to the spawn pool [WIP]").Value; ShouldSpawnTurrets = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShouldSpawnTurrets", true, "Add turrets to the spawn pool [WIP]").Value; } [HarmonyPatch(typeof(RoundManager), "Start")] [HarmonyPrefix] private static void setIsHost() { isHost = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost; } [HarmonyPatch(typeof(RoundManager), "AdvanceHourAndSpawnNewBatchOfEnemies")] [HarmonyPrefix] private static void updateCurrentLevelInfo(ref EnemyVent[] ___allEnemyVents, ref SelectableLevel ___currentLevel) { currentLevel = ___currentLevel; mls.LogInfo((object)"List of spawnable enemies (inside):"); currentLevel.Enemies.ForEach(delegate(SpawnableEnemyWithRarity e) { mls.LogInfo((object)((Object)e.enemyType).name); }); mls.LogInfo((object)"List of spawnable enemies (outside):"); currentLevel.OutsideEnemies.ForEach(delegate(SpawnableEnemyWithRarity e) { mls.LogInfo((object)((Object)e.enemyType).name); }); } private static void chooseAndSpawnEnemy(bool inside, Vector3 pos, Vector3 player_pos) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) ManualLogSource obj = mls; Vector3 val = player_pos; obj.LogInfo((object)("Player pos " + ((object)(Vector3)(ref val)).ToString())); List<SpawnableEnemyWithRarity> list = currentLevel.Enemies.Where((SpawnableEnemyWithRarity e) => disabledEnemies.Contains(e.enemyType.enemyName) ? IsAllowlist : (!IsAllowlist)).ToList(); List<SpawnableEnemyWithRarity> list2 = currentLevel.OutsideEnemies.Where((SpawnableEnemyWithRarity e) => disabledEnemies.Contains(e.enemyType.enemyName) ? IsAllowlist : (!IsAllowlist)).ToList(); int num = Random.Range(1, 2 + (list2.Count + list.Count) / 2); if (num == 2 && !ShouldSpawnMines) { num = 1; } if (num == 1 && !ShouldSpawnTurrets) { num = 2; } if (num == 2 && !ShouldSpawnMines) { num = 3; } switch (num) { case 1: { SpawnableMapObject[] spawnableMapObjects2 = currentLevel.spawnableMapObjects; foreach (SpawnableMapObject val4 in spawnableMapObjects2) { if (!((Object)(object)val4.prefabToSpawn.GetComponentInChildren<Turret>() == (Object)null)) { pos -= Vector3.up * 1.8f; GameObject val5 = Object.Instantiate<GameObject>(val4.prefabToSpawn, pos, Quaternion.identity); val5.transform.position = pos; Transform transform = val5.transform; val = player_pos - pos; transform.forward = ((Vector3)(ref val)).normalized; val5.GetComponent<NetworkObject>().Spawn(true); ManualLogSource obj3 = mls; val = pos; obj3.LogInfo((object)("Tried spawning a turret at " + ((object)(Vector3)(ref val)).ToString())); break; } } return; } case 2: { SpawnableMapObject[] spawnableMapObjects = currentLevel.spawnableMapObjects; foreach (SpawnableMapObject val2 in spawnableMapObjects) { if (!((Object)(object)val2.prefabToSpawn.GetComponentInChildren<Landmine>() == (Object)null)) { pos -= Vector3.up * 1.8f; GameObject val3 = Object.Instantiate<GameObject>(val2.prefabToSpawn, pos, Quaternion.identity); val3.transform.position = pos; val3.transform.forward = new Vector3(1f, 0f, 0f); val3.GetComponent<NetworkObject>().Spawn(true); ManualLogSource obj2 = mls; val = pos; obj2.LogInfo((object)("Tried spawning a mine at " + ((object)(Vector3)(ref val)).ToString())); break; } } return; } } SpawnableEnemyWithRarity val6; if (inside) { if (list.Count < 1) { mls.LogInfo((object)"Cant spawn enemy - no other enemies present to copy from"); return; } val6 = list[Random.Range(0, list.Count - 1)]; } else { if (list2.Count < 1) { mls.LogInfo((object)"Cant spawn enemy - no other enemies present to copy from"); return; } val6 = list2[Random.Range(0, list2.Count - 1)]; } pos += Vector3.up * 0.25f; ManualLogSource obj4 = mls; string enemyName = val6.enemyType.enemyName; val = pos; obj4.LogInfo((object)("Spawning " + enemyName + " at " + ((object)(Vector3)(ref val)).ToString())); SpawnEnemy(val6, pos, 0f); } [HarmonyPatch(typeof(GiftBoxItem), "OpenGiftBoxServerRpc")] [HarmonyPrefix] private static void spawnRandomEntity(GiftBoxItem __instance) { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } int value = Traverse.Create((object)__instance).Field("__rpc_exec_stage").GetValue<int>(); mls.LogInfo((object)("IsServer:" + networkManager.IsServer + " IsHost:" + networkManager.IsHost + " __rpc_exec_stage:" + value)); if (value == 1 && isHost) { int num = Random.Range(1, 100); mls.LogInfo((object)("Player's fortune:" + num)); if (num < spawnChance) { chooseAndSpawnEnemy(((GrabbableObject)__instance).isInFactory, ((Component)__instance).transform.position, ((Component)Traverse.Create((object)__instance).Field("previousPlayerHeldBy").GetValue<PlayerControllerB>()).transform.position); } } } private static void SpawnEnemy(SpawnableEnemyWithRarity enemy, Vector3 pos, float rot) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) RoundManager.Instance.SpawnEnemyGameObject(pos, rot, -1, enemy.enemyType); } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalPresents"; public const string PLUGIN_NAME = "LethalPresents"; public const string PLUGIN_VERSION = "1.0.3"; } }
NeutronStarSample.dll
Decompiled 2 years agousing System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using LethalLib.Modules; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("NeutronStarSample")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NeutronStarSample")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f60b80b1-a5ce-484d-9415-11dd066f8999")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace NeutronStarSample; [BepInPlugin("nihl.NeutronStarSample", "NeutronStarSample", "1.0.0.0")] public class NeutronStarSampleBase : BaseUnityPlugin { private const string modGUID = "nihl.NeutronStarSample"; private const string modName = "NeutronStarSample"; private const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("nihl.NeutronStarSample"); private static NeutronStarSampleBase instance; internal ManualLogSource MLS; private void Awake() { if ((Object)(object)instance == (Object)null) { instance = this; } MLS = Logger.CreateLogSource("nihl.NeutronStarSample"); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "NeutronStarSample")); Item val2 = val.LoadAsset<Item>("Assets/NeutronStarSample.asset"); if ((Object)(object)val2 == (Object)null) { MLS.LogInfo((object)"Failed to load Star prefab,"); } else { NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Items.RegisterScrap(val2, 3, (LevelTypes)510); } MLS.LogInfo((object)"NeutronStarSample Loaded!"); } }
Skibidi.AI.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Animations.Rigging; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Skibidi.AI")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Skibidi.AI")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("597be394-0d5f-4dbb-ad1d-4d432b1b4802")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Skibidi.AI { public class SkibidiAI : JesterAI { private int prevState = 0; public TwoBoneIKConstraint headIK; public AudioClip tauntClip; private float flushTime; public override void Start() { ((JesterAI)this).Start(); Debug.Log((object)"Spawning le skibidi. beware."); } public virtual void EvtFlush() { Debug.Log((object)"Flushing!"); ((EnemyAI)this).SwitchToBehaviourState(0); } public override void Update() { if (((EnemyAI)this).isEnemyDead) { return; } switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: if (prevState != 0) { ((EnemyAI)this).creatureAnimator.SetBool("flushed", true); ((EnemyAI)this).creatureVoice.Stop(true); ((EnemyAI)this).creatureVoice.PlayOneShot(((EnemyAI)this).enemyType.stunSFX); flushTime = Time.time; } ((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight = Mathf.Lerp(((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight, 0f, Time.deltaTime * 5f); break; case 1: if (prevState != 1) { ((EnemyAI)this).creatureAnimator.SetBool("flushed", false); base.farAudio.PlayOneShot(tauntClip); } ((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight = Mathf.Lerp(((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight, 1f, Time.deltaTime * 5f); break; case 2: if (prevState != 2) { ((EnemyAI)this).creatureAnimator.SetBool("flushed", false); } ((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight = Mathf.Lerp(((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight, 1f, Time.deltaTime * 5f); break; } prevState = ((EnemyAI)this).currentBehaviourStateIndex; if (((EnemyAI)this).currentBehaviourStateIndex != 0 || !(Time.time - flushTime < 15f)) { ((JesterAI)this).Update(); ((EnemyAI)this).agent.speed = Mathf.Clamp(((EnemyAI)this).agent.speed, 0f, 7.5f); if (base.popUpTimer > 10f) { base.popUpTimer = 10f; } } } } public class SkibidiSFX : MonoBehaviour { public SkibidiAI enemy; public AudioClip brrClip; public AudioClip skibidiClip; public float skibidiRamp = 0f; public virtual void PlayBrrSFX() { if (skibidiRamp > 1f) { skibidiRamp = 1f; } ((JesterAI)enemy).farAudio.pitch = 1f + skibidiRamp; ((JesterAI)enemy).farAudio.PlayOneShot(brrClip); skibidiRamp += 0.02f; } public virtual void PlaySkibidiSFX() { ((JesterAI)enemy).farAudio.pitch = 1f; skibidiRamp = 0f; ((EnemyAI)enemy).creatureVoice.PlayOneShot(skibidiClip); } } }
Skibidi.dll
Decompiled 2 years 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 LethalLib.Modules; using Microsoft.CodeAnalysis; using Skibidi.AI; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyCompany("Skibidi")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Skibidi Toilet core")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Skibidi")] [assembly: AssemblyTitle("Skibidi")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Skibidi { public static class Assets { public static string mainAssetBundleName = "skibidibundle"; public static AssetBundle MainAssetBundle = null; private static string GetAssemblyName() { return Assembly.GetExecutingAssembly().FullName.Split(',')[0]; } public static void PopulateAssets() { if ((Object)(object)MainAssetBundle == (Object)null) { using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName)) { MainAssetBundle = AssetBundle.LoadFromStream(stream); } } } } [BepInPlugin("rileyzzz.Skibidi", "Skibidi Toilet", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private void Awake() { Assets.PopulateAssets(); EnemyType val = Assets.MainAssetBundle.LoadAsset<EnemyType>("SkibidiDef"); TerminalNode val2 = Assets.MainAssetBundle.LoadAsset<TerminalNode>("SkibidiFile"); TerminalKeyword val3 = Assets.MainAssetBundle.LoadAsset<TerminalKeyword>("Skibidi"); NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); Type typeFromHandle = typeof(SkibidiAI); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Skibidi AI {typeFromHandle}"); Enemies.RegisterEnemy(val, 22, (LevelTypes)(-1), (SpawnType)0, val2, val3); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Skibidi is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "Skibidi"; public const string PLUGIN_NAME = "Skibidi"; public const string PLUGIN_VERSION = "1.0.0"; } }