using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using CustomMapLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppPhoton.Pun;
using Il2CppRUMBLE.Players;
using MelonLoader;
using Microsoft.CodeAnalysis;
using Singularity;
using UnityEngine;
using UnityEngine.Rendering;
[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), "Singularity", "1.0.1", "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("Singularity")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Singularity")]
[assembly: AssemblyTitle("Singularity")]
[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 Singularity
{
public class Main : Map
{
public static GameObject skyboxHolder;
public bool amhost;
public static bool inMatch;
public override void OnLateInitializeMelon()
{
((Map)this).Initialize("Singularity", "1.0.1", "ERROR", (Map)(object)this);
}
public Quaternion GetAngleToFaceMe(Vector3 objectPosition, Vector3 lookAtPosition)
{
//IL_0001: 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_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = objectPosition - lookAtPosition;
return Quaternion.LookRotation(val);
}
public override void OnMapCreation()
{
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: 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_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Expected O, but got Unknown
//IL_0325: Unknown result type (might be due to invalid IL or missing references)
//IL_034a: Unknown result type (might be due to invalid IL or missing references)
//IL_036a: Unknown result type (might be due to invalid IL or missing references)
//IL_038a: Unknown result type (might be due to invalid IL or missing references)
MelonLogger.Msg("Creating Singularity Map");
using Stream stream = ((MelonBase)this).MelonAssembly.Assembly.GetManifestResourceStream("Singularity.Resources.spacemap");
byte[] array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
Il2CppAssetBundle val = Il2CppAssetBundleManager.LoadFromMemory(Il2CppStructArray<byte>.op_Implicit(array));
Material val2 = val.LoadAsset<Material>("BlackHoleMaterial");
GameObject val3 = val.LoadAsset<GameObject>("Blackhole");
GameObject val4 = Object.Instantiate<GameObject>(val3);
val4.transform.localPosition = new Vector3(0f, 10.48f, 0f);
Transform child = val4.transform.GetChild(0).GetChild(0);
child.localPosition = new Vector3(0f, 0f, 0.0655f);
child.localScale = new Vector3(5.9855f, 5.8945f, 10f);
val4.transform.GetChild(0).localScale = new Vector3(1.2827f, 1.2827f, 0f);
val4.transform.localScale = Vector3.one * 2291f;
GameObject val5 = ((Map)this).CreatePrimitiveObject((PrimitiveType)3, new Vector3(-15.3327f, -0.53f, 41.7818f), Quaternion.identity, Vector3.zero, (ObjectType)1, (PrimitivePhysicsMaterial)null);
for (int i = 0; i < 359; i++)
{
GameObject val6 = ((Map)this).CreatePrimitiveObject((PrimitiveType)3, val5.transform.forward * 30f, Quaternion.identity, new Vector3(13.8f, 1f, 13.8f), (ObjectType)9, (PrimitivePhysicsMaterial)null);
val6.transform.rotation = GetAngleToFaceMe(val6.transform.position, val5.transform.position);
val5.transform.Rotate(new Vector3(0f, 1f, 0f));
val6.transform.position = val6.transform.position + new Vector3(0f, 10f, 0f);
Object.Destroy((Object)(object)val6.GetComponent<Renderer>());
}
Material material = val.LoadAsset<Material>("Purple_4K_Resolution");
GameObject val7 = ((Map)this).CreatePrimitiveObject((PrimitiveType)3, Vector3.zero, Quaternion.identity, Vector3.one, (ObjectType)9, (PrimitivePhysicsMaterial)null);
val7.transform.localScale = new Vector3(200f, 1f, 200f);
val7.transform.localPosition = new Vector3(0f, -13.7891f, 0f);
val7.GetComponent<MeshCollider>().convex = true;
((Collider)val7.GetComponent<MeshCollider>()).isTrigger = true;
val7.AddComponent<KillOnCollide>();
Object.Destroy((Object)(object)val7.GetComponent<Renderer>());
skyboxHolder = new GameObject("SkyboxHolder");
Renderer val8 = (Renderer)(object)skyboxHolder.AddComponent<MeshRenderer>();
val8.material = material;
Object.DontDestroyOnLoad((Object)(object)skyboxHolder);
val4.transform.SetParent(base.mapParent.transform);
val4.transform.localPosition = new Vector3(0f, 10.48f, 0f);
base.mapParent.transform.position = new Vector3(0f, -11f, 0f);
base.HostPedestal.SetFirstSequence(new Vector3(0f, 0f, 30f));
base.ClientPedestal.SetFirstSequence(new Vector3(0f, 0f, -30f));
val.Unload(false);
}
private Vector3 GetRandomPointOnHemisphere(float radius)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
float num = Random.Range(0f, (float)Math.PI * 2f);
float num2 = Random.Range(0f, (float)Math.PI / 2f);
float num3 = radius * Mathf.Sin(num2) * Mathf.Cos(num);
float num4 = radius * Mathf.Cos(num2);
float num5 = radius * Mathf.Sin(num2) * Mathf.Sin(num);
return new Vector3(num3, num4, num5);
}
private IEnumerator coroutine(bool amHost)
{
yield return (object)new WaitForSeconds(2f);
MelonLogger.Msg("Singularity map loaded! Prepare for chaos.");
RenderSettings.skybox = skyboxHolder.GetComponent<Renderer>().material;
if ((Object)(object)skyboxHolder != (Object)null)
{
Renderer renderer2 = skyboxHolder.GetComponent<Renderer>();
if ((Object)(object)renderer2 != (Object)null && (Object)(object)renderer2.material != (Object)null)
{
RenderSettings.skybox = renderer2.material;
}
else
{
MelonLogger.Error("Skybox material not found in SkyboxHolder");
}
}
else
{
MelonLogger.Error("SkyboxHolder is null");
}
DynamicGI.UpdateEnvironment();
amhost = amHost;
GameObject sceneBoundaryPlayer = GameObject.Find("Logic/SceneBoundaryPlayers");
GameObject sceneBoundaryStructure = GameObject.Find("Logic/SceneBoundaryStructures");
Object.Destroy((Object)(object)sceneBoundaryStructure);
Object.Destroy((Object)(object)sceneBoundaryPlayer);
RenderSettings.ambientMode = (AmbientMode)1;
RenderSettings.ambientIntensity = 1f;
RenderSettings.defaultReflectionMode = (DefaultReflectionMode)0;
RenderSettings.fogColor = Color.black;
Light[] lights = Il2CppArrayBase<Light>.op_Implicit(Object.FindObjectsOfType<Light>());
Light[] array = lights;
foreach (Light light in array)
{
light.cullingMask = -1;
}
Renderer[] renderers = Il2CppArrayBase<Renderer>.op_Implicit(Object.FindObjectsOfType<Renderer>());
Renderer[] array2 = renderers;
foreach (Renderer renderer in array2)
{
renderer.lightProbeUsage = (LightProbeUsage)0;
renderer.reflectionProbeUsage = (ReflectionProbeUsage)0;
renderer.lightmapIndex = -1;
}
GameObject directionalLight = GameObject.Find("Lighting and effects/Directional Light");
directionalLight.transform.rotation = Quaternion.Euler(278.8893f, 245.8519f, 0f);
Light skylight = directionalLight.GetComponent<Light>();
skylight.color = new Color(1f, 0.64f, 0f);
skylight.intensity = 7f;
inMatch = true;
}
public override void OnMapMatchLoad(bool amHost)
{
MelonCoroutines.Start(coroutine(amHost));
}
public override void OnMapDisabled()
{
inMatch = false;
}
}
[RegisterTypeInIl2Cpp]
public class KillOnCollide : MonoBehaviour
{
private void OnTriggerEnter(Collider other)
{
MelonLogger.Msg("Collided with thingy ahahahahaaaaaaaaaaaaaaaaaaaaa!");
if (!PhotonNetwork.IsMasterClient)
{
MelonLogger.Msg("Not master client");
return;
}
PlayerController component = ((Component)((Component)other).transform.root).GetComponent<PlayerController>();
if ((Object)(object)component != (Object)null)
{
MelonLogger.Msg("playerController not null");
component.assignedPlayer.Data.HealthPoints = 0;
}
}
}
}