Decompiled source of CustomDifficulty v3.0.0

BepInEx\plugins\CustomDifficulty\CustomDifficulty.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using GlobalEnums;
using GlobalSettings;
using HarmonyLib;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using Newtonsoft.Json;
using TeamCherry.Localization;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace CodexMods.CustomDifficulty;

internal sealed class BossRulesController
{
	private static readonly string[] NonCombatStateTerms = new string[15]
	{
		"Death", "Dead", "Defeat", "Killed", "Destroy", "Intro", "Outro", "Title", "Scene", "Transition",
		"Dormant", "Asleep", "Wake", "Stun", "Stagger"
	};

	private readonly SettingsStore _settingsStore;

	public static BossRulesController Instance;

	public BossRulesController(SettingsStore settingsStore)
	{
		_settingsStore = settingsStore;
		Instance = this;
	}

	public bool TryGetScaledWait(Wait waitAction, out float originalWait, out float scaledWait)
	{
		originalWait = 0f;
		scaledWait = 0f;
		if (waitAction == null || waitAction.time == null)
		{
			return false;
		}
		if (!TryGetCombatSource(waitAction, out var isBoss, out var _))
		{
			return false;
		}
		ModSettingKind setting = (isBoss ? ModSettingKind.BossAttackSpeedMultiplier : ModSettingKind.EnemyAttackSpeedMultiplier);
		if (!_settingsStore.IsEnabled(setting) && !isBoss)
		{
			return false;
		}
		float value = ((isBoss && _settingsStore.IsEnabled(setting)) ? _settingsStore.Current.BossAttackSpeedMultiplier : ((!isBoss) ? _settingsStore.Current.EnemyAttackSpeedMultiplier : 1f));
		float num = (isBoss ? ValueValidator.NormalizeBossAttackSpeedMultiplier(value) : ValueValidator.NormalizeMultiplier(value));
		if (Math.Abs(num - 1f) < 0.001f)
		{
			return false;
		}
		originalWait = waitAction.time.Value;
		if (originalWait <= 0f || float.IsNaN(originalWait) || float.IsInfinity(originalWait))
		{
			return false;
		}
		scaledWait = Mathf.Max(0.001f, CalculateScaledAttackWait(originalWait, num));
		return true;
	}

	internal static float CalculateScaledAttackWait(float originalWait, float attackSpeed)
	{
		if (originalWait <= 0f || float.IsNaN(originalWait) || float.IsInfinity(originalWait))
		{
			return originalWait;
		}
		return originalWait / ValueValidator.NormalizeMultiplier(attackSpeed);
	}

	public void Shutdown()
	{
		if (object.ReferenceEquals(Instance, this))
		{
			Instance = null;
		}
	}

	private static bool TryGetCombatSource(Wait waitAction, out bool isBoss, out GameObject combatSource)
	{
		isBoss = false;
		combatSource = null;
		try
		{
			Fsm fsm = ((FsmStateAction)waitAction).Fsm;
			GameObject val = ((fsm != null) ? fsm.GameObject : ((FsmStateAction)waitAction).Owner);
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			HealthManager val2 = val.GetComponentInParent<HealthManager>();
			if ((Object)(object)val2 == (Object)null)
			{
				val2 = val.GetComponentInChildren<HealthManager>(true);
			}
			if ((Object)(object)val2 == (Object)null)
			{
				return false;
			}
			isBoss = EnemyStatsController.IsBossSource(((Component)val2).gameObject);
			combatSource = ((Component)val2).gameObject;
			string value = ((((FsmStateAction)waitAction).State != null) ? ((FsmStateAction)waitAction).State.Name : string.Empty);
			string value2 = ((fsm != null) ? fsm.Name : string.Empty);
			return !ContainsNonCombatTerm(value) && !ContainsNonCombatTerm(value2);
		}
		catch
		{
			return false;
		}
	}

	private static bool ContainsNonCombatTerm(string value)
	{
		if (string.IsNullOrEmpty(value))
		{
			return false;
		}
		for (int i = 0; i < NonCombatStateTerms.Length; i++)
		{
			if (value.IndexOf(NonCombatStateTerms[i], StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return true;
			}
		}
		return false;
	}
}
[HarmonyPatch(typeof(Wait), "OnUpdate")]
internal static class BossAttackWaitPatch
{
	private struct WaitScaleState
	{
		public bool Changed;

		public float OriginalWait;
	}

	private static void Prefix(Wait __instance, out WaitScaleState __state)
	{
		__state = default(WaitScaleState);
		BossRulesController instance = BossRulesController.Instance;
		if (instance != null && instance.TryGetScaledWait(__instance, out var originalWait, out var scaledWait))
		{
			__instance.time.Value = scaledWait;
			__state.Changed = true;
			__state.OriginalWait = originalWait;
		}
	}

	private static void Postfix(Wait __instance, WaitScaleState __state)
	{
		if (__state.Changed && __instance != null && __instance.time != null)
		{
			__instance.time.Value = __state.OriginalWait;
		}
	}
}
internal sealed class CurrencyRewardController
{
	[ThreadStatic]
	private static int _coinCollectionDepth;

	[ThreadStatic]
	private static int _shardCollectionDepth;

	private readonly SettingsStore _settingsStore;

	private double _poorWorldRemainder;

	public static CurrencyRewardController Instance;

	public CurrencyRewardController(SettingsStore settingsStore)
	{
		_settingsStore = settingsStore;
		_settingsStore.Changed += OnSettingChanged;
		Instance = this;
	}

	public void BeginCoinCollection()
	{
		_coinCollectionDepth++;
	}

	public void EndCoinCollection()
	{
		_coinCollectionDepth = Math.Max(0, _coinCollectionDepth - 1);
	}

	public void BeginShardCollection()
	{
		_shardCollectionDepth++;
	}

	public void EndShardCollection()
	{
		_shardCollectionDepth = Math.Max(0, _shardCollectionDepth - 1);
	}

	public void ScaleCoinAddition(ref int amount)
	{
		if (_coinCollectionDepth > 0 && amount > 0 && (MutatorController.Instance == null || !MutatorController.Instance.IsGrantingMaskFragmentReward))
		{
			float num = 1f;
			if (_settingsStore.IsEnabled(ModSettingKind.CoinMultiplier))
			{
				num *= ValueValidator.NormalizeMultiplier(_settingsStore.Current.CoinMultiplier);
			}
			bool flag = false;
			if (_settingsStore.IsMutatorEnabled(ModSettingKind.MutatorRichWorld))
			{
				num *= 30f;
			}
			else if (_settingsStore.IsMutatorEnabled(ModSettingKind.MutatorPoorWorld))
			{
				flag = true;
				num *= 0.5f;
			}
			if (flag)
			{
				amount = ScalePositiveAmountWithRemainder(amount, num, ref _poorWorldRemainder);
				return;
			}
			_poorWorldRemainder = 0.0;
			amount = ScalePositiveAmountRaw(amount, num);
		}
	}

	public void ScaleShardAddition(ref int amount)
	{
		if (_settingsStore.IsEnabled(ModSettingKind.ShardMultiplier) && _shardCollectionDepth > 0 && amount > 0)
		{
			float shardMultiplier = _settingsStore.Current.ShardMultiplier;
			amount = ScalePositiveAmount(amount, shardMultiplier);
		}
	}

	public void Shutdown()
	{
		_settingsStore.Changed -= OnSettingChanged;
		_coinCollectionDepth = 0;
		_shardCollectionDepth = 0;
		_poorWorldRemainder = 0.0;
		if (Instance == this)
		{
			Instance = null;
		}
	}

	internal static int ScalePositiveAmount(int originalAmount, float multiplier)
	{
		if (originalAmount <= 0)
		{
			return originalAmount;
		}
		int val = (int)Math.Round((float)originalAmount * ValueValidator.NormalizeMultiplier(multiplier), MidpointRounding.AwayFromZero);
		return Math.Max(1, val);
	}

	internal static int ScalePositiveAmountRaw(int originalAmount, float multiplier)
	{
		if (originalAmount <= 0)
		{
			return originalAmount;
		}
		double val = Math.Round((double)originalAmount * (double)multiplier, MidpointRounding.AwayFromZero);
		return (int)Math.Max(1.0, Math.Min(2147483647.0, val));
	}

	internal static int ScalePositiveAmountWithRemainder(int originalAmount, float multiplier, ref double remainder)
	{
		if (originalAmount <= 0)
		{
			return originalAmount;
		}
		if (double.IsNaN(remainder) || double.IsInfinity(remainder) || remainder < 0.0 || remainder >= 1.0)
		{
			remainder = 0.0;
		}
		double num = (double)originalAmount * Math.Max(0.0, multiplier) + remainder;
		if (num >= 2147483647.0)
		{
			remainder = 0.0;
			return int.MaxValue;
		}
		double num2 = Math.Floor(num + 1E-09);
		remainder = num - num2;
		return (int)Math.Max(0.0, num2);
	}

	private void OnSettingChanged(ModSettingKind setting)
	{
		if (setting == ModSettingKind.MutatorPoorWorld || setting == ModSettingKind.MutatorRichWorld)
		{
			_poorWorldRemainder = 0.0;
		}
	}
}
[HarmonyPatch(typeof(GeoControl), "Collected")]
internal static class CoinCollectionScopePatch
{
	private static void Prefix(out bool __state)
	{
		__state = CurrencyRewardController.Instance != null;
		if (__state)
		{
			CurrencyRewardController.Instance.BeginCoinCollection();
		}
	}

	private static void Postfix(bool __state)
	{
		if (__state && CurrencyRewardController.Instance != null)
		{
			CurrencyRewardController.Instance.EndCoinCollection();
		}
	}

	private static Exception Finalizer(Exception __exception, bool __state)
	{
		if (__exception != null && __state && CurrencyRewardController.Instance != null)
		{
			CurrencyRewardController.Instance.EndCoinCollection();
		}
		return __exception;
	}
}
[HarmonyPatch(typeof(CurrencyManager), "AddGeo", new Type[] { typeof(int) })]
internal static class CoinRewardAmountPatch
{
	private static void Prefix(ref int __0)
	{
		if (CurrencyRewardController.Instance != null)
		{
			CurrencyRewardController.Instance.ScaleCoinAddition(ref __0);
		}
	}
}
[HarmonyPatch(typeof(ShellShard), "Collected")]
internal static class ShardCollectionScopePatch
{
	private static void Prefix(out bool __state)
	{
		__state = CurrencyRewardController.Instance != null;
		if (__state)
		{
			CurrencyRewardController.Instance.BeginShardCollection();
		}
	}

	private static void Postfix(bool __state)
	{
		if (__state && CurrencyRewardController.Instance != null)
		{
			CurrencyRewardController.Instance.EndShardCollection();
		}
	}

	private static Exception Finalizer(Exception __exception, bool __state)
	{
		if (__exception != null && __state && CurrencyRewardController.Instance != null)
		{
			CurrencyRewardController.Instance.EndShardCollection();
		}
		return __exception;
	}
}
[HarmonyPatch(typeof(CurrencyManager), "AddShards", new Type[] { typeof(int) })]
internal static class ShardRewardAmountPatch
{
	private static void Prefix(ref int __0)
	{
		if (CurrencyRewardController.Instance != null)
		{
			CurrencyRewardController.Instance.ScaleShardAddition(ref __0);
		}
	}
}
internal sealed class CustomDifficultyMenu
{
	private sealed class DifficultySummarySnapshot
	{
		public int Score;

		public string Classification;

		public string ClassificationDescription;

		public string ProfileStyle;

		public string ProfileDescription;

		public string Mutators;

		public string MutatorsDescription;

		public Color AccentColor;
	}

	private sealed class DamageToolDefinition
	{
		public readonly string Title;

		public readonly string Description;

		public readonly string ImageName;

		public DamageToolDefinition(string title, string description, string imageName)
		{
			Title = title;
			Description = description;
			ImageName = imageName;
		}
	}

	private const string HealthControl = "CustomDifficultyHealth";

	private const string NeedleControl = "CustomDifficultyNeedle";

	private const string NeedleUpgradePercentageControl = "CustomDifficultyNeedleUpgradePercentage";

	private const string SilkSpearDamageControl = "CustomDifficultySilkSpearDamage";

