Decompiled source of CarlosMMOBosses v1.0.1

plugins/CarlosMMOBosses.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CarlosMMOBosses")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CarlosMMOBosses")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3a11544a-4046-45e1-93bc-9cf5849547ce")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CarlosMMO.Bosses;

[BepInPlugin("carlosmmo.bosses", "Carlos MMO Bosses", "6.0.2")]
public class CarlosMMOBossesPlugin : BaseUnityPlugin
{
	internal enum LegendarySetType
	{
		None,
		Eikthyr,
		Elder,
		Bonemass,
		Moder,
		Yagluth,
		Queen
	}

	internal enum DebuffKind
	{
		None,
		Bleed,
		Poison,
		Frost,
		Fire,
		Shock
	}

	internal sealed class DebuffState
	{
		public int TargetId;

		public WeakReference<Character> TargetRef;

		public DebuffKind Kind;

		public float DamagePerTick;

		public float TickInterval;

		public float NextTickTime;

		public float EndTime;

		public string SourceWeapon;
	}

	public const string ModGuid = "carlosmmo.bosses";

	public const string ModName = "Carlos MMO Bosses";

	public const string ModVersion = "6.0.2";

	internal static CarlosMMOBossesPlugin Instance;

	internal static ManualLogSource Logger;

	private readonly Harmony _harmony = new Harmony("carlosmmo.bosses");

	private ConfigEntry<bool> _modEnabled;

	private ConfigEntry<bool> _debugMode;

	private ConfigEntry<bool> _guardianLegendaryDropsEnabled;

	private ConfigEntry<bool> _showPlayerMessageOnGuardianKill;

	private ConfigEntry<bool> _enableVisualThemes;

	private ConfigEntry<bool> _enableSetBonuses;

	private ConfigEntry<bool> _enableWeaponEffects;

	private ConfigEntry<bool> _enableSetAura;

	private ConfigEntry<bool> _showDebugVisualMessages;

	private ConfigEntry<float> _setBonusTickInterval;

	private ConfigEntry<bool> _showSetDebug;

	private ConfigEntry<bool> _showHitDebug;

	private ConfigEntry<bool> _showProcDebug;

	private ConfigEntry<float> _setDebugCooldown;

	private ConfigEntry<float> _hitDebugCooldown;

	private ConfigEntry<float> _procDebugCooldown;

	private ConfigEntry<bool> _spawnHitSphereFx;

	private ConfigEntry<string> _eikthyrPrefabName;

	private ConfigEntry<string> _elderPrefabName;

	private ConfigEntry<string> _bonemassPrefabName;

	private ConfigEntry<string> _moderPrefabName;

	private ConfigEntry<string> _yagluthPrefabName;

	private ConfigEntry<string> _queenPrefabName;

	private ConfigEntry<int> _eikthyrExtraDropAmount;

	private ConfigEntry<int> _elderExtraDropAmount;

	private ConfigEntry<int> _bonemassExtraDropAmount;

	private ConfigEntry<int> _moderExtraDropAmount;

	private ConfigEntry<int> _yagluthExtraDropAmount;

	private ConfigEntry<int> _queenExtraDropAmount;

	public const string ItemEikthyrEssence = "Carlos_EssenciaEikthyr";

	public const string ItemElderRoot = "Carlos_RaizAncestral";

	public const string ItemBonemassCore = "Carlos_NucleoPutrido";

	public const string ItemModerHeart = "Carlos_CoracaoGlacial";

	public const string ItemYagluthFlame = "Carlos_ChamaTotemica";

	public const string ItemQueenEye = "Carlos_OlhoDaRainha";

	public const string ItemHelmThunder = "Carlos_HelmoDoTrovao";

	public const string ItemChestThunder = "Carlos_PeitoralDoTrovao";

	public const string ItemLegsThunder = "Carlos_CalcasDoTrovao";

	public const string ItemSwordThunder = "Carlos_LaminaDoTrovao";

	public const string ItemHelmElder = "Carlos_ElmoAncestral";

	public const string ItemChestElder = "Carlos_PeitoralAncestral";

	public const string ItemLegsElder = "Carlos_CalcasAncestrais";

	public const string ItemBowElder = "Carlos_ArcoAncestral";

	public const string ItemHelmBonemass = "Carlos_ElmoPutrido";

	public const string ItemChestBonemass = "Carlos_PeitoralPutrido";

	public const string ItemLegsBonemass = "Carlos_CalcasPutridas";

	public const string ItemMaceBonemass = "Carlos_MacaPutrida";

	public const string ItemHelmModer = "Carlos_ElmoGlacial";

	public const string ItemChestModer = "Carlos_PeitoralGlacial";

	public const string ItemLegsModer = "Carlos_CalcasGlaciais";

	public const string ItemSwordModer = "Carlos_EspadaGlacial";

	public const string ItemHelmYagluth = "Carlos_ElmoTotemico";

	public const string ItemChestYagluth = "Carlos_PeitoralTotemico";

	public const string ItemLegsYagluth = "Carlos_CalcasTotemicas";

	public const string ItemSwordYagluth = "Carlos_LaminaTotemica";

	public const string ItemHelmQueen = "Carlos_ElmoDaRainha";

	public const string ItemChestQueen = "Carlos_PeitoralDaRainha";

	public const string ItemLegsQueen = "Carlos_CalcasDaRainha";

	public const string ItemCrossbowQueen = "Carlos_BestaDaRainha";

	private readonly HashSet<int> _processedDeaths = new HashSet<int>();

	private bool _materialsRegistered;

	private bool _eikthyrGearRegistered;

	private bool _elderGearRegistered;

	private bool _bonemassGearRegistered;

	private bool _moderGearRegistered;

	private bool _yagluthGearRegistered;

	private bool _queenGearRegistered;

	private bool _visualsApplied;

	private float _nextSetBonusTickTime;

	private float _nextSetDebugMessageTime;

	private float _nextHitDebugMessageTime;

	private float _nextProcDebugMessageTime;

	private LegendarySetType _lastDetectedSet = LegendarySetType.None;

	private GameObject _setAuraObject;

	private Light _setAuraLight;

	internal static LegendarySetType ActiveLocalSet = LegendarySetType.None;

	internal static bool SuppressWeaponProc;

	internal static readonly Dictionary<int, DebuffState> ActiveDebuffs = new Dictionary<int, DebuffState>();

	private void Awake()
	{
		Instance = this;
		Logger = ((BaseUnityPlugin)this).Logger;
		LoadConfig();
		if (!_modEnabled.Value)
		{
			Logger.LogInfo((object)"Carlos MMO Bosses desativado na configuração.");
			return;
		}
		Logger.LogInfo((object)"==============================================");
		Logger.LogInfo((object)"Carlos MMO Bosses 6.0.2 carregando...");
		Logger.LogInfo((object)"Sistema de Guardiões Lendários + Materiais + Receitas + Visual + Set Bonus + Weapon Effects + Debug Visual iniciado.");
		Logger.LogInfo((object)"==============================================");
		try
		{
			PrefabManager.OnVanillaPrefabsAvailable += RegisterLegendaryMaterialsAndGear;
			ApplyHarmonyPatches();
			LogGuardianSetup();
			Logger.LogInfo((object)"Carlos MMO Bosses: carregado com sucesso.");
		}
		catch (Exception ex)
		{
			Logger.LogError((object)"Carlos MMO Bosses: erro ao iniciar plugin.");
			Logger.LogError((object)ex);
		}
	}

	private void OnDestroy()
	{
		try
		{
			PrefabManager.OnVanillaPrefabsAvailable -= RegisterLegendaryMaterialsAndGear;
			_harmony.UnpatchSelf();
			DestroySetAura();
			ActiveDebuffs.Clear();
			Logger.LogInfo((object)"Carlos MMO Bosses: patches removidos.");
		}
		catch (Exception ex)
		{
			Logger.LogError((object)"Carlos MMO Bosses: erro ao destruir plugin.");
			Logger.LogError((object)ex);
		}
	}

	private void Update()
	{
		if (!_modEnabled.Value)
		{
			return;
		}
		if (_enableVisualThemes.Value && !_visualsApplied && ((Object)(object)ObjectDB.instance != (Object)null || (Object)(object)ZNetScene.instance != (Object)null))
		{
			try
			{
				ApplyAllLegendaryVisualThemes();
				_visualsApplied = true;
				Logger.LogInfo((object)"Visual temático dos sets lendários aplicado com sucesso.");
			}
			catch (Exception ex)
			{
				Logger.LogError((object)"Erro ao aplicar visual temático dos sets lendários.");
				Logger.LogError((object)ex);
			}
		}
		if (_enableSetBonuses.Value)
		{
			try
			{
				UpdateLocalPlayerSetBonus();
			}
			catch (Exception ex2)
			{
				Logger.LogError((object)"Erro ao atualizar bônus de set.");
				Logger.LogError((object)ex2);
			}
		}
		if (!_enableWeaponEffects.Value)
		{
			return;
		}
		try
		{
			UpdateActiveDebuffs();
		}
		catch (Exception ex3)
		{
			Logger.LogError((object)"Erro ao atualizar debuffs ativos.");
			Logger.LogError((object)ex3);
		}
	}

	private void LoadConfig()
	{
		_modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - Geral", "ModEnabled", true, "Ativa ou desativa o plugin Carlos MMO Bosses.");
		_debugMode = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - Geral", "DebugMode", true, "Ativa logs extras de depuração.");
		_guardianLegendaryDropsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - Geral", "GuardianLegendaryDropsEnabled", true, "Ativa o sistema de drops extras dos guardiões vanilla.");
		_showPlayerMessageOnGuardianKill = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - Geral", "ShowPlayerMessageOnGuardianKill", true, "Mostra mensagem na tela ao matar um guardião e receber drop extra.");
		_enableVisualThemes = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - Geral", "EnableVisualThemes", true, "Ativa aplicação de visual temático nos sets e armas lendárias.");
		_enableSetBonuses = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - Geral", "EnableSetBonuses", true, "Ativa bônus de set ao equipar 3 peças do mesmo guardião.");
		_enableWeaponEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - Geral", "EnableWeaponEffects", true, "Ativa efeitos especiais das armas lendárias no impacto.");
		_enableSetAura = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - Geral", "EnableSetAura", true, "Ativa uma aura de luz leve no jogador quando o bônus de set está ativo.");
		_showDebugVisualMessages = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - Geral", "ShowDebugVisualMessages", true, "Ativa o sistema visual de debug na tela.");
		_setBonusTickInterval = ((BaseUnityPlugin)this).Config.Bind<float>("1 - Geral", "SetBonusTickInterval", 1.5f, "Intervalo em segundos dos ticks de bônus passivos de set.");
		_showSetDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - Geral", "ShowSetDebug", true, "Mostra debug visual do set: SET ON / SET OFF.");
		_showHitDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - Geral", "ShowHitDebug", true, "Mostra debug visual HIT ao acertar inimigos com armas lendárias.");
		_showProcDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - Geral", "ShowProcDebug", true, "Mostra debug visual PROC quando o efeito especial da arma dispara.");
		_setDebugCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("1 - Geral", "SetDebugCooldown", 0.15f, "Cooldown em segundos das mensagens visuais de SET.");
		_hitDebugCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("1 - Geral", "HitDebugCooldown", 0.08f, "Cooldown em segundos das mensagens visuais de HIT.");
		_procDebugCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("1 - Geral", "ProcDebugCooldown", 0.1f, "Cooldown em segundos das mensagens visuais de PROC.");
		_spawnHitSphereFx = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - Geral", "SpawnHitSphereFx", true, "Cria uma esfera visual temporária no ponto do HIT / PROC.");
		_eikthyrPrefabName = ((BaseUnityPlugin)this).Config.Bind<string>("2 - Guardiões", "EikthyrPrefabName", "Eikthyr", "Nome interno do prefab do Eikthyr.");
		_elderPrefabName = ((BaseUnityPlugin)this).Config.Bind<string>("2 - Guardiões", "ElderPrefabName", "gd_king", "Nome interno do prefab do The Elder.");
		_bonemassPrefabName = ((BaseUnityPlugin)this).Config.Bind<string>("2 - Guardiões", "BonemassPrefabName", "Bonemass", "Nome interno do prefab do Bonemass.");
		_moderPrefabName = ((BaseUnityPlugin)this).Config.Bind<string>("2 - Guardiões", "ModerPrefabName", "Dragon", "Nome interno do prefab da Moder.");
		_yagluthPrefabName = ((BaseUnityPlugin)this).Config.Bind<string>("2 - Guardiões", "YagluthPrefabName", "GoblinKing", "Nome interno do prefab do Yagluth.");
		_queenPrefabName = ((BaseUnityPlugin)this).Config.Bind<string>("2 - Guardiões", "QueenPrefabName", "SeekerQueen", "Nome interno do prefab da Queen.");
		_eikthyrExtraDropAmount = ((BaseUnityPlugin)this).Config.Bind<int>("3 - Drop Lendário Eikthyr", "ExtraDropAmount", 3, "Quantidade do material lendário do Eikthyr.");
		_elderExtraDropAmount = ((BaseUnityPlugin)this).Config.Bind<int>("4 - Drop Lendário Elder", "ExtraDropAmount", 3, "Quantidade do material lendário do Elder.");
		_bonemassExtraDropAmount = ((BaseUnityPlugin)this).Config.Bind<int>("5 - Drop Lendário Bonemass", "ExtraDropAmount", 3, "Quantidade do material lendário do Bonemass.");
		_moderExtraDropAmount = ((BaseUnityPlugin)this).Config.Bind<int>("6 - Drop Lendário Moder", "ExtraDropAmount", 3, "Quantidade do material lendário da Moder.");
		_yagluthExtraDropAmount = ((BaseUnityPlugin)this).Config.Bind<int>("7 - Drop Lendário Yagluth", "ExtraDropAmount", 3, "Quantidade do material lendário do Yagluth.");
		_queenExtraDropAmount = ((BaseUnityPlugin)this).Config.Bind<int>("8 - Drop Lendário Queen", "ExtraDropAmount", 3, "Quantidade do material lendário da Queen.");
	}

	private void ApplyHarmonyPatches()
	{
		_harmony.PatchAll(typeof(CharacterDeathPatch));
		_harmony.PatchAll(typeof(CharacterDamagePatch));
		TryPatchOptionalSpeedMethod("GetJogSpeedFactor", "Postfix");
		TryPatchOptionalSpeedMethod("GetRunSpeedFactor", "Postfix");
		Logger.LogInfo((object)"Harmony patches aplicados.");
	}

	private void TryPatchOptionalSpeedMethod(string methodName, string postfixMethodName)
	{
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Expected O, but got Unknown
		try
		{
			MethodInfo methodInfo = AccessTools.Method(typeof(Player), methodName, (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(PlayerSpeedPatch), postfixMethodName, (Type[])null, (Type[])null);
			if (methodInfo != null && methodInfo2 != null)
			{
				_harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				Logger.LogInfo((object)("Patch opcional aplicado em Player." + methodName));
			}
			else if (_debugMode.Value)
			{
				Logger.LogWarning((object)("Método opcional Player." + methodName + " não encontrado. Speed bonus ficará parcial."));
			}
		}
		catch (Exception ex)
		{
			Logger.LogWarning((object)("Falha ao aplicar patch opcional de velocidade em " + methodName + ": " + ex.Message));
		}
	}

	private void LogGuardianSetup()
	{
		Logger.LogInfo((object)"Guardiões configurados:");
		Logger.LogInfo((object)("Eikthyr = " + _eikthyrPrefabName.Value));
		Logger.LogInfo((object)("Elder   = " + _elderPrefabName.Value));
		Logger.LogInfo((object)("Bonemass= " + _bonemassPrefabName.Value));
		Logger.LogInfo((object)("Moder   = " + _moderPrefabName.Value));
		Logger.LogInfo((object)("Yagluth = " + _yagluthPrefabName.Value));
		Logger.LogInfo((object)("Queen   = " + _queenPrefabName.Value));
	}

	private void RegisterLegendaryMaterialsAndGear()
	{
		RegisterLegendaryMaterials();
		RegisterEikthyrLegendaryGear();
		RegisterElderLegendaryGear();
		RegisterBonemassLegendaryGear();
		RegisterModerLegendaryGear();
		RegisterYagluthLegendaryGear();
		RegisterQueenLegendaryGear();
		PrefabManager.OnVanillaPrefabsAvailable -= RegisterLegendaryMaterialsAndGear;
	}

	private void RegisterLegendaryMaterials()
	{
		if (_materialsRegistered)
		{
			return;
		}
		try
		{
			Logger.LogInfo((object)"Registrando materiais lendários Carlos MMO...");
			AddLegendaryMaterial("Carlos_EssenciaEikthyr", "AmberPearl", "Essência de Eikthyr", "Material lendário obtido ao derrotar Eikthyr. Usado em equipamentos do próximo salto de poder.", 50, 0.3f);
			AddLegendaryMaterial("Carlos_RaizAncestral", "ElderBark", "Raiz Ancestral", "Material lendário obtido ao derrotar The Elder. Base para armaduras e armas do próximo bioma.", 50, 0.8f);
			AddLegendaryMaterial("Carlos_NucleoPutrido", "WitheredBone", "Núcleo Putrido", "Material lendário obtido ao derrotar Bonemass. Carrega força podre e resistência brutal.", 50, 1f);
			AddLegendaryMaterial("Carlos_CoracaoGlacial", "FreezeGland", "Coração Glacial", "Material lendário obtido ao derrotar Moder. Essência dracônica congelada para forja avançada.", 50, 0.8f);
			AddLegendaryMaterial("Carlos_ChamaTotemica", "BlackMetal", "Chama Totêmica", "Material lendário obtido ao derrotar Yagluth. Poder ancestral para armas e sets lendários.", 50, 1.2f);
			AddLegendaryMaterial("Carlos_OlhoDaRainha", "RoyalJelly", "Olho da Rainha", "Material lendário obtido ao derrotar a Queen. Item raro de elite para o endgame Carlos MMO.", 50, 0.7f);
			_materialsRegistered = true;
			Logger.LogInfo((object)"Materiais lendários registrados com sucesso.");
		}
		catch (Exception ex)
		{
			Logger.LogError((object)"Erro ao registrar materiais lendários.");
			Logger.LogError((object)ex);
		}
	}

	private void RegisterEikthyrLegendaryGear()
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Expected O, but got Unknown
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Expected O, but got Unknown
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Expected O, but got Unknown
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Expected O, but got Unknown
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Expected O, but got Unknown
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Expected O, but got Unknown
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Expected O, but got Unknown
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Expected O, but got Unknown
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Expected O, but got Unknown
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Expected O, but got Unknown
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Expected O, but got Unknown
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Expected O, but got Unknown
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Expected O, but got Unknown
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Expected O, but got Unknown
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Expected O, but got Unknown
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Expected O, but got Unknown
		if (_eikthyrGearRegistered)
		{
			return;
		}
		try
		{
			Logger.LogInfo((object)"Registrando set lendário inicial de Eikthyr...");
			AddCraftableArmor("Carlos_HelmoDoTrovao", "HelmetLeather", "Helmo do Trovão", "Helmo lendário forjado com a Essência de Eikthyr.", "piece_workbench", 2, 1, 1.5f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_EssenciaEikthyr", 3, 0, true),
				new RequirementConfig("DeerHide", 8, 0, true),
				new RequirementConfig("BoneFragments", 5, 0, true),
				new RequirementConfig("LeatherScraps", 4, 0, true)
			});
			AddCraftableArmor("Carlos_PeitoralDoTrovao", "ArmorLeatherChest", "Peitoral do Trovão", "Peitoral lendário de poder bruto para a próxima etapa da jornada.", "piece_workbench", 2, 1, 4f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_EssenciaEikthyr", 5, 0, true),
				new RequirementConfig("DeerHide", 12, 0, true),
				new RequirementConfig("BoneFragments", 6, 0, true),
				new RequirementConfig("LeatherScraps", 8, 0, true)
			});
			AddCraftableArmor("Carlos_CalcasDoTrovao", "ArmorLeatherLegs", "Calças do Trovão", "Calças lendárias feitas para dar mobilidade e resistência no começo do MMO.", "piece_workbench", 2, 1, 3f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_EssenciaEikthyr", 4, 0, true),
				new RequirementConfig("DeerHide", 10, 0, true),
				new RequirementConfig("BoneFragments", 4, 0, true),
				new RequirementConfig("LeatherScraps", 6, 0, true)
			});
			AddCraftableWeapon("Carlos_LaminaDoTrovao", "SwordBronze", "Lâmina do Trovão", "Espada lendária inicial energizada pela Essência de Eikthyr.", "piece_workbench", 2, 1, 2f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_EssenciaEikthyr", 6, 0, true),
				new RequirementConfig("Wood", 8, 0, true),
				new RequirementConfig("Bronze", 10, 0, true),
				new RequirementConfig("DeerHide", 2, 0, true)
			});
			_eikthyrGearRegistered = true;
			Logger.LogInfo((object)"Set lendário inicial de Eikthyr registrado com sucesso.");
		}
		catch (Exception ex)
		{
			Logger.LogError((object)"Erro ao registrar gear lendário de Eikthyr.");
			Logger.LogError((object)ex);
		}
	}

	private void RegisterElderLegendaryGear()
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Expected O, but got Unknown
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Expected O, but got Unknown
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Expected O, but got Unknown
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Expected O, but got Unknown
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Expected O, but got Unknown
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Expected O, but got Unknown
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Expected O, but got Unknown
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Expected O, but got Unknown
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Expected O, but got Unknown
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Expected O, but got Unknown
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Expected O, but got Unknown
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Expected O, but got Unknown
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Expected O, but got Unknown
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Expected O, but got Unknown
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Expected O, but got Unknown
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Expected O, but got Unknown
		if (_elderGearRegistered)
		{
			return;
		}
		try
		{
			Logger.LogInfo((object)"Registrando set lendário do Elder...");
			AddCraftableArmor("Carlos_ElmoAncestral", "HelmetBronze", "Elmo Ancestral", "Elmo lendário moldado com a força viva do Elder.", "piece_workbench", 3, 1, 2f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_RaizAncestral", 4, 0, true),
				new RequirementConfig("Bronze", 8, 0, true),
				new RequirementConfig("ElderBark", 10, 0, true),
				new RequirementConfig("FineWood", 6, 0, true)
			});
			AddCraftableArmor("Carlos_PeitoralAncestral", "ArmorBronzeChest", "Peitoral Ancestral", "Peitoral pesado com madeira viva e metal forjado para atravessar o próximo bioma.", "piece_workbench", 3, 1, 5f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_RaizAncestral", 6, 0, true),
				new RequirementConfig("Bronze", 14, 0, true),
				new RequirementConfig("ElderBark", 14, 0, true),
				new RequirementConfig("FineWood", 10, 0, true)
			});
			AddCraftableArmor("Carlos_CalcasAncestrais", "ArmorBronzeLegs", "Calças Ancestrais", "Calças lendárias com defesa reforçada e mobilidade para exploração brutal.", "piece_workbench", 3, 1, 4f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_RaizAncestral", 5, 0, true),
				new RequirementConfig("Bronze", 10, 0, true),
				new RequirementConfig("ElderBark", 12, 0, true),
				new RequirementConfig("FineWood", 8, 0, true)
			});
			AddCraftableWeapon("Carlos_ArcoAncestral", "BowFineWood", "Arco Ancestral", "Arco lendário do Elder, feito para esmagar o progresso do próximo bioma.", "piece_workbench", 3, 1, 2f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_RaizAncestral", 7, 0, true),
				new RequirementConfig("FineWood", 14, 0, true),
				new RequirementConfig("Bronze", 8, 0, true),
				new RequirementConfig("DeerHide", 4, 0, true)
			});
			_elderGearRegistered = true;
			Logger.LogInfo((object)"Set lendário do Elder registrado com sucesso.");
		}
		catch (Exception ex)
		{
			Logger.LogError((object)"Erro ao registrar gear lendário do Elder.");
			Logger.LogError((object)ex);
		}
	}

	private void RegisterBonemassLegendaryGear()
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Expected O, but got Unknown
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Expected O, but got Unknown
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Expected O, but got Unknown
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Expected O, but got Unknown
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Expected O, but got Unknown
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Expected O, but got Unknown
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Expected O, but got Unknown
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Expected O, but got Unknown
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Expected O, but got Unknown
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Expected O, but got Unknown
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Expected O, but got Unknown
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Expected O, but got Unknown
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Expected O, but got Unknown
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Expected O, but got Unknown
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Expected O, but got Unknown
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Expected O, but got Unknown
		if (_bonemassGearRegistered)
		{
			return;
		}
		try
		{
			Logger.LogInfo((object)"Registrando set lendário do Bonemass...");
			AddCraftableArmor("Carlos_ElmoPutrido", "HelmetIron", "Elmo Putrido", "Elmo lendário marcado pela força apodrecida de Bonemass.", "piece_workbench", 4, 1, 2.5f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_NucleoPutrido", 4, 0, true),
				new RequirementConfig("Iron", 10, 0, true),
				new RequirementConfig("WitheredBone", 8, 0, true),
				new RequirementConfig("Guck", 6, 0, true)
			});
			AddCraftableArmor("Carlos_PeitoralPutrido", "ArmorIronChest", "Peitoral Putrido", "Peitoral brutal forjado com ferro, ossos secos e núcleo pútrido.", "piece_workbench", 4, 1, 6f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_NucleoPutrido", 6, 0, true),
				new RequirementConfig("Iron", 16, 0, true),
				new RequirementConfig("WitheredBone", 12, 0, true),
				new RequirementConfig("Guck", 8, 0, true)
			});
			AddCraftableArmor("Carlos_CalcasPutridas", "ArmorIronLegs", "Calças Putridas", "Calças lendárias pesadas para tankar o caos do próximo avanço.", "piece_workbench", 4, 1, 5f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_NucleoPutrido", 5, 0, true),
				new RequirementConfig("Iron", 12, 0, true),
				new RequirementConfig("WitheredBone", 10, 0, true),
				new RequirementConfig("Guck", 6, 0, true)
			});
			AddCraftableWeapon("Carlos_MacaPutrida", "MaceIron", "Maça Putrida", "Maça lendária de impacto bruto alimentada pelo Núcleo Putrido.", "piece_workbench", 4, 1, 2.5f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_NucleoPutrido", 7, 0, true),
				new RequirementConfig("Iron", 14, 0, true),
				new RequirementConfig("WitheredBone", 10, 0, true),
				new RequirementConfig("AncientSeed", 1, 0, true)
			});
			_bonemassGearRegistered = true;
			Logger.LogInfo((object)"Set lendário do Bonemass registrado com sucesso.");
		}
		catch (Exception ex)
		{
			Logger.LogError((object)"Erro ao registrar gear lendário do Bonemass.");
			Logger.LogError((object)ex);
		}
	}

	private void RegisterModerLegendaryGear()
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Expected O, but got Unknown
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Expected O, but got Unknown
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Expected O, but got Unknown
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Expected O, but got Unknown
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Expected O, but got Unknown
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Expected O, but got Unknown
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Expected O, but got Unknown
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Expected O, but got Unknown
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Expected O, but got Unknown
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Expected O, but got Unknown
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Expected O, but got Unknown
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Expected O, but got Unknown
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Expected O, but got Unknown
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Expected O, but got Unknown
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Expected O, but got Unknown
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Expected O, but got Unknown
		if (_moderGearRegistered)
		{
			return;
		}
		try
		{
			Logger.LogInfo((object)"Registrando set lendário da Moder...");
			AddCraftableArmor("Carlos_ElmoGlacial", "HelmetIron", "Elmo Glacial", "Elmo lendário imbuído com a soberania fria da Moder.", "piece_workbench", 5, 1, 2.5f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_CoracaoGlacial", 4, 0, true),
				new RequirementConfig("Silver", 10, 0, true),
				new RequirementConfig("WolfPelt", 8, 0, true),
				new RequirementConfig("FreezeGland", 6, 0, true)
			});
			AddCraftableArmor("Carlos_PeitoralGlacial", "ArmorWolfChest", "Peitoral Glacial", "Peitoral dracônico gelado para guerra em terras altas.", "piece_workbench", 5, 1, 5.5f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_CoracaoGlacial", 6, 0, true),
				new RequirementConfig("Silver", 16, 0, true),
				new RequirementConfig("WolfPelt", 12, 0, true),
				new RequirementConfig("FreezeGland", 10, 0, true)
			});
			AddCraftableArmor("Carlos_CalcasGlaciais", "ArmorWolfLegs", "Calças Glaciais", "Calças lendárias frias como o sopro da rainha dracônica.", "piece_workbench", 5, 1, 4.5f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_CoracaoGlacial", 5, 0, true),
				new RequirementConfig("Silver", 12, 0, true),
				new RequirementConfig("WolfPelt", 10, 0, true),
				new RequirementConfig("Obsidian", 8, 0, true)
			});
			AddCraftableWeapon("Carlos_EspadaGlacial", "SwordSilver", "Espada Glacial", "Espada lendária de prata banhada em coração glacial.", "piece_workbench", 5, 1, 2.5f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_CoracaoGlacial", 7, 0, true),
				new RequirementConfig("Silver", 18, 0, true),
				new RequirementConfig("FreezeGland", 8, 0, true),
				new RequirementConfig("Crystal", 4, 0, true)
			});
			_moderGearRegistered = true;
			Logger.LogInfo((object)"Set lendário da Moder registrado com sucesso.");
		}
		catch (Exception ex)
		{
			Logger.LogError((object)"Erro ao registrar gear lendário da Moder.");
			Logger.LogError((object)ex);
		}
	}

	private void RegisterYagluthLegendaryGear()
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Expected O, but got Unknown
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Expected O, but got Unknown
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Expected O, but got Unknown
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Expected O, but got Unknown
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Expected O, but got Unknown
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Expected O, but got Unknown
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Expected O, but got Unknown
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Expected O, but got Unknown
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Expected O, but got Unknown
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Expected O, but got Unknown
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Expected O, but got Unknown
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Expected O, but got Unknown
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Expected O, but got Unknown
		//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: Expected O, but got Unknown
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c9: Expected O, but got Unknown
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Expected O, but got Unknown
		if (_yagluthGearRegistered)
		{
			return;
		}
		try
		{
			Logger.LogInfo((object)"Registrando set lendário do Yagluth...");
			AddCraftableArmor("Carlos_ElmoTotemico", "HelmetPadded", "Elmo Totêmico", "Elmo lendário de rei maldito, marcado por fogo ancestral.", "piece_workbench", 6, 1, 3f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_ChamaTotemica", 4, 0, true),
				new RequirementConfig("BlackMetal", 10, 0, true),
				new RequirementConfig("LinenThread", 10, 0, true),
				new RequirementConfig("Tar", 6, 0, true)
			});
			AddCraftableArmor("Carlos_PeitoralTotemico", "ArmorPaddedCuirass", "Peitoral Totêmico", "Peitoral lendário de poder sombrio e majestade destrutiva.", "piece_workbench", 6, 1, 6f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_ChamaTotemica", 6, 0, true),
				new RequirementConfig("BlackMetal", 16, 0, true),
				new RequirementConfig("LinenThread", 14, 0, true),
				new RequirementConfig("Tar", 10, 0, true)
			});
			AddCraftableArmor("Carlos_CalcasTotemicas", "ArmorPaddedGreaves", "Calças Totêmicas", "Calças lendárias reforçadas para o auge do caos.", "piece_workbench", 6, 1, 5f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_ChamaTotemica", 5, 0, true),
				new RequirementConfig("BlackMetal", 12, 0, true),
				new RequirementConfig("LinenThread", 12, 0, true),
				new RequirementConfig("Needle", 10, 0, true)
			});
			AddCraftableWeapon("Carlos_LaminaTotemica", "SwordBlackmetal", "Lâmina Totêmica", "Lâmina lendária incendiada pelo domínio de Yagluth.", "piece_workbench", 6, 1, 2.8f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_ChamaTotemica", 7, 0, true),
				new RequirementConfig("BlackMetal", 18, 0, true),
				new RequirementConfig("LinenThread", 8, 0, true),
				new RequirementConfig("Tar", 8, 0, true)
			});
			_yagluthGearRegistered = true;
			Logger.LogInfo((object)"Set lendário do Yagluth registrado com sucesso.");
		}
		catch (Exception ex)
		{
			Logger.LogError((object)"Erro ao registrar gear lendário do Yagluth.");
			Logger.LogError((object)ex);
		}
	}

	private void RegisterQueenLegendaryGear()
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Expected O, but got Unknown
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Expected O, but got Unknown
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Expected O, but got Unknown
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Expected O, but got Unknown
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Expected O, but got Unknown
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Expected O, but got Unknown
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Expected O, but got Unknown
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Expected O, but got Unknown
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Expected O, but got Unknown
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Expected O, but got Unknown
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Expected O, but got Unknown
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Expected O, but got Unknown
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a7: Expected O, but got Unknown
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Expected O, but got Unknown
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c9: Expected O, but got Unknown
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Expected O, but got Unknown
		if (_queenGearRegistered)
		{
			return;
		}
		try
		{
			Logger.LogInfo((object)"Registrando set lendário da Queen...");
			AddCraftableArmor("Carlos_ElmoDaRainha", "HelmetCarapace", "Elmo da Rainha", "Elmo lendário de elite com carapaça nobre e brilho raro.", "piece_workbench", 7, 1, 3f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_OlhoDaRainha", 4, 0, true),
				new RequirementConfig("Carapace", 10, 0, true),
				new RequirementConfig("RoyalJelly", 10, 0, true),
				new RequirementConfig("Softtissue", 6, 0, true)
			});
			AddCraftableArmor("Carlos_PeitoralDaRainha", "ArmorCarapaceChest", "Peitoral da Rainha", "Peitoral lendário quitinoso de domínio absoluto do endgame.", "piece_workbench", 7, 1, 6.5f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_OlhoDaRainha", 6, 0, true),
				new RequirementConfig("Carapace", 16, 0, true),
				new RequirementConfig("RoyalJelly", 14, 0, true),
				new RequirementConfig("Softtissue", 10, 0, true)
			});
			AddCraftableArmor("Carlos_CalcasDaRainha", "ArmorCarapaceLegs", "Calças da Rainha", "Calças lendárias de carapaça real para a fase suprema.", "piece_workbench", 7, 1, 5.5f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_OlhoDaRainha", 5, 0, true),
				new RequirementConfig("Carapace", 12, 0, true),
				new RequirementConfig("RoyalJelly", 12, 0, true),
				new RequirementConfig("BlackCore", 2, 0, true)
			});
			AddCraftableWeapon("Carlos_BestaDaRainha", "CrossbowArbalest", "Besta da Rainha", "Besta lendária de perfuração brutal feita para esmagar o final do jogo.", "piece_workbench", 7, 1, 3f, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Carlos_OlhoDaRainha", 7, 0, true),
				new RequirementConfig("Carapace", 14, 0, true),
				new RequirementConfig("RoyalJelly", 10, 0, true),
				new RequirementConfig("BlackCore", 3, 0, true)
			});
			_queenGearRegistered = true;
			Logger.LogInfo((object)"Set lendário da Queen registrado com sucesso.");
		}
		catch (Exception ex)
		{
			Logger.LogError((object)"Erro ao registrar gear lendário da Queen.");
			Logger.LogError((object)ex);
		}
	}

	private void AddLegendaryMaterial(string internalName, string cloneFromPrefab, string displayName, string description, int stackSize, float weight)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Expected O, but got Unknown
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		ItemConfig val = new ItemConfig
		{
			Name = displayName,
			Description = description,
			Enabled = false,
			StackSize = stackSize,
			Weight = weight
		};
		CustomItem val2 = new CustomItem(internalName, cloneFromPrefab, val);
		ItemManager.Instance.AddItem(val2);
		Logger.LogInfo((object)("Material lendário registrado: " + internalName + " (base: " + cloneFromPrefab + ")"));
	}

	private void AddCraftableArmor(string internalName, string cloneFromPrefab, string displayName, string description, string station, int minStationLevel, int stackSize, float weight, RequirementConfig[] recipeRequirements)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Expected O, but got Unknown
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Expected O, but got Unknown
		ItemConfig val = new ItemConfig
		{
			Name = displayName,
			Description = description,
			CraftingStation = station,
			MinStationLevel = minStationLevel,
			Requirements = recipeRequirements,
			Weight = weight,
			StackSize = stackSize
		};
		CustomItem val2 = new CustomItem(internalName, cloneFromPrefab, val);
		ItemManager.Instance.AddItem(val2);
		Logger.LogInfo((object)("Armadura registrada: " + internalName + " (base: " + cloneFromPrefab + ")"));
	}

	private void AddCraftableWeapon(string internalName, string cloneFromPrefab, string displayName, string description, string station, int minStationLevel, int stackSize, float weight, RequirementConfig[] recipeRequirements)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Expected O, but got Unknown
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Expected O, but got Unknown
		ItemConfig val = new ItemConfig
		{
			Name = displayName,
			Description = description,
			CraftingStation = station,
			MinStationLevel = minStationLevel,
			Requirements = recipeRequirements,
			Weight = weight,
			StackSize = stackSize
		};
		CustomItem val2 = new CustomItem(internalName, cloneFromPrefab, val);
		ItemManager.Instance.AddItem(val2);
		Logger.LogInfo((object)("Arma registrada: " + internalName + " (base: " + cloneFromPrefab + ")"));
	}

	private void ApplyAllLegendaryVisualThemes()
	{
		ThemeSetEikthyr();
		ThemeSetElder();
		ThemeSetBonemass();
		ThemeSetModer();
		ThemeSetYagluth();
		ThemeSetQueen();
	}

	private void ThemeSetEikthyr()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: 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_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: 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_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		Color primaryColor = default(Color);
		((Color)(ref primaryColor))..ctor(0.38f, 0.3f, 0.18f);
		Color emissionColor = default(Color);
		((Color)(ref emissionColor))..ctor(0.08f, 0.1f, 0.12f);
		ThemeItemPrefab("Carlos_HelmoDoTrovao", primaryColor, emissionColor, 0.8f, 0.35f);
		ThemeItemPrefab("Carlos_PeitoralDoTrovao", primaryColor, emissionColor, 0.8f, 0.35f);
		ThemeItemPrefab("Carlos_CalcasDoTrovao", primaryColor, emissionColor, 0.8f, 0.35f);
		ThemeItemPrefab("Carlos_LaminaDoTrovao", new Color(0.45f, 0.35f, 0.2f), new Color(0.1f, 0.12f, 0.15f), 0.9f, 0.45f);
	}

	private void ThemeSetElder()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: 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_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		Color primaryColor = default(Color);
		((Color)(ref primaryColor))..ctor(0.18f, 0.24f, 0.16f);
		Color emissionColor = default(Color);
		((Color)(ref emissionColor))..ctor(0.04f, 0.06f, 0.03f);
		ThemeItemPrefab("Carlos_ElmoAncestral", primaryColor, emissionColor, 0.35f, 0.25f);
		ThemeItemPrefab("Carlos_PeitoralAncestral", new Color(0.22f, 0.2f, 0.14f), emissionColor, 0.3f, 0.28f);
		ThemeItemPrefab("Carlos_CalcasAncestrais", primaryColor, emissionColor, 0.3f, 0.25f);
		ThemeItemPrefab("Carlos_ArcoAncestral", new Color(0.28f, 0.2f, 0.12f), new Color(0.05f, 0.07f, 0.04f), 0.15f, 0.3f);
	}

	private void ThemeSetBonemass()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		Color primaryColor = default(Color);
		((Color)(ref primaryColor))..ctor(0.16f, 0.2f, 0.14f);
		Color emissionColor = default(Color);
		((Color)(ref emissionColor))..ctor(0.03f, 0.05f, 0.02f);
		ThemeItemPrefab("Carlos_ElmoPutrido", primaryColor, emissionColor, 0.3f, 0.2f);
		ThemeItemPrefab("Carlos_PeitoralPutrido", new Color(0.12f, 0.14f, 0.1f), emissionColor, 0.3f, 0.18f);
		ThemeItemPrefab("Carlos_CalcasPutridas", new Color(0.14f, 0.16f, 0.12f), emissionColor, 0.28f, 0.18f);
		ThemeItemPrefab("Carlos_MacaPutrida", new Color(0.28f, 0.3f, 0.2f), new Color(0.04f, 0.06f, 0.02f), 0.45f, 0.3f);
	}

	private void ThemeSetModer()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: 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_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		Color primaryColor = default(Color);
		((Color)(ref primaryColor))..ctor(0.55f, 0.6f, 0.65f);
		Color emissionColor = default(Color);
		((Color)(ref emissionColor))..ctor(0.08f, 0.1f, 0.15f);
		ThemeItemPrefab("Carlos_ElmoGlacial", primaryColor, emissionColor, 0.85f, 0.5f);
		ThemeItemPrefab("Carlos_PeitoralGlacial", new Color(0.6f, 0.65f, 0.7f), emissionColor, 0.85f, 0.5f);
		ThemeItemPrefab("Carlos_CalcasGlaciais", primaryColor, emissionColor, 0.8f, 0.48f);
		ThemeItemPrefab("Carlos_EspadaGlacial", new Color(0.7f, 0.75f, 0.8f), new Color(0.1f, 0.12f, 0.18f), 0.9f, 0.6f);
	}

	private void ThemeSetYagluth()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: 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_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		Color primaryColor = default(Color);
		((Color)(ref primaryColor))..ctor(0.25f, 0.1f, 0.12f);
		Color emissionColor = default(Color);
		((Color)(ref emissionColor))..ctor(0.2f, 0.08f, 0.04f);
		ThemeItemPrefab("Carlos_ElmoTotemico", primaryColor, emissionColor, 0.75f, 0.35f);
		ThemeItemPrefab("Carlos_PeitoralTotemico", new Color(0.2f, 0.08f, 0.1f), emissionColor, 0.75f, 0.35f);
		ThemeItemPrefab("Carlos_CalcasTotemicas", primaryColor, emissionColor, 0.7f, 0.32f);
		ThemeItemPrefab("Carlos_LaminaTotemica", new Color(0.45f, 0.38f, 0.18f), new Color(0.3f, 0.1f, 0.05f), 0.85f, 0.45f);
	}

	private void ThemeSetQueen()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: 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_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		Color primaryColor = default(Color);
		((Color)(ref primaryColor))..ctor(0.18f, 0.12f, 0.2f);
		Color emissionColor = default(Color);
		((Color)(ref emissionColor))..ctor(0.12f, 0.08f, 0.04f);
		ThemeItemPrefab("Carlos_ElmoDaRainha", primaryColor, emissionColor, 0.7f, 0.45f);
		ThemeItemPrefab("Carlos_PeitoralDaRainha", new Color(0.14f, 0.1f, 0.16f), emissionColor, 0.7f, 0.45f);
		ThemeItemPrefab("Carlos_CalcasDaRainha", primaryColor, emissionColor, 0.68f, 0.42f);
		ThemeItemPrefab("Carlos_BestaDaRainha", new Color(0.35f, 0.3f, 0.12f), new Color(0.2f, 0.1f, 0.05f), 0.8f, 0.5f);
	}

	private void ThemeItemPrefab(string prefabName, Color primaryColor, Color emissionColor, float metallic, float smoothness)
	{
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Expected O, but got Unknown
		//IL_010f: 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)
		GameObject val = null;
		if ((Object)(object)ObjectDB.instance != (Object)null)
		{
			val = ObjectDB.instance.GetItemPrefab(prefabName);
		}
		if ((Object)(object)val == (Object)null && (Object)(object)ZNetScene.instance != (Object)null)
		{
			val = ZNetScene.instance.GetPrefab(prefabName);
		}
		if ((Object)(object)val == (Object)null)
		{
			if (_debugMode.Value)
			{
				Logger.LogWarning((object)("Prefab para tema visual não encontrado: " + prefabName));
			}
			return;
		}
		Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true);
		Renderer[] array = componentsInChildren;
		foreach (Renderer val2 in array)
		{
			if ((Object)(object)val2 == (Object)null)
			{
				continue;
			}
			Material[] sharedMaterials = val2.sharedMaterials;
			if (sharedMaterials == null || sharedMaterials.Length == 0)
			{
				continue;
			}
			for (int j = 0; j < sharedMaterials.Length; j++)
			{
				Material val3 = sharedMaterials[j];
				if (!((Object)(object)val3 == (Object)null))
				{
					Material val4 = new Material(val3);
					if (val4.HasProperty("_Color"))
					{
						val4.color = primaryColor;
					}
					if (val4.HasProperty("_EmissionColor"))
					{
						val4.EnableKeyword("_EMISSION");
						val4.SetColor("_EmissionColor", emissionColor);
					}
					if (val4.HasProperty("_Metallic"))
					{
						val4.SetFloat("_Metallic", metallic);
					}
					if (val4.HasProperty("_Glossiness"))
					{
						val4.SetFloat("_Glossiness", smoothness);
					}
					if (val4.HasProperty("_Smoothness"))
					{
						val4.SetFloat("_Smoothness", smoothness);
					}
					sharedMaterials[j] = val4;
				}
			}
			val2.sharedMaterials = sharedMaterials;
		}
		if (_debugMode.Value)
		{
			Logger.LogInfo((object)("Tema visual aplicado em: " + prefabName));
		}
	}

	private void UpdateLocalPlayerSetBonus()
	{
		Player localPlayer = Player.m_localPlayer;
		if ((Object)(object)localPlayer == (Object)null)
		{
			ActiveLocalSet = LegendarySetType.None;
			DestroySetAura();
			return;
		}
		LegendarySetType legendarySetType = (ActiveLocalSet = DetectActiveSet(localPlayer));
		if (legendarySetType != _lastDetectedSet)
		{
			_lastDetectedSet = legendarySetType;
			OnActiveSetChanged(localPlayer, legendarySetType);
		}
		if (legendarySetType != 0 && !(Time.time < _nextSetBonusTickTime))
		{
			_nextSetBonusTickTime = Time.time + Mathf.Max(0.5f, _setBonusTickInterval.Value);
			ApplySetBonusTick(localPlayer, legendarySetType);
		}
	}

	private void OnActiveSetChanged(Player player, LegendarySetType newSet)
	{
		if ((Object)(object)player == (Object)null)
		{
			return;
		}
		if (newSet == LegendarySetType.None)
		{
			DestroySetAura();
			ShowSetDebugMessage("SET OFF");
			if (_debugMode.Value)
			{
				Logger.LogInfo((object)"Bônus de set removido.");
			}
			return;
		}
		if (_showPlayerMessageOnGuardianKill.Value)
		{
			((Character)player).Message((MessageType)1, "Bônus de set ativado: " + GetSetDisplayName(newSet), 0, (Sprite)null);
		}
		ShowSetDebugMessage("SET ON: " + GetSetDisplayName(newSet));
		UpdateSetAura(player, newSet);
		if (_debugMode.Value)
		{
			Logger.LogInfo((object)("Bônus de set ativado: " + GetSetDisplayName(newSet)));
		}
	}

	private void ApplySetBonusTick(Player player, LegendarySetType setType)
	{
		if (!((Object)(object)player == (Object)null))
		{
			switch (setType)
			{
			case LegendarySetType.Eikthyr:
				TryAddStamina(player, 6f);
				break;
			case LegendarySetType.Elder:
				((Character)player).Heal(2f, true);
				break;
			case LegendarySetType.Bonemass:
				break;
			case LegendarySetType.Moder:
				TryAddStamina(player, 3f);
				break;
			case LegendarySetType.Yagluth:
				TryAddStamina(player, 2f);
				break;
			case LegendarySetType.Queen:
				TryAddStamina(player, 4f);
				break;
			}
		}
	}

	private LegendarySetType DetectActiveSet(Player player)
	{
		List<string> equippedInternalNames = GetEquippedInternalNames(player);
		if (equippedInternalNames.Count == 0)
		{
			return LegendarySetType.None;
		}
		int num = CountMatches(equippedInternalNames, "Carlos_HelmoDoTrovao", "Carlos_PeitoralDoTrovao", "Carlos_CalcasDoTrovao");
		if (num >= 3)
		{
			return LegendarySetType.Eikthyr;
		}
		int num2 = CountMatches(equippedInternalNames, "Carlos_ElmoAncestral", "Carlos_PeitoralAncestral", "Carlos_CalcasAncestrais");
		if (num2 >= 3)
		{
			return LegendarySetType.Elder;
		}
		int num3 = CountMatches(equippedInternalNames, "Carlos_ElmoPutrido", "Carlos_PeitoralPutrido", "Carlos_CalcasPutridas");
		if (num3 >= 3)
		{
			return LegendarySetType.Bonemass;
		}
		int num4 = CountMatches(equippedInternalNames, "Carlos_ElmoGlacial", "Carlos_PeitoralGlacial", "Carlos_CalcasGlaciais");
		if (num4 >= 3)
		{
			return LegendarySetType.Moder;
		}
		int num5 = CountMatches(equippedInternalNames, "Carlos_ElmoTotemico", "Carlos_PeitoralTotemico", "Carlos_CalcasTotemicas");
		if (num5 >= 3)
		{
			return LegendarySetType.Yagluth;
		}
		int num6 = CountMatches(equippedInternalNames, "Carlos_ElmoDaRainha", "Carlos_PeitoralDaRainha", "Carlos_CalcasDaRainha");
		if (num6 >= 3)
		{
			return LegendarySetType.Queen;
		}
		return LegendarySetType.None;
	}

	private int CountMatches(List<string> equippedNames, params string[] targets)
	{
		int num = 0;
		foreach (string item in targets)
		{
			if (equippedNames.Contains(item))
			{
				num++;
			}
		}
		return num;
	}

	private List<string> GetEquippedInternalNames(Player player)
	{
		List<string> list = new List<string>();
		try
		{
			Inventory inventory = ((Humanoid)player).GetInventory();
			if (inventory == null)
			{
				return list;
			}
			MethodInfo methodInfo = AccessTools.Method(((object)inventory).GetType(), "GetWornItems", (Type[])null, (Type[])null);
			if (methodInfo != null)
			{
				object[] array = new object[1]
				{
					new List<ItemData>()
				};
				methodInfo.Invoke(inventory, array);
				if (array[0] is List<ItemData> list2)
				{
					foreach (ItemData item in list2)
					{
						if ((Object)(object)item?.m_dropPrefab != (Object)null)
						{
							list.Add(((Object)item.m_dropPrefab).name);
						}
					}
				}
			}
			else
			{
				AddItemNameIfExists(list, Traverse.Create((object)player).Field("m_helmetItem").GetValue<ItemData>());
				AddItemNameIfExists(list, Traverse.Create((object)player).Field("m_chestItem").GetValue<ItemData>());
				AddItemNameIfExists(list, Traverse.Create((object)player).Field("m_legItem").GetValue<ItemData>());
				AddItemNameIfExists(list, Traverse.Create((object)player).Field("m_shoulderItem").GetValue<ItemData>());
			}
		}
		catch (Exception ex)
		{
			if (_debugMode.Value)
			{
				Logger.LogWarning((object)("Falha ao ler itens equipados: " + ex.Message));
			}
		}
		return list;
	}

	private void AddItemNameIfExists(List<string> list, ItemData item)
	{
		if ((Object)(object)item?.m_dropPrefab != (Object)null)
		{
			list.Add(((Object)item.m_dropPrefab).name);
		}
	}

	private void UpdateSetAura(Player player, LegendarySetType setType)
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Expected O, but got Unknown
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		if (!_enableSetAura.Value || (Object)(object)player == (Object)null)
		{
			DestroySetAura();
			return;
		}
		if ((Object)(object)_setAuraObject == (Object)null)
		{
			_setAuraObject = new GameObject("CarlosMMO_SetAura");
			_setAuraObject.transform.SetParent(((Component)player).transform, false);
			_setAuraObject.transform.localPosition = new Vector3(0f, 1.2f, 0f);
			_setAuraLight = _setAuraObject.AddComponent<Light>();
			_setAuraLight.type = (LightType)2;
			_setAuraLight.range = 3.2f;
			_setAuraLight.intensity = 0.85f;
			_setAuraLight.shadows = (LightShadows)0;
		}
		if ((Object)(object)_setAuraLight != (Object)null)
		{
			_setAuraLight.color = GetAuraColor(setType);
		}
	}

	private void DestroySetAura()
	{
		if ((Object)(object)_setAuraObject != (Object)null)
		{
			Object.Destroy((Object)(object)_setAuraObject);
			_setAuraObject = null;
			_setAuraLight = null;
		}
	}

	private Color GetAuraColor(LegendarySetType setType)
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		return (Color)(setType switch
		{
			LegendarySetType.Eikthyr => new Color(0.55f, 0.48f, 0.22f), 
			LegendarySetType.Elder => new Color(0.18f, 0.28f, 0.16f), 
			LegendarySetType.Bonemass => new Color(0.18f, 0.24f, 0.14f), 
			LegendarySetType.Moder => new Color(0.45f, 0.55f, 0.7f), 
			LegendarySetType.Yagluth => new Color(0.4f, 0.15f, 0.1f), 
			LegendarySetType.Queen => new Color(0.24f, 0.16f, 0.28f), 
			_ => Color.white, 
		});
	}

	private string GetSetDisplayName(LegendarySetType setType)
	{
		return setType switch
		{
			LegendarySetType.Eikthyr => "Eikthyr", 
			LegendarySetType.Elder => "Elder", 
			LegendarySetType.Bonemass => "Bonemass", 
			LegendarySetType.Moder => "Moder", 
			LegendarySetType.Yagluth => "Yagluth", 
			LegendarySetType.Queen => "Queen", 
			_ => "Nenhum", 
		};
	}

	private void TryAddStamina(Player player, float amount)
	{
		if ((Object)(object)player == (Object)null || amount <= 0f)
		{
			return;
		}
		try
		{
			((Character)player).AddStamina(amount);
		}
		catch (Exception ex)
		{
			if (_debugMode.Value)
			{
				Logger.LogWarning((object)("Falha ao adicionar stamina: " + ex.Message));
			}
		}
	}

	private void ShowSetDebugMessage(string message)
	{
		if (_showDebugVisualMessages.Value && _showSetDebug.Value && !((Object)(object)Player.m_localPlayer == (Object)null) && !(Time.time < _nextSetDebugMessageTime))
		{
			_nextSetDebugMessageTime = Time.time + Mathf.Max(0.01f, _setDebugCooldown.Value);
			((Character)Player.m_localPlayer).Message((MessageType)1, "[Carlos MMO] " + message, 0, (Sprite)null);
		}
	}

	private void ShowHitDebugMessage(string message)
	{
		if (_showDebugVisualMessages.Value && _showHitDebug.Value && !((Object)(object)Player.m_localPlayer == (Object)null) && !(Time.time < _nextHitDebugMessageTime))
		{
			_nextHitDebugMessageTime = Time.time + Mathf.Max(0.01f, _hitDebugCooldown.Value);
			((Character)Player.m_localPlayer).Message((MessageType)1, "[Carlos MMO] " + message, 0, (Sprite)null);
		}
	}

	private void ShowProcDebugMessage(string message)
	{
		if (_showDebugVisualMessages.Value && _showProcDebug.Value && !((Object)(object)Player.m_localPlayer == (Object)null) && !(Time.time < _nextProcDebugMessageTime))
		{
			_nextProcDebugMessageTime = Time.time + Mathf.Max(0.01f, _procDebugCooldown.Value);
			((Character)Player.m_localPlayer).Message((MessageType)1, "[Carlos MMO] " + message, 0, (Sprite)null);
		}
	}

	internal void TryShowHitDebug(Character attacker, Character target, HitData hit)
	{
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: 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_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		if (!_showDebugVisualMessages.Value || !_showHitDebug.Value || SuppressWeaponProc || (Object)(object)attacker == (Object)null || (Object)(object)target == (Object)null || hit == null)
		{
			return;
		}
		Player localPlayer = Player.m_localPlayer;
		if ((Object)(object)localPlayer == (Object)null || (Object)(object)attacker != (Object)(object)localPlayer)
		{
			return;
		}
		ItemData currentWeapon = GetCurrentWeapon(localPlayer);
		if ((Object)(object)currentWeapon?.m_dropPrefab == (Object)null)
		{
			return;
		}
		string name = ((Object)currentWeapon.m_dropPrefab).name;
		if (IsLegendaryWeapon(name))
		{
			string message = "HIT: " + GetShortWeaponDebugName(name);
			Color weaponDebugColor = GetWeaponDebugColor(name);
			Vector3 position = ((Component)target).transform.position + Vector3.up * 0.8f;
			ShowHitDebugMessage(message);
			if (_spawnHitSphereFx.Value)
			{
				SpawnSimpleHitFX(position, weaponDebugColor, 0.11f, 0.2f);
			}
		}
	}

	private bool IsLegendaryWeapon(string weaponName)
	{
		int result;
		switch (weaponName)
		{
		default:
			result = ((weaponName == "Carlos_BestaDaRainha") ? 1 : 0);
			break;
		case "Carlos_LaminaDoTrovao":
		case "Carlos_ArcoAncestral":
		case "Carlos_MacaPutrida":
		case "Carlos_EspadaGlacial":
		case "Carlos_LaminaTotemica":
			result = 1;
			break;
		}
		return (byte)result != 0;
	}

	private string GetShortWeaponDebugName(string weaponName)
	{
		return weaponName switch
		{
			"Carlos_LaminaDoTrovao" => "TROVÃO", 
			"Carlos_ArcoAncestral" => "ANCESTRAL", 
			"Carlos_MacaPutrida" => "PUTRIDO", 
			"Carlos_EspadaGlacial" => "GLACIAL", 
			"Carlos_LaminaTotemica" => "TOTÊMICO", 
			"Carlos_BestaDaRainha" => "RAINHA", 
			_ => weaponName, 
		};
	}

	private Color GetWeaponDebugColor(string weaponName)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: 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_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		return (Color)(weaponName switch
		{
			"Carlos_LaminaDoTrovao" => GetAuraColor(LegendarySetType.Eikthyr), 
			"Carlos_ArcoAncestral" => GetAuraColor(LegendarySetType.Elder), 
			"Carlos_MacaPutrida" => GetAuraColor(LegendarySetType.Bonemass), 
			"Carlos_EspadaGlacial" => GetAuraColor(LegendarySetType.Moder), 
			"Carlos_LaminaTotemica" => GetAuraColor(LegendarySetType.Yagluth), 
			"Carlos_BestaDaRainha" => GetAuraColor(LegendarySetType.Queen), 
			_ => Color.white, 
		});
	}

	internal void TryApplyWeaponEffect(Character attacker, Character target, HitData originalHit)
	{
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: 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)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: 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_0221: 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_0285: Unknown result type (might be due to invalid IL or missing references)
		//IL_0288: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e6: 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)
		if (!_enableWeaponEffects.Value || SuppressWeaponProc || (Object)(object)attacker == (Object)null || (Object)(object)target == (Object)null || originalHit == null || target.IsDead())
		{
			return;
		}
		Player val = (Player)(object)((attacker is Player) ? attacker : null);
		if (val == null)
		{
			return;
		}
		ItemData currentWeapon = GetCurrentWeapon(val);
		if (!((Object)(object)currentWeapon?.m_dropPrefab == (Object)null))
		{
			string name = ((Object)currentWeapon.m_dropPrefab).name;
			Vector3 position = ((Component)target).transform.position + Vector3.up * 0.8f;
			switch (name)
			{
			case "Carlos_LaminaDoTrovao":
				TryDealImmediateDamage(target, (Character)(object)val, 8f, DebuffKind.Shock);
				AddOrRefreshDebuff(target, DebuffKind.Shock, 3f, 1f, 3f, name);
				SpawnSimpleHitFX(position, GetAuraColor(LegendarySetType.Eikthyr), 0.15f, 0.35f);
				ShowProcDebugMessage("PROC: TROVÃO DISPARADO");
				break;
			case "Carlos_ArcoAncestral":
				AddOrRefreshDebuff(target, DebuffKind.Bleed, 8f, 1f, 4f, name);
				SpawnSimpleHitFX(position, GetAuraColor(LegendarySetType.Elder), 0.15f, 0.35f);
				ShowProcDebugMessage("PROC: SANGRAMENTO");
				break;
			case "Carlos_MacaPutrida":
				TryDealImmediateDamage(target, (Character)(object)val, 6f, DebuffKind.Poison);
				AddOrRefreshDebuff(target, DebuffKind.Poison, 10f, 1f, 5f, name);
				SpawnSimpleHitFX(position, GetAuraColor(LegendarySetType.Bonemass), 0.15f, 0.35f);
				ShowProcDebugMessage("PROC: VENENO PESADO");
				break;
			case "Carlos_EspadaGlacial":
				TryDealImmediateDamage(target, (Character)(object)val, 7f, DebuffKind.Frost);
				AddOrRefreshDebuff(target, DebuffKind.Frost, 7f, 1f, 4f, name);
				SpawnSimpleHitFX(position, GetAuraColor(LegendarySetType.Moder), 0.15f, 0.35f);
				ShowProcDebugMessage("PROC: GELO");
				break;
			case "Carlos_LaminaTotemica":
				TryDealImmediateDamage(target, (Character)(object)val, 10f, DebuffKind.Fire);
				AddOrRefreshDebuff(target, DebuffKind.Fire, 9f, 1f, 5f, name);
				SpawnSimpleHitFX(position, GetAuraColor(LegendarySetType.Yagluth), 0.15f, 0.35f);
				ShowProcDebugMessage("PROC: FOGO");
				break;
			case "Carlos_BestaDaRainha":
				TryDealImmediateDamage(target, (Character)(object)val, 5f, DebuffKind.Poison);
				AddOrRefreshDebuff(target, DebuffKind.Poison, 12f, 0.75f, 4.5f, name);
				SpawnSimpleHitFX(position, GetAuraColor(LegendarySetType.Queen), 0.15f, 0.35f);
				ShowProcDebugMessage("PROC: VENENO REAL");
				break;
			}
		}
	}

	private ItemData GetCurrentWeapon(Player player)
	{
		try
		{
			return ((Humanoid)player).GetCurrentWeapon();
		}
		catch
		{
			try
			{
				return Traverse.Create((object)player).Field("m_rightItem").GetValue<ItemData>();
			}
			catch
			{
				return null;
			}
		}
	}

	private void AddOrRefreshDebuff(Character target, DebuffKind kind, float totalDuration, float tickInterval, float damagePerTick, string sourceWeapon)
	{
		if (!((Object)(object)target == (Object)null) && kind != 0)
		{
			int instanceID = ((Object)target).GetInstanceID();
			if (ActiveDebuffs.TryGetValue(instanceID, out var value))
			{
				value.Kind = kind;
				value.DamagePerTick = damagePerTick;
				value.TickInterval = tickInterval;
				value.NextTickTime = Time.time + tickInterval;
				value.EndTime = Time.time + totalDuration;
				value.SourceWeapon = sourceWeapon;
			}
			else
			{
				ActiveDebuffs[instanceID] = new DebuffState
				{
					TargetId = instanceID,
					TargetRef = new WeakReference<Character>(target),
					Kind = kind,
					DamagePerTick = damagePerTick,
					TickInterval = tickInterval,
					NextTickTime = Time.time + tickInterval,
					EndTime = Time.time + totalDuration,
					SourceWeapon = sourceWeapon
				};
			}
		}
	}

	private void UpdateActiveDebuffs()
	{
		if (ActiveDebuffs.Count == 0)
		{
			return;
		}
		List<int> list = null;
		foreach (KeyValuePair<int, DebuffState> activeDebuff in ActiveDebuffs)
		{
			DebuffState value = activeDebuff.Value;
			Character target;
			if (value == null)
			{
				if (list == null)
				{
					list = new List<int>();
				}
				list.Add(activeDebuff.Key);
			}
			else if (!value.TargetRef.TryGetTarget(out target) || (Object)(object)target == (Object)null || target.IsDead())
			{
				if (list == null)
				{
					list = new List<int>();
				}
				list.Add(activeDebuff.Key);
			}
			else if (Time.time >= value.EndTime)
			{
				if (list == null)
				{
					list = new List<int>();
				}
				list.Add(activeDebuff.Key);
			}
			else if (!(Time.time < value.NextTickTime))
			{
				value.NextTickTime = Time.time + value.TickInterval;
				switch (value.Kind)
				{
				case DebuffKind.Bleed:
					TryDealDebuffTickDamage(target, 4f, 0f, 0f, 0f);
					break;
				case DebuffKind.Poison:
					TryDealDebuffTickDamage(target, 0f, value.DamagePerTick, 0f, 0f);
					break;
				case DebuffKind.Frost:
					TryDealDebuffTickDamage(target, 0f, 0f, value.DamagePerTick, 0f);
					break;
				case DebuffKind.Fire:
					TryDealDebuffTickDamage(target, 0f, 0f, 0f, value.DamagePerTick);
					break;
				case DebuffKind.Shock:
					TryDealDebuffTickDamage(target, value.DamagePerTick, 0f, 0f, 0f);
					break;
				}
			}
		}
		if (list == null)
		{
			return;
		}
		foreach (int item in list)
		{
			ActiveDebuffs.Remove(item);
		}
	}

	private void TryDealImmediateDamage(Character target, Character attacker, float amount, DebuffKind kind)
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Expected O, but got Unknown
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: 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_0088: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)target == (Object)null || (Object)(object)attacker == (Object)null || amount <= 0f)
		{
			return;
		}
		SuppressWeaponProc = true;
		try
		{
			HitData val = new HitData();
			val.m_point = ((Component)target).transform.position + Vector3.up;
			Vector3 val2 = ((Component)target).transform.position - ((Component)attacker).transform.position;
			val.m_dir = ((Vector3)(ref val2)).normalized;
			val.m_pushForce = 0f;
			val.m_skill = (SkillType)1;
			switch (kind)
			{
			case DebuffKind.Fire:
				val.m_damage.m_fire = amount;
				break;
			case DebuffKind.Frost:
				val.m_damage.m_frost = amount;
				break;
			case DebuffKind.Poison:
				val.m_damage.m_poison = amount;
				break;
			default:
				val.m_damage.m_blunt = amount;
				break;
			}
			val.SetAttacker(attacker);
			target.Damage(val);
		}
		catch (Exception ex)
		{
			if (_debugMode.Value)
			{
				Logger.LogWarning((object)("Falha ao aplicar dano imediato: " + ex.Message));
			}
		}
		finally
		{
			SuppressWeaponProc = false;
		}
	}

	private void TryDealDebuffTickDamage(Character target, float blunt, float poison, float frost, float fire)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		//IL_0025: 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_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)target == (Object)null)
		{
			return;
		}
		SuppressWeaponProc = true;
		try
		{
			HitData val = new HitData();
			val.m_point = ((Component)target).transform.position + Vector3.up * 0.5f;
			val.m_dir = Vector3.zero;
			val.m_pushForce = 0f;
			val.m_skill = (SkillType)0;
			val.m_damage.m_blunt = blunt;
			val.m_damage.m_poison = poison;
			val.m_damage.m_frost = frost;
			val.m_damage.m_fire = fire;
			if ((Object)(object)Player.m_localPlayer != (Object)null)
			{
				val.SetAttacker((Character)(object)Player.m_localPlayer);
			}
			target.Damage(val);
		}
		catch (Exception ex)
		{
			if (_debugMode.Value)
			{
				Logger.LogWarning((object)("Falha ao aplicar tick de debuff: " + ex.Message));
			}
		}
		finally
		{
			SuppressWeaponProc = false;
		}
	}

	private void SpawnSimpleHitFX(Vector3 position, Color color, float scale, float duration)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		if (!_spawnHitSphereFx.Value)
		{
			return;
		}
		try
		{
			GameObject val = GameObject.CreatePrimitive((PrimitiveType)0);
			((Object)val).name = "CarlosMMO_HitFX";
			val.transform.position = position;
			val.transform.localScale = Vector3.one * Mathf.Max(0.01f, scale);
			Collider component = val.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			Renderer component2 = val.GetComponent<Renderer>();
			if ((Object)(object)component2 != (Object)null && (Object)(object)component2.material != (Object)null)
			{
				component2.material.color = color;
				if (component2.material.HasProperty("_EmissionColor"))
				{
					component2.material.EnableKeyword("_EMISSION");
					component2.material.SetColor("_EmissionColor", color * 0.4f);
				}
			}
			Object.Destroy((Object)(object)val, Mathf.Max(0.02f, duration));
		}
		catch
		{
		}
	}

	internal void TryHandleGuardianDeath(Character character)
	{
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: 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_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Unknown result type (might be due to invalid IL or missing references)
		if (!_guardianLegendaryDropsEnabled.Value || (Object)(object)character == (Object)null)
		{
			return;
		}
		int instanceID = ((Object)character).GetInstanceID();
		if (_processedDeaths.Contains(instanceID))
		{
			return;
		}
		_processedDeaths.Add(instanceID);
		string text = CleanName(((Object)((Component)character).gameObject).name);
		if (_debugMode.Value)
		{
			Logger.LogInfo((object)("OnDeath detectado em: " + text));
		}
		try
		{
			if (IsMatch(text, _eikthyrPrefabName.Value))
			{
				HandleGuardianReward("Eikthyr", ((Component)character).transform.position, "Carlos_EssenciaEikthyr", _eikthyrExtraDropAmount.Value);
			}
			else if (IsMatch(text, _elderPrefabName.Value))
			{
				HandleGuardianReward("The Elder", ((Component)character).transform.position, "Carlos_RaizAncestral", _elderExtraDropAmount.Value);
			}
			else if (IsMatch(text, _bonemassPrefabName.Value))
			{
				HandleGuardianReward("Bonemass", ((Component)character).transform.position, "Carlos_NucleoPutrido", _bonemassExtraDropAmount.Value);
			}
			else if (IsMatch(text, _moderPrefabName.Value))
			{
				HandleGuardianReward("Moder", ((Component)character).transform.position, "Carlos_CoracaoGlacial", _moderExtraDropAmount.Value);
			}
			else if (IsMatch(text, _yagluthPrefabName.Value))
			{
				HandleGuardianReward("Yagluth", ((Component)character).transform.position, "Carlos_ChamaTotemica", _yagluthExtraDropAmount.Value);
			}
			else if (IsMatch(text, _queenPrefabName.Value))
			{
				HandleGuardianReward("Queen", ((Component)character).transform.position, "Carlos_OlhoDaRainha", _queenExtraDropAmount.Value);
			}
		}
		catch (Exception ex)
		{
			Logger.LogError((object)"Erro ao processar morte de guardião.");
			Logger.LogError((object)ex);
		}
	}

	private void HandleGuardianReward(string guardianName, Vector3 position, string extraDropPrefab, int extraDropAmount)
	{
		//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_004f: Unknown result type (might be due to invalid IL or missing references)
		if (_debugMode.Value)
		{
			Logger.LogInfo((object)("Guardião derrotado: " + guardianName));
			Logger.LogInfo((object)$"Drop lendário: {extraDropPrefab} x{extraDropAmount}");
		}
		SpawnDrop(extraDropPrefab, extraDropAmount, position + Vector3.up);
		if (_showPlayerMessageOnGuardianKill.Value && (Object)(object)Player.m_localPlayer != (Object)null)
		{
			((Character)Player.m_localPlayer).Message((MessageType)1, "Guardião derrotado: " + guardianName + "\nMaterial lendário recebido!", 0, (Sprite)null);
		}
	}

	private void SpawnDrop(string prefabName, int stack, Vector3 position)
	{
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		if (string.IsNullOrWhiteSpace(prefabName))
		{
			Logger.LogWarning((object)"SpawnDrop ignorado: prefab vazio.");
			return;
		}
		if (stack <= 0)
		{
			Logger.LogWarning((object)("SpawnDrop ignorado: stack inválido para " + prefabName + "."));
			return;
		}
		GameObject val = null;
		if ((Object)(object)ObjectDB.instance != (Object)null)
		{
			val = ObjectDB.instance.GetItemPrefab(prefabName);
		}
		if ((Object)(object)val == (Object)null && (Object)(object)ZNetScene.instance != (Object)null)
		{
			val = ZNetScene.instance.GetPrefab(prefabName);
		}
		if ((Object)(object)val == (Object)null)
		{
			Logger.LogWarning((object)("Drop '" + prefabName + "' não encontrado no ObjectDB/ZNetScene."));
			return;
		}
		GameObject val2 = Object.Instantiate<GameObject>(val, position, Quaternion.identity);
		ItemDrop component = val2.GetComponent<ItemDrop>();
		if ((Object)(object)component != (Object)null && component.m_itemData != null)
		{
			component.m_itemData.m_stack = Mathf.Max(1, stack);
		}
		Logger.LogInfo((object)$"Drop spawnado com sucesso: {prefabName} x{stack}");
	}

	private static string CleanName(string value)
	{
		if (string.IsNullOrWhiteSpace(value))
		{
			return string.Empty;
		}
		return value.Replace("(Clone)", "").Trim();
	}

	private static bool IsMatch(string a, string b)
	{
		return string.Equals(CleanName(a), CleanName(b), StringComparison.OrdinalIgnoreCase);
	}
}
[HarmonyPatch(typeof(Character), "OnDeath")]
public static class CharacterDeathPatch
{
	private static void Postfix(Character __instance)
	{
		if ((Object)(object)CarlosMMOBossesPlugin.Instance == (Object)null || (Object)(object)__instance == (Object)null)
		{
			return;
		}
		try
		{
			CarlosMMOBossesPlugin.Instance.TryHandleGuardianDeath(__instance);
		}
		catch (Exception ex)
		{
			CarlosMMOBossesPlugin.Logger.LogError((object)"Erro em CharacterDeathPatch.");
			CarlosMMOBossesPlugin.Logger.LogError((object)ex);
		}
	}
}
[HarmonyPatch(typeof(Character), "Damage")]
public static class CharacterDamagePatch
{
	private static void Prefix(Character __instance, HitData hit)
	{
		if ((Object)(object)CarlosMMOBossesPlugin.Instance == (Object)null || (Object)(object)__instance == (Object)null || hit == null)
		{
			return;
		}
		try
		{
			Player val = (Player)(object)((__instance is Player) ? __instance : null);
			if (val != null && (Object)(object)val == (Object)(object)Player.m_localPlayer && CarlosMMOBossesPlugin.ActiveLocalSet == CarlosMMOBossesPlugin.LegendarySetType.Bonemass)
			{
				((DamageTypes)(ref hit.m_damage)).Modify(0.85f);
			}
		}
		catch (Exception ex)
		{
			CarlosMMOBossesPlugin.Logger.LogWarning((object)("Erro no Prefix de dano: " + ex.Message));
		}
	}

	private static void Postfix(Character __instance, HitData hit)
	{
		if ((Object)(object)CarlosMMOBossesPlugin.Instance == (Object)null || (Object)(object)__instance == (Object)null || hit == null)
		{
			return;
		}
		try
		{
			if (!CarlosMMOBossesPlugin.SuppressWeaponProc)
			{
				Character attacker = hit.GetAttacker();
				if (!((Object)(object)attacker == (Object)null))
				{
					CarlosMMOBossesPlugin.Instance.TryShowHitDebug(attacker, __instance, hit);
					CarlosMMOBossesPlugin.Instance.TryApplyWeaponEffect(attacker, __instance, hit);
				}
			}
		}
		catch (Exception ex)
		{
			CarlosMMOBossesPlugin.Logger.LogWarning((object)("Erro no Postfix de dano: " + ex.Message));
		}
	}
}
public static class PlayerSpeedPatch
{
	public static void Postfix(Player __instance, ref float __result)
	{
		if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer))
		{
			switch (CarlosMMOBossesPlugin.ActiveLocalSet)
			{
			case CarlosMMOBossesPlugin.LegendarySetType.Eikthyr:
				__result *= 1.08f;
				break;
			case CarlosMMOBossesPlugin.LegendarySetType.Queen:
				__result *= 1.1f;
				break;
			case CarlosMMOBossesPlugin.LegendarySetType.Moder:
				__result *= 1.04f;
				break;
			}
		}
	}
}