Decompiled source of MarketPulse v1.0.0

BepInEx/plugins/MarketPulse.dll

Decompiled 6 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using MarketPulse.Configuration;
using MarketPulse.Localization;
using UnityEngine;
using UnityEngine.Localization.Settings;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MarketPulse")]
[assembly: AssemblyDescription("Market Pulse mod for Island Market Simulator by Ice Box Studio")]
[assembly: AssemblyCompany("Ice Box Studio")]
[assembly: AssemblyProduct("MarketPulse")]
[assembly: AssemblyCopyright("Copyright © 2026 Ice Box Studio All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("B090E94D-BC00-4877-9106-4C141BBEE58E")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MarketPulse
{
	[BepInPlugin("IceBoxStudio.IslandMarketSimulator.MarketPulse", "MarketPulse", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class MarketPulse : BasePlugin
	{
		public static MarketPulse _Instance;

		private const string ModConfigManagerApiTypeName = "ModConfigManager.Api.ModConfigManagerAPI";

		private const string ModConfigManagerRegisterMethodName = "RegisterPluginInfo";

		private Harmony _harmony;

		private bool patchesApplied;

		public static MarketPulse Instance => _Instance;

		internal static ManualLogSource Logger { get; private set; }

		public override void Load()
		{
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			_Instance = this;
			Logger = ((BasePlugin)this).Log;
			bool flag = default(bool);
			try
			{
				Logger.LogInfo((object)"=============================================");
				ManualLogSource logger = Logger;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(1, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("MarketPulse");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(LocalizationManager.Instance.GetLocalizedText("plugin.initializing"));
				}
				logger.LogInfo(val);
				ManualLogSource logger2 = Logger;
				val = new BepInExInfoLogInterpolatedStringHandler(54, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(LocalizationManager.Instance.GetLocalizedText("plugin.author_prefix"));
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Ice Box Studio(https://steamcommunity.com/id/ibox666/)");
				}
				logger2.LogInfo(val);
				ConfigManager.Initialize(((BasePlugin)this).Config);
				RegisterToModConfigManager();
				ApplyPatches();
				ManualLogSource logger3 = Logger;
				val = new BepInExInfoLogInterpolatedStringHandler(1, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("MarketPulse");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(LocalizationManager.Instance.GetLocalizedText("plugin.initialized"));
				}
				logger3.LogInfo(val);
				Logger.LogInfo((object)"=============================================");
			}
			catch (Exception ex)
			{
				ManualLogSource logger4 = Logger;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(9, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("MarketPulse");
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" 初始化错误: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("\n");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.StackTrace);
				}
				logger4.LogError(val2);
			}
		}

		private void ApplyPatches()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (!patchesApplied)
			{
				try
				{
					_harmony = new Harmony("IceBoxStudio.IslandMarketSimulator.MarketPulse");
					_harmony.PatchAll();
					patchesApplied = true;
					return;
				}
				catch (Exception ex)
				{
					ManualLogSource logger = Logger;
					bool flag = default(bool);
					BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(10, 3, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("MarketPulse");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" 应用补丁错误: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\n");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.StackTrace);
					}
					logger.LogError(val);
					return;
				}
			}
			Logger.LogInfo((object)LocalizationManager.Instance.GetLocalizedText("plugin.patches_skipped"));
		}

		private void RegisterToModConfigManager()
		{
			Type type = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly assembly) => assembly.GetType("ModConfigManager.Api.ModConfigManagerAPI") != null)?.GetType("ModConfigManager.Api.ModConfigManagerAPI");
			if (!(type == null))
			{
				MethodInfo method = type.GetMethod("RegisterPluginInfo", BindingFlags.Static | BindingFlags.Public);
				if (!(method == null))
				{
					method.Invoke(null, new object[5]
					{
						"IceBoxStudio.IslandMarketSimulator.MarketPulse",
						LocalizationManager.Instance.GetLocalizedText("plugin.name"),
						"1.0.0",
						"Ice Box Studio",
						LocalizationManager.Instance.GetLocalizedText("plugin.description")
					});
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "IceBoxStudio.IslandMarketSimulator.MarketPulse";

		public const string PLUGIN_NAME = "MarketPulse";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace MarketPulse.Patches
{
	[HarmonyPatch(typeof(NpcManager))]
	internal static class TrafficPatches
	{
		private static readonly string LogPrefix = "[MarketPulse]";

		private static readonly Dictionary<int, int> BaseConcurrentCapByInstance = new Dictionary<int, int>();

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void AwakePostfix(NpcManager __instance)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			if ((Object)(object)__instance == (Object)null)
			{
				ManualLogSource logger = MarketPulse.Logger;
				if (logger != null)
				{
					bool flag = default(bool);
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(25, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(LogPrefix);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" NpcManager 初始化缓存失败:实例为空。");
					}
					logger.LogWarning(val);
				}
			}
			else
			{
				int instanceID = ((Object)__instance).GetInstanceID();
				int maxCustomerNpcCount = __instance.maxCustomerNpcCount;
				BaseConcurrentCapByInstance[instanceID] = maxCustomerNpcCount;
			}
		}

		[HarmonyPatch("SetCustomerTime", new Type[]
		{
			typeof(int),
			typeof(int)
		})]
		[HarmonyPostfix]
		private static void SetCustomerTimePostfix(NpcManager __instance)
		{
			if (IsTrafficTuningEnabled() && !((Object)(object)__instance == (Object)null))
			{
				int minNextCustomerWaitTime = __instance.minNextCustomerWaitTime;
				int maxNextCustomerWaitTime = __instance.maxNextCustomerWaitTime;
				TrafficPresetMode presetMode = TrafficPresetSettings.ParsePreset(ConfigManager.Instance.TrafficPreset?.Value);
				float num = Mathf.Max(0.1f, TrafficPresetSettings.GetArrivalSpeedMultiplier(presetMode, ConfigManager.Instance.CustomerArrivalSpeedMultiplier.Value));
				float num2 = 1f / num;
				int num3 = Mathf.Max(1, Mathf.RoundToInt((float)minNextCustomerWaitTime * num2));
				int maxNextCustomerWaitTime2 = Mathf.Max(num3, Mathf.RoundToInt((float)maxNextCustomerWaitTime * num2));
				__instance.minNextCustomerWaitTime = num3;
				__instance.maxNextCustomerWaitTime = maxNextCustomerWaitTime2;
			}
		}

		[HarmonyPatch("SendCustomer")]
		[HarmonyPrefix]
		private static void SendCustomerPrefix(NpcManager __instance)
		{
			if (IsTrafficTuningEnabled() && !((Object)(object)__instance == (Object)null))
			{
				int instanceID = ((Object)__instance).GetInstanceID();
				int maxCustomerNpcCount = __instance.maxCustomerNpcCount;
				if (!BaseConcurrentCapByInstance.ContainsKey(instanceID))
				{
					BaseConcurrentCapByInstance[instanceID] = maxCustomerNpcCount;
				}
				int num = BaseConcurrentCapByInstance[instanceID];
				float inStoreCustomerLimitMultiplier = TrafficPresetSettings.GetInStoreCustomerLimitMultiplier(TrafficPresetSettings.ParsePreset(ConfigManager.Instance.TrafficPreset?.Value), ConfigManager.Instance.InStoreCustomerLimitMultiplier.Value);
				int num2 = Mathf.Max(1, Mathf.RoundToInt((float)num * inStoreCustomerLimitMultiplier));
				if (num2 != maxCustomerNpcCount)
				{
					__instance.maxCustomerNpcCount = num2;
				}
			}
		}

		private static bool IsTrafficTuningEnabled()
		{
			if (ConfigManager.Instance != null && ConfigManager.Instance.EnableTrafficTuning != null)
			{
				return ConfigManager.Instance.EnableTrafficTuning.Value;
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(PlayerData), "ServerChangeReputation")]
	internal static class ReputationPatches
	{
		private static readonly string LogPrefix = "[MarketPulse]";

		[HarmonyPrefix]
		private static void ServerChangeReputationPrefix(ref float amount)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			if (ConfigManager.Instance == null || ConfigManager.Instance.EnableReputationInfluence == null)
			{
				ManualLogSource logger = MarketPulse.Logger;
				if (logger != null)
				{
					bool flag = default(bool);
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(17, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(LogPrefix);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" 声望联动检查失败:配置未初始化。");
					}
					logger.LogWarning(val);
				}
			}
			else if (ConfigManager.Instance.EnableReputationInfluence.Value && amount > 0f)
			{
				float reputationGainMultiplier = TrafficPresetSettings.GetReputationGainMultiplier(TrafficPresetSettings.ParsePreset(ConfigManager.Instance.TrafficPreset?.Value), ConfigManager.Instance.ReputationGainMultiplier.Value);
				amount *= reputationGainMultiplier;
			}
		}
	}
}
namespace MarketPulse.Localization
{
	public static class LocalizationHelper
	{
		public static Dictionary<string, string> GetDefaultTranslations(string language)
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			switch (language)
			{
			case "zh":
				dictionary.Add("plugin.initializing", "开始初始化...");
				dictionary.Add("plugin.author_prefix", "作者:");
				dictionary.Add("plugin.initialized", "初始化成功!");
				dictionary.Add("plugin.patches_skipped", "补丁已应用,跳过...");
				dictionary.Add("plugin.name", "市场脉动");
				dictionary.Add("plugin.description", "调整店铺客流节奏与正向声望成长速度。");
				dictionary.Add("config.enable_traffic_tuning", "启用客流调整");
				dictionary.Add("config.traffic_preset", "客流预设(VanillaPlus / BusyMarket / FestivalRush / Custom)\nVanillaPlus = 到店 x1.30, 店内 x1.35, 声望 x1.25\nBusyMarket = 到店 x1.65, 店内 x1.80, 声望 x1.45\nFestivalRush = 到店 x2.20, 店内 x2.50, 声望 x1.80\nCustom = 使用配置文件中的自定义倍率");
				dictionary.Add("config.customer_arrival_speed_multiplier", "客人到店速度倍率");
				dictionary.Add("config.in_store_customer_limit_multiplier", "店内客人数量倍率");
				dictionary.Add("config.enable_reputation_influence", "启用声望联动");
				dictionary.Add("config.reputation_gain_multiplier", "声望获取速度倍率");
				break;
			case "zh-TW":
				dictionary.Add("plugin.initializing", "開始初始化...");
				dictionary.Add("plugin.author_prefix", "作者:");
				dictionary.Add("plugin.initialized", "初始化成功!");
				dictionary.Add("plugin.patches_skipped", "補丁已套用,跳過...");
				dictionary.Add("plugin.name", "市場脉動");
				dictionary.Add("plugin.description", "調整店鋪客流節奏與正向聲望成長速度。");
				dictionary.Add("config.enable_traffic_tuning", "啟用客流調整");
				dictionary.Add("config.traffic_preset", "客流預設(VanillaPlus / BusyMarket / FestivalRush / Custom)\nVanillaPlus = 到店 x1.30, 店內 x1.35, 聲望 x1.25\nBusyMarket = 到店 x1.65, 店內 x1.80, 聲望 x1.45\nFestivalRush = 到店 x2.20, 店內 x2.50, 聲望 x1.80\nCustom = 使用設定檔中的自訂倍率");
				dictionary.Add("config.customer_arrival_speed_multiplier", "客人到店速度倍率");
				dictionary.Add("config.in_store_customer_limit_multiplier", "店內客人數量倍率");
				dictionary.Add("config.enable_reputation_influence", "啟用聲望聯動");
				dictionary.Add("config.reputation_gain_multiplier", "聲望獲取速度倍率");
				break;
			case "en":
				dictionary.Add("plugin.initializing", "Initializing...");
				dictionary.Add("plugin.author_prefix", "Author: ");
				dictionary.Add("plugin.initialized", "Initialized successfully!");
				dictionary.Add("plugin.patches_skipped", "Patches already applied, skipping...");
				dictionary.Add("plugin.name", "Market Pulse");
				dictionary.Add("plugin.description", "Adjusts store traffic pacing and positive reputation growth.");
				dictionary.Add("config.enable_traffic_tuning", "Enable customer flow tuning");
				dictionary.Add("config.traffic_preset", "Traffic preset (VanillaPlus / BusyMarket / FestivalRush / Custom)\nVanillaPlus = arrival x1.30, in-store x1.35, reputation x1.25\nBusyMarket = arrival x1.65, in-store x1.80, reputation x1.45\nFestivalRush = arrival x2.20, in-store x2.50, reputation x1.80\nCustom = Use the custom multiplier in the configuration file");
				dictionary.Add("config.customer_arrival_speed_multiplier", "Customer arrival speed multiplier");
				dictionary.Add("config.in_store_customer_limit_multiplier", "In-store customer count multiplier");
				dictionary.Add("config.enable_reputation_influence", "Enable reputation link");
				dictionary.Add("config.reputation_gain_multiplier", "Reputation gain speed multiplier");
				break;
			case "ja":
				dictionary.Add("plugin.initializing", "初期化中...");
				dictionary.Add("plugin.author_prefix", "作者: ");
				dictionary.Add("plugin.initialized", "初期化に成功しました!");
				dictionary.Add("plugin.patches_skipped", "パッチは適用済みです。スキップします...");
				dictionary.Add("plugin.name", "市場脉動");
				dictionary.Add("plugin.description", "店舗の客足ペースと正の評判成長速度を調整します。");
				dictionary.Add("config.enable_traffic_tuning", "客足調整を有効化");
				dictionary.Add("config.traffic_preset", "客足プリセット(VanillaPlus / BusyMarket / FestivalRush / Custom)\nVanillaPlus = 来店 x1.30, 店内 x1.35, 評判 x1.25\nBusyMarket = 来店 x1.65, 店内 x1.80, 評判 x1.45\nFestivalRush = 来店 x2.20, 店内 x2.50, 評判 x1.80\nCustom = 設定ファイルのカスタム倍率を使用");
				dictionary.Add("config.customer_arrival_speed_multiplier", "来店速度倍率");
				dictionary.Add("config.in_store_customer_limit_multiplier", "店内客数倍率");
				dictionary.Add("config.enable_reputation_influence", "評判連動を有効化");
				dictionary.Add("config.reputation_gain_multiplier", "評判獲得速度倍率");
				break;
			}
			return dictionary;
		}
	}
	public class LocalizationManager
	{
		private static LocalizationManager _instance;

		private readonly Dictionary<string, Dictionary<string, string>> _localizations = new Dictionary<string, Dictionary<string, string>>();

		private string _currentLocale = "zh";

		public static readonly string[] SupportedLanguages = new string[16]
		{
			"en", "tr", "fr", "es", "zh", "zh-TW", "de", "el", "pt-BR", "it",
			"ja", "pl", "pt-PT", "ru", "ko", "th"
		};

		public static LocalizationManager Instance => _instance ?? (_instance = new LocalizationManager());

		private LocalizationManager()
		{
			Initialize();
		}

		public void Initialize()
		{
			RefreshCurrentLocale();
			string[] supportedLanguages = SupportedLanguages;
			foreach (string text in supportedLanguages)
			{
				Dictionary<string, string> defaultTranslations = LocalizationHelper.GetDefaultTranslations(text);
				if (defaultTranslations != null && defaultTranslations.Count > 0)
				{
					_localizations[text] = defaultTranslations;
				}
			}
		}

		private void RefreshCurrentLocale()
		{
			if (PlayerPrefs.HasKey("Lang"))
			{
				int num = PlayerPrefs.GetInt("Lang");
				ILocalesProvider availableLocales = LocalizationSettings.AvailableLocales;
				if (availableLocales != null && availableLocales.Locales != null && num >= 0 && num < availableLocales.Locales.Count)
				{
					string code = availableLocales.Locales[num].Identifier.Code;
					_currentLocale = (_localizations.ContainsKey(code) ? code : "en");
				}
			}
		}

		public string GetLocalizedText(string key, params object[] args)
		{
			RefreshCurrentLocale();
			if (string.IsNullOrEmpty(_currentLocale) || !_localizations.ContainsKey(_currentLocale))
			{
				_currentLocale = "en";
			}
			if (_localizations.ContainsKey(_currentLocale) && _localizations[_currentLocale].TryGetValue(key, out var value))
			{
				if (args.Length == 0)
				{
					return value;
				}
				return string.Format(value, args);
			}
			if (_currentLocale != "en" && _localizations.ContainsKey("en") && _localizations["en"].TryGetValue(key, out var value2))
			{
				if (args.Length == 0)
				{
					return value2;
				}
				return string.Format(value2, args);
			}
			if (_localizations.ContainsKey("zh") && _localizations["zh"].TryGetValue(key, out var value3))
			{
				if (args.Length == 0)
				{
					return value3;
				}
				return string.Format(value3, args);
			}
			return key;
		}
	}
}
namespace MarketPulse.Configuration
{
	public class ConfigManager
	{
		private static ConfigManager _instance;

		private readonly ConfigFile _configFile;

		private readonly Dictionary<string, ConfigEntry<bool>> _boolConfigs = new Dictionary<string, ConfigEntry<bool>>();

		private readonly Dictionary<string, ConfigEntry<string>> _stringConfigs = new Dictionary<string, ConfigEntry<string>>();

		private readonly Dictionary<string, ConfigEntry<int>> _intConfigs = new Dictionary<string, ConfigEntry<int>>();

		private readonly Dictionary<string, ConfigEntry<float>> _floatConfigs = new Dictionary<string, ConfigEntry<float>>();

		private readonly Dictionary<string, ConfigEntry<KeyCode>> _keyCodeConfigs = new Dictionary<string, ConfigEntry<KeyCode>>();

		public static ConfigManager Instance => _instance;

		public ConfigEntry<bool> EnableTrafficTuning { get; private set; }

		public ConfigEntry<string> TrafficPreset { get; private set; }

		public ConfigEntry<float> CustomerArrivalSpeedMultiplier { get; private set; }

		public ConfigEntry<float> InStoreCustomerLimitMultiplier { get; private set; }

		public ConfigEntry<bool> EnableReputationInfluence { get; private set; }

		public ConfigEntry<float> ReputationGainMultiplier { get; private set; }

		private ConfigManager(ConfigFile configFile)
		{
			_configFile = configFile;
			InitializeDefaultConfigs();
		}

		public static void Initialize(ConfigFile configFile)
		{
			if (_instance == null)
			{
				_instance = new ConfigManager(configFile);
			}
		}

		private void InitializeDefaultConfigs()
		{
			TrafficPreset = RegisterString("- 预设 - Preset", "TrafficPreset", GetLocalizedDescription("config.traffic_preset"), "VanillaPlus");
			EnableTrafficTuning = RegisterBool("客流相关 - Traffic Related", "EnableTrafficTuning", GetLocalizedDescription("config.enable_traffic_tuning"), defaultValue: true);
			CustomerArrivalSpeedMultiplier = RegisterFloatMax("客流相关 - Traffic Related", "CustomerArrivalSpeedMultiplier", GetLocalizedDescription("config.customer_arrival_speed_multiplier"), 1f, 0.5f, 3f);
			InStoreCustomerLimitMultiplier = RegisterFloatMax("客流相关 - Traffic Related", "InStoreCustomerLimitMultiplier", GetLocalizedDescription("config.in_store_customer_limit_multiplier"), 1f, 0.5f, 5f);
			EnableReputationInfluence = RegisterBool("声望相关 - Reputation Related", "EnableReputationInfluence", GetLocalizedDescription("config.enable_reputation_influence"), defaultValue: false);
			ReputationGainMultiplier = RegisterFloatMax("声望相关 - Reputation Related", "ReputationGainMultiplier", GetLocalizedDescription("config.reputation_gain_multiplier"), 1f, 0.1f, 5f);
		}

		private string GetLocalizedDescription(string key)
		{
			return LocalizationManager.Instance?.GetLocalizedText(key) ?? key;
		}

		public ConfigEntry<bool> RegisterBool(string section, string key, string description, bool defaultValue)
		{
			ConfigEntry<bool> val = _configFile.Bind<bool>(section, key, defaultValue, description);
			_boolConfigs[key] = val;
			return val;
		}

		public ConfigEntry<string> RegisterString(string section, string key, string description, string defaultValue)
		{
			ConfigEntry<string> val = _configFile.Bind<string>(section, key, defaultValue, description);
			_stringConfigs[key] = val;
			return val;
		}

		public ConfigEntry<KeyCode> RegisterKeyCode(string section, string key, string description, KeyCode defaultValue)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			ConfigEntry<KeyCode> val = _configFile.Bind<KeyCode>(section, key, defaultValue, description);
			_keyCodeConfigs[key] = val;
			return val;
		}

		public ConfigEntry<int> RegisterInt(string section, string key, string description, int defaultValue)
		{
			ConfigEntry<int> val = _configFile.Bind<int>(section, key, defaultValue, description);
			_intConfigs[key] = val;
			return val;
		}

		public ConfigEntry<int> RegisterIntMax(string section, string key, string description, int defaultValue, int minValue, int maxValue)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			ConfigEntry<int> val = _configFile.Bind<int>(section, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<int>(minValue, maxValue), Array.Empty<object>()));
			_intConfigs[key] = val;
			return val;
		}

		public ConfigEntry<float> RegisterFloat(string section, string key, string description, float defaultValue)
		{
			ConfigEntry<float> val = _configFile.Bind<float>(section, key, defaultValue, description);
			_floatConfigs[key] = val;
			return val;
		}

		public ConfigEntry<float> RegisterFloatMax(string section, string key, string description, float defaultValue, float minValue, float maxValue)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			ConfigEntry<float> val = _configFile.Bind<float>(section, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(minValue, maxValue), Array.Empty<object>()));
			_floatConfigs[key] = val;
			return val;
		}
	}
	public enum TrafficPresetMode
	{
		VanillaPlus,
		BusyMarket,
		FestivalRush,
		Custom
	}
	public static class TrafficPresetSettings
	{
		public static TrafficPresetMode ParsePreset(string presetText)
		{
			if (string.IsNullOrWhiteSpace(presetText))
			{
				return TrafficPresetMode.VanillaPlus;
			}
			switch (presetText.Trim().ToLowerInvariant())
			{
			case "vanilla+":
			case "vanillaplus":
				return TrafficPresetMode.VanillaPlus;
			case "busymarket":
			case "busy market":
				return TrafficPresetMode.BusyMarket;
			case "festivalrush":
			case "festival rush":
				return TrafficPresetMode.FestivalRush;
			case "custom":
				return TrafficPresetMode.Custom;
			default:
				return TrafficPresetMode.VanillaPlus;
			}
		}

		public static float GetArrivalSpeedMultiplier(TrafficPresetMode presetMode, float customValue)
		{
			return presetMode switch
			{
				TrafficPresetMode.Custom => customValue, 
				TrafficPresetMode.BusyMarket => 1.65f, 
				TrafficPresetMode.FestivalRush => 2.2f, 
				_ => 1.3f, 
			};
		}

		public static float GetInStoreCustomerLimitMultiplier(TrafficPresetMode presetMode, float customValue)
		{
			return presetMode switch
			{
				TrafficPresetMode.Custom => customValue, 
				TrafficPresetMode.BusyMarket => 1.8f, 
				TrafficPresetMode.FestivalRush => 2.5f, 
				_ => 1.35f, 
			};
		}

		public static float GetReputationGainMultiplier(TrafficPresetMode presetMode, float customValue)
		{
			return presetMode switch
			{
				TrafficPresetMode.Custom => customValue, 
				TrafficPresetMode.BusyMarket => 1.45f, 
				TrafficPresetMode.FestivalRush => 1.8f, 
				_ => 1.25f, 
			};
		}
	}
}