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 WyattsTweaks v1.0.1
plugins/Wyatt-WyattsTweaks/WyattsTweaks.dll
Decompiled 8 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.Utilities; using UnityEngine.UI; using WyattsTweaks.Scripts.Configs; using WyattsTweaks.Scripts.Environment; using WyattsTweaks.Scripts.Input; using WyattsTweaks.Scripts.Inventory; using WyattsTweaks.Scripts.Items; using WyattsTweaks.Scripts.Moons; using WyattsTweaks.Scripts.Networking; using WyattsTweaks.Scripts.Player; using WyattsTweaks.Scripts.Systems; using WyattsTweaks.Scripts.Teleportation; using WyattsTweaks.Scripts.Utilities; using WyattsTweaks.Scripts.World; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("WyattsTweaks")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A custom mod for Lethal Company")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("WyattsTweaks")] [assembly: AssemblyTitle("WyattsTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [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; } } } public class MoaiItem : GrabbableObject { public AudioClip clickSound; private AudioSource audioSource; private void Awake() { audioSource = ((Component)this).GetComponent<AudioSource>(); } public override void ItemActivate(bool used, bool buttonDown) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown && (Object)(object)audioSource != (Object)null && (Object)(object)clickSound != (Object)null) { audioSource.PlayOneShot(clickSound); } } } namespace WyattsTweaks { public static class PluginInfo { public const string PLUGIN_GUID = "WyattsTweaks"; public const string PLUGIN_NAME = "WyattsTweaks"; public const string PLUGIN_VERSION = "1.0.1"; } } namespace WyattsTweaks.Scripts { [BepInPlugin("wyatt.WyattsTweaks", "WyattsTweaks", "1.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class WyattsTweaks : BaseUnityPlugin { public static class Compatibility { public static bool ReservedSlotCoreCompat; public static bool ReservedSlotsWalkieCompat; public static bool ReservedSlotsFlashlightCompat; public static bool LethalThingsCompat; public static bool LateGameUpgradesCompat; } public const string GUID = "wyatt.WyattsTweaks"; public const bool DebugMode = false; public static AssetBundle Assets; public static ManualLogSource Log; public static WyattsTweaks Instance { get; private set; } public void BindConfig<T>(ref ConfigEntrySettings<T> config, string SectionName) { config.Entry = ((BaseUnityPlugin)this).Config.Bind<T>(SectionName, config.ConfigName, config.DefaultValue, config.ConfigDesc); } public void LoadConfigs() { ((BaseUnityPlugin)this).Config.Reload(); ConfigsSynchronizer.ConfigsReceived = false; } private void Awake() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; WorldTweaks.RegisterConfigs(); MoonTweaks.RegisterConfigs(); PlayerTweaks.RegisterConfigs(); InventoryTweaks.RegisterConfigs(); ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; CheckCompatibilities(); Harmony val = new Harmony("wyatt.WyattsTweaks"); val.PatchAll(typeof(MenuManager_Patches)); val.PatchAll(typeof(HUDManager_Patches)); val.PatchAll(typeof(NetworkManager_Patches)); val.PatchAll(typeof(StartOfRound_Patches)); val.PatchAll(typeof(TimeOfDay_Patches)); val.PatchAll(typeof(InteractTrigger_Patches)); val.PatchAll(typeof(Terminal_Patches)); val.PatchAll(typeof(PlayerControllerB_Patches)); val.PatchAll(typeof(GrabbableObject_Patches)); val.PatchAll(typeof(TeleportMenuLoader)); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); Assets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "assets")); if ((Object)(object)Assets == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load custom assets."); return; } Item val2 = Assets.LoadAsset<Item>("Assets/Wyatt's Tweaks/Moai/Moai.asset"); Utilities.FixMixerGroups(val2.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Items.RegisterScrap(val2, 30, (LevelTypes)(-1)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin wyatt.WyattsTweaks is loaded!"); } private void CheckCompatibilities() { Compatibility.ReservedSlotCoreCompat = IsModPresent("FlipMods.ReservedItemSlotCore"); Compatibility.ReservedSlotsWalkieCompat = IsModPresent("FlipMods.ReservedWalkieSlot"); Compatibility.ReservedSlotsFlashlightCompat = IsModPresent("FlipMods.ReservedFlashlightSlot"); Compatibility.LethalThingsCompat = IsModPresent("evaisa.lethalthings"); Compatibility.LateGameUpgradesCompat = IsModPresent("com.malco.lethalcompany.moreshipupgrades"); } public static bool IsModPresent(string name) { foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { if (name == pluginInfo.Value.Metadata.GUID) { Log.LogInfo((object)("Found: " + pluginInfo.Value.Metadata.Name)); return true; } } return false; } } } namespace WyattsTweaks.Scripts.World { public class WorldTweaks { public class Configs { public static ConfigEntrySettings<float> GlobalTimeSpeedMulti = new ConfigEntrySettings<float>("GlobalTimeSpeedMultiplier", 0.7f, 1.4f, "Think of this as a percentage, the lower it is, the slower the time goes by, the higher it is, the faster time passes."); public static ConfigEntrySettings<bool> AllowHotbarKeybinds = new ConfigEntrySettings<bool>("AllowHotbarKeybinds", defaultValue: true, vanillaValue: false, "Set this to false if you don't want people who join your lobby to be able to use the hotbar keybinds and to true if you want them to be able to."); public static ConfigEntrySettings<bool> AllowFlashlightKeybind = new ConfigEntrySettings<bool>("AllowFlashlightKeybind", defaultValue: true, vanillaValue: false, "Set this to false if you don't want people who join your lobby to be able to use the Flashlight keybind and to true if you want them to be able to."); public static ConfigEntrySettings<bool> AllowWalkieTalkieKeybind = new ConfigEntrySettings<bool>("AllowWalkieTalkieKeybind", defaultValue: true, vanillaValue: false, "Set this to false if you don't want people who join your lobby to be able to use the WalkieTalkie keybind and to true if you want them to be able to."); public static ConfigEntrySettings<bool> AllowClientsToUseTerminal = new ConfigEntrySettings<bool>("AllowClientsToUseTerminal", defaultValue: true, vanillaValue: true, "Set this to false if you don't want people who join your lobby to be able to use the terminal and to true if you want them to be able to.\nYou probably want to set this to true if you're hosting a lobby with people you know and trust."); public static ConfigEntrySettings<bool> UseVanillaSprintSpeedValues = new ConfigEntrySettings<bool>("UseVanillaSprintSpeedValues", defaultValue: false, vanillaValue: true, "Set this to true if you want to use all the vanilla values tied to sprinting.\nStamina drain related configs not included."); public static ConfigEntrySettings<bool> UseVanillaStaminaValues = new ConfigEntrySettings<bool>("UseVanillaStaminaValues", defaultValue: false, vanillaValue: true, "Set this to true if you want to use all the vanilla values tied to stamina.\nSprint speed related configs not included."); public static ConfigEntrySettings<bool> UseVanillaToolItemWeights = new ConfigEntrySettings<bool>("UseVanillaToolItemWeights", defaultValue: false, vanillaValue: true, "Set this to true if you want to use all the vanilla values for the weight of every tool item."); public static ConfigEntrySettings<bool> UseVanillaToolItemPrices = new ConfigEntrySettings<bool>("UseVanillaToolItemPrices", defaultValue: false, vanillaValue: true, "Set this to true if you want to use all the vanilla values for the price of every tool item."); public static ConfigEntrySettings<bool> UseVanillaMoonCosts = new ConfigEntrySettings<bool>("UseVanillaMoonCosts", defaultValue: false, vanillaValue: true, "Set this to true if you want to use all the vanilla values for the cost of traveling to the moons."); public static string GameRulesSectionHeader => "GameRules"; } public static Terminal TerminalInstance = null; public static InteractTrigger TerminalInteractTriggerInstance = null; private static readonly MethodInfo TerminalTriggerInUseRPC = typeof(InteractTrigger).GetMethod("UpdateUsedByPlayerServerRpc", BindingFlags.Instance | BindingFlags.NonPublic); public static void RegisterConfigs() { WyattsTweaks.Instance.BindConfig(ref Configs.GlobalTimeSpeedMulti, Configs.GameRulesSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.AllowHotbarKeybinds, Configs.GameRulesSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.AllowFlashlightKeybind, Configs.GameRulesSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.AllowWalkieTalkieKeybind, Configs.GameRulesSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.AllowClientsToUseTerminal, Configs.GameRulesSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.UseVanillaSprintSpeedValues, Configs.GameRulesSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.UseVanillaStaminaValues, Configs.GameRulesSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.UseVanillaToolItemWeights, Configs.GameRulesSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.UseVanillaToolItemPrices, Configs.GameRulesSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.UseVanillaMoonCosts, Configs.GameRulesSectionHeader); ConfigsSynchronizer.OnConfigsChangedDelegate = (Action)Delegate.Combine(ConfigsSynchronizer.OnConfigsChangedDelegate, (Action)delegate { ReapplyConfigs(TimeOfDay.Instance); }); ConfigsSynchronizer.Instance.AddConfigGetter(WriteConfigsToWriter); ConfigsSynchronizer.Instance.AddConfigSetter(ReadConfigChanges); ConfigsSynchronizer.Instance.AddConfigSizeGetter(() => 9); } public static FastBufferWriter WriteConfigsToWriter(FastBufferWriter writer) { //IL_0013: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) float num = Configs.GlobalTimeSpeedMulti.Value(); ((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives)); bool flag = Configs.AllowFlashlightKeybind.Value(); ((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); flag = Configs.AllowWalkieTalkieKeybind.Value(); ((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); flag = Configs.AllowHotbarKeybinds.Value(); ((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); flag = Configs.UseVanillaToolItemPrices.Value(); ((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); flag = Configs.UseVanillaMoonCosts.Value(); ((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); return writer; } public static FastBufferReader ReadConfigChanges(FastBufferReader payload) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00dd: Unknown result type (might be due to invalid IL or missing references) float value = default(float); ((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives)); Configs.GlobalTimeSpeedMulti.Entry.Value = value; bool value2 = default(bool); ((FastBufferReader)(ref payload)).ReadValue<bool>(ref value2, default(ForPrimitives)); Configs.AllowFlashlightKeybind.Entry.Value = value2; ((FastBufferReader)(ref payload)).ReadValue<bool>(ref value2, default(ForPrimitives)); Configs.AllowWalkieTalkieKeybind.Entry.Value = value2; ((FastBufferReader)(ref payload)).ReadValue<bool>(ref value2, default(ForPrimitives)); Configs.AllowHotbarKeybinds.Entry.Value = value2; ((FastBufferReader)(ref payload)).ReadValue<bool>(ref value2, default(ForPrimitives)); Configs.UseVanillaToolItemPrices.Entry.Value = value2; ((FastBufferReader)(ref payload)).ReadValue<bool>(ref value2, default(ForPrimitives)); Configs.UseVanillaMoonCosts.Entry.Value = value2; return payload; } public static void ReapplyConfigs(TimeOfDay timeOfDay) { timeOfDay.globalTimeSpeedMultiplier = Configs.GlobalTimeSpeedMulti.Value(); } public static bool CanInteractWithTerminal(InteractTrigger __instance) { if (!NetworkManager.Singleton.IsServer) { return false; } if (Configs.AllowClientsToUseTerminal.Value()) { return false; } return (Object)(object)TerminalInteractTriggerInstance == (Object)(object)__instance; } public static void MakeTerminalUnusableForAnyoneButHost() { if (NetworkManager.Singleton.IsServer && !Configs.AllowClientsToUseTerminal.Value()) { object[] parameters = new object[1] { 0 }; TerminalTriggerInUseRPC.Invoke(TerminalInteractTriggerInstance, parameters); } } public static void ResetValues(InteractTrigger trigger) { if (trigger.hidePlayerItem && (Object)(object)StartOfRound.Instance.allPlayerScripts[0].currentlyHeldObjectServer != (Object)null) { StartOfRound.Instance.allPlayerScripts[0].currentlyHeldObjectServer.EnableItemMeshes(true); typeof(InteractTrigger).GetField("playerUsingId", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(trigger, -1); } StartOfRound.Instance.allPlayerScripts[0].currentTriggerInAnimationWith = null; trigger.isPlayingSpecialAnimation = false; } } } namespace WyattsTweaks.Scripts.Utilities { public static class StringUtils { public static void RemoveChar(ref string str, char character) { List<int> list = new List<int>(); for (int num = str.Length - 1; num >= 0; num--) { if (str[num] == character) { list.Add(num); } } for (int i = 0; i < list.Count; i++) { str = str.Remove(list[i], 1); } } } } namespace WyattsTweaks.Scripts.Teleportation { public class TeleportMenu : MonoBehaviour { private bool showMenu = false; private Rect windowRect = new Rect(50f, 50f, 400f, 250f); private List<Component> teleportObjects = new List<Component>(); private int sourceIndex = 0; private int destinationIndex = 0; private void Awake() { WyattsTweaks.Log.LogInfo((object)"TeleportMenu Awake"); } private void Start() { WyattsTweaks.Log.LogInfo((object)"TeleportMenu Start"); } private void OnEnable() { WyattsTweaks.Log.LogInfo((object)"TeleportMenu OnEnable"); } private void Update() { if (Keyboard.current != null && ((ButtonControl)Keyboard.current.f1Key).wasPressedThisFrame) { showMenu = !showMenu; Cursor.visible = showMenu; Cursor.lockState = (CursorLockMode)(!showMenu); } if (Time.frameCount % 300 == 0) { WyattsTweaks.Log.LogInfo((object)"TeleportMenu Update running"); } } private void OnGUI() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (showMenu) { windowRect = GUI.Window(1337, windowRect, new WindowFunction(DrawWindow), "Teleport Menu"); } } private void DrawWindow(int id) { GUILayout.Space(10f); if (GUILayout.Button("Refresh", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { Refresh(); } GUILayout.Space(15f); GUILayout.Label("Source", Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) })) { sourceIndex--; if (sourceIndex < 0) { sourceIndex = teleportObjects.Count - 1; } } GUILayout.Label((teleportObjects.Count > 0) ? GetObjectName(teleportObjects[sourceIndex]) : "None", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) }); if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) })) { sourceIndex++; if (sourceIndex >= teleportObjects.Count) { sourceIndex = 0; } } GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.Label("Destination", Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) })) { destinationIndex--; if (destinationIndex < 0) { destinationIndex = teleportObjects.Count - 1; } } GUILayout.Label((teleportObjects.Count > 0) ? GetObjectName(teleportObjects[destinationIndex]) : "None", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) }); if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) })) { destinationIndex++; if (destinationIndex >= teleportObjects.Count) { destinationIndex = 0; } } GUILayout.EndHorizontal(); GUILayout.Space(20f); if (GUILayout.Button("Teleport", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) })) { Teleport(); } GUI.DragWindow(); } private void Teleport() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: 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_0205: Unknown result type (might be due to invalid IL or missing references) if (teleportObjects.Count == 0) { return; } Component val = teleportObjects[sourceIndex]; Component val2 = teleportObjects[destinationIndex]; if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { return; } Vector3 val3 = val2.transform.position + Vector3.up * 0.5f; PlayerControllerB val4 = (PlayerControllerB)(object)((val is PlayerControllerB) ? val : null); if (val4 != null) { val4.TeleportPlayer(val3, false, 0f, false, true); return; } WyattsTweaks.Log.LogInfo((object)"========== TELEPORT DEBUG =========="); WyattsTweaks.Log.LogInfo((object)("Source: " + ((Object)val).name)); Transform val5 = val.transform; while ((Object)(object)val5 != (Object)null) { WyattsTweaks.Log.LogInfo((object)("Transform: " + ((Object)val5).name)); Component[] components = ((Component)val5).GetComponents<Component>(); foreach (Component val6 in components) { if ((Object)(object)val6 != (Object)null) { WyattsTweaks.Log.LogInfo((object)(" - " + ((object)val6).GetType().Name)); } } val5 = val5.parent; } WyattsTweaks.Log.LogInfo((object)$"Type: {((object)val).GetType()}"); WyattsTweaks.Log.LogInfo((object)$"Position BEFORE: {val.transform.position}"); PhysicsProp val7 = (PhysicsProp)(object)((val is PhysicsProp) ? val : null); if ((Object)(object)val7 != (Object)null) { WyattsTweaks.Log.LogInfo((object)("Teleporting scrap: " + ((Object)val7).name)); ((Component)val7).transform.position = val3; ((Component)val7).transform.rotation = Quaternion.identity; ((GrabbableObject)val7).startFallingPosition = val3; ((GrabbableObject)val7).targetFloorPosition = val3; ((GrabbableObject)val7).fallTime = 1f; } WyattsTweaks.Log.LogInfo((object)$"Position AFTER: {val.transform.position}"); Rigidbody component = val.GetComponent<Rigidbody>(); WyattsTweaks.Log.LogInfo((object)(((Object)(object)component == (Object)null) ? "Rigidbody on source: NULL" : ("Rigidbody on source: " + ((Object)component).name))); Rigidbody componentInParent = val.GetComponentInParent<Rigidbody>(); WyattsTweaks.Log.LogInfo((object)(((Object)(object)componentInParent == (Object)null) ? "Parent Rigidbody: NULL" : ("Parent Rigidbody: " + ((Object)componentInParent).name))); NetworkObject componentInParent2 = val.GetComponentInParent<NetworkObject>(); WyattsTweaks.Log.LogInfo((object)(((Object)(object)componentInParent2 == (Object)null) ? "NetworkObject: NULL" : ("NetworkObject: " + ((Object)componentInParent2).name))); WyattsTweaks.Log.LogInfo((object)"========== END DEBUG =========="); } private string GetObjectName(Component obj) { PlayerControllerB val = (PlayerControllerB)(object)((obj is PlayerControllerB) ? obj : null); if (val != null) { return val.playerUsername; } NetworkObject componentInParent = obj.GetComponentInParent<NetworkObject>(); if (componentInParent != null) { return ((Object)componentInParent).name; } return ((object)obj).ToString(); } private void Refresh() { teleportObjects.Clear(); PlayerControllerB[] array = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0); foreach (PlayerControllerB item in array) { teleportObjects.Add((Component)(object)item); } PhysicsProp[] array2 = Object.FindObjectsByType<PhysicsProp>((FindObjectsSortMode)0); foreach (PhysicsProp item2 in array2) { teleportObjects.Add((Component)(object)item2); } sourceIndex = 0; destinationIndex = 0; } } [HarmonyPatch(typeof(StartOfRound), "Start")] public class TeleportMenuLoader { private static bool loaded; private static void Postfix() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown if (!loaded) { loaded = true; GameObject val = new GameObject("TeleportMenu"); Object.DontDestroyOnLoad((Object)(object)val); val.AddComponent<TeleportMenu>(); WyattsTweaks.Log.LogInfo((object)"TeleportMenu loaded after game start."); } } } } namespace WyattsTweaks.Scripts.Systems { [HarmonyPatch(typeof(HUDManager))] public class HUDManager_Patches { [HarmonyPatch("Awake")] [HarmonyPostfix] public static void Awake(HUDManager __instance) { if (NetworkManager.Singleton.IsServer && !WyattsTweaks.Compatibility.ReservedSlotCoreCompat) { InventoryTweaks.ChangeItemSlotsAmountUI(); } } } [HarmonyPatch(typeof(IngamePlayerSettings))] public class IngamePlayerSettings_Patches { [HarmonyPatch("RebindKey")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> AllowMouseBinding(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { CodeInstruction val = list[i]; if (!(val.opcode != OpCodes.Ldstr) && !((string)val.operand != "Mouse")) { list.RemoveAt(i + 1); list.RemoveAt(i); } } return list.AsEnumerable(); } } [HarmonyPatch(typeof(MenuManager))] public class MenuManager_Patches { [HarmonyPatch("Start")] [HarmonyPostfix] private static void MenuManager_Start(MenuManager __instance) { WyattsTweaks.Instance.LoadConfigs(); CustomNetworking.Instance.UnregisterChannels(); } } [HarmonyPatch(typeof(NetworkManager))] public static class NetworkManager_Patches { [HarmonyPatch("StartHost")] [HarmonyPostfix] private static void StartHost_Post(GameNetworkManager __instance) { ConfigsSynchronizer.Instance.RegisterMessages(); } [HarmonyPatch("StartClient")] [HarmonyPostfix] private static void StartClient_Post(GameNetworkManager __instance) { ConfigsSynchronizer.Instance.RegisterMessages(); } } [HarmonyPatch(typeof(StartOfRound))] public static class StartOfRound_Patches { [HarmonyPatch("OnPlayerConnectedClientRpc")] [HarmonyPostfix] private static void OnPlayerConnectedClientRpc(StartOfRound __instance, ulong clientId, int assignedPlayerObjectId) { if (!NetworkManager.Singleton.IsServer) { ConfigsSynchronizer.Instance.RequestConfigs(); } } } [HarmonyPatch(typeof(TimeOfDay))] public class TimeOfDay_Patches { [HarmonyPatch("Start")] [HarmonyPostfix] private static void ChangeTimeSpeedMultiplier(TimeOfDay __instance) { if (NetworkManager.Singleton.IsServer) { WorldTweaks.ReapplyConfigs(__instance); } } } } namespace WyattsTweaks.Scripts.Player { [HarmonyPatch(typeof(PlayerControllerB))] public static class PlayerControllerB_Patches { private static PlayerInputRedirection inputRedirection; public static void SetupKeybinds(PlayerControllerB player) { if (PlayerTweaks.IsLocallyControlled(player)) { inputRedirection = ((Component)player).gameObject.GetComponent<PlayerInputRedirection>(); inputRedirection.InitializeKeybinds(); } } private static bool InsertStaminaRechargeMovementHinderedWalking(ref List<CodeInstruction> instructions, CodeInstruction instruction, int i, ref List<int> IndexesToRemove) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown if (instruction.opcode != OpCodes.Ldc_R4) { return false; } if (Math.Abs((float)instruction.operand - 0.5f) > 0.01f) { return false; } instructions[i - 7] = new CodeInstruction(OpCodes.Ldloc_0, (object)null); instructions[i - 6] = CodeInstruction.Call(typeof(PlayerTweaks), "StaminaRechargeMovementHinderedWalking", (Type[])null, (Type[])null); instructions[i - 5] = CodeInstruction.StoreField(typeof(PlayerControllerB), "sprintMeter"); for (int j = i - 4; j <= i + 6; j++) { IndexesToRemove.Add(j); } return true; } private static bool InsertStaminaRechargeMovementNotHinderedWalking(ref List<CodeInstruction> instructions, CodeInstruction instruction, int i, ref List<int> IndexesToRemove) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown if (instruction.opcode != OpCodes.Ldc_R4) { return false; } if (Math.Abs((float)instruction.operand - 9f) > 0.01f) { return false; } instructions[i - 4] = new CodeInstruction(OpCodes.Ldloc_0, (object)null); instructions[i - 3] = CodeInstruction.Call(typeof(PlayerTweaks), "StaminaRechargeMovementNotHinderedWalking", (Type[])null, (Type[])null); instructions[i - 2] = CodeInstruction.StoreField(typeof(PlayerControllerB), "sprintMeter"); for (int j = i - 1; j <= i + 9; j++) { IndexesToRemove.Add(j); } return true; } private static bool InsertStaminaRechargeMovementNotHinderedNotWalking(ref List<CodeInstruction> instructions, CodeInstruction instruction, int i, ref List<int> IndexesToRemove) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown if (instruction.opcode != OpCodes.Ldc_R4) { return false; } if (Math.Abs((float)instruction.operand - 4f) > 0.01f) { return false; } instructions[i - 4] = new CodeInstruction(OpCodes.Ldloc_0, (object)null); instructions[i - 3] = CodeInstruction.Call(typeof(PlayerTweaks), "StaminaRechargeMovementNotHinderedNotWalking", (Type[])null, (Type[])null); instructions[i - 2] = CodeInstruction.StoreField(typeof(PlayerControllerB), "sprintMeter"); for (int j = i - 1; j <= i + 9; j++) { IndexesToRemove.Add(j); } return true; } [HarmonyPatch("Awake")] [HarmonyPostfix] private static void Awake(PlayerControllerB __instance) { GameObject gameObject = ((Component)__instance).gameObject; gameObject.AddComponent<PlayerInputRedirection>(); if (NetworkManager.Singleton.IsServer) { PlayerTweaks.ReapplyConfigs(__instance); } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start(PlayerControllerB __instance) { PlayerTweaks.RegisterSwitchSlotMessage(); } private static void ModifySprintMultiplierValues(ref List<CodeInstruction> instructions) { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Expected O, but got Unknown //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Expected O, but got Unknown //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Expected O, but got Unknown float num = 2.25f; float num2 = 1f; float num3 = 1f; float num4 = 10f; int num5 = -1; bool flag = false; bool flag2 = false; bool flag3 = false; for (int i = 0; i < instructions.Count; i++) { CodeInstruction val = instructions[i]; if (!(val.opcode != OpCodes.Ldc_R4) && !((double)Math.Abs((float)val.operand - num) > 0.1)) { num5 = i; instructions[i] = CodeInstruction.Call(typeof(ConfigEntrySettings<float>), "Value", (Type[])null, (Type[])null); instructions.Insert(i, CodeInstruction.Call(typeof(ConfigEntrySettings<bool>), "Value", (Type[])null, (Type[])null)); instructions.Insert(i, new CodeInstruction(OpCodes.Ldc_I4_0, (object)null)); instructions.Insert(i, CodeInstruction.LoadField(typeof(WorldTweaks.Configs), "UseVanillaSprintSpeedValues", false)); instructions.Insert(i, CodeInstruction.LoadField(typeof(PlayerTweaks.Configs), "MaxSprintSpeed", false)); break; } } if (num5 == -1) { return; } for (int j = num5; j < instructions.Count; j++) { CodeInstruction val2 = instructions[j]; if (val2.opcode == OpCodes.Ldc_R4) { if (flag2 && flag3 && flag) { break; } if (!flag && (double)Math.Abs((float)val2.operand - num2) < 0.1) { instructions[j] = CodeInstruction.Call(typeof(ConfigEntrySettings<float>), "Value", (Type[])null, (Type[])null); instructions.Insert(j, CodeInstruction.Call(typeof(ConfigEntrySettings<bool>), "Value", (Type[])null, (Type[])null)); instructions.Insert(j, new CodeInstruction(OpCodes.Ldc_I4_0, (object)null)); instructions.Insert(j, CodeInstruction.LoadField(typeof(WorldTweaks.Configs), "UseVanillaSprintSpeedValues", false)); instructions.Insert(j, CodeInstruction.LoadField(typeof(PlayerTweaks.Configs), "SprintSpeedIncreasePerFrame", false)); flag = true; } else if (!flag2 && (double)Math.Abs((float)val2.operand - num3) < 0.1) { instructions[j] = CodeInstruction.Call(typeof(ConfigEntrySettings<float>), "Value", (Type[])null, (Type[])null); instructions.Insert(j, CodeInstruction.Call(typeof(ConfigEntrySettings<bool>), "Value", (Type[])null, (Type[])null)); instructions.Insert(j, new CodeInstruction(OpCodes.Ldc_I4_0, (object)null)); instructions.Insert(j, CodeInstruction.LoadField(typeof(WorldTweaks.Configs), "UseVanillaSprintSpeedValues", false)); instructions.Insert(j, CodeInstruction.LoadField(typeof(PlayerTweaks.Configs), "DefaultSprintSpeed", false)); flag2 = true; } else if (!flag3 && (double)Math.Abs((float)val2.operand - num4) < 0.1) { instructions[j] = CodeInstruction.Call(typeof(ConfigEntrySettings<float>), "Value", (Type[])null, (Type[])null); instructions.Insert(j, CodeInstruction.Call(typeof(ConfigEntrySettings<bool>), "Value", (Type[])null, (Type[])null)); instructions.Insert(j, new CodeInstruction(OpCodes.Ldc_I4_0, (object)null)); instructions.Insert(j, CodeInstruction.LoadField(typeof(WorldTweaks.Configs), "UseVanillaSprintSpeedValues", false)); instructions.Insert(j, CodeInstruction.LoadField(typeof(PlayerTweaks.Configs), "SprintSpeedDecreasePerFrame", false)); flag3 = true; } } } } [HarmonyPatch("Update")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Update_Transpiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> instructions2 = new List<CodeInstruction>(instructions); ModifySprintMultiplierValues(ref instructions2); return instructions2.AsEnumerable(); } [HarmonyPatch("ConnectClientToPlayerObject")] [HarmonyPostfix] private static void AddHotkeys(PlayerControllerB __instance) { SetupKeybinds(__instance); } [HarmonyPatch("LateUpdate")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions) { foreach (CodeInstruction instruction in instructions) { if (instruction.opcode == OpCodes.Ldc_R4) { float value = (float)instruction.operand; if (Math.Abs(value - 4f) < 0.01f) { yield return CodeInstruction.LoadField(typeof(PlayerTweaks.Configs), "StaminaWeightWhileStandingStill", false); yield return new CodeInstruction(OpCodes.Ldc_I4_0, (object)null); yield return CodeInstruction.Call(typeof(ConfigEntrySettings<float>), "Value", (Type[])null, (Type[])null); continue; } if (Math.Abs(value - 9f) < 0.01f) { yield return CodeInstruction.LoadField(typeof(PlayerTweaks.Configs), "StaminaWeightWhileWalking", false); yield return new CodeInstruction(OpCodes.Ldc_I4_0, (object)null); yield return CodeInstruction.Call(typeof(ConfigEntrySettings<float>), "Value", (Type[])null, (Type[])null); continue; } } yield return instruction; } } [HarmonyPatch("Jump_performed")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> ModifyJumpDrain(IEnumerable<CodeInstruction> instructions) { foreach (CodeInstruction instruction in instructions) { if (instruction.opcode == OpCodes.Ldc_R4 && Math.Abs((float)instruction.operand - 0.08f) < 0.001f) { yield return CodeInstruction.LoadField(typeof(PlayerTweaks.Configs), "JumpStaminaDrain", false); yield return new CodeInstruction(OpCodes.Ldc_I4_0, (object)null); yield return CodeInstruction.Call(typeof(ConfigEntrySettings<float>), "Value", (Type[])null, (Type[])null); } else { yield return instruction; } } } [HarmonyPatch("Emote1_performed")] [HarmonyPrefix] private static bool Emote1_performed() { return false; } [HarmonyPatch("Emote2_performed")] [HarmonyPrefix] private static bool Emote2_performed() { return false; } [HarmonyPatch("SendNewPlayerValuesClientRpc")] [HarmonyPostfix] private static void ConnectClientToPlayerObject(PlayerControllerB __instance) { WorldTweaks.MakeTerminalUnusableForAnyoneButHost(); } [HarmonyPatch("OnEnable")] [HarmonyPostfix] private static void OnEnable(PlayerControllerB __instance) { if (PlayerTweaks.IsLocallyControlled(__instance)) { inputRedirection?.OnEnable(); } } [HarmonyPatch("OnDisable")] [HarmonyPostfix] private static void OnDisable(PlayerControllerB __instance) { if (PlayerTweaks.IsLocallyControlled(__instance)) { inputRedirection?.OnDisable(); } } [HarmonyPatch("OnDestroy")] [HarmonyPrefix] public static void OnDestroy(PlayerControllerB __instance) { if (PlayerTweaks.IsLocallyControlled(__instance)) { inputRedirection?.Destroy(); inputRedirection = null; } } } public class PlayerInputRedirection : MonoBehaviour, WyattsTweaksPlayerInput.IHotbarActions, WyattsTweaksPlayerInput.IEmotesActions, WyattsTweaksPlayerInput.IActionsActions { private PlayerControllerB owner = null; private WyattsTweaksPlayerInput input = null; private MethodInfo SwitchToSlotMethod = null; private WalkieTalkie WalkieTalkieToStop = null; private FlashlightItem FlashlightToStop = null; public void OnHotbar1(CallbackContext context) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 if ((int)((CallbackContext)(ref context)).phase == 3) { RequestSlotChange(0); } } public void OnHotbar2(CallbackContext context) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 if ((int)((CallbackContext)(ref context)).phase == 3) { RequestSlotChange(1); } } public void OnHotbar3(CallbackContext context) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 if ((int)((CallbackContext)(ref context)).phase == 3) { RequestSlotChange(2); } } public void OnHotbar4(CallbackContext context) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 if ((int)((CallbackContext)(ref context)).phase == 3) { RequestSlotChange(3); } } public void OnHotbar5(CallbackContext context) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 if ((int)((CallbackContext)(ref context)).phase == 3 && InventoryTweaks.HasEnoughSlots(4)) { RequestSlotChange(4); } } public void OnHotbar6(CallbackContext context) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 if ((int)((CallbackContext)(ref context)).phase == 3 && InventoryTweaks.HasEnoughSlots(5)) { RequestSlotChange(5); } } public void OnHotbar7(CallbackContext context) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 if ((int)((CallbackContext)(ref context)).phase == 3 && InventoryTweaks.HasEnoughSlots(6)) { RequestSlotChange(6); } } public void OnHotbar8(CallbackContext context) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 if ((int)((CallbackContext)(ref context)).phase == 3 && InventoryTweaks.HasEnoughSlots(7)) { RequestSlotChange(7); } } public void OnHotbar9(CallbackContext context) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 if ((int)((CallbackContext)(ref context)).phase == 3 && InventoryTweaks.HasEnoughSlots(8)) { RequestSlotChange(8); } } public void OnEmote1(CallbackContext context) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB obj = owner; if (obj != null) { obj.PerformEmote(context, 1); } } public void OnEmote2(CallbackContext context) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB obj = owner; if (obj != null) { obj.PerformEmote(context, 2); } } public void OnFlashlightToggle(CallbackContext context) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 if ((int)((CallbackContext)(ref context)).phase == 3) { ToggleFlashlight(); } } public void OnWalkieTalkieSpeak(CallbackContext context) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 InputActionPhase phase = ((CallbackContext)(ref context)).phase; InputActionPhase val = phase; if ((int)val != 3) { if ((int)val == 4) { StopUsingWalkieTalkie(); } } else { UseWalkieTalkie(); } } public void OnEnable() { input?.Enable(); } public void OnDisable() { input?.Disable(); } public void Destroy() { input?.Dispose(); } public void InitializeKeybinds() { owner = ((Component)this).gameObject.GetComponent<PlayerControllerB>(); input = new WyattsTweaksPlayerInput(); input.Hotbar.SetCallbacks(this); input.Emotes.SetCallbacks(this); input.Actions.SetCallbacks(this); input.Enable(); SetupKeybinds(); } public void SetupKeybinds() { //IL_0015: 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_002a: 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_0059: 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_0088: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) BindingSyntax val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar1, 0); ((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[0].Value()); val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar2, 0); ((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[1].Value()); val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar3, 0); ((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[2].Value()); val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar4, 0); ((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[3].Value()); val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar5, 0); ((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[4].Value()); val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar6, 0); ((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[5].Value()); val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar7, 0); ((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[6].Value()); val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar8, 0); ((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[7].Value()); val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar9, 0); ((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[8].Value()); val = InputActionSetupExtensions.ChangeBinding(input.Emotes.Emote1, 0); ((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.EmoteKeybinds[0].Value()); val = InputActionSetupExtensions.ChangeBinding(input.Emotes.Emote2, 0); ((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.EmoteKeybinds[1].Value()); val = InputActionSetupExtensions.ChangeBinding(input.Actions.FlashlightToggle, 0); ((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.FlashlightKeybind.Value()); val = InputActionSetupExtensions.ChangeBinding(input.Actions.WalkieTalkieSpeak, 0); ((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.WalkieTalkieKeybind.Value()); } private void FindBestFlashlight(ref FlashlightItem BestFlashlight, ref List<FlashlightItem> Flashlights) { foreach (FlashlightItem Flashlight in Flashlights) { if ((Object)(object)BestFlashlight == (Object)null) { BestFlashlight = Flashlight; } else if (((GrabbableObject)Flashlight).insertedBattery.charge > ((GrabbableObject)BestFlashlight).insertedBattery.charge && ((GrabbableObject)Flashlight).insertedBattery.charge > 0f) { BestFlashlight = Flashlight; } } } private void UseSelectedFlashlight(ref FlashlightItem Flashlight, ref FieldInfo timeSinceSwitchingSlots) { bool isPocketed = ((GrabbableObject)Flashlight).isPocketed; ((GrabbableObject)Flashlight).UseItemOnClient(true); timeSinceSwitchingSlots.SetValue(owner, 0f); FlashlightToStop = Flashlight; if (isPocketed) { ((GrabbableObject)Flashlight).playerHeldBy.ChangeHelmetLight(Flashlight.flashlightTypeID, ((GrabbableObject)Flashlight).isBeingUsed); ((GrabbableObject)Flashlight).PocketItem(); } } private void ToggleFlashlight() { if ((!NetworkManager.Singleton.IsServer && !ConfigsSynchronizer.ConfigsReceived) || !WorldTweaks.Configs.AllowFlashlightKeybind.Value() || WyattsTweaks.Compatibility.ReservedSlotsFlashlightCompat || !PlayerTweaks.CanUseItem(owner)) { return; } FieldInfo timeSinceSwitchingSlots = typeof(PlayerControllerB).GetField("timeSinceSwitchingSlots", BindingFlags.Instance | BindingFlags.NonPublic); if ((float)timeSinceSwitchingSlots.GetValue(owner) < 0.075f) { return; } if (Object.op_Implicit((Object)(object)FlashlightToStop) && (Object)(object)((GrabbableObject)FlashlightToStop).playerHeldBy == (Object)(object)owner && FlashlightToStop.flashlightTypeID == 0 && ((GrabbableObject)FlashlightToStop).insertedBattery.charge > 0f) { UseSelectedFlashlight(ref FlashlightToStop, ref timeSinceSwitchingSlots); return; } FlashlightItem val = null; List<FlashlightItem> Flashlights = new List<FlashlightItem>(); List<FlashlightItem> Flashlights2 = new List<FlashlightItem>(); GrabbableObject[] itemSlots = owner.ItemSlots; foreach (GrabbableObject val2 in itemSlots) { val = (FlashlightItem)(object)((val2 is FlashlightItem) ? val2 : null); if (!((Object)(object)val == (Object)null)) { switch (val.flashlightTypeID) { case 0: Flashlights.Add(val); break; case 1: Flashlights2.Add(val); break; } } } val = null; FindBestFlashlight(ref val, ref Flashlights); if ((Object)(object)val != (Object)null) { UseSelectedFlashlight(ref val, ref timeSinceSwitchingSlots); return; } if (Object.op_Implicit((Object)(object)FlashlightToStop) && (Object)(object)((GrabbableObject)FlashlightToStop).playerHeldBy == (Object)(object)owner && FlashlightToStop.flashlightTypeID == 1 && ((GrabbableObject)FlashlightToStop).insertedBattery.charge > 0f) { UseSelectedFlashlight(ref FlashlightToStop, ref timeSinceSwitchingSlots); return; } FindBestFlashlight(ref val, ref Flashlights2); if ((Object)(object)val != (Object)null) { UseSelectedFlashlight(ref val, ref timeSinceSwitchingSlots); } } private void UseWalkieTalkie() { if ((!NetworkManager.Singleton.IsServer && !ConfigsSynchronizer.ConfigsReceived) || !WorldTweaks.Configs.AllowWalkieTalkieKeybind.Value() || WyattsTweaks.Compatibility.ReservedSlotsWalkieCompat || !PlayerTweaks.CanUseItem(owner)) { return; } FieldInfo field = typeof(PlayerControllerB).GetField("timeSinceSwitchingSlots", BindingFlags.Instance | BindingFlags.NonPublic); if ((float)field.GetValue(owner) < 0.075f) { return; } WalkieTalkie val = null; List<WalkieTalkie> list = new List<WalkieTalkie>(); GrabbableObject[] itemSlots = owner.ItemSlots; foreach (GrabbableObject val2 in itemSlots) { val = (WalkieTalkie)(object)((val2 is WalkieTalkie) ? val2 : null); if (!((Object)(object)val == (Object)null)) { list.Add(val); } } val = null; foreach (WalkieTalkie item in list) { if ((Object)(object)val == (Object)null) { val = item; } else if (((GrabbableObject)item).isBeingUsed && !(((GrabbableObject)item).insertedBattery.charge <= ((GrabbableObject)val).insertedBattery.charge)) { val = item; } } if (!((Object)(object)val == (Object)null)) { ((GrabbableObject)val).UseItemOnClient(true); field.SetValue(owner, 0f); WalkieTalkieToStop = val; } } private void StopUsingWalkieTalkie() { if (Object.op_Implicit((Object)(object)WalkieTalkieToStop) && !((Object)(object)((GrabbableObject)WalkieTalkieToStop).playerHeldBy != (Object)(object)owner)) { ((GrabbableObject)WalkieTalkieToStop).UseItemOnClient(false); } } private void Awake() { owner = ((Component)this).gameObject.GetComponent<PlayerControllerB>(); SwitchToSlotMethod = typeof(PlayerControllerB).GetMethod("SwitchToItemSlot", BindingFlags.Instance | BindingFlags.NonPublic); } private void RequestSlotChange(int slot) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (PlayerTweaks.CanSwitchSlot(owner) && WorldTweaks.Configs.AllowHotbarKeybinds.Value()) { SwitchToSlot(slot); typeof(PlayerControllerB).GetField("timeSinceSwitchingSlots", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(owner, 0f); CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref slot, default(ForPrimitives)); customMessagingManager.SendNamedMessage(PlayerTweaks.PlayerSwitchSlotRequestChannel, 0uL, val, (NetworkDelivery)2); } } public void SwitchToSlot(int slot) { ShipBuildModeManager.Instance.CancelBuildMode(true); int currentItemSlot = owner.currentItemSlot; owner.playerBodyAnimator.SetBool("GrabValidated", false); object[] parameters = new object[2] { slot, null }; SwitchToSlotMethod.Invoke(owner, parameters); } } public class PlayerTweaks { public static class Configs { public static ConfigEntrySettings<float> MaxStamina = new ConfigEntrySettings<float>("MaxStamina", 15f, 11f, "This is the maximum amount of time you can run.\nThe higher the number, the longer you can run for."); public static ConfigEntrySettings<float> DefaultSprintSpeed = new ConfigEntrySettings<float>("DefaultSprintSpeed", 1.5f, 1f, "This is the floor of your sprint speed.\nEvery frame your sprint speed decreases when you don't run and this is as low as it can go."); public static ConfigEntrySettings<float> SprintSpeedIncreasePerFrame = new ConfigEntrySettings<float>("SprintSpeedIncreasePerFrame", 1f, 1f, "The higher this value is, the faster your sprint speed reaches the maximum sprint speed.\nYour sprint speed increments every frame you're running."); public static ConfigEntrySettings<float> SprintSpeedDecreasePerFrame = new ConfigEntrySettings<float>("SprintSpeedDecreasePerFrame", 10f, 10f, "The higher this value is, the faster your sprint speed goes to the default sprint speed.\nYour sprint speed decrements every frame you're not running."); public static ConfigEntrySettings<float> MaxSprintSpeed = new ConfigEntrySettings<float>("MaxSprintSpeed", 3f, 2.25f, "This is your sprint speed ceiling.\nEvery frame your sprint speed increases and this is how high it can go."); public static ConfigEntrySettings<float> StaminaRechargePerFrame = new ConfigEntrySettings<float>("StaminaRechargePerFrame", 5f, 1f, "The bigger number this is the faster your stamina recharges."); public static ConfigEntrySettings<float> StaminaWeightWhileWalking = new ConfigEntrySettings<float>("StaminaWeightWhileWalking", 9f, 9f, "The bigger number this is, the slower your stamina recharges while walking."); public static ConfigEntrySettings<float> StaminaWeightWhileStandingStill = new ConfigEntrySettings<float>("StaminaWeightWhileStandingStill", 4f, 4f, "The bigger number this is, the slower your stamina recharges while standing still"); public static ConfigEntrySettings<float> JumpStaminaDrain = new ConfigEntrySettings<float>("JumpStaminaDrain", 0.04f, 0.08f, "The lower this amount is, the less stamina jumping drains.\n"); public static ConfigEntrySettings<string>[] SlotKeybinds = new ConfigEntrySettings<string>[9] { new ConfigEntrySettings<string>("Slot1", "<Keyboard>/1", ""), new ConfigEntrySettings<string>("Slot2", "<Keyboard>/2", ""), new ConfigEntrySettings<string>("Slot3", "<Keyboard>/3", ""), new ConfigEntrySettings<string>("Slot4", "<Keyboard>/4", ""), new ConfigEntrySettings<string>("Slot5", "<Keyboard>/5", ""), new ConfigEntrySettings<string>("Slot6", "<Keyboard>/6", ""), new ConfigEntrySettings<string>("Slot7", "<Keyboard>/7", ""), new ConfigEntrySettings<string>("Slot8", "<Keyboard>/8", ""), new ConfigEntrySettings<string>("Slot9", "<Keyboard>/9", "") }; public static ConfigEntrySettings<string>[] EmoteKeybinds = new ConfigEntrySettings<string>[2] { new ConfigEntrySettings<string>("Emote1", "<Keyboard>/y", "<Keyboard>/1"), new ConfigEntrySettings<string>("Emote2", "<Keyboard>/u", "<Keyboard>/2") }; public static ConfigEntrySettings<string> FlashlightKeybind = new ConfigEntrySettings<string>("Flashlight", "<Keyboard>/f", ""); public static ConfigEntrySettings<string> WalkieTalkieKeybind = new ConfigEntrySettings<string>("WalkieTalkieKeybind", "<Keyboard>/r", ""); public static string PlayerTweaksSectionHeader => "PlayerTweaks"; public static string KeybindsSectionHeader => "Keybinds"; } [CompilerGenerated] private static class <>O { public static Func<FastBufferWriter, FastBufferWriter> <0>__WriteConfigsToWriter; public static Func<FastBufferReader, FastBufferReader> <1>__ReadConfigChanges; public static HandleNamedMessageDelegate <2>__ReceiveSwitchSlot; public static HandleNamedMessageDelegate <3>__ReceiveSwitchSlotRequest; } public static PlayerControllerB LocalPlayerController => GameNetworkManager.Instance.localPlayerController; public static string PlayerSwitchSlotChannel => "PlayerChangeSlot"; public static string PlayerSwitchSlotRequestChannel => "PlayerChangeSlotRequest"; public static void RegisterConfigs() { WyattsTweaks.Instance.BindConfig(ref Configs.MaxStamina, Configs.PlayerTweaksSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.DefaultSprintSpeed, Configs.PlayerTweaksSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.SprintSpeedIncreasePerFrame, Configs.PlayerTweaksSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.SprintSpeedDecreasePerFrame, Configs.PlayerTweaksSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.MaxSprintSpeed, Configs.PlayerTweaksSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.StaminaRechargePerFrame, Configs.PlayerTweaksSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.StaminaWeightWhileWalking, Configs.PlayerTweaksSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.StaminaWeightWhileStandingStill, Configs.PlayerTweaksSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.JumpStaminaDrain, Configs.PlayerTweaksSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.FlashlightKeybind, Configs.KeybindsSectionHeader); WyattsTweaks.Instance.BindConfig(ref Configs.WalkieTalkieKeybind, Configs.KeybindsSectionHeader); for (int i = 0; i < Configs.SlotKeybinds.Length; i++) { WyattsTweaks.Instance.BindConfig(ref Configs.SlotKeybinds[i], Configs.KeybindsSectionHeader); } for (int j = 0; j < Configs.EmoteKeybinds.Length; j++) { WyattsTweaks.Instance.BindConfig(ref Configs.EmoteKeybinds[j], Configs.KeybindsSectionHeader); } ConfigsSynchronizer.OnConfigsChangedDelegate = (Action)Delegate.Combine(ConfigsSynchronizer.OnConfigsChangedDelegate, (Action)delegate { ReapplyConfigs(LocalPlayerController, applyToAllPlayers: true, force: true, updateHud: true); }); ConfigsSynchronizer.Instance.AddConfigGetter(WriteConfigsToWriter); ConfigsSynchronizer.Instance.AddConfigSetter(ReadConfigChanges); ConfigsSynchronizer.Instance.AddConfigSizeGetter(() => 36); } public static FastBufferWriter WriteConfigsToWriter(FastBufferWriter writer) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) float num = Configs.DefaultSprintSpeed.Value(WorldTweaks.Configs.UseVanillaSprintSpeedValues.Value()); ((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives)); num = Configs.SprintSpeedIncreasePerFrame.Value(WorldTweaks.Configs.UseVanillaSprintSpeedValues.Value()); ((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives)); num = Configs.SprintSpeedDecreasePerFrame.Value(WorldTweaks.Configs.UseVanillaSprintSpeedValues.Value()); ((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives)); num = Configs.MaxSprintSpeed.Value(WorldTweaks.Configs.UseVanillaSprintSpeedValues.Value()); ((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives)); num = Configs.MaxStamina.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value()); ((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives)); num = Configs.StaminaRechargePerFrame.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value()); ((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives)); num = Configs.StaminaWeightWhileWalking.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value()); ((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives)); num = Configs.StaminaWeightWhileStandingStill.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value()); ((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives)); num = Configs.JumpStaminaDrain.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value()); ((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives)); return writer; } public static FastBufferReader ReadConfigChanges(FastBufferReader payload) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) float value = default(float); ((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives)); Configs.DefaultSprintSpeed.Entry.Value = value; ((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives)); Configs.SprintSpeedIncreasePerFrame.Entry.Value = value; ((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives)); Configs.SprintSpeedDecreasePerFrame.Entry.Value = value; ((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives)); Configs.MaxSprintSpeed.Entry.Value = value; ((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives)); Configs.MaxStamina.Entry.Value = value; ((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives)); Configs.StaminaRechargePerFrame.Entry.Value = value; ((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives)); Configs.StaminaWeightWhileWalking.Entry.Value = value; ((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives)); Configs.StaminaWeightWhileStandingStill.Entry.Value = value; ((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives)); Configs.JumpStaminaDrain.Entry.Value = value; return payload; } public static void ReapplyConfigs(PlayerControllerB player, bool applyToAllPlayers = false, bool force = true, bool updateHud = false) { float sprintTime = player.sprintTime; int num = player.ItemSlots.Length; player.sprintTime = Configs.MaxStamina.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value()); if (WyattsTweaks.Compatibility.ReservedSlotCoreCompat) { return; } if (!applyToAllPlayers) { InventoryTweaks.ChangeItemSlotsAmount(player, force); } else { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB _instance in allPlayerScripts) { InventoryTweaks.ChangeItemSlotsAmount(_instance, force); } } if (updateHud) { InventoryTweaks.ChangeItemSlotsAmountUI(); } bool flag = true; } public static void RegisterSwitchSlotMessage() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //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_0051: Expected O, but got Unknown CustomNetworking instance = CustomNetworking.Instance; string playerSwitchSlotChannel = PlayerSwitchSlotChannel; object obj = <>O.<2>__ReceiveSwitchSlot; if (obj == null) { HandleNamedMessageDelegate val = ReceiveSwitchSlot; <>O.<2>__ReceiveSwitchSlot = val; obj = (object)val; } instance.RegisterChannel(playerSwitchSlotChannel, (HandleNamedMessageDelegate)obj); CustomNetworking instance2 = CustomNetworking.Instance; string playerSwitchSlotRequestChannel = PlayerSwitchSlotRequestChannel; object obj2 = <>O.<3>__ReceiveSwitchSlotRequest; if (obj2 == null) { HandleNamedMessageDelegate val2 = ReceiveSwitchSlotRequest; <>O.<3>__ReceiveSwitchSlotRequest = val2; obj2 = (object)val2; } instance2.RegisterChannel(playerSwitchSlotRequestChannel, (HandleNamedMessageDelegate)obj2); } public static void SwitchSlot_Server(int slot, ulong clientIDOfChangedSlot) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0056: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref slot, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref clientIDOfChangedSlot, default(ForPrimitives)); customMessagingManager.SendNamedMessageToAll(PlayerSwitchSlotChannel, val, (NetworkDelivery)2); } } public static void ReceiveSwitchSlotRequest(ulong senderID, FastBufferReader payload) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { int slot = default(int); ((FastBufferReader)(ref payload)).ReadValueSafe<int>(ref slot, default(ForPrimitives)); SwitchSlot_Server(slot, senderID); } } public static void ReceiveSwitchSlot(ulong senderID, FastBufferReader payload) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0020: Unknown result type (might be due to invalid IL or missing references) int slot = default(int); ((FastBufferReader)(ref payload)).ReadValueSafe<int>(ref slot, default(ForPrimitives)); ulong num = default(ulong); ((FastBufferReader)(ref payload)).ReadValueSafe<ulong>(ref num, default(ForPrimitives)); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.actualClientId == num) { ((Component)val).gameObject.GetComponent<PlayerInputRedirection>().SwitchToSlot(slot); break; } } } public static float StaminaRechargeMovementHinderedWalking(PlayerControllerB player, float num2) { return Mathf.Clamp(player.sprintMeter - Time.deltaTime / player.sprintTime * num2 * 0.5f, 0f, 1f); } public static float StaminaRechargeMovementNotHinderedWalking(PlayerControllerB player, float num2) { return Mathf.Clamp(player.sprintMeter + Time.deltaTime * Configs.StaminaRechargePerFrame.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value()) / (player.sprintTime + Configs.StaminaWeightWhileWalking.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value())) * num2, 0f, 1f); } public static float StaminaRechargeMovementNotHinderedNotWalking(PlayerControllerB player, float num2) { return Mathf.Clamp(player.sprintMeter + Time.deltaTime * Configs.StaminaRechargePerFrame.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value()) / (player.sprintTime + Configs.StaminaWeightWhileStandingStill.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value())) * num2, 0f, 1f); } public static bool IsLocallyControlled(PlayerControllerB player) { return (Object)(object)player == (Object)(object)GameNetworkManager.Instance.localPlayerController; } public static bool CanSwitchSlot(PlayerControllerB player) { Type typeFromHandle = typeof(PlayerControllerB); bool flag = (bool)typeFromHandle.GetField("throwingObject", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(player); float num = (float)typeFromHandle.GetField("timeSinceSwitchingSlots", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(player); if (((!((NetworkBehaviour)player).IsOwner || !player.isPlayerControlled || (((NetworkBehaviour)player).IsServer && !player.isHostPlayerObject)) && !player.isTestingPlayer) || num < 0.3f || player.isGrabbingObjectAnimation || player.inSpecialInteractAnimation || flag || player.isTypingChat || player.twoHanded || player.activatingItem || player.jetpackControls || player.disablingJetpackControls) { return false; } return true; } public static bool CanUseItem(PlayerControllerB player) { bool flag = true; if ((Object)(object)player.currentlyHeldObjectServer != (Object)null) { flag = player.currentlyHeldObjectServer.itemProperties.usableInSpecialAnimations; } return ((((NetworkBehaviour)player).IsOwner && player.isPlayerControlled && (!((NetworkBehaviour)player).IsServer || player.isHostPlayerObject)) || player.isTestingPlayer) && !player.quickMenuManager.isMenuOpen && !player.isPlayerDead && (flag || (!player.isGrabbingObjectAnimation && !player.inTerminalMenu && !player.isTypingChat && (!player.inSpecialInteractAnimation || player.inShockingMinigame))); } } } namespace WyattsTweaks.Scripts.Moons { public class MoonTweaks { public static class Configs { public static readonly Dictionary<string, int> DefaultMoonCosts = new Dictionary<string, int> { { "Experimentation", 0 }, { "Assurance", 0 }, { "Vow", 0 }, { "Offense", 0 }, { "March", 0 }, { "Rend", 550 }, { "Dine", 600 }, { "Titan", 700 } }; public static ConfigEntrySettings<string> MoonPrices = new ConfigEntrySettings<string>("MoonPrices", JsonConvert.SerializeObject((object)DefaultMoonCosts), JsonConvert.SerializeObject((object)DefaultMoonCosts), "To change the cost to go to a planet you can change the amount corresponding to the moon you want to modify.\nYou can also modify the cost of moons from different mods here, by just adding another entry anywhere in the dictionary with the planet's name and the cost you want it to be\nThe value is a json string which is why you see \\ everywhere before \".\nTo add another moon, just add , after Titan's value and write it like so \\\"MoonName\\\":Value"); public static Dictionary<string, int> MoonPricesDeserialized; public static string MoonPricesHeader => "MoonPrices"; public static int MoonPricesSize => FastBufferWriter.GetWriteSize<byte>(ConfigsSynchronizer.ToBytes(JsonConvert.SerializeObject((object)MoonPricesDeserialized)), -1, 0); } public static void RegisterConfigs() { WyattsTweaks.Instance.BindConfig(ref Configs.MoonPrices, Configs.MoonPricesHeader); ((BaseUnityPlugin)WyattsTweaks.Instance).Config.ConfigReloaded += delegate { ReadMoonPrices(); ApplyVanillaMoonCosts(ref Configs.MoonPricesDeserialized, WorldTweaks.Configs.UseVanillaMoonCosts.Value()); }; ReadMoonPrices(); ApplyVanillaMoonCosts(ref Configs.MoonPricesDeserialized, WorldTweaks.Configs.UseVanillaMoonCosts.Value()); ConfigsSynchronizer.OnConfigsChangedDelegate = (Action)Delegate.Combine(ConfigsSynchronizer.OnConfigsChangedDelegate, (Action)delegate { ReapplyConfigs(WorldTweaks.TerminalInstance); }); ConfigsSynchronizer.Instance.AddConfigSizeGetter(() => Configs.MoonPricesSize); ConfigsSynchronizer.Instance.AddConfigGetter(SendConfigs); ConfigsSynchronizer.Instance.AddConfigSetter(OnConfigsReceived); } public static FastBufferWriter SendConfigs(FastBufferWriter writer) { //IL_0016: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) byte[] array = ConfigsSynchronizer.ToBytes(JsonConvert.SerializeObject((object)Configs.MoonPricesDeserialized)); ((FastBufferWriter)(ref writer)).WriteValueSafe<byte>(array, default(ForPrimitives)); return writer; } public static FastBufferReader OnConfigsReceived(FastBufferReader payload) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) byte[] bytes = default(byte[]); ((FastBufferReader)(ref payload)).ReadValueSafe<byte>(ref bytes, default(ForPrimitives)); Configs.MoonPricesDeserialized = JsonConvert.DeserializeObject<Dictionary<string, int>>((string)ConfigsSynchronizer.ToObject(bytes)); return payload; } public static void ReapplyConfigs(Terminal terminal) { if (!Object.op_Implicit((Object)(object)terminal)) { return; } TerminalKeyword val = Array.Find(terminal.terminalNodes.allKeywords, (TerminalKeyword keyword) => ((Object)keyword).name == "Route"); if ((Object)(object)val == (Object)null) { return; } Dictionary<string, int> dictionary = new Dictionary<string, int>(Configs.MoonPricesDeserialized); CompatibleNoun[] compatibleNouns = val.compatibleNouns; foreach (CompatibleNoun val2 in compatibleNouns) { foreach (KeyValuePair<string, int> item in dictionary) { if (!((Object)val2.noun).name.Contains(item.Key)) { continue; } val2.result.itemCost = item.Value; CompatibleNoun[] terminalOptions = val2.result.terminalOptions; foreach (CompatibleNoun val3 in terminalOptions) { if (!((Object)val3.noun).name.ToLower().Contains("deny")) { val3.result.itemCost = item.Value; break; } } dictionary.Remove(item.Key); break; } } } private static void ApplyVanillaMoonCosts(ref Dictionary<string, int> MoonCosts, bool vanilla) { if (!vanilla) { return; } foreach (KeyValuePair<string, int> defaultMoonCost in Configs.DefaultMoonCosts) { MoonCosts[defaultMoonCost.Key] = defaultMoonCost.Value; } } private static void ReadMoonPrices() { Configs.MoonPricesDeserialized = JsonConvert.DeserializeObject<Dictionary<string, int>>(Configs.MoonPrices.Value()); } } } namespace WyattsTweaks.Scripts.Items { [HarmonyPatch(typeof(GrabbableObject))] public class GrabbableObject_Patches { [HarmonyPatch("Start")] [HarmonyPostfix] public static void ChangeTerminalItemWeights(GrabbableObject __instance) { bool flag = false; if (NetworkManager.Singleton.IsServer || ConfigsSynchronizer.ConfigsReceived) { InventoryTweaks.ModifyItemWeight(__instance); } } } [HarmonyPatch(typeof(Terminal))] public class Terminal_Patches { [HarmonyPatch("Start")] [HarmonyPostfix] public static void Start(Terminal __instance) { if (NetworkManager.Singleton.IsServer) { MoonTweaks.ReapplyConfigs(__instance); InventoryTweaks.ApplyItemPrices(__instance); } } } } namespace WyattsTweaks.Scripts.Inventory { public class InventoryTweaks { public static class Configs { public static ConfigEntrySettings<int> ExtraItemSlotsAmount = new ConfigEntrySettings<int>("ExtraItemSlots", 2, 0, "This increases how many slots you have.\n0 Slots means you have the default 4 from the vanilla game, if you increase this number you get additional slots in addition to the original 4."); public static ConfigEntrySettings<int>[] ToolItemWeights = new ConfigEntrySettings<int>[14] { new ConfigEntrySettings<int>("WalkieTalkieWeight", 0, 0), new ConfigEntrySettings<int>("FlashlightWeight", 0, 0), new ConfigEntrySettings<int>("ShovelWeight", 5, 18), new ConfigEntrySettings<int>("LockPickerWeight", 2, 15), new ConfigEntrySettings<int>("ProFlashlightWeight", 0, 5), new ConfigEntrySettings<int>("StunGrenadeWeight", 2, 5), new ConfigEntrySettings<int>("BoomboxWeight", 5, 15), new ConfigEntrySettings<int>("TZPInhalantWeight", 0, 0), new ConfigEntrySettings<int>("ZapGunWeight", 4, 10), new ConfigEntrySettings<int>("JetpackWeight", 10, 50), new ConfigEntrySettings<int>("ExtensionLadderWeight", 0, 0), new ConfigEntrySettings<int>("RadarBoosterWeight", 5, 18), new ConfigEntrySettings<int>("SprayPaintWeight", 1, 1), new ConfigEntrySettings<int>("CruiserWeight", 0, 0) }; public static ConfigEntrySettings<int>[] ToolItemPrices = new ConfigEntrySettings<int>[14] { new ConfigEntrySettings<int>("WalkieTalkiePrice", 12, 12), new ConfigEntrySettings<int>("FlashlightPrice", 15, 15), new ConfigEntrySettings<int>("ShovelPrice", 30, 30), new ConfigEntrySettings<int>("LockPickerPrice", 20, 20), new ConfigEntrySettings<int>("ProFlashlightPrice", 25, 25), new ConfigEntrySettings<int>("StunGrenadePrice", 30, 30), new ConfigEntrySettings<int>("BoomboxPrice", 60, 60), new ConfigEntrySettings<int>("TZPInhalantPrice", 120, 120), new ConfigEntrySettings<int>("ZapGunPrice", 400, 400), new ConfigEntrySettings<int>("JetpackPrice", 700, 700), new ConfigEntrySettings<int>("ExtensionLadderPrice", 60, 60), new ConfigEntrySettings<int>("RadarBoosterPrice", 60, 60), new ConfigEntrySettings<int>("SprayPaintPrice", 50, 50), new ConfigEntrySettings<int>("CruiserPrice", 370, 300) }; public static string InventoryTweaksSectionHeader => "InventoryTweaks"; public static string TerminalItemProperties => "TerminalItemProperties"; } public static void RegisterConfigs() { WyattsTweaks.Instance.BindConfig(ref Configs.ExtraItemSlotsAmount, Configs.InventoryTweaksSectionHeader); for (int i = 0; i < Configs.ToolItemWeights.Length; i++) { WyattsTweaks.Instance.BindConfig(ref Configs.ToolItemWeights[i], Configs.TerminalItemProperties); WyattsTweaks.Instance.BindConfig(ref Configs.ToolItemPrices[i], Configs.TerminalItemProperties); } ConfigsSynchronizer.OnConfigsChangedDelegate = (Action)Delegate.Combine(ConfigsSynchronizer.OnConfigsChangedDelegate, (Action)delegate { ReapplyConfigs(); ApplyItemPrices(WorldTweaks.TerminalInstance); }); ConfigsSynchronizer.Instance.AddConfigGetter(WriteConfigsToWriter); ConfigsSynchronizer.Instance.AddConfigSetter(ReadConfigChanges); ConfigsSynchronizer.Instance.AddConfigSizeGetter(() => 4 + 4 * Configs.ToolItemWeights.Length + 4 * Configs.ToolItemPrices.Length); } public static FastBufferWriter WriteConfigsToWriter(FastBufferWriter writer) { //IL_0013: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) int num = Configs.ExtraItemSlotsAmount.Value(); ((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ConfigEntrySettings<int>[] toolItemWeights = Configs.ToolItemWeights; foreach (ConfigEntrySettings<int> configEntrySettings in toolItemWeights) { num = configEntrySettings.Value(WorldTweaks.Configs.UseVanillaToolItemWeights.Value()); ((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref num, default(ForPrimitives)); } ConfigEntrySettings<int>[] toolItemPrices = Configs.ToolItemPrices; foreach (ConfigEntrySettings<int> configEntrySettings2 in toolItemPrices) { num = configEntrySettings2.Value(WorldTweaks.Configs.UseVanillaToolItemPrices.Value()); ((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref num, default(ForPrimitives)); } return writer; } public static FastBufferReader ReadConfigChanges(FastBufferReader payload) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ac: Unknown result type (might be due to invalid IL or missing references) int value = default(int); ((FastBufferReader)(ref payload)).ReadValueSafe<int>(ref value, default(ForPrimitives)); Configs.ExtraItemSlotsAmount.Entry.Value = value; ConfigEntrySettings<int>[] toolItemWeights = Configs.ToolItemWeights; foreach (ConfigEntrySettings<int> configEntrySettings in toolItemWeights) { ((FastBufferReader)(ref payload)).ReadValueSafe<int>(ref value, default(ForPrimitives)); configEntrySettings.Entry.Value = value; } ConfigEntrySettings<int>[] toolItemPrices = Configs.ToolItemPrices; foreach (ConfigEntrySettings<int> configEntrySettings2 in toolItemPrices) { ((FastBufferReader)(ref payload)).ReadValueSafe<int>(ref value, default(ForPrimitives)); configEntrySettings2.Entry.Value = value; } return payload; } public static bool HasEnoughSlots(int slotID) { return PlayerTweaks.LocalPlayerController.ItemSlots.Length - (slotID + 1) > -1; } public static void ChangeItemSlotsAmount(PlayerControllerB __instance, bool force = true) { if (force || Configs.ExtraItemSlotsAmount.Value() != 0) { List<GrabbableObject> list = new List<GrabbableObject>(__instance.ItemSlots); __instance.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[4 + Configs.ExtraItemSlotsAmount.Value()]; for (int i = 0; i < list.Count; i++) { __instance.ItemSlots[i] = list[i]; } } } public static void ReapplyConfigs() { GrabbableObject[] array = Resources.FindObjectsOfTypeAll<GrabbableObject>(); GrabbableObject[] array2 = array; foreach (GrabbableObject item in array2) { ModifyItemWeight(item); } ApplyItemPrices(WorldTweaks.TerminalInstance); } public static void ApplyItemPrices(Terminal terminal) { if (!Object.op_Implicit((Object)(object)terminal)) { return; } TerminalKeyword val = Array.Find(terminal.terminalNodes.allKeywords, (TerminalKeyword keyword) => ((Object)keyword).name.ToLower() == "buy"); if ((Object)(object)val == (Object)null) { return; } bool vanilla = WorldTweaks.Configs.UseVanillaToolItemPrices.Value(); CompatibleNoun[] compatibleNouns = val.compatibleNouns; foreach (CompatibleNoun val2 in compatibleNouns) { ConfigEntrySettings<int>[] toolItemPrices = Configs.ToolItemPrices; foreach (ConfigEntrySettings<int> configEntrySettings in toolItemPrices) { if (configEntrySettings.ConfigName == "CruiserPrice") { string str = ((Object)val2.noun).name.ToLower(); StringUtils.RemoveChar(ref str, ' '); if (!configEntrySettings.ConfigName.ToLower().Contains(str)) { continue; } val2.result.itemCost = configEntrySettings.Value(vanilla); terminal.buyableVehicles[0].creditsWorth = configEntrySettings.Value(vanilla); CompatibleNoun[] terminalOptions = val2.result.terminalOptions; foreach (CompatibleNoun val3 in terminalOptions) { if (!((Object)val3.noun).name.ToLower().Contains("deny")) { val3.result.itemCost = configEntrySettings.Value(vanilla); break; } } break; } string str2 = ((Object)val2.noun).name.ToLower(); StringUtils.RemoveChar(ref str2, ' '); if (!configEntrySettings.ConfigName.ToLower().Contains(str2)) { continue; } val2.result.itemCost = configEntrySettings.Value(vanilla); terminal.buyableItemsList[val2.result.buyItemIndex].creditsWorth = configEntrySettings.Value(vanilla); CompatibleNoun[] terminalOptions2 = val2.result.terminalOptions; foreach (CompatibleNoun val4 in terminalOptions2) { if (!((Object)val4.noun).name.ToLower().Contains("deny")) { val4.result.itemCost = configEntrySettings.Value(vanilla); break; } } break; } } } public static void ModifyItemWeight(GrabbableObject item) { if (!((Object)(object)item == (Object)null)) { string itemName = ((Object)item.itemProperties).name.ToLower(); StringUtils.RemoveChar(ref itemName, ' '); int num = Array.FindIndex(Configs.ToolItemWeights, (ConfigEntrySettings<int> config) => config.ConfigName.ToLower().Contains(itemName)); if (num != -1) { item.itemProperties.weight = (float)Configs.ToolItemWeights[num].Value(WorldTweaks.Configs.UseVanillaToolItemWeights.Value()) / 100f + 1f; } } } public static void ChangeItemSlotsAmountUI() { //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: 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_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) if (Configs.ExtraItemSlotsAmount.Value() == 0) { return; } GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/Inventory"); List<string> list = new List<string> { "Slot0", "Slot1", "Slot2", "Slot3" }; for (int i = 0; i < val.transform.childCount; i++) { Transform child = val.transform.GetChild(i); if (!list.Contains(((Object)((Component)child).gameObject).name)) { Object.Destroy((Object)(object)((Component)child).gameObject); } } Image[] array = (Image[])(object)new Image[4 + Configs.ExtraItemSlotsAmount.Value()]; array[0] = HUDManager.Instance.itemSlotIconFrames[0]; array[1] = HUDManager.Instance.itemSlotIconFrames[1]; array[2] = HUDManager.Instance.itemSlotIconFrames[2]; array[3] = HUDManager.Instance.itemSlotIconFrames[3]; Image[] array2 = (Image[])(object)new Image[4 + Configs.ExtraItemSlotsAmount.Value()]; array2[0] = HUDManager.Instance.itemSlotIcons[0]; array2[1] = HUDManager.Instance.itemSlotIcons[1]; array2[2] = HUDManager.Instance.itemSlotIcons[2]; array2[3] = HUDManager.Instance.itemSlotIcons[3]; GameObject val2 = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/Inventory/Slot3"); GameObject val3 = val2; for (int j = 0; j < Configs.ExtraItemSlotsAmount.Value(); j++) { GameObject val4 = Object.Instantiate<GameObject>(val2); ((Object)val4).name = $"Slot{3 + (j + 1)}"; val4.transform.parent = val.transform; Vector3 localPosition = val3.transform.localPosition; val4.transform.SetLocalPositionAndRotation(new Vector3(localPosition.x + 50f, localPosition.y, localPosition.z), val3.transform.localRotation); val3 = val4; array[3 + (j + 1)] = val4.GetComponent<Image>(); array2[3 + (j + 1)] = ((Component)val4.transform.GetChild(0)).GetComponent<Image>(); } HUDManager.Instance.itemSlotIconFrames = array; HUDManager.Instance.itemSlotIcons = array2; } } } namespace WyattsTweaks.Scripts.Input { public class WyattsTweaksPlayerInput : IInputActionCollection2, IInputActionCollection, IEnumerable<InputAction>, IEnumerable, IDisposable { public struct HotbarActions { private WyattsTweaksPlayerInput m_Wrapper; public InputAction Hotbar1 => m_Wrapper.m_Hotbar_Hotbar1; public InputAction Hotbar2 => m_Wrapper.m_Hotbar_Hotbar2; public InputAction Hotbar3 => m_Wrapper.m_Hotbar_Hotbar3; public InputAction Hotbar4 => m_Wrapper.m_Hotbar_Hotbar4; public InputAction Hotbar5 => m_Wrapper.m_Hotbar_Hotbar5; public InputAction Hotbar6 => m_Wrapper.m_Hotbar_Hotbar6; public InputAction Hotbar7 => m_Wrapper.m_Hotbar_Hotbar7; public InputAction Hotbar8 => m_Wrapper.m_Hotbar_Hotbar8; public InputAction Hotbar9 => m_Wrapper.m_Hotbar_Hotbar9; public bool enabled => Get().enabled; public HotbarActions(WyattsTweaksPlayerInput wrapper) { m_Wrapper = wrapper; } public InputActionMap Get() { return m_Wrapper.m_Hotbar; } public void Enable() { Get().Enable(); } public void Disable() { Get().Disable(); } public static implicit operator InputActionMap(HotbarActions set) { return set.Get(); } public void AddCallbacks(IHotbarActions instance) { if (instance != null && !m_Wrapper.m_HotbarActionsCallbackInterfaces.Contains(instance)) { m_Wrapper.m_HotbarActionsCallbackInterfaces.Add(instance); Hotbar1.started += instance.OnHotbar1; Hotbar1.performed += instance.OnHotbar1; Hotbar1.canceled += instance.OnHotbar1; Hotbar2.started += instance.OnHotbar2; Hotbar2.performed += instance.OnHotbar2; Hotbar2.canceled += instance.OnHotbar2; Hotbar3.started += instance.OnHotbar3; Hotbar3.performed += instance.OnHotbar3; Hotbar3.canceled += instance.OnHotbar3; Hotbar4.started += instance.OnHotbar4; Hotbar4.performed += instance.OnHotbar4; Hotbar4.canceled += instance.OnHotbar4; Hotbar5.started += instance.OnHotbar5; Hotbar5.performed += instance.OnHotbar5; Hotbar5.canceled += instance.OnHotbar5; Hotbar6.started += instance.OnHotbar6; Hotbar6.performed += instance.OnHotbar6; Hotbar6.canceled += instance.OnHotbar6; Hotbar7.started += instance.OnHotbar7; Hotbar7.performed += instance.OnHotbar7; Hotbar7.canceled += instance.OnHotbar7; Hotbar8.started += instance.OnHotbar8; Hotbar8.performed += instance.OnHotbar8; Hotbar8.canceled += instance.OnHotbar8; Hotbar9.started += instance.OnHotbar9; Hotbar9.performed += instance.OnHotbar9; Hotbar9.canceled += instance.OnHotbar9; } } private void UnregisterCallbacks(IHotbarActions instance) { Hotbar1.started -= instance.OnHotbar1; Hotbar1.performed -= instance.OnHotbar1; Hotbar1.canceled -= instance.OnHotbar1; Hotbar2.started -= instance.OnHotbar2; Hotbar2.performed -= instance.OnHotbar2; Hotbar2.canceled -= instance.OnHotbar2; Hotbar3.started -= instance.OnHotbar3; Hotbar3.performed -= instance.OnHotbar3; Hotbar3.canceled -= instance.OnHotbar3; Hotbar4.started -= instance.OnHotbar4; Hotbar4.performed -= instance.OnHotbar4; Hotbar4.canceled -= instance.OnHotbar4; Hotbar5.started -= instance.OnHotbar5; Hotbar5.performed -= instance.OnHotbar5; Hotbar5.canceled -= instance.OnHotbar5; Hotbar6.started -= instance.OnHotbar6; Hotbar6.performed -= instance.OnHotbar6; Hotbar6.canceled -= instance.OnHotbar6; Hotbar7.started -= instance.OnHotbar7; Hotbar7.performed -= instance.OnHotbar7; Hotbar7.canceled -= instance.OnHotbar7; Hotbar8.started -= instance.OnHotbar8; Hotbar8.performed -= instance.OnHotbar8; Hotbar8.canceled -= instance.OnHotbar8; Hotbar9.started -= instance.OnHotbar9; Hotbar9.performed -= instance.OnHotbar9; Hotbar9.canceled -= instance.OnHotbar9; } public void RemoveCallbacks(IHotbarActions instance) { if (m_Wrapper.m_HotbarActionsCallbackInterfaces.Remove(instance)) { UnregisterCallbacks(instance); } } public void SetCallbacks(IHotbarActions instance) { foreach (IHotbarActions hotbarActionsCallbackInterface in m_Wrapper.m_HotbarActionsCallbackInterfaces) { UnregisterCallbacks(hotbarActionsCallbackInterface); } m_Wrapper.m_HotbarActionsCallbackInterfaces.Clear(); AddCallbacks(instance); } } public struct EmotesActions { private WyattsTweaksPlayerInput m_Wrapper; public InputAction Emote1 => m_Wrapper.m_Emotes_Emote1; public InputAction Emote2 => m_Wrapper.m_Emotes_Emote2; public bool enabled => Get().enabled; public EmotesActions(WyattsTweaksPlayerInput wrapper) { m_Wrapper = wrapper; } public InputActionMap Get() { return m_Wrapper.m_Emotes; } public void Enable() { Get().Enable(); } public void Disable() { Get().Disable(); } public static implicit operator InputActionMap(EmotesActions set) { return set.Get(); } public void AddCallbacks(IEmotesActions instance) { if (instance != null && !m_Wrapper.m_EmotesActionsCallbackInterfaces.Contains(instance)) { m_Wrapper.m_EmotesActionsCallbackInterfaces.Add(instance);