using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using AdjustableUpgrades.Configuration;
using AdjustableUpgrades.Core;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("AdjustableUpgrades")]
[assembly: AssemblyDescription("A REPO mod that lets players adjust their upgrade levels within their purchased cap.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdjustableUpgrades")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a1b2c3d4-e5f6-7890-abcd-ef1234567890")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.3.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace AdjustableUpgrades
{
[BepInPlugin("Hazuki.REPO.AdjustableUpgrades", "Adjustable Upgrades", "1.0.3")]
public class Plugin : BaseUnityPlugin
{
private const string MOD_GUID = "Hazuki.REPO.AdjustableUpgrades";
private const string MOD_NAME = "Adjustable Upgrades";
private const string MOD_VERSION = "1.0.3";
private readonly Harmony harmony = new Harmony("Hazuki.REPO.AdjustableUpgrades");
internal static ManualLogSource Log;
internal static Plugin Instance;
private bool isUIVisible;
private Rect windowRect = new Rect(20f, 20f, 420f, 500f);
private Vector2 scrollPosition = Vector2.zero;
private GUIStyle headerStyle;
private GUIStyle labelStyle;
private GUIStyle buttonStyle;
private GUIStyle boxStyle;
private GUIStyle windowStyle;
private bool stylesInitialized;
private CursorLockMode previousLockState;
private bool previousCursorVisible;
private const int WINDOW_ID = 98712;
private void Awake()
{
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)Instance != (Object)null))
{
Instance = this;
Log = ((BaseUnityPlugin)this).Logger;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
UpgradeCapManager.SetSavePath(Paths.ConfigPath);
ModConfig.Init(((BaseUnityPlugin)this).Config);
harmony.PatchAll();
Log.LogInfo((object)"Adjustable Upgrades v1.0.3 loaded!");
Log.LogInfo((object)$"Press '{ModConfig.ToggleUIKey.Value}' to toggle upgrade adjustment UI.");
}
}
private void Update()
{
//IL_0005: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
if (!Input.GetKeyDown(ModConfig.ToggleUIKey.Value))
{
return;
}
isUIVisible = !isUIVisible;
Log.LogInfo((object)$"Upgrade Adjust UI toggled: {isUIVisible}");
if (isUIVisible)
{
previousLockState = Cursor.lockState;
previousCursorVisible = Cursor.visible;
Cursor.lockState = (CursorLockMode)0;
Cursor.visible = true;
if (UpgradeCapManager.GetAllCaps().Count == 0)
{
Log.LogInfo((object)"Caps empty, reinitializing...");
UpgradeCapManager.InitCapsFromCurrentStats();
}
}
else
{
Cursor.lockState = previousLockState;
Cursor.visible = previousCursorVisible;
}
}
private void OnGUI()
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected O, but got Unknown
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
if (isUIVisible)
{
if ((int)Cursor.lockState != 0)
{
Cursor.lockState = (CursorLockMode)0;
Cursor.visible = true;
}
InitStyles();
windowRect = GUILayout.Window(98712, windowRect, new WindowFunction(DrawWindow), "Adjustable Upgrades", windowStyle, Array.Empty<GUILayoutOption>());
}
}
private void OnDestroy()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
harmony.UnpatchSelf();
if (isUIVisible)
{
Cursor.lockState = previousLockState;
Cursor.visible = previousCursorVisible;
}
}
private void InitStyles()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Expected O, but got Unknown
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Expected O, but got Unknown
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Expected O, but got Unknown
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
if (!stylesInitialized)
{
windowStyle = new GUIStyle(GUI.skin.window);
windowStyle.normal.textColor = new Color(0.9f, 0.85f, 0.6f);
windowStyle.fontSize = 16;
windowStyle.fontStyle = (FontStyle)1;
headerStyle = new GUIStyle(GUI.skin.label);
headerStyle.fontSize = 14;
headerStyle.fontStyle = (FontStyle)1;
headerStyle.normal.textColor = new Color(1f, 0.9f, 0.5f);
headerStyle.alignment = (TextAnchor)4;
labelStyle = new GUIStyle(GUI.skin.label);
labelStyle.fontSize = 13;
labelStyle.normal.textColor = Color.white;
buttonStyle = new GUIStyle(GUI.skin.button);
buttonStyle.fontSize = 13;
buttonStyle.fontStyle = (FontStyle)1;
boxStyle = new GUIStyle(GUI.skin.box);
boxStyle.normal.textColor = Color.white;
boxStyle.fontSize = 12;
stylesInitialized = true;
}
}
private void DrawWindow(int windowID)
{
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_039e: Unknown result type (might be due to invalid IL or missing references)
//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
Dictionary<string, int> allCaps = UpgradeCapManager.GetAllCaps();
if (allCaps.Count == 0)
{
GUILayout.Space(10f);
GUILayout.Label("No upgrades detected yet.", headerStyle, Array.Empty<GUILayoutOption>());
GUILayout.Label("Enter a level first, then try again.", labelStyle, Array.Empty<GUILayoutOption>());
GUILayout.Space(5f);
if (GUILayout.Button("Refresh", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
{
UpgradeCapManager.InitCapsFromCurrentStats();
}
GUILayout.Space(10f);
GUI.DragWindow();
return;
}
GUILayout.Space(5f);
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
if (GUILayout.Button("MAX ALL", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
{
UpgradeCapManager.MaxAll();
}
if (GUILayout.Button("CLEAR ALL", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
{
UpgradeCapManager.ClearAll();
}
if (ModConfig.EnableRandomizeButton.Value && GUILayout.Button("RANDOM", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
{
UpgradeCapManager.RandomizeAll();
}
GUILayout.EndHorizontal();
GUILayout.Space(5f);
List<string> list = (from k in allCaps.Keys
where UpgradeCapManager.VanillaKeys.Contains(k)
orderby k
select k).ToList();
List<string> list2 = (from k in allCaps.Keys
where UpgradeCapManager.ModdedKeys.Contains(k)
orderby k
select k).ToList();
scrollPosition = GUILayout.BeginScrollView(scrollPosition, Array.Empty<GUILayoutOption>());
if (list.Count > 0)
{
GUILayout.Label("--- Vanilla Upgrades ---", headerStyle, Array.Empty<GUILayoutOption>());
GUILayout.Space(3f);
foreach (string item in list)
{
DrawUpgradeRow(item, allCaps[item]);
}
}
if (list2.Count > 0)
{
GUILayout.Space(8f);
GUILayout.Label("--- Modded Upgrades ---", headerStyle, Array.Empty<GUILayoutOption>());
GUILayout.Space(3f);
foreach (string item2 in list2)
{
DrawUpgradeRow(item2, allCaps[item2]);
}
}
List<string> list3 = (from k in allCaps.Keys
where !UpgradeCapManager.VanillaKeys.Contains(k) && !UpgradeCapManager.ModdedKeys.Contains(k)
orderby k
select k).ToList();
if (list3.Count > 0)
{
GUILayout.Space(8f);
GUILayout.Label("--- Other Upgrades ---", headerStyle, Array.Empty<GUILayoutOption>());
GUILayout.Space(3f);
foreach (string item3 in list3)
{
DrawUpgradeRow(item3, allCaps[item3]);
}
}
GUILayout.EndScrollView();
GUILayout.Space(5f);
KeyCode value = ModConfig.ToggleUIKey.Value;
GUILayout.Label("Press " + ((object)(KeyCode)(ref value)).ToString() + " to close", labelStyle, Array.Empty<GUILayoutOption>());
GUI.DragWindow();
}
private void DrawUpgradeRow(string key, int cap)
{
int currentLevel = UpgradeCapManager.GetCurrentLevel(key);
object obj = UpgradeCapManager.GetDisplayName(key);
GUILayout.BeginHorizontal(boxStyle, Array.Empty<GUILayoutOption>());
if (obj == null)
{
obj = "";
}
GUILayout.Label((string)obj, labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) });
GUILayout.Label($"Lv.{currentLevel} / {cap}", labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
GUI.enabled = currentLevel > 0;
if (GUILayout.Button("-", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
{
GUILayout.Width(30f),
GUILayout.Height(25f)
}))
{
UpgradeCapManager.SetLevel(key, currentLevel - 1);
}
GUI.enabled = true;
int num = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)currentLevel, 0f, (float)cap, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }));
if (num != currentLevel)
{
UpgradeCapManager.SetLevel(key, num);
}
GUI.enabled = currentLevel < cap;
if (GUILayout.Button("+", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
{
GUILayout.Width(30f),
GUILayout.Height(25f)
}))
{
UpgradeCapManager.SetLevel(key, currentLevel + 1);
}
GUI.enabled = true;
GUILayout.EndHorizontal();
}
}
}
namespace AdjustableUpgrades.Patches
{
[HarmonyPatch(typeof(StatsManager), "Start")]
public class StatsManagerInitPatch
{
[HarmonyPostfix]
public static void Postfix(StatsManager __instance)
{
UpgradeCapManager.InitCapsFromCurrentStats();
}
}
[HarmonyPatch(typeof(ItemUpgrade), "PlayerUpgrade")]
public class UpgradePurchasePatch
{
public struct UpgradeSnapshot
{
public string SteamID;
public Dictionary<string, int> PreLevels;
}
[HarmonyPrefix]
public static void Prefix(ItemUpgrade __instance, out UpgradeSnapshot __state)
{
__state = default(UpgradeSnapshot);
object? value = AccessTools.Field(typeof(ItemUpgrade), "itemToggle").GetValue(__instance);
ItemToggle val = (ItemToggle)((value is ItemToggle) ? value : null);
if ((Object)(object)val == (Object)null || !val.toggleState)
{
return;
}
PlayerAvatar val2 = SemiFunc.PlayerAvatarGetFromPhotonID((int)AccessTools.Field(typeof(ItemToggle), "playerTogglePhotonID").GetValue(val));
if ((Object)(object)val2 == (Object)null)
{
return;
}
string text = (string)AccessTools.Field(typeof(PlayerAvatar), "steamID").GetValue(val2);
if (!((Object)(object)val2.photonView != (Object)null) || !val2.photonView.IsMine)
{
return;
}
Dictionary<string, int> dictionary = new Dictionary<string, int>();
if ((Object)(object)StatsManager.instance != (Object)null)
{
foreach (KeyValuePair<string, Dictionary<string, int>> dictionaryOfDictionary in StatsManager.instance.dictionaryOfDictionaries)
{
if (dictionaryOfDictionary.Key.StartsWith("playerUpgrade"))
{
int value2 = (dictionaryOfDictionary.Value.ContainsKey(text) ? dictionaryOfDictionary.Value[text] : 0);
dictionary[dictionaryOfDictionary.Key] = value2;
}
}
}
__state = new UpgradeSnapshot
{
SteamID = text,
PreLevels = dictionary
};
}
[HarmonyPostfix]
public static void Postfix(ItemUpgrade __instance, UpgradeSnapshot __state)
{
if (string.IsNullOrEmpty(__state.SteamID) || __state.PreLevels == null || (Object)(object)StatsManager.instance == (Object)null)
{
return;
}
foreach (KeyValuePair<string, Dictionary<string, int>> dictionaryOfDictionary in StatsManager.instance.dictionaryOfDictionaries)
{
if (dictionaryOfDictionary.Key.StartsWith("playerUpgrade"))
{
int num = (dictionaryOfDictionary.Value.ContainsKey(__state.SteamID) ? dictionaryOfDictionary.Value[__state.SteamID] : 0);
int num2 = (__state.PreLevels.ContainsKey(dictionaryOfDictionary.Key) ? __state.PreLevels[dictionaryOfDictionary.Key] : 0);
if (num > num2)
{
int num3 = num - num2;
UpgradeCapManager.IncreaseCap(dictionaryOfDictionary.Key, num3);
Plugin.Log.LogInfo((object)$"Upgrade purchased: {dictionaryOfDictionary.Key} cap increased by {num3}");
}
}
}
}
}
}
namespace AdjustableUpgrades.Core
{
public static class UpgradeCapManager
{
private static readonly Dictionary<string, int> upgradeCaps = new Dictionary<string, int>();
public static readonly HashSet<string> VanillaKeys = new HashSet<string>();
public static readonly HashSet<string> ModdedKeys = new HashSet<string>();
private static readonly object capLock = new object();
private static readonly Random random = new Random();
private static string capsFilePath;
public static void SetSavePath(string configDir)
{
capsFilePath = Path.Combine(configDir, "AdjustableUpgrades_caps.txt");
}
public static void InitCapsFromCurrentStats()
{
lock (capLock)
{
upgradeCaps.Clear();
VanillaKeys.Clear();
ModdedKeys.Clear();
if ((Object)(object)StatsManager.instance == (Object)null)
{
return;
}
Dictionary<string, int> dictionary = LoadCapsFromFile();
HashSet<string> hashSet = (from f in typeof(StatsManager).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
select f.Name).ToHashSet();
string localSteamID = GetLocalSteamID();
if (string.IsNullOrEmpty(localSteamID))
{
return;
}
foreach (KeyValuePair<string, Dictionary<string, int>> dictionaryOfDictionary in StatsManager.instance.dictionaryOfDictionaries)
{
if (dictionaryOfDictionary.Key.StartsWith("playerUpgrade"))
{
if (hashSet.Contains(dictionaryOfDictionary.Key))
{
VanillaKeys.Add(dictionaryOfDictionary.Key);
}
else
{
ModdedKeys.Add(dictionaryOfDictionary.Key);
}
int val = (dictionaryOfDictionary.Value.ContainsKey(localSteamID) ? dictionaryOfDictionary.Value[localSteamID] : 0);
int val2 = (dictionary.ContainsKey(dictionaryOfDictionary.Key) ? dictionary[dictionaryOfDictionary.Key] : 0);
upgradeCaps[dictionaryOfDictionary.Key] = Math.Max(val2, val);
}
}
Plugin.Log.LogInfo((object)$"UpgradeCapManager initialized: {VanillaKeys.Count} vanilla, {ModdedKeys.Count} modded. Caps loaded (saved caps applied).");
RestoreLevelsToCaps(localSteamID);
SaveCapsToFile();
}
}
private static void RestoreLevelsToCaps(string localSteamID)
{
if ((Object)(object)PunManager.instance == (Object)null)
{
return;
}
PhotonView component = ((Component)PunManager.instance).GetComponent<PhotonView>();
if ((Object)(object)component == (Object)null)
{
return;
}
foreach (KeyValuePair<string, int> upgradeCap in upgradeCaps)
{
string key = upgradeCap.Key;
int value = upgradeCap.Value;
int num = 0;
if (StatsManager.instance.dictionaryOfDictionaries.TryGetValue(key, out var value2))
{
num = (value2.ContainsKey(localSteamID) ? value2[localSteamID] : 0);
}
if (num < value)
{
if (VanillaKeys.Contains(key))
{
string text = key.Substring("playerUpgrade".Length);
int num2 = value - num;
component.RPC("TesterUpgradeCommandRPC", (RpcTarget)0, new object[3] { localSteamID, text, num2 });
}
else
{
component.RPC("UpdateStatRPC", (RpcTarget)0, new object[3] { key, localSteamID, value });
}
Plugin.Log.LogInfo((object)$"Restored {key}: {num} -> {value}");
}
}
}
public static void IncreaseCap(string key, int amount = 1)
{
lock (capLock)
{
if (!upgradeCaps.ContainsKey(key))
{
upgradeCaps[key] = 0;
}
upgradeCaps[key] += amount;
Plugin.Log.LogInfo((object)$"Cap increased: {key} -> {upgradeCaps[key]}");
SaveCapsToFile();
}
}
public static int GetCap(string key)
{
lock (capLock)
{
return upgradeCaps.ContainsKey(key) ? upgradeCaps[key] : 0;
}
}
public static int GetCurrentLevel(string key)
{
if ((Object)(object)StatsManager.instance == (Object)null)
{
return 0;
}
string localSteamID = GetLocalSteamID();
if (string.IsNullOrEmpty(localSteamID))
{
return 0;
}
if (StatsManager.instance.dictionaryOfDictionaries.TryGetValue(key, out var value))
{
if (!value.ContainsKey(localSteamID))
{
return 0;
}
return value[localSteamID];
}
return 0;
}
public static void SetLevel(string key, int targetLevel)
{
int cap = GetCap(key);
int num = Math.Max(0, Math.Min(targetLevel, cap));
int currentLevel = GetCurrentLevel(key);
if (num == currentLevel)
{
return;
}
string localSteamID = GetLocalSteamID();
if (!string.IsNullOrEmpty(localSteamID) && !((Object)(object)PunManager.instance == (Object)null))
{
PhotonView component = ((Component)PunManager.instance).GetComponent<PhotonView>();
if ((Object)(object)component == (Object)null)
{
Plugin.Log.LogWarning((object)"SetLevel: PunManager PhotonView not found.");
}
else if (VanillaKeys.Contains(key))
{
string text = key.Substring("playerUpgrade".Length);
int num2 = num - currentLevel;
component.RPC("TesterUpgradeCommandRPC", (RpcTarget)0, new object[3] { localSteamID, text, num2 });
Plugin.Log.LogInfo((object)$"SetLevel (vanilla): {key} {currentLevel} -> {num} (delta: {num2})");
}
else
{
component.RPC("UpdateStatRPC", (RpcTarget)0, new object[3] { key, localSteamID, num });
Plugin.Log.LogInfo((object)$"SetLevel (modded): {key} {currentLevel} -> {num}");
}
}
}
public static void RandomizeAll()
{
lock (capLock)
{
foreach (string item in upgradeCaps.Keys.ToList())
{
int num = upgradeCaps[item];
if (num > 0)
{
int targetLevel = random.Next(0, num + 1);
SetLevel(item, targetLevel);
}
}
}
Plugin.Log.LogInfo((object)"All upgrade levels randomized.");
}
public static void MaxAll()
{
lock (capLock)
{
foreach (KeyValuePair<string, int> upgradeCap in upgradeCaps)
{
SetLevel(upgradeCap.Key, upgradeCap.Value);
}
}
Plugin.Log.LogInfo((object)"All upgrade levels set to max.");
}
public static void ClearAll()
{
lock (capLock)
{
foreach (string item in upgradeCaps.Keys.ToList())
{
SetLevel(item, 0);
}
}
Plugin.Log.LogInfo((object)"All upgrade levels cleared to 0.");
}
public static Dictionary<string, int> GetAllCaps()
{
lock (capLock)
{
return new Dictionary<string, int>(upgradeCaps);
}
}
public static string GetDisplayName(string key)
{
if (key.StartsWith("playerUpgrade"))
{
return key.Substring("playerUpgrade".Length);
}
if (key.StartsWith("player"))
{
return key.Substring("player".Length);
}
return key;
}
private static void SaveCapsToFile()
{
if (string.IsNullOrEmpty(capsFilePath))
{
return;
}
try
{
List<string> list = new List<string>();
foreach (KeyValuePair<string, int> upgradeCap in upgradeCaps)
{
list.Add($"{upgradeCap.Key}={upgradeCap.Value}");
}
File.WriteAllLines(capsFilePath, list);
}
catch (Exception ex)
{
Plugin.Log.LogWarning((object)("Failed to save caps: " + ex.Message));
}
}
private static Dictionary<string, int> LoadCapsFromFile()
{
Dictionary<string, int> dictionary = new Dictionary<string, int>();
if (string.IsNullOrEmpty(capsFilePath))
{
return dictionary;
}
if (!File.Exists(capsFilePath))
{
return dictionary;
}
try
{
string[] array = File.ReadAllLines(capsFilePath);
for (int i = 0; i < array.Length; i++)
{
string text = array[i].Trim();
if (string.IsNullOrEmpty(text))
{
continue;
}
int num = text.IndexOf('=');
if (num > 0)
{
string key = text.Substring(0, num);
if (int.TryParse(text.Substring(num + 1), out var result))
{
dictionary[key] = result;
}
}
}
Plugin.Log.LogInfo((object)$"Loaded {dictionary.Count} saved caps from file.");
}
catch (Exception ex)
{
Plugin.Log.LogWarning((object)("Failed to load caps: " + ex.Message));
}
return dictionary;
}
private static string GetLocalSteamID()
{
if (SemiFunc.PlayerGetAll() == null)
{
return null;
}
foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
{
if (!((Object)(object)item == (Object)null) && (Object)(object)item.photonView != (Object)null && item.photonView.IsMine)
{
return SemiFunc.PlayerGetSteamID(item);
}
}
PlayerAvatar val = SemiFunc.PlayerGetAll().FirstOrDefault();
if (!((Object)(object)val != (Object)null))
{
return null;
}
return SemiFunc.PlayerGetSteamID(val);
}
}
}
namespace AdjustableUpgrades.Configuration
{
internal static class ModConfig
{
public static ConfigEntry<KeyCode> ToggleUIKey;
public static ConfigEntry<bool> EnableRandomizeButton;
public static void Init(ConfigFile config)
{
ToggleUIKey = config.Bind<KeyCode>("UI Settings", "ToggleUIKey", (KeyCode)283, "Key to toggle the upgrade adjustment UI");
EnableRandomizeButton = config.Bind<bool>("UI Settings", "EnableRandomizeButton", true, "Show the 'Randomize All' button in the UI");
}
}
}