using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BoneLib;
using BoneLib.BoneMenu;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UltimatePack;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Main), "Ultimate Pack", "2.3.0", "NOODLETEAM", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ultimate pack")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ultimate pack")]
[assembly: AssemblyTitle("ultimate pack")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace UltimatePack
{
public class Main : MelonMod
{
public static bool GodMode = false;
public static bool InfiniteAmmo = false;
public static bool SuperSpeed = false;
public static float SpeedMultiplier = 2f;
public static string DetectedModIoToken = string.Empty;
public override void OnInitializeMelon()
{
AutoDetectModIoToken();
SetupMenu();
MelonLogger.Msg("Ultimate Pack 2.3.0 (Auto-Token & Spawner Update) initialized.");
}
private static void AutoDetectModIoToken()
{
try
{
string persistentDataPath = Application.persistentDataPath;
MelonLogger.Msg("Searching for mod.io configuration in: " + persistentDataPath);
string[] array = new string[4]
{
Path.Combine(persistentDataPath, "modio.json"),
Path.Combine(persistentDataPath, "modiosettings.json"),
Path.Combine(persistentDataPath, "Mods", "modio.json"),
Path.Combine(persistentDataPath, "mod.io", "OAuthToken.json")
};
foreach (string path in array)
{
if (File.Exists(path))
{
Match match = Regex.Match(File.ReadAllText(path), "\"(?:access_token|oauth_token|token)\"\\s*:\\s*\"([^\"]+)\"");
if (match.Success)
{
DetectedModIoToken = match.Groups[1].Value;
MelonLogger.Msg("Successfully extracted mod.io API token from game data!");
return;
}
}
}
if (Directory.Exists(persistentDataPath))
{
array = Directory.GetFiles(persistentDataPath, "*.json", SearchOption.AllDirectories);
foreach (string text in array)
{
if (text.ToLower().Contains("modio") || text.ToLower().Contains("token"))
{
Match match2 = Regex.Match(File.ReadAllText(text), "\"(?:access_token|oauth_token|token)\"\\s*:\\s*\"([^\"]+)\"");
if (match2.Success)
{
DetectedModIoToken = match2.Groups[1].Value;
MelonLogger.Msg("Found mod.io API token in: " + Path.GetFileName(text));
return;
}
}
}
}
MelonLogger.Warning("Could not auto-detect mod.io token. Make sure you are signed into mod.io in-game.");
}
catch (Exception ex)
{
MelonLogger.Error("Error reading mod.io token from game data: " + ex.Message);
}
}
private void SetupMenu()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
Page obj = Page.Root.CreatePage("Ultimate Pack", Color.cyan, 0, true);
Page obj2 = obj.CreatePage("Combat Options", Color.red, 0, true);
obj2.CreateBool("God Mode", Color.green, GodMode, (Action<bool>)delegate(bool val)
{
GodMode = val;
});
obj2.CreateBool("Infinite Ammo", Color.yellow, InfiniteAmmo, (Action<bool>)delegate(bool val)
{
InfiniteAmmo = val;
if (InfiniteAmmo)
{
RefillAmmo();
}
});
obj2.CreateFunction("Refill All Ammo Now", Color.white, (Action)RefillAmmo);
Page obj3 = obj.CreatePage("Movement Options", Color.blue, 0, true);
obj3.CreateBool("Super Speed", Color.green, SuperSpeed, (Action<bool>)delegate(bool val)
{
SuperSpeed = val;
});
obj3.CreateFloat("Speed Multiplier", Color.white, 0.5f, 1f, 5f, SpeedMultiplier, (Action<float>)delegate(float val)
{
SpeedMultiplier = val;
});
Page obj4 = obj.CreatePage("Item & Mod Spawner", Color.magenta, 0, true);
Page categoryPage = obj4.CreatePage("Guns & Firearms", Color.yellow, 0, true);
Page categoryPage2 = obj4.CreatePage("Melee Weapons", Color.red, 0, true);
Page categoryPage3 = obj4.CreatePage("NPCs & Enemies", Color.green, 0, true);
Page categoryPage4 = obj4.CreatePage("Props & Vehicles", Color.cyan, 0, true);
Page categoryPage5 = obj4.CreatePage("Installed Mods & Custom Content", Color.white, 0, true);
SetupCategoryMenu(categoryPage, "Guns");
SetupCategoryMenu(categoryPage2, "Melee");
SetupCategoryMenu(categoryPage3, "NPCs");
SetupCategoryMenu(categoryPage4, "Props");
SetupCategoryMenu(categoryPage5, "Mods");
Page obj5 = obj4.CreatePage("Mod.io Status", Color.grey, 0, true);
obj5.CreateFunction("Check Detected Token Status", Color.yellow, (Action)ShowTokenStatus);
obj5.CreateFunction("Re-scan Game Data for Token", Color.cyan, (Action)AutoDetectModIoToken);
}
private void SetupCategoryMenu(Page categoryPage, string categoryName)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
categoryPage.CreateFunction("Scan for " + categoryName, Color.white, (Action)delegate
{
PopulateCategorySpawnables(categoryPage, categoryName);
});
}
private static void PopulateCategorySpawnables(Page page, string category)
{
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
try
{
Type type = Type.GetType("SLZ.Marrow.Warehouse.AssetWarehouse, Il2CppSLZ.Marrow");
if (!(type != null))
{
return;
}
dynamic val = type.GetProperty("Instance")?.GetValue(null);
if (!((val != null) ? true : false))
{
return;
}
dynamic crates = val.GetCrates();
foreach (dynamic item in crates)
{
string text = item.Title;
string barcode = item.Barcode;
if (MatchesCategory(text, category))
{
page.CreateFunction("Spawn " + text, Color.green, (Action)delegate
{
SpawnCrateByBarcode(barcode);
});
}
}
}
catch
{
MelonLogger.Warning("Unable to scan crates for " + category + ".");
}
}
private static bool MatchesCategory(string name, string category)
{
string text = name.ToLower();
switch (category)
{
case "Guns":
if (!text.Contains("gun") && !text.Contains("pistol") && !text.Contains("rifle"))
{
return text.Contains("shotgun");
}
return true;
case "Melee":
if (!text.Contains("sword") && !text.Contains("blade") && !text.Contains("knife") && !text.Contains("bat"))
{
return text.Contains("axe");
}
return true;
case "NPCs":
if (!text.Contains("npc") && !text.Contains("null") && !text.Contains("ford") && !text.Contains("zombie"))
{
return text.Contains("headcrab");
}
return true;
case "Props":
if (!text.Contains("prop") && !text.Contains("box") && !text.Contains("barrel") && !text.Contains("chair"))
{
return text.Contains("vehicle");
}
return true;
case "Mods":
return true;
default:
return false;
}
}
private static void SpawnCrateByBarcode(string barcode)
{
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
try
{
object rigManager = GetRigManager();
if (rigManager != null)
{
dynamic val = rigManager;
Transform val2 = (Transform)val.physicsRig.m_head;
Vector3 val3 = val2.position + val2.forward * 1.5f;
(Type.GetType("BoneLib.BoneSpawner, BoneLib")?.GetMethod("SpawnPayload", BindingFlags.Static | BindingFlags.Public))?.Invoke(null, new object[3]
{
barcode,
val3,
Quaternion.identity
});
}
}
catch (Exception ex)
{
MelonLogger.Error("Failed to spawn crate [" + barcode + "]: " + ex.Message);
}
}
private static void ShowTokenStatus()
{
if (!string.IsNullOrEmpty(DetectedModIoToken))
{
string text = ((DetectedModIoToken.Length > 10) ? (DetectedModIoToken.Substring(0, 10) + "...") : DetectedModIoToken);
MelonLogger.Msg("Mod.io Token active: " + text);
}
else
{
MelonLogger.Warning("No Mod.io Token detected in game files yet. Ensure you are signed in inside BONELAB settings.");
}
}
public override void OnUpdate()
{
if (GodMode)
{
object rigManager = GetRigManager();
if (rigManager != null)
{
dynamic val = rigManager;
if (val.health != null)
{
val.health.curr_Health = val.health.max_Health;
val.health.dying = false;
}
}
}
if (InfiniteAmmo && Time.frameCount % 30 == 0)
{
RefillAmmo();
}
}
public override void OnFixedUpdate()
{
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
if (!SuperSpeed)
{
return;
}
object physicsRig = GetPhysicsRig();
if (physicsRig != null)
{
dynamic val = physicsRig;
dynamic val2 = val.physBody ?? val.m_physBody;
if (val2 != null)
{
Vector3 val3 = (Vector3)val2.velocity;
val2.velocity = (dynamic)new Vector3(val3.x * SpeedMultiplier, val3.y, val3.z * SpeedMultiplier);
}
}
}
private static void RefillAmmo()
{
object rigManager = GetRigManager();
if (rigManager == null)
{
return;
}
try
{
dynamic val = rigManager;
dynamic val2 = val.AmmoInventory;
if (val2 != null)
{
val2.lightAmmo = 9999;
val2.mediumAmmo = 9999;
val2.heavyAmmo = 9999;
}
}
catch
{
}
}
private static object GetRigManager()
{
return typeof(Player).GetProperty("RigManager")?.GetValue(null);
}
private static object GetPhysicsRig()
{
return typeof(Player).GetProperty("PhysicsRig")?.GetValue(null);
}
}
}