using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using AssetBundleLoader;
using ErrorUtils;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppRUMBLE.Players;
using Il2CppSystem;
using MelonLoader;
using Microsoft.CodeAnalysis;
using NAudio.Wave;
using RumbleModUI;
using RumbleModdingAPI;
using RumblePrecipitation;
using UnityEngine;
using UniverseLib.Runtime.Il2Cpp;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Main), "RumblePrecipitation", "1.0.0", "ERROR", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 255, 0, 0)]
[assembly: MelonAuthorColor(255, 255, 0, 0)]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: VerifyLoaderVersion(0, 6, 2, true)]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b10c94a1-8a40-4701-bc5b-98eabb44dfea")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("RumblePrecipitation")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+858e0976c3de6a25d51de2d1df9a31226a2214ba")]
[assembly: AssemblyProduct("RumblePrecipitation")]
[assembly: AssemblyTitle("RumblePrecipitation")]
[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 ErrorUtils
{
internal static class Utilities
{
public static PlayerController playerController { get; private set; }
public static void Init()
{
playerController = Players.GetPlayerController();
}
public static AssetBundle LoadBundle(string resourceName)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
using Stream stream = executingAssembly.GetManifestResourceStream(resourceName);
if (stream != null)
{
byte[] array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
return AssetBundle.LoadFromMemory(array);
}
Debug.LogError(Object.op_Implicit("Resource not found: " + resourceName));
return null;
}
public static GameObject CreatePrimitive(PrimitiveType type, Color color, string name)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.CreatePrimitive(type);
((Object)val).name = name;
MeshRenderer component = val.GetComponent<MeshRenderer>();
((Renderer)component).material.shader = Shader.Find("Universal Render Pipeline/Unlit");
((Renderer)component).material.color = color;
return val;
}
public static void InvertNormals(GameObject obj)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: 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)
MeshFilter component = obj.GetComponent<MeshFilter>();
if ((Object)(object)component != (Object)null)
{
Mesh mesh = component.mesh;
Vector3[] array = Il2CppArrayBase<Vector3>.op_Implicit((Il2CppArrayBase<Vector3>)(object)mesh.normals);
for (int i = 0; i < array.Length; i++)
{
array[i] = -array[i];
}
mesh.normals = Il2CppStructArray<Vector3>.op_Implicit(array);
for (int j = 0; j < mesh.subMeshCount; j++)
{
int[] array2 = Il2CppArrayBase<int>.op_Implicit((Il2CppArrayBase<int>)(object)mesh.GetTriangles(j));
for (int k = 0; k < array2.Length; k += 3)
{
int num = array2[k];
array2[k] = array2[k + 1];
array2[k + 1] = num;
}
mesh.SetTriangles(Il2CppStructArray<int>.op_Implicit(array2), j);
}
MelonLogger.Msg("Normals inverted for '" + ((Object)obj).name + "'.");
}
else
{
MelonLogger.Error("MeshFilter not found on '" + ((Object)obj).name + "'.");
}
}
public static IEnumerator PlayEmbeddedSound(string resourceName)
{
Assembly assembly = typeof(Main).Assembly;
using Stream stream = assembly.GetManifestResourceStream(resourceName);
if (stream != null)
{
Mp3FileReader reader = new Mp3FileReader(stream);
try
{
WaveOutEvent device = new WaveOutEvent();
try
{
device.Init((IWaveProvider)(object)reader);
device.Play();
while ((int)device.PlaybackState == 1)
{
yield return (object)new WaitForFixedUpdate();
}
}
finally
{
((IDisposable)device)?.Dispose();
}
}
finally
{
((IDisposable)reader)?.Dispose();
}
}
else
{
MelonLogger.Msg("Embedded resource not found: " + resourceName);
}
}
}
}
namespace RumblePrecipitation
{
public static class BuildInfo
{
public const string ModName = "RumblePrecipitation";
public const string ModVersion = "1.0.0";
public const string Description = "Adds rain and snow to rumble!";
public const string Author = "ERROR";
public const string Company = "";
}
public class Main : MelonMod
{
private bool isInitialized;
private string currentScene = "Loader";
private GameObject needDestroy;
private ModSetting<int> WeatherType;
private int weatherType = 0;
private ModSetting<bool> EnabledInMatches;
private bool enabledInMatches = false;
private UI UI = UI.instance;
private Mod Precipitation = new Mod();
public override void OnLateInitializeMelon()
{
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Expected O, but got Unknown
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Expected O, but got Unknown
Calls.onMapInitialized += OnMapInitialized;
MelonLogger.Msg("RumblePrecipitation Initiated");
Precipitation.ModName = "RumblePrecipitation";
Precipitation.ModVersion = "1.0.0";
Precipitation.SetFolder("RumblePrecipitation");
Precipitation.AddDescription("Description", "", "Adds rain and snow to rumble!", new Tags
{
IsSummary = true
});
WeatherType = Precipitation.AddToList("Weather Type", 1, "An integer value (whole number) that determines what type of weather you want. \n 0 = Snow \n 1 = Rain \n >2 = Clear", new Tags());
EnabledInMatches = Precipitation.AddToList("Enabled In Matches", true, 0, "Determines weather or not weather is activated in matches.", new Tags());
Precipitation.GetFromFile();
Precipitation.ModSaved += Save;
UI.instance.UI_Initialized += OnUIInit;
Save();
}
public void OnUIInit()
{
UI.AddMod(Precipitation);
}
public void Save()
{
enabledInMatches = (bool)((ModSetting)EnabledInMatches).Value;
weatherType = (int)((ModSetting)WeatherType).Value;
if (isInitialized)
{
if ((currentScene == "Map0" || currentScene == "Map1") && !enabledInMatches)
{
ChangeWeather(2);
}
else
{
ChangeWeather(weatherType);
}
}
}
private AssetBundle LoadBundleFromFile(string filePath)
{
if (File.Exists(filePath))
{
return AssetBundle.LoadFromFile(filePath);
}
return null;
}
public void OnMapInitialized()
{
if (currentScene != "Loader")
{
MelonCoroutines.Start(InitializeWithPause());
}
}
private IEnumerator InitializeWithPause()
{
yield return (object)new WaitForSeconds(3f);
Initialize();
}
private void ChangeWeather(int weather)
{
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: 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_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)needDestroy != (Object)null)
{
Object.Destroy((Object)(object)needDestroy);
}
if (weather == 0)
{
AssetBundle assetBundle = Utilities.LoadBundle("RumblePrecipitation.snow");
if ((Object)(object)assetBundle != (Object)null)
{
GameObject val = assetBundle.LoadAsset<GameObject>("Particle");
GameObject val2 = Object.Instantiate<GameObject>(val);
val2.transform.position = new Vector3(-2.48f, 11.74f, -6.33f);
val2.transform.localScale = new Vector3(5f, 1f, 5f);
needDestroy = val2;
assetBundle.Unload(unloadAllLoadedObjects: false);
}
RenderSettings.fog = true;
RenderSettings.fogColor = Color.white;
RenderSettings.fogMode = (FogMode)1;
RenderSettings.fogStartDistance = 5f;
RenderSettings.fogEndDistance = 100f;
RenderSettings.fogDensity = 0.1f;
}
else if (weather == 1)
{
AssetBundle assetBundle2 = Utilities.LoadBundle("RumblePrecipitation.rain");
if ((Object)(object)assetBundle2 != (Object)null)
{
GameObject val3 = assetBundle2.LoadAsset<GameObject>("Rain");
GameObject val4 = Object.Instantiate<GameObject>(val3);
val4.transform.position = new Vector3(-11.28f, 11.74f, -0.87f);
val4.transform.localScale = new Vector3(5f, 1f, 5f);
needDestroy = val4;
assetBundle2.Unload(unloadAllLoadedObjects: false);
}
RenderSettings.fog = true;
RenderSettings.fogColor = Color.gray;
RenderSettings.fogMode = (FogMode)1;
RenderSettings.fogStartDistance = 5f;
RenderSettings.fogEndDistance = 100f;
RenderSettings.fogDensity = 0.1f;
}
else if (weather >= 2)
{
if (Mods.getMyModString().Contains("Rumble Dark Mode"))
{
RenderSettings.fogColor = Color.black;
}
else
{
RenderSettings.fogColor = new Color(0f, 0f, 0f, 1f);
}
RenderSettings.fog = true;
RenderSettings.fogMode = (FogMode)1;
RenderSettings.fogStartDistance = 20f;
RenderSettings.fogEndDistance = 1000f;
RenderSettings.fogDensity = 0.01f;
}
}
public void Initialize()
{
if (!isInitialized)
{
if ((currentScene == "Map0" || currentScene == "Map1") && !enabledInMatches)
{
ChangeWeather(2);
}
else
{
ChangeWeather(weatherType);
}
isInitialized = true;
}
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
currentScene = sceneName;
isInitialized = false;
}
}
}
namespace UniverseLib.Runtime.Il2Cpp
{
public static class ICallManager
{
private static readonly Dictionary<string, Delegate> iCallCache = new Dictionary<string, Delegate>();
private static readonly Dictionary<string, Delegate> unreliableCache = new Dictionary<string, Delegate>();
public static T GetICall<T>(string signature) where T : Delegate
{
if (iCallCache.ContainsKey(signature))
{
return (T)iCallCache[signature];
}
IntPtr intPtr = IL2CPP.il2cpp_resolve_icall(signature);
if (intPtr == IntPtr.Zero)
{
throw new MissingMethodException("Could not find any iCall with the signature '" + signature + "'!");
}
Delegate delegateForFunctionPointer = Marshal.GetDelegateForFunctionPointer(intPtr, typeof(T));
iCallCache.Add(signature, delegateForFunctionPointer);
return (T)delegateForFunctionPointer;
}
public static T GetICallUnreliable<T>(params string[] possibleSignatures) where T : Delegate
{
string text = possibleSignatures.First();
if (unreliableCache.ContainsKey(text))
{
return (T)unreliableCache[text];
}
foreach (string text2 in possibleSignatures)
{
IntPtr intPtr = IL2CPP.il2cpp_resolve_icall(text2);
if (intPtr != IntPtr.Zero)
{
T val = (T)Marshal.GetDelegateForFunctionPointer(intPtr, typeof(T));
unreliableCache.Add(text, val);
return val;
}
}
throw new MissingMethodException("Could not find any iCall from list of provided signatures starting with '" + text + "'!");
}
}
}
namespace AssetBundleLoader
{
public class AssetBundle : Object
{
internal delegate IntPtr d_LoadFromFile(IntPtr path, uint crc, ulong offset);
private delegate IntPtr d_LoadFromMemory(IntPtr binary, uint crc);
public delegate IntPtr d_GetAllLoadedAssetBundles_Native();
internal delegate IntPtr d_LoadAssetWithSubAssets_Internal(IntPtr _this, IntPtr name, IntPtr type);
internal delegate IntPtr d_LoadAsset_Internal(IntPtr _this, IntPtr name, IntPtr type);
internal delegate void d_Unload(IntPtr _this, bool unloadAllLoadedObjects);
public readonly IntPtr m_bundlePtr = IntPtr.Zero;
static AssetBundle()
{
ClassInjector.RegisterTypeInIl2Cpp<AssetBundle>();
}
[HideFromIl2Cpp]
public static AssetBundle LoadFromFile(string path)
{
IntPtr intPtr = ICallManager.GetICallUnreliable<d_LoadFromFile>(new string[2] { "UnityEngine.AssetBundle::LoadFromFile_Internal", "UnityEngine.AssetBundle::LoadFromFile" })(IL2CPP.ManagedStringToIl2Cpp(path), 0u, 0uL);
return (intPtr != IntPtr.Zero) ? new AssetBundle(intPtr) : null;
}
[HideFromIl2Cpp]
public static AssetBundle LoadFromMemory(byte[] binary, uint crc = 0u)
{
IntPtr intPtr = ICallManager.GetICallUnreliable<d_LoadFromMemory>(new string[2] { "UnityEngine.AssetBundle::LoadFromMemory_Internal", "UnityEngine.AssetBundle::LoadFromMemory" })(((Il2CppObjectBase)Il2CppStructArray<byte>.op_Implicit(binary)).Pointer, crc);
return (intPtr != IntPtr.Zero) ? new AssetBundle(intPtr) : null;
}
[HideFromIl2Cpp]
public static AssetBundle[] GetAllLoadedAssetBundles()
{
IntPtr intPtr = ICallManager.GetICall<d_GetAllLoadedAssetBundles_Native>("UnityEngine.AssetBundle::GetAllLoadedAssetBundles_Native")();
return (intPtr != IntPtr.Zero) ? Il2CppArrayBase<AssetBundle>.op_Implicit((Il2CppArrayBase<AssetBundle>)(object)new Il2CppReferenceArray<AssetBundle>(intPtr)) : null;
}
public AssetBundle(IntPtr ptr)
: base(ptr)
{
m_bundlePtr = ptr;
}
[HideFromIl2Cpp]
public Object[] LoadAllAssets()
{
IntPtr intPtr = ICallManager.GetICall<d_LoadAssetWithSubAssets_Internal>("UnityEngine.AssetBundle::LoadAssetWithSubAssets_Internal")(m_bundlePtr, IL2CPP.ManagedStringToIl2Cpp(""), ((Il2CppObjectBase)Il2CppType.Of<Object>()).Pointer);
return (Object[])((intPtr != IntPtr.Zero) ? ((Array)Il2CppArrayBase<Object>.op_Implicit((Il2CppArrayBase<Object>)(object)new Il2CppReferenceArray<Object>(intPtr))) : ((Array)new Object[0]));
}
[HideFromIl2Cpp]
public T LoadAsset<T>(string name) where T : Object
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
IntPtr intPtr = ICallManager.GetICall<d_LoadAsset_Internal>("UnityEngine.AssetBundle::LoadAsset_Internal")(m_bundlePtr, IL2CPP.ManagedStringToIl2Cpp(name), ((Il2CppObjectBase)Il2CppType.Of<T>()).Pointer);
return (intPtr != IntPtr.Zero) ? ((Il2CppObjectBase)new Object(intPtr)).TryCast<T>() : default(T);
}
[HideFromIl2Cpp]
public void Unload(bool unloadAllLoadedObjects)
{
ICallManager.GetICall<d_Unload>("UnityEngine.AssetBundle::Unload")(m_bundlePtr, unloadAllLoadedObjects);
}
}
}