using System;
using System.Collections.Generic;
using System.Diagnostics;
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", "1.0.0")]
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;
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_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Expected O, but got Unknown
//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
//IL_040d: Unknown result type (might be due to invalid IL or missing references)
//IL_0412: Unknown result type (might be due to invalid IL or missing references)
//IL_0414: Unknown result type (might be due to invalid IL or missing references)
//IL_0416: Unknown result type (might be due to invalid IL or missing references)
//IL_041d: Unknown result type (might be due to invalid IL or missing references)
//IL_0422: Unknown result type (might be due to invalid IL or missing references)
//IL_0427: Unknown result type (might be due to invalid IL or missing references)
//IL_042b: Unknown result type (might be due to invalid IL or missing references)
//IL_0437: Unknown result type (might be due to invalid IL or missing references)
//IL_0439: Unknown result type (might be due to invalid IL or missing references)
//IL_043e: Unknown result type (might be due to invalid IL or missing references)
//IL_0442: Unknown result type (might be due to invalid IL or missing references)
//IL_0444: Unknown result type (might be due to invalid IL or missing references)
//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
//IL_04c7: 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));
if (text == "/free")
{
chestsFree = !chestsFree;
string text2 = (chestsFree ? "<color=green>ENABLED<color=white>" : "<color=red>DISABLED<color=white>");
ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Free chests hack: " + text2);
MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Free chests hack set to: " + chestsFree));
return;
}
if (text == "/tier" && array.Length > 1)
{
switch (array[1].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>RARE (Blue)<color=white>");
break;
case "orange":
forcedTier = 3;
ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Chests forced to rarity: <color=orange>LEGENDARY (Orange)<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;
}
if (text == "/gold" && array.Length > 1)
{
if (int.TryParse(array[1], out var result))
{
InventoryItem val = (InventoryItem)ScriptableObject.CreateInstance(typeof(InventoryItem));
val.Copy(ItemManager.Instance.GetItemByName("Coin"), result);
InventoryUI.Instance.AddItemToInventory(val);
ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Added <color=yellow>" + result + " gold<color=white> to your inventory.");
MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Spawned " + result + " physical gold coins in inventory RAM."));
}
return;
}
if (text == "/stamina")
{
infiniteStamina = !infiniteStamina;
string text3 = (infiniteStamina ? "<color=green>ENABLED<color=white>" : "<color=red>DISABLED<color=white>");
ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Infinite Stamina: " + text3);
MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Infinite Stamina set to: " + infiniteStamina));
if (infiniteStamina && (Object)(object)PlayerStatus.Instance != (Object)null)
{
PlayerStatus.Instance.stamina = 100f;
}
return;
}
if (text == "/speed" && array.Length > 1)
{
if (float.TryParse(array[1], out var result2))
{
speedMultiplier = result2;
ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Speed multiplier set to: <color=orange>x" + result2 + "<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: /speed <multiplier><color=white>");
}
return;
}
if (text == "/spawnchest" && array.Length > 1)
{
string text4 = array[1].ToLower();
int num = -1;
switch (text4)
{
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 val2 = null;
SpawnPowerupsInLocations[] array3 = array2;
foreach (SpawnPowerupsInLocations val3 in array3)
{
if (val3.powerupChests != null && val3.powerupChests.Length > num)
{
val2 = val3.powerupChests[num].prefab;
break;
}
}
if ((Object)(object)val2 == (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 val4 = position + forward * 4.5f;
val4.y = position.y;
Quaternion val5 = Quaternion.LookRotation(forward);
GameObject val6 = Object.Instantiate<GameObject>(val2, val4, val5);
int nextId = ResourceManager.Instance.GetNextId();
LootContainerInteract componentInChildren = val6.GetComponentInChildren<LootContainerInteract>();
if ((Object)(object)componentInChildren != (Object)null)
{
componentInChildren.SetId(nextId);
}
ResourceManager.Instance.AddObject(nextId, val6);
ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] " + text4.ToUpper() + " chest materialized at your feet!");
string[] obj = new string[6]
{
"[DANIS_NIGHTMARE] Spawned chest: ",
text4.ToUpper(),
" | Position: ",
null,
null,
null
};
Vector3 val7 = val4;
obj[3] = ((object)(*(Vector3*)(&val7))/*cast due to .constrained prefix*/).ToString();
obj[4] = " | ID: ";
obj[5] = nextId.ToString();
MonoBehaviour.print((object)string.Concat(obj));
return;
}
switch (text)
{
case "/god":
{
godMode = !godMode;
string text5 = (godMode ? "<color=green>ENABLED<color=white>" : "<color=red>DISABLED<color=white>");
ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] God Mode: " + text5);
MonoBehaviour.print((object)("[DANIS_NIGHTMARE] God Mode set to: " + godMode));
return;
}
case "/hunger":
{
infiniteHunger = !infiniteHunger;
string text6 = (infiniteHunger ? "<color=green>ENABLED (Hunger Frozen)<color=white>" : "<color=red>DISABLED<color=white>");
ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Infinite Hunger: " + text6);
MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Infinite Hunger set to: " + infiniteHunger));
if (infiniteHunger && (Object)(object)PlayerStatus.Instance != (Object)null)
{
PlayerStatus.Instance.hunger = 100f;
}
return;
}
case "/dmg":
if (array.Length > 1)
{
if (int.TryParse(array[1], 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: /dmg <multiplier><color=white>");
}
return;
}
break;
}
if (text == "/forcerng")
{
forceRng = !forceRng;
string text7 = (forceRng ? "<color=green>ENABLED (100% Max Drop)<color=white>" : "<color=red>DISABLED<color=white>");
ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Force RNG: " + text7);
MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Force RNG (Max Drops) set to: " + forceRng));
}
else if (text == "/dropmult" && array.Length > 1)
{
if (int.TryParse(array[1], out var result4))
{
dropMultiplier = result4;
ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Drop multiplier set to: <color=orange>x" + result4 + "<color=white>");
MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Drop multiplier changed to: x" + result4));
}
else
{
ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Correct usage: /dropmult <multiplier><color=white>");
}
}
else if (text == "/pmult" && array.Length > 1)
{
if (int.TryParse(array[1], out var result5))
{
powerupMultiplier = result5;
ChatBox.Instance.SendMessage("[DANIS_NIGHTMARE] Powerup pickup multiplier: <color=orange>x" + result5 + "<color=white>");
MonoBehaviour.print((object)("[DANIS_NIGHTMARE] Powerup pickup multiplier changed to: x" + result5));
}
else
{
ChatBox.Instance.SendMessage("<color=yellow>[DANIS_NIGHTMARE] Correct usage: /pmult <multiplier><color=white>");
}
}
else
{
ChatBox.Instance.SendMessage("<color=red>[DANIS_NIGHTMARE] Unknown command. Commands: /free, /tier, /gold, /stamina, /dropmult, /pmult, /forcerng, /speed, /god, /hunger, /dmg, /spawnchest<color=white>");
}
}
}
[HarmonyPatch(typeof(ChatBox), "SendMessage", new Type[] { typeof(string) })]
public class ParcheChatDebug
{
private static bool Prefix(ref string message)
{
if (message.StartsWith("/") && !message.StartsWith("/give"))
{
Plugin.ProcessDebugCommand(message);
return false;
}
if (message.StartsWith("Picked up ") && Plugin.powerupMultiplier > 1)
{
message = message.Replace("Picked up ", "Picked up " + Plugin.powerupMultiplier + "x ");
}
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)
{
MonoBehaviour.print((object)"[DANIS_NIGHTMARE] Jump detected: Stamina drain bypassed!");
return false;
}
return true;
}
}
[HarmonyPatch(typeof(PlayerMovement), "Movement")]
public class ParcheVelocidadReal
{
private static void Prefix(PlayerMovement __instance, ref float ___moveSpeed, ref float ___maxSpeed)
{
___moveSpeed = 3500f * Plugin.speedMultiplier;
___maxSpeed = 6.5f * 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;
}
}