Decompiled source of Lethal progression PLUS v1.0.0
BeplnEx/plugins/LethalProgressionPLUS-1.0.1/LethalProgressionPlus.dll
Decompiled 11 months 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.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalProgression.Config; using LethalProgression.GUI; using LethalProgression.Patches; using LethalProgression.Skills; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("LethalProgression")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Progression Mod")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LethalProgression")] [assembly: AssemblyTitle("LethalProgression")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalProgression { [HarmonyPatch] internal class LP_NetworkManager { public static GameObject xpNetworkObject; public static XP xpInstance; [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (!((Object)(object)xpNetworkObject != (Object)null)) { xpNetworkObject = (GameObject)LethalPlugin.skillBundle.LoadAsset("LP_XPHandler"); xpNetworkObject.AddComponent<XP>(); NetworkManager.Singleton.AddNetworkPrefab(xpNetworkObject); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void SpawnNetworkHandler() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { GameObject val = Object.Instantiate<GameObject>(xpNetworkObject, Vector3.zero, Quaternion.identity); val.GetComponent<NetworkObject>().Spawn(false); xpInstance = val.GetComponent<XP>(); LethalPlugin.Log.LogInfo((object)"XPHandler Initialized."); } } } [BepInPlugin("Henny.LethalProgressionPlus", "Lethal Progression Plus", "1.0.0")] internal class LethalPlugin : BaseUnityPlugin { private const string modGUID = "Henny.LethalProgression+"; private const string modName = "Lethal Progression+"; private const string modVersion = "1.0.0"; private const string modAuthor = "Henny"; public static AssetBundle skillBundle; internal static ManualLogSource Log; internal static bool ReservedSlots; public static LethalPlugin Instance { get; private set; } private void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown Instance = this; Harmony val = new Harmony("Henny.LethalProgression+"); val.PatchAll(Assembly.GetExecutingAssembly()); skillBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "skillmenu")); Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"Lethal Progression loaded."); foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { if (pluginInfo.Value.Metadata.GUID.IndexOf("ReservedItem") >= 0) { ReservedSlots = true; } if (pluginInfo.Value.Metadata.GUID.IndexOf("mikestweaks") < 0) { continue; } ConfigEntryBase[] configEntries = pluginInfo.Value.Instance.Config.GetConfigEntries(); ConfigEntryBase[] array = configEntries; foreach (ConfigEntryBase val2 in array) { if (val2.Definition.Key == "ExtraItemSlots") { if (int.Parse(val2.GetSerializedValue()) > 0) { ReservedSlots = true; } break; } } } Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array2 = types; foreach (Type type in array2) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array3 = methods; foreach (MethodInfo methodInfo in array3) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } SkillConfig.InitConfig(); } public void BindConfig<T>(string section, string key, T defaultValue, string description = "") { ((BaseUnityPlugin)this).Config.Bind<T>(section, key, defaultValue, description); } public IDictionary<string, string> GetAllConfigEntries() { return ((BaseUnityPlugin)this).Config.GetConfigEntries().ToDictionary((ConfigEntryBase entry) => entry.Definition.Key, (ConfigEntryBase entry) => entry.GetSerializedValue()); } } internal class XP : NetworkBehaviour { public NetworkVariable<int> xpPoints = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<int> xpLevel = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<int> profit = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<int> xpReq = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<float> teamLootValue = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public int skillPoints; public SkillList skillList; public SkillsGUI guiObj; public bool Initialized = false; public void Start() { LethalPlugin.Log.LogInfo((object)"XP Network Behavior Made!"); PlayerConnect_ServerRpc(); } public void LoadSaveData() { int num = GameNetworkManager.Instance.saveFileNum + 1; string path = Application.persistentDataPath + "/LethalProgression/save" + num + ".txt"; if (!File.Exists(path)) { Directory.CreateDirectory(Application.persistentDataPath + "/LethalProgression"); File.WriteAllText(path, ""); string text = ""; text += "0\n"; text += "0\n"; text += "0\n"; File.WriteAllText(path, text); } string[] array = File.ReadAllLines(path); LethalPlugin.Log.LogError((object)"Loading XP!"); xpLevel.Value = int.Parse(array[0]); xpPoints.Value = int.Parse(array[1]); profit.Value = int.Parse(array[2]); xpReq.Value = GetXPRequirement(); LethalPlugin.Log.LogInfo((object)GetXPRequirement().ToString()); } public int GetXPRequirement() { int connectedPlayersAmount = StartOfRound.Instance.connectedPlayersAmount; int timesFulfilledQuota = TimeOfDay.Instance.timesFulfilledQuota; int num = int.Parse(SkillConfig.hostConfig["XP Minimum"]); int num2 = int.Parse(SkillConfig.hostConfig["XP Maximum"]); int num3 = int.Parse(SkillConfig.hostConfig["Person Multiplier"]); int num4 = connectedPlayersAmount * num3; int num5 = num + num4; int num6 = int.Parse(SkillConfig.hostConfig["Quota Multiplier"]); int num7 = timesFulfilledQuota * num6; num5 += (int)((float)num5 * ((float)num7 / 100f)); if (num5 > num2) { num5 = num2; } LethalPlugin.Log.LogInfo((object)$"{connectedPlayersAmount} players, {timesFulfilledQuota} quotas, {num} initial cost, {num4} person value, {num7} quota value, {num5} total cost."); return num5; } public int GetXP() { return xpPoints.Value; } public int GetLevel() { return xpLevel.Value; } public int GetProfit() { return profit.Value; } public int GetSkillPoints() { return skillPoints; } public void SetSkillPoints(int num) { skillPoints = num; } public void AddSkillPoint() { skillPoints++; } [ServerRpc(RequireOwnership = false)] public void ChangeXPRequirement_ServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3672466612u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3672466612u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(XPRequirementCoroutine()); } } } public IEnumerator XPRequirementCoroutine() { yield return (object)new WaitForSeconds(0.5f); xpReq.Value = GetXPRequirement(); } [ServerRpc(RequireOwnership = false)] public void AddXPServerRPC(int xp) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3074971930u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, xp); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3074971930u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } int xP = GetXP(); NetworkVariable<int> obj = xpPoints; obj.Value += xp; NetworkVariable<int> obj2 = profit; obj2.Value += xp; int num = GetXP(); XPHUDUpdate_ClientRPC(xP, num, xp); if (num >= xpReq.Value) { int num2 = 0; while (num >= xpReq.Value) { num2++; num -= xpReq.Value; Givepoint_ClientRPC(); } xpPoints.Value = num; NetworkVariable<int> obj3 = xpLevel; obj3.Value += num2; LevelUp_ClientRPC(); } } [ClientRpc] public void XPHUDUpdate_ClientRPC(int oldXP, int newXP, int xpGained) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3462423043u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, oldXP); BytePacker.WriteValueBitPacked(val2, newXP); BytePacker.WriteValueBitPacked(val2, xpGained); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3462423043u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { HUDManagerPatch.ShowXPUpdate(oldXP, newXP, newXP - oldXP); } } } [ClientRpc] public void LevelUp_ClientRPC() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(820724324u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 820724324u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { HUDManagerPatch.ShowLevelUp(); } } } [ClientRpc] public void Givepoint_ClientRPC() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(179361894u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 179361894u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { skillPoints++; } } } public void TeamLootValueUpdate(float update, int newValue) { TeamLootValueUpdate_ServerRpc(update); } [ServerRpc(RequireOwnership = false)] public void TeamLootValueUpdate_ServerRpc(float updatedValue) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3281224843u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref updatedValue, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3281224843u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { float multiplier = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Value].GetMultiplier(); float num = updatedValue * multiplier; NetworkVariable<float> obj = teamLootValue; obj.Value += num; LethalPlugin.Log.LogInfo((object)$"Changed team loot value by {updatedValue * multiplier} turning into {teamLootValue.Value}."); } } } [ServerRpc(RequireOwnership = false)] public void ServerHandSlots_ServerRpc(ulong playerID, int newSlots) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2696007838u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); BytePacker.WriteValueBitPacked(val2, newSlots); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2696007838u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !LethalPlugin.ReservedSlots) { SetPlayerHandslots_ClientRpc(playerID, newSlots); } } } [ClientRpc] public void SetPlayerHandslots_ClientRpc(ulong playerID, int newSlots) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2549144616u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); BytePacker.WriteValueBitPacked(val2, newSlots); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2549144616u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SetHandSlot(playerID, newSlots); } } } public void SetHandSlot(ulong playerID, int newSlots) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.playerClientId != playerID) { continue; } int num = 4 + newSlots; List<GrabbableObject> list = new List<GrabbableObject>(val.ItemSlots); val.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[num]; for (int j = 0; j < num; j++) { if (list.Count >= num) { val.ItemSlots[j] = list[j]; } } LethalPlugin.Log.LogInfo((object)$"Player {playerID} has {val.ItemSlots.Length} slots after setting."); break; } } [ServerRpc(RequireOwnership = false)] public void GetEveryoneHandSlots_ServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2063608820u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2063608820u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost) || LethalPlugin.ReservedSlots || !LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.HandSlot)) { return; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val3 in allPlayerScripts) { if (((Component)val3).gameObject.activeSelf) { ulong playerClientId = val3.playerClientId; int handSlots = val3.ItemSlots.Length - 4; SendEveryoneHandSlots_ClientRpc(playerClientId, handSlots); } } } [ClientRpc] public void SendEveryoneHandSlots_ClientRpc(ulong playerID, int handSlots) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4146414765u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); BytePacker.WriteValueBitPacked(val2, handSlots); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4146414765u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SetHandSlot(playerID, handSlots); } } } [ServerRpc(RequireOwnership = false)] public void PlayerConnect_ServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2203520695u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2203520695u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { IDictionary<string, string> allConfigEntries = LethalPlugin.Instance.GetAllConfigEntries(); string serializedConfig = JsonConvert.SerializeObject((object)allConfigEntries); SendEveryoneConfigs_ClientRpc(serializedConfig); } } } [ClientRpc] public void SendEveryoneConfigs_ClientRpc(string serializedConfig) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2502216668u, val, (RpcDelivery)0); bool flag = serializedConfig != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(serializedConfig, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2502216668u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } IDictionary<string, string> dictionary = JsonConvert.DeserializeObject<IDictionary<string, string>>(serializedConfig); foreach (KeyValuePair<string, string> item in dictionary) { SkillConfig.hostConfig[item.Key] = item.Value; LethalPlugin.Log.LogInfo((object)("Loaded host config: " + item.Key + " = " + item.Value)); } if (!Initialized) { Initialized = true; LP_NetworkManager.xpInstance = this; skillList = new SkillList(); skillList.InitializeSkills(); guiObj = new SkillsGUI(); NetworkVariable<float> obj = teamLootValue; obj.OnValueChanged = (OnValueChangedDelegate<float>)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<float>(guiObj.TeamLootHudUpdate)); if (GameNetworkManager.Instance.isHostingGame) { LoadSaveData(); } skillPoints = xpLevel.Value + 5; GetEveryoneHandSlots_ServerRpc(); ChangeXPRequirement_ServerRpc(); } } protected override void __initializeVariables() { if (xpPoints == null) { throw new Exception("XP.xpPoints cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)xpPoints).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)xpPoints, "xpPoints"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)xpPoints); if (xpLevel == null) { throw new Exception("XP.xpLevel cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)xpLevel).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)xpLevel, "xpLevel"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)xpLevel); if (profit == null) { throw new Exception("XP.profit cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)profit).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)profit, "profit"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)profit); if (xpReq == null) { throw new Exception("XP.xpReq cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)xpReq).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)xpReq, "xpReq"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)xpReq); if (teamLootValue == null) { throw new Exception("XP.teamLootValue cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)teamLootValue).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)teamLootValue, "teamLootValue"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)teamLootValue); ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_XP() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3672466612u, new RpcReceiveHandler(__rpc_handler_3672466612)); NetworkManager.__rpc_func_table.Add(3074971930u, new RpcReceiveHandler(__rpc_handler_3074971930)); NetworkManager.__rpc_func_table.Add(3462423043u, new RpcReceiveHandler(__rpc_handler_3462423043)); NetworkManager.__rpc_func_table.Add(820724324u, new RpcReceiveHandler(__rpc_handler_820724324)); NetworkManager.__rpc_func_table.Add(179361894u, new RpcReceiveHandler(__rpc_handler_179361894)); NetworkManager.__rpc_func_table.Add(3281224843u, new RpcReceiveHandler(__rpc_handler_3281224843)); NetworkManager.__rpc_func_table.Add(2696007838u, new RpcReceiveHandler(__rpc_handler_2696007838)); NetworkManager.__rpc_func_table.Add(2549144616u, new RpcReceiveHandler(__rpc_handler_2549144616)); NetworkManager.__rpc_func_table.Add(2063608820u, new RpcReceiveHandler(__rpc_handler_2063608820)); NetworkManager.__rpc_func_table.Add(4146414765u, new RpcReceiveHandler(__rpc_handler_4146414765)); NetworkManager.__rpc_func_table.Add(2203520695u, new RpcReceiveHandler(__rpc_handler_2203520695)); NetworkManager.__rpc_func_table.Add(2502216668u, new RpcReceiveHandler(__rpc_handler_2502216668)); } private static void __rpc_handler_3672466612(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((XP)(object)target).ChangeXPRequirement_ServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3074971930(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int xp = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref xp); target.__rpc_exec_stage = (__RpcExecStage)1; ((XP)(object)target).AddXPServerRPC(xp); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3462423043(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int oldXP = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref oldXP); int newXP = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref newXP); int xpGained = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref xpGained); target.__rpc_exec_stage = (__RpcExecStage)2; ((XP)(object)target).XPHUDUpdate_ClientRPC(oldXP, newXP, xpGained); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_820724324(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((XP)(object)target).LevelUp_ClientRPC(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_179361894(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((XP)(object)target).Givepoint_ClientRPC(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3281224843(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float updatedValue = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref updatedValue, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((XP)(object)target).TeamLootValueUpdate_ServerRpc(updatedValue); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2696007838(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); int newSlots = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref newSlots); target.__rpc_exec_stage = (__RpcExecStage)1; ((XP)(object)target).ServerHandSlots_ServerRpc(playerID, newSlots); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2549144616(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); int newSlots = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref newSlots); target.__rpc_exec_stage = (__RpcExecStage)2; ((XP)(object)target).SetPlayerHandslots_ClientRpc(playerID, newSlots); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2063608820(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((XP)(object)target).GetEveryoneHandSlots_ServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4146414765(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); int handSlots = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref handSlots); target.__rpc_exec_stage = (__RpcExecStage)2; ((XP)(object)target).SendEveryoneHandSlots_ClientRpc(playerID, handSlots); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2203520695(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((XP)(object)target).PlayerConnect_ServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2502216668(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string serializedConfig = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref serializedConfig, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((XP)(object)target).SendEveryoneConfigs_ClientRpc(serializedConfig); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "XP"; } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalProgression"; public const string PLUGIN_NAME = "LethalProgression"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace LethalProgression.GUI { [HarmonyPatch] internal class GUIUpdate { public static bool isMenuOpen; public static SkillsGUI guiInstance; [HarmonyPostfix] [HarmonyPatch(typeof(QuickMenuManager), "Update")] private static void SkillMenuUpdate(QuickMenuManager __instance) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) if (guiInstance == null || !Object.op_Implicit((Object)(object)guiInstance.mainPanel)) { return; } if (isMenuOpen) { if (bool.Parse(SkillConfig.hostConfig["Unspec in Ship Only"]) && !bool.Parse(SkillConfig.hostConfig["Disable Unspec"])) { if (GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom) { guiInstance.SetUnspec(show: true); } else { guiInstance.SetUnspec(show: false); } } if (bool.Parse(SkillConfig.hostConfig["Disable Unspec"])) { guiInstance.SetUnspec(show: false); } Vector2 val = ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue(); GameObject gameObject = ((Component)guiInstance.mainPanel.transform.GetChild(2)).gameObject; float x = gameObject.transform.position.x; Rect rect = gameObject.GetComponent<RectTransform>().rect; float num = x - ((Rect)(ref rect)).width; float x2 = gameObject.transform.position.x; rect = gameObject.GetComponent<RectTransform>().rect; float num2 = x2 + ((Rect)(ref rect)).width; float y = gameObject.transform.position.y; rect = gameObject.GetComponent<RectTransform>().rect; float num3 = y - ((Rect)(ref rect)).height; float y2 = gameObject.transform.position.y; rect = gameObject.GetComponent<RectTransform>().rect; float num4 = y2 + ((Rect)(ref rect)).height; if (val.x >= num && val.x <= num2) { if (val.y >= num3 && val.y <= num4) { ((Component)guiInstance.mainPanel.transform.GetChild(2).GetChild(2)).gameObject.SetActive(true); } else { ((Component)guiInstance.mainPanel.transform.GetChild(2).GetChild(2)).gameObject.SetActive(false); } } else { ((Component)guiInstance.mainPanel.transform.GetChild(2).GetChild(2)).gameObject.SetActive(false); } guiInstance.mainPanel.SetActive(true); GameObject val2 = GameObject.Find("Systems/UI/Canvas/QuickMenu/MainButtons"); val2.SetActive(false); GameObject val3 = GameObject.Find("Systems/UI/Canvas/QuickMenu/PlayerList"); val3.SetActive(false); RealTimeUpdateInfo(); } else { guiInstance.mainPanel.SetActive(false); } } [HarmonyPostfix] [HarmonyPatch(typeof(QuickMenuManager), "CloseQuickMenu")] private static void SkillMenuClose(QuickMenuManager __instance) { isMenuOpen = false; } private static void RealTimeUpdateInfo() { GameObject gameObject = ((Component)guiInstance.mainPanel.transform.GetChild(2)).gameObject; gameObject = ((Component)gameObject.transform.GetChild(1)).gameObject; TextMeshProUGUI component = gameObject.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component).text = LP_NetworkManager.xpInstance.GetSkillPoints().ToString(); } } internal class SkillsGUI { public GameObject mainPanel; public GameObject infoPanel; public Skill activeSkill; public GameObject templateSlot; public List<GameObject> skillButtonsList = new List<GameObject>(); public int shownSkills = 0; public SkillsGUI() { CreateSkillMenu(); GUIUpdate.guiInstance = this; } public void OpenSkillMenu() { GUIUpdate.isMenuOpen = true; mainPanel.SetActive(true); GameObject gameObject = ((Component)mainPanel.transform.GetChild(3)).gameObject; gameObject.SetActive(false); } public void CreateSkillMenu() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown mainPanel = Object.Instantiate<GameObject>(LethalPlugin.skillBundle.LoadAsset<GameObject>("SkillMenu")); ((Object)mainPanel).name = "SkillMenu"; mainPanel.SetActive(false); templateSlot = Object.Instantiate<GameObject>(GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/Inventory/Slot3")); ((Object)templateSlot).name = "TemplateSlot"; templateSlot.SetActive(false); infoPanel = ((Component)mainPanel.transform.GetChild(1)).gameObject; infoPanel.SetActive(false); GameObject gameObject = ((Component)mainPanel.transform.GetChild(4)).gameObject; gameObject.GetComponent<Button>().onClick = new ButtonClickedEvent(); ((UnityEvent)gameObject.GetComponent<Button>().onClick).AddListener(new UnityAction(BackButton)); shownSkills = 0; if (LP_NetworkManager.xpInstance.skillList.skills == null) { return; } foreach (KeyValuePair<UpgradeType, Skill> skill in LP_NetworkManager.xpInstance.skillList.skills) { LethalPlugin.Log.LogInfo((object)("Creating button for " + skill.Value.GetShortName())); GameObject val = SetupUpgradeButton(skill.Value); LethalPlugin.Log.LogInfo((object)"Setup passed!"); skillButtonsList.Add(val); LethalPlugin.Log.LogInfo((object)"Added to skill list.."); LoadSkillData(skill.Value, val); } TeamLootHudUpdate(1f, 1f); } public void BackButton() { GUIUpdate.isMenuOpen = false; GameObject val = GameObject.Find("Systems/UI/Canvas/QuickMenu/MainButtons"); val.SetActive(true); GameObject val2 = GameObject.Find("Systems/UI/Canvas/QuickMenu/PlayerList"); val2.SetActive(true); } public void SetUnspec(bool show) { GameObject gameObject = ((Component)infoPanel.transform.GetChild(6)).gameObject; GameObject gameObject2 = ((Component)infoPanel.transform.GetChild(7)).gameObject; GameObject gameObject3 = ((Component)infoPanel.transform.GetChild(8)).gameObject; gameObject.SetActive(show); gameObject2.SetActive(show); gameObject3.SetActive(show); if (!bool.Parse(SkillConfig.hostConfig["Disable Unspec"])) { GameObject gameObject4 = ((Component)infoPanel.transform.GetChild(9)).gameObject; gameObject4.SetActive(!show); } } public GameObject SetupUpgradeButton(Skill skill) { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Expected O, but got Unknown //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Expected O, but got Unknown GameObject gameObject = ((Component)mainPanel.transform.GetChild(0)).gameObject; GameObject val = Object.Instantiate<GameObject>(gameObject); if (!Object.op_Implicit((Object)(object)gameObject)) { LethalPlugin.Log.LogError((object)"Couldn't find template button!"); return null; } ((Object)val).name = skill.GetShortName(); val.transform.SetParent(mainPanel.transform, false); int count = LP_NetworkManager.xpInstance.skillList.skills.Count; float num = 6f / (float)count; val.transform.localScale = new Vector3(num, num, num); float num2 = 55f * num; Vector3 localPosition = val.transform.localPosition; localPosition.y -= (float)shownSkills * num2; float num3 = CalculateHorizontalOffset(num); localPosition.x -= num3; val.transform.localPosition = localPosition; shownSkills++; GameObject gameObject2 = ((Component)val.transform.GetChild(0)).gameObject; ((TMP_Text)gameObject2.GetComponent<TextMeshProUGUI>()).SetText(skill.GetShortName(), true); GameObject gameObject3 = ((Component)val.transform.GetChild(1)).gameObject; ((TMP_Text)gameObject3.GetComponent<TextMeshProUGUI>()).SetText(skill.GetLevel().ToString(), true); GameObject gameObject4 = ((Component)val.transform.GetChild(2)).gameObject; ((TMP_Text)gameObject4.GetComponent<TextMeshProUGUI>()).SetText("(" + skill.GetLevel() + " " + skill.GetAttribute() + ")", true); ((TMP_Text)val.GetComponentInChildren<TextMeshProUGUI>()).SetText(skill.GetShortName() + ":", true); val.SetActive(true); val.GetComponent<Button>().onClick = new ButtonClickedEvent(); ((UnityEvent)val.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { UpdateStatInfo(skill); }); return val; } private float CalculateHorizontalOffset(float scaleFactor) { float num = 225f; return num * (1f - scaleFactor) / 2f; } public void LoadSkillData(Skill skill, GameObject skillButton) { if (!skill._teamShared) { GameObject gameObject = ((Component)skillButton.transform.GetChild(0)).gameObject; ((TMP_Text)gameObject.GetComponent<TextMeshProUGUI>()).SetText(skill.GetShortName(), true); GameObject gameObject2 = ((Component)skillButton.transform.GetChild(1)).gameObject; ((TMP_Text)gameObject2.GetComponent<TextMeshProUGUI>()).SetText(skill.GetLevel().ToString(), true); GameObject gameObject3 = ((Component)skillButton.transform.GetChild(2)).gameObject; if (skill.GetAttribute().ToLower() == "hand slots") { int num = skill.GetLevel() * 10; ((TMP_Text)gameObject3.GetComponent<TextMeshProUGUI>()).SetText("(+" + skill.Slot() + " Slots)", true); } else { ((TMP_Text)gameObject3.GetComponent<TextMeshProUGUI>()).SetText("(+" + (float)skill.GetLevel() * skill.GetMultiplier() + "% " + skill.GetAttribute() + ")", true); } ((TMP_Text)skillButton.GetComponentInChildren<TextMeshProUGUI>()).SetText(skill.GetShortName() + ":", true); } } public void UpdateStatInfo(Skill skill) { //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Expected O, but got Unknown //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Expected O, but got Unknown //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Expected O, but got Unknown //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Expected O, but got Unknown //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Expected O, but got Unknown //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Expected O, but got Unknown //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Expected O, but got Unknown //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Expected O, but got Unknown //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Expected O, but got Unknown //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Expected O, but got Unknown //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Expected O, but got Unknown if (!infoPanel.activeSelf) { infoPanel.SetActive(true); } TextMeshProUGUI component = ((Component)infoPanel.transform.GetChild(0)).gameObject.GetComponent<TextMeshProUGUI>(); TextMeshProUGUI component2 = ((Component)infoPanel.transform.GetChild(1)).gameObject.GetComponent<TextMeshProUGUI>(); TextMeshProUGUI component3 = ((Component)infoPanel.transform.GetChild(2)).gameObject.GetComponent<TextMeshProUGUI>(); activeSkill = skill; ((TMP_Text)component).SetText(skill.GetName(), true); if (skill.GetMaxLevel() == 99999) { ((TMP_Text)component2).SetText($"{skill.GetLevel()}", true); } else { ((TMP_Text)component2).SetText($"{skill.GetLevel()} / {skill.GetMaxLevel()}", true); } ((TMP_Text)component3).SetText(skill.GetDescription(), true); GameObject gameObject = ((Component)infoPanel.transform.GetChild(3)).gameObject; GameObject gameObject2 = ((Component)infoPanel.transform.GetChild(4)).gameObject; GameObject gameObject3 = ((Component)infoPanel.transform.GetChild(5)).gameObject; gameObject.GetComponent<Button>().onClick = new ButtonClickedEvent(); ((UnityEvent)gameObject.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { AddMaxSkillPoints(skill); }); gameObject2.GetComponent<Button>().onClick = new ButtonClickedEvent(); ((UnityEvent)gameObject2.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { AddSkillPoint(skill, 5); }); gameObject3.GetComponent<Button>().onClick = new ButtonClickedEvent(); ((UnityEvent)gameObject3.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { AddSkillPoint(skill, 1); }); UpdateButtonText(gameObject, "+MAX"); UpdateButtonText(gameObject2, "+5"); GameObject gameObject4 = ((Component)infoPanel.transform.GetChild(6)).gameObject; GameObject gameObject5 = ((Component)infoPanel.transform.GetChild(7)).gameObject; GameObject gameObject6 = ((Component)infoPanel.transform.GetChild(8)).gameObject; gameObject4.GetComponent<Button>().onClick = new ButtonClickedEvent(); ((UnityEvent)gameObject4.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { RemoveAllSkillPoints(skill); }); gameObject5.GetComponent<Button>().onClick = new ButtonClickedEvent(); ((UnityEvent)gameObject5.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { RemoveSkillPoint(skill, 5); }); gameObject6.GetComponent<Button>().onClick = new ButtonClickedEvent(); ((UnityEvent)gameObject6.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { RemoveSkillPoint(skill, 1); }); UpdateButtonText(gameObject4, "-MAX"); UpdateButtonText(gameObject5, "-5"); } private void UpdateButtonText(GameObject button, string newText) { TextMeshProUGUI val = button.GetComponent<TextMeshProUGUI>(); if ((Object)(object)val == (Object)null) { val = button.GetComponentInChildren<TextMeshProUGUI>(true); } if ((Object)(object)val != (Object)null) { ((TMP_Text)val).text = newText; } else { Debug.LogError((object)("TextMeshProUGUI component not found on " + ((Object)button).name)); } } private void AddMaxSkillPoints(Skill skill) { int skillPoints = LP_NetworkManager.xpInstance.GetSkillPoints(); int num = Math.Min(skillPoints, skill.GetMaxLevel() - skill.GetLevel()); skill.AddLevel(num); LP_NetworkManager.xpInstance.SetSkillPoints(LP_NetworkManager.xpInstance.GetSkillPoints() - num); UpdateStatInfo(skill); UpdateSkillButtons(skill); } private void RemoveAllSkillPoints(Skill skill) { int level = skill.GetLevel(); skill.AddLevel(-level); LP_NetworkManager.xpInstance.SetSkillPoints(LP_NetworkManager.xpInstance.GetSkillPoints() + level); UpdateStatInfo(skill); UpdateSkillButtons(skill); } public void AddSkillPoint(Skill skill, int amt) { int skillPoints = LP_NetworkManager.xpInstance.GetSkillPoints(); if (skillPoints > 0) { amt = Math.Min(amt, skillPoints); amt = Math.Min(amt, skill.GetMaxLevel() - skill.GetLevel()); skill.AddLevel(amt); LP_NetworkManager.xpInstance.SetSkillPoints(skillPoints - amt); UpdateStatInfo(skill); UpdateSkillButtons(skill); } } public void RemoveSkillPoint(Skill skill, int amt) { if (skill.GetLevel() != 0) { amt = Math.Min(amt, skill.GetLevel()); skill.AddLevel(-amt); LP_NetworkManager.xpInstance.SetSkillPoints(LP_NetworkManager.xpInstance.GetSkillPoints() + amt); UpdateStatInfo(skill); UpdateSkillButtons(skill); } } private void UpdateSkillButtons(Skill skill) { foreach (GameObject skillButtons in skillButtonsList) { if (((Object)skillButtons).name == skill.GetShortName()) { LoadSkillData(skill, skillButtons); } } } public void TeamLootHudUpdate(float oldValue, float newValue) { foreach (GameObject skillButtons in skillButtonsList) { if (((Object)skillButtons).name == "VAL") { Skill skill = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Value]; LoadSkillData(skill, skillButtons); GameObject gameObject = ((Component)skillButtons.transform.GetChild(0)).gameObject; ((TMP_Text)gameObject.GetComponent<TextMeshProUGUI>()).SetText(skill.GetShortName(), true); GameObject gameObject2 = ((Component)skillButtons.transform.GetChild(1)).gameObject; ((TMP_Text)gameObject2.GetComponent<TextMeshProUGUI>()).SetText(skill.GetLevel().ToString(), true); ((TMP_Text)skillButtons.GetComponentInChildren<TextMeshProUGUI>()).SetText(skill.GetShortName() + ":", true); GameObject gameObject3 = ((Component)skillButtons.transform.GetChild(2)).gameObject; ((TMP_Text)gameObject3.GetComponent<TextMeshProUGUI>()).SetText("(+" + LP_NetworkManager.xpInstance.teamLootValue.Value + "% " + skill.GetAttribute() + ")", true); LethalPlugin.Log.LogInfo((object)$"Setting team value hud to {LP_NetworkManager.xpInstance.teamLootValue.Value}"); } } } } } namespace LethalProgression.Skills { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("Update")] [HarmonyPrefix] private static void UpdatePrefix(PlayerControllerB __instance) { Strength.CheckAndUpdateCarryWeight(); } [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdatePostfix(PlayerControllerB __instance) { ApplySpeedUpdate(__instance); } private static void ApplySpeedUpdate(PlayerControllerB playerController) { if (!((Object)(object)playerController == (Object)null) && LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.Speed)) { Skill skill = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Speed]; float num = (float)skill.GetLevel() * skill.GetMultiplier() / 100f * 4.6f; playerController.movementSpeed = 4.6f + num; } } } [HarmonyPatch(typeof(Shovel), "SwingShovel")] internal class ShovelSwingPatch { public static void Prefix(Shovel __instance) { if ((Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null) { Skill skill = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Power]; float num = Power.CalculatePowerMultiplier(skill.GetLevel()); __instance.shovelHitForce = (int)((float)__instance.shovelHitForce * num); LethalPlugin.Log.LogInfo((object)$"Applied power multiplier to shovel: {num}"); } } } public enum UpgradeType { HPRegen, Stamina, Speed, Jump, Battery, HandSlot, Value, Oxygen, Strength, Power } internal class SkillList { public Dictionary<UpgradeType, Skill> skills = new Dictionary<UpgradeType, Skill>(); public void CreateSkill(UpgradeType upgrade, string name, string description, string shortname, string attribute, UpgradeType upgradeType, int cost, int maxLevel, float multiplier, Action<int, int> callback = null, bool teamShared = false) { Skill value = new Skill(name, description, shortname, attribute, upgradeType, cost, maxLevel, multiplier, callback, teamShared); skills.Add(upgrade, value); } public bool IsSkillListValid() { if (skills.Count == 0) { return false; } return true; } public bool IsSkillValid(UpgradeType upgrade) { if (!skills.ContainsKey(upgrade)) { LethalPlugin.Log.LogInfo((object)("Skill " + upgrade.ToString() + " is not in the skill list!")); return false; } return true; } public int GetCurrentSkillLevel(UpgradeType upgradeType) { if (skills.ContainsKey(upgradeType)) { return skills[upgradeType].GetLevel(); } return 0; } public void InitializeSkills() { if (bool.Parse(SkillConfig.hostConfig["Health Regen Enabled"])) { LethalPlugin.Log.LogInfo((object)"HP Regen check 1"); CreateSkill(UpgradeType.HPRegen, "Health Regen", "The company installs a basic healer into your suit, letting you regenerate health slowly. Only regenerate up to 100 HP.", "HPR", "Health Regeneration", UpgradeType.HPRegen, 1, int.Parse(SkillConfig.hostConfig["Health Regen Max Level"]), float.Parse(SkillConfig.hostConfig["Health Regen Multiplier"], CultureInfo.InvariantCulture)); } if (bool.Parse(SkillConfig.hostConfig["Stamina Enabled"])) { CreateSkill(UpgradeType.Stamina, "Stamina", "Hours on that company gym finally coming into play. Allows you to run for longer.", "STM", "Stamina", UpgradeType.Stamina, 1, int.Parse(SkillConfig.hostConfig["Stamina Max Level"]), float.Parse(SkillConfig.hostConfig["Stamina Multiplier"], CultureInfo.InvariantCulture), Stamina.StaminaUpdate); } if (bool.Parse(SkillConfig.hostConfig["Battery Life Enabled"])) { CreateSkill(UpgradeType.Battery, "Battery Life", "The company provides you with better batteries. Replace your batteries AT THE SHIP'S CHARGER to see an effect.", "BAT", "Battery Life", UpgradeType.Battery, 1, int.Parse(SkillConfig.hostConfig["Battery Life Max Level"]), float.Parse(SkillConfig.hostConfig["Battery Life Multiplier"], CultureInfo.InvariantCulture)); } if (bool.Parse(SkillConfig.hostConfig["Hand Slots Enabled"]) && !LethalPlugin.ReservedSlots) { int currentSkillLevel = GetCurrentSkillLevel(UpgradeType.HandSlot); int maxLevel = int.Parse(SkillConfig.hostConfig["Hand Slots Max Level"]); float multiplier2 = 1f; string description = GetInitialDescriptionForHandSlots(currentSkillLevel, multiplier2); CreateSkill(UpgradeType.HandSlot, "Hand Slot", description, "HND", "Hand Slots", UpgradeType.HandSlot, 1, maxLevel, multiplier2, HandSlots.HandSlotsUpdate); } if (bool.Parse(SkillConfig.hostConfig["Loot Value Enabled"])) { CreateSkill(UpgradeType.Value, "Loot Value", "The company gives you a better pair of eyes, allowing you to see the value in things.", "VAL", "Loot Value", UpgradeType.Value, 1, int.Parse(SkillConfig.hostConfig["Loot Value Max Level"]), float.Parse(SkillConfig.hostConfig["Loot Value Multiplier"], CultureInfo.InvariantCulture), LootValue.LootValueUpdate); } if (bool.Parse(SkillConfig.hostConfig["Oxygen Enabled"])) { CreateSkill(UpgradeType.Oxygen, "Oxygen", "The company installs you with oxygen tanks. You gain extra time in the water. (Start drowning when the bar is empty.)", "OXY", "Extra Oxygen", UpgradeType.Oxygen, 1, int.Parse(SkillConfig.hostConfig["Oxygen Max Level"]), float.Parse(SkillConfig.hostConfig["Oxygen Multiplier"], CultureInfo.InvariantCulture)); } if (bool.Parse(SkillConfig.hostConfig["Strength Enabled"])) { CreateSkill(UpgradeType.Strength, "Strength", "The company installed a nifty new helium pack. Allows you to be less hindered by weight.", "STR", "Strength", UpgradeType.Strength, 1, int.Parse(SkillConfig.hostConfig["Strength Max Level"]), float.Parse(SkillConfig.hostConfig["Strength Multiplier"], CultureInfo.InvariantCulture), Strength.StrengthUpdate); } if (bool.Parse(SkillConfig.hostConfig["Power Enabled"])) { CreateSkill(UpgradeType.Power, "Power", "The company roids are begining to show results. Try out your new power on enemies or even friends.", "POW", "Power", UpgradeType.Power, 1, int.Parse(SkillConfig.hostConfig["Power Max Level"]), float.Parse(SkillConfig.hostConfig["Power Multiplier"], CultureInfo.InvariantCulture), Power.PowerUpdate); } if (bool.Parse(SkillConfig.hostConfig["Jump Enabled"])) { CreateSkill(UpgradeType.Jump, "Jump", "The company decided to install springs in your shoes. Try out your new Jump to get up places faster.", "JMP", "Jump", UpgradeType.Jump, 1, int.Parse(SkillConfig.hostConfig["Jump Max Level"]), float.Parse(SkillConfig.hostConfig["Jump Multiplier"], CultureInfo.InvariantCulture), Jump.JumpUpdate); } if (bool.Parse(SkillConfig.hostConfig["Speed Enabled"])) { CreateSkill(UpgradeType.Speed, "Speed", "The companies gene manipulation seems to be working in your favor. Try out your new Speed to escape enemies with ease.", "SPD", "Speed", UpgradeType.Speed, 1, int.Parse(SkillConfig.hostConfig["Speed Max Level"]), float.Parse(SkillConfig.hostConfig["Speed Multiplier"], CultureInfo.InvariantCulture), Speed.SpeedUpdate); } static string GetInitialDescriptionForHandSlots(int currentLevel, float multiplier) { Skill skill = new Skill("", "", "", "", UpgradeType.HandSlot, 0, 0, multiplier); skill.SetLevel(currentLevel); skill.UpdateSkillDescription(); return skill.GetDescription(); } } } internal class Skill { private readonly string _shortName; private readonly string _name; private readonly string _attribute; private string _description; private readonly UpgradeType _upgradeType; private readonly int _cost; private readonly int _maxLevel; private readonly float _multiplier; private readonly Action<int, int> _callback; public bool _teamShared; private int _level; public Skill(string name, string description, string shortname, string attribute, UpgradeType upgradeType, int cost, int maxLevel, float multiplier, Action<int, int> callback = null, bool teamShared = false) { _name = name; _shortName = shortname; _attribute = attribute; _upgradeType = upgradeType; _description = description; _cost = cost; _maxLevel = maxLevel; _multiplier = multiplier; _level = 0; _callback = callback; _teamShared = teamShared; } public void UpdateSkillDescription() { if (_upgradeType == UpgradeType.HandSlot) { int num = CalculateUpgradesNeededForNextSlot(); _description = $"The company finally gives you a better belt! Fit more stuff! (Upgrade {num} more times for another slot.)"; } } public int CalculateUpgradesNeededForNextSlot() { int level = _level; int num = int.Parse(SkillConfig.hostConfig["Hand Slots Initial Cost"]); int num2 = int.Parse(SkillConfig.hostConfig["Hand Slots Initial Cost"]) + int.Parse(SkillConfig.hostConfig["Hand Slots Increment"]); while (level >= num) { num += num2; num2 += int.Parse(SkillConfig.hostConfig["Hand Slots Increment"]); } return num - level; } public int Slot() { int level = _level; int num = int.Parse(SkillConfig.hostConfig["Hand Slots Initial Cost"]); int num2 = int.Parse(SkillConfig.hostConfig["Hand Slots Initial Cost"]) + int.Parse(SkillConfig.hostConfig["Hand Slots Increment"]); while (level >= num) { num += num2; num2 += int.Parse(SkillConfig.hostConfig["Hand Slots Increment"]); } return (num2 - (int.Parse(SkillConfig.hostConfig["Hand Slots Initial Cost"]) + int.Parse(SkillConfig.hostConfig["Hand Slots Increment"]))) / int.Parse(SkillConfig.hostConfig["Hand Slots Increment"]); } public string GetName() { return _name; } public string GetShortName() { return _shortName; } public string GetAttribute() { return _attribute; } public string GetDescription() { return _description; } public UpgradeType GetUpgradeType() { return _upgradeType; } public int GetCost() { return _cost; } public int GetMaxLevel() { return _maxLevel; } public int GetLevel() { return _level; } public float GetMultiplier() { return _multiplier; } public float GetTrueValue() { return _multiplier * (float)_level; } public void SetLevel(int level) { _level = level; } public void AddLevel(int level) { _level += level; int level2 = _level; UpdateSkillDescription(); _callback?.Invoke(level, level2); } } [HarmonyPatch] internal class BatteryLife { [HarmonyPrefix] [HarmonyPatch(typeof(GrabbableObject), "SyncBatteryServerRpc")] public static void BatteryUpdate(ref int charge) { if (LP_NetworkManager.xpInstance.skillList.IsSkillListValid() && LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.Battery) && charge == 100) { charge += (int)LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Battery].GetTrueValue(); } } } internal class HandSlots { public static int currentSlotCount = 4; private static int nextSlotThreshold = 8; public static void HandSlotsUpdate(int updateValue, int newValue) { //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) if (LethalPlugin.ReservedSlots || !LP_NetworkManager.xpInstance.skillList.IsSkillListValid() || !LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.HandSlot)) { return; } XP xpInstance = LP_NetworkManager.xpInstance; int level2 = (int)xpInstance.skillList.skills[UpgradeType.HandSlot].GetTrueValue(); int num = Slot(level2); int num2 = 4 + num; 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[num2]; 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[num2]; 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 templateSlot = xpInstance.guiObj.templateSlot; GameObject val3 = val2; currentSlotCount = num2; for (int j = 0; j < num; j++) { GameObject val4 = Object.Instantiate<GameObject>(templateSlot); ((Object)val4).name = $"Slot{3 + (j + 1)}"; val4.transform.SetParent(val.transform); Vector3 localPosition = val3.transform.localPosition; val4.transform.SetLocalPositionAndRotation(new Vector3(localPosition.x, 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>(); val4.SetActive(true); } int num3 = array.Length; int num4 = Mathf.Clamp(Mathf.CeilToInt(Mathf.Sqrt((float)num3 / 4f)), 2, 8); float num5 = 78 / num4; float num6 = num5; Vector3[] array3 = (Vector3[])(object)new Vector3[num4]; int num7 = 4 * num4; for (int k = 0; k < num4; k++) { array3[k] = new Vector3(-185f, (float)(-k) * num6, 0f); } for (int l = 0; l < num3; l++) { int num8 = l / num7; int num9 = l % num7; Vector3 localPosition2 = array3[num8] + new Vector3((float)num9 * num5, 0f, 0f); ((Graphic)array[l]).rectTransform.sizeDelta = new Vector2(num5, num6); ((Component)array[l]).transform.localPosition = localPosition2; } HUDManager.Instance.itemSlotIconFrames = array; HUDManager.Instance.itemSlotIcons = array2; ulong playerClientId = GameNetworkManager.Instance.localPlayerController.playerClientId; xpInstance.ServerHandSlots_ServerRpc(playerClientId, num); static int Slot(int level) { int num10 = int.Parse(SkillConfig.hostConfig["Hand Slots Initial Cost"]); int num11 = int.Parse(SkillConfig.hostConfig["Hand Slots Initial Cost"]) + int.Parse(SkillConfig.hostConfig["Hand Slots Increment"]); while (level >= num10) { num10 += num11; num11 += int.Parse(SkillConfig.hostConfig["Hand Slots Increment"]); } return (num11 - (int.Parse(SkillConfig.hostConfig["Hand Slots Initial Cost"]) + int.Parse(SkillConfig.hostConfig["Hand Slots Increment"]))) / int.Parse(SkillConfig.hostConfig["Hand Slots Increment"]); } } } [HarmonyPatch] internal class HPRegen { [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] private static void HPRegenUpdate(PlayerControllerB __instance) { if (__instance.health >= 100 || !LP_NetworkManager.xpInstance.skillList.IsSkillListValid() || !LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.HPRegen) || LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.HPRegen].GetLevel() == 0) { return; } if (__instance.healthRegenerateTimer <= 0f) { Skill skill = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.HPRegen]; float trueValue = skill.GetTrueValue(); __instance.healthRegenerateTimer = 1f / trueValue; __instance.health++; if (__instance.health >= 20) { __instance.MakeCriticallyInjured(false); } HUDManager.Instance.UpdateHealthUI(__instance.health, false); } else { __instance.healthRegenerateTimer -= Time.deltaTime; } } } internal class Jump { public static void JumpUpdate(int updatedValue, int newJumpLevel) { if (LP_NetworkManager.xpInstance.skillList.IsSkillListValid() && LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.Jump)) { Skill skill = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Jump]; PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; float num = (float)newJumpLevel * skill.GetMultiplier() / 100f * 13f; localPlayerController.jumpForce += num; LethalPlugin.Log.LogInfo((object)$"Jump level: {skill.GetLevel()}, New Jump: {localPlayerController.jumpForce}"); } } } [HarmonyPatch] internal class LootValue { private static readonly float BaseScrapValueMultiplier = 0.35f; [HarmonyPrefix] [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] private static void AddLootValue() { if (LP_NetworkManager.xpInstance.skillList.IsSkillListValid() && LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.Value)) { RoundManager.Instance.scrapValueMultiplier = BaseScrapValueMultiplier; float multiplier = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Value].GetMultiplier(); RoundManager instance = RoundManager.Instance; instance.scrapValueMultiplier += multiplier * 7f * LP_NetworkManager.xpInstance.teamLootValue.Value / 2000f; } } public static void LootValueUpdate(int change, int newLevel) { if (LP_NetworkManager.xpInstance.skillList.IsSkillListValid() && LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.Value)) { LP_NetworkManager.xpInstance.TeamLootValueUpdate(change, newLevel); } } } [HarmonyPatch] internal class Oxygen { private static GameObject oxygenBar; private static float oxygen = 0f; private static float oxygenTimer = 0f; private static bool inWater = false; private static bool canDrown = true; [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "SetFaceUnderwaterClientRpc")] private static void EnteredWater(PlayerControllerB __instance) { inWater = true; } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "SetFaceOutOfWaterClientRpc")] private static void LeftWater(PlayerControllerB __instance) { inWater = false; } [HarmonyPrefix] [HarmonyPatch(typeof(PlayerControllerB), "SetFaceUnderwaterFilters")] private static void ShouldDrown(PlayerControllerB __instance) { if (!canDrown) { StartOfRound.Instance.drowningTimer = 99f; } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] private static void OxygenUpdate(PlayerControllerB __instance) { if (!LP_NetworkManager.xpInstance.skillList.IsSkillListValid() || !LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.Oxygen)) { return; } if (__instance.isPlayerDead) { if (Object.op_Implicit((Object)(object)oxygenBar)) { oxygenBar.SetActive(false); } return; } if (LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Oxygen].GetLevel() == 0) { if (Object.op_Implicit((Object)(object)oxygenBar)) { oxygenBar.SetActive(false); } if (!canDrown) { canDrown = true; StartOfRound.Instance.drowningTimer = 1f; } return; } if (!Object.op_Implicit((Object)(object)oxygenBar)) { CreateOxygenBar(); } Skill skill = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Oxygen]; float trueValue = skill.GetTrueValue(); if (inWater) { oxygenBar.SetActive(true); if (oxygenTimer <= 0f) { oxygenTimer = 0.1f; if (oxygen > 0f) { oxygen -= 0.1f; } else if (!canDrown) { canDrown = true; StartOfRound.Instance.drowningTimer = 1f; } } else { oxygenTimer -= Time.deltaTime; } } if (!inWater) { if (oxygenTimer <= 0f) { oxygenTimer = 0.1f; if (oxygen < trueValue) { oxygenBar.SetActive(true); oxygen += 0.1f; canDrown = false; } else { oxygenBar.SetActive(false); } } else { oxygenTimer -= Time.deltaTime; } } if (oxygen > trueValue) { oxygenBar.SetActive(false); oxygen = trueValue; } if (oxygenBar.activeSelf) { float fillAmount = oxygen / trueValue; ((Component)oxygenBar.transform.GetChild(0).GetChild(0)).GetComponent<Image>().fillAmount = fillAmount; } } public static void CreateOxygenBar() { oxygenBar = Object.Instantiate<GameObject>(LethalPlugin.skillBundle.LoadAsset<GameObject>("OxygenBar")); oxygenBar.SetActive(false); } } internal class Power { public static void PowerUpdate(int updatedValue, int newPower) { if (LP_NetworkManager.xpInstance.skillList.IsSkillListValid() && LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.Power)) { Skill skill = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Power]; float num = CalculatePowerMultiplier(skill.GetLevel()); LethalPlugin.Log.LogInfo((object)$"Power level: {skill.GetLevel()}, Power multiplier: {skill.GetLevel()}"); } } public static float CalculatePowerMultiplier(int powerLevel) { return 1f + (float)powerLevel * 0.1f; } } internal class Speed { public static void SpeedUpdate(int updatedValue, int newSpeedLevel) { if (LP_NetworkManager.xpInstance.skillList.IsSkillListValid() && LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.Speed)) { Skill skill = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Speed]; PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; float num = (float)newSpeedLevel * skill.GetMultiplier() / 100f * 4.6f; localPlayerController.movementSpeed += num; LethalPlugin.Log.LogInfo((object)$"Speed level: {skill.GetLevel()}, New movement speed: {localPlayerController.movementSpeed}"); } } } internal class Stamina { public static void StaminaUpdate(int updatedValue, int newStamina) { if (LP_NetworkManager.xpInstance.skillList.IsSkillListValid() && LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.Stamina)) { Skill skill = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Stamina]; PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; float num = (float)updatedValue * skill.GetMultiplier() / 100f * 11f; localPlayerController.sprintTime += num; LethalPlugin.Log.LogInfo((object)$"{updatedValue} change, {newStamina} new stamina points, Adding {num} resulting in {localPlayerController.sprintTime} stamina"); } } } internal class Strength { private static PlayerControllerB localPlayer; private static float lastCarryWeight; public static void Initialize() { localPlayer = GameNetworkManager.Instance.localPlayerController; lastCarryWeight = localPlayer.carryWeight; } public static void CheckAndUpdateCarryWeight() { if (!((Object)(object)localPlayer == (Object)null) && Mathf.Abs(localPlayer.carryWeight - lastCarryWeight) > Mathf.Epsilon) { StrengthUpdates(); lastCarryWeight = localPlayer.carryWeight; } } public static void StrengthUpdates() { if (!LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.Strength)) { return; } Skill skill = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Strength]; float num = (float)skill.GetLevel() * 0.01f; float num2 = 1f; GrabbableObject[] itemSlots = localPlayer.ItemSlots; foreach (GrabbableObject val in itemSlots) { if ((Object)(object)val != (Object)null) { num2 += val.itemProperties.weight - 1f; } } localPlayer.carryWeight = Mathf.Max(1f + (num2 - 1f) * (1f - num), 1f); LethalPlugin.Log.LogInfo((object)("New carry weight: " + localPlayer.carryWeight)); } public static void StrengthUpdate(int updatedValue, int newStrength) { if (!LP_NetworkManager.xpInstance.skillList.IsSkillListValid() || !LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.Strength)) { return; } Skill skill = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Strength]; Initialize(); float num = (float)skill.GetLevel() * 0.01f; float num2 = 1f; GrabbableObject[] itemSlots = localPlayer.ItemSlots; foreach (GrabbableObject val in itemSlots) { if ((Object)(object)val != (Object)null) { num2 += val.itemProperties.weight - 1f; } } localPlayer.carryWeight = Mathf.Max(1f + (num2 - 1f) * (1f - num), 1f); LethalPlugin.Log.LogInfo((object)$"Strength level: {skill.GetLevel()}, New carry weight: {localPlayer.carryWeight}"); } } } namespace LethalProgression.Patches { [HarmonyPatch] internal class HUDManagerPatch { private static GameObject _tempBar; private static TextMeshProUGUI _tempText; private static float _tempBarTime; private static GameObject levelText; private static float levelTextTime; private static Dictionary<string, int> _enemyReward = new Dictionary<string, int> { { "HoarderBug (EnemyType)", 30 }, { "BaboonBird (EnemyType)", 15 }, { "MouthDog (EnemyType)", 200 }, { "Centipede (EnemyType)", 30 }, { "Flowerman (EnemyType)", 200 }, { "SandSpider (EnemyType)", 50 }, { "Crawler (EnemyType)", 50 }, { "Puffer (EnemyType)", 15 } }; [HarmonyPrefix] [HarmonyPatch(typeof(HUDManager), "AddNewScrapFoundToDisplay")] private static void GiveXPForScrap(GrabbableObject GObject) { if (GameNetworkManager.Instance.isHostingGame) { int scrapValue = GObject.scrapValue; LP_NetworkManager.xpInstance.AddXPServerRPC(scrapValue); } } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyAI), "KillEnemy")] private static void GiveXPForKill(EnemyAI __instance) { string text = ((object)__instance.enemyType).ToString(); LethalPlugin.Log.LogInfo((object)("Enemy type: " + text)); int xp = 30; if (_enemyReward.ContainsKey(text)) { xp = _enemyReward[text]; } LP_NetworkManager.xpInstance.AddXPServerRPC(xp); } public static void ShowXPUpdate(int oldXP, int newXP, int xp) { if (!Object.op_Implicit((Object)(object)_tempBar)) { MakeBar(); } GameObject val = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/BottomMiddle/XPUpdate/XPBarProgress"); val.GetComponent<Image>().fillAmount = (float)newXP / (float)LP_NetworkManager.xpInstance.GetXPRequirement(); ((TMP_Text)_tempText).text = newXP + " / " + (float)LP_NetworkManager.xpInstance.GetXPRequirement(); _tempBarTime = 2f; if (!_tempBar.activeSelf) { ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(XPBarCoroutine()); } } private static IEnumerator XPBarCoroutine() { _tempBar.SetActive(true); while (_tempBarTime > 0f) { float time = _tempBarTime; _tempBarTime = 0f; yield return (object)new WaitForSeconds(time); } _tempBar.SetActive(false); } public static void ShowLevelUp() { if (!Object.op_Implicit((Object)(object)levelText)) { MakeLevelUp(); } levelTextTime = 5f; if (!levelText.gameObject.activeSelf) { ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(LevelUpCoroutine()); } } public static void MakeLevelUp() { levelText = Object.Instantiate<GameObject>(LethalPlugin.skillBundle.LoadAsset<GameObject>("LevelUp")); ((TMP_Text)((Component)levelText.transform.GetChild(0)).GetComponent<TextMeshProUGUI>()).text = "Level Up! Spend your skill points."; levelText.gameObject.SetActive(false); } private static IEnumerator LevelUpCoroutine() { levelText.gameObject.SetActive(true); while (levelTextTime > 0f) { float time = levelTextTime; levelTextTime = 0f; yield return (object)new WaitForSeconds(time); } levelText.gameObject.SetActive(false); } private static void MakeBar() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("/Systems/UI/Canvas/QuickMenu/XPBar"); QuickMenuManagerPatch.MakeNewXPBar(); val = GameObject.Find("/Systems/UI/Canvas/QuickMenu/XPBar"); _tempBar = Object.Instantiate<GameObject>(val); ((Object)_tempBar).name = "XPUpdate"; _tempText = _tempBar.GetComponentInChildren<TextMeshProUGUI>(); GameObject val2 = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/BottomMiddle"); _tempBar.transform.SetParent(val2.transform, false); _tempBar.transform.localScale = new Vector3(0.4f, 0.4f, 0.4f); GameObject val3 = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/BottomMiddle/XPUpdate/XPLevel"); Object.Destroy((Object)(object)val3); GameObject val4 = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/BottomMiddle/XPUpdate/XPProfit"); Object.Destroy((Object)(object)val4); _tempBar.transform.Translate(3.1f, -2.1f, 0f); Vector3 localPosition = _tempBar.transform.localPosition; _tempBar.transform.localPosition = new Vector3(localPosition.x, localPosition.y + 5f, localPosition.z); _tempBar.SetActive(false); } } [HarmonyPatch] internal class QuickMenuManagerPatch { [CompilerGenerated] private static class <>O { public static UnityAction <0>__OpenSkillTree; } private static GameObject _xpBar; private static GameObject _xpBarProgress; private static TextMeshProUGUI _xpText; private static TextMeshProUGUI _xpLevel; private static TextMeshProUGUI _profit; private static GameObject skillTreeButton; [HarmonyPostfix] [HarmonyPatch(typeof(QuickMenuManager), "OpenQuickMenu")] private static void QuickMenuXPBar(QuickMenuManager __instance) { if (__instance.isMenuOpen) { if (!Object.op_Implicit((Object)(object)_xpBar) || !Object.op_Implicit((Object)(object)_xpBarProgress)) { MakeNewXPBar(); } _xpBar.SetActive(true); _xpBarProgress.SetActive(true); } } [HarmonyPostfix] [HarmonyPatch(typeof(QuickMenuManager), "Update")] private static void XPMenuUpdate(QuickMenuManager __instance) { if (Object.op_Implicit((Object)(object)_xpBar) && Object.op_Implicit((Object)(object)_xpBarProgress)) { if (__instance.mainButtonsPanel.activeSelf) { _xpBar.SetActive(true); _xpBarProgress.SetActive(true); } else { _xpBar.SetActive(false); _xpBarProgress.SetActive(false); } ((TMP_Text)_xpText).text = LP_NetworkManager.xpInstance.GetXP() + " / " + LP_NetworkManager.xpInstance.xpReq.Value; ((TMP_Text)_xpLevel).text = "Level: " + LP_NetworkManager.xpInstance.GetLevel(); ((TMP_Text)_profit).text = "You've made.. " + LP_NetworkManager.xpInstance.GetProfit() + "$"; _xpBarProgress.GetComponent<Image>().fillAmount = (float)LP_NetworkManager.xpInstance.GetXP() / (float)LP_NetworkManager.xpInstance.xpReq.Value; } } public static void MakeNewXPBar() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("/Systems/UI/Canvas/QuickMenu"); if (!Object.op_Implicit((Object)(object)_xpBar)) { GameObject val2 = GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/LevelUpBox"); _xpBar = Object.Instantiate<GameObject>(val2); ((Object)_xpBar).name = "XPBar"; _xpBar.transform.SetParent(val.transform, false); _xpBar.transform.localScale = new Vector3(0.75f, 0.75f, 0.75f); _xpBar.transform.Translate(-2f, 1f, 0f); } if (!Object.op_Implicit((Object)(object)_xpBarProgress)) { GameObject val3 = GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/LevelUpMeter"); _xpBarProgress = Object.Instantiate<GameObject>(val3); ((Object)_xpBarProgress).name = "XPBarProgress"; _xpBarProgress.transform.SetParent(_xpBar.transform, false); _xpBarProgress.GetComponent<Image>().fillAmount = 0f; _xpBarProgress.transform.localScale = new Vector3(0.597f, 5.21f, 1f); _xpBarProgress.transform.Translate(-0.8f, 0.2f, 0f); Vector3 localPosition = _xpBarProgress.transform.localPosition; _xpBarProgress.transform.localPosition = new Vector3(localPosition.x + 7f, localPosition.y - 3.5f, 0f); GameObject val4 = GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/Total"); _xpText = Object.Instantiate<GameObject>(val4).GetComponent<TextMeshProUGUI>(); ((Object)_xpText).name = "XPText"; ((TMP_Text)_xpText).alignment = (TextAlignmentOptions)514; ((TMP_Text)_xpText).SetText("0/1000", true); ((TMP_Text)_xpText).transform.SetParent(_xpBar.transform, false); ((Graphic)_xpText).color = new Color(1f, 0.6f, 0f, 1f); ((TMP_Text)_xpText).transform.Translate(-0.75f, 0.21f, 0f); _xpLevel = Object.Instantiate<GameObject>(val4).GetComponent<TextMeshProUGUI>(); ((Object)_xpLevel).name = "XPLevel"; ((TMP_Text)_xpLevel).alignment = (TextAlignmentOptions)514; ((TMP_Text)_xpLevel).SetText("Level: 0", true); ((TMP_Text)_xpLevel).transform.SetParent(_xpBar.transform, false); ((Graphic)_xpLevel).color = new Color(1f, 0.6f, 0f, 1f); ((TMP_Text)_xpLevel).transform.Translate(-1f, 0.4f, 0f); _profit = Object.Instantiate<GameObject>(val4).GetComponent<TextMeshProUGUI>(); ((Object)_profit).name = "XPProfit"; ((TMP_Text)_profit).alignment = (TextAlignmentOptions)514; ((TMP_Text)_profit).SetText("You've made.. 0$.", true); ((TMP_Text)_profit).transform.SetParent(_xpBar.transform, false); ((Graphic)_profit).color = new Color(1f, 0.6f, 0f, 1f); ((TMP_Text)_profit).transform.Translate(-0.8f, 0f, 0f); } } [HarmonyPostfix] [HarmonyPatch(typeof(QuickMenuManager), "OpenQuickMenu")] private static void SkillTreeAwake(QuickMenuManager __instance) { if (__instance.isMenuOpen && !Object.op_Implicit((Object)(object)skillTreeButton)) { MakeSkillTreeButton(); } } private static void MakeSkillTreeButton() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown GameObject val = GameObject.Find("Systems/UI/Canvas/QuickMenu/MainButtons/Resume"); skillTreeButton = Object.Instantiate<GameObject>(val); GameObject val2 = GameObject.Find("Systems/UI/Canvas/QuickMenu/MainButtons"); skillTreeButton.transform.SetParent(val2.transform, false); ((Object)skillTreeButton).name = "Skills"; ((TMP_Text)skillTreeButton.GetComponentInChildren<TextMeshProUGUI>()).text = "> Skills"; skillTreeButton.transform.Translate(0.7f, 1.1f, 0f); skillTreeButton.GetComponent<Button>().onClick = new ButtonClickedEvent(); ButtonClickedEvent onClick = skillTreeButton.GetComponent<Button>().onClick; object obj = <>O.<0>