using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using FishNet; using FishNet.Broadcast; using FishNet.Connection; using FishNet.Object; using FishNet.Serializing; using FishNet.Transporting; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 HTF1v1 { internal static class Cfg { public static ConfigEntry Enabled; public static ConfigEntry ToggleKey; public static ConfigEntry ArenaSize; public static ConfigEntry ArenaOrigin; public static ConfigEntry WallHeightMult; public static ConfigEntry CountdownSeconds; public static ConfigEntry StartMoney; public static ConfigEntry MinSpawnDistance; public static ConfigEntry PvpDamageMultiplier; public static ConfigEntry RecoilMultiplier; public static ConfigEntry ScoreCap; public static ConfigEntry ClearWeaponsBetweenRounds; public static ConfigEntry AutoCleanThrownItems; public static ConfigEntry VerboseLogging; public static ConfigEntry EnableSlide; public static ConfigEntry SlideSpeedMult; public static ConfigEntry SlideDuration; public static ConfigEntry WeaponsPerSpawn; public static ConfigEntry IncludeMelee; public static ConfigEntry ShowWeaponLabels; public static ConfigEntry IncludeExplosives; public static ConfigEntry RoundTimeLimit; public static ConfigEntry EnableLights; public static ConfigEntry RotateMaps; public static ConfigEntry EnabledMaps; public static ConfigEntry FloodDelaySeconds; public static ConfigEntry FloodRiseSeconds; public static ConfigEntry FloodWarnSeconds; public static ConfigEntry FloodDamage; public static ConfigEntry FloodWaveHeight; public static ConfigEntry FloodColor; public static ConfigEntry FloodSounds; public static ConfigEntry FloodUnderwaterEffect; public static ConfigEntry FloodEndsRound; public static ConfigEntry IncludeCigarette; public static ConfigEntry BlockedWeapons; public static ConfigEntry ShowMenuButton; public static ConfigEntry CountdownSound; public static ConfigEntry PlayMusic; public static ConfigEntry MusicTrack; public static ConfigEntry FogAmount; public static ConfigEntry NoHunger; public static ConfigEntry BuyMenuKey; public static ConfigEntry BuyMenuSlots; public static ConfigEntry ClearInventoryEachRound; public static ConfigEntry SuppressIslandWarning; public static void Bind(ConfigFile c) { //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) Enabled = c.Bind("General", "Enabled", true, "Master switch for the 1v1 mode."); ToggleKey = c.Bind("General", "ToggleKey", (KeyCode)290, "In-game hotkey to enter/leave 1v1 mode without using the menu button."); SuppressIslandWarning = c.Bind("General", "SuppressIslandWarning", true, "Completely suppress the 'You can't progress if you leave your friends' warning."); VerboseLogging = c.Bind("General", "VerboseLogging", false, "Extra diagnostics. Never logs per-frame."); EnableSlide = c.Bind("Movement", "EnableSlide", true, "Crouch while moving fast on the ground to slide, FPS-style."); SlideSpeedMult = c.Bind("Movement", "SlideSpeedMult", 1.45f, "Slide launch speed as a multiple of sprint speed."); SlideDuration = c.Bind("Movement", "SlideDuration", 0.8f, "How long a slide lasts, in seconds."); IncludeExplosives = c.Bind("Shop", "IncludeExplosives", true, "Include TNT and other explosives on the weapon wall."); RoundTimeLimit = c.Bind("Round", "RoundTimeLimit", 240f, "Seconds per round. If nobody dies before it expires, the round resets and NOBODY scores. 0 = no limit."); BuyMenuKey = c.Bind("Shop", "BuyMenuKey", (KeyCode)116, "Opens the buy panel during the pre-round buy window."); BuyMenuSlots = c.Bind("Shop", "BuyMenuSlots", 10, "How many weapons appear in the buy panel (max 10, keys 1-9 and 0)."); IncludeCigarette = c.Bind("Shop", "IncludeCigarette", true, "Sell a cigarette item if one is registered by another mod. (CigaretteMod does not add a purchasable item, so this usually finds nothing.)"); BlockedWeapons = c.Bind("Shop", "BlockedWeapons", "knuckle", "Comma-separated name fragments that are never sold. Case-insensitive."); ShowMenuButton = c.Bind("General", "ShowMenuButton", false, "Add the 1v1 button to the main menu. Off = use the hotkey only."); CountdownSound = c.Bind("Round", "CountdownSound", true, "Play a tick on each countdown number and a cue when the fight starts."); PlayMusic = c.Bind("Round", "PlayMusic", true, "Play the game's combat music while the duel is running."); MusicTrack = c.Bind("Round", "MusicTrack", "BossFight1", "Music clip name. Known-good values: BossFight1, BossFightMini, MainMenu."); FogAmount = c.Bind("Map", "FogAmount", 0.1f, "Fog strength, 0 = off, 0.10 = light haze. Restored on exit."); NoHunger = c.Bind("Round", "NoHunger", true, "Stop hunger draining while the duel is active."); EnabledMaps = c.Bind("Map", "EnabledMaps", "", "Comma-separated list of maps in the rotation. Blank = all of them. HOST ONLY - a client's setting is overwritten by whatever the host picks. Known ids: " + Maps.IdList() + "."); FloodDelaySeconds = c.Bind("Flood", "FloodDelaySeconds", 5f, "SKYLINE FLOODED: seconds of dry fighting before the water starts rising."); FloodRiseSeconds = c.Bind("Flood", "FloodRiseSeconds", 10f, "SKYLINE FLOODED: base seconds the water takes to climb from the pit floor to deck level."); FloodWarnSeconds = c.Bind("Flood", "FloodWarnSeconds", 5f, "SKYLINE FLOODED: how long before the flood the timer turns red, pulses and starts ticking."); FloodDamage = c.Bind("Flood", "FloodDamage", 12, "SKYLINE FLOODED: damage taken every 0.5s while touching the water. 0 = harmless water."); FloodWaveHeight = c.Bind("Flood", "FloodWaveHeight", 0.22f, "SKYLINE FLOODED: wave amplitude in metres. 0 = a flat surface."); FloodColor = c.Bind("Flood", "FloodColor", new Color(0.13f, 0.45f, 0.78f, 0.72f), "SKYLINE FLOODED: water colour. The alpha is how see-through it is."); FloodSounds = c.Bind("Flood", "FloodSounds", true, "SKYLINE FLOODED: play the countdown ticks, the flood alarm and the splashes."); FloodUnderwaterEffect = c.Bind("Flood", "FloodUnderwaterEffect", true, "SKYLINE FLOODED: apply the game's own underwater fog, screen overlay and muffled audio while you are in the water."); FloodEndsRound = c.Bind("Flood", "FloodEndsRound", false, "SKYLINE FLOODED: once the pit finishes rising (100%), end the round with no score - same as the RoundTimeLimit expiring. Off = the round just keeps running as before."); RotateMaps = c.Bind("Map", "RotateMaps", true, "Pick a random map each round (ARENA / SKYLINE). Off = always ARENA."); EnableLights = c.Bind("Map", "EnableLights", true, "Street lamps and arena lighting."); ClearInventoryEachRound = c.Bind("Round", "ClearInventoryEachRound", true, "Wipe every player's inventory at the start of each round, so nobody keeps last round's guns."); WeaponsPerSpawn = c.Bind("Shop", "WeaponsPerSpawn", 0, "How many weapons to offer at each spawn. 0 = every weapon in the game."); IncludeMelee = c.Bind("Shop", "IncludeMelee", true, "Include melee weapons (knives, bats) alongside guns."); ShowWeaponLabels = c.Bind("Shop", "ShowWeaponLabels", true, "Float the weapon's name and price above each buy point."); ArenaSize = c.Bind("Map", "ArenaSize", 60f, "Outer size of the arena floor in metres (square)."); ArenaOrigin = c.Bind("Map", "ArenaOrigin", new Vector3(0f, 800f, 0f), "World position the arena is built at. High up so it never overlaps island geometry."); WallHeightMult = c.Bind("Map", "WallHeightMult", 2.5f, "Outer wall height as a multiple of the player's measured max jump height (plus body height)."); CountdownSeconds = c.Bind("Round", "CountdownSeconds", 10, "Pre-round buy window in seconds. Players are frozen and can buy; the colour fade spans it."); StartMoney = c.Bind("Round", "StartMoney", 99999, "Money the shared wallet is topped up to at the start of every round."); MinSpawnDistance = c.Bind("Round", "MinSpawnDistance", 28f, "Minimum distance between the two chosen spawn points."); RecoilMultiplier = c.Bind("Round", "RecoilMultiplier", 0.7f, "Scales gun recoil while a 1v1 round is running. 0.7 = 30% less recoil. 1 = vanilla. Applies to both the camera kick and the weapon-rig kick, and only inside 1v1."); PvpDamageMultiplier = c.Bind("Round", "PvpDamageMultiplier", 1f, "Overrides the game's player-vs-player damage scale (vanilla is 0.25, i.e. quartered). 1 = full damage."); ScoreCap = c.Bind("Round", "ScoreCap", 10, "First to this score wins: the match then auto-resets to 0-0 and restarts at round 1. 0 = no cap."); ClearWeaponsBetweenRounds = c.Bind("Round", "ClearWeaponsBetweenRounds", true, "Despawn weapons dropped on the arena floor at the start of each round."); AutoCleanThrownItems = c.Bind("Round", "AutoCleanThrownItems", true, "Automatically clean up and remove loose weapons and items on the arena floor when a round ends and switches."); try { if (CountdownSeconds != null && CountdownSeconds.Value == 3) { CountdownSeconds.Value = 10; } } catch (Exception ex) { Debug.LogWarning((object)("HTF1v1 config migration: " + ex.Message)); } try { if (FloodDelaySeconds != null && FloodDelaySeconds.Value == 45f) { FloodDelaySeconds.Value = 5f; } } catch (Exception ex2) { Debug.LogWarning((object)("HTF1v1 config migration: " + ex2.Message)); } try { if (FloodWarnSeconds != null && FloodWarnSeconds.Value == 10f) { FloodWarnSeconds.Value = 5f; } } catch (Exception ex3) { Debug.LogWarning((object)("HTF1v1 config migration: " + ex3.Message)); } try { if (FloodEndsRound != null && FloodEndsRound.Value) { FloodEndsRound.Value = false; } } catch (Exception ex4) { Debug.LogWarning((object)("HTF1v1 config migration: " + ex4.Message)); } try { if (FloodRiseSeconds != null && FloodRiseSeconds.Value >= 45f) { FloodRiseSeconds.Value = 10f; } } catch (Exception ex5) { Debug.LogWarning((object)("HTF1v1 config migration: " + ex5.Message)); } } } internal static class Patches { private static readonly FieldInfo _warningGroupField = AccessTools.Field(typeof(IslandUI), "_warningGroup"); private static readonly FieldInfo _deathFriendsHelpTextField = AccessTools.Field(typeof(DeathUI), "_friendsHelpText"); public static void Apply(Harmony h) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Expected O, but got Unknown //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Expected O, but got Unknown //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Expected O, but got Unknown //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Expected O, but got Unknown //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Expected O, but got Unknown //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Expected O, but got Unknown //IL_038c: Expected O, but got Unknown Try(h, "Player.BlockInputs getter", AccessTools.PropertyGetter(typeof(Player), "BlockInputs"), null, new HarmonyMethod(typeof(Patches), "BlockInputs_Post", (Type[])null)); Try(h, "Weapon.Shoot", AccessTools.Method(typeof(Weapon), "Shoot", (Type[])null, (Type[])null), new HarmonyMethod(typeof(Patches), "Shoot_Pre", (Type[])null), null); Try(h, "PlayerEffects.UpdateEffects", AccessTools.Method(typeof(PlayerEffects), "UpdateEffects", (Type[])null, (Type[])null), new HarmonyMethod(typeof(Patches), "UpdateEffects_Pre", (Type[])null), null); Try(h, "PlayerManager.OnPlayerDied", AccessTools.Method(typeof(PlayerManager), "OnPlayerDied", new Type[1] { typeof(Player) }, (Type[])null), null, new HarmonyMethod(typeof(Patches), "OnPlayerDied_Post", (Type[])null)); Try(h, "Server.RpcLogic___HitPlayer___2449261505", AccessTools.Method(typeof(Server), "RpcLogic___HitPlayer___2449261505", (Type[])null, (Type[])null), new HarmonyMethod(typeof(Patches), "HitPlayer_Pre", (Type[])null), null); Try(h, "PlayerCamera.Recoil", AccessTools.Method(typeof(PlayerCamera), "Recoil", new Type[1] { typeof(Vector2) }, (Type[])null), new HarmonyMethod(typeof(Patches), "Recoil_Pre", (Type[])null), null); Try(h, "PlayerToolMovement.Recoil", AccessTools.Method(typeof(PlayerToolMovement), "Recoil", new Type[1] { typeof(Vector2) }, (Type[])null), new HarmonyMethod(typeof(Patches), "Recoil_Pre", (Type[])null), null); Try(h, "PlayerUI.ToggleIslandWarning", AccessTools.Method(typeof(PlayerUI), "ToggleIslandWarning", new Type[1] { typeof(bool) }, (Type[])null), new HarmonyMethod(typeof(Patches), "ToggleIslandWarning_Pre", (Type[])null), null); Try(h, "IslandUI._islandUIToggleIslandWarning", AccessTools.Method(typeof(IslandUI), "_islandUIToggleIslandWarning", new Type[1] { typeof(bool) }, (Type[])null), new HarmonyMethod(typeof(Patches), "IslandUIToggleIslandWarning_Pre", (Type[])null), null); Try(h, "IslandWarning.OnTriggerExit", AccessTools.Method(typeof(IslandWarning), "OnTriggerExit", new Type[1] { typeof(Collider) }, (Type[])null), new HarmonyMethod(typeof(Patches), "IslandWarning_OnTriggerExit_Pre", (Type[])null), null); Try(h, "DazedUtils.AllPlayersNearbyCheck", AccessTools.Method(typeof(DazedUtils), "AllPlayersNearbyCheck", new Type[2] { typeof(Vector3), typeof(float) }, (Type[])null), new HarmonyMethod(typeof(Patches), "AllPlayersNearbyCheck_Pre", (Type[])null), null); Try(h, "DeathUI.ToggleDeathUI", AccessTools.Method(typeof(DeathUI), "ToggleDeathUI", new Type[1] { typeof(bool) }, (Type[])null), null, new HarmonyMethod(typeof(Patches), "DeathUI_ToggleDeathUI_Post", (Type[])null)); Try(h, "SaveManager.SaveServer", AccessTools.Method(typeof(SaveManager), "SaveServer", new Type[1] { typeof(bool) }, (Type[])null), new HarmonyMethod(typeof(Patches), "SaveServer_Pre", (Type[])null), new HarmonyMethod(typeof(Patches), "SaveServer_Post", (Type[])null)); } private static void Try(Harmony h, string label, MethodBase target, HarmonyMethod pre, HarmonyMethod post) { try { if (target == null) { Plugin.Warn("Patch target not found: " + label + " (skipped)"); return; } h.Patch(target, pre, post, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); if (Cfg.VerboseLogging.Value) { Plugin.Log("Patched " + label); } } catch (Exception ex) { Plugin.Err("Failed to patch " + label + ": " + ex.Message); } } private static void BlockInputs_Post(ref bool __result) { try { if (Rounds.InputFrozen) { __result = true; } } catch { } } private static bool Shoot_Pre() { try { return !Rounds.InputFrozen; } catch { return true; } } private static bool UpdateEffects_Pre() { try { return !Rounds.OwnsSaturation; } catch { return true; } } private static void Move_Post(PlayerMovement __instance) { try { Slide.Apply(__instance); } catch { } } private static void UpdateMoveSpeed_Post(PlayerMovement __instance) { try { Slide.RaiseSpeedCap(__instance); } catch { } } private static bool LowerFullness_Pre() { try { return !Rounds.Active || !Cfg.NoHunger.Value; } catch { return true; } } private static void Recoil_Pre(ref Vector2 recoil) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) try { if (Rounds.Active && Cfg.Enabled.Value) { float num = Cfg.RecoilMultiplier.Value; if (num < 0f) { num = 0f; } if (num != 1f) { recoil *= num; } } } catch { } } private static void OnPlayerDied_Post(Player player) { try { Rounds.OnDeath(player); } catch (Exception ex) { Plugin.Err("OnPlayerDied_Post: " + ex.Message); } } private static void HitPlayer_Pre(Player __0, Player __5) { try { Rounds.RecordAttacker(__0, __5); } catch { } } private static void ToggleIslandWarning_Pre(ref bool to) { try { if (Cfg.SuppressIslandWarning.Value || Rounds.Active) { to = false; } } catch { } } private static bool IslandUIToggleIslandWarning_Pre(IslandUI __instance, ref bool to) { try { if (Cfg.SuppressIslandWarning.Value || Rounds.Active) { to = false; if ((Object)(object)__instance != (Object)null && _warningGroupField != null) { object? value = _warningGroupField.GetValue(__instance); CanvasGroup val = (CanvasGroup)((value is CanvasGroup) ? value : null); if ((Object)(object)val != (Object)null) { try { Type type = AccessTools.TypeByName("LeanTween"); if (type != null) { AccessTools.Method(type, "cancel", new Type[1] { typeof(GameObject) }, (Type[])null)?.Invoke(null, new object[1] { ((Component)val).gameObject }); } } catch { } val.alpha = 0f; ((Component)val).gameObject.SetActive(false); } } return false; } } catch { } return true; } private static bool IslandWarning_OnTriggerExit_Pre() { try { if (Cfg.SuppressIslandWarning.Value || Rounds.Active) { return false; } } catch { } return true; } private static bool AllPlayersNearbyCheck_Pre(ref bool __result) { try { if (Cfg.SuppressIslandWarning.Value || Rounds.Active) { __result = true; return false; } } catch { } return true; } private static void DeathUI_ToggleDeathUI_Post(DeathUI __instance) { try { if ((Cfg.SuppressIslandWarning.Value || Rounds.Active) && (Object)(object)__instance != (Object)null && _deathFriendsHelpTextField != null) { object? value = _deathFriendsHelpTextField.GetValue(__instance); GameObject val = (GameObject)((value is GameObject) ? value : null); if ((Object)(object)val != (Object)null) { val.SetActive(false); } } } catch { } } private static void SaveServer_Pre() { try { if (Rounds.Active && Rounds.SavedMoneyValid) { Rounds.ForceInstantMoney(Rounds.SavedMoney); } } catch { } } private static void SaveServer_Post() { try { if (Rounds.Active) { Rounds.TopUpMoney(); } } catch { } } } [BepInPlugin("JacobSmear.htf1v1", "HTF 1v1", "1.2.10")] public class Plugin : BaseUnityPlugin { public const string Guid = "JacobSmear.htf1v1"; private static ManualLogSource _log; private Harmony _harmony; private bool _pendingEnter; private float _nextInjectTry; private GameObject _menuButton; public static void Log(string m) { if (_log != null) { _log.LogInfo((object)m); } } public static void Warn(string m) { if (_log != null) { _log.LogWarning((object)m); } } public static void Err(string m) { if (_log != null) { _log.LogError((object)m); } } private void Awake() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) _log = ((BaseUnityPlugin)this).Logger; try { try { Cfg.Bind(((BaseUnityPlugin)this).Config); } catch (Exception ex) { Err("Config binding failed, continuing with defaults: " + ex); } if (Cfg.Enabled == null) { Err("Config unavailable - HTF 1v1 cannot start."); return; } if (!Cfg.Enabled.Value) { Log("HTF 1v1 is disabled in config."); return; } _harmony = new Harmony("JacobSmear.htf1v1"); Patches.Apply(_harmony); Net.Init(); IslandManager.OnFirstIslandLoaded += OnIslandReady; SceneManager.sceneLoaded += OnSceneLoaded; Log("HTF 1v1 v1.2.3 loaded. Hotkey: " + ((object)Cfg.ToggleKey.Value/*cast due to .constrained prefix*/).ToString() + " | ScoreCap=" + Cfg.ScoreCap.Value + " | Countdown=" + Cfg.CountdownSeconds.Value + "s"); } catch (Exception ex2) { Err("Awake failed: " + ex2); } } private void OnDestroy() { try { IslandManager.OnFirstIslandLoaded -= OnIslandReady; SceneManager.sceneLoaded -= OnSceneLoaded; if (Rounds.Active) { Rounds.Exit(); } Net.Shutdown(); if (_harmony != null) { _harmony.UnpatchSelf(); } } catch (Exception ex) { Err("OnDestroy: " + ex); } } private void OnSceneLoaded(Scene s, LoadSceneMode mode) { _nextInjectTry = 0f; } private void OnIslandReady() { try { if (_pendingEnter) { _pendingEnter = false; ((MonoBehaviour)this).StartCoroutine(EnterAfterDelay()); } } catch (Exception ex) { Err("OnIslandReady: " + ex); } } private IEnumerator EnterAfterDelay() { yield return (object)new WaitForSeconds(1.5f); for (int i = 0; i < 40; i++) { if (!((Object)(object)Player.LocalPlayer == (Object)null)) { break; } yield return (object)new WaitForSeconds(0.25f); } Rounds.Enter(); } private void Update() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (Cfg.Enabled == null) { return; } try { if (!Cfg.Enabled.Value) { if (Rounds.Active) { Rounds.Exit(); } return; } Net.Tick(); Rounds.Tick(); Slide.Tick(); BuyMenu.Tick(); if (Input.GetKeyDown(Cfg.ToggleKey.Value)) { Toggle(); } if (Cfg.ShowMenuButton.Value && (Object)(object)_menuButton == (Object)null && Time.unscaledTime >= _nextInjectTry) { _nextInjectTry = Time.unscaledTime + 2f; TryInjectMenuButton(); } } catch (Exception ex) { Err("Update: " + ex); } } private void Toggle() { try { if (Rounds.Active) { Rounds.Exit(); } else if ((Object)(object)Island.CurIsland == (Object)null) { _pendingEnter = true; Warn("1v1 armed - no world is loaded yet. Start or join a game and it will activate automatically."); } else { Rounds.Enter(); } } catch (Exception ex) { Err("Toggle: " + ex); } } private void TryInjectMenuButton() { //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown try { CanvasManager val = Object.FindFirstObjectByType(); if ((Object)(object)val == (Object)null) { return; } List field = Util.GetField>(val, "_allMainMenuButtons"); if (field == null || field.Count == 0 || (Object)(object)field[0] == (Object)null) { return; } Button val2 = ((IEnumerable