	private const string SilkSpearSilkCostControl = "CustomDifficultySilkSpearSilkCost";

	private const string DamageTakenControl = "CustomDifficultyDamageTaken";

	private const string EnvironmentalDamageControl = "CustomDifficultyEnvironmentalDamage";

	private const string OneHitControl = "CustomDifficultyOneHit";

	private const string HealingControl = "CustomDifficultyHealing";

	private const string HealingCostControl = "CustomDifficultyHealingCost";

	private const string InvincibilityTimeControl = "CustomDifficultyInvincibilityTime";

	private const string EnemyHealthControl = "CustomDifficultyEnemyHealth";

	private const string EnemySpeedControl = "CustomDifficultyEnemySpeed";

	private const string EnemyAttackSpeedControl = "CustomDifficultyEnemyAttackSpeed";

	private const string EnemyAggressionControl = "CustomDifficultyEnemyAggression";

	private const string BossControlPrefix = "CustomDifficultyBoss";

	private const string CoinControl = "CustomDifficultyCoin";

	private const string ShardControl = "CustomDifficultyShard";

	private const string ShopPriceControl = "CustomDifficultyShopPrice";

	private const string StationPriceControl = "CustomDifficultyStationPrice";

	private const string DeathRosaryLossControl = "CustomDifficultyDeathRosaryLoss";

	private const string HornetSpeedControl = "CustomDifficultyHornetSpeed";

	private const string DashRechargeControl = "CustomDifficultyDashRecharge";

	private const float ActiveRowHeight = 146f;

	private const float ActiveRowSpacing = 158f;

	private const int ActiveOptionCount = 97;

	private const string NavigationSearchControl = "CustomDifficultyNavigationSearch";

	private static readonly ModSettingKind[] BossSettings = new ModSettingKind[7]
	{
		ModSettingKind.BossHealthMultiplier,
		ModSettingKind.BossDamageTakenMultiplier,
		ModSettingKind.BossSpeedMultiplier,
		ModSettingKind.BossAttackSpeedMultiplier,
		ModSettingKind.BossBrutalMode,
		ModSettingKind.DisableHealingDuringBoss,
		ModSettingKind.HealingDuringBossMultiplier
	};

	private static readonly DamageToolDefinition[] RedDamageTools = new DamageToolDefinition[22]
	{
		new DamageToolDefinition("ALFINETE RETO", "Projétil leve para ataques rápidos à distância.", "T_straight_pin.png"),
		new DamageToolDefinition("ALFINETE TRIPLO", "Arremessa três alfinetes em conjunto.", "T_tri_pin.png"),
		new DamageToolDefinition("FRAGMENTO DE FERRÃO", "Armadilha de lâminas que perfura inimigos ao contato.", "T_sting_shard.png"),
		new DamageToolDefinition("GARRA CURVA", "Osso curvo arremessável, eficiente contra alvos voadores.", "T_curve_claw.png"),
		new DamageToolDefinition("PINO LONGO", "Pino pesado criado para atravessar carapaças resistentes.", "T_claw_javelin.png"),
		new DamageToolDefinition("TACHINHAS", "Espalha pontas no chão que ferem inimigos que pisarem nelas.", "T_tack.png"),
		new DamageToolDefinition("FOICE CURVA", "Versão aprimorada da Garra Curva para enfrentar presas perigosas.", "T_curve_claw_upgraded.png"),
		new DamageToolDefinition("ANEL DE ARREMESSO", "Arma de Shakra que ricocheteia em inimigos e superfícies.", "T_shakra_ring.png"),
		new DamageToolDefinition("PIMPILLO", "Bolsa volátil que explode ao atingir o alvo.", "T_pimpilo.png"),
		new DamageToolDefinition("DISPARO DE SEDA — ARQUITETO", "Versão do Disparo de Seda modificada pelo Décimo Segundo Arquiteto.", "_0003_T_web_shot_architect.png"),
		new DamageToolDefinition("DISPARO DE SEDA — FILHA DA FORJA", "Versão do Disparo de Seda modificada pela Filha da Forja.", "_0002_T_web_shot_forge.png"),
		new DamageToolDefinition("CORTADOR DE CONCHAS", "Projétil espiral que ricocheteia e surpreende os inimigos.", "T_Conch_Drill_Shot.png"),
		new DamageToolDefinition("DISPARO DE SEDA — ORIGINAL", "Arma antiga dos Tecelões restaurada à sua forma original.", "_0001_T_web_shot_forge_runes.png"),
		new DamageToolDefinition("BROCA DO DELVER", "Broca giratória que conduz a Hornet para baixo com força destrutiva.", "T_Spine_head.png"),
		new DamageToolDefinition("RODA DENTADA", "Lâmina circular mecânica que avança cortando os inimigos.", "T_cogwork_saw.png"),
		new DamageToolDefinition("ARMADOR DE ARMADILHAS", "Cria uma runa de Seda que se incendeia ao contato.", "_0004_T_snare_setter.png"),
		new DamageToolDefinition("ARDÓSIA DE SÍLEX", "Aquece temporariamente a agulha e adiciona fogo aos golpes.", "Hornet_icon_0003_T_flintstone.png"),
		new DamageToolDefinition("COGFLY", "Companheiro mecânico alado que procura e ataca inimigos.", "T_cogwork_flier.png"),
		new DamageToolDefinition("CERVEJA DE PULGA", "Bebida energizante que aumenta temporariamente a velocidade.", "T_flea_brew.png"),
		new DamageToolDefinition("FRASCO DE PLASMÍDIO", "Concede máscaras temporárias de plasmídio.", "T_syringe_lifeblood.png"),
		new DamageToolDefinition("RECIPIENTES VOLTAICOS", "Dispositivo carregado que libera uma descarga elétrica.", "_0004_T_lightning__0001_1.png"),
		new DamageToolDefinition("CANHÃO DE ROSÁRIO", "Canhão poderoso carregado com Rosários.", "_0004_T_rosary_cannon_loaded.png")
	};

	private static readonly DamageToolDefinition[] BlueDamageTools = new DamageToolDefinition[23]
	{
		new DamageToolDefinition("OLHO DE DRUIDA", "Transforma parte do dano recebido em Seda.", "T_mossmedal.png"),
		new DamageToolDefinition("OLHOS DE DRUIDA", "Versão aprimorada do Olho de Druida.", "T_mossmedal_second.png"),
		new DamageToolDefinition("SINO DE MAGMA", "Reduz o dano causado por fogo e magma.", "Hornet_T_lava_charm.png"),
		new DamageToolDefinition("SINO DE PROTEÇÃO", "Protege a Hornet enquanto ela realiza um vínculo.", "Hornet_icon_0001_T_bell_shield.png"),
		new DamageToolDefinition("BOLSA POLLIP", "Aplica veneno às ferramentas vermelhas equipadas.", "T_poison_pouch.png"),
		new DamageToolDefinition("MÁSCARA FRATURADA", "Bloqueia um dano crítico antes de se quebrar.", "Hornet_T_fractured_mask.png"),
		new DamageToolDefinition("MULTILIGADOR", "Prolonga o vínculo e aumenta seu efeito de recuperação.", "T_multi_bind.png"),
		new DamageToolDefinition("LUZ DE TEIA", "Aumenta a velocidade de regeneração de Seda.", "T_icon_white_ring.png"),
		new DamageToolDefinition("CÍRCULO DENTE-DE-SERRA", "Faz lâminas girarem ao abrir a capa, ferindo inimigos próximos.", "T_brolly_spike.png"),
		new DamageToolDefinition("FAIXA INJETORA", "Aumenta a velocidade de execução do vínculo.", "T_quick_bind.png"),
		new DamageToolDefinition("EXTENSOR DE CARRETEL", "Permite armazenar Seda além da capacidade natural.", "T_spool_bar_extender.png"),
		new DamageToolDefinition("VÍNCULO DE RESERVA", "Armazena um vínculo adicional para situações de emergência.", "T_focus_spool.png"),
		new DamageToolDefinition("ESPELHO DE GARRA", "Emite um clarão que causa dano durante o vínculo.", "T_dazzle_bind.png"),
		new DamageToolDefinition("ESPELHOS DE GARRA", "Versão aprimorada que libera uma explosão mais intensa.", "T_dazzle_bind_upg.png"),
		new DamageToolDefinition("CRISTAL DE MEMÓRIA", "Cria um cristal ofensivo quando a Hornet recebe dano.", "T_revenge_crystal.png"),
		new DamageToolDefinition("PICARETA DE GATUNO", "Rouba Rosários e Fragmentos de Concha dos inimigos atingidos.", "Thief_Claw.png"),
		new DamageToolDefinition("FILAMENTO VOLTAICO", "Eletrifica as Habilidades de Seda.", "T_zap_imbuement.png"),
		new DamageToolDefinition("FUNDA RÁPIDA", "Duplica a quantidade de ferramentas arremessadas.", "T_quick_sling.png"),
		new DamageToolDefinition("GUIRLANDA DE PUREZA", "Protege contra a infestação de larvas do lodo.", "Wreath_of_Purity.png"),
		new DamageToolDefinition("GARRA LONGA", "Aumenta o alcance dos ataques da agulha.", "T_longneedle.png"),
		new DamageToolDefinition("LANTERNA DE LUMEFOGO", "Consome Seda para invocar lumefogos que atacam inimigos.", "T_wisp_lantern.png"),
		new DamageToolDefinition("OVO DE PULGALIA", "Reduz o custo das Habilidades de Seda enquanto a vida está cheia.", "Flea_Egg.png"),
		new DamageToolDefinition("EMBLEMA DE PINO", "Reduz o tempo necessário para carregar o Golpe de Agulha.", "Pin_Badge.png")
	};

	private static readonly DamageToolDefinition[] YellowDamageTools = new DamageToolDefinition[13]
	{
		new DamageToolDefinition("BÚSSOLA", "Marca a posição da Hornet no mapa.", "T_Compass.png"),
		new DamageToolDefinition("PINGENTE DE FRAGMENTO", "Aumenta a quantidade de Fragmentos de Concha coletados.", "Hornet_Bone_Necklace.png"),
		new DamageToolDefinition("BROCHE DE MAGNETITA", "Atrai Rosários soltos para a Hornet.", "T_rosary_magnet.png"),
		new DamageToolDefinition("CINTO PESADO", "Reduz o recuo ao atacar e ao receber dano.", "T_weighted_anklet.png"),
		new DamageToolDefinition("PULSEIRA FARPADA", "Aumenta o dano da agulha, mas também o dano recebido.", "T_barbed_wire.png"),
		new DamageToolDefinition("BOLSA DE INSETO MORTO", "Preserva parte dos Rosários depois da derrota.", "T_dead_purse.png"),
		new DamageToolDefinition("BOLSA DE CONCHA", "Aumenta a capacidade das ferramentas vermelhas.", "T_shell_satchel.png"),
		new DamageToolDefinition("DADOS DE MAGNETITA", "Concede uma chance de evitar completamente o dano recebido.", "_0006_I_magnetite_dice.png"),
		new DamageToolDefinition("BRAÇADEIRA DE RASTEJO", "Permite uma retirada rápida enquanto a Hornet se abaixa.", "T_steel_spine.png"),
		new DamageToolDefinition("EMPUNHADURA DE SUBIDA", "Permite permanecer parada enquanto se agarra a uma parede.", "T_longneedle_old1.png"),
		new DamageToolDefinition("CORDAS DE ARANHA", "Amplia e fortalece os efeitos da Agulharpa.", "T_attunement_charm.png"),
		new DamageToolDefinition("TORNOZELEIRAS DE SEDA", "Consome Seda para aumentar a velocidade de corrida.", "T_icon_sprintmaster.png"),
		new DamageToolDefinition("MARCA DO LADRÃO", "Aumenta os Rosários obtidos, mas perde alguns ao receber dano.", "Thief_Brooch.png")
	};

	private readonly SettingsStore _settingsStore;

	private readonly ModImages _images;

	private readonly PresetManager _presetManager;

	private readonly LocalizationManager _localization;

	private readonly object _inputBlocker = new object();

	private bool _isOpen;

	private bool _heroInputBlocked;

	private float _previousTimeScale = 1f;

	private bool _previousCursorVisible;

	private CursorLockMode _previousCursorLockMode;

