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 GamblerExtras v1.0.1
GamblerExtras.dll
Decompiled a year 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.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Modules; using RepoDice; using RepoDice.Effects; using UnityEngine; using UnityEngine.AI; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace GamblerExtras { [BepInPlugin("ZeroTails.GamblerExtras", "Gambler Extras", "1.0.1")] public class GamblerExtras : BaseUnityPlugin { private static GamblerExtras? Instance; private static ManualLogSource? _logger; private Harmony? _harmony; private ConfigEntry<bool>? _enableTeleportValuablesToTruck; private ConfigEntry<bool>? _enableTeleportPlayerToExtraction; private ConfigEntry<bool>? _enableTeleportAllPlayersToExtraction; private ConfigEntry<bool>? _enableTeleportEnemiesToPlayer; private ConfigEntry<bool>? _enableKillAllEnemies; private ConfigEntry<bool>? _enableSpawnCart; private ConfigEntry<bool>? _enableRandomizeEnemyScale; private ConfigEntry<bool>? _enableLowGravity; private ConfigEntry<bool>? _enableRechargeAllBatteries; private ConfigEntry<bool>? _enableSpawnHealthPacks; private const string HEALTH_PACK_ITEM_NAME = "Item Health Pack Small"; private void Awake() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown Instance = this; _logger = ((BaseUnityPlugin)this).Logger; _logger.LogInfo((object)"GamblerExtras v1.0.0 is loading..."); SetupConfig(); _harmony = new Harmony("ZeroTails.GamblerExtras"); _harmony.PatchAll(); RegisterEffects(); _logger.LogInfo((object)"GamblerExtras v1.0.0 has been loaded!"); } private void SetupConfig() { _enableTeleportValuablesToTruck = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Enable Teleport Valuables To Truck", true, "Enables the effect that teleports all valuables to the truck"); _enableTeleportPlayerToExtraction = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Enable Teleport Player To Extraction", true, "Enables the effect that teleports the player to a random extraction point"); _enableTeleportAllPlayersToExtraction = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Enable Teleport All Players To Extraction", true, "Enables the effect that teleports all players to random extraction points"); _enableTeleportEnemiesToPlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Enable Teleport Enemies To Player", true, "Enables the effect that teleports all enemies to the player"); _enableKillAllEnemies = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Enable Kill All Enemies", true, "Enables the effect that kills all enemies in the level"); _enableSpawnCart = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Enable Spawn Cart", true, "Enables the effect that spawns a new C.A.R.T. near the player"); _enableRandomizeEnemyScale = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Enable Randomize Enemy Scale", true, "Enables the effect that randomizes the scale of all enemies"); _enableLowGravity = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Enable Low Gravity", true, "Enables the effect that lowers gravity for all players"); _enableRechargeAllBatteries = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Enable Recharge All Batteries", true, "Enables the effect that recharges all batteries in the level"); _enableSpawnHealthPacks = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Enable Spawn Health Packs", true, "Enables the effect that spawns health packs near the player"); } private void RegisterEffects() { Type typeFromHandle = typeof(RepoDice); MethodInfo method = typeFromHandle.GetMethod("MainRegisterNewEffect", BindingFlags.Static | BindingFlags.NonPublic); if (method == null) { ManualLogSource? logger = _logger; if (logger != null) { logger.LogError((object)"Could not find MainRegisterNewEffect method via reflection. Effects will not be registered."); } return; } ConfigEntry<bool>? enableTeleportValuablesToTruck = _enableTeleportValuablesToTruck; if (enableTeleportValuablesToTruck != null && enableTeleportValuablesToTruck.Value) { method.Invoke(null, new object[3] { new TeleportValuablesToTruck(), false, false }); } ConfigEntry<bool>? enableTeleportPlayerToExtraction = _enableTeleportPlayerToExtraction; if (enableTeleportPlayerToExtraction != null && enableTeleportPlayerToExtraction.Value) { method.Invoke(null, new object[3] { new TeleportPlayerToExtraction(), false, false }); } ConfigEntry<bool>? enableTeleportAllPlayersToExtraction = _enableTeleportAllPlayersToExtraction; if (enableTeleportAllPlayersToExtraction != null && enableTeleportAllPlayersToExtraction.Value) { method.Invoke(null, new object[3] { new TeleportAllPlayersToExtraction(), false, false }); } ConfigEntry<bool>? enableKillAllEnemies = _enableKillAllEnemies; if (enableKillAllEnemies != null && enableKillAllEnemies.Value) { method.Invoke(null, new object[3] { new KillAllEnemies(), false, false }); } ConfigEntry<bool>? enableSpawnCart = _enableSpawnCart; if (enableSpawnCart != null && enableSpawnCart.Value) { method.Invoke(null, new object[3] { new SpawnCart(), false, false }); } ConfigEntry<bool>? enableRandomizeEnemyScale = _enableRandomizeEnemyScale; if (enableRandomizeEnemyScale != null && enableRandomizeEnemyScale.Value) { method.Invoke(null, new object[3] { new RandomizeEnemyScale(), false, false }); } ConfigEntry<bool>? enableLowGravity = _enableLowGravity; if (enableLowGravity != null && enableLowGravity.Value) { method.Invoke(null, new object[3] { new LowGravity(), false, false }); } ConfigEntry<bool>? enableRechargeAllBatteries = _enableRechargeAllBatteries; if (enableRechargeAllBatteries != null && enableRechargeAllBatteries.Value) { method.Invoke(null, new object[3] { new RechargeAllBatteries(), false, false }); } ConfigEntry<bool>? enableSpawnHealthPacks = _enableSpawnHealthPacks; if (enableSpawnHealthPacks != null && enableSpawnHealthPacks.Value) { method.Invoke(null, new object[3] { new SpawnHealthPacks(), false, false }); } ManualLogSource? logger2 = _logger; if (logger2 != null) { logger2.LogInfo((object)"Registered all GamblerExtras effects with RepoDice"); } } public static void Log(string message, LogLevel level = 16) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (_logger != null) { _logger.Log(level, (object)("[GamblerExtras] " + message)); } } } public class TeleportValuablesToTruck : IEffect { private class TeleportTimer : MonoBehaviour { private float _timeRemaining; private PlayerAvatar? _roller; private bool _hasTeleported = false; private bool _hasRedistributedValue = false; private float _redistributionTimeRemaining; public void Initialize(float duration, PlayerAvatar roller) { _timeRemaining = duration; _roller = roller; _hasTeleported = false; _hasRedistributedValue = false; _redistributionTimeRemaining = 10f; } private void Update() { if (!_hasTeleported) { _timeRemaining -= Time.deltaTime; if (!(_timeRemaining <= 0f)) { return; } PerformTeleport(); _hasTeleported = true; _redistributionTimeRemaining = 10f; _valuableForRedistribution.Clear(); ValuableObject[] array = Object.FindObjectsOfType<ValuableObject>(true); ValuableObject[] array2 = array; foreach (ValuableObject val in array2) { if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy) { _valuableForRedistribution.Add(val); } } GamblerExtras.Log($"Found {_valuableForRedistribution.Count} valuables for value redistribution", (LogLevel)16); } else if (!_hasRedistributedValue) { _redistributionTimeRemaining -= Time.deltaTime; if (_redistributionTimeRemaining <= 0f) { RedistributeValue(); _hasRedistributedValue = true; Object.Destroy((Object)(object)((Component)this).gameObject); } } } private void PerformTeleport() { //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) LevelGenerator instance = LevelGenerator.Instance; object obj; if (instance == null) { obj = null; } else { LevelPoint levelPathTruck = instance.LevelPathTruck; obj = ((levelPathTruck != null) ? ((Component)levelPathTruck).transform : null); } if ((Object)obj == (Object)null) { GamblerExtras.Log("Truck not found, cannot teleport valuables", (LogLevel)4); return; } GamblerExtras.Log($"Beginning teleport of {_pendingTeleport.Count} valuables to truck", (LogLevel)16); int num = 0; foreach (ValuableObject item in _pendingTeleport.ToList()) { try { if ((Object)(object)item == (Object)null) { GamblerExtras.Log("Skipping null valuable", (LogLevel)4); continue; } if ((Object)(object)item.photonView == (Object)null) { GamblerExtras.Log("Skipping valuable " + ((Object)item).name + " - no photonView", (LogLevel)4); continue; } if ((Object)(object)item.roomVolumeCheck != (Object)null && item.roomVolumeCheck.inExtractionPoint) { GamblerExtras.Log("Skipping valuable " + ((Object)item).name + " - already in extraction point", (LogLevel)32); continue; } Vector3 val = ((Component)LevelGenerator.Instance.LevelPathTruck).transform.position + new Vector3(Random.Range(-1f, 1f), 1f, Random.Range(-1f, 1f)); GamblerExtras.Log($"Teleporting {((Object)item).name} to position {val}", (LogLevel)32); if (SemiFunc.IsMultiplayer()) { if (SemiFunc.IsMasterClientOrSingleplayer()) { GamblerExtras.Log("Teleporting valuable " + ((Object)item).name + " in multiplayer", (LogLevel)32); ((Component)item).transform.position = val; ((Component)item).transform.rotation = Quaternion.identity; Rigidbody component = ((Component)item).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; component.position = val; component.rotation = Quaternion.identity; } if ((Object)(object)Networker.Instance != (Object)null && (Object)(object)item.photonView != (Object)null) { GamblerExtras.Log($"Using Networker to teleport {((Object)item).name} (ViewID: {item.photonView.ViewID})", (LogLevel)32); try { ((MonoBehaviourPun)Networker.Instance).photonView.RPC("TeleportObjectRPC", (RpcTarget)1, new object[3] { item.photonView.ViewID, val, Quaternion.identity }); } catch (Exception ex) { GamblerExtras.Log("RPC error: " + ex.Message, (LogLevel)2); } } if ((Object)(object)item.photonView != (Object)null && item.photonView.Owner != null && item.photonView.Owner != PhotonNetwork.LocalPlayer) { GamblerExtras.Log("Transferring ownership of " + ((Object)item).name, (LogLevel)32); item.photonView.TransferOwnership(PhotonNetwork.LocalPlayer); } if ((Object)(object)item.roomVolumeCheck != (Object)null) { item.roomVolumeCheck.CheckSet(); } } } else { GamblerExtras.Log("Teleporting valuable " + ((Object)item).name + " in single player", (LogLevel)32); ((Component)item).transform.position = val; ((Component)item).transform.rotation = Quaternion.identity; Rigidbody component2 = ((Component)item).GetComponent<Rigidbody>(); if ((Object)(object)component2 != (Object)null) { component2.velocity = Vector3.zero; component2.angularVelocity = Vector3.zero; } if ((Object)(object)item.roomVolumeCheck != (Object)null) { item.roomVolumeCheck.CheckSet(); } } num++; GamblerExtras.Log("Successfully teleported " + ((Object)item).name, (LogLevel)32); } catch (Exception ex2) { GamblerExtras.Log("Error teleporting valuable: " + ex2.Message, (LogLevel)2); } } GamblerExtras.Log($"Teleported {num} valuables to the truck", (LogLevel)16); _pendingTeleport.Clear(); } private void RedistributeValue() { //IL_03ad: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer()) { GamblerExtras.Log("Only master client can redistribute value", (LogLevel)4); return; } try { float num = 0f; Dictionary<ValuableObject, float> dictionary = new Dictionary<ValuableObject, float>(); foreach (ValuableObject item in _valuableForRedistribution) { if (!((Object)(object)item == (Object)null) && ((Component)item).gameObject.activeInHierarchy) { float num2 = (dictionary[item] = GetValuableValue(item)); num += num2; GamblerExtras.Log($"Valuable {((Object)item).name} current value: {num2}", (LogLevel)32); } } GamblerExtras.Log($"Original total value: {_originalTotalValue}, Current total value: {num}", (LogLevel)16); float num3 = _originalTotalValue - num; if (num3 <= 0f) { GamblerExtras.Log("No value deficit to redistribute", (LogLevel)16); return; } GamblerExtras.Log($"Value deficit to redistribute: {num3}", (LogLevel)16); float num4 = 0f; foreach (ValuableObject item2 in _valuableForRedistribution) { if (!((Object)(object)item2 == (Object)null) && ((Component)item2).gameObject.activeInHierarchy) { float num5 = (_originalBaseValues.ContainsKey(item2) ? _originalBaseValues[item2] : (dictionary.ContainsKey(item2) ? dictionary[item2] : 0f)); num4 += num5; } } if (num4 <= 0f) { GamblerExtras.Log("No base value to use for redistribution", (LogLevel)4); return; } int num6 = 0; foreach (ValuableObject item3 in _valuableForRedistribution) { if ((Object)(object)item3 == (Object)null || !((Component)item3).gameObject.activeInHierarchy) { continue; } float num7 = (_originalBaseValues.ContainsKey(item3) ? _originalBaseValues[item3] : (dictionary.ContainsKey(item3) ? dictionary[item3] : 0f)); if (!(num7 <= 0f)) { float num8 = num7 / num4; float num9 = num3 * num8; float num10 = (dictionary.ContainsKey(item3) ? dictionary[item3] : 0f); float num11 = num10 + num9; GamblerExtras.Log($"Valuable {((Object)item3).name}: Original value={num7}, Current value={num10}, " + $"Adding {num9} ({num8 * 100f:F1}% of deficit), New value={num11}", (LogLevel)32); if (SetValuableValue(item3, num11)) { num6++; } else { GamblerExtras.Log("Could not update value for " + ((Object)item3).name, (LogLevel)4); } } } GamblerExtras.Log($"Redistributed value to {num6} valuables to compensate for lost value", (LogLevel)16); if ((Object)(object)Networker.Instance != (Object)null && (Object)(object)_roller != (Object)null) { ((MonoBehaviourPun)Networker.Instance).photonView.RPC("PlayAudioAtPoint", (RpcTarget)0, new object[2] { ((Component)_roller).transform.position, "Good2" }); } } catch (Exception ex) { GamblerExtras.Log("Error redistributing value: " + ex.Message, (LogLevel)2); } } private void OnDestroy() { if (!_hasTeleported && _pendingTeleport.Count > 0) { PerformTeleport(); } if (_hasTeleported && !_hasRedistributedValue && _valuableForRedistribution.Count > 0) { RedistributeValue(); } } } private const float TELEPORT_DELAY = 3f; private const float VALUE_REDISTRIBUTION_DELAY = 10f; private static List<ValuableObject> _pendingTeleport = new List<ValuableObject>(); private static GameObject? _timerObject; private static float _originalTotalValue = 0f; private static Dictionary<ValuableObject, float> _originalBaseValues = new Dictionary<ValuableObject, float>(); private static List<ValuableObject> _valuableForRedistribution = new List<ValuableObject>(); public string Name => "Valuable Vacuum"; public EffectType Outcome => (EffectType)4; public bool ShowDefaultTooltip => true; public string Tooltip => "All valuables will be summoned to the truck in 3 seconds! The total value of all of them together will be preserved through redistribution of value after a delay!"; private static float GetValuableValue(ValuableObject valuable) { if ((Object)(object)valuable == (Object)null) { return 0f; } try { FieldInfo field = ((object)valuable).GetType().GetField("dollarValueCurrent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { GamblerExtras.Log("Found dollarValueCurrent field on " + ((Object)valuable).name, (LogLevel)32); return (float)field.GetValue(valuable); } MethodInfo method = ((object)valuable).GetType().GetMethod("GetValue", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { GamblerExtras.Log("Found GetValue method on " + ((Object)valuable).name, (LogLevel)32); return (float)method.Invoke(valuable, null); } PropertyInfo property = ((object)valuable).GetType().GetProperty("Value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null) { GamblerExtras.Log("Found Value property on " + ((Object)valuable).name, (LogLevel)32); return (float)property.GetValue(valuable); } FieldInfo field2 = ((object)valuable).GetType().GetField("scrapValue", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null) { GamblerExtras.Log("Found scrapValue field on " + ((Object)valuable).name, (LogLevel)32); return (float)field2.GetValue(valuable); } FieldInfo field3 = ((object)valuable).GetType().GetField("value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field3 != null) { GamblerExtras.Log("Found value field on " + ((Object)valuable).name, (LogLevel)32); return (float)field3.GetValue(valuable); } FieldInfo[] fields = ((object)valuable).GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { if (fieldInfo.Name.ToLowerInvariant().Contains("value") && fieldInfo.FieldType == typeof(float)) { GamblerExtras.Log("Found field with 'value' in name: " + fieldInfo.Name + " on " + ((Object)valuable).name, (LogLevel)32); return (float)fieldInfo.GetValue(valuable); } } GamblerExtras.Log("Could not find any value field or property on " + ((Object)valuable).name, (LogLevel)4); return 0f; } catch (Exception ex) { GamblerExtras.Log("Error getting value for " + ((Object)valuable).name + ": " + ex.Message, (LogLevel)2); return 0f; } } private static bool SetValuableValue(ValuableObject valuable, float newValue) { if ((Object)(object)valuable == (Object)null) { return false; } try { bool flag = false; FieldInfo field = ((object)valuable).GetType().GetField("dollarValueCurrent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { field.SetValue(valuable, newValue); flag = true; } if (!flag) { MethodInfo method = ((object)valuable).GetType().GetMethod("SetValue", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(float) }, null); if (method != null) { method.Invoke(valuable, new object[1] { newValue }); flag = true; } } if (!flag) { PropertyInfo property = ((object)valuable).GetType().GetProperty("Value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite) { property.SetValue(valuable, newValue); flag = true; } } if (!flag) { FieldInfo field2 = ((object)valuable).GetType().GetField("scrapValue", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(valuable, newValue); flag = true; } } if (!flag) { FieldInfo field3 = ((object)valuable).GetType().GetField("value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field3 != null) { field3.SetValue(valuable, newValue); flag = true; } } if (!flag) { FieldInfo[] fields = ((object)valuable).GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { if (fieldInfo.Name.ToLowerInvariant().Contains("value") && fieldInfo.FieldType == typeof(float)) { fieldInfo.SetValue(valuable, newValue); flag = true; break; } } } return flag; } catch (Exception ex) { GamblerExtras.Log("Error setting value for " + ((Object)valuable).name + ": " + ex.Message, (LogLevel)2); return false; } } public void Use(PlayerAvatar? roller) { //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Expected O, but got Unknown //IL_0305: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)roller == (Object)null) { GamblerExtras.Log("Roller is null, cannot teleport valuables", (LogLevel)4); return; } LevelGenerator instance = LevelGenerator.Instance; object obj; if (instance == null) { obj = null; } else { LevelPoint levelPathTruck = instance.LevelPathTruck; obj = ((levelPathTruck != null) ? ((Component)levelPathTruck).transform : null); } if ((Object)obj == (Object)null) { GamblerExtras.Log("Truck not found, cannot teleport valuables", (LogLevel)4); return; } if ((Object)(object)_timerObject != (Object)null) { Object.Destroy((Object)(object)_timerObject); } _pendingTeleport.Clear(); _originalBaseValues.Clear(); _valuableForRedistribution.Clear(); _originalTotalValue = 0f; ValuableObject[] array = Object.FindObjectsOfType<ValuableObject>(true); GamblerExtras.Log($"Found {array.Length} valuables in the level", (LogLevel)16); int num = 0; ValuableObject[] array2 = array; foreach (ValuableObject val in array2) { if ((Object)(object)val == (Object)null) { GamblerExtras.Log("Found null valuable", (LogLevel)4); continue; } if ((Object)(object)val.photonView == (Object)null) { GamblerExtras.Log("Skipping valuable " + ((Object)val).name + " - no photonView", (LogLevel)4); continue; } if ((Object)(object)val.roomVolumeCheck != (Object)null && val.roomVolumeCheck.inExtractionPoint) { GamblerExtras.Log("Skipping valuable " + ((Object)val).name + " - already in extraction point", (LogLevel)32); continue; } try { float valuableValue = GetValuableValue(val); if (valuableValue > 0f) { _originalBaseValues[val] = valuableValue; _originalTotalValue += valuableValue; GamblerExtras.Log($"Valuable {((Object)val).name} has base value: {valuableValue}", (LogLevel)32); } _pendingTeleport.Add(val); num++; GamblerExtras.Log("Added valuable " + ((Object)val).name + " to pending teleport list", (LogLevel)32); } catch (Exception ex) { GamblerExtras.Log("Error processing valuable " + ((Object)val).name + ": " + ex.Message, (LogLevel)2); } } GamblerExtras.Log($"Added {num} valuables to teleport list with total value: {_originalTotalValue}", (LogLevel)16); if (num > 0) { _timerObject = new GameObject("ValuableVacuumTimer"); Object.DontDestroyOnLoad((Object)(object)_timerObject); TeleportTimer teleportTimer = _timerObject.AddComponent<TeleportTimer>(); teleportTimer.Initialize(3f, roller); GamblerExtras.Log($"Created teleport timer - teleporting in {3f} seconds", (LogLevel)16); } else { GamblerExtras.Log("No eligible valuables found to teleport", (LogLevel)4); } if ((Object)(object)Networker.Instance != (Object)null && (Object)(object)roller != (Object)null) { ((MonoBehaviourPun)Networker.Instance).photonView.RPC("PlayAudioAtPoint", (RpcTarget)0, new object[2] { ((Component)roller).transform.position, "AudioTest" }); } } } public class TeleportPlayerToExtraction : IEffect { public string Name => "Extraction Warp"; public EffectType Outcome => (EffectType)1; public bool ShowDefaultTooltip => true; public string Tooltip => "You're being teleported to an extraction point! You might be trapped!"; public void Use(PlayerAvatar? roller) { //IL_00d9: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)roller == (Object)null) { GamblerExtras.Log("Roller is null, cannot teleport player", (LogLevel)4); return; } ExtractionPoint[] array = Object.FindObjectsOfType<ExtractionPoint>(); if (array == null || array.Length == 0) { GamblerExtras.Log("No extraction points found", (LogLevel)4); return; } ExtractionPoint[] array2 = array.Where((ExtractionPoint ep) => ((Component)ep).gameObject.activeInHierarchy && ((int)ep.currentState == 1 || (int)ep.currentState == 2 || (int)ep.currentState == 0)).ToArray(); if (array2.Length == 0) { array2 = array; } ExtractionPoint val = array2[Random.Range(0, array2.Length)]; if ((Object)(object)val == (Object)null) { GamblerExtras.Log("Selected extraction point is null", (LogLevel)4); return; } Vector3 val2 = (((Object)(object)val.safetySpawn != (Object)null) ? val.safetySpawn.position : (((Component)val).transform.position + Vector3.up)); if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)Networker.Instance).photonView.RPC("ForceTeleportRPC", (RpcTarget)0, new object[3] { roller.photonView.ViewID, val2, ((Component)val).transform.rotation }); } else { ((Component)roller).transform.position = val2; ((Component)roller).transform.rotation = ((Component)val).transform.rotation; if ((Object)(object)PlayerController.instance != (Object)null) { ((Component)PlayerController.instance).transform.position = val2; ((Component)PlayerController.instance).transform.rotation = ((Component)val).transform.rotation; PlayerController.instance.rb.velocity = Vector3.zero; PlayerController.instance.rb.angularVelocity = Vector3.zero; } } GamblerExtras.Log("Teleported player " + roller.playerName + " to extraction point", (LogLevel)16); } } public class TeleportAllPlayersToExtraction : IEffect { public string Name => "Mass Extraction Warp"; public EffectType Outcome => (EffectType)0; public bool ShowDefaultTooltip => true; public string Tooltip => "Everyone is being teleported to extraction points! You might be trapped!"; public void Use(PlayerAvatar? roller) { //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: 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) ExtractionPoint[] array = Object.FindObjectsOfType<ExtractionPoint>(); if (array == null || array.Length == 0) { GamblerExtras.Log("No extraction points found", (LogLevel)4); return; } ExtractionPoint[] array2 = array.Where((ExtractionPoint ep) => ((Component)ep).gameObject.activeInHierarchy && ((int)ep.currentState == 1 || (int)ep.currentState == 2 || (int)ep.currentState == 0)).ToArray(); if (array2.Length == 0) { array2 = array; } List<PlayerAvatar> playerList = GameDirector.instance.PlayerList; if (playerList == null || playerList.Count == 0) { GamblerExtras.Log("No players found", (LogLevel)4); return; } foreach (PlayerAvatar item in playerList) { if ((Object)(object)item == (Object)null || (Object)(object)item.photonView == (Object)null || item.playerHealth.health <= 0) { continue; } ExtractionPoint val = array2[Random.Range(0, array2.Length)]; if ((Object)(object)val == (Object)null) { continue; } Vector3 val2 = (((Object)(object)val.safetySpawn != (Object)null) ? val.safetySpawn.position : (((Component)val).transform.position + Vector3.up)); if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)Networker.Instance).photonView.RPC("ForceTeleportRPC", (RpcTarget)0, new object[3] { item.photonView.ViewID, val2, ((Component)val).transform.rotation }); } else if ((Object)(object)item == (Object)(object)PlayerAvatar.instance) { ((Component)item).transform.position = val2; ((Component)item).transform.rotation = ((Component)val).transform.rotation; if ((Object)(object)PlayerController.instance != (Object)null) { ((Component)PlayerController.instance).transform.position = val2; ((Component)PlayerController.instance).transform.rotation = ((Component)val).transform.rotation; PlayerController.instance.rb.velocity = Vector3.zero; PlayerController.instance.rb.angularVelocity = Vector3.zero; } } } GamblerExtras.Log("Teleported all players to extraction points", (LogLevel)16); } } public class KillAllEnemies : IEffect { public string Name => "Mass Extinction"; public EffectType Outcome => (EffectType)4; public bool ShowDefaultTooltip => true; public string Tooltip => "All enemies are being eliminated!"; public void Use(PlayerAvatar? roller) { //IL_0333: 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_0178: Invalid comparison between Unknown and I4 //IL_0190: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer()) { GamblerExtras.Log("Only the host can kill all enemies", (LogLevel)4); return; } EnemyParent[] array = Object.FindObjectsOfType<EnemyParent>(); int num = 0; EnemyParent[] array2 = array; foreach (EnemyParent val in array2) { if ((Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy || (Object)(object)val.Enemy == (Object)null) { continue; } try { bool flag = false; if (val.Enemy.HasHealth && (Object)(object)val.Enemy.Health != (Object)null) { EnemyHealth health = val.Enemy.Health; Type type = ((object)health).GetType(); MethodInfo method = type.GetMethod("Kill", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(health, null); flag = true; } else { MethodInfo method2 = type.GetMethod("Die", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method2 != null) { method2.Invoke(health, null); flag = true; } else { MethodInfo method3 = type.GetMethod("TakeDamage", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method3 != null) { method3.Invoke(health, new object[1] { 10000f }); flag = true; } } } } if (!flag && (int)val.Enemy.CurrentState != 11) { val.Enemy.CurrentState = (EnemyState)11; if (val.Enemy.HasStateDespawn) { Type type2 = ((object)val.Enemy.StateDespawn).GetType(); MethodInfo method4 = type2.GetMethod("ForceDespawn", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method4 != null) { method4.Invoke(val.Enemy.StateDespawn, null); flag = true; } } val.SpawnedTimerSet(0f); flag = true; } if (!flag && (Object)(object)val.EnableObject != (Object)null) { val.EnableObject.SetActive(false); flag = true; } if (!flag) { if (SemiFunc.IsMultiplayer()) { if ((Object)(object)((MonoBehaviourPun)val).photonView != (Object)null && ((MonoBehaviourPun)val).photonView.IsMine) { PhotonNetwork.Destroy(((Component)val).gameObject); } } else { Object.Destroy((Object)(object)((Component)val).gameObject); } flag = true; } if (flag) { num++; } } catch (Exception ex) { GamblerExtras.Log("Error killing enemy " + ((Object)val).name + ": " + ex.Message, (LogLevel)4); } } GamblerExtras.Log($"Killed {num} enemies", (LogLevel)16); if ((Object)(object)Networker.Instance != (Object)null && (Object)(object)roller != (Object)null) { ((MonoBehaviourPun)Networker.Instance).photonView.RPC("PlayAudioAtPoint", (RpcTarget)0, new object[2] { ((Component)roller).transform.position, "Good2" }); } } } public class SpawnCart : IEffect { private class TemporaryCartMarker : MonoBehaviour { private void OnDestroy() { int num = _temporaryCarts.IndexOf(((Component)this).gameObject); if (num >= 0) { _temporaryCarts.RemoveAt(num); } } } private class TempCartCleanupHelper : MonoBehaviour { private void Awake() { SceneManager.sceneLoaded += OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { CleanupTemporaryCarts(); } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; CleanupTemporaryCarts(); } } private static List<GameObject> _temporaryCarts = new List<GameObject>(); private static GameObject? _cleanupHelper; private const string CART_ITEM_NAME = "C.A.R.T."; private const string CART_ASSET_NAME = "Item Cart Medium"; public string Name => "Cart Delivery"; public EffectType Outcome => (EffectType)3; public bool ShowDefaultTooltip => true; public string Tooltip => "A C.A.R.T. has been delivered to your location!"; public void Use(PlayerAvatar? roller) { //IL_01fe: 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_003f: Expected O, but got Unknown //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)roller == (Object)null) { GamblerExtras.Log("Roller is null, cannot spawn cart", (LogLevel)4); return; } if ((Object)(object)_cleanupHelper == (Object)null) { _cleanupHelper = new GameObject("TempCartCleanupHelper"); _cleanupHelper.AddComponent<TempCartCleanupHelper>(); Object.DontDestroyOnLoad((Object)(object)_cleanupHelper); } if (SemiFunc.IsMultiplayer() && !SemiFunc.IsMasterClientOrSingleplayer()) { GamblerExtras.Log("Only the host can spawn carts in multiplayer", (LogLevel)4); return; } int cartsSpawned = 0; Vector3 val = ((Component)roller).transform.position + ((Component)roller).transform.forward * 2f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val + Vector3.up * 3f, Vector3.down, ref val2, 10f)) { val = ((RaycastHit)(ref val2)).point + Vector3.up * 0.5f; try { Item val3 = default(Item); if (Items.TryGetItemByName("C.A.R.T.", ref val3) || Items.TryGetItemByName("Item Cart Medium", ref val3)) { GameObject val4 = Items.SpawnItem(val3, val, Quaternion.identity); if ((Object)(object)val4 != (Object)null) { ((Object)val4).name = $"TempCart_{DateTime.Now.Ticks}"; if (!Object.op_Implicit((Object)(object)val4.GetComponent<TemporaryCartMarker>())) { val4.AddComponent<TemporaryCartMarker>(); } cartsSpawned++; _temporaryCarts.Add(val4); GamblerExtras.Log($"Successfully spawned cart using REPOLib at position {val}", (LogLevel)32); } else { GamblerExtras.Log("REPOLib SpawnItem returned null for cart", (LogLevel)4); SpawnUsingFallbackMethod(val, ref cartsSpawned, 0); } } else { GamblerExtras.Log("Could not find cart in REPOLib's item repository", (LogLevel)4); SpawnUsingFallbackMethod(val, ref cartsSpawned, 0); } } catch (Exception ex) { GamblerExtras.Log("Error spawning cart using REPOLib: " + ex.Message, (LogLevel)2); SpawnUsingFallbackMethod(val, ref cartsSpawned, 0); } } else { GamblerExtras.Log("Could not find valid ground for cart", (LogLevel)4); } GamblerExtras.Log($"Spawned {cartsSpawned} temporary C.A.R.T.", (LogLevel)16); if ((Object)(object)Networker.Instance != (Object)null) { ((MonoBehaviourPun)Networker.Instance).photonView.RPC("PlayAudioAtPoint", (RpcTarget)0, new object[2] { ((Component)roller).transform.position, "Good2" }); } } private void SpawnUsingFallbackMethod(Vector3 spawnPosition, ref int cartsSpawned, int index) { //IL_00a6: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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) try { List<GameObject> list = (from cart in GameObject.FindGameObjectsWithTag("Cart") where (Object)(object)cart != (Object)null && cart.activeInHierarchy select cart).ToList(); if (list.Count > 0) { GameObject val = list[Random.Range(0, list.Count)]; GameObject val2 = null; if (SemiFunc.IsMultiplayer() && SemiFunc.IsMasterClientOrSingleplayer()) { try { val2 = PhotonNetwork.Instantiate(((Object)val).name, spawnPosition, Quaternion.identity, (byte)0, (object[])null); } catch (Exception ex) { GamblerExtras.Log("Error using PhotonNetwork.Instantiate: " + ex.Message, (LogLevel)2); val2 = Object.Instantiate<GameObject>(val, spawnPosition, Quaternion.identity); } } else if (!SemiFunc.IsMultiplayer()) { val2 = Object.Instantiate<GameObject>(val, spawnPosition, Quaternion.identity); } if ((Object)(object)val2 != (Object)null) { ((Object)val2).name = $"TempCart_{DateTime.Now.Ticks}_{index}"; val2.AddComponent<TemporaryCartMarker>(); cartsSpawned++; _temporaryCarts.Add(val2); GamblerExtras.Log("Spawned cart by cloning existing one", (LogLevel)32); } else { GamblerExtras.Log("Failed to instantiate cart clone", (LogLevel)4); } } else { GamblerExtras.Log("No existing carts found to clone", (LogLevel)4); } } catch (Exception ex2) { GamblerExtras.Log("Error in fallback cart spawn method: " + ex2.Message, (LogLevel)2); } } public static void CleanupTemporaryCarts() { int num = 0; TemporaryCartMarker[] array = Object.FindObjectsOfType<TemporaryCartMarker>(); TemporaryCartMarker[] array2 = array; foreach (TemporaryCartMarker temporaryCartMarker in array2) { if (!((Object)(object)temporaryCartMarker != (Object)null) || !((Object)(object)((Component)temporaryCartMarker).gameObject != (Object)null)) { continue; } if (SemiFunc.IsMultiplayer() && SemiFunc.IsMasterClientOrSingleplayer()) { PhotonView component = ((Component)temporaryCartMarker).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null && component.IsMine) { PhotonNetwork.Destroy(((Component)temporaryCartMarker).gameObject); } else { Object.Destroy((Object)(object)((Component)temporaryCartMarker).gameObject); } } else if (!SemiFunc.IsMultiplayer()) { Object.Destroy((Object)(object)((Component)temporaryCartMarker).gameObject); } num++; } foreach (GameObject item in _temporaryCarts.ToList()) { if (!((Object)(object)item != (Object)null)) { continue; } if (SemiFunc.IsMultiplayer() && SemiFunc.IsMasterClientOrSingleplayer()) { PhotonView component2 = item.GetComponent<PhotonView>(); if ((Object)(object)component2 != (Object)null && component2.IsMine) { PhotonNetwork.Destroy(item); } else { Object.Destroy((Object)(object)item); } } else if (!SemiFunc.IsMultiplayer()) { Object.Destroy((Object)(object)item); } } _temporaryCarts.Clear(); GamblerExtras.Log($"Cleaned up {num} temporary carts", (LogLevel)16); } } public class RandomizeEnemyScale : IEffect { public string Name => "Enemy Resize"; public EffectType Outcome => (EffectType)2; public bool ShowDefaultTooltip => true; public string Tooltip => "Enemies are being resized!"; public void Use(PlayerAvatar? roller) { //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) EnemyParent[] array = Object.FindObjectsOfType<EnemyParent>(); int num = 0; EnemyParent[] array2 = array; Vector3 val2 = default(Vector3); foreach (EnemyParent val in array2) { if ((Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy || (Object)(object)((MonoBehaviourPun)val).photonView == (Object)null) { continue; } try { float num2 = Random.Range(0.1f, 0.5f); ((Vector3)(ref val2))..ctor(num2, num2, num2); if (SemiFunc.IsMultiplayer()) { if (SemiFunc.IsMasterClientOrSingleplayer()) { ((MonoBehaviourPun)Networker.Instance).photonView.RPC("SetScale", (RpcTarget)0, new object[2] { ((MonoBehaviourPun)val).photonView.ViewID, val2 }); if (SemiFunc.IsMasterClientOrSingleplayer()) { ScaleEnemyComponents(((Component)val).gameObject, num2); } } } else { ((Component)val).transform.localScale = val2; ScaleEnemyComponents(((Component)val).gameObject, num2); } num++; } catch (Exception ex) { GamblerExtras.Log("Error resizing enemy " + ((Object)val).name + ": " + ex.Message, (LogLevel)2); } } GamblerExtras.Log($"Resized {num} enemies", (LogLevel)16); if ((Object)(object)Networker.Instance != (Object)null && (Object)(object)roller != (Object)null) { ((MonoBehaviourPun)Networker.Instance).photonView.RPC("PlayAudioAtPoint", (RpcTarget)0, new object[2] { ((Component)roller).transform.position, "Positive1" }); } } private void ScaleEnemyComponents(GameObject enemyObject, float scale) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) try { Collider[] componentsInChildren = enemyObject.GetComponentsInChildren<Collider>(true); foreach (Collider val in componentsInChildren) { BoxCollider val2 = (BoxCollider)(object)((val is BoxCollider) ? val : null); if (val2 != null) { val2.size = val2.size; continue; } SphereCollider val3 = (SphereCollider)(object)((val is SphereCollider) ? val : null); if (val3 != null) { val3.radius *= scale / enemyObject.transform.localScale.x; continue; } CapsuleCollider val4 = (CapsuleCollider)(object)((val is CapsuleCollider) ? val : null); if (val4 != null) { val4.radius *= scale / enemyObject.transform.localScale.x; val4.height *= scale / enemyObject.transform.localScale.y; } } NavMeshAgent componentInChildren = enemyObject.GetComponentInChildren<NavMeshAgent>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.height *= scale / enemyObject.transform.localScale.y; componentInChildren.radius *= scale / enemyObject.transform.localScale.x; } Animator componentInChildren2 = enemyObject.GetComponentInChildren<Animator>(); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren2.speed = Mathf.Lerp(1.5f, 0.7f, scale); } Enemy componentInChildren3 = enemyObject.GetComponentInChildren<Enemy>(); if (!((Object)(object)componentInChildren3 != (Object)null)) { } } catch (Exception ex) { GamblerExtras.Log("Error scaling enemy components: " + ex.Message, (LogLevel)2); } } } public class LowGravity : IEffect { private class LowGravityGroundedOverride : MonoBehaviour { private PlayerController? _controller; private bool _wasJumping = false; private void Awake() { _controller = ((Component)this).GetComponent<PlayerController>(); } private void Update() { if ((Object)(object)_controller == (Object)null) { return; } try { FieldInfo field = typeof(PlayerController).GetField("isGrounded", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { bool flag = (bool)field.GetValue(_controller); if (Input.GetButtonDown("Jump") && flag) { _wasJumping = true; } else if (!Input.GetButton("Jump") && _wasJumping) { _wasJumping = false; field.SetValue(_controller, true); } else if (!_wasJumping) { field.SetValue(_controller, true); } } } catch { } } private void OnDestroy() { } } private class GravityTimer : MonoBehaviour { private float _duration; private float _gravityMultiplier; private float _timeRemaining; private bool _effectActive = false; private Vector3 _originalGlobalGravity; private bool _isUsingGlobalGravity = false; private PlayerAvatar? _roller; public void Initialize(float duration, float gravityMultiplier, PlayerAvatar roller) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) _duration = duration; _timeRemaining = duration; _gravityMultiplier = gravityMultiplier; _roller = roller; _effectActive = false; _originalGlobalGravity = Physics.gravity; _playerOriginalGravity.Clear(); ApplyLowGravityToAllPlayers(); } private void ApplyLowGravityToAllPlayers() { //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) try { List<PlayerAvatar> playerList = GameDirector.instance.PlayerList; int num = 0; foreach (PlayerAvatar item in playerList) { if ((Object)(object)item == (Object)null) { continue; } PlayerController val = null; if ((Object)(object)item == (Object)(object)PlayerAvatar.instance) { val = PlayerController.instance; } else if ((Object)(object)item.playerTransform != (Object)null) { val = ((Component)item.playerTransform).GetComponent<PlayerController>(); } if (!((Object)(object)val != (Object)null) || _playerOriginalGravity.ContainsKey(item.photonView.ViewID)) { continue; } _playerOriginalGravity[item.photonView.ViewID] = val.CustomGravity; val.CustomGravity = _playerOriginalGravity[item.photonView.ViewID] * _gravityMultiplier; val.antiGravityTimer = _duration; try { if (!Object.op_Implicit((Object)(object)((Component)val).gameObject.GetComponent<LowGravityGroundedOverride>())) { ((Component)val).gameObject.AddComponent<LowGravityGroundedOverride>(); } } catch (Exception ex) { GamblerExtras.Log("Error setting up grounded override: " + ex.Message, (LogLevel)2); } num++; GamblerExtras.Log($"Applied low gravity and air movement to player {item.playerName} for {_duration} seconds", (LogLevel)16); } if (num == 0) { Physics.gravity *= _gravityMultiplier; _isUsingGlobalGravity = true; GamblerExtras.Log($"Applied global low gravity for {_duration} seconds", (LogLevel)16); } _effectActive = true; } catch (Exception ex2) { GamblerExtras.Log("Error applying low gravity: " + ex2.Message, (LogLevel)2); RestoreGravity(); } } private void RestoreGravity() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) try { if (_isUsingGlobalGravity) { Physics.gravity = _originalGlobalGravity; _isUsingGlobalGravity = false; } foreach (KeyValuePair<int, float> item in _playerOriginalGravity) { int key = item.Key; float value = item.Value; PlayerAvatar val = null; foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if ((Object)(object)player != (Object)null && (Object)(object)player.photonView != (Object)null && player.photonView.ViewID == key) { val = player; break; } } if (!((Object)(object)val != (Object)null)) { continue; } PlayerController val2 = null; if ((Object)(object)val == (Object)(object)PlayerAvatar.instance) { val2 = PlayerController.instance; } else if ((Object)(object)val.playerTransform != (Object)null) { val2 = ((Component)val.playerTransform).GetComponent<PlayerController>(); } if ((Object)(object)val2 != (Object)null) { val2.CustomGravity = value; LowGravityGroundedOverride component = ((Component)val2).gameObject.GetComponent<LowGravityGroundedOverride>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } GamblerExtras.Log("Restored normal gravity for player " + val.playerName, (LogLevel)16); } } _playerOriginalGravity.Clear(); _effectActive = false; if ((Object)(object)_roller != (Object)null && (Object)(object)Networker.Instance != (Object)null) { ((MonoBehaviourPun)Networker.Instance).photonView.RPC("PlayAudioAtPoint", (RpcTarget)0, new object[2] { ((Component)_roller).transform.position, "Good2" }); } GamblerExtras.Log("Low gravity effect has ended", (LogLevel)16); } catch (Exception ex) { GamblerExtras.Log("Error restoring gravity: " + ex.Message, (LogLevel)2); } } private void Update() { if (!_effectActive) { return; } _timeRemaining -= Time.deltaTime; if (_timeRemaining > 0f && _timeRemaining % 10f < 0.1f) { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if (!((Object)(object)player == (Object)null)) { PlayerController val = null; if ((Object)(object)player == (Object)(object)PlayerAvatar.instance) { val = PlayerController.instance; } else if ((Object)(object)player.playerTransform != (Object)null) { val = ((Component)player.playerTransform).GetComponent<PlayerController>(); } if ((Object)(object)val != (Object)null && !_playerOriginalGravity.ContainsKey(player.photonView.ViewID)) { _playerOriginalGravity[player.photonView.ViewID] = val.CustomGravity; val.CustomGravity = _playerOriginalGravity[player.photonView.ViewID] * _gravityMultiplier; val.antiGravityTimer = _timeRemaining; } } } } if (_timeRemaining <= 0f) { RestoreGravity(); Object.Destroy((Object)(object)((Component)this).gameObject); } } private void OnDestroy() { if (_effectActive) { RestoreGravity(); } } } private const float DURATION = 60f; private const float GRAVITY_MULTIPLIER = 0.1f; private static GameObject? _timerObject; private static Dictionary<int, float> _playerOriginalGravity = new Dictionary<int, float>(); public string Name => "Low Gravity"; public EffectType Outcome => (EffectType)2; public bool ShowDefaultTooltip => true; public string Tooltip => "Gravity has been reduced for everyone for 1 minute, you can also move around better mid-air! Press Q to fall."; public void Use(PlayerAvatar? roller) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)roller == (Object)null) { GamblerExtras.Log("Roller is null, cannot apply low gravity", (LogLevel)4); return; } if ((Object)(object)_timerObject != (Object)null) { Object.Destroy((Object)(object)_timerObject); } _timerObject = new GameObject("LowGravityTimer"); Object.DontDestroyOnLoad((Object)(object)_timerObject); GravityTimer gravityTimer = _timerObject.AddComponent<GravityTimer>(); gravityTimer.Initialize(60f, 0.1f, roller); GamblerExtras.Log($"Applied low gravity to all players for {60f} seconds", (LogLevel)16); if ((Object)(object)Networker.Instance != (Object)null && (Object)(object)roller != (Object)null) { ((MonoBehaviourPun)Networker.Instance).photonView.RPC("PlayAudioAtPoint", (RpcTarget)0, new object[2] { ((Component)roller).transform.position, "AudioTest" }); } } } public class RechargeAllBatteries : IEffect { public string Name => "Power Surge"; public EffectType Outcome => (EffectType)4; public bool ShowDefaultTooltip => true; public string Tooltip => "All batteries are being recharged!"; public void Use(PlayerAvatar? roller) { //IL_0110: Unknown result type (might be due to invalid IL or missing references) ItemBattery[] array = Object.FindObjectsOfType<ItemBattery>(true); int num = 0; ItemBattery[] array2 = array; foreach (ItemBattery val in array2) { if ((Object)(object)val == (Object)null) { continue; } try { val.batteryLife = 100f; FieldInfo field = typeof(ItemBattery).GetField("batteryLifeInt", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { field.SetValue(val, 6); } else { try { val.SetBatteryLife(6); } catch { } } num++; } catch (Exception ex) { GamblerExtras.Log("Error recharging battery: " + ex.Message, (LogLevel)2); } } GamblerExtras.Log($"Recharged {num} batteries", (LogLevel)16); if ((Object)(object)Networker.Instance != (Object)null && (Object)(object)roller != (Object)null) { ((MonoBehaviourPun)Networker.Instance).photonView.RPC("PlayAudioAtPoint", (RpcTarget)0, new object[2] { ((Component)roller).transform.position, "Good2" }); } } } public class SpawnHealthPacks : IEffect { private const string HEALTH_PACK_ITEM_NAME = "Small Health Pack (25)"; private const string HEALTH_PACK_ASSET_NAME = "Item Health Pack Small"; public string Name => "Medical Drop"; public EffectType Outcome => (EffectType)3; public bool ShowDefaultTooltip => true; public string Tooltip => "Medical supplies have arrived!"; public void Use(PlayerAvatar? roller) { //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)roller == (Object)null) { GamblerExtras.Log("Roller is null, cannot spawn health packs", (LogLevel)4); return; } if (SemiFunc.IsMultiplayer() && !SemiFunc.IsMasterClientOrSingleplayer()) { GamblerExtras.Log("Only the host can spawn health packs in multiplayer", (LogLevel)4); return; } int num = 6; int packSpawned = 0; Vector3 val = default(Vector3); RaycastHit val3 = default(RaycastHit); Item val4 = default(Item); for (int i = 0; i < num; i++) { float num2 = 360f / (float)num * (float)i * (MathF.PI / 180f); float num3 = 2f; ((Vector3)(ref val))..ctor(Mathf.Cos(num2) * num3, 0.5f, Mathf.Sin(num2) * num3); Vector3 val2 = ((Component)roller).transform.position + val; if (Physics.Raycast(val2 + Vector3.up * 1f, Vector3.down, ref val3, 3f)) { val2 = ((RaycastHit)(ref val3)).point + Vector3.up * 0.1f; } try { if (Items.TryGetItemByName("Small Health Pack (25)", ref val4) || Items.TryGetItemByName("Item Health Pack Small", ref val4)) { GameObject val5 = Items.SpawnItem(val4, val2, Quaternion.identity); if ((Object)(object)val5 != (Object)null) { packSpawned++; GamblerExtras.Log($"Successfully spawned health pack using REPOLib at {val2}", (LogLevel)32); } else { GamblerExtras.Log("REPOLib SpawnItem returned null for health pack", (LogLevel)4); SpawnUsingFallbackMethod(val2, ref packSpawned); } } else { GamblerExtras.Log("Could not find health pack in REPOLib's item repository", (LogLevel)4); SpawnUsingFallbackMethod(val2, ref packSpawned); } } catch (Exception ex) { GamblerExtras.Log("Error spawning health pack: " + ex.Message, (LogLevel)2); SpawnUsingFallbackMethod(val2, ref packSpawned); } } GamblerExtras.Log($"Spawned {packSpawned} health packs", (LogLevel)16); if ((Object)(object)Networker.Instance != (Object)null) { ((MonoBehaviourPun)Networker.Instance).photonView.RPC("PlayAudioAtPoint", (RpcTarget)0, new object[2] { ((Component)roller).transform.position, "Good2" }); } } private void SpawnUsingFallbackMethod(Vector3 spawnPosition, ref int packSpawned) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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) if (SemiFunc.IsMultiplayer() && (Object)(object)Networker.Instance != (Object)null) { try { Networker.Instance.SpawnItemRPC("Item Health Pack Small", spawnPosition); packSpawned++; GamblerExtras.Log("Spawned health pack using Networker.SpawnItemRPC", (LogLevel)32); return; } catch (Exception ex) { GamblerExtras.Log("Error using Networker to spawn health pack: " + ex.Message, (LogLevel)2); } } if (SemiFunc.IsMultiplayer()) { return; } try { GameObject[] array = (from go in Object.FindObjectsOfType<GameObject>(true) where (((Object)go).name.Contains("Health") || ((Object)go).name.Contains("health")) && (Object)(object)go.GetComponent<ItemAttributes>() != (Object)null select go).ToArray(); if (array.Length != 0) { GameObject val = array[Random.Range(0, array.Length)]; GameObject val2 = Object.Instantiate<GameObject>(val, spawnPosition, Quaternion.identity); if ((Object)(object)val2 != (Object)null) { packSpawned++; GamblerExtras.Log("Spawned health pack by cloning existing one", (LogLevel)32); } } else { GamblerExtras.Log("No existing health packs found to clone", (LogLevel)4); } } catch (Exception ex2) { GamblerExtras.Log("Error cloning health pack: " + ex2.Message, (LogLevel)2); } } } }