using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("HowToFishCheatMenu")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("HowToFishCheatMenu")] [assembly: AssemblyTitle("HowToFishCheatMenu")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 HowToFishCheatMenu { [BepInPlugin("com.matt.howtofish.cheatmenu", "How to Fish Cheat Menu", "2.1.0")] public sealed class Plugin : BaseUnityPlugin { private sealed class MovementDefaults { public float WalkSpeed { get; } public float SprintSpeed { get; } public MovementDefaults(float walkSpeed, float sprintSpeed) { WalkSpeed = walkSpeed; SprintSpeed = sprintSpeed; } } public const string PluginGuid = "com.matt.howtofish.cheatmenu"; public const string PluginName = "How to Fish Cheat Menu"; public const string PluginVersion = "2.1.0"; private const BindingFlags InstancePrivate = BindingFlags.Instance | BindingFlags.NonPublic; private readonly Dictionary _movementDefaults = new Dictionary(); private Rect _windowRect = new Rect(30f, 30f, 660f, 700f); private Vector2 _scrollPosition; private ConfigEntry _toggleMenuKey; private ConfigEntry _flySpeed; private bool _showMenu; private bool _flyMode; private bool _autoRestoreVitals; private bool _speedBoost; private float _speedMultiplier = 2f; private float _timeScale = 1f; private float _nextVitalsRestore; private int _islandIndex; private int _heldItemSkinIndex; private int _boatSkinIndex; private Vector3? _savedPosition; private string _status = "Load a solo or hosted save, then press Insert."; private int _windowId; private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) _toggleMenuKey = ((BaseUnityPlugin)this).Config.Bind("Hotkeys", "ToggleMenu", new KeyboardShortcut((KeyCode)277, Array.Empty()), "Show or hide the menu."); _flySpeed = ((BaseUnityPlugin)this).Config.Bind("Player", "FlySpeed", 12f, "Movement speed while fly mode is enabled."); _windowId = ((object)this).GetHashCode(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"How to Fish Cheat Menu 2.1.0 loaded."); } private void Update() { //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) KeyboardShortcut value = _toggleMenuKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { _showMenu = !_showMenu; } Player localPlayer = Player.LocalPlayer; if (_flyMode) { MoveLocalPlayer(localPlayer); } if (_speedBoost) { ApplySpeedBoost(localPlayer); } else { RestoreSpeed(localPlayer); } if (_autoRestoreVitals && (Object)(object)localPlayer != (Object)null && Time.unscaledTime >= _nextVitalsRestore) { localPlayer.Vitals.Heal(9999); localPlayer.Vitals.RestoreFullness(9999); _nextVitalsRestore = Time.unscaledTime + 0.5f; } if (!Mathf.Approximately(Time.timeScale, _timeScale)) { Time.timeScale = _timeScale; } } private void OnGUI() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (_showMenu) { _windowRect = GUI.Window(_windowId, _windowRect, new WindowFunction(DrawWindow), "How to Fish Cheat Menu"); } } private void DrawWindow(int id) { //IL_0002: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, Array.Empty()); GUILayout.Label("Solo / Host Utility Menu", Array.Empty()); GUILayout.Label("Networked options are intended for a save you host. Use carefully.", Array.Empty()); DrawMoneySection(); DrawVitalsSection(); DrawMovementSection(); DrawWorldSection(); DrawBoatSection(); DrawHeldItemSection(); DrawProgressSection(); GUILayout.Space(10f); GUILayout.Label(_status, Array.Empty()); GUILayout.EndScrollView(); GUI.DragWindow(new Rect(0f, 0f, 10000f, 20f)); } private void DrawMoneySection() { BeginSection("Money"); GUILayout.Label($"Current: {MoneyManager.Money:N0}", Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); DrawButton("+1,000", delegate { AddMoney(1000); }); DrawButton("+10,000", delegate { AddMoney(10000); }); DrawButton("+100,000", delegate { AddMoney(100000); }); DrawButton("+1,000,000", delegate { AddMoney(1000000); }); GUILayout.EndHorizontal(); EndSection(); } private void DrawVitalsSection() { BeginSection("Player"); Player localPlayer = Player.LocalPlayer; if ((Object)(object)localPlayer == (Object)null) { GUILayout.Label("Player data unavailable. Load into a save first.", Array.Empty()); EndSection(); return; } PlayerVitals vitals = localPlayer.Vitals; GUILayout.Label($"Health: {vitals.Health} Fullness: {vitals.Fullness}", Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); DrawButton("Restore Health", delegate { vitals.Heal(9999); SetStatus("Health restored."); }); DrawButton("Restore Fullness", delegate { vitals.RestoreFullness(9999); SetStatus("Fullness restored."); }); DrawButton(PlayerManager.InGodMode ? "Disable God Mode" : "Enable God Mode", ToggleGodMode); GUILayout.EndHorizontal(); _autoRestoreVitals = GUILayout.Toggle(_autoRestoreVitals, "Auto restore health and fullness", Array.Empty()); EndSection(); } private void DrawMovementSection() { BeginSection("Movement And Teleport"); _flyMode = GUILayout.Toggle(_flyMode, $"Fly Mode ({_flySpeed.Value:F1} u/s)", Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Fly Speed", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }); _flySpeed.Value = GUILayout.HorizontalSlider(_flySpeed.Value, 2f, 60f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) }); GUILayout.EndHorizontal(); GUILayout.Label("Fly controls: WASD, Space up, Left Ctrl down.", Array.Empty()); _speedBoost = GUILayout.Toggle(_speedBoost, "Speed Boost", Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label($"Speed Multiplier: {_speedMultiplier:F1}x", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }); _speedMultiplier = GUILayout.HorizontalSlider(_speedMultiplier, 1f, 10f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) }); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); DrawButton("Save Position", SavePosition); DrawButton("Return To Saved", ReturnToSavedPosition); DrawButton("Forward 25m", delegate { TeleportRelative(0f, 0f, 25f); }); DrawButton("Up 10m", delegate { TeleportRelative(0f, 10f, 0f); }); GUILayout.EndHorizontal(); EndSection(); } private void DrawWorldSection() { BeginSection("World"); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label($"Time Scale: {_timeScale:F2}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) }); _timeScale = GUILayout.HorizontalSlider(_timeScale, 0.1f, 4f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) }); DrawButton("Reset", delegate { _timeScale = 1f; }); GUILayout.EndHorizontal(); int totalIslands = IslandManager.TotalIslands; if (totalIslands > 0) { _islandIndex = Mathf.Clamp(_islandIndex, 0, totalIslands - 1); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label($"Island: {_islandIndex + 1} / {totalIslands}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) }); _islandIndex = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)_islandIndex, 0f, (float)(totalIslands - 1), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) })); DrawButton("Load Island", LoadSelectedIsland); GUILayout.EndHorizontal(); } else { GUILayout.Label("Island data is not loaded yet.", Array.Empty()); } EndSection(); } private void DrawBoatSection() { BeginSection("Boat"); Boat boat = BoatManager.Boat; if ((Object)(object)boat == (Object)null) { GUILayout.Label("No active boat. Spawn or enter the boat first.", Array.Empty()); EndSection(); return; } GUILayout.Label($"Unlocked: {boat.BoatUnlocked} Radar: {boat.BoatRadarUnlocked} Motor: {boat.MotorIndex}", Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); DrawButton("Unlock Boat", delegate { boat.UnlockBoat(); SetStatus("Boat unlocked."); }); DrawButton("Unlock Radar", delegate { boat.UnlockBoatRadar(); SetStatus("Boat radar unlocked."); }); DrawButton("Max Motor", delegate { MaximizeBoatMotor(boat); }); GUILayout.EndHorizontal(); DrawSkinSelector("Boat Skin", boat.SkinPreset, boat.CurSkin, ref _boatSkinIndex, delegate(int skin) { boat.ServerSetSkin((byte)skin); SetStatus($"Boat skin set to {skin}."); }); EndSection(); } private void DrawHeldItemSection() { BeginSection("Held Item"); Player localPlayer = Player.LocalPlayer; Item item = (((Object)(object)localPlayer == (Object)null) ? null : localPlayer.Holding.HeldItem); if ((Object)(object)item == (Object)null) { GUILayout.Label("Hold a fish or item to use these options.", Array.Empty()); EndSection(); return; } GUILayout.Label($"Holding: {item.GetName()} Worth: {item.TotalWorth:N0}", Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); DrawButton("Cook Fully", delegate { item.CookItem(100f); SetStatus("Held item cooked."); }); DrawButton("100x Kill Score", delegate { item.SetKillscoreMultiplier(100f); SetStatus("Held item score multiplier set to 100x."); }); DrawButton("10x Bet Multiplier", delegate { item.AddBetMultiplier(10f); SetStatus("Held item bet multiplier increased."); }); GUILayout.EndHorizontal(); DrawSkinSelector("Item Skin", item.SkinPreset, item.CurSkin, ref _heldItemSkinIndex, delegate(int skin) { SaveManager.UnlockSkin(item.ID, (byte)skin); item.ServerSetSkin((byte)skin); SetStatus("Unlocked and applied " + GetSkinName(item.SkinPreset, skin) + "."); }); DrawButton("Unlock Every Skin On Held Item", delegate { UnlockAllItemSkins(item); }); EndSection(); } private void DrawProgressSection() { BeginSection("Hosted Save Progression"); ServerSaveObject curServerSave = SaveManager.CurServerSave; if (curServerSave == null) { GUILayout.Label("No server save is loaded.", Array.Empty()); EndSection(); return; } GUILayout.Label($"Max Island: {curServerSave.MaxIsland} Boat: {curServerSave.UnlockedBoat} Grill: {curServerSave.UnlockedGrill}", Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); DrawButton("Unlock Boat + Grill", UnlockBasicProgression); DrawButton("Unlock All Islands", UnlockAllIslands); DrawButton("Save Now", SaveNow); GUILayout.EndHorizontal(); EndSection(); } private static void BeginSection(string title) { GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty()); GUILayout.Label(title, Array.Empty()); } private static void EndSection() { GUILayout.EndVertical(); GUILayout.Space(4f); } private static void DrawButton(string label, Action action) { if (GUILayout.Button(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(105f) })) { action(); } } private void DrawSkinSelector(string label, SkinPreset preset, byte currentSkin, ref int selectedSkin, Action applySkin) { if ((Object)(object)preset == (Object)null || preset.Skins == null || preset.Skins.Count == 0) { GUILayout.Label(label + ": no skin data available.", Array.Empty()); return; } selectedSkin = Mathf.Clamp(selectedSkin, 0, preset.Skins.Count - 1); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label($"{label}: {GetSkinName(preset, selectedSkin)} ({selectedSkin}/{preset.Skins.Count - 1})", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(320f) }); selectedSkin = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)selectedSkin, 0f, (float)(preset.Skins.Count - 1), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) })); if (GUILayout.Button("Apply", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) })) { applySkin(selectedSkin); } GUILayout.EndHorizontal(); GUILayout.Label($"Current skin index: {currentSkin}", Array.Empty()); } private static string GetSkinName(SkinPreset preset, int index) { //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) if ((Object)(object)preset == (Object)null || index < 0 || index >= preset.Skins.Count) { return "Unknown"; } ItemSkin val = preset.Skins[index]; return ((ItemSkin)(ref val)).Name; } private void AddMoney(int amount) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) MoneyManager.AddMoney(amount, Vector3.zero); SetStatus($"Added {amount:N0} money."); } private void ToggleGodMode() { PlayerManager.ToggleGodMode(); SetStatus("God mode " + (PlayerManager.InGodMode ? "enabled" : "disabled") + "."); } private void SavePosition() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.LocalPlayer; if ((Object)(object)localPlayer == (Object)null) { SetStatus("No local player is available."); return; } _savedPosition = localPlayer.Transform.position; SetStatus("Position saved."); } private void ReturnToSavedPosition() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!_savedPosition.HasValue) { SetStatus("Save a position first."); } else { Teleport(Player.LocalPlayer, _savedPosition.Value); } } private void TeleportRelative(float x, float y, float z) { //IL_0041: 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_0046: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_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_0072: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.LocalPlayer; if ((Object)(object)localPlayer == (Object)null) { SetStatus("No local player is available."); return; } Vector3 val = Vector3.ProjectOnPlane(((Object)(object)localPlayer.CurCam == (Object)null) ? localPlayer.Transform.forward : ((Component)localPlayer.CurCam).transform.forward, Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; Teleport(localPlayer, localPlayer.Transform.position + normalized * z + Vector3.up * y + localPlayer.Transform.right * x); } private void Teleport(Player player, Vector3 position) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { SetStatus("No local player is available."); return; } player.Movement.Teleport(position, true); SetStatus("Teleported."); } private void LoadSelectedIsland() { IslandManager.LoadIsland((byte)_islandIndex); SetStatus($"Loading island {_islandIndex + 1}."); } private void MaximizeBoatMotor(Boat boat) { IList privateField = GetPrivateField(boat, "_motors"); if (privateField == null || privateField.Count == 0) { SetStatus("Boat motor data is unavailable."); return; } boat.SetMotor((byte)(privateField.Count - 1)); SetStatus("Boat motor upgraded to maximum."); } private void UnlockAllItemSkins(Item item) { SkinPreset skinPreset = item.SkinPreset; if ((Object)(object)skinPreset == (Object)null || skinPreset.Skins == null || skinPreset.Skins.Count == 0) { SetStatus("Held item has no skin data."); return; } for (int i = 0; i < skinPreset.Skins.Count; i++) { SaveManager.UnlockSkin(item.ID, (byte)i); } item.ServerSetSkin((byte)_heldItemSkinIndex); SetStatus($"Unlocked {skinPreset.Skins.Count} skins for {item.GetName()}."); } private void UnlockBasicProgression() { ServerSaveObject curServerSave = SaveManager.CurServerSave; if (curServerSave == null) { SetStatus("No server save is loaded."); return; } curServerSave.UnlockedBoat = true; curServerSave.UnlockedBoatRadar = true; curServerSave.UnlockedGrill = true; SaveManager.SaveServer(false); SetStatus("Boat, radar, and grill unlocked and saved."); } private void UnlockAllIslands() { ServerSaveObject curServerSave = SaveManager.CurServerSave; if (curServerSave == null || IslandManager.TotalIslands <= 0) { SetStatus("Save or island data is unavailable."); return; } curServerSave.MaxIsland = (byte)(IslandManager.TotalIslands - 1); SaveManager.SaveServer(false); SetStatus("All islands unlocked and saved."); } private void SaveNow() { SaveManager.SaveServer(false); SetStatus("Hosted save written to disk."); } private void MoveLocalPlayer(Player player) { //IL_000a: 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) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)player == (Object)null)) { Vector3 val = Vector3.zero; if (Input.GetKey((KeyCode)119)) { val += Vector3.forward; } if (Input.GetKey((KeyCode)115)) { val += Vector3.back; } if (Input.GetKey((KeyCode)97)) { val += Vector3.left; } if (Input.GetKey((KeyCode)100)) { val += Vector3.right; } if (Input.GetKey((KeyCode)32)) { val += Vector3.up; } if (Input.GetKey((KeyCode)306)) { val += Vector3.down; } if (!(val == Vector3.zero)) { Transform val2 = (((Object)(object)player.CurCam == (Object)null) ? null : ((Component)player.CurCam).transform); Vector3 val3 = (((Object)(object)val2 == (Object)null) ? val : val2.TransformDirection(val)); player.Movement.Teleport(player.Transform.position + ((Vector3)(ref val3)).normalized * _flySpeed.Value * Time.unscaledDeltaTime, true); } } } private void ApplySpeedBoost(Player player) { if ((Object)(object)player == (Object)null) { return; } PlayerMovement movement = player.Movement; if (!_movementDefaults.TryGetValue(movement, out MovementDefaults value)) { float privateField = GetPrivateField(movement, "_walkSpeed"); float privateField2 = GetPrivateField(movement, "_sprintSpeed"); if (privateField <= 0f || privateField2 <= 0f) { return; } value = new MovementDefaults(privateField, privateField2); _movementDefaults.Add(movement, value); } SetPrivateField(movement, "_walkSpeed", value.WalkSpeed * _speedMultiplier); SetPrivateField(movement, "_sprintSpeed", value.SprintSpeed * _speedMultiplier); } private void RestoreSpeed(Player player) { if (!((Object)(object)player == (Object)null) && _movementDefaults.TryGetValue(player.Movement, out MovementDefaults value)) { SetPrivateField(player.Movement, "_walkSpeed", value.WalkSpeed); SetPrivateField(player.Movement, "_sprintSpeed", value.SprintSpeed); } } private static T GetPrivateField(object owner, string name) { FieldInfo field = owner.GetType().GetField(name, BindingFlags.Instance | BindingFlags.NonPublic); if (field == null) { return default(T); } object value = field.GetValue(owner); if (value is T) { return (T)value; } return default(T); } private static void SetPrivateField(object owner, string name, T value) { FieldInfo field = owner.GetType().GetField(name, BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(owner, value); } } private void SetStatus(string message) { _status = message; ((BaseUnityPlugin)this).Logger.LogInfo((object)message); } } }