	private string _healthText = string.Empty;

	private string _needleText = string.Empty;

	private string _needleUpgradePercentageText = string.Empty;

	private string _silkSpearDamageText = string.Empty;

	private string _silkSpearSilkCostText = string.Empty;

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

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

	private string _damageTakenText = string.Empty;

	private string _environmentalDamageText = string.Empty;

	private string _oneHitText = string.Empty;

	private string _healingText = string.Empty;

	private string _healingCostText = string.Empty;

	private string _invincibilityTimeText = string.Empty;

	private string _enemyHealthText = string.Empty;

	private string _enemySpeedText = string.Empty;

	private string _enemyAttackSpeedText = string.Empty;

	private string _enemyAggressionText = string.Empty;

	private string _coinText = string.Empty;

	private string _shardText = string.Empty;

	private string _shopPriceText = string.Empty;

	private string _stationPriceText = string.Empty;

	private string _deathRosaryLossText = string.Empty;

	private string _hornetSpeedText = string.Empty;

	private string _dashRechargeText = string.Empty;

	private string _presetNameText = "Meu Preset";

	private string _openSettingsSnapshot = string.Empty;

	private string _operationMessage = string.Empty;

	private string _navigationSearchText = string.Empty;

	private float _openAnimationProgress;

	private bool _focusNavigationSearch;

	private Color _currentSectionAccent = new Color(0.94f, 0.69f, 0.28f, 1f);

	private string _focusedControl = string.Empty;

	private int _selectedSectionIndex = 2;

	private Vector2 _sectionScroll = Vector2.zero;

	private Vector2 _optionScroll = Vector2.zero;

	private bool _cardGridActive;

	private int _cardGridColumns = 1;

	private int _cardGridColumn;

	private float _cardGridY;

	private float _cardGridWidth;

	private string _tooltipText = string.Empty;

	private bool _showRestoreConfirmation;

	private bool _hasHoveredSetting;

	private ModSettingKind _hoveredSetting;

	private readonly Dictionary<int, float> _hoverAnimations = new Dictionary<int, float>();

	private GUIStyle _titleStyle;

	private GUIStyle _sectionTitleStyle;

	private GUIStyle _sectionSubtitleStyle;

	private GUIStyle _sectionTabStyle;

	private GUIStyle _selectedSectionTabStyle;

	private GUIStyle _labelStyle;

	private GUIStyle _descriptionStyle;

	private GUIStyle _metaTitleStyle;

	private GUIStyle _metaValueStyle;

	private GUIStyle _searchStyle;

	private GUIStyle _footerStyle;

	private GUIStyle _fieldStyle;

	private GUIStyle _buttonStyle;

	private GUIStyle _lockedLabelStyle;

	private GUIStyle _lockedValueStyle;

	private GUIStyle _lockedBadgeStyle;

	private GUIStyle _restoreButtonStyle;

	private GUIStyle _closeButtonStyle;

	private GUIStyle _completionLabelStyle;

	private GUIStyle _completionValueStyle;

	private GUIStyle _summaryValueStyle;

	private GUIStyle _summaryCaptionStyle;

	private GUIStyle _eyebrowStyle;

	private GUIStyle _sidebarHeaderStyle;

	private GUIStyle _chipStyle;

	private GUIStyle _shortcutStyle;

	private GUIStyle _navigationSearchStyle;

	private GUIStyle _switchLabelStyle;

	private GUIStyle _tooltipStyle;

	private GUIStyle _keycapStyle;

	private bool _thinScrollbarActive;

	private float _previousScrollbarWidth;

	private float _previousScrollbarThumbWidth;

	private float _previousScrollbarUpHeight;

	private float _previousScrollbarDownHeight;

	private Texture2D _previousScrollbarThumbNormal;

	private Texture2D _previousScrollbarThumbHover;

	private Texture2D _buttonNormalTexture;

	private Texture2D _buttonHoverTexture;

	private Texture2D _buttonActiveTexture;

	private Texture2D _fieldNormalTexture;

	private Texture2D _fieldFocusedTexture;

	public CustomDifficultyMenu(SettingsStore settingsStore, ModImages images, PresetManager presetManager, LocalizationManager localization)
	{
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: 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)
		_settingsStore = settingsStore;
		_images = images;
		_presetManager = presetManager;
		_localization = localization;
	}

