using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using CustomMapLib;
using CustomMapLib.Components;
using CustomMultiplayerMaps;
using HarmonyLib;
using Il2Cpp;
using Il2CppExitGames.Client.Photon;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppPhoton.Pun;
using Il2CppPhoton.Realtime;
using Il2CppRUMBLE.Environment.MatchFlow;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.MoveSystem;
using Il2CppRUMBLE.Networking.MatchFlow;
using Il2CppRUMBLE.Players;
using Il2CppRUMBLE.Utilities;
using Il2CppSystem;
using MelonLoader;
using Microsoft.CodeAnalysis;
using RumbleModUI;
using RumbleModdingAPI;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyDescription("allows you to make more complex custom maps")]
[assembly: AssemblyCopyright("Created by elmish")]
[assembly: AssemblyTrademark(null)]
[assembly: MelonInfo(typeof(global::CustomMapLib.CustomMapLib), "CustomMapLib", "1.1.0", "elmish", null)]
[assembly: MelonColor(255, 255, 0, 0)]
[assembly: MelonGame(null, null)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("CustomMapLib")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+7ec138df702d0c65729c6318aaa4a4f484c6b8b0")]
[assembly: AssemblyProduct("CustomMapLib")]
[assembly: AssemblyTitle("CustomMapLib")]
[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 CustomMapLib
{
public static class BuildInfo
{
public const string Name = "CustomMapLib";
public const string Description = "allows you to make more complex custom maps";
public const string Author = "elmish";
public const string Company = null;
public const string Version = "1.1.0";
public const string DownloadLink = null;
}
public class CustomMapLib : MelonMod
{
[HarmonyPatch(typeof(main), "PreLoadMaps")]
public static class MapLoadPatch
{
public static void Postfix()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
MelonLogger.Msg("[CustomMapLib - PreLoadMaps]: adding custom maps from CustomMapLib");
foreach (Map initializedMap in InitializedMaps)
{
try
{
string text = initializedMap.mapName + " " + initializedMap.mapVersion;
initializedMap.mapParent = new GameObject(text);
initializedMap.mapParent.transform.SetParent(customMultiplayerMaps.mapsParent.transform);
initializedMap.mapParent.SetActive(false);
initializedMap.handler = initializedMap.mapParent.AddComponent<MapInternalHandler>();
initializedMap.handler._map = initializedMap;
initializedMap.OnMapCreation();
MelonLogger.Msg("[CustomMapLib - PreLoadMaps]: Loading " + initializedMap.mapName + " by " + initializedMap.creatorName);
}
catch (Exception ex)
{
MelonLogger.Error($"[CustomMapLib - PreLoadMaps]: Fatal error occured when loading {initializedMap.mapName}, Version {initializedMap.mapVersion}, game will now quit, please ping @elmishh with your log file immediately");
MelonLogger.Error((object)ex);
Application.Quit();
}
}
}
}
[HarmonyPatch(typeof(MatchHandler), "ExecuteNextRound")]
public static class RoundPatch
{
public static void Prefix()
{
foreach (Map initializedMap in InitializedMaps)
{
if (initializedMap.handler.inMatch)
{
initializedMap.OnRoundStarted();
}
}
}
}
[HarmonyPatch(typeof(main), "GetEnabledMapsString")]
public static class MapListPatch
{
public static bool Prefix(ref string __result)
{
MelonLogger.Msg("GetEnabledMapsString was called");
int num = 13;
string text = "";
if (Mods.doesOpponentHaveMod("CustomMapLib", "1.1.0", true))
{
MelonLogger.Msg("[CustomMapLib - GetEnabledMapsString]: Opponent has mod");
foreach (Map initializedMap in InitializedMaps)
{
num++;
}
for (int i = 4; i < num; i++)
{
string name = customMultiplayerMaps.CustomMultiplayerMaps.Settings[i].Name;
if ((bool)customMultiplayerMaps.CustomMultiplayerMaps.Settings[i].Value)
{
text = text + name + "|";
}
}
__result = text;
return false;
}
MelonLogger.Msg("opponent does not have mod");
return true;
}
}
[HarmonyPatch(typeof(main), "ModsReceived")]
public static class Patch2
{
public static bool Prefix()
{
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
MelonLogger.Msg("ModsReceived was called");
if (Mods.doesOpponentHaveMod("CustomMapLib", "1.1.0", true))
{
MelonLogger.Msg("[CustomMapLib - ModsReceived]: both players have mod");
MelonLogger.Msg($"{customMultiplayerMaps.enabled}, {customMultiplayerMaps.EventSent}, {PhotonNetwork.IsMasterClient}");
if (customMultiplayerMaps.enabled && !customMultiplayerMaps.EventSent && !PhotonNetwork.IsMasterClient)
{
MelonLogger.Msg(customMultiplayerMaps.currentScene);
if (customMultiplayerMaps.currentScene == "Map0" || customMultiplayerMaps.currentScene == "Map1")
{
MelonLogger.Msg("[CustomMapLib - ModsReceived]: raising event with code 69");
PhotonNetwork.RaiseEvent(customMultiplayerMaps.myEventCode, Object.op_Implicit(customMultiplayerMaps.GetEnabledMapsString()), main.eventOptions, SendOptions.SendReliable);
}
}
return false;
}
MelonLogger.Msg("ModsReceived - opponent does not have mod");
return true;
}
}
[HarmonyPatch(typeof(main), "OnEvent")]
public static class NetworkEventRecievedPatch
{
public static bool Prefix(ref EventData eventData)
{
if (Mods.doesOpponentHaveMod("CustomMapLib", "1.1.0", true))
{
if (eventData.Code == customMultiplayerMaps.myEventCode)
{
MelonLogger.Msg("[CustomMapLib - OnEvent 69]: opponent has mod");
string[] array = eventData.CustomData.ToString().Split('|');
MelonLogger.Msg("CustomMapLib || OnEvent intercepted successfully");
customMultiplayerMaps.ProcessEventCode69(array);
return false;
}
if (eventData.Code == customMultiplayerMaps.myEventCode2)
{
MelonLogger.Msg("[CustomMapLib - OnEvent 70]: opponent has mod");
string[] array2 = new string[1] { eventData.CustomData.ToString() };
customMultiplayerMaps.ProcessEventCode70(array2);
return false;
}
}
return true;
}
}
[HarmonyPatch(typeof(main), "ProcessEventCode69")]
public static class ProcessPatch
{
public static bool Prefix(ref string[] processedString)
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
MelonLogger.Msg("ProcessEventCode69 called");
if (Mods.doesOpponentHaveMod("CustomMapLib", "1.1.0", true))
{
MelonLogger.Msg("[CustomMapLib - ProcessEventCode69 override]: opponent has mod");
string text = SelectRandomMap(processedString);
PhotonNetwork.RaiseEvent(customMultiplayerMaps.myEventCode2, Object.op_Implicit(text), main.eventOptions2, SendOptions.SendReliable);
}
return true;
}
private static string SelectRandomMap(string[] opponentMaps)
{
MelonLogger.Msg((object)1);
string[] array = customMultiplayerMaps.GetEnabledMapsString().Split('|');
MelonLogger.Msg((object)2);
string text = "[";
string text2 = "[";
MelonLogger.Msg((object)3);
for (int i = 0; i < array.Length - 1; i++)
{
MelonLogger.Msg((object)3.1);
text += array[i];
MelonLogger.Msg((object)3.2);
if (i != array.Length - 1)
{
MelonLogger.Msg((object)3.3);
text += ", ";
}
MelonLogger.Msg((object)3.4);
}
MelonLogger.Msg((object)4);
for (int j = 0; j < opponentMaps.Length - 1; j++)
{
MelonLogger.Msg((object)4.1);
text2 += opponentMaps[j];
MelonLogger.Msg((object)4.2);
if (j != opponentMaps.Length - 1)
{
MelonLogger.Msg((object)4.3);
text2 += ", ";
}
MelonLogger.Msg((object)4.4);
}
MelonLogger.Msg((object)5);
text += "]";
text2 += "]";
MelonLogger.Msg("[CustomMapLib - SelectRandomMap]: opponent maps: " + text2);
MelonLogger.Msg("[CustomMapLib - SelectRandomMap]: local maps: " + text2);
MelonLogger.Msg((object)6);
List<string> list = new List<string>();
foreach (string text3 in opponentMaps)
{
MelonLogger.Msg((object)7);
string[] array2 = array;
foreach (string text4 in array2)
{
MelonLogger.Msg((object)8);
if (text3 == text4)
{
MelonLogger.Msg((object)9);
list.Add(text4);
MelonLogger.Msg((object)10);
}
}
MelonLogger.Msg((object)11);
}
MelonLogger.Msg((object)12);
if (list.Count == 1)
{
MelonLogger.Warning("[CustomMapLib - SelectRandomMap]: no mutual maps found, disabling. " + list[0]);
return "NO_MUTUAL_MAPS";
}
string text5 = "[";
MelonLogger.Msg((object)13);
for (int m = 0; m < list.Count - 1; m++)
{
MelonLogger.Msg((object)14);
text5 += array[m];
MelonLogger.Msg((object)15);
if (m != list.Count - 1)
{
MelonLogger.Msg((object)16);
text5 += ", ";
MelonLogger.Msg((object)17);
}
MelonLogger.Msg((object)18);
}
text5 += "]";
MelonLogger.Msg((object)19);
Random random = new Random();
MelonLogger.Error($"[CustomMapLib - SelectRandomMap]: choosing map - list length: {list.Count}, maps: {text5}, selected map index: {random}");
MelonLogger.Msg((object)20);
string text6 = list[random.Next(0, list.Count - 2)];
MelonLogger.Msg((object)21);
MelonLogger.Msg("map selected: " + text6);
return text6;
}
}
[HarmonyPatch(typeof(main), "ProcessEventCode70")]
public static class SecondProcessPatch
{
public static bool Prefix(ref string[] processedString)
{
MelonLogger.Msg("ProcessEventCode70 called");
if (Mods.doesOpponentHaveMod("CustomMapLib", "1.1.0", true))
{
if (processedString[0] == "NO_MUTUAL_MAPS")
{
return false;
}
bool flag = false;
MelonLogger.Msg("[CustomMapLib - ProcessEventCode70 override]: both players have mod");
MelonLogger.Warning("[CustomMapLib - ProcessEventCode70 override]: looking for map with name: " + processedString[0]);
for (int i = 0; i < customMultiplayerMaps.mapsParent.transform.childCount; i++)
{
if (((Object)customMultiplayerMaps.mapsParent.transform.GetChild(i)).name == processedString[0])
{
((Component)customMultiplayerMaps.mapsParent.transform.GetChild(i)).gameObject.SetActive(true);
if (customMultiplayerMaps.currentScene == "Map0")
{
customMultiplayerMaps.UnLoadMap0();
}
else if (customMultiplayerMaps.currentScene == "Map1")
{
customMultiplayerMaps.UnLoadMap1();
}
Singleton<PoolManager>.instance.ResetPools((AssetType)3);
flag = true;
MelonLogger.Msg("[CustomMapLib - ProcessEventCode70 override]: loading " + processedString[0]);
}
}
if (!flag)
{
MelonLogger.Error("[CustomMapLib - ProcessEventCode70 override]: Map not found, please dm or ping @elmishh if this happens with a log file");
}
return false;
}
return true;
}
}
[HarmonyPatch(typeof(PlayerController), "Initialize", new Type[] { typeof(Player) })]
public static class PlayerSpawnPatch
{
private static void Postfix(ref PlayerController __instance, ref Player player)
{
if (__instance.assignedPlayer.Data.GeneralData.PlayFabMasterId == "3F73EBEC8EDD260F")
{
MelonCoroutines.Start(delayedMethod(__instance));
}
}
public static IEnumerator delayedMethod(PlayerController __instance)
{
yield return (object)new WaitForSeconds(2f);
instancedChest = ((Component)((Component)__instance).gameObject.transform.GetChild(0).GetChild(1).GetChild(0)
.GetChild(4)
.GetChild(0)).gameObject;
instancedCosmetic = Object.Instantiate<GameObject>(cosmetic);
instancedCosmetic.transform.localScale = new Vector3(0.012f, 0.012f, 0.012f);
instancedCosmetic.transform.SetParent(instancedChest.transform);
instancedCosmetic.transform.localPosition = new Vector3(0f, 0.1f, -0.15f);
instancedCosmetic.transform.localRotation = Quaternion.Euler(35f, 90f, 0f);
instancedCosmeticHandler = instancedCosmetic.AddComponent<StaffHandler>();
instancedCosmeticHandler.isLocal = (int)__instance.controllerType == 1;
instancedLeftHand = ((Component)((Component)__instance).transform.GetChild(1).GetChild(1)).gameObject;
instancedRightHand = ((Component)((Component)__instance).transform.GetChild(1).GetChild(2)).gameObject;
}
}
public static CustomMapLib? instance;
public static List<Map> InitializedMaps = new List<Map>();
public static main? customMultiplayerMaps;
public static Shader? urp_lit;
public static bool mapLoaderInitialized;
public static GameObject? physicMaterialHolder;
public static Collider? physicMaterialHolderCollider;
public static string? currentScene;
public static string? previousScene;
public static RaiseEventOptions eventOptions = new RaiseEventOptions
{
Receivers = (ReceiverGroup)0
};
public static GameObject? cosmetic;
public static GameObject? instancedCosmetic;
public static StaffHandler instancedCosmeticHandler;
public static GameObject? instancedChest;
public static GameObject? instancedRightHand;
public static GameObject? instancedLeftHand;
public override void OnLateInitializeMelon()
{
instance = this;
}
public void OnEvent(EventData eventData)
{
if (eventData.Code != 17)
{
return;
}
string[] array = eventData.CustomData.ToString().Split('|');
string text = array[0];
if (text == "CustomMapLib")
{
string text2 = array[1];
switch (text2)
{
case "SnapBack":
instancedCosmeticHandler.ChangeMode(StaffHandler.holdingMode.Back, doRaiseEvent: false);
break;
case "SnapHand":
instancedCosmeticHandler.ChangeMode(StaffHandler.holdingMode.SingleHand, doRaiseEvent: false);
break;
case "SnapDoubleHand":
instancedCosmeticHandler.ChangeMode(StaffHandler.holdingMode.DoubleHand, doRaiseEvent: false);
break;
default:
MelonLogger.Msg("invalid CustomMapLib raiseEvent: " + text2);
break;
}
}
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
previousScene = currentScene;
currentScene = sceneName;
if (sceneName == "Gym" && previousScene == "Gym")
{
return;
}
try
{
if (mapLoaderInitialized)
{
foreach (Map initializedMap in InitializedMaps)
{
if ((Object)(object)initializedMap.handler != (Object)null)
{
initializedMap.handler.inMatch = false;
}
}
}
}
catch
{
}
if (sceneName == "Loader")
{
urp_lit = Shader.Find("Universal Render Pipeline/Lit");
LoadPhysicsMaterial();
CreateOriginalStaff();
}
else if (sceneName == "Gym" && !mapLoaderInitialized)
{
LoadBalancingClient networkingClient = PhotonNetwork.NetworkingClient;
networkingClient.EventReceived += Action<EventData>.op_Implicit((Action<EventData>)OnEvent);
ClassInjector.RegisterTypeInIl2Cpp<MapInternalHandler>();
mapLoaderInitialized = true;
}
}
public static PhysicMaterial GetPhysicsMaterial()
{
try
{
return Object.Instantiate<PhysicMaterial>(physicMaterialHolderCollider.material);
}
catch
{
MelonLogger.Msg("Physics material is null, please ping @elmishh on discord with your log file");
LoadPhysicsMaterial();
}
return null;
}
public static void LoadPhysicsMaterial()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
physicMaterialHolder = new GameObject();
physicMaterialHolderCollider = (Collider?)(object)physicMaterialHolder.AddComponent<BoxCollider>();
Object.DontDestroyOnLoad((Object)(object)physicMaterialHolder);
if ((Object)(object)physicMaterialHolderCollider.material == (Object)null)
{
using (Stream stream = ((MelonBase)instance).MelonAssembly.Assembly.GetManifestResourceStream("CustomMapLib.Resources.physicsmaterial"))
{
byte[] array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
Il2CppAssetBundle val = Il2CppAssetBundleManager.LoadFromMemory(Il2CppStructArray<byte>.op_Implicit(array));
physicMaterialHolderCollider.material = Object.Instantiate<PhysicMaterial>(val.LoadAsset<PhysicMaterial>("baseMaterial"));
}
}
}
private void CreateOriginalStaff()
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
using Stream stream = ((MelonBase)this).MelonAssembly.Assembly.GetManifestResourceStream("CustomMapLib.Resources.asset");
byte[] array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
Il2CppAssetBundle val = Il2CppAssetBundleManager.LoadFromMemory(Il2CppStructArray<byte>.op_Implicit(array));
cosmetic = Object.Instantiate<GameObject>(val.LoadAsset<GameObject>("untitled2"));
Object.DontDestroyOnLoad((Object)(object)cosmetic);
cosmetic.transform.position = Vector3.one * 9999f;
}
}
public class Map : MelonMod
{
public enum ObjectType
{
CombatFloor = 9,
NonCombatFloor = 11,
Wall = 1
}
public class PrimitivePhysicsMaterial
{
public float Bounciness = 0f;
public float Friction = 0f;
public Options options;
}
public enum Options
{
Bouncy,
Friction,
Both
}
public class _PedestalSequences
{
public class _InternalClientPedestal
{
public Map _instance;
public void SetFirstSequence(Vector3 newPosition)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
_instance.handler.ClientPedestalSequence1 = newPosition;
}
public void SetSecondSequence(Vector3 newPosition)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
_instance.handler.ClientPedestalSequence2 = newPosition;
}
}
public class _HostPedestal
{
public Map _instance;
public void SetFirstSequence(Vector3 newPosition)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
_instance.handler.HostPedestalSequence1 = newPosition;
}
public void SetSecondSequence(Vector3 newPosition)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
_instance.handler.HostPedestalSequence2 = newPosition;
}
}
}
public string mapName;
public string creatorName;
public string mapVersion;
public GameObject mapParent;
public bool mapInitialized;
public MapInternalHandler handler;
public _PedestalSequences._HostPedestal HostPedestal = new _PedestalSequences._HostPedestal();
public _PedestalSequences._InternalClientPedestal ClientPedestal = new _PedestalSequences._InternalClientPedestal();
public bool inMatch => handler.inMatch;
public void Initialize(string _mapName, string _mapVersion, string _creatorName)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Expected O, but got Unknown
if (!mapInitialized)
{
mapName = _mapName;
mapVersion = _mapVersion;
creatorName = _creatorName;
CustomMapLib.customMultiplayerMaps = (main)MelonBase.FindMelon("CustomMultiplayerMaps", "UlvakSkillz");
string text = mapName + " " + mapVersion;
CustomMapLib.customMultiplayerMaps.CustomMultiplayerMaps.AddToList(text, true, 0, "Enable or Disable " + mapName + " - " + creatorName, new Tags());
HostPedestal._instance = this;
ClientPedestal._instance = this;
CustomMapLib.InitializedMaps.Add(this);
mapInitialized = true;
CustomMapLib.customMultiplayerMaps.CustomMultiplayerMaps.GetFromFile();
}
}
[Obsolete("new version does not need 'this' in the end, please update to it.")]
public void Initialize(string _mapName, string _mapVersion, string _creatorName, Map _instance)
{
Initialize(_mapName, _mapVersion, _creatorName);
}
public GameObject CreatePrimitiveObject(PrimitiveType primitiveType, Vector3 position, Quaternion rotation, Vector3 scale, ObjectType type, PrimitivePhysicsMaterial primitivePhysicsMaterial = null)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: 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)
GameObject val = GameObject.CreatePrimitive(primitiveType);
val.transform.position = position;
val.transform.rotation = rotation;
val.transform.localScale = scale;
val.GetComponent<Renderer>().material.shader = CustomMapLib.urp_lit;
Collider val2 = val.GetComponent<Collider>();
if (type != ObjectType.Wall)
{
Object.Destroy((Object)(object)val2);
val2 = (Collider)(object)val.AddComponent<MeshCollider>();
val.layer = (int)type;
}
else
{
val.layer = 11;
}
GroundCollider val3 = val.AddComponent<GroundCollider>();
val3.isMainGroundCollider = true;
val3.collider = val2;
val.transform.SetParent(mapParent.transform);
if (primitivePhysicsMaterial != null)
{
PhysicMaterial physicsMaterial = CustomMapLib.GetPhysicsMaterial();
if ((Object)(object)physicsMaterial != (Object)null)
{
val2.material = physicsMaterial;
switch (primitivePhysicsMaterial.options)
{
case Options.Bouncy:
val2.material.bounciness = primitivePhysicsMaterial.Bounciness;
val2.material.bouncyness = primitivePhysicsMaterial.Bounciness;
val2.material.bounceCombine = (PhysicMaterialCombine)3;
break;
case Options.Friction:
val2.material.dynamicFriction = primitivePhysicsMaterial.Friction;
val2.material.dynamicFriction2 = primitivePhysicsMaterial.Friction;
val2.material.staticFriction = primitivePhysicsMaterial.Friction;
val2.material.staticFriction2 = primitivePhysicsMaterial.Friction;
val2.material.frictionCombine = (PhysicMaterialCombine)2;
break;
case Options.Both:
val2.material.bounciness = primitivePhysicsMaterial.Bounciness;
val2.material.bouncyness = primitivePhysicsMaterial.Bounciness;
val2.material.dynamicFriction = primitivePhysicsMaterial.Friction;
val2.material.dynamicFriction2 = primitivePhysicsMaterial.Friction;
val2.material.staticFriction = primitivePhysicsMaterial.Friction;
val2.material.staticFriction2 = primitivePhysicsMaterial.Friction;
val2.material.frictionCombine = (PhysicMaterialCombine)2;
break;
default:
MelonLogger.Error("what the fuck did you do? did you forget to set options?");
break;
}
}
}
return val;
}
public virtual void OnMapMatchLoad(bool amHost)
{
}
public virtual void OnMapDisabled()
{
}
public virtual void OnMapCreation()
{
}
public virtual void OnRoundStarted()
{
}
}
[RegisterTypeInIl2Cpp]
public class StaffHandler : MonoBehaviour
{
public enum holdingMode
{
Back,
SingleHand,
DoubleHand
}
public bool isLocal;
public GameObject rightHandHold;
public GameObject leftHandHold;
public bool RCGrip;
public bool LCGrip;
public holdingMode currentMode = holdingMode.Back;
public Vector3 handOffset = new Vector3(0.015f, -0.1f, 0.012f);
public Quaternion rotationOffset = Quaternion.Euler(15f, 0f, 0f);
public Quaternion doubleHandRotationOffset = Quaternion.Euler(-90f, 0f, 0f);
public void ChangeMode(holdingMode newMode, bool doRaiseEvent)
{
//IL_003f: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: 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)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
currentMode = newMode;
switch (newMode)
{
case holdingMode.Back:
((Component)this).transform.SetParent(CustomMapLib.instancedChest.transform);
((Component)this).transform.localPosition = new Vector3(0f, 0.1f, -0.15f);
((Component)this).transform.localRotation = Quaternion.Euler(35f, 90f, 0f);
if (doRaiseEvent)
{
PhotonNetwork.RaiseEvent((byte)17, Object.op_Implicit("CustomMapLib|SnapBack"), CustomMapLib.eventOptions, SendOptions.SendReliable);
}
break;
case holdingMode.SingleHand:
((Component)this).transform.SetParent(CustomMapLib.instancedRightHand.transform);
((Component)this).transform.localPosition = handOffset;
((Component)this).transform.localRotation = rotationOffset;
if (doRaiseEvent)
{
PhotonNetwork.RaiseEvent((byte)17, Object.op_Implicit("CustomMapLib|SnapHand"), CustomMapLib.eventOptions, SendOptions.SendReliable);
}
break;
case holdingMode.DoubleHand:
if (doRaiseEvent)
{
PhotonNetwork.RaiseEvent((byte)17, Object.op_Implicit("CustomMapLib|SnapDoubleHand"), CustomMapLib.eventOptions, SendOptions.SendReliable);
}
break;
}
}
public void Start()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: 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_00ee: 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_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: 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_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
rightHandHold = GameObject.CreatePrimitive((PrimitiveType)3);
rightHandHold.transform.localScale = Vector3.one * 0.1f;
rightHandHold.transform.SetParent(((Component)this).transform);
rightHandHold.transform.localPosition = Vector3.zero + ((Component)this).transform.forward * -12.5f + ((Component)this).transform.up * 12.5f;
rightHandHold.GetComponent<Renderer>().enabled = false;
leftHandHold = GameObject.CreatePrimitive((PrimitiveType)3);
leftHandHold.transform.localScale = Vector3.one * 0.1f;
leftHandHold.transform.SetParent(((Component)this).transform);
leftHandHold.transform.localPosition = Vector3.zero + ((Component)this).transform.forward * 15f + ((Component)this).transform.up * -15f;
leftHandHold.GetComponent<Renderer>().enabled = false;
}
public void FixedUpdate()
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
RCGrip = RightController.GetGrip() > 0.5f;
LCGrip = LeftController.GetGrip() > 0.5f;
if (currentMode == holdingMode.Back)
{
if (RCGrip && (double)Vector3.Distance(rightHandHold.transform.position, CustomMapLib.instancedRightHand.transform.position) < 0.2 && isLocal)
{
ChangeMode(holdingMode.SingleHand, doRaiseEvent: true);
}
}
else if (currentMode == holdingMode.SingleHand)
{
if (LCGrip && (double)Vector3.Distance(leftHandHold.transform.position, CustomMapLib.instancedLeftHand.transform.position) < 0.2 && isLocal)
{
ChangeMode(holdingMode.DoubleHand, doRaiseEvent: true);
}
else if (!RCGrip && isLocal)
{
ChangeMode(holdingMode.Back, doRaiseEvent: true);
}
}
else if (currentMode == holdingMode.DoubleHand)
{
Quaternion rotation = LookAt(CustomMapLib.instancedLeftHand.transform.position, CustomMapLib.instancedRightHand.transform.position) * doubleHandRotationOffset;
Vector3 position = (CustomMapLib.instancedLeftHand.transform.position + CustomMapLib.instancedRightHand.transform.position * 3f) / 4f;
((Component)this).transform.rotation = rotation;
((Component)this).transform.position = position;
if (!LCGrip && isLocal)
{
ChangeMode(holdingMode.SingleHand, doRaiseEvent: true);
}
else if (!RCGrip && isLocal)
{
ChangeMode(holdingMode.Back, doRaiseEvent: true);
}
}
}
public Quaternion LookAt(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);
}
}
}
namespace CustomMapLib.Components
{
[RegisterTypeInIl2Cpp]
public class MapInternalHandler : MonoBehaviour
{
public Map _map;
public bool inMatch;
public Pedestal clientPedestal;
public Vector3 ClientPedestalSequence1 = new Vector3(0f, 0f, -3f);
public Vector3 ClientPedestalSequence2 = new Vector3(0f, -1f, 0f);
public Pedestal hostPedestal;
public Vector3 HostPedestalSequence1 = new Vector3(0f, 0f, 3f);
public Vector3 HostPedestalSequence2 = new Vector3(0f, -1f, 0f);
private string currentScene;
public MapInternalHandler(IntPtr ptr)
: base(ptr)
{
}//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: 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_002f: 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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
public void OnEnable()
{
inMatch = true;
_map.OnMapMatchLoad(PhotonNetwork.IsMasterClient);
currentScene = CustomMapLib.customMultiplayerMaps.currentScene;
MelonCoroutines.Start(GetPedestals());
}
public void OnDisable()
{
inMatch = false;
_map.OnMapDisabled();
}
private IEnumerator GetPedestals()
{
yield return (object)new WaitForSeconds(1f);
PedestalManager manager = null;
if (currentScene == "Map0")
{
manager = Pedestals.GetGameObject().GetComponent<PedestalManager>();
}
else if (currentScene == "Map1")
{
manager = Pedestals.GetGameObject().GetComponent<PedestalManager>();
}
foreach (Pedestal pedestal in (Il2CppArrayBase<Pedestal>)(object)manager.Pedestals)
{
foreach (MoveOffsetOverDuration moveSequence in (Il2CppArrayBase<MoveOffsetOverDuration>)(object)pedestal.CurrentMoveSequence)
{
if (moveSequence.offset == new Vector3(0f, 0f, 3f))
{
hostPedestal = pedestal;
}
else if (moveSequence.offset == new Vector3(0f, 0f, -3f))
{
clientPedestal = pedestal;
}
}
}
MelonCoroutines.Start(coroutine());
}
private IEnumerator coroutine()
{
yield return (object)new WaitForSeconds(2f);
if (inMatch && (currentScene == "Map0" || currentScene == "Map1"))
{
((Il2CppArrayBase<MoveOffsetOverDuration>)(object)clientPedestal.CurrentMoveSequence)[0].offset = ClientPedestalSequence1;
((Il2CppArrayBase<MoveOffsetOverDuration>)(object)clientPedestal.CurrentMoveSequence)[1].offset = ClientPedestalSequence2;
((Il2CppArrayBase<MoveOffsetOverDuration>)(object)hostPedestal.CurrentMoveSequence)[0].offset = HostPedestalSequence1;
((Il2CppArrayBase<MoveOffsetOverDuration>)(object)hostPedestal.CurrentMoveSequence)[1].offset = HostPedestalSequence2;
}
((Il2CppArrayBase<MoveOffsetOverDuration>)(object)Singleton<MatchHandler>.instance.firstRoundConfig.MoveOffsetSequencePedestalOne)[0].offset = HostPedestalSequence1;
((Il2CppArrayBase<MoveOffsetOverDuration>)(object)Singleton<MatchHandler>.instance.firstRoundConfig.MoveOffsetSequencePedestalOne)[1].offset = HostPedestalSequence2;
((Il2CppArrayBase<MoveOffsetOverDuration>)(object)Singleton<MatchHandler>.instance.firstRoundConfig.MoveOffsetSequencePedestalTwo)[0].offset = ClientPedestalSequence1;
((Il2CppArrayBase<MoveOffsetOverDuration>)(object)Singleton<MatchHandler>.instance.firstRoundConfig.MoveOffsetSequencePedestalTwo)[1].offset = ClientPedestalSequence2;
((Il2CppArrayBase<MoveOffsetOverDuration>)(object)Singleton<MatchHandler>.instance.repeatingRoundConfig.MoveOffsetSequencePedestalOne)[0].offset = HostPedestalSequence1;
((Il2CppArrayBase<MoveOffsetOverDuration>)(object)Singleton<MatchHandler>.instance.repeatingRoundConfig.MoveOffsetSequencePedestalOne)[1].offset = HostPedestalSequence2;
((Il2CppArrayBase<MoveOffsetOverDuration>)(object)Singleton<MatchHandler>.instance.repeatingRoundConfig.MoveOffsetSequencePedestalTwo)[0].offset = ClientPedestalSequence1;
((Il2CppArrayBase<MoveOffsetOverDuration>)(object)Singleton<MatchHandler>.instance.repeatingRoundConfig.MoveOffsetSequencePedestalTwo)[1].offset = ClientPedestalSequence2;
((Il2CppArrayBase<MoveOffsetOverDuration>)(object)Singleton<MatchHandler>.instance.finalRoundConfig.MoveOffsetSequencePedestalOne)[0].offset = HostPedestalSequence1;
((Il2CppArrayBase<MoveOffsetOverDuration>)(object)Singleton<MatchHandler>.instance.finalRoundConfig.MoveOffsetSequencePedestalOne)[1].offset = HostPedestalSequence2;
((Il2CppArrayBase<MoveOffsetOverDuration>)(object)Singleton<MatchHandler>.instance.finalRoundConfig.MoveOffsetSequencePedestalTwo)[0].offset = ClientPedestalSequence1;
((Il2CppArrayBase<MoveOffsetOverDuration>)(object)Singleton<MatchHandler>.instance.finalRoundConfig.MoveOffsetSequencePedestalTwo)[1].offset = ClientPedestalSequence2;
}
}
}