using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BossMusic;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Utilities;
using MelonLoader;
using Microsoft.CodeAnalysis;
using RumbleModUI;
using RumbleModdingAPI;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Class1), "BossMusic", "1.0.2", "Spooki", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 99, 0, 148)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BossMusic")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BossMusic")]
[assembly: AssemblyTitle("BossMusic")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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]
[Microsoft.CodeAnalysis.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;
}
}
}
namespace BossMusic
{
public class Class1 : MelonMod
{
public static class BuildInfo
{
public const string ModName = "BossMusic";
public const string ModVersion = "1.0.2";
public const string Description = "Plays boss music when you get into a match with certain players who are really good.";
public const string Author = "Spooki";
public const string Company = "";
}
private float volume;
private bool hearSelfMusic;
private Mod Mod = new Mod();
private string[] ids = new string[12];
private string[] songs = new string[2] { "PromisedConsort", "TwinMoonKnight" };
private Il2CppAssetBundle bundle;
private string currentScene = "";
public void Save()
{
hearSelfMusic = (bool)Mod.Settings[1].SavedValue;
volume = (float)Mod.Settings[2].SavedValue;
}
public void OnUIInit()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Expected O, but got Unknown
Mod.ModName = "BossMusic";
Mod.ModVersion = "1.0.2";
Mod.SetFolder("BossMusic");
Mod.AddDescription("Description", "", "Plays boss music when you get into a match with certain players who are really good.", new Tags
{
IsSummary = true
});
Mod.AddToList("Hear Self Music", false, 0, "Allows the \"boss\" to hear their own music.", new Tags());
Mod.AddToList("Volume", 1f, "choose a volume from 1 to 0", new Tags());
Mod.GetFromFile();
Mod.ModSaved += Save;
UI.instance.AddMod(Mod);
MelonLogger.Msg("Added Mod: BossMusic");
}
public Il2CppAssetBundle LoadBundle(string path)
{
using Stream stream = ((MelonBase)this).MelonAssembly.Assembly.GetManifestResourceStream(path);
byte[] array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
return Il2CppAssetBundleManager.LoadFromMemory(Il2CppStructArray<byte>.op_Implicit(array));
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
currentScene = sceneName;
}
public void SceneLoaded()
{
if (!hearSelfMusic && (currentScene == "Map0" || currentScene == "Map1"))
{
string playFabMasterId = Singleton<PlayerManager>.instance.AllPlayers[1].Data.GeneralData.PlayFabMasterId;
string playFabMasterId2 = Singleton<PlayerManager>.instance.AllPlayers[0].Data.GeneralData.PlayFabMasterId;
string[] array = ids;
foreach (string text in array)
{
if (text == playFabMasterId)
{
switch (playFabMasterId)
{
case "C23A4EF3E213D420":
{
GameObject val9 = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("GrandMusic"));
val9.GetComponent<AudioSource>().volume = volume;
break;
}
case "A38F5067A38BDDC9":
{
GameObject val8 = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("TacoSlayer"));
val8.GetComponent<AudioSource>().volume = volume;
break;
}
case "C865BEADBF6A3B33":
{
GameObject val7 = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("Juicepar"));
val7.GetComponent<AudioSource>().volume = volume;
break;
}
case "8D7AC974609065FF":
{
GameObject val6 = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("Shoeless"));
val6.GetComponent<AudioSource>().volume = volume;
break;
}
case "DA8A4C1F83E97E87":
{
GameObject val5 = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("MuMe"));
val5.GetComponent<AudioSource>().volume = volume;
break;
}
case "5832566FD2375E31":
{
GameObject val4 = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("Ulvak"));
val4.GetComponent<AudioSource>().volume = volume;
break;
}
case "CA13C58A58AF5B3D":
{
GameObject val3 = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("Sauer"));
val3.GetComponent<AudioSource>().volume = volume;
break;
}
case "9DA77F22A3B283D1":
{
GameObject val2 = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("Spooki"));
val2.GetComponent<AudioSource>().volume = volume;
break;
}
default:
{
GameObject val = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>(songs[Random.RandomRange(0, songs.Length)]));
val.GetComponent<AudioSource>().volume = volume;
break;
}
}
break;
}
}
}
if (!hearSelfMusic || (!(currentScene == "Map0") && !(currentScene == "Map1")))
{
return;
}
string playFabMasterId3 = Singleton<PlayerManager>.instance.AllPlayers[1].Data.GeneralData.PlayFabMasterId;
string playFabMasterId4 = Singleton<PlayerManager>.instance.AllPlayers[0].Data.GeneralData.PlayFabMasterId;
string[] array2 = ids;
foreach (string text2 in array2)
{
if (text2 == playFabMasterId4)
{
switch (playFabMasterId4)
{
case "C23A4EF3E213D420":
{
GameObject val18 = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("GrandMusic"));
val18.GetComponent<AudioSource>().volume = volume;
break;
}
case "A38F5067A38BDDC9":
{
GameObject val17 = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("TacoSlayer"));
val17.GetComponent<AudioSource>().volume = volume;
break;
}
case "C865BEADBF6A3B33":
{
GameObject val16 = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("Juicepar"));
val16.GetComponent<AudioSource>().volume = volume;
break;
}
case "8D7AC974609065FF":
{
GameObject val15 = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("Shoeless"));
val15.GetComponent<AudioSource>().volume = volume;
break;
}
case "DA8A4C1F83E97E87":
{
GameObject val14 = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("MuMe"));
val14.GetComponent<AudioSource>().volume = volume;
break;
}
case "5832566FD2375E31":
{
GameObject val13 = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("Ulvak"));
val13.GetComponent<AudioSource>().volume = volume;
break;
}
case "CA13C58A58AF5B3D":
{
GameObject val12 = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("Sauer"));
val12.GetComponent<AudioSource>().volume = volume;
break;
}
case "9DA77F22A3B283D1":
{
GameObject val11 = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("Spooki"));
val11.GetComponent<AudioSource>().volume = volume;
break;
}
default:
{
GameObject val10 = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>(songs[Random.RandomRange(0, songs.Length)]));
val10.GetComponent<AudioSource>().volume = volume;
break;
}
}
break;
}
}
}
public override void OnLateInitializeMelon()
{
((MelonBase)this).OnLateInitializeMelon();
UI.instance.UI_Initialized += OnUIInit;
Calls.onMapInitialized += SceneLoaded;
bundle = LoadBundle("BossMusic.Bundles.audioassetbundle");
ids[0] = "2F34ACC4278EE5E8";
ids[1] = "8D4176761F3CCA43";
ids[2] = "C23A4EF3E213D420";
ids[3] = "C6615796F9D474F2";
ids[4] = "C865BEADBF6A3B33";
ids[5] = "CA13C58A58AF5B3D";
ids[6] = "4431CC28C9B6942C";
ids[7] = "8D7AC974609065FF";
ids[8] = "5832566FD2375E31";
ids[9] = "9DA77F22A3B283D1";
ids[10] = "DA8A4C1F83E97E87";
ids[11] = "A38F5067A38BDDC9";
}
}
}