	public void Update()
	{
		if (_isOpen)
		{
			_openAnimationProgress = Mathf.MoveTowards(_openAnimationProgress, 1f, Time.unscaledDeltaTime * 7.5f);
		}
		if (Input.GetKeyDown((KeyCode)289))
		{
			if (_isOpen)
			{
				Close();
			}
			else
			{
				Open();
			}
		}
		else if (_isOpen && Input.GetKeyDown((KeyCode)27))
		{
			if (_showRestoreConfirmation)
			{
				_showRestoreConfirmation = false;
			}
			else
			{
				Close();
			}
		}
		else if (_isOpen)
		{
			if ((Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305)) && Input.GetKeyDown((KeyCode)102))
			{
				_focusNavigationSearch = true;
			}
			else if (Input.GetKeyDown((KeyCode)102) && string.IsNullOrEmpty(_focusedControl) && _hasHoveredSetting && !_showRestoreConfirmation)
			{
				CommitField(_hoveredSetting);
				_settingsStore.ToggleFavorite(_hoveredSetting);
			}
			if (string.IsNullOrEmpty(_focusedControl) && (Input.GetKeyDown((KeyCode)101) || Input.GetKeyDown((KeyCode)281)))
			{
				CycleSelectedSection(1);
			}
			else if (string.IsNullOrEmpty(_focusedControl) && (Input.GetKeyDown((KeyCode)113) || Input.GetKeyDown((KeyCode)280)))
			{
				CycleSelectedSection(-1);
			}
		}
	}

	public void OnGUI()
	{
		//IL_0031: 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_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: 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_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0232: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_037d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0394: Unknown result type (might be due to invalid IL or missing references)
		//IL_031f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0340: Unknown result type (might be due to invalid IL or missing references)
		//IL_034b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0372: Unknown result type (might be due to invalid IL or missing references)
		//IL_0475: Unknown result type (might be due to invalid IL or missing references)
		//IL_0477: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0509: Unknown result type (might be due to invalid IL or missing references)
		//IL_051b: Unknown result type (might be due to invalid IL or missing references)
		//IL_053d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0543: Unknown result type (might be due to invalid IL or missing references)
		//IL_052b: Unknown result type (might be due to invalid IL or missing references)
		if (!_isOpen)
		{
			return;
		}
		HandleSubmitKey();
		EnsureStyles();
		GUI.depth = -1000;
		_tooltipText = string.Empty;
		_hasHoveredSetting = false;
		Matrix4x4 matrix = GUI.matrix;
		Color color = GUI.color;
		float num = Mathf.Clamp(Mathf.Min((float)Screen.width / 1280f, (float)Screen.height / 720f), 0.4f, 1.15f);
		GUI.matrix = Matrix4x4.Scale(new Vector3(num, num, 1f));
		float num2 = (float)Screen.width / num;
		float num3 = (float)Screen.height / num;
		Rect val = default(Rect);
		((Rect)(ref val))..ctor(0f, 0f, num2, num3);
		GUI.color = new Color(1f, 1f, 1f, Mathf.Clamp01(_openAnimationProgress));
		DrawMenuBackdrop(val);
		float num4 = Mathf.Min(1700f, Mathf.Max(760f, num2 - 40f));
		float num5 = Mathf.Min(1040f, Mathf.Max(620f, num3 - 34f));
		Rect rect = default(Rect);
		((Rect)(ref rect))..ctor((num2 - num4) * 0.5f, (num3 - num5) * 0.5f + (1f - _openAnimationProgress) * 18f, num4, num5);
		MenuSection section = LockedOptionCatalog.Sections[Mathf.Clamp(_selectedSectionIndex, 0, LockedOptionCatalog.Sections.Length - 1)];
		_currentSectionAccent = GetSectionAccent(section);
		DrawSoftShadow(rect);
		DrawSolidRect(rect, MenuVisualTheme.Panel);
		DrawOrnateFrame(rect);
		DrawSolidRect(new Rect(((Rect)(ref rect)).x + 20f, ((Rect)(ref rect)).y + 1f, ((Rect)(ref rect)).width - 40f, 1f), MenuVisualTheme.WithAlpha(_currentSectionAccent, 0.72f));
		GUI.Label(new Rect(((Rect)(ref rect)).x + 28f, ((Rect)(ref rect)).y + 8f, 410f, 18f), L("menu_eyebrow", "SILKSONG  /  PERFIL PERSONALIZADO"), _eyebrowStyle);
		GUI.Label(new Rect(((Rect)(ref rect)).x + 27f, ((Rect)(ref rect)).y + 23f, 360f, 42f), "CUSTOM DIFFICULTY", _titleStyle);
		DrawStatusChip(new Rect(((Rect)(ref rect)).x + 392f, ((Rect)(ref rect)).y + 30f, 70f, 26f), "v3.0.0", _currentSectionAccent);
		Rect val2 = default(Rect);
		((Rect)(ref val2))..ctor(((Rect)(ref rect)).xMax - 58f, ((Rect)(ref rect)).y + 18f, 38f, 38f);
		float num6 = ((Rect)(ref val2)).x - 12f;
		Rect rect2 = default(Rect);
		((Rect)(ref rect2))..ctor(num6 - 190f, ((Rect)(ref rect)).y + 17f, 180f, 40f);
		Rect rect3 = default(Rect);
		((Rect)(ref rect3))..ctor(((Rect)(ref rect2)).x - 150f, ((Rect)(ref rect2)).y, 140f, ((Rect)(ref rect2)).height);
		if (((Rect)(ref rect3)).x > ((Rect)(ref rect)).x + 485f)
		{
			DrawMetricChip(rect3, L("changes", "ALTERAÇÕES"), GetChangedSettingCount().ToString(), MenuVisualTheme.SignalCyan);
			DrawMetricChip(rect2, L("active_interface", "INTERFACE ATIVA"), GetActiveOptionsPercentage() + "%", _currentSectionAccent);
		}
		SetTooltip(val2, L("close_menu", "Fechar menu (F8 / Esc)"));
		if (GUI.Button(val2, "×", _closeButtonStyle))
		{
			Close();
			GUI.matrix = matrix;
			GUI.color = color;
			return;
		}
		float num7 = 78f;
		float num8 = 58f;
		Rect val3 = default(Rect);
		((Rect)(ref val3))..ctor(((Rect)(ref rect)).x + 14f, ((Rect)(ref rect)).y + num7, ((Rect)(ref rect)).width - 28f, ((Rect)(ref rect)).height - num7 - num8 - 4f);
		float num9 = Mathf.Clamp(((Rect)(ref val3)).width * 0.185f, 224f, 278f);
		Rect val4 = default(Rect);
		((Rect)(ref val4))..ctor(((Rect)(ref val3)).x, ((Rect)(ref val3)).y, num9, ((Rect)(ref val3)).height);
		Rect optionRect = default(Rect);
		((Rect)(ref optionRect))..ctor(((Rect)(ref val4)).xMax + 12f, ((Rect)(ref val3)).y, ((Rect)(ref val3)).width - num9 - 12f, ((Rect)(ref val3)).height);
		DrawSolidRect(val4, MenuVisualTheme.Sidebar);
		DrawSolidRect(new Rect(((Rect)(ref val4)).xMax - 1f, ((Rect)(ref val4)).y, 1f, ((Rect)(ref val4)).height), MenuVisualTheme.BorderSubtle);
		bool enabled = GUI.enabled;
		GUI.enabled = enabled && !_showRestoreConfirmation;
		DrawSectionTabs(val4);
		DrawSectionContent(optionRect);
		DrawFooter(new Rect(((Rect)(ref rect)).x + 14f, ((Rect)(ref rect)).yMax - num8, ((Rect)(ref rect)).width - 28f, num8 - 8f));
		GUI.enabled = enabled;
		DrawTooltip(val);
		if (_showRestoreConfirmation)
		{
			DrawRestoreConfirmation(val);
		}
		HandleTextFieldFocus();
		ConsumeInputEvent();
		GUI.matrix = matrix;
		GUI.color = color;
	}

	public void Shutdown()
	{
		if (_isOpen)
		{
			Close();
		}
		DestroyTexture(ref _buttonNormalTexture);
		DestroyTexture(ref _buttonHoverTexture);
		DestroyTexture(ref _buttonActiveTexture);
		DestroyTexture(ref _fieldNormalTexture);
		DestroyTexture(ref _fieldFocusedTexture);
	}

	private void Open()
	{
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		SyncTextFromSettings();
		_openSettingsSnapshot = _settingsStore.ExportJson();
		_operationMessage = string.Empty;
		_openAnimationProgress = 0f;
		_showRestoreConfirmation = false;
		_tooltipText = string.Empty;
		_focusNavigationSearch = false;
		_focusedControl = string.Empty;
		_previousTimeScale = Time.timeScale;
		Time.timeScale = 0f;
		_previousCursorVisible = Cursor.visible;
		_previousCursorLockMode = Cursor.lockState;
		Cursor.visible = true;
		Cursor.lockState = (CursorLockMode)0;
		SetHeroInputBlocked(blocked: true);
		_isOpen = true;
	}

	private void Close()
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		CommitAllFields();
		GUI.FocusControl(string.Empty);
		_focusedControl = string.Empty;
		_isOpen = false;
		SetHeroInputBlocked(blocked: false);
		Time.timeScale = _previousTimeScale;
		Cursor.visible = _previousCursorVisible;
		Cursor.lockState = _previousCursorLockMode;
	}

	private void DrawSectionTabs(Rect sectionRect)
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: 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_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		//IL_0224: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		//IL_052e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0530: Unknown result type (might be due to invalid IL or missing references)
		//IL_0554: Unknown result type (might be due to invalid IL or missing references)
		//IL_0559: Unknown result type (might be due to invalid IL or missing references)
		//IL_0563: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d3: 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_02fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0302: Unknown result type (might be due to invalid IL or missing references)
		//IL_030c: Unknown result type (might be due to invalid IL or missing references)
		//IL_029c: 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)
		//IL_0326: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_038d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0392: Unknown result type (might be due to invalid IL or missing references)
		//IL_0474: Unknown result type (might be due to invalid IL or missing references)
		//IL_045d: Unknown result type (might be due to invalid IL or missing references)
		GUI.Label(new Rect(((Rect)(ref sectionRect)).x + 14f, ((Rect)(ref sectionRect)).y + 8f, ((Rect)(ref sectionRect)).width - 28f, 18f), L("navigation", "NAVEGAÇÃO"), _sidebarHeaderStyle);
		Rect val = default(Rect);
		((Rect)(ref val))..ctor(((Rect)(ref sectionRect)).x + 10f, ((Rect)(ref sectionRect)).y + 30f, ((Rect)(ref sectionRect)).width - 20f, 36f);
		SetTooltip(val, L("search_tooltip", "Buscar categorias e seções (Ctrl+F)"));
		GUI.SetNextControlName("CustomDifficultyNavigationSearch");
		_navigationSearchText = GUI.TextField(val, _navigationSearchText ?? string.Empty, 36, _navigationSearchStyle);
		if (!string.IsNullOrEmpty(_navigationSearchText) && GUI.Button(new Rect(((Rect)(ref val)).xMax - 31f, ((Rect)(ref val)).y + 6f, 25f, 26f), "×", _closeButtonStyle))
		{
			_navigationSearchText = string.Empty;
			GUI.FocusControl("CustomDifficultyNavigationSearch");
		}
		if (string.IsNullOrEmpty(_navigationSearchText))
		{
			GUI.Label(new Rect(((Rect)(ref val)).x + 13f, ((Rect)(ref val)).y, ((Rect)(ref val)).width - 26f, ((Rect)(ref val)).height), "⌕  " + L("search_category", "Buscar categoria..."), _searchStyle);
		}
		if (_focusNavigationSearch)
		{
			GUI.FocusControl("CustomDifficultyNavigationSearch");
			_focusNavigationSearch = false;
		}
		float num = 44f;
		Rect position = default(Rect);
		((Rect)(ref position))..ctor(((Rect)(ref sectionRect)).x + 1f, ((Rect)(ref sectionRect)).y + 72f, ((Rect)(ref sectionRect)).width - 2f, ((Rect)(ref sectionRect)).height - num - 76f);
		float filteredNavigationHeight = GetFilteredNavigationHeight();
		Rect viewRect = default(Rect);
		((Rect)(ref viewRect))..ctor(0f, 0f, Mathf.Max(150f, ((Rect)(ref position)).width - 18f), Mathf.Max(((Rect)(ref position)).height, filteredNavigationHeight));
		_sectionScroll = BeginThinScrollView(position, _sectionScroll, viewRect, alwaysShowHorizontal: false, alwaysShowVertical: false);
		float num2 = 5f;
		string b = string.Empty;
		int num3 = 0;
		Rect val2 = default(Rect);
		Rect rect = default(Rect);
		for (int i = 0; i < LockedOptionCatalog.Sections.Length; i++)
		{
			MenuSection section = LockedOptionCatalog.Sections[i];
			if (!MatchesNavigationSearch(section))
			{
				continue;
			}
			string sectionGroup = GetSectionGroup(section);
			if (!string.Equals(sectionGroup, b, StringComparison.Ordinal))
			{
				if (num3 > 0)
				{
					num2 += 7f;
				}
				GUI.Label(new Rect(13f, num2, ((Rect)(ref viewRect)).width - 26f, 20f), sectionGroup, _sidebarHeaderStyle);
				num2 += 23f;
				b = sectionGroup;
			}
			bool flag = i == _selectedSectionIndex;
			((Rect)(ref val2))..ctor(7f, num2, ((Rect)(ref viewRect)).width - 14f, 48f);
			bool flag2 = ((Rect)(ref val2)).Contains(Event.current.mousePosition);
			Color sectionAccent = GetSectionAccent(section);
			if (flag || flag2)
			{
				DrawSolidRect(val2, flag ? new Color(sectionAccent.r * 0.18f, sectionAccent.g * 0.18f, sectionAccent.b * 0.18f, 0.72f) : new Color(0.07f, 0.085f, 0.087f, 0.84f));
			}
			if (flag)
			{
				DrawSolidRect(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).y + 6f, 3f, ((Rect)(ref val2)).height - 12f), sectionAccent);
			}
			((Rect)(ref rect))..ctor(((Rect)(ref val2)).x + 12f, ((Rect)(ref val2)).y + 12f, 24f, 24f);
			DrawSectionIcon(rect, section, sectionAccent);
			GUI.Label(new Rect(((Rect)(ref rect)).xMax + 10f, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width - 82f, ((Rect)(ref val2)).height), GetLocalizedSectionLabel(section).ToUpperInvariant(), flag ? _selectedSectionTabStyle : _sectionTabStyle);
			int num4 = GetActiveRowCount(section) + LockedOptionCatalog.GetOptions(section).Count;
			if (num4 > 0)
			{
				GUI.Label(new Rect(((Rect)(ref val2)).xMax - 36f, ((Rect)(ref val2)).y, 26f, ((Rect)(ref val2)).height), num4.ToString(), _shortcutStyle);
			}
			if (GUI.Button(val2, GUIContent.none, GUIStyle.none))
			{
				SelectSection(i);
			}
			num2 += 52f;
			num3++;
		}
		if (num3 == 0)
		{
			GUI.Label(new Rect(15f, 18f, ((Rect)(ref viewRect)).width - 30f, 52f), L("no_category", "Nenhuma categoria encontrada. Tente outro termo."), _descriptionStyle);
		}
		EndThinScrollView();
		Rect val3 = default(Rect);
		((Rect)(ref val3))..ctor(((Rect)(ref sectionRect)).x + 9f, ((Rect)(ref sectionRect)).yMax - num + 5f, ((Rect)(ref sectionRect)).width - 18f, 36f);
		DrawSolidRect(val3, MenuVisualTheme.Surface);
		DrawSolidRect(new Rect(((Rect)(ref val3)).x, ((Rect)(ref val3)).y, ((Rect)(ref val3)).width, 1f), MenuVisualTheme.BorderSubtle);
		GUI.Label(val3, "★  " + _settingsStore.FavoriteCount + "   " + L("favorites_search", "FAVORITOS · CTRL+F BUSCAR"), _lockedBadgeStyle);
	}

	private void DrawSectionContent(Rect optionRect)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: 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_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
		MenuSection section = LockedOptionCatalog.Sections[Mathf.Clamp(_selectedSectionIndex, 0, LockedOptionCatalog.Sections.Length - 1)];
		_currentSectionAccent = GetSectionAccent(section);
		Rect rect = default(Rect);
		((Rect)(ref rect))..ctor(((Rect)(ref optionRect)).x, ((Rect)(ref optionRect)).y, ((Rect)(ref optionRect)).width, 78f);
		DrawSolidRect(rect, MenuVisualTheme.Surface);
		DrawSolidRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + 9f, 3f, ((Rect)(ref rect)).height - 18f), _currentSectionAccent);
		DrawSolidRect(new Rect(((Rect)(ref rect)).x + 14f, ((Rect)(ref rect)).yMax - 1f, ((Rect)(ref rect)).width - 28f, 1f), MenuVisualTheme.WithAlpha(_currentSectionAccent, 0.28f));
		Rect rect2 = default(Rect);
		((Rect)(ref rect2))..ctor(((Rect)(ref rect)).x + 18f, ((Rect)(ref rect)).y + 15f, 46f, 46f);
		DrawSectionIcon(rect2, section, _currentSectionAccent);
		float num = Mathf.Clamp(((Rect)(ref rect)).width * 0.22f, 180f, 220f);
		Rect rect3 = default(Rect);
		((Rect)(ref rect3))..ctor(((Rect)(ref rect)).xMax - num - 14f, ((Rect)(ref rect)).y + 17f, num, 42f);
		float num2 = ((Rect)(ref rect2)).xMax + 14f;
		float num3 = ((Rect)(ref rect3)).x - num2 - 14f;
		GUI.Label(new Rect(num2, ((Rect)(ref rect)).y + 7f, num3, 32f), GetLocalizedSectionLabel(section), _sectionTitleStyle);
		GUI.Label(new Rect(num2, ((Rect)(ref rect)).y + 38f, num3, 31f), GetSectionSubtitle(section), _sectionSubtitleStyle);
		DrawMetricChip(rect3, L("items_in_area", "ITENS NESTA ÁREA"), (GetActiveRowCount(section) + LockedOptionCatalog.GetOptions(section).Count).ToString(), _currentSectionAccent);
		Rect position = default(Rect);
		((Rect)(ref position))..ctor(((Rect)(ref optionRect)).x, ((Rect)(ref optionRect)).y + 78f + 10f, ((Rect)(ref optionRect)).width, ((Rect)(ref optionRect)).height - 78f - 10f);
		List<LockedOptionDefinition> options = LockedOptionCatalog.GetOptions(section);
		float num4 = Mathf.Max(240f, ((Rect)(ref position)).width - 16f);
		float estimatedContentHeight = GetEstimatedContentHeight(section, num4, options.Count);
		Rect viewRect = default(Rect);
		((Rect)(ref viewRect))..ctor(0f, 0f, num4, Mathf.Max(((Rect)(ref position)).height, estimatedContentHeight));
		_optionScroll = BeginThinScrollView(position, _optionScroll, viewRect, alwaysShowHorizontal: false, alwaysShowVertical: false);
		float rowY = 4f;
		BeginCardLayout(section, ((Rect)(ref viewRect)).width, rowY);
		DrawActiveRows(section, ((Rect)(ref viewRect)).width, ref rowY);
		rowY = EndCardLayout(rowY);
		for (int i = 0; i < options.Count; i++)
		{
			DrawLockedRow(new Rect(0f, rowY, ((Rect)(ref viewRect)).width, 124f), options[i], i);
			rowY += 132f;
		}
		EndThinScrollView();
	}

	private Vector2 BeginThinScrollView(Rect position, Vector2 scrollPosition, Rect viewRect, bool alwaysShowHorizontal, bool alwaysShowVertical)
	{
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		GUISkin skin = GUI.skin;
		_previousScrollbarWidth = skin.verticalScrollbar.fixedWidth;
		_previousScrollbarThumbWidth = skin.verticalScrollbarThumb.fixedWidth;
		_previousScrollbarUpHeight = skin.verticalScrollbarUpButton.fixedHeight;
		_previousScrollbarDownHeight = skin.verticalScrollbarDownButton.fixedHeight;
		_previousScrollbarThumbNormal = skin.verticalScrollbarThumb.normal.background;
		_previousScrollbarThumbHover = skin.verticalScrollbarThumb.hover.background;
		skin.verticalScrollbar.fixedWidth = 7f;
		skin.verticalScrollbarThumb.fixedWidth = 7f;
		skin.verticalScrollbarUpButton.fixedHeight = 0f;
		skin.verticalScrollbarDownButton.fixedHeight = 0f;
		skin.verticalScrollbarThumb.normal.background = _fieldFocusedTexture;
		skin.verticalScrollbarThumb.hover.background = _buttonHoverTexture;
		_thinScrollbarActive = true;
		return GUI.BeginScrollView(position, scrollPosition, viewRect, alwaysShowHorizontal, alwaysShowVertical);
	}

	private void EndThinScrollView()
	{
		GUI.EndScrollView();
		if (_thinScrollbarActive)
		{
			GUISkin skin = GUI.skin;
			skin.verticalScrollbar.fixedWidth = _previousScrollbarWidth;
			skin.verticalScrollbarThumb.fixedWidth = _previousScrollbarThumbWidth;
			skin.verticalScrollbarUpButton.fixedHeight = _previousScrollbarUpHeight;
			skin.verticalScrollbarDownButton.fixedHeight = _previousScrollbarDownHeight;
			skin.verticalScrollbarThumb.normal.background = _previousScrollbarThumbNormal;
			skin.verticalScrollbarThumb.hover.background = _previousScrollbarThumbHover;
			_thinScrollbarActive = false;
		}
	}

	private void BeginCardLayout(MenuSection section, float width, float startY)
	{
		_cardGridActive = ShouldUseCardGrid(section, width);
		_cardGridColumns = ((!_cardGridActive) ? 1 : 2);
		_cardGridColumn = 0;
		_cardGridY = startY;
		_cardGridWidth = width;
	}

	private Rect ResolveCardRect(Rect requested, bool fullWidth)
	{
		//IL_0008: 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_0067: Unknown result type (might be due to invalid IL or missing references)
		if (!_cardGridActive)
		{
			return requested;
		}
		if (fullWidth)
		{
			if (_cardGridColumn != 0)
			{
				_cardGridY += 158f;
				_cardGridColumn = 0;
			}
			Rect result = default(Rect);
			((Rect)(ref result))..ctor(0f, _cardGridY, _cardGridWidth, ((Rect)(ref requested)).height);
			_cardGridY += ((Rect)(ref requested)).height + 12f;
			return result;
		}
		float num = (_cardGridWidth - 12f) / (float)_cardGridColumns;
		Rect result2 = default(Rect);
		((Rect)(ref result2))..ctor((float)_cardGridColumn * (num + 12f), _cardGridY, num, ((Rect)(ref requested)).height);
		_cardGridColumn++;
		if (_cardGridColumn >= _cardGridColumns)
		{
			_cardGridColumn = 0;
			_cardGridY += ((Rect)(ref requested)).height + 12f;
		}
		return result2;
	}

	private float EndCardLayout(float fallbackY)
	{
		if (!_cardGridActive)
		{
			return fallbackY;
		}
		if (_cardGridColumn != 0)
		{
			_cardGridY += 158f;
			_cardGridColumn = 0;
		}
		_cardGridActive = false;
		return _cardGridY;
	}

	private static bool ShouldUseCardGrid(MenuSection section, float width)
	{
		if (width < 1010f)
		{
			return false;
		}
		if (section != MenuSection.Favorites && section != MenuSection.Player && section != MenuSection.Damage && section != MenuSection.Enemies && section != MenuSection.Bosses && section != MenuSection.Drops && section != MenuSection.Economy && section != MenuSection.Movement)
		{
			return section == MenuSection.Mutators;
		}
		return true;
	}

	private float GetEstimatedContentHeight(MenuSection section, float width, int lockedCount)
	{
		switch (section)
		{
		case MenuSection.Summary:
			return ((width >= 900f) ? 500f : 630f) + (float)lockedCount * 132f;
		case MenuSection.Favorites:
			if (_settingsStore.FavoriteCount == 0)
			{
				return 334f + (float)lockedCount * 132f;
			}
			break;
		}
		int num = GetActiveRowCount(section);
		if (ShouldUseCardGrid(section, width))
		{
			if (section == MenuSection.Damage)
			{
				num = Mathf.CeilToInt((float)(num - 4) / 2f) + 7;
			}
			else
			{
				int num2 = ((section != MenuSection.Favorites) ? 1 : 0);
				num = Mathf.CeilToInt((float)(num - num2) / 2f) + num2;
			}
		}
		return (float)num * 158f + (float)lockedCount * 132f + 18f;
	}

	private void DrawActiveRows(MenuSection section, float width, ref float rowY)
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0261: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b38: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cce: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f75: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_1029: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_030c: Unknown result type (might be due to invalid IL or missing references)
		//IL_1138: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b93: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_106e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d29: Unknown result type (might be due to invalid IL or missing references)
		//IL_034a: Unknown result type (might be due to invalid IL or missing references)
		//IL_117d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_125f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1281: Unknown result type (might be due to invalid IL or missing references)
		//IL_12a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_11ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_1226: Unknown result type (might be due to invalid IL or missing references)
		//IL_0383: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_1316: Unknown result type (might be due to invalid IL or missing references)
		//IL_11c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_1389: Unknown result type (might be due to invalid IL or missing references)
		//IL_10c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d84: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_13ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_110d: Unknown result type (might be due to invalid IL or missing references)
		//IL_044c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c49: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ddf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0485: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_0237: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ca4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e3a: Unknown result type (might be due to invalid IL or missing references)
		//IL_054e: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e95: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0601: Unknown result type (might be due to invalid IL or missing references)
		//IL_0650: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ef0: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_06dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0705: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f4b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0755: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_080a: Unknown result type (might be due to invalid IL or missing references)
		//IL_085a: Unknown result type (might be due to invalid IL or missing references)
		//IL_08ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_08e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_090f: Unknown result type (might be due to invalid IL or missing references)
		//IL_095f: Unknown result type (might be due to invalid IL or missing references)
		//IL_09ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_09d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a14: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a2e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a51: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a95: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aaf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ad2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b16: Unknown result type (might be due to invalid IL or missing references)
		switch (section)
		{
		case MenuSection.Favorites:
			DrawFavoriteRows(width, ref rowY);
			break;
		case MenuSection.Summary:
		{
			DifficultySummarySnapshot summary = BuildDifficultySummary();
			DrawSummaryDashboard(width, ref rowY, summary);
			break;
		}
		case MenuSection.Player:
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.MaximumHealth, "VIDA MÁXIMA", "Define o limite total de máscaras da Hornet, entre 1 e 20. Ao reduzir o valor, a vida atual é limitada ao novo máximo; ao desligar a opção, o máximo original do perfil é restaurado.", (_images != null) ? _images.Health : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.DamageTakenMultiplier, "DANO RECEBIDO", "Adiciona dano aos ataques de inimigos e projéteis. O valor 1 mantém o dano original; cada ponto acima de 1 acrescenta uma máscara ao dano que o ataque normalmente causaria.", (_images != null) ? _images.EnemyDamage : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.EnvironmentalDamageMultiplier, "DANO DE CENÁRIO", "Controla o dano adicional de espinhos, ácido, lava, armadilhas e outros perigos do cenário. O valor 1 preserva o dano original; valores maiores acrescentam máscaras ao acerto.", (_images != null) ? _images.EnvironmentalDamage : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.OneHitMode, "MODO ONE HIT", "Quando o valor está Ligado, qualquer acerto que cause dano remove toda a vida normal e azul da Hornet. O botão LIG./DESL. ativa ou ignora completamente esta regra.", (_images != null) ? _images.OneHit : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.HealingAmount, "QUANTIDADE DE CURA", "Define diretamente quantas máscaras são recuperadas ao concluir um Bind, de 1 a 20. O valor não multiplica a cura normal; ele passa a ser a quantidade total restaurada, limitada pela vida máxima.", (_images != null) ? _images.Healing : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.HealingCost, "CUSTO DA CURA", "Define diretamente quantos fios de Seda são necessários e consumidos pelo Bind, de 1 a 18. O mesmo valor é usado para liberar a cura, atualizar o indicador e descontar a Seda.", (_images != null) ? _images.SilkSpool : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.InvincibilityTimeMultiplier, "TEMPO DE INVENCIBILIDADE", "Multiplica a duração original da invencibilidade após receber dano e durante Parry, Quake, Cross Stitch e Silk Dash. 1,0x mantém o tempo normal; 2,0x dobra cada janela.", (_images != null) ? _images.Invincibility : null, (_images != null) ? _images.Timing : null);
			rowY += 158f;
			DrawPlayerCategoryResetRow(new Rect(0f, rowY, width, 146f));
			rowY += 158f;
			break;
		case MenuSection.Damage:
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.NeedleDamage, "DANO DA AGULHA", "Define o dano base da agulha antes das melhorias, entre 1 e 100. Este valor substitui o dano base detectado do jogo enquanto a opção estiver ligada.", (_images != null) ? _images.Needle : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.NeedleUpgradePercentage, "AUMENTO POR MELHORIA (%)", "Aplica a porcentagem a cada melhoria já obtida, sempre sobre o dano resultante da etapa anterior. Exemplo: dano 10 e 100% vira 20 na primeira melhoria e 40 na segunda.", (_images != null) ? _images.NeedleUpgrade : null);
			rowY += 158f;
			DrawDamageToolCategory(new Rect(0f, rowY, width, 146f), "HABILIDADES DE SEDA", "Custos e danos individuais das seis Habilidades de Seda. Os valores padrão reproduzem a build 1.0.30000.", new Color(0.86f, 0.88f, 0.84f, 1f), (_images != null) ? _images.WhiteTools : null);
			rowY += 158f;
			DrawDamageToolEntry(new Rect(18f, rowY, width - 18f, 146f), "LANÇA DE SEDA", "Um impacto perfurante. Fórmula vanilla: dano atual da Agulha × 3,00.", (_images != null) ? _images.SilkSpear : null, new Color(0.86f, 0.88f, 0.84f, 1f));
			rowY += 158f;
			DrawSettingRow(new Rect(18f, rowY, width - 18f, 146f), ModSettingKind.SilkSpearSilkCost, "CUSTO DE SEDA", GetSilkCostDescription("Lança de Seda"), (_images != null) ? _images.SilkSpear : null);
			rowY += 158f;
			DrawSettingRow(new Rect(18f, rowY, width - 18f, 146f), ModSettingKind.SilkSpearDamageMultiplier, "MULTIPLICADOR DE DANO", GetSilkDamageDescription(ModSettingKind.SilkSpearDamageMultiplier, "Aplicado uma vez ao dano atual da Agulha no único impacto.", 1), (_images != null) ? _images.SilkSpear : null);
			rowY += 158f;
			DrawDamageToolEntry(new Rect(18f, rowY, width - 18f, 146f), "TURBILHÃO DE FIOS", "Impactos separados a cada 6 passos de física. O FSM troca o multiplicador após 0,5 s.", (_images != null) ? _images.ThreadStorm : null, new Color(0.86f, 0.88f, 0.84f, 1f));
			rowY += 158f;
			DrawSettingRow(new Rect(18f, rowY, width - 18f, 146f), ModSettingKind.ThreadStormSilkCost, "CUSTO DE SEDA", GetSilkCostDescription("Turbilhão de Fios"), (_images != null) ? _images.ThreadStorm : null);
			rowY += 158f;
			DrawSettingRow(new Rect(18f, rowY, width - 18f, 146f), ModSettingKind.ThreadStormNormalHitMultiplier, "IMPACTOS INICIAIS (0–0,5 S)", GetSilkDamageDescription(ModSettingKind.ThreadStormNormalHitMultiplier, "O alvo mantém os quatro primeiros impactos completos.", 1), (_images != null) ? _images.ThreadStorm : null);
			rowY += 158f;
			DrawSettingRow(new Rect(18f, rowY, width - 18f, 146f), ModSettingKind.ThreadStormLateHitMultiplier, "IMPACTOS TARDIOS (APÓS 0,5 S)", GetSilkDamageDescription(ModSettingKind.ThreadStormLateHitMultiplier, "No mesmo alvo, o 5º impacto ainda é dividido por 3 e os seguintes por 4.", 1), (_images != null) ? _images.ThreadStorm : null);
			rowY += 158f;
			DrawDamageToolEntry(new Rect(18f, rowY, width - 18f, 146f), "PONTO CRUZ", "Contra-ataque de quatro impactos, criado somente após uma defesa bem-sucedida.", (_images != null) ? _images.CrossStitch : null, new Color(0.86f, 0.88f, 0.84f, 1f));
			rowY += 158f;
			DrawSettingRow(new Rect(18f, rowY, width - 18f, 146f), ModSettingKind.CrossStitchSilkCost, "CUSTO DE SEDA", GetSilkCostDescription("Ponto Cruz"), (_images != null) ? _images.CrossStitch : null);
			rowY += 158f;
			DrawSettingRow(new Rect(18f, rowY, width - 18f, 146f), ModSettingKind.CrossStitchHitMultiplier, "MULTIPLICADOR POR GOLPE", GetSilkDamageDescription(ModSettingKind.CrossStitchHitMultiplier, "Cada um dos quatro impactos é calculado e arredondado separadamente.", 4), (_images != null) ? _images.CrossStitch : null);
			rowY += 158f;
			DrawDamageToolEntry(new Rect(18f, rowY, width - 18f, 146f), "DARDO AFIADO", "Na build atual, usa um único DamageEnemies de 2,75x por inimigo atravessado.", (_images != null) ? _images.SharpDart : null, new Color(0.86f, 0.88f, 0.84f, 1f));
			rowY += 158f;
			DrawSettingRow(new Rect(18f, rowY, width - 18f, 146f), ModSettingKind.SharpdartSilkCost, "CUSTO DE SEDA", GetSilkCostDescription("Dardo Afiado"), (_images != null) ? _images.SharpDart : null);
			rowY += 158f;
			DrawSettingRow(new Rect(18f, rowY, width - 18f, 146f), ModSettingKind.SharpdartMainHitMultiplier, "MULTIPLICADOR DO IMPACTO", GetSilkDamageDescription(ModSettingKind.SharpdartMainHitMultiplier, "Substitui somente o impacto perfurante; movimento e invulnerabilidade não são alterados.", 1), (_images != null) ? _images.SharpDart : null);
			rowY += 158f;
			DrawDamageToolEntry(new Rect(18f, rowY, width - 18f, 146f), "FÚRIA DE RUNAS", "Nove runas independentes. A redução por impactos repetidos pertence a cada inimigo.", (_images != null) ? _images.RuneRage : null, new Color(0.86f, 0.88f, 0.84f, 1f));
			rowY += 158f;
			DrawSettingRow(new Rect(18f, rowY, width - 18f, 146f), ModSettingKind.RuneRageSilkCost, "CUSTO DE SEDA", GetSilkCostDescription("Fúria de Runas"), (_images != null) ? _images.RuneRage : null);
			rowY += 158f;
			DrawSettingRow(new Rect(18f, rowY, width - 18f, 146f), ModSettingKind.RuneRageBaseDamageMultiplier, "MULTIPLICADOR BASE DA RUNA", GetSilkDamageDescription(ModSettingKind.RuneRageBaseDamageMultiplier, "Define a primeira runa. No mesmo alvo, as seguintes usam divisão inteira por 2, 3, 4 e assim por diante, com mínimo 1.", 1), (_images != null) ? _images.RuneRage : null);
			rowY += 158f;
			DrawDamageToolEntry(new Rect(18f, rowY, width - 18f, 146f), "FERRÕES PÁLIDOS", "Três projéteis independentes, cada um usando o dano atual da Agulha.", (_images != null) ? _images.PaleSpines : null, new Color(0.86f, 0.88f, 0.84f, 1f));
			rowY += 158f;
			DrawSettingRow(new Rect(18f, rowY, width - 18f, 146f), ModSettingKind.PaleNailsSilkCost, "CUSTO DE SEDA", GetSilkCostDescription("Ferrões Pálidos"), (_images != null) ? _images.PaleSpines : null);
			rowY += 158f;
			DrawSettingRow(new Rect(18f, rowY, width - 18f, 146f), ModSettingKind.PaleNailsProjectileMultiplier, "MULTIPLICADOR POR PROJÉTIL", GetSilkDamageDescription(ModSettingKind.PaleNailsProjectileMultiplier, "Cada projétil é calculado separadamente. A prévia total considera os três projéteis.", 3), (_images != null) ? _images.PaleSpines : null);
			rowY += 158f;
			DrawDamageToolCategory(new Rect(0f, rowY, width, 146f), "FERRAMENTAS VERMELHAS", "Dispositivos ativos, como projéteis, armadilhas e bombas; os usos são reabastecidos com Fragmentos de Concha.", new Color(0.86f, 0.25f, 0.18f, 1f), (_images != null) ? _images.RedTools : null);
			rowY += 158f;
			DrawDamageToolEntries(RedDamageTools, new Color(0.86f, 0.25f, 0.18f, 1f), width, ref rowY);
			DrawDamageToolCategory(new Rect(0f, rowY, width, 146f), "FERRAMENTAS AZUIS", "Melhorias passivas defensivas e ofensivas: proteção extra, resistência a perigos e aplicação de efeitos.", new Color(0.22f, 0.54f, 0.92f, 1f), (_images != null) ? _images.BlueTools : null);
			rowY += 158f;
			DrawDamageToolEntries(BlueDamageTools, new Color(0.22f, 0.54f, 0.92f, 1f), width, ref rowY);
			DrawDamageToolCategory(new Rect(0f, rowY, width, 146f), "FERRAMENTAS AMARELAS", "Melhorias passivas ofensivas ou de suporte, voltadas a reforçar ataques e vantagens de exploração.", new Color(0.94f, 0.72f, 0.18f, 1f), (_images != null) ? _images.YellowTools : null);
			rowY += 158f;
			DrawDamageToolEntries(YellowDamageTools, new Color(0.94f, 0.72f, 0.18f, 1f), width, ref rowY);
			break;
		case MenuSection.Enemies:
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.EnemyHealthMultiplier, "VIDA DOS INIMIGOS", "Multiplica a vida máxima dos inimigos comuns quando eles aparecem. A vida atual mantém a mesma porcentagem ao mudar o valor; Bosses identificados não são alterados.", (_images != null) ? _images.GetSectionIcon(MenuSection.Enemies) : null, (_images != null) ? _images.Health : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.EnemySpeedMultiplier, "VELOCIDADE DOS INIMIGOS", "Multiplica de 0,1x a 1,1x a velocidade física de movimento dos inimigos comuns. Não acelera o tempo global, a Hornet nem a recarga de ataques; inimigos parados continuam parados.", (_images != null) ? _images.GetSectionIcon(MenuSection.Enemies) : null, (_images != null) ? _images.Sprint : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.EnemyAttackSpeedMultiplier, "RECARGA DE ATAQUE DOS INIMIGOS", "Valores maiores reduzem os intervalos entre ações ofensivas dos inimigos comuns. Em 2,0x, os tempos de espera caem pela metade; Bosses não são alterados.", (_images != null) ? _images.GetSectionIcon(MenuSection.Enemies) : null, (_images != null) ? _images.Timing : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.EnemyAggressionMultiplier, "AGRESSIVIDADE DOS INIMIGOS", "Multiplica as distâncias de detecção, alerta e perseguição usadas pela IA dos inimigos comuns. Valores maiores fazem o inimigo perceber a Hornet de mais longe.", (_images != null) ? _images.GetSectionIcon(MenuSection.Enemies) : null, (_images != null) ? _images.WorldSense : null);
			rowY += 158f;
			DrawEnemiesCategoryResetRow(new Rect(0f, rowY, width, 146f));
			rowY += 158f;
			break;
		case MenuSection.Bosses:
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.BossHealthMultiplier, "VIDA DOS BOSSES", "Multiplica a vida máxima de cada Boss identificado quando ele aparece. A vida atual mantém a mesma porcentagem quando o valor é alterado.", (_images != null) ? _images.GetSectionIcon(MenuSection.Bosses) : null, (_images != null) ? _images.Health : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.BossDamageTakenMultiplier, "DANO RECEBIDO DE BOSS", "Multiplica somente o dano que a Hornet recebe de ataques e projéteis identificados como pertencentes a um Boss.", (_images != null) ? _images.GetSectionIcon(MenuSection.Bosses) : null, (_images != null) ? _images.EnemyDamage : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.BossSpeedMultiplier, "VELOCIDADE DOS BOSSES", "Multiplica de 0,1x a 1,1x a velocidade física dos Bosses, sem alterar a velocidade da Hornet.", (_images != null) ? _images.GetSectionIcon(MenuSection.Bosses) : null, (_images != null) ? _images.Sprint : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.BossAttackSpeedMultiplier, "RECARGA DE ATAQUE DOS BOSSES", "Valores maiores reduzem os intervalos da IA durante o combate. Em 2,0x, os tempos entre ações ofensivas caem pela metade.", (_images != null) ? _images.GetSectionIcon(MenuSection.Bosses) : null, (_images != null) ? _images.Timing : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.BossBrutalMode, "MODO BOSS BRUTAL", "Cada ataque de Boss tem 10% de chance de causar 1 máscara adicional. Durante Boss, toda cura concluída recupera 1 máscara a menos. O dano da Hornet não muda.", (_images != null) ? _images.GetSectionIcon(MenuSection.Bosses) : null, (_images != null) ? _images.BossBrutal : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.DisableHealingDuringBoss, "SEM CURA EM BOSS", "Quando ligado, o Bind ainda pode consumir Seda, mas não recupera nenhuma máscara enquanto uma luta de Boss estiver ativa.", (_images != null) ? _images.GetSectionIcon(MenuSection.Bosses) : null, (_images != null) ? _images.NoHealingBoss : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.HealingDuringBossMultiplier, "CURA DURANTE BOSS", "Multiplica somente durante Boss a Quantidade de Cura configurada na aba Hornet. Exemplo: cura 3 com 0,5x restaura 2; com 2,0x restaura 6. Sem Cura em Boss sempre resulta em 0, e o Modo Boss Brutal retira 1 após o cálculo.", (_images != null) ? _images.Healing : null, (_images != null) ? _images.GetSectionIcon(MenuSection.Bosses) : null);
			rowY += 158f;
			DrawBossesCategoryResetRow(new Rect(0f, rowY, width, 146f));
			rowY += 158f;
			break;
		case MenuSection.Drops:
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.CoinMultiplier, "ROSÁRIOS RECEBIDOS POR MOEDAS", "Multiplica somente os Rosários concedidos ao coletar moedas no cenário. O resultado é arredondado para o inteiro mais próximo e nunca fica abaixo de 1 quando a coleta original é positiva.", (_images != null) ? _images.Coin : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.ShardMultiplier, "ROSÁRIOS RECEBIDOS POR FRAGMENTOS", "Multiplica somente a recompensa adicionada ao coletar fragmentos. O resultado é arredondado para o inteiro mais próximo e não altera gastos, preços ou outras fontes de moeda.", (_images != null) ? _images.Shard : null);
			rowY += 158f;
			DrawDropsCategoryResetRow(new Rect(0f, rowY, width, 146f));
			rowY += 158f;
			break;
		case MenuSection.Economy:
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.ShopPriceMultiplier, "PREÇOS DAS LOJAS", "Multiplica o preço em Rosários dos itens vendidos nas lojas compatíveis. O resultado é arredondado para o inteiro mais próximo e todo item com preço positivo continua custando pelo menos 1.", (_images != null) ? _images.Shop : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.StationPriceMultiplier, "PREÇOS DOS BANCOS E ESTAÇÕES", "Multiplica o valor em Rosários mostrado e cobrado nas confirmações de bancos e estações Bellway. Não altera preços de lojas comuns nem custos pagos com outros tipos de recurso.", (_images != null) ? _images.Bench : null, (_images != null) ? _images.Station : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.DeathRosaryLossPercentage, "PERDA DE ROSÁRIOS NA MORTE", "Define a porcentagem da perda normal de Rosários ao morrer. 100% mantém a regra original e 0% não perde nada. Acima de 100%, o saldo pode ficar negativo, mas o casulo devolve no máximo o saldo positivo existente antes da morte.", (_images != null) ? _images.Coin : null);
			rowY += 158f;
			DrawEconomyCategoryResetRow(new Rect(0f, rowY, width, 146f));
			rowY += 158f;
			break;
		case MenuSection.Movement:
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.HornetSpeedMultiplier, "VELOCIDADE DA HORNET", "Multiplica a velocidade normal de caminhada e corrida da Hornet. Não altera a velocidade própria do dash nem de ataques.", (_images != null) ? _images.Sprint : null);
			rowY += 158f;
			DrawSettingRow(new Rect(0f, rowY, width, 146f), ModSettingKind.DashRechargeLevel, "RECARGA DO DASH", "Nível 1 mantém a recarga normal. No nível 2 a recarga leva 0,1 segundo; cada nível seguinte dobra esse tempo, até o nível 20.", (_images != null) ? _images.DashRecharge : null);
			rowY += 158f;
			DrawMovementCategoryResetRow(new Rect(0f, rowY, width, 146f));
			rowY += 158f;
			break;
		case MenuSection.Mutators:
		{
			for (int num = 0; num < MutatorCatalog.All.Length; num++)
			{
				DrawMutatorRow(new Rect(0f, rowY, width, 146f), MutatorCatalog.All[num], num);
				rowY += 158f;
			}
			DrawMutatorsCategoryResetRow(new Rect(0f, rowY, width, 146f));
			rowY += 158f;
			break;
		}
		case MenuSection.Presets:
			DrawPresetRows(width, ref rowY);
			break;
		case MenuSection.System:
			DrawLanguageRow(new Rect(0f, rowY, width, 146f));
			rowY += 158f;
			DrawLanguagePreviewRow(new Rect(0f, rowY, width, 146f));
			rowY += 158f;
			DrawCommandRow(new Rect(0f, rowY, width, 146f), L("system_apply_title", "APLICAR"), L("system_apply_desc", "Confirma todos os valores digitados e transforma o estado atual no novo ponto para Descartar alterações."), L("system_apply_value", "Tempo real"), L("apply", "APLICAR"), delegate
			{
				CommitAllFields();
				_openSettingsSnapshot = _settingsStore.ExportJson();
				SetOperationMessage("Alterações aplicadas.");
			});
			rowY += 158f;
			DrawCommandRow(new Rect(0f, rowY, width, 146f), L("system_reset_title", "RESETAR TUDO"), L("system_reset_desc", "Restaura todas as categorias aos padrões do perfil atual. Os favoritos são preservados."), L("system_reset_value", "Todos os ajustes"), L("reset", "RESETAR"), delegate
			{
				CommitAllFields();
				_showRestoreConfirmation = true;
			});
			rowY += 158f;
			DrawCommandRow(new Rect(0f, rowY, width, 146f), L("system_discard_title", "DESCARTAR ALTERAÇÕES"), L("system_discard_desc", "Retorna exatamente ao estado existente quando o menu foi aberto ou quando Aplicar foi usado pela última vez."), L("system_discard_value", "Snapshot do menu"), L("system_discard_action", "DESCARTAR"), delegate
			{
				if (!string.IsNullOrEmpty(_openSettingsSnapshot) && _settingsStore.ImportJson(_openSettingsSnapshot))
				{
					SyncTextFromSettings();
					SetOperationMessage("Alterações descartadas.");
				}
			});
			rowY += 158f;
			DrawCommandRow(new Rect(0f, rowY, width, 146f), L("system_close_title", "FECHAR MENU"), L("system_close_desc", "Aplica os campos em edição, fecha a interface e devolve o controle da Hornet."), "F8 / Esc", L("back", "FECHAR"), delegate
			{
				Close();
			});
			rowY += 158f;
			break;
		}
	}

	private void DrawPresetRows(float width, ref float rowY)
	{
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0329: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
		int num = ((_presetManager != null) ? _presetManager.Count : 0);
		int num2 = ((_presetManager != null) ? _presetManager.LoadedCount : 0);
		string arg = ((_presetManager != null) ? _presetManager.ActivePresetName : L("unavailable", "Indisponível"));
		DrawCycleRow(new Rect(0f, rowY, width, 146f), L("preset_load_file_title", "CARREGAR ARQUIVO"), string.Format(L("preset_load_file_desc", "{0} arquivo(s) encontrado(s) na pasta Presets. Carregar adiciona o arquivo à lista Seus Presets sem ativá-lo."), num), (_presetManager != null) ? _presetManager.SelectedName : L("unavailable", "Indisponível"), delegate(int direction)
		{
			if (_presetManager != null)
			{
				_presetManager.Cycle(direction);
			}
		}, L("preset_load_button", "CARREGAR"), delegate
		{
			if (_presetManager != null && _presetManager.LoadSelectedFileToList())
			{
				SetOperationMessage("Preset carregado para a lista.");
			}
			else
			{
				SetOperationMessage("Não foi possível carregar esse arquivo.");
			}
		});
		rowY += 158f;
		DrawPresetNamedActionRow(new Rect(0f, rowY, width, 146f), L("preset_save_file_title", "SALVAR ARQUIVO"), L("preset_save_file_desc", "Salva em um novo JSON todas as configurações atuais de todas as abas e adiciona o preset à lista Seus Presets."), L("action_save_short", "SALVAR"), delegate
		{
			if (_presetManager != null)
			{
				CommitAllFields();
				_presetNameText = _presetManager.Create(_presetNameText);
				SetOperationMessage("Preset salvo e adicionado à lista.");
			}
		});
		rowY += 158f;
		DrawCommandRow(new Rect(0f, rowY, width, 146f), L("preset_refresh_title", "ATUALIZAR PASTA PRESETS"), string.Format(L("preset_refresh_desc", "Lê novamente os arquivos JSON da pasta do mod. Preset ativo: {0}."), arg), string.Format(L("preset_loaded_count", "{0} carregado(s)"), num2), L("reload_presets", "ATUALIZAR"), delegate
		{
			if (_presetManager != null)
			{
				_presetManager.Refresh();
				SetOperationMessage("Pasta Presets atualizada.");
			}
		});
		rowY += 158f;
		DrawBuiltInPresetToggle(width, ref rowY, "very_easy", L("preset_very_easy", "MUITO FÁCIL"), L("desc_preset_very_easy", "Grande vantagem para a Hornet, inimigos frágeis, economia generosa e nenhuma perda de Rosários."));
		DrawBuiltInPresetToggle(width, ref rowY, "easy", L("preset_easy", "FÁCIL"), L("desc_preset_easy", "Mais vida e cura, inimigos mais frágeis, preços menores e perda de Rosários reduzida."));
		DrawBuiltInPresetToggle(width, ref rowY, "normal", L("preset_normal", "NORMAL"), L("desc_preset_normal", "Usa os valores normais detectados no perfil atual."));
		DrawBuiltInPresetToggle(width, ref rowY, "hard", L("preset_hard", "DIFÍCIL"), L("desc_preset_hard", "Menos vida e cura; inimigos e Bosses mais resistentes, rápidos e agressivos."));
		DrawBuiltInPresetToggle(width, ref rowY, "very_hard", L("preset_very_hard", "MUITO DIFÍCIL"), L("desc_preset_very_hard", "Dano recebido maior, cura limitada, economia restrita e oponentes muito fortalecidos."));
		DrawBuiltInPresetToggle(width, ref rowY, "nightmare", L("preset_nightmare", "NIGHTMARE"), L("desc_preset_nightmare", "Perfil extremo com pouca vida, economia severa e Bosses brutalmente fortalecidos."));
		DrawBuiltInPresetToggle(width, ref rowY, "farm", L("preset_farm", "FARM"), L("desc_preset_farm", "Aumenta Rosários, Fragmentos, dano, cura e velocidade para coleta."));
		if (_presetManager == null || _presetManager.LoadedCount == 0)
		{
			DrawPresetToggleRow(new Rect(0f, rowY, width, 146f), L("your_presets", "SEUS PRESETS"), L("your_presets_empty", "Nenhum arquivo foi carregado para esta lista. Use Carregar Arquivo acima."), active: false, null, canRemove: false, null);
			rowY += 158f;
			return;
		}
		for (int num3 = 0; num3 < _presetManager.LoadedCount; num3++)
		{
			int presetIndex = num3;
			if (IsPresetRowVisible(rowY))
			{
				DrawPresetToggleRow(new Rect(0f, rowY, width, 146f), L("your_preset_prefix", "SEU PRESET") + " — " + _presetManager.GetLoadedName(presetIndex).ToUpperInvariant(), L("your_preset_desc", "Liga todas as configurações deste arquivo. Excluir remove somente da aba; o JSON permanece na pasta Presets."), _presetManager.IsLoadedActive(presetIndex), delegate
				{
					if (_presetManager.ToggleLoaded(presetIndex))
					{
						SyncTextFromSettings();
						SetOperationMessage(_presetManager.IsLoadedActive(presetIndex) ? "Preset ativado." : "Preset desativado.");
					}
				}, canRemove: true, delegate
				{
					if (_presetManager.RemoveLoadedFromTab(presetIndex))
					{
						SyncTextFromSettings();
						SetOperationMessage("Preset excluído da aba. O arquivo foi mantido.");
					}
				});
			}
			rowY += 158f;
		}
	}

	private void DrawPresetRowsLegacy(float width, ref float rowY)
	{
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		string text = ((_presetManager != null) ? (_presetManager.Count + " preset(s) salvo(s) em disco.") : "Gerenciador de presets indisponível.");
		if (!string.IsNullOrEmpty(_operationMessage))
		{
			text = text + " " + _operationMessage;
		}
		DrawCycleRow(new Rect(0f, rowY, width, 146f), "PRESET SALVO", text, (_presetManager != null) ? _presetManager.SelectedName : "Indisponível", delegate(int direction)
		{
			if (_presetManager != null)
			{
				_presetManager.Cycle(direction);
			}
		}, null, null);
		rowY += 158f;
		DrawPresetNamedActionRow(new Rect(0f, rowY, width, 146f), "CRIAR PRESET", "Salva a configuração atual em um novo arquivo usando o nome digitado.", "CRIAR", delegate
		{
			if (_presetManager != null)
			{
				_presetNameText = _presetManager.Create(_presetNameText);
				SetOperationMessage("Preset criado.");
			}
		});
		rowY += 158f;
		DrawPresetCommand(width, ref rowY, "SALVAR ATUAL", "Substitui o conteúdo do preset selecionado pela configuração atual.", "SALVAR", delegate
		{
			if (_presetManager != null && _presetManager.SaveSelected())
			{
				SetOperationMessage("Preset salvo.");
			}
		});
		DrawPresetCommand(width, ref rowY, "CARREGAR SELECIONADO", "Aplica imediatamente todos os valores do preset selecionado.", "CARREGAR", delegate
		{
			if (_presetManager != null && _presetManager.LoadSelected())
			{
				SyncTextFromSettings();
				SetOperationMessage("Preset carregado.");
			}
		});
		DrawPresetCommand(width, ref rowY, "DUPLICAR SELECIONADO", "Cria uma cópia independente do preset selecionado.", "DUPLICAR", delegate
		{
			if (_presetManager != null)
			{
				_presetNameText = _presetManager.DuplicateSelected();
				SetOperationMessage("Preset duplicado.");
			}
		});
		DrawPresetNamedActionRow(new Rect(0f, rowY, width, 146f), "RENOMEAR SELECIONADO", "Renomeia o arquivo selecionado usando o nome digitado.", "RENOMEAR", delegate
		{
			if (_presetManager != null)
			{
				_presetNameText = _presetManager.RenameSelected(_presetNameText);
				SetOperationMessage("Preset renomeado.");
			}
		});
		rowY += 158f;
		DrawPresetCommand(width, ref rowY, "APAGAR SELECIONADO", "Apaga somente o arquivo do preset selecionado. A configuração ativa não muda.", "APAGAR", delegate
		{
			if (_presetManager != null && _presetManager.DeleteSelected())
			{
				SetOperationMessage("Preset apagado.");
			}
		});
		DrawPresetCommand(width, ref rowY, "RESETAR ARQUIVO", "Substitui o preset selecionado pelos valores do perfil Normal.", "RESETAR", delegate
		{
			if (_presetManager != null && _presetManager.ResetSelected())
			{
				SetOperationMessage("Arquivo restaurado.");
			}
		});
		DrawPresetCommand(width, ref rowY, "EXPORTAR ATUAL", (_presetManager != null) ? ("Cria um JSON datado em " + _presetManager.ExportDirectory) : "Gerenciador indisponível.", "EXPORTAR", delegate
		{
			if (_presetManager != null)
			{
				_presetManager.ExportCurrent();
				SetOperationMessage("Configuração exportada.");
			}
		});
		DrawPresetCommand(width, ref rowY, "IMPORTAR MAIS RECENTE", (_presetManager != null) ? ("Importa o JSON mais recente de " + _presetManager.ImportDirectory + " ou da pasta de exportação.") : "Gerenciador indisponível.", "IMPORTAR", delegate
		{
			if (_presetManager != null && _presetManager.ImportLatest())
			{
				SyncTextFromSettings();
				SetOperationMessage("Preset importado.");
			}
			else
			{
				SetOperationMessage("Nenhum JSON válido para importar.");
			}
		});
		DrawPresetCommand(width, ref rowY, "RECARREGAR LISTA", "Lê novamente os arquivos da pasta de presets.", "RECARREGAR", delegate
		{
			if (_presetManager != null)
			{
				_presetManager.Refresh();
				SetOperationMessage("Lista recarregada.");
			}
		});
		DrawBuiltInPreset(width, ref rowY, "EASY", "Mais vida e cura, inimigos mais frágeis, preços menores e perda de Rosários reduzida.");
		DrawBuiltInPreset(width, ref rowY, "NORMAL", "Restaura os ajustes normais detectados no perfil atual.");
		DrawBuiltInPreset(width, ref rowY, "HARD", "Menos vida e cura; inimigos e Bosses mais resistentes, rápidos e agressivos.");
		DrawBuiltInPreset(width, ref rowY, "NIGHTMARE", "Perfil extremo com pouca vida, economia restrita e Bosses muito fortalecidos.");
		DrawBuiltInPreset(width, ref rowY, "ONE HIT", "Ativa um golpe fatal, uma máscara máxima e bloqueia a cura.");
		DrawBuiltInPreset(width, ref rowY, "FARM", "Aumenta Rosários, Fragmentos, dano, cura e velocidade para coleta.");
		DrawBuiltInPreset(width, ref rowY, "CUSTOM", "Mantém a configuração atual sem alterar valores.");
	}

	private void DrawBuiltInPresetToggle(float width, ref float rowY, string key, string displayName, string description)
	{
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		bool active = _presetManager != null && _presetManager.IsBuiltInActive(key);
		DrawPresetToggleRow(new Rect(0f, rowY, width, 146f), L("preset_mod_prefix", "PRESET DO MOD") + " — " + displayName, description, active, delegate
		{
			if (_presetManager != null && _presetManager.ToggleBuiltIn(key))
			{
				SyncTextFromSettings();
				SetOperationMessage(_presetManager.IsBuiltInActive(key) ? ("Preset " + displayName + " ativado.") : ("Preset " + displayName + " desativado."));
			}
		}, canRemove: false, null);
		rowY += 158f;
	}

	private void DrawPresetToggleRow(Rect rowRect, string title, string description, bool active, Action toggleAction, bool canRemove, Action removeAction)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: 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_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		DrawActionRowBackground(rowRect, title?.GetHashCode() ?? 0);
		float num = 350f;
		float num2 = ((Rect)(ref rowRect)).xMax - num - 16f;
		DrawActionRowText(rowRect, num2, title, description);
		float num3 = ((Rect)(ref rowRect)).y + 34f;
		float num4 = (canRemove ? 164f : num);
		if (toggleAction != null)
		{
			Color color = GUI.color;
			if (active)
			{
				GUI.color = new Color(0.72f, 1f, 0.76f, 1f);
			}
			if (GUI.Button(new Rect(num2, num3, num4, 44f), active ? L("enabled", "LIGADO") : L("disabled", "DESLIGADO"), _buttonStyle))
			{
				ExecuteMenuAction(toggleAction);
			}
			GUI.color = color;
		}
		else
		{
			DrawDisabledControl(new Rect(num2, num3, num4, 44f), L("empty", "VAZIO"));
		}
		if (canRemove && GUI.Button(new Rect(num2 + 174f, num3, 176f, 44f), L("remove_from_tab", "EXCLUIR DA ABA"), _buttonStyle))
		{
			ExecuteMenuAction(removeAction);
		}
	}

	private bool IsPresetRowVisible(float rowY)
	{
		if (rowY + 146f >= _optionScroll.y - 158f)
		{
			return rowY <= _optionScroll.y + 920f;
		}
		return false;
	}

	private void DrawPresetCommand(float width, ref float rowY, string title, string description, string button, Action action)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		DrawCommandRow(new Rect(0f, rowY, width, 146f), title, description, (_presetManager != null) ? _presetManager.SelectedName : "Indisponível", button, action);
		rowY += 158f;
	}

	private void DrawBuiltInPreset(float width, ref float rowY, string name, string description)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		DrawCommandRow(new Rect(0f, rowY, width, 146f), "PRESET " + name, description, "Interno", "APLICAR", delegate
		{
			if (_presetManager != null && _presetManager.ApplyBuiltIn(name))
			{
				SyncTextFromSettings();
				SetOperationMessage("Preset " + name + " aplicado.");
			}
		});
		rowY += 158f;
	}

	private void DrawCommandRow(Rect rowRect, string title, string description, string value, string buttonLabel, Action action)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		DrawActionRowBackground(rowRect, title?.GetHashCode() ?? 0);
		float num = 330f;
		float num2 = ((Rect)(ref rowRect)).xMax - num - 16f;
		DrawActionRowText(rowRect, num2, title, description);
		DrawFramedBox(new Rect(num2, ((Rect)(ref rowRect)).y + 23f, 190f, 62f), new Color(0.018f, 0.024f, 0.024f, 0.96f), new Color(0.24f, 0.23f, 0.18f, 0.9f));
		GUI.Label(new Rect(num2 + 8f, ((Rect)(ref rowRect)).y + 23f, 174f, 62f), T(value ?? string.Empty), _metaValueStyle);
		if (GUI.Button(new Rect(num2 + 198f, ((Rect)(ref rowRect)).y + 34f, 132f, 42f), T(buttonLabel), _buttonStyle))
		{
			ExecuteMenuAction(action);
		}
	}

	private void DrawCycleRow(Rect rowRect, string title, string description, string value, Action<int> adjust, string actionLabel, Action action)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		DrawActionRowBackground(rowRect, title?.GetHashCode() ?? 0);
		bool flag = !string.IsNullOrEmpty(actionLabel);
		float num = (flag ? 390f : 300f);
		float num2 = ((Rect)(ref rowRect)).xMax - num - 16f;
		DrawActionRowText(rowRect, num2, title, description);
		float num3 = ((Rect)(ref rowRect)).y + 34f;
		if (GUI.Button(new Rect(num2, num3, 42f, 42f), "<", _buttonStyle))
		{
			ExecuteMenuAction(delegate
			{
				adjust(-1);
			});
		}
		DrawFramedBox(new Rect(num2 + 50f, num3, 160f, 42f), new Color(0.018f, 0.024f, 0.024f, 0.96f), new Color(0.24f, 0.23f, 0.18f, 0.9f));
		GUI.Label(new Rect(num2 + 56f, num3, 148f, 42f), T(value ?? string.Empty), _metaValueStyle);
		if (GUI.Button(new Rect(num2 + 218f, num3, 42f, 42f), ">", _buttonStyle))
		{
			ExecuteMenuAction(delegate
			{
				adjust(1);
			});
		}
		if (flag && GUI.Button(new Rect(num2 + 268f, num3, 122f, 42f), T(actionLabel), _buttonStyle))
		{
			ExecuteMenuAction(action);
		}
	}

	private void DrawPresetNamedActionRow(Rect rowRect, string title, string description, string actionLabel, Action action)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		DrawActionRowBackground(rowRect, title?.GetHashCode() ?? 0);
		float num = 390f;
		float num2 = ((Rect)(ref rowRect)).xMax - num - 16f;
		DrawActionRowText(rowRect, num2, title, description);
		GUI.SetNextControlName("CustomDifficultyPresetName");
		_presetNameText = GUI.TextField(new Rect(num2, ((Rect)(ref rowRect)).y + 34f, 250f, 42f), _presetNameText ?? string.Empty, 48, _fieldStyle);
		if (GUI.Button(new Rect(num2 + 258f, ((Rect)(ref rowRect)).y + 34f, 132f, 42f), T(actionLabel), _buttonStyle))
		{
			ExecuteMenuAction(action);
		}
	}

	private void DrawLanguageRow(Rect rowRect)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0208: Unknown result type (might be due to invalid IL or missing references)
		//IL_0249: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_029b: Unknown result type (might be due to invalid IL or missing references)
		DrawActionRowBackground(rowRect, 401);
		float num = 470f;
		float num2 = ((Rect)(ref rowRect)).xMax - num - 18f;
		DrawActionRowText(rowRect, num2, L("system_language_title", "IDIOMA DA INTERFACE"), L("system_language_desc", "Automático acompanha o idioma atual do jogo. Se o arquivo correspondente não existir, a interface usa inglês."));
		Rect rect = default(Rect);
		((Rect)(ref rect))..ctor(num2 + 54f, ((Rect)(ref rowRect)).y + 28f, 288f, 106f);
		DrawFramedBox(rect, new Color(0.018f, 0.032f, 0.032f, 0.99f), new Color(_currentSectionAccent.r, _currentSectionAccent.g, _currentSectionAccent.b, 0.82f));
		DrawSolidRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 5f, ((Rect)(ref rect)).height), _currentSectionAccent);
		DrawSolidRect(new Rect(((Rect)(ref rect)).x + 18f, ((Rect)(ref rect)).y + 19f, 9f, 9f), new Color(0.3f, 0.96f, 0.58f, 1f));
		GUI.Label(new Rect(((Rect)(ref rect)).x + 34f, ((Rect)(ref rect)).y + 7f, ((Rect)(ref rect)).width - 46f, 32f), L("system_status_active", "DEFINIDO") + "  ·  " + ((_localization != null) ? _localization.GetSelectedDisplayName() : "Automatic"), _metaTitleStyle);
		GUI.Label(new Rect(((Rect)(ref rect)).x + 18f, ((Rect)(ref rect)).y + 39f, ((Rect)(ref rect)).width - 36f, 54f), (_localization != null) ? _localization.GetSelectionSummary() : "Automatic → English", _metaValueStyle);
		if (GUI.Button(new Rect(num2, ((Rect)(ref rowRect)).y + 58f, 44f, 48f), "‹", _buttonStyle))
		{
			_localization.Cycle(-1);
		}
		if (GUI.Button(new Rect(num2 + 352f, ((Rect)(ref rowRect)).y + 58f, 44f, 48f), "›", _buttonStyle))
		{
			_localization.Cycle(1);
		}
		Color color = GUI.color;
		if (_localization != null && _localization.IsAutomatic)
		{
			GUI.color = new Color(0.72f, 1f, 0.78f, 1f);
		}
		if (GUI.Button(new Rect(num2 + 406f, ((Rect)(ref rowRect)).y + 58f, 64f, 48f), "AUTO", _buttonStyle))
		{
			_localization.SelectAutomatic();
		}
		GUI.color = color;
	}

	private void DrawLanguagePreviewRow(Rect rowRect)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: 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_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		DrawActionRowBackground(rowRect, 402);
		float num = 470f;
		float num2 = ((Rect)(ref rowRect)).xMax - num - 18f;
		DrawActionRowText(rowRect, num2, L("system_preview_title", "PRÉVIA DO IDIOMA"), L("system_preview_desc", "Esta amostra confirma visualmente o idioma aplicado e verifica letras acentuadas ou caracteres especiais."));
		Rect rect = default(Rect);
		((Rect)(ref rect))..ctor(num2, ((Rect)(ref rowRect)).y + 22f, num, 120f);