using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Pools;
using Il2CppRUMBLE.Utilities;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using Microsoft.CodeAnalysis;
using ShifstoneModels;
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), "Custom Shiftstone Models", "1.0.5", "SpooderCode", null)]
[assembly: MelonGame("", "")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ShifstoneModels")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ShifstoneModels")]
[assembly: AssemblyTitle("ShifstoneModels")]
[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 ShifstoneModels
{
public class Class1 : MelonMod
{
public GameObject LoadShifstone(string file, string objN)
{
try
{
Il2CppAssetBundle val = Il2CppAssetBundleManager.LoadFromFile("UserData/ShiftstoneModels/" + file);
GameObject val2;
try
{
val2 = Object.Instantiate<GameObject>(val.LoadAsset<GameObject>(objN));
}
catch
{
val2 = Object.Instantiate<GameObject>(val.LoadAsset<GameObject>("Stone"));
}
val2.SetActive(false);
val.Unload(false);
return val2;
}
catch
{
return null;
}
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
if (!(sceneName == "Loader"))
{
return;
}
string[] array = new string[8] { "CHARGE", "GUARD", "VOLATILE", "ADAMANT", "SURGE", "VIGOR", "FLOW", "STUBBORN" };
string[] array2 = array;
foreach (string text in array2)
{
GameObject val = LoadShifstone(text, text);
if ((Object)(object)val == (Object)null)
{
continue;
}
if (text != "CHARGE")
{
MelonLogger.Msg(text + " Loaded");
}
else
{
MelonLogger.Msg(text + " Loaded (WARNING: Due to a problem with RUMBLE, This stone will not have a custom model) ");
}
string text2 = "";
switch (text)
{
case "GUARD":
text2 = "GuardStone";
break;
case "CHARGE":
text2 = "ChargeStone";
break;
case "VOLATILE":
text2 = "VolatileStone";
break;
case "ADAMANT":
text2 = "AdamantStone";
break;
case "SURGE":
text2 = "SurgeStone";
break;
case "VIGOR":
text2 = "VigorStone";
break;
case "FLOW":
text2 = "FlowStone";
break;
case "STUBBORN":
text2 = "StubbornStone";
break;
}
Enumerator<PooledMonoBehaviour> enumerator = Singleton<PoolManager>.instance.GetPool(text2).PooledObjects.GetEnumerator();
while (enumerator.MoveNext())
{
PooledMonoBehaviour current = enumerator.Current;
if (!((Object)(object)current != (Object)null))
{
continue;
}
((Renderer)((Component)current).GetComponentInChildren<MeshRenderer>()).enabled = false;
((Component)current).transform.localRotation = Quaternion.identity;
GameObject val2 = Object.Instantiate<GameObject>(val, ((Component)current).transform);
val2.SetActive(true);
foreach (MeshRenderer componentsInChild in ((Component)current).GetComponentsInChildren<MeshRenderer>())
{
if (((Object)((Component)componentsInChild).gameObject).name.Contains("%"))
{
((Renderer)componentsInChild).material = ((Renderer)((Component)((Component)current).transform.GetChild(0)).GetComponent<MeshRenderer>()).material;
}
}
}
}
}
}
}