Decompiled source of DanisNightmare v2.1.2

DanisNightmare.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("MuckDebugMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MuckDebugMod")]
[assembly: AssemblyTitle("MuckDebugMod")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MuckDebugMod;

[BepInPlugin("com.plinkuuu.danisnightmare", "Dani's Nightmare", "2.1.2")]
public class Plugin : BaseUnityPlugin
{
	public static bool chestsFree = false;

	public static int forcedTier = 0;

	public static bool infiniteStamina = false;

	public static bool speedHackActive = false;

	public static bool godMode = false;

	public static bool infiniteHunger = false;

	public static int damageMultiplier = 1;

	public static bool forceRng = false;

	public static int dropMultiplier = 1;

	public static int powerupMultiplier = 1;

	public static float speedMultiplier = 1f;

	public static float defensePercent = 0f;

	public static int structureMultiplier = 1;

	public static int chestPowerupMultiplier = 1;

	public static bool peacefulMode = false;

	public static float mobMultiplier = 1f;

	public static float enemyHpMultiplier = 1f;

	public static float enemyDmgMultiplier = 1f;

	private void Awake()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("com.plinkuuu.danisnightmare").PatchAll();
		MonoBehaviour.print((object)"[DANIS_NIGHTMARE] ==============================================");
		MonoBehaviour.print((object)"[DANIS_NIGHTMARE] DANI'S NIGHTMARE SUCCESSFULLY INITIALIZED!");
		MonoBehaviour.print((object)"[DANIS_NIGHTMARE] ==============================================");
	}

	public unsafe static void ProcessDebugCommand(string message)
	{
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: 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_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01db: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_027c: Unknown result type (might be due to invalid IL or missing references)
		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
		string[] array = message.Split(new char[1] { ' ' });
		string text = array[0].ToLower();
		MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Chat command detected: " + message));
		switch (text)
		{
		case "/free":
		{
			chestsFree = !chestsFree;
			string text3 = (chestsFree ? "<color=green>ENABLED<color=white>" : "<color=red>DISABLED<color=white>");
			ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Free chests hack: " + text3);
			MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Free chests hack set to: " + chestsFree));
			return;
		}
		case "/player":
			ExecutePlayerCommand((array.Length > 1) ? array[1].ToLower() : "help", array);
			return;
		case "/spawnchest":
		{
			if (array.Length <= 1)
			{
				break;
			}
			string text2 = array[1].ToLower();
			int num = -1;
			switch (text2)
			{
			case "white":
				num = 0;
				break;
			case "blue":
				num = 1;
				break;
			case "orange":
				num = 2;
				break;
			}
			if (num == -1)
			{
				ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Correct usage: /spawnchest <white/blue/orange><color=white>");
				return;
			}
			SpawnPowerupsInLocations[] array2 = Resources.FindObjectsOfTypeAll<SpawnPowerupsInLocations>();
			GameObject val = null;
			SpawnPowerupsInLocations[] array3 = array2;
			foreach (SpawnPowerupsInLocations val2 in array3)
			{
				if (val2.powerupChests != null && val2.powerupChests.Length > num)
				{
					val = val2.powerupChests[num].prefab;
					break;
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				MonoBehaviour.print((object)("[DANIS_NIGHTMARE] ERROR: Chest prefab not found in RAM. Index: " + num));
				return;
			}
			Vector3 position = ((Component)GameManager.players[LocalClient.instance.myId]).transform.position;
			Vector3 forward = ((Component)GameManager.players[LocalClient.instance.myId]).transform.forward;
			Vector3 val3 = position + forward * 4.5f;
			val3.y = position.y;
			Quaternion val4 = Quaternion.LookRotation(forward);
			GameObject val5 = Object.Instantiate<GameObject>(val, val3, val4);
			int nextId = ResourceManager.Instance.GetNextId();
			LootContainerInteract componentInChildren = val5.GetComponentInChildren<LootContainerInteract>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.SetId(nextId);
			}
			ResourceManager.Instance.AddObject(nextId, val5);
			ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] " + text2.ToUpper() + " chest materialized at your feet!");
			string[] obj = new string[6]
			{
				"[DANIS_NIGHTMARE] Spawned chest: ",
				text2.ToUpper(),
				" | Position: ",
				null,
				null,
				null
			};
			Vector3 val6 = val3;
			obj[3] = ((object)(*(Vector3*)(&val6))/*cast due to .constrained prefix*/).ToString();
			obj[4] = " | ID: ";
			obj[5] = nextId.ToString();
			MonoBehaviour.print((object)string.Concat(obj));
			return;
		}
		}
		if (text == "/god")
		{
			godMode = !godMode;
			if (godMode)
			{
				infiniteStamina = true;
				infiniteHunger = true;
				if ((Object)(object)PlayerStatus.Instance != (Object)null)
				{
					PlayerStatus.Instance.stamina = 100f;
					PlayerStatus.Instance.hunger = 100f;
				}
				ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] God Mode: <color=green>ENABLED (Invincibility, Infinite Stamina & Hunger active!)<color=white>");
			}
			else
			{
				infiniteStamina = false;
				infiniteHunger = false;
				ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] God Mode: <color=red>DISABLED<color=white>");
			}
			MonoBehaviour.print((object)("[DANIS_NIGHTMARE] God Mode toggled to: " + godMode));
			return;
		}
		if (text == "/structmult" && array.Length > 1)
		{
			if (int.TryParse(array[1], out var result))
			{
				structureMultiplier = result;
				ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Structure multiplier set to: <color=orange>x" + result + "<color=white> (Will apply on the next run!)");
				MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Structure multiplier changed to: x" + result));
			}
			else
			{
				ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Correct usage: /structmult <multiplier><color=white>");
			}
			return;
		}
		if (text == "/peaceful")
		{
			peacefulMode = !peacefulMode;
			string text4 = (peacefulMode ? "<color=green>ENABLED (Peaceful Mode)<color=white>" : "<color=red>DISABLED<color=white>");
			ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Peaceful Mode: " + text4);
			MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Peaceful Mode set to: " + peacefulMode));
			return;
		}
		if (text == "/setday" && array.Length > 1)
		{
			if (int.TryParse(array[1], out var result2))
			{
				if (result2 < 0)
				{
					result2 = 0;
				}
				float num2 = (float)result2 + DayCycle.time;
				Traverse.Create(typeof(DayCycle)).Property("totalTime", (object[])null).SetValue((object)num2);
				ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Time machine activated! Travelled to: <color=orange>Day " + result2 + "<color=white>");
				MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Time machine triggered. Set total day time to: " + num2));
			}
			else
			{
				ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Correct usage: /setday <number><color=white>");
			}
			return;
		}
		if (text == "/setnight" && array.Length > 1)
		{
			if (int.TryParse(array[1], out var result3))
			{
				if (result3 < 0)
				{
					result3 = 0;
				}
				DayCycle.time = 0.51f;
				float num3 = (float)result3 + 0.51f;
				Traverse.Create(typeof(DayCycle)).Property("totalTime", (object[])null).SetValue((object)num3);
				if ((Object)(object)GameLoop.Instance != (Object)null)
				{
					Traverse.Create((object)GameLoop.Instance).Field("nightStarted").SetValue((object)false);
				}
				ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Night machine activated! Travelled to: <color=orange>Night " + result3 + "<color=white>");
				MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Night machine triggered. Set night time to: " + num3));
			}
			else
			{
				ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Correct usage: /setnight <number><color=white>");
			}
			return;
		}
		switch (text)
		{
		case "/kill":
			ExecuteKillCommand((array.Length > 1) ? array[1].ToLower() : "");
			break;
		case "/enemy":
			ExecuteEnemyCommand((array.Length > 1) ? array[1].ToLower() : "help", array, message);
			break;
		case "/powerup":
			ExecutePowerupCommand((array.Length > 1) ? array[1].ToLower() : "help", array, message);
			break;
		case "/item":
		case "/items":
			ExecuteItemsCommand((array.Length > 1) ? array[1].ToLower() : "help", array, message);
			break;
		default:
			ChatBox.Instance.SendMessage("<color=red>[DANIS_NIGHTMARE] Unknown command. Commands: /free, /spawnchest, /peaceful, /setday, /setnight, /kill, /enemy, /item, /powerup, /player, /god, /items, /structmult<color=white>");
			break;
		}
	}

	public static void ExecuteKillCommand(string argument)
	{
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Invalid comparison between Unknown and I4
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_02db: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
		switch (argument)
		{
		case "":
		case "help":
		case "h":
		case "?":
			ChatBox.Instance.SendMessage("<color=yellow>Kill command usage: /kill enemies for enemies or bosses for bosses<color=white>");
			ChatBox.Instance.SendMessage("<color=yellow>Kill command usage: /kill hostiles for al hostiles mobs or peaceful for peaceful mobs<color=white>");
			ChatBox.Instance.SendMessage("<color=yellow>Kill command usage: /kill all<color=white>");
			ChatBox.Instance.SendMessage("<color=yellow>Kill command usage: /kill self<color=white>");
			return;
		case "self":
		case "me":
			if ((Object)(object)PlayerStatus.Instance != (Object)null)
			{
				PlayerStatus.Instance.Damage(0, 0, true);
				ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] You committed suicide.");
				MonoBehaviour.print((object)"[DANIS_NIGHTMARE] Player triggered self-kill.");
			}
			return;
		}
		if ((Object)(object)MobManager.Instance == (Object)null || MobManager.Instance.mobs == null)
		{
			ChatBox.Instance.SendMessage("<color=red>[DANIS_NIGHTMARE] Error: No active mobs found in manager.<color=white>");
			return;
		}
		int num = 0;
		foreach (Mob item in new List<Mob>(MobManager.Instance.mobs.Values))
		{
			if ((Object)(object)item == (Object)null)
			{
				continue;
			}
			string text = (((Object)(object)item.mobType != (Object)null) ? item.mobType.name : "");
			bool flag = text == "Woodman" || text == "Cow";
			bool flag2 = ((Object)(object)item.mobType != (Object)null && item.mobType.boss) || (int)item.bossType > 0;
			bool flag3 = !flag && !flag2;
			bool flag4 = false;
			if (argument == "all")
			{
				flag4 = true;
			}
			else if (argument == "enemies" && flag3)
			{
				flag4 = true;
			}
			else if ((argument == "bosses" || argument == "boss") && flag2)
			{
				flag4 = true;
			}
			else if (argument == "hostiles" && (flag3 || flag2))
			{
				flag4 = true;
			}
			else if (argument == "peaceful" && flag)
			{
				flag4 = true;
			}
			if (!flag4)
			{
				continue;
			}
			Hitable component = ((Component)item).GetComponent<Hitable>();
			if (!((Object)(object)component != (Object)null))
			{
				continue;
			}
			if (flag2)
			{
				LootExtra.BossLoot(((Component)item).transform, item.bossType);
			}
			if ((Object)(object)component.dropTable != (Object)null)
			{
				List<InventoryItem> loot = component.dropTable.GetLoot();
				if (loot != null)
				{
					foreach (InventoryItem item2 in loot)
					{
						if ((Object)(object)item2 != (Object)null)
						{
							int nextId = ItemManager.Instance.GetNextId();
							ItemManager.Instance.DropItemAtPosition(item2.id, item2.amount, ((Component)item).transform.position, nextId);
						}
					}
				}
			}
			component.Damage(0, LocalClient.instance.myId, 0, ((Component)item).transform.position);
			num++;
		}
		ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Purged <color=orange>" + num + "</color> targets (" + argument.ToUpper() + ").");
		MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Purged " + num + " targets of type: " + argument));
	}

	public static void ExecuteItemsCommand(string subCommand, string[] parts, string message)
	{
		//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fd: Expected O, but got Unknown
		//IL_038c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0393: Expected O, but got Unknown
		switch (subCommand)
		{
		case "help":
		case "h":
		case "?":
			ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Items command usage: /items forcerng<color=white>");
			ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Items command usage: /items drop <multiplier><color=white>");
			ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Items command usage: /items give <id_or_name> [amount]<color=white>");
			return;
		case "forcerng":
		{
			forceRng = !forceRng;
			string text = (forceRng ? "<color=green>ENABLED (100% Max Drop)<color=white>" : "<color=red>DISABLED<color=white>");
			ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Force RNG: " + text);
			MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Force RNG (Max Drops) set to: " + forceRng));
			return;
		}
		case "drop":
			if (parts.Length > 2)
			{
				if (int.TryParse(parts[2], out var result))
				{
					dropMultiplier = result;
					ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Drop multiplier set to: <color=orange>x" + result + "<color=white>");
					MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Drop multiplier changed to: x" + result));
				}
				else
				{
					ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Correct usage: /items drop <multiplier><color=white>");
				}
				return;
			}
			break;
		}
		if (subCommand == "give" && parts.Length > 2)
		{
			InventoryItem val = null;
			int result2 = 1;
			bool flag = false;
			if (int.TryParse(parts[2], out var result3))
			{
				if (ItemManager.Instance.allItems.ContainsKey(result3))
				{
					val = ItemManager.Instance.allItems[result3];
				}
				if (parts.Length > 3)
				{
					int.TryParse(parts[3], out result2);
				}
			}
			else
			{
				string text2 = "";
				if (int.TryParse(parts[^1], out result2))
				{
					if (result2 < 1)
					{
						result2 = 1;
					}
					for (int i = 2; i < parts.Length - 1; i++)
					{
						if (parts[i].Contains("_"))
						{
							flag = true;
							parts[i] = parts[i].Replace("_", " ");
						}
						text2 = text2 + parts[i] + " ";
					}
				}
				else
				{
					result2 = 1;
					for (int j = 2; j < parts.Length; j++)
					{
						if (parts[j].Contains("_"))
						{
							flag = true;
							parts[j] = parts[j].Replace("_", " ");
						}
						text2 = text2 + parts[j] + " ";
					}
				}
				text2 = text2.Trim();
				foreach (InventoryItem value in ItemManager.Instance.allItems.Values)
				{
					if ((Object)(object)value != (Object)null && value.name.Equals(text2, StringComparison.OrdinalIgnoreCase))
					{
						val = value;
						break;
					}
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				ChatBox.Instance.SendMessage("<color=red>[DANIS_NIGHTMARE] Error: Item not found in database!<color=white>");
				return;
			}
			if (flag)
			{
				ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Tip: You don't need to use underscores anymore! Regular spaces work fine.<color=white>");
			}
			if (val.stackable && val.max > 1)
			{
				InventoryItem val2 = (InventoryItem)ScriptableObject.CreateInstance(typeof(InventoryItem));
				val2.Copy(val, result2);
				InventoryUI.Instance.AddItemToInventory(val2);
				ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Gave <color=yellow>" + result2 + "x " + val.name + "<color=white> to your inventory.");
			}
			else
			{
				int num = 0;
				for (int k = 0; k < result2; k++)
				{
					if (InventoryUI.Instance.IsInventoryFull())
					{
						ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Warning: Inventory full! Stopped giving items.<color=white>");
						break;
					}
					InventoryItem val3 = (InventoryItem)ScriptableObject.CreateInstance(typeof(InventoryItem));
					val3.Copy(val, 1);
					InventoryUI.Instance.AddItemToInventory(val3);
					num++;
				}
				string text3 = ((num > 1) ? " (separate slots)" : "");
				ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Gave <color=yellow>" + num + "x " + val.name + "<color=white>" + text3 + " to your inventory.");
			}
			MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Processed /items give for item: " + val.name + " | Requested: " + result2));
		}
		else
		{
			ChatBox.Instance.SendMessage("<color=red>[DANIS_NIGHTMARE] Unknown sub-command. Usage: /items help<color=white>");
		}
	}

	public unsafe static void ExecuteEnemyCommand(string subCommand, string[] parts, string message)
	{
		//IL_033a: Unknown result type (might be due to invalid IL or missing references)
		//IL_033f: Unknown result type (might be due to invalid IL or missing references)
		//IL_035a: Unknown result type (might be due to invalid IL or missing references)
		//IL_035f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0361: Unknown result type (might be due to invalid IL or missing references)
		//IL_0363: Unknown result type (might be due to invalid IL or missing references)
		//IL_036a: Unknown result type (might be due to invalid IL or missing references)
		//IL_036f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0374: Unknown result type (might be due to invalid IL or missing references)
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_0478: Unknown result type (might be due to invalid IL or missing references)
		//IL_047a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_039a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
		switch (subCommand)
		{
		case "help":
		case "h":
		case "?":
			ChatBox.Instance.SendMessage("<color=yellow>Enemy command usage: /enemy hp <multiplier><color=white>");
			ChatBox.Instance.SendMessage("<color=yellow>Enemy command usage: /enemy dmg <multiplier><color=white>");
			ChatBox.Instance.SendMessage("<color=yellow>Enemy command usage: /enemy amount <multiplier><color=white>");
			ChatBox.Instance.SendMessage("<color=yellow>Enemy command usage: /enemy spawn <name> [amount]<color=white>");
			return;
		case "hp":
		{
			if (parts.Length <= 2)
			{
				break;
			}
			if (float.TryParse(parts[2], NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
			{
				if (result < 0f)
				{
					result = 0f;
				}
				enemyHpMultiplier = result;
				ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Enemy HP multiplier set to: <color=orange>x" + result.ToString(CultureInfo.InvariantCulture) + "<color=white>");
				MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Enemy HP multiplier changed to: x" + result));
			}
			else
			{
				ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Correct usage: /enemy hp <multiplier><color=white>");
			}
			return;
		}
		}
		if (subCommand == "dmg" && parts.Length > 2)
		{
			if (float.TryParse(parts[2], NumberStyles.Any, CultureInfo.InvariantCulture, out var result2))
			{
				if (result2 < 0f)
				{
					result2 = 0f;
				}
				enemyDmgMultiplier = result2;
				ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Enemy damage multiplier set to: <color=orange>x" + result2.ToString(CultureInfo.InvariantCulture) + "<color=white>");
				MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Enemy damage multiplier changed to: x" + result2));
			}
			else
			{
				ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Correct usage: /enemy dmg <multiplier><color=white>");
			}
		}
		else if (subCommand == "amount" && parts.Length > 2)
		{
			if (float.TryParse(parts[2], NumberStyles.Any, CultureInfo.InvariantCulture, out var result3))
			{
				if (result3 < 0f)
				{
					result3 = 0f;
				}
				mobMultiplier = result3;
				ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Mob spawn multiplier set to: <color=orange>x" + result3.ToString(CultureInfo.InvariantCulture) + "<color=white>");
				MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Mob spawn multiplier changed to: x" + result3));
			}
			else
			{
				ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Correct usage: /enemy amount <multiplier><color=white>");
			}
		}
		else if (subCommand == "spawn" && parts.Length > 2)
		{
			string text = "";
			int result4 = 1;
			if (int.TryParse(parts[^1], out result4))
			{
				if (result4 < 1)
				{
					result4 = 1;
				}
				for (int i = 2; i < parts.Length - 1; i++)
				{
					text = text + parts[i] + " ";
				}
			}
			else
			{
				result4 = 1;
				for (int j = 2; j < parts.Length; j++)
				{
					text = text + parts[j] + " ";
				}
			}
			text = text.Trim();
			int num = -1;
			string text2 = "";
			if ((Object)(object)MobSpawner.Instance != (Object)null && MobSpawner.Instance.allMobs != null)
			{
				for (int k = 0; k < MobSpawner.Instance.allMobs.Length; k++)
				{
					MobType val = MobSpawner.Instance.allMobs[k];
					if ((Object)(object)val != (Object)null && val.name.Equals(text, StringComparison.OrdinalIgnoreCase))
					{
						num = k;
						text2 = val.name;
						break;
					}
				}
			}
			if (num == -1)
			{
				ChatBox.Instance.SendMessage("<color=red>[DANIS_NIGHTMARE] Error: Enemy '" + text + "' not found in database!<color=white>");
				return;
			}
			Vector3 position = ((Component)GameManager.players[LocalClient.instance.myId]).transform.position;
			Vector3 forward = ((Component)GameManager.players[LocalClient.instance.myId]).transform.forward;
			Vector3 val2 = position + forward * 4.5f;
			val2.y = position.y;
			for (int l = 0; l < result4; l++)
			{
				int nextId = MobManager.Instance.GetNextId();
				Vector3 val3 = (Vector3)((result4 > 1) ? new Vector3((float)((double)Random.value - 0.5) * 1.5f, 0f, (float)((double)Random.value - 0.5) * 1.5f) : Vector3.zero);
				MobSpawner.Instance.ServerSpawnNewMob(nextId, num, val2 + val3, 1f, 1f, (BossType)0, -1);
			}
			ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Spawned <color=orange>" + result4 + "x " + text2 + "<color=white> in front of you!");
			string[] obj = new string[6]
			{
				"[DANIS_NIGHTMARE] Spawned enemy: ",
				text2,
				" | Count: ",
				result4.ToString(),
				" | Position: ",
				null
			};
			Vector3 val4 = val2;
			obj[5] = ((object)(*(Vector3*)(&val4))/*cast due to .constrained prefix*/).ToString();
			MonoBehaviour.print((object)string.Concat(obj));
		}
		else
		{
			ChatBox.Instance.SendMessage("<color=red>[DANIS_NIGHTMARE] Unknown sub-command. Usage: /enemy help<color=white>");
		}
	}

	public static void ExecutePlayerCommand(string subCommand, string[] parts)
	{
		switch (subCommand)
		{
		case "help":
		case "h":
		case "?":
			ChatBox.Instance.SendMessage("<color=yellow>Player command usage: /player stamina<color=white>");
			ChatBox.Instance.SendMessage("<color=yellow>Player command usage: /player hunger<color=white>");
			ChatBox.Instance.SendMessage("<color=yellow>Player command usage: /player defense <percent_to_avoid><color=white>");
			ChatBox.Instance.SendMessage("<color=yellow>Player command usage: /player speed <multiplier><color=white>");
			ChatBox.Instance.SendMessage("<color=yellow>Player command usage: /player dmg <multiplier><color=white>");
			return;
		case "stamina":
		{
			infiniteStamina = !infiniteStamina;
			string text = (infiniteStamina ? "<color=green>ENABLED<color=white>" : "<color=red>DISABLED<color=white>");
			ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Infinite Stamina: " + text);
			MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Infinite Stamina set to: " + infiniteStamina));
			if (infiniteStamina && (Object)(object)PlayerStatus.Instance != (Object)null)
			{
				PlayerStatus.Instance.stamina = 100f;
			}
			return;
		}
		case "hunger":
		{
			infiniteHunger = !infiniteHunger;
			string text2 = (infiniteHunger ? "<color=green>ENABLED (Hunger Frozen)<color=white>" : "<color=red>DISABLED<color=white>");
			ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Infinite Hunger: " + text2);
			MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Infinite Hunger set to: " + infiniteHunger));
			if (infiniteHunger && (Object)(object)PlayerStatus.Instance != (Object)null)
			{
				PlayerStatus.Instance.hunger = 100f;
			}
			return;
		}
		case "defense":
		{
			if (parts.Length <= 2)
			{
				break;
			}
			if (float.TryParse(parts[2], NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
			{
				if (result < 0f)
				{
					result = 0f;
				}
				if (result > 100f)
				{
					result = 100f;
				}
				defensePercent = result;
				if (defensePercent >= 100f)
				{
					ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] God Mode: <color=green>ENABLED (Avoiding 100% of damage)<color=white>");
				}
				else
				{
					ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Defense set to: <color=orange>Avoiding " + result.ToString(CultureInfo.InvariantCulture) + "% of damage<color=white>");
				}
				MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Defense percentage set to: " + result + "%"));
			}
			else
			{
				ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Correct usage: /player defense <percent_to_avoid><color=white>");
			}
			return;
		}
		}
		if (subCommand == "speed" && parts.Length > 2)
		{
			if (float.TryParse(parts[2], NumberStyles.Any, CultureInfo.InvariantCulture, out var result2))
			{
				speedMultiplier = result2;
				ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Speed multiplier set to: <color=orange>x" + result2.ToString(CultureInfo.InvariantCulture) + "<color=white>");
				MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Speed multiplier changed to: x" + result2));
				if ((Object)(object)PlayerStatus.Instance != (Object)null)
				{
					PlayerStatus.Instance.UpdateStats();
				}
			}
			else
			{
				ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Correct usage: /player speed <multiplier><color=white>");
			}
		}
		else if (subCommand == "dmg" && parts.Length > 2)
		{
			if (int.TryParse(parts[2], out var result3))
			{
				damageMultiplier = result3;
				ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Damage multiplier set to: <color=orange>x" + result3 + "<color=white>");
				MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Damage multiplier changed to: x" + result3));
			}
			else
			{
				ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Correct usage: /player dmg <multiplier><color=white>");
			}
		}
		else
		{
			ChatBox.Instance.SendMessage("<color=red>[DANIS_NIGHTMARE] Unknown sub-command. Usage: /player help<color=white>");
		}
	}

	public static void ExecutePowerupCommand(string subCommand, string[] parts, string message)
	{
		//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0504: 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_050b: Unknown result type (might be due to invalid IL or missing references)
		//IL_050d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0514: Unknown result type (might be due to invalid IL or missing references)
		//IL_0519: Unknown result type (might be due to invalid IL or missing references)
		//IL_051e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0522: Unknown result type (might be due to invalid IL or missing references)
		//IL_057e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0544: Unknown result type (might be due to invalid IL or missing references)
		//IL_0583: Unknown result type (might be due to invalid IL or missing references)
		//IL_058c: Unknown result type (might be due to invalid IL or missing references)
		//IL_058e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0590: Unknown result type (might be due to invalid IL or missing references)
		switch (subCommand)
		{
		case "help":
		case "h":
		case "?":
			ChatBox.Instance.SendMessage("<color=yellow>Powerup command usage: /powerup tier <rarity><color=white>");
			ChatBox.Instance.SendMessage("<color=yellow>Powerup command usage: /powerup drop <multiplier><color=white>");
			ChatBox.Instance.SendMessage("<color=yellow>Powerup command usage: /powerup pickup <multiplier><color=white>");
			ChatBox.Instance.SendMessage("<color=yellow>Powerup command usage: /powerup give <name> <amount><color=white>");
			ChatBox.Instance.SendMessage("<color=yellow>Powerup command usage: /powerup spawn <name> <amount><color=white>");
			return;
		case "tier":
			if (parts.Length > 2)
			{
				switch (parts[2].ToLower())
				{
				case "white":
					forcedTier = 1;
					ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Chests forced to rarity: <color=white>COMMON (White)<color=white>");
					break;
				case "blue":
					forcedTier = 2;
					ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Chests forced to rarity: <color=cyan>RARO (Blue)<color=white>");
					break;
				case "orange":
					forcedTier = 3;
					ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Chests forced to rarity: <color=orange>LEGENDARIO (Naranja)<color=white>");
					break;
				case "reset":
					forcedTier = 0;
					ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Chest rarity restored to normal.");
					break;
				}
				MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Chest rarity (Forced Tier) changed to ID: " + forcedTier));
				return;
			}
			break;
		}
		if (subCommand == "pickup" && parts.Length > 2)
		{
			if (int.TryParse(parts[2], out var result))
			{
				powerupMultiplier = result;
				ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Powerup pickup multiplier: <color=orange>x" + result + "<color=white>");
				MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Powerup pickup multiplier changed to: x" + result));
			}
			else
			{
				ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Correct usage: /powerup pickup <multiplier><color=white>");
			}
		}
		else if (subCommand == "drop" && parts.Length > 2)
		{
			if (int.TryParse(parts[2], out var result2))
			{
				chestPowerupMultiplier = result2;
				ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Powerup drop count set to: <color=orange>x" + result2 + "<color=white>");
				MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Powerup drop count changed to: x" + result2));
			}
			else
			{
				ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Correct usage: /powerup drop <multiplier><color=white>");
			}
		}
		else if (subCommand == "give" && parts.Length > 3)
		{
			string text = "";
			for (int i = 2; i < parts.Length - 1; i++)
			{
				text = text + parts[i] + " ";
			}
			text = text.Trim();
			if (!int.TryParse(parts[^1], out var result3))
			{
				ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Correct usage: /powerup give <powerup_name> <amount><color=white>");
				return;
			}
			int num = -1;
			string text2 = "";
			foreach (KeyValuePair<string, int> item in ItemManager.Instance.stringToPowerupId)
			{
				if (item.Key.Equals(text, StringComparison.OrdinalIgnoreCase))
				{
					num = item.Value;
					text2 = item.Key;
					break;
				}
			}
			if (num == -1)
			{
				ChatBox.Instance.SendMessage("<color=red>[DANIS_NIGHTMARE] Error: Powerup '" + text + "' not found in RAM!<color=white>");
				return;
			}
			Traverse.Create((object)PowerupInventory.Instance).Field<int[]>("powerups").Value[num] += result3;
			UiEvents.Instance.AddPowerup(ItemManager.Instance.allPowerups[num]);
			PlayerStatus.Instance.UpdateStats();
			PowerupUI.Instance.AddPowerup(num);
			ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Added <color=orange>" + result3 + "x " + text2 + "<color=white> directly to your inventory.");
			MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Injected powerup directly: " + text2 + " | Count: " + result3));
		}
		else if (subCommand == "spawn" && parts.Length > 2)
		{
			string text3 = "";
			int result4 = 1;
			if (int.TryParse(parts[^1], out result4))
			{
				if (result4 < 1)
				{
					result4 = 1;
				}
				for (int j = 2; j < parts.Length - 1; j++)
				{
					text3 = text3 + parts[j] + " ";
				}
			}
			else
			{
				result4 = 1;
				for (int k = 2; k < parts.Length; k++)
				{
					text3 = text3 + parts[k] + " ";
				}
			}
			text3 = text3.Trim();
			int num2 = -1;
			string text4 = "";
			foreach (KeyValuePair<string, int> item2 in ItemManager.Instance.stringToPowerupId)
			{
				if (item2.Key.Equals(text3, StringComparison.OrdinalIgnoreCase))
				{
					num2 = item2.Value;
					text4 = item2.Key;
					break;
				}
			}
			if (num2 == -1)
			{
				ChatBox.Instance.SendMessage("<color=red>[DANIS_NIGHTMARE] Error: Powerup '" + text3 + "' not found in RAM!<color=white>");
				return;
			}
			Vector3 position = ((Component)GameManager.players[LocalClient.instance.myId]).transform.position;
			Vector3 forward = ((Component)GameManager.players[LocalClient.instance.myId]).transform.forward;
			Vector3 val = position + forward * 4.5f;
			val.y = position.y;
			for (int l = 0; l < result4; l++)
			{
				int nextId = ItemManager.Instance.GetNextId();
				Vector3 val2 = (Vector3)((result4 > 1) ? new Vector3((float)((double)Random.value - 0.5) * 1.5f, 0f, (float)((double)Random.value - 0.5) * 1.5f) : Vector3.zero);
				ItemManager.Instance.DropPowerupAtPosition(num2, val + val2, nextId);
			}
			ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Materialized <color=orange>" + result4 + "x " + text4 + "<color=white> on the ground!");
			MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Materialized powerups on the ground: " + text4 + " | Count: " + result4));
		}
		else
		{
			ChatBox.Instance.SendMessage("<color=red>[DANIS_NIGHTMARE] Unknown sub-command. Usage: /powerup help<color=white>");
		}
	}
}
[HarmonyPatch(typeof(ChatBox), "ChatCommand")]
public class ParcheChatDebug
{
	private static bool Prefix(string message)
	{
		string item = message.Split(new char[1] { ' ' })[0].ToLower();
		if (new List<string>
		{
			"/free", "/god", "/peaceful", "/kill", "/setday", "/setnight", "/spawnchest", "/player", "/powerup", "/items",
			"/item", "/enemy", "/structmult"
		}.Contains(item))
		{
			Plugin.ProcessDebugCommand(message);
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(ItemManager), "GetRandomPowerup")]
public class ParcheSiempreNaranja
{
	private static bool Prefix(ItemManager __instance, ref Powerup __result)
	{
		if (Plugin.forcedTier == 1)
		{
			__result = __instance.powerupsWhite[Random.Range(0, __instance.powerupsWhite.Length)];
			MonoBehaviour.print((object)"[DANIS_NIGHTMARE] Forced drop intercepted: White");
			return false;
		}
		if (Plugin.forcedTier == 2)
		{
			__result = __instance.powerupsBlue[Random.Range(0, __instance.powerupsBlue.Length)];
			MonoBehaviour.print((object)"[DANIS_NIGHTMARE] Forced drop intercepted: Blue");
			return false;
		}
		if (Plugin.forcedTier == 3)
		{
			__result = __instance.powerupsOrange[Random.Range(0, __instance.powerupsOrange.Length)];
			MonoBehaviour.print((object)"[DANIS_NIGHTMARE] Forced drop intercepted: Orange");
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(LootContainerInteract), "GetName")]
public class ParcheTextoCofre
{
	private static bool Prefix(LootContainerInteract __instance, ref string __result)
	{
		if (Plugin.chestsFree)
		{
			__result = "Open me, bitch!";
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(LootContainerInteract), "Interact")]
public class ParcheInteractCofre
{
	private static void Prefix(LootContainerInteract __instance, ref int __state)
	{
		__state = __instance.price;
		if (Plugin.chestsFree)
		{
			__instance.price = 0;
			MonoBehaviour.print((object)"[DANIS_NIGHTMARE] Chest clicked: Price temporarily forced to 0!");
		}
	}

	private static void Postfix(LootContainerInteract __instance, int __state)
	{
		__instance.price = __state;
	}
}
[HarmonyPatch(typeof(PlayerStatus), "Stamina")]
public class ParcheEstaminaGasto
{
	private static bool Prefix(PlayerStatus __instance, ref bool ___running, ref bool ___underwater, PlayerMovement ___player, ref float ___staminaRegenRate, ref float ___staminaDrainRate)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		if (Plugin.infiniteStamina)
		{
			Vector3 velocity = ___player.GetVelocity();
			___running = ((Vector3)(ref velocity)).magnitude > 5f && ___player.sprinting;
			___underwater = ___player.IsUnderWater();
			if (!___running && !___underwater)
			{
				if (__instance.stamina < 100f && ___player.grounded && __instance.hunger > 0f)
				{
					float num = 1f;
					if (__instance.hunger <= 0f)
					{
						num *= 0.3f;
					}
					__instance.stamina += ___staminaRegenRate * Time.deltaTime * num;
				}
				return false;
			}
			_ = __instance.stamina;
			_ = 0f;
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(PlayerStatus), "Jump")]
public class ParcheEstaminaSalto
{
	private static bool Prefix()
	{
		if (Plugin.infiniteStamina)
		{
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(PowerupInventory), "GetSpeedMultiplier")]
public class Patch_PlayerSpeedMultiplier
{
	private static void Postfix(ref float __result)
	{
		__result *= Plugin.speedMultiplier;
	}
}
[HarmonyPatch(typeof(PlayerStatus), "HandleDamage")]
public class ParcheModoDios
{
	private static bool Prefix()
	{
		if (Plugin.godMode)
		{
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(PlayerStatus), "Hunger")]
public class ParcheHambreInfinita
{
	private static bool Prefix()
	{
		if (Plugin.infiniteHunger)
		{
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(LootDrop), "GetLoot", new Type[] { })]
public class ParcheRngForce1
{
	private static bool Prefix(LootDrop __instance, ref List<InventoryItem> __result)
	{
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Expected O, but got Unknown
		if (Plugin.forceRng)
		{
			List<InventoryItem> list = new List<InventoryItem>();
			if (__instance.loot != null)
			{
				LootItems[] loot = __instance.loot;
				foreach (LootItems val in loot)
				{
					if (val != null && (Object)(object)val.item != (Object)null)
					{
						int amountMax = val.amountMax;
						InventoryItem val2 = (InventoryItem)ScriptableObject.CreateInstance(typeof(InventoryItem));
						val2.Copy(val.item, amountMax);
						list.Add(val2);
					}
				}
			}
			__result = list;
			MonoBehaviour.print((object)("[DANIS_NIGHTMARE] LootDrop ID " + __instance.id + " forced to 100% max drop!"));
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(LootDrop), "GetLoot", new Type[] { typeof(ConsistentRandom) })]
public class ParcheRngForce2
{
	private static bool Prefix(LootDrop __instance, ref List<InventoryItem> __result)
	{
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Expected O, but got Unknown
		if (Plugin.forceRng)
		{
			List<InventoryItem> list = new List<InventoryItem>();
			if (__instance.loot != null)
			{
				LootItems[] loot = __instance.loot;
				foreach (LootItems val in loot)
				{
					if (val != null && (Object)(object)val.item != (Object)null)
					{
						int amountMax = val.amountMax;
						InventoryItem val2 = (InventoryItem)ScriptableObject.CreateInstance(typeof(InventoryItem));
						val2.Copy(val.item, amountMax);
						list.Add(val2);
					}
				}
			}
			__result = list;
			MonoBehaviour.print((object)("[DANIS_NIGHTMARE] LootDrop (Random) ID " + __instance.id + " forced to 100% max drop!"));
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(LootDrop), "GetLoot", new Type[] { })]
public class ParcheDropMultiplier1
{
	private static void Postfix(ref List<InventoryItem> __result)
	{
		if (Plugin.dropMultiplier <= 1 || __result == null)
		{
			return;
		}
		foreach (InventoryItem item in __result)
		{
			if ((Object)(object)item != (Object)null)
			{
				item.amount *= Plugin.dropMultiplier;
			}
		}
		MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Drop amounts multiplied by: x" + Plugin.dropMultiplier));
	}
}
[HarmonyPatch(typeof(LootDrop), "GetLoot", new Type[] { typeof(ConsistentRandom) })]
public class ParcheDropMultiplier2
{
	private static void Postfix(ref List<InventoryItem> __result)
	{
		if (Plugin.dropMultiplier <= 1 || __result == null)
		{
			return;
		}
		foreach (InventoryItem item in __result)
		{
			if ((Object)(object)item != (Object)null)
			{
				item.amount *= Plugin.dropMultiplier;
			}
		}
		MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Drop amounts (Random) multiplied by: x" + Plugin.dropMultiplier));
	}
}
[HarmonyPatch(typeof(PowerupInventory), "AddPowerup")]
public class ParcheCantidadPowerups
{
	private static bool Prefix(ref int[] ___powerups, int powerupId)
	{
		if (Plugin.powerupMultiplier > 1)
		{
			___powerups[powerupId] += Plugin.powerupMultiplier - 1;
		}
		return true;
	}
}
[HarmonyPatch(typeof(PowerupUI), "AddPowerup")]
public class ParcheUI_PowerupAmount
{
	private static void Postfix(int powerupId, Dictionary<int, GameObject> ___powerups)
	{
		if (___powerups.ContainsKey(powerupId) && (Object)(object)PowerupInventory.Instance != (Object)null)
		{
			string name = ItemManager.Instance.allPowerups[powerupId].name;
			int amount = PowerupInventory.Instance.GetAmount(name);
			TextMeshProUGUI componentInChildren = ___powerups[powerupId].GetComponentInChildren<TextMeshProUGUI>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				((TMP_Text)componentInChildren).text = amount.ToString();
			}
		}
	}
}
[HarmonyPatch(typeof(PowerupInventory), "GetStrengthMultiplier")]
public class ParcheDanoMultiplicador
{
	private static void Postfix(ref float __result)
	{
		__result *= Plugin.damageMultiplier;
	}
}
[HarmonyPatch(typeof(PlayerMovement), "Movement")]
public class Patch_PlayerMovementForce
{
	private static void Prefix(ref float ___moveSpeed)
	{
		if (Plugin.speedMultiplier > 1f)
		{
			___moveSpeed = 3500f * (Plugin.speedMultiplier * 0.5f);
		}
		else
		{
			___moveSpeed = 3500f * Plugin.speedMultiplier;
		}
	}
}
[HarmonyPatch(typeof(PlayerStatus), "HandleDamage")]
public class ParcheDefensa
{
	private static void Prefix(ref int damageTaken)
	{
		if (Plugin.defensePercent > 0f)
		{
			float num = (100f - Plugin.defensePercent) / 100f;
			damageTaken = (int)((float)damageTaken * num);
		}
	}
}
[HarmonyPatch(typeof(StructureSpawner), "Start")]
public class Patch_StructureSpawner
{
	private static void Prefix(StructureSpawner __instance)
	{
		__instance.nShrines *= Plugin.structureMultiplier;
		MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Spawning " + __instance.nShrines + " total structures (Multiplier: x" + Plugin.structureMultiplier + ")"));
	}
}
[HarmonyPatch(typeof(LootContainerInteract), "ServerExecute")]
public class Patch_ChestPowerupCount
{
	private static bool Prefix(LootContainerInteract __instance, int fromClient)
	{
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		if (LocalClient.serverOwner)
		{
			int chestPowerupMultiplier = Plugin.chestPowerupMultiplier;
			for (int i = 0; i < chestPowerupMultiplier; i++)
			{
				Powerup val = ItemManager.Instance.GetRandomPowerup(__instance.white, __instance.blue, __instance.gold);
				if (__instance.testPowerup && (Object)(object)__instance.powerupToTest != (Object)null)
				{
					val = __instance.powerupToTest;
				}
				int nextId = ItemManager.Instance.GetNextId();
				Vector3 val2 = (Vector3)((chestPowerupMultiplier > 1) ? new Vector3((Random.value - 0.5f) * 1.5f, 1.2f, (Random.value - 0.5f) * 1.5f) : Vector3.zero);
				ItemManager.Instance.DropPowerupAtPosition(val.id, ((Component)__instance).transform.position + val2, nextId);
				ServerSend.DropPowerupAtPosition(val.id, nextId, ((Component)__instance).transform.position + val2);
			}
			MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Chest opened. Multiplied powerup drop count: " + chestPowerupMultiplier));
		}
		return false;
	}
}
[HarmonyPatch(typeof(ShrineInteractable), "DropPowerup")]
public class Patch_ShrineDrop
{
	private static bool Prefix(ShrineInteractable __instance)
	{
		//IL_0070: 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_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		if (LocalClient.serverOwner)
		{
			int chestPowerupMultiplier = Plugin.chestPowerupMultiplier;
			for (int i = 0; i < chestPowerupMultiplier; i++)
			{
				Powerup randomPowerup = ItemManager.Instance.GetRandomPowerup(0.3f, 0.2f, 0.1f);
				int nextId = ItemManager.Instance.GetNextId();
				Vector3 val = (Vector3)((chestPowerupMultiplier > 1) ? new Vector3((Random.value - 0.5f) * 1.5f, 1.2f, (Random.value - 0.5f) * 1.5f) : Vector3.zero);
				ItemManager.Instance.DropPowerupAtPosition(randomPowerup.id, ((Component)__instance).transform.position + val, nextId);
				ServerSend.DropPowerupAtPosition(randomPowerup.id, nextId, ((Component)__instance).transform.position + val);
			}
			MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Shrine loot spawned. Multiplied count: " + chestPowerupMultiplier));
		}
		return false;
	}
}
[HarmonyPatch(typeof(LootExtra), "BossLoot")]
public class Patch_BossLoot
{
	private static bool Prefix(Transform dropPos, BossType mobType)
	{
		//IL_0070: 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_0075: 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_0088: 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_009d: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
		if (LocalClient.serverOwner)
		{
			int chestPowerupMultiplier = Plugin.chestPowerupMultiplier;
			for (int i = 0; i < chestPowerupMultiplier; i++)
			{
				Powerup randomPowerup = ItemManager.Instance.GetRandomPowerup(0f, 0.8f, 0.2f);
				int nextId = ItemManager.Instance.GetNextId();
				Vector3 val = (Vector3)((chestPowerupMultiplier > 1) ? new Vector3((Random.value - 0.5f) * 1.5f, 1.2f, (Random.value - 0.5f) * 1.5f) : Vector3.zero);
				ItemManager.Instance.DropPowerupAtPosition(randomPowerup.id, dropPos.position + val, nextId);
				ServerSend.DropPowerupAtPosition(randomPowerup.id, nextId, dropPos.position + val);
			}
			MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Boss loot spawned. Multiplied count: " + chestPowerupMultiplier));
		}
		return false;
	}
}
[HarmonyPatch(typeof(MobZone), "ServerSpawnEntity")]
public class ParcheMobZone
{
	private static bool Prefix(MobZone __instance)
	{
		if (Plugin.peacefulMode && (Object)(object)__instance.mobType != (Object)null)
		{
			string name = __instance.mobType.name;
			if (name == "Woodman" || name == "Cow")
			{
				return true;
			}
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(GameLoop), "CheckMobSpawns")]
public class Patch_NightSpawnsBypass
{
	private static bool Prefix(GameLoop __instance, ref Vector2 ___checkMobUpdateInterval)
	{
		if (Plugin.peacefulMode)
		{
			float num = (float)GameManager.instance.GetPlayersAlive() / 2f;
			float num2 = Random.Range(___checkMobUpdateInterval.x / num, ___checkMobUpdateInterval.y / num);
			((MonoBehaviour)__instance).Invoke("CheckMobSpawns", num2);
			MonoBehaviour.print((object)"[DANIS_NIGHTMARE] Nightly mob spawn bypassed (Peaceful Mode active).");
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(GameLoop), "StartBoss")]
public class Patch_NightBossBypass
{
	private static bool Prefix()
	{
		if (Plugin.peacefulMode)
		{
			MonoBehaviour.print((object)"[DANIS_NIGHTMARE] Nightly calendar boss spawn bypassed (Peaceful Mode active).");
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(GameLoop), "FindMobCap")]
public class Patch_MobCap
{
	private static void Postfix()
	{
		GameLoop.currentMobCap = Mathf.RoundToInt((float)GameLoop.currentMobCap * Plugin.mobMultiplier);
	}
}
[HarmonyPatch(typeof(GameLoop), "SpawnMob")]
public class Patch_SpawnMobMultiplier
{
	private static bool Prefix(MobType mob, Vector3 pos, float multiplier, float bossMultiplier, BossType bossType)
	{
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		if (Plugin.mobMultiplier <= 1f || Plugin.peacefulMode)
		{
			return true;
		}
		int num = Mathf.FloorToInt(Plugin.mobMultiplier) - 1;
		float num2 = Plugin.mobMultiplier - Mathf.Floor(Plugin.mobMultiplier);
		if (Random.value < num2)
		{
			num++;
		}
		for (int i = 0; i < num; i++)
		{
			int nextId = MobManager.Instance.GetNextId();
			MobSpawner.Instance.ServerSpawnNewMob(nextId, mob.id, pos, multiplier, bossMultiplier, bossType, -1);
		}
		return true;
	}
}
[HarmonyPatch(typeof(TradeUi), "SetTrade")]
public class Patch_TradeUi_SetTrade
{
	private static void Prefix(TradeUi __instance, Trade t, bool buy, ref int __state)
	{
		__state = t.price;
		if (Plugin.chestsFree && buy)
		{
			t.price = 0;
		}
	}

	private static void Postfix(TradeUi __instance, Trade t, int __state)
	{
		t.price = __state;
	}
}
[HarmonyPatch(typeof(TradeUi), "BuySell")]
public class Patch_TradeUi_BuySell
{
	private static void Prefix(TradeUi __instance, ref Trade ___trade, bool ___buy, ref int __state)
	{
		__state = ___trade.price;
		if (Plugin.chestsFree && ___buy)
		{
			___trade.price = 0;
		}
	}

	private static void Postfix(TradeUi __instance, ref Trade ___trade, int __state)
	{
		___trade.price = __state;
	}
}
[HarmonyPatch(typeof(GameManager), "MobDamageMultiplier")]
public class Patch_MobDamageMultiplier
{
	private static void Postfix(ref float __result)
	{
		__result *= Plugin.enemyDmgMultiplier;
	}
}
[HarmonyPatch(typeof(GameManager), "MobHpMultiplier")]
public class Patch_MobHpMultiplier
{
	private static void Postfix(ref float __result)
	{
		__result *= Plugin.enemyHpMultiplier;
	}
}
[HarmonyPatch(typeof(ChatBox), "Awake")]
public class Patch_ChatBox_Autocomplete
{
	private static void Postfix(ChatBox __instance)
	{
		if (__instance.commands != null)
		{
			List<string> list = new List<string>(__instance.commands);
			string[] array = new string[13]
			{
				"free", "god", "peaceful", "kill", "setday", "setnight", "spawnchest", "player", "powerup", "items",
				"item", "enemy", "structmult"
			};
			list.AddRange(array);
			__instance.commands = list.ToArray();
			MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Injected " + array.Length + " main commands into native autocomplete database."));
		}
	}
}
[HarmonyPatch(typeof(Commands), "PredictCommands")]
public class Patch_Commands_Predict
{
	private static bool Prefix(Commands __instance, ref string ___suggestedText)
	{
		if (!ChatBox.Instance.typing)
		{
			return true;
		}
		string text = __instance.inputField.text;
		if (text.Length < 1)
		{
			return true;
		}
		string[] array = text.Split(new char[1] { ' ' }, StringSplitOptions.None);
		if (array.Length < 1)
		{
			return true;
		}
		string text2 = array[0].ToLower();
		if (array.Length == 1 && array[0].StartsWith("/"))
		{
			string value = array[0].Substring(1).ToLower();
			string[] array2 = new string[17]
			{
				"seed", "ping", "debug", "kill", "kick", "free", "god", "peaceful", "setday", "setnight",
				"spawnchest", "player", "powerup", "items", "item", "enemy", "structmult"
			};
			foreach (string text3 in array2)
			{
				if (text3.StartsWith(value))
				{
					___suggestedText = "/" + text3;
					return false;
				}
			}
		}
		if (array.Length == 2)
		{
			string value2 = array[1].ToLower();
			string[] array3 = null;
			switch (text2)
			{
			case "/player":
				array3 = new string[5] { "stamina", "hunger", "defense", "speed", "dmg" };
				break;
			case "/powerup":
				array3 = new string[5] { "tier", "pickup", "drop", "give", "spawn" };
				break;
			case "/items":
			case "/item":
				array3 = new string[3] { "forcerng", "drop", "give" };
				break;
			case "/enemy":
				array3 = new string[4] { "hp", "dmg", "amount", "spawn" };
				break;
			case "/kill":
				array3 = new string[6] { "enemies", "bosses", "hostiles", "peaceful", "all", "self" };
				break;
			}
			if (array3 != null)
			{
				string[] array2 = array3;
				foreach (string text4 in array2)
				{
					if (text4.StartsWith(value2))
					{
						___suggestedText = array[0] + " " + text4;
						return false;
					}
				}
			}
		}
		if (array.Length >= 3)
		{
			string text5 = array[1].ToLower();
			string text6 = "";
			for (int j = 2; j < array.Length; j++)
			{
				text6 = text6 + array[j] + " ";
			}
			text6 = text6.Trim().ToLower();
			if (text2 == "/powerup" && (text5 == "spawn" || text5 == "give"))
			{
				foreach (string key in ItemManager.Instance.stringToPowerupId.Keys)
				{
					if (key.ToLower().StartsWith(text6))
					{
						___suggestedText = array[0] + " " + array[1] + " " + key;
						return false;
					}
				}
			}
			if ((text2 == "/items" || text2 == "/item") && text5 == "give")
			{
				foreach (InventoryItem value3 in ItemManager.Instance.allItems.Values)
				{
					if ((Object)(object)value3 != (Object)null && value3.name.ToLower().StartsWith(text6))
					{
						___suggestedText = array[0] + " " + array[1] + " " + value3.name;
						return false;
					}
				}
			}
			if (text2 == "/enemy" && text5 == "spawn")
			{
				MobType[] allMobs = MobSpawner.Instance.allMobs;
				foreach (MobType val in allMobs)
				{
					if ((Object)(object)val != (Object)null && val.name.ToLower().StartsWith(text6))
					{
						___suggestedText = array[0] + " " + array[1] + " " + val.name;
						return false;
					}
				}
			}
		}
		return true;
	}
}
[HarmonyPatch(typeof(ChatBox), "SendMessage", new Type[] { typeof(string) })]
public class Patch_ChatBox_PickupNotification
{
	private static void Prefix(ref string message)
	{
		if (message.StartsWith("Picked up ") && Plugin.powerupMultiplier > 1)
		{
			message = message.Replace("Picked up ", "Picked up " + Plugin.powerupMultiplier + "x ");
		}
	}
}