using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using DomainExpansion;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using MelonLoader;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(DomainMod), "Domain Expansion", "0.1.0", "Mariska", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("DomainExpansion")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DomainExpansion")]
[assembly: AssemblyTitle("DomainExpansion")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace DomainExpansion;
public enum DomainType
{
UnlimitedVoid,
MalevolentShrine,
SelfEmbodiment,
IronMountain
}
public class DomainMod : MelonMod
{
private const float Radius = 15f;
private const float Duration = 12f;
private const float TickRate = 0.1f;
private bool active;
private GameObject dome;
private Light domeLight;
public override void OnInitializeMelon()
{
//IL_0019: 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_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
Page obj = Page.Root.CreatePage("Domain Expansion", new Color(0.6f, 0f, 1f), 0, true);
obj.CreateFunction("Gojo: Unlimited Void", Color.cyan, (Action)delegate
{
Expand(DomainType.UnlimitedVoid);
});
obj.CreateFunction("Sukuna: Malevolent Shrine", Color.red, (Action)delegate
{
Expand(DomainType.MalevolentShrine);
});
obj.CreateFunction("Mahito: Self-Embodiment", new Color(0.4f, 0.6f, 0.9f), (Action)delegate
{
Expand(DomainType.SelfEmbodiment);
});
obj.CreateFunction("Jogo: Iron Mountain", new Color(1f, 0.45f, 0f), (Action)delegate
{
Expand(DomainType.IronMountain);
});
obj.CreateFunction("Close Domain", Color.white, (Action)Close);
}
public override void OnSceneWasInitialized(int buildIndex, string sceneName)
{
Close();
}
private void Expand(DomainType type)
{
//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_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
if (!active && !((Object)(object)Player.Head == (Object)null))
{
active = true;
Vector3 position = Player.Head.position;
BuildVisuals(type, position);
MelonCoroutines.Start(Run(type, position));
((MelonBase)this).LoggerInstance.Msg($"Domain Expansion: {type}");
}
}
private void Close()
{
active = false;
if ((Object)(object)dome != (Object)null)
{
Object.Destroy((Object)(object)dome);
}
if ((Object)(object)domeLight != (Object)null)
{
Object.Destroy((Object)(object)((Component)domeLight).gameObject);
}
dome = null;
domeLight = null;
}
private static Color DomainColor(DomainType t)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: 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_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
return (Color)(t switch
{
DomainType.UnlimitedVoid => new Color(0.05f, 0.05f, 0.15f, 1f),
DomainType.MalevolentShrine => new Color(0.35f, 0f, 0f, 1f),
DomainType.SelfEmbodiment => new Color(0.15f, 0.2f, 0.3f, 1f),
_ => new Color(0.6f, 0.2f, 0f, 1f),
});
}
private static Color LightColor(DomainType t)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
return (Color)(t switch
{
DomainType.UnlimitedVoid => new Color(0.6f, 0.8f, 1f),
DomainType.MalevolentShrine => Color.red,
DomainType.SelfEmbodiment => new Color(0.5f, 0.7f, 1f),
_ => new Color(1f, 0.5f, 0.1f),
});
}
private void BuildVisuals(DomainType type, Vector3 center)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Expected O, but got Unknown
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Expected O, but got Unknown
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
dome = GameObject.CreatePrimitive((PrimitiveType)0);
((Object)dome).name = "DomainExpansion_Dome";
Object.Destroy((Object)(object)dome.GetComponent<Collider>());
dome.transform.position = center;
dome.transform.localScale = Vector3.one * 15f * 2f;
MeshFilter component = dome.GetComponent<MeshFilter>();
Mesh val = Object.Instantiate<Mesh>(component.sharedMesh);
Il2CppStructArray<int> triangles = val.triangles;
for (int i = 0; i < ((Il2CppArrayBase<int>)(object)triangles).Length; i += 3)
{
int num = ((Il2CppArrayBase<int>)(object)triangles)[i];
((Il2CppArrayBase<int>)(object)triangles)[i] = ((Il2CppArrayBase<int>)(object)triangles)[i + 1];
((Il2CppArrayBase<int>)(object)triangles)[i + 1] = num;
}
val.triangles = triangles;
component.mesh = val;
MeshRenderer component2 = dome.GetComponent<MeshRenderer>();
Shader val2 = Shader.Find("Universal Render Pipeline/Unlit") ?? Shader.Find("Unlit/Color");
if ((Object)(object)val2 != (Object)null)
{
((Renderer)component2).material = new Material(val2);
}
Color val3 = DomainColor(type);
((Renderer)component2).material.color = val3;
if (((Renderer)component2).material.HasProperty("_BaseColor"))
{
((Renderer)component2).material.SetColor("_BaseColor", val3);
}
GameObject val4 = new GameObject("DomainExpansion_Light");
val4.transform.position = center;
domeLight = val4.AddComponent<Light>();
domeLight.type = (LightType)2;
domeLight.range = 30f;
domeLight.intensity = 3f;
domeLight.color = LightColor(type);
}
private IEnumerator Run(DomainType type, Vector3 center)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
float end = Time.time + 12f;
float nextTick = 0f;
while (active && Time.time < end)
{
if (Time.time >= nextTick)
{
nextTick = Time.time + 0.1f;
foreach (Rigidbody item in BodiesInside(center))
{
Apply(type, item, center);
}
if (type == DomainType.IronMountain && (Object)(object)domeLight != (Object)null)
{
domeLight.intensity = Random.Range(2f, 5f);
}
}
yield return null;
}
Close();
}
private List<Rigidbody> BodiesInside(Vector3 center)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
List<Rigidbody> list = new List<Rigidbody>();
HashSet<int> hashSet = new HashSet<int>();
Transform val = (((Object)(object)Player.RigManager != (Object)null) ? ((Component)Player.RigManager).transform : null);
foreach (Collider item in (Il2CppArrayBase<Collider>)(object)Physics.OverlapSphere(center, 15f))
{
Rigidbody attachedRigidbody = item.attachedRigidbody;
if (!((Object)(object)attachedRigidbody == (Object)null) && !attachedRigidbody.isKinematic && (!((Object)(object)val != (Object)null) || !((Component)attachedRigidbody).transform.IsChildOf(val)) && hashSet.Add(((Object)attachedRigidbody).GetInstanceID()))
{
list.Add(attachedRigidbody);
}
}
return list;
}
private static void Apply(DomainType type, Rigidbody rb, Vector3 center)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: 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_0030: 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_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = center - rb.worldCenterOfMass;
switch (type)
{
case DomainType.UnlimitedVoid:
rb.velocity *= 0.05f;
rb.angularVelocity *= 0.05f;
rb.AddForce(-Physics.gravity, (ForceMode)5);
break;
case DomainType.MalevolentShrine:
if (Random.value < 0.4f)
{
rb.AddForce(Random.onUnitSphere * 8f, (ForceMode)2);
rb.AddTorque(Random.onUnitSphere * 20f, (ForceMode)2);
}
break;
case DomainType.SelfEmbodiment:
rb.AddForce(((Vector3)(ref val)).normalized * 25f, (ForceMode)5);
rb.AddTorque(Random.onUnitSphere * 15f, (ForceMode)5);
break;
case DomainType.IronMountain:
if (Random.value < 0.25f)
{
Vector3 val2 = -((Vector3)(ref val)).normalized + Vector3.up * 2f;
Vector3 normalized = ((Vector3)(ref val2)).normalized;
rb.AddForce(normalized * 12f, (ForceMode)2);
}
break;
}
}
}