using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.Notifications;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSLZ.Bonelab;
using Il2CppSLZ.Marrow.SceneStreaming;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LabFusion.Downloading;
using LabFusion.Downloading.ModIO;
using LabFusion.Marrow;
using LabFusion.Network;
using LabFusion.Senders;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using PalletPaste;
using PalletPaste.SpawnGun;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "PalletPaste", "2.0.0", "Fizzyhex", null)]
[assembly: MelonColor(255, 20, 194, 215)]
[assembly: MelonAuthorColor(255, 108, 116, 230)]
[assembly: MelonAdditionalDependencies(new string[] { "LabFusion" })]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("PalletPaste")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+1a5a9bbd69b6c45f5915f16f93df3af50e02c456")]
[assembly: AssemblyProduct("PalletPaste")]
[assembly: AssemblyTitle("PalletPaste")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 PalletPaste
{
public class Core : MelonMod
{
public override void OnUpdate()
{
if (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)118))
{
OnPaste();
}
}
internal static void OnPaste()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_0079: 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_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: 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)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Expected O, but got Unknown
string[] array = GUIUtility.systemCopyBuffer.Split("\n");
bool flag = array.Length == 1;
bool flag2 = false;
string[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
string text = array2[i].Trim();
SpawnGun spawnGun;
if (DownloadUtils.IsModPageUrl(text))
{
MelonLogger.Msg("Mod.io link detected: " + text);
DownloadUtils.DownloadFromModPageUrl(text, flag);
flag2 = true;
}
else if (SpawnGunUtils.GetSpawnGun(out spawnGun))
{
SpawnGunUtils.CopyBarcodeToSpawnGun(spawnGun, new Barcode(text), notify: true);
break;
}
}
if (flag2 && !flag)
{
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("Pallet Paste"),
Message = NotificationText.op_Implicit("Multi-line paste started!"),
Type = (NotificationType)0
});
}
}
public override void OnInitializeMelon()
{
Root.Create();
}
}
public static class DownloadUtils
{
[CompilerGenerated]
private static class <>O
{
public static DownloadCallback <0>__OnDownloadComplete;
}
public static void DownloadFromModPageUrl(string modPageUrl, bool notify = false)
{
ModIOSettings.LoadToken((Action<string>)OnTokenLoaded);
void OnTokenLoaded(string token)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
string modSlug = modPageUrl.Split('/')[^1];
ModIOManagerPublic.GetModFromSlug(modSlug, (ModCallback)delegate(ModCallbackInfo info)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
QueueDownload(info, modSlug, notify);
});
}
}
private static void QueueDownload(ModCallbackInfo info, string displayName, bool notify = false)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_0058: 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)
//IL_0073: 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_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Expected O, but got Unknown
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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_004d: Expected O, but got Unknown
//IL_00d6: Expected O, but got Unknown
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: 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_00d1: Expected O, but got Unknown
if ((int)info.Result == 1)
{
MelonLogger.Msg("Failed to get mod info");
if (notify)
{
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("Pallet Paste"),
Message = NotificationText.op_Implicit("Failed to fetch mod info for " + displayName),
Type = (NotificationType)2
});
}
return;
}
MelonLogger.Msg("Got mod info - downloading...");
ModTransaction val = new ModTransaction
{
ModFile = new ModIOFile(((ModData)(ref info.Data)).ID, (int?)null)
};
object obj = <>O.<0>__OnDownloadComplete;
if (obj == null)
{
DownloadCallback val2 = OnDownloadComplete;
<>O.<0>__OnDownloadComplete = val2;
obj = (object)val2;
}
val.Callback = (DownloadCallback)obj;
if (notify)
{
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("Pallet Paste"),
Message = NotificationText.op_Implicit(displayName + " was added to the download queue!")
});
}
ModIODownloader.EnqueueDownload(val);
static void OnDownloadComplete(DownloadCallbackInfo transaction)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: 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)
//IL_0017: Invalid comparison between Unknown and I4
//IL_0042: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
PasteHistory.Append(new PasteHistory.Paste(transaction.Pallet));
MelonLogger.Msg(((int)transaction.Result == 1) ? "Download failed!" : "Download succeeded!");
MelonLogger.Msg($"Pallet: {((Scannable)transaction.Pallet).Title} ({((Scannable)transaction.Pallet).Barcode.ID}) by @{transaction.Pallet.Author}");
MelonLogger.Msg("Crates:");
Enumerator<Crate> enumerator = transaction.Pallet.Crates.GetEnumerator();
while (enumerator.MoveNext())
{
Crate current = enumerator.Current;
MelonLogger.Msg($"- {((Scannable)current).Title} ({((Scannable)current).Barcode.ID})");
current.Tags.Add("<color=#07f5f5>Pallet Paste</color>");
}
}
}
public static bool IsModPageUrl(string text)
{
string text2 = text.Replace("http://", "").Replace("https://", "");
if (text2.Contains("bonelab/m/"))
{
return text2.StartsWith("mod.io");
}
return false;
}
}
public static class ModIOManagerPublic
{
public static void GetModFromSlug(string modSlug, ModCallback modCallback)
{
string url = ModIOSettings.GameApiPath + "@" + modSlug;
MelonLogger.Msg("Downloading mod file from '" + url + "'...");
ModIOSettings.LoadToken((Action<string>)OnTokenLoaded);
void OnTokenLoaded(string token)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
if (string.IsNullOrWhiteSpace(token))
{
ModCallback obj = modCallback;
if (obj != null)
{
obj.Invoke(ModCallbackInfo.FailedCallback);
}
}
else
{
MelonCoroutines.Start((IEnumerator)typeof(ModIOManager).GetMethod("CoGetMod", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, new object[3] { url, token, modCallback }));
}
}
}
}
public static class PasteHistory
{
public class MockPallet
{
public readonly Barcode Barcode;
public readonly string Title;
private Pallet _pallet;
public Pallet Pallet
{
get
{
if ((Object)(object)_pallet != (Object)null)
{
return _pallet;
}
Pallet val = default(Pallet);
if (!AssetWarehouse.Instance.TryGetPallet(Barcode, ref val))
{
return _pallet;
}
_pallet = val;
return val;
}
}
public MockPallet(Pallet pallet)
{
Barcode = ((Scannable)pallet).Barcode;
Title = ((Scannable)pallet).Title;
}
}
public struct Paste
{
public readonly MockPallet MockPallet;
public Paste(Pallet pallet)
{
MockPallet = new MockPallet(pallet);
}
}
private static List<Paste> pasteHistory = new List<Paste>();
public static void Append(Paste paste)
{
pasteHistory.Insert(0, paste);
if (pasteHistory.Count > 200)
{
pasteHistory.RemoveAt(pasteHistory.Count - 1);
}
}
private static void DrawCrate(Page page, Crate crate)
{
//IL_0019: 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: Expected O, but got Unknown
page.Add((Element)new FunctionElement(((Scannable)crate).Title, Color.white, (Action)delegate
{
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: 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_0094: 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_009f: 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)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Expected O, but got Unknown
MelonLogger.Msg($"{((Scannable)crate).Barcode} selected in menu");
if (((Object)crate).GetIl2CppType() == Il2CppType.Of<SpawnableCrate>() && SpawnGunUtils.GetSpawnGun(out var spawnGun))
{
SpawnGunUtils.CopyBarcodeToSpawnGun(spawnGun, ((Scannable)crate).Barcode, notify: true);
}
else if (((Object)crate).GetIl2CppType() == Il2CppType.Of<SpawnableCrate>())
{
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("Pallet Paste"),
Message = NotificationText.op_Implicit("Hold a spawn gun to copy this spawnable."),
Type = (NotificationType)0
});
}
else if (((Object)crate).GetIl2CppType() == Il2CppType.Of<LevelCrate>())
{
string text = (NetworkInfo.IsClient ? "Click YES to send a level request to the lobby host." : "Click YES to load the selected level");
Menu.DisplayDialog("Swap maps to " + ((Scannable)crate).Title + "?", text, (Texture2D)null, (Action)delegate
{
//IL_0017: 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_0022: 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_002c: 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_0056: Expected O, but got Unknown
if (NetworkInfo.IsClient)
{
LoadSender.SendLevelRequest(((Il2CppObjectBase)crate).Cast<LevelCrate>());
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("Requested Level"),
Message = NotificationText.op_Implicit("Sent a level request for " + ((Scannable)crate).Title + "!")
});
}
else
{
SceneStreamer.Load(((Scannable)crate).Barcode, (Barcode)null);
}
}, (Action)null);
}
else
{
Menu.DisplayDialog("Swap avatar to " + ((Scannable)crate).Title + "?", "Click YES to swap your current avatar.", (Texture2D)null, (Action)delegate
{
Player.RigManager.SwapAvatarCrate(((Scannable)crate).Barcode, false, (Action<bool>)null);
}, (Action)null);
}
}));
}
private static void DrawPaste(Page page, Paste paste)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Expected O, but got Unknown
page.Add((Element)new FunctionElement($"Crates ({paste.MockPallet.Pallet.Crates.Count}):", Color.cyan, (Action)delegate
{
}));
Enumerator<Crate> enumerator = paste.MockPallet.Pallet.Crates.GetEnumerator();
while (enumerator.MoveNext())
{
Crate current = enumerator.Current;
DrawCrate(page, current);
}
}
public static void DrawPasteList(Page page)
{
//IL_0036: 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_0051: Expected O, but got Unknown
foreach (Paste paste in pasteHistory)
{
page.Add((Element)new FunctionElement(((Object)paste.MockPallet.Pallet).name, Color.white, (Action)delegate
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: 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_002c: Expected O, but got Unknown
//IL_0031: Expected O, but got Unknown
Page val = new Page(((Object)paste.MockPallet.Pallet).name, Color.white, 0);
DrawPaste(val, paste);
Menu.OpenPage(val);
}));
}
}
}
internal static class Root
{
private static MelonPreferences_Category _category;
private static MelonPreferences_Entry<bool> _boneMenuEnabled;
public static void Create()
{
//IL_004a: 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)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
_category = MelonPreferences.CreateCategory("PalletPaste", "Pallet Paste");
_boneMenuEnabled = _category.CreateEntry<bool>("BoneMenuEnabled", true, "BoneMenu Enabled", (string)null, false, false, (ValueValidator)null, (string)null);
if (_boneMenuEnabled.Value)
{
Page val = Page.Root.CreatePage("Pallet Paste", Color.cyan, 0, true);
val.CreateFunction("Paste!", Color.cyan, (Action)delegate
{
Core.OnPaste();
});
val.Add((Element)(object)val.CreateFunction("Pastes", Color.cyan, (Action)delegate
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_001b: Expected O, but got Unknown
Page val2 = new Page("Pastes", Color.white, 0);
PasteHistory.DrawPasteList(val2);
Menu.OpenPage(val2);
}));
if (!HelperMethods.IsAndroid())
{
DrawSettings(val.CreatePage("Settings (PC)", Color.white, 0, true));
}
}
}
private static void DrawSettings(Page settingsPage)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
settingsPage.RemoveAll();
settingsPage.CreateFunction(_boneMenuEnabled.Value ? "Hide from BoneMenu" : "Undo hide from BoneMenu", Color.red, (Action)delegate
{
if (_boneMenuEnabled.Value)
{
Menu.DisplayDialog("Disable this page?", "You will need to manually edit your MelonPreferences file to re-enable this page after game restart. Are you sure?", (Texture2D)null, (Action)delegate
{
_boneMenuEnabled.Value = false;
_category.SaveToFile(true);
Menu.CurrentPage = Page.Root;
DrawSettings(settingsPage);
}, (Action)null);
}
else
{
_boneMenuEnabled.Value = true;
_category.SaveToFile(true);
DrawSettings(settingsPage);
}
});
}
}
internal class PageExtras
{
[CompilerGenerated]
private MelonPreferences_Category <category>P;
[CompilerGenerated]
private Page <page>P;
public PageExtras(MelonPreferences_Category category, Page page)
{
<category>P = category;
<page>P = page;
base..ctor();
}
public BoolElement CreateBoolPref(ref MelonPreferences_Entry<bool> pref, string name, Color color, bool startValue, Action<bool> callback = null, string prefName = null)
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
if (prefName == null)
{
prefName = name;
}
if (!<category>P.HasEntry(prefName))
{
pref = <category>P.CreateEntry<bool>(prefName, startValue, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
}
MelonPreferences_Entry<bool> entry = pref;
return <page>P.CreateBool(((MelonPreferences_Entry)pref).DisplayName, color, entry.Value, (Action<bool>)delegate(bool value)
{
Action<bool> action = callback;
if (action != null)
{
Extensions.InvokeActionSafe<bool>(action, value);
}
entry.Value = value;
<category>P.SaveToFile(true);
});
}
}
}
namespace PalletPaste.SpawnGun
{
public static class SpawnGunUtils
{
public static bool GetSpawnGun(out SpawnGun spawnGun)
{
spawnGun = Player.GetComponentInHand<SpawnGun>(Player.RightHand);
if (!Object.op_Implicit((Object)(object)spawnGun))
{
spawnGun = Player.GetComponentInHand<SpawnGun>(Player.LeftHand);
}
return (Object)(object)spawnGun != (Object)null;
}
public static bool CopyBarcodeToSpawnGun(SpawnGun spawnGun, Barcode barcode, bool notify = false)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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_002e: 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_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
SpawnableCrate crate = CrateFilterer.GetCrate<SpawnableCrate>(barcode);
if (Object.op_Implicit((Object)(object)crate))
{
spawnGun.OnSpawnableSelected(crate);
}
if (notify)
{
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("Pallet Paste"),
Message = NotificationText.op_Implicit("Copied to Spawn Gun!"),
Type = (NotificationType)3
});
}
return (Object)(object)crate != (Object)null;
}
}
}