using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using HarmonyLib;
using Il2CppRUMBLE.Environment;
using Il2CppRUMBLE.MoveSystem;
using MelonLoader;
using RumbleModUI;
using RumbleModdingAPI;
using StructureStones;
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(main), "StructureStones", "2.0.2", "UlvakSkillz", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 195, 0, 255)]
[assembly: MelonAuthorColor(255, 195, 0, 255)]
[assembly: VerifyLoaderVersion(0, 6, 2, true)]
[assembly: AssemblyTitle("StructureStones")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StructureStones")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("26c0135e-fa6a-4ddb-a5d5-44e667a0272b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace StructureStones;
public class main : MelonMod
{
[HarmonyPatch(typeof(Structure), "Start")]
public static class StructureSpawn
{
private static void Postfix(ref Structure __instance)
{
try
{
if ((Object)(object)((Component)__instance.processableComponent).gameObject.GetComponent<Tetherball>() != (Object)null)
{
MeshRenderer component = ((Component)((Component)__instance.processableComponent).gameObject.transform.GetChild(0)).GetComponent<MeshRenderer>();
((Renderer)component).material = stoneMaterials[(int)StructureStones.Settings[8].SavedValue];
}
}
catch (Exception ex)
{
MelonLogger.Error((object)ex);
}
}
}
[HarmonyPatch(typeof(Structure), "OnFetchFromPool")]
public static class StructureRespawn
{
private static void Postfix(ref Structure __instance)
{
string text = ((Object)((Component)__instance.processableComponent).gameObject).name;
MeshRenderer val;
try
{
if (!((Object)(object)((Component)__instance.processableComponent).gameObject.GetComponent<Tetherball>() != (Object)null))
{
val = ((!((Object)(object)((Component)__instance.processableComponent).gameObject.GetComponent<MeshRenderer>() != (Object)null)) ? ((Component)((Component)__instance.processableComponent).gameObject.transform).GetComponentInChildren<MeshRenderer>() : ((Component)__instance.processableComponent).gameObject.GetComponent<MeshRenderer>());
}
else
{
text = "BoulderBall";
val = ((Component)((Component)__instance.processableComponent).gameObject.transform.GetChild(0)).GetComponent<MeshRenderer>();
}
}
catch (Exception ex)
{
MelonLogger.Error((object)ex);
return;
}
switch (text)
{
case "LargeRock":
((Renderer)val).material = stoneMaterials[(int)StructureStones.Settings[7].SavedValue];
break;
case "SmallRock":
((Renderer)val).material = stoneMaterials[(int)StructureStones.Settings[6].SavedValue];
break;
case "Pillar":
((Renderer)val).material = stoneMaterials[(int)StructureStones.Settings[2].SavedValue];
break;
case "Disc":
((Renderer)val).material = stoneMaterials[(int)StructureStones.Settings[1].SavedValue];
break;
case "Wall":
((Renderer)val).material = stoneMaterials[(int)StructureStones.Settings[5].SavedValue];
break;
case "RockCube":
((Renderer)val).material = stoneMaterials[(int)StructureStones.Settings[4].SavedValue];
break;
case "Ball":
((Renderer)val).material = stoneMaterials[(int)StructureStones.Settings[3].SavedValue];
break;
case "BoulderBall":
((Renderer)val).material = stoneMaterials[(int)StructureStones.Settings[8].SavedValue];
break;
}
}
}
private bool sceneChanged = false;
private string currentScene = "";
private bool init = false;
public GameObject materialsParent;
public GameObject[] materialsHolder;
public static Material[] stoneMaterials = (Material[])(object)new Material[8];
private UI UI = UI.instance;
public static Mod StructureStones = new Mod();
private int[] preSavedValues = new int[8];
public override void OnLateInitializeMelon()
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Expected O, but got Unknown
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Expected O, but got Unknown
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Expected O, but got Unknown
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02d7: Expected O, but got Unknown
//IL_036d: Unknown result type (might be due to invalid IL or missing references)
//IL_0377: Expected O, but got Unknown
//IL_040d: Unknown result type (might be due to invalid IL or missing references)
//IL_0417: Expected O, but got Unknown
//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
//IL_04b7: Expected O, but got Unknown
//IL_054d: Unknown result type (might be due to invalid IL or missing references)
//IL_0557: Expected O, but got Unknown
StructureStones.ModName = "StructureStones";
StructureStones.ModVersion = "2.0.2";
StructureStones.SetFolder("StructureStones");
StructureStones.AddDescription("Description", "Description", "Sets Structure Skins to Shiftstone Skins", new Tags
{
IsSummary = true
});
StructureStones.AddToList("Disc", 1, "Volatile Stone: 0" + Environment.NewLine + "Charge Stone: 1" + Environment.NewLine + "Surge Stone: 2" + Environment.NewLine + "Flow Stone: 3" + Environment.NewLine + "Guard Stone: 4" + Environment.NewLine + "Stubborn Stone: 5" + Environment.NewLine + "Adamant Stone: 6" + Environment.NewLine + "Vigor Stone: 7", new Tags());
StructureStones.AddToList("Pillar", 2, "Volatile Stone: 0" + Environment.NewLine + "Charge Stone: 1" + Environment.NewLine + "Surge Stone: 2" + Environment.NewLine + "Flow Stone: 3" + Environment.NewLine + "Guard Stone: 4" + Environment.NewLine + "Stubborn Stone: 5" + Environment.NewLine + "Adamant Stone: 6" + Environment.NewLine + "Vigor Stone: 7", new Tags());
StructureStones.AddToList("Ball", 3, "Volatile Stone: 0" + Environment.NewLine + "Charge Stone: 1" + Environment.NewLine + "Surge Stone: 2" + Environment.NewLine + "Flow Stone: 3" + Environment.NewLine + "Guard Stone: 4" + Environment.NewLine + "Stubborn Stone: 5" + Environment.NewLine + "Adamant Stone: 6" + Environment.NewLine + "Vigor Stone: 7", new Tags());
StructureStones.AddToList("Cube", 4, "Volatile Stone: 0" + Environment.NewLine + "Charge Stone: 1" + Environment.NewLine + "Surge Stone: 2" + Environment.NewLine + "Flow Stone: 3" + Environment.NewLine + "Guard Stone: 4" + Environment.NewLine + "Stubborn Stone: 5" + Environment.NewLine + "Adamant Stone: 6" + Environment.NewLine + "Vigor Stone: 7", new Tags());
StructureStones.AddToList("Wall", 5, "Volatile Stone: 0" + Environment.NewLine + "Charge Stone: 1" + Environment.NewLine + "Surge Stone: 2" + Environment.NewLine + "Flow Stone: 3" + Environment.NewLine + "Guard Stone: 4" + Environment.NewLine + "Stubborn Stone: 5" + Environment.NewLine + "Adamant Stone: 6" + Environment.NewLine + "Vigor Stone: 7", new Tags());
StructureStones.AddToList("Small Rock", 6, "Volatile Stone: 0" + Environment.NewLine + "Charge Stone: 1" + Environment.NewLine + "Surge Stone: 2" + Environment.NewLine + "Flow Stone: 3" + Environment.NewLine + "Guard Stone: 4" + Environment.NewLine + "Stubborn Stone: 5" + Environment.NewLine + "Adamant Stone: 6" + Environment.NewLine + "Vigor Stone: 7", new Tags());
StructureStones.AddToList("Large Rock", 0, "Volatile Stone: 0" + Environment.NewLine + "Charge Stone: 1" + Environment.NewLine + "Surge Stone: 2" + Environment.NewLine + "Flow Stone: 3" + Environment.NewLine + "Guard Stone: 4" + Environment.NewLine + "Stubborn Stone: 5" + Environment.NewLine + "Adamant Stone: 6" + Environment.NewLine + "Vigor Stone: 7", new Tags());
StructureStones.AddToList("BoulderBall", 7, "Volatile Stone: 0" + Environment.NewLine + "Charge Stone: 1" + Environment.NewLine + "Surge Stone: 2" + Environment.NewLine + "Flow Stone: 3" + Environment.NewLine + "Guard Stone: 4" + Environment.NewLine + "Stubborn Stone: 5" + Environment.NewLine + "Adamant Stone: 6" + Environment.NewLine + "Vigor Stone: 7", new Tags());
StructureStones.GetFromFile();
for (int i = 0; i < StructureStones.Settings.Count - 1; i++)
{
preSavedValues[i] = (int)StructureStones.Settings[i + 1].SavedValue;
}
UI.instance.UI_Initialized += UIInit;
StructureStones.ModSaved += Save;
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
currentScene = sceneName;
sceneChanged = true;
}
public override void OnFixedUpdate()
{
//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_003e: Expected O, but got Unknown
//IL_0043: Expected O, but got Unknown
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Expected O, but got Unknown
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Expected O, but got Unknown
if (!sceneChanged)
{
return;
}
try
{
if (currentScene == "Loader" && !init)
{
GameObject val = new GameObject();
GameObject val2 = val;
materialsParent = val;
Object.DontDestroyOnLoad((Object)(object)val2);
((Object)materialsParent).name = "StructureStonesMaterialsParent";
GameObject gameObject = ((Component)ShiftStones.GetPoolAdamantStone().transform.parent).gameObject;
materialsHolder = (GameObject[])(object)new GameObject[8];
for (int i = 0; i < 8; i++)
{
materialsHolder[i] = new GameObject();
materialsHolder[i].transform.parent = materialsParent.transform;
stoneMaterials[i] = new Material(((Renderer)((Component)gameObject.transform.GetChild(i + 3).GetChild(0).GetChild(0)).GetComponent<MeshRenderer>()).material);
((Object)materialsHolder[i]).name = ((Object)stoneMaterials[i]).name;
materialsHolder[i].AddComponent<MeshRenderer>();
((Renderer)materialsHolder[i].GetComponent<MeshRenderer>()).material = stoneMaterials[i];
}
init = true;
Log("Initialized");
}
if (!init)
{
return;
}
}
catch (Exception ex)
{
MelonLogger.Error((object)ex);
return;
}
sceneChanged = false;
}
public static void Log(string msg)
{
MelonLogger.Msg(msg);
}
private void Save()
{
for (int i = 1; i < StructureStones.Settings.Count - 1; i++)
{
if (preSavedValues[i] == (int)StructureStones.Settings[i + 1].SavedValue)
{
continue;
}
switch (i)
{
case 0:
{
GameObject poolDisc = Structures.GetPoolDisc();
for (int n = 0; n < poolDisc.transform.childCount; n++)
{
if (((Component)poolDisc.transform.GetChild(n)).gameObject.active)
{
((Renderer)((Component)poolDisc.transform.GetChild(n).GetChild(0)).GetComponent<MeshRenderer>()).material = stoneMaterials[(int)StructureStones.Settings[i + 1].SavedValue];
}
}
break;
}
case 1:
{
GameObject poolPillar = Structures.GetPoolPillar();
for (int num3 = 0; num3 < poolPillar.transform.childCount; num3++)
{
if (((Component)poolPillar.transform.GetChild(num3)).gameObject.active)
{
((Renderer)((Component)poolPillar.transform.GetChild(num3).GetChild(0)).GetComponent<MeshRenderer>()).material = stoneMaterials[(int)StructureStones.Settings[i + 1].SavedValue];
}
}
break;
}
case 2:
{
GameObject poolBall = Structures.GetPoolBall();
for (int l = 0; l < poolBall.transform.childCount; l++)
{
if (((Component)poolBall.transform.GetChild(l)).gameObject.active)
{
((Renderer)((Component)poolBall.transform.GetChild(l).GetChild(0)).GetComponent<MeshRenderer>()).material = stoneMaterials[(int)StructureStones.Settings[i + 1].SavedValue];
}
}
break;
}
case 3:
{
GameObject poolCube = Structures.GetPoolCube();
for (int num = 0; num < poolCube.transform.childCount; num++)
{
if (((Component)poolCube.transform.GetChild(num)).gameObject.active)
{
((Renderer)((Component)poolCube.transform.GetChild(num).GetChild(0)).GetComponent<MeshRenderer>()).material = stoneMaterials[(int)StructureStones.Settings[i + 1].SavedValue];
}
}
break;
}
case 4:
{
GameObject poolWall = Structures.GetPoolWall();
for (int m = 0; m < poolWall.transform.childCount; m++)
{
if (((Component)poolWall.transform.GetChild(m)).gameObject.active)
{
((Renderer)((Component)poolWall.transform.GetChild(m).GetChild(0)).GetComponent<MeshRenderer>()).material = stoneMaterials[(int)StructureStones.Settings[i + 1].SavedValue];
}
}
break;
}
case 5:
{
GameObject poolSmallRock = Structures.GetPoolSmallRock();
for (int k = 0; k < poolSmallRock.transform.childCount; k++)
{
if (((Component)poolSmallRock.transform.GetChild(k)).gameObject.active)
{
((Renderer)((Component)poolSmallRock.transform.GetChild(k)).GetComponent<MeshRenderer>()).material = stoneMaterials[(int)StructureStones.Settings[i + 1].SavedValue];
}
}
break;
}
case 6:
{
GameObject poolLargeRock = Structures.GetPoolLargeRock();
for (int num2 = 0; num2 < poolLargeRock.transform.childCount; num2++)
{
if (((Component)poolLargeRock.transform.GetChild(num2)).gameObject.active)
{
((Renderer)((Component)poolLargeRock.transform.GetChild(num2)).GetComponent<MeshRenderer>()).material = stoneMaterials[(int)StructureStones.Settings[i + 1].SavedValue];
}
}
break;
}
case 7:
{
GameObject poolBoulderBall = Structures.GetPoolBoulderBall();
for (int j = 0; j < poolBoulderBall.transform.childCount; j++)
{
if (((Component)poolBoulderBall.transform.GetChild(j)).gameObject.active)
{
((Renderer)((Component)poolBoulderBall.transform.GetChild(j)).GetComponent<MeshRenderer>()).material = stoneMaterials[(int)StructureStones.Settings[i + 1].SavedValue];
}
}
if (currentScene == "Gym")
{
((Renderer)((Component)Ball.GetGameObject().transform.GetChild(0)).GetComponent<MeshRenderer>()).material = stoneMaterials[(int)StructureStones.Settings[i + 1].SavedValue];
((Renderer)((Component)Ball.GetGameObject().transform.GetChild(0)).GetComponent<MeshRenderer>()).material = stoneMaterials[(int)StructureStones.Settings[i + 1].SavedValue];
}
else if (currentScene == "Park")
{
((Renderer)Ball_.GetGameObject().GetComponent<MeshRenderer>()).material = stoneMaterials[(int)StructureStones.Settings[i + 1].SavedValue];
((Renderer)Ball_.GetGameObject().GetComponent<MeshRenderer>()).material = stoneMaterials[(int)StructureStones.Settings[i + 1].SavedValue];
}
break;
}
}
preSavedValues[i] = (int)StructureStones.Settings[i + 1].SavedValue;
}
}
private void UIInit()
{
UI.AddMod(StructureStones);
}
}