using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu.Elements;
using BoneLib.Nullables;
using EchoVRGamemode;
using EchoVRGamemode.Behaviors;
using EchoVRGamemode.Proxy;
using HarmonyLib;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LabFusion.Data;
using LabFusion.MarrowIntegration;
using LabFusion.Network;
using LabFusion.Representation;
using LabFusion.SDK.Gamemodes;
using LabFusion.Utilities;
using MelonLoader;
using SLZ.Interaction;
using SLZ.Marrow.Data;
using SLZ.Marrow.Pool;
using SLZ.Marrow.Warehouse;
using SLZ.Rig;
using SLZ.SFX;
using SwipezGamemodeLib.Spectator;
using SwipezGamemodeLib.Utilities;
using TMPro;
using UnhollowerBaseLib;
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(MainClass), "EchoVRGamemode", "1.0.0", "notnotnotswipez", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: AssemblyTitle("EchoVRGamemode")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EchoVRGamemode")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ff79f9ce-f89f-49ba-a928-cad7320b785b")]
[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 EchoVRGamemode
{
public static class AssetBundleExtensioner
{
public static T LoadPersistentAsset<T>(this AssetBundle bundle, string name) where T : Object
{
Object val = bundle.LoadAsset(name);
if (val != (Object)null)
{
val.hideFlags = (HideFlags)32;
return ((Il2CppObjectBase)val).TryCast<T>();
}
return default(T);
}
}
public class EchoVRGamemodeAssets
{
public static List<AudioClip> audioClips = new List<AudioClip>();
public static Texture2D blueTeamLogo;
public static Texture2D orangeTeamLogo;
public static AudioClip[] defaultPlaylist;
public static void LoadAssets(AssetBundle bundle)
{
blueTeamLogo = bundle.LoadPersistentAsset<Texture2D>("assets/echovirtualreality/bundle/blueteamicon.png");
orangeTeamLogo = bundle.LoadPersistentAsset<Texture2D>("assets/echovirtualreality/bundle/orangeteamicon.png");
foreach (string item in (Il2CppArrayBase<string>)(object)bundle.GetAllAssetNames())
{
if (item.EndsWith(".mp3"))
{
audioClips.Add(bundle.LoadPersistentAsset<AudioClip>(item));
}
}
defaultPlaylist = audioClips.ToArray();
}
}
[HarmonyPatch(typeof(HandSFX), "PunchAttack", new Type[]
{
typeof(Collision),
typeof(float),
typeof(float)
})]
public static class PunchDamagePatch
{
public static void Prefix(HandSFX __instance, Collision c)
{
if (EchoVRGamemode.Instance != null && ((Gamemode)EchoVRGamemode.Instance).IsActive() && ((Object)__instance._hand.manager).GetInstanceID() != ((Object)Player.rigManager).GetInstanceID())
{
RigManager componentInParent = c.gameObject.GetComponentInParent<RigManager>();
PlayerRep val = default(PlayerRep);
if (Object.op_Implicit((Object)(object)componentInParent) && ((Object)componentInParent).GetInstanceID() == ((Object)Player.rigManager).GetInstanceID() && PlayerRepManager.TryGetPlayerRep(__instance._hand.manager, ref val) && EchoVRGamemode.Instance.GetRole(val.PlayerId) != EchoVRGamemode.Instance.localRole)
{
PunchFreezer.Instance.Punch();
}
}
}
}
[HarmonyPatch(typeof(Hand), "AttachObject")]
public class OnFrozeHandGrabPatch
{
public static bool Prefix(Hand __instance)
{
if (((Object)__instance.manager).GetInstanceID() != ((Object)Player.rigManager).GetInstanceID())
{
return true;
}
if (EchoVRGamemode.Instance != null && ((Gamemode)EchoVRGamemode.Instance).IsActive())
{
if (EchoVRGamemode.Instance.endTimer.isRunning)
{
return false;
}
if (PunchFreezer.Instance.IsFrozen())
{
return false;
}
}
return true;
}
}
public class MainClass : MelonMod
{
public static bool hasSpiderlab;
private bool addedCallback = false;
public override void OnInitializeMelon()
{
GamemodeRegistration.LoadGamemodes(Assembly.GetExecutingAssembly());
Hooking.OnGripAttached += OnGripAttached;
Hooking.OnLevelInitialized += OnLevelInitialized;
AssetBundle bundle = (HelperMethods.IsAndroid() ? EmbeddedAssetBundle.LoadFromAssembly(Assembly.GetExecutingAssembly(), "EchoVRGamemode.Resources.echovrassets.android.gamemode") : EmbeddedAssetBundle.LoadFromAssembly(Assembly.GetExecutingAssembly(), "EchoVRGamemode.Resources.echovrassets.gamemode"));
EchoVRGamemodeAssets.LoadAssets(bundle);
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
Assembly[] array = assemblies;
foreach (Assembly assembly in array)
{
if (assembly.GetName().Name.ToLower().Equals("spiderlab"))
{
hasSpiderlab = true;
}
}
}
private void OnLevelInitialized(LevelInfo info)
{
if (!hasSpiderlab)
{
((Component)Player.physicsRig).gameObject.AddComponent<AirControl>();
}
((Component)Player.physicsRig).gameObject.AddComponent<PunchFreezer>();
}
private void OnGripAttached(Grip grip, Hand hand)
{
if (EchoVRGamemode.Instance == null || !((Gamemode)EchoVRGamemode.Instance).IsActive() || ((Object)hand.manager).GetInstanceID() == ((Object)Player.rigManager).GetInstanceID() || ((HandReciever)grip).Host == null || (Object)(object)((HandReciever)grip).Host.Rb == (Object)null)
{
return;
}
InteractableHost component = ((Component)((HandReciever)grip).Host.Rb).GetComponent<InteractableHost>();
AssetPoolee component2 = ((Component)((HandReciever)grip).Host.Rb).GetComponent<AssetPoolee>();
if (!(Barcode.op_Implicit(((Scannable)component2.spawnableCrate)._barcode) != EchoVRGamemode.DISC_BARCODE))
{
GameObject currentAttachedGO = Player.leftHand.m_CurrentAttachedGO;
GameObject currentAttachedGO2 = Player.rightHand.m_CurrentAttachedGO;
if (Object.op_Implicit((Object)(object)currentAttachedGO) && AttemptGetInteractableHost(currentAttachedGO, out var host) && ((Object)host).GetInstanceID() == ((Object)component).GetInstanceID())
{
Player.leftHand.DetachJoint(false, (Grip)null);
Player.leftHand.DetachObject();
}
if (Object.op_Implicit((Object)(object)currentAttachedGO2) && AttemptGetInteractableHost(currentAttachedGO2, out var host2) && ((Object)host2).GetInstanceID() == ((Object)component).GetInstanceID())
{
Player.rightHand.DetachJoint(false, (Grip)null);
Player.rightHand.DetachObject();
}
}
}
private bool AttemptGetInteractableHost(GameObject go, out InteractableHost host)
{
if ((Object)(object)go == (Object)null)
{
host = null;
return false;
}
Grip component = go.GetComponent<Grip>();
if ((Object)(object)component != (Object)null && ((HandReciever)component).Host != null)
{
host = ((Component)((HandReciever)component).Host.Rb).GetComponent<InteractableHost>();
return true;
}
host = null;
return false;
}
}
public class EchoVRGamemode : Gamemode
{
public const string DefaultPrefix = "InternalEchoMetadata";
public const string PlayerRoleKey = "InternalEchoMetadata.Role";
public const string BLUE_ROLE = "Blue";
public const string ORANGE_ROLE = "Orange";
public string localRole = "nothing";
public static string DISC_BARCODE = "nothing";
public int roundDurationMinutes = 5;
private int blueScore = 0;
private int orangeScore = 0;
private BoxCollider orangeSideSelect;
private BoxCollider blueSideSelect;
private GamemodeTimer roundTimer = new GamemodeTimer();
private Vector3 discSpawnPosition = new Vector3(0f, 0f, 0f);
private Vector3 blueSideDiscSpawnPosition = new Vector3(0f, 0f, 0f);
private Vector3 orangeSideDiscSpawnPosition = new Vector3(0f, 0f, 0f);
private bool warnedOfOneMinute = false;
private bool doTeamSelect = false;
public static List<int> discsUsed = new List<int>();
private List<TMP_Text> blueScoreDisplays = new List<TMP_Text>();
private List<TMP_Text> orangeScoreDisplays = new List<TMP_Text>();
public GamemodeTimer endTimer = new GamemodeTimer();
public override string GamemodeCategory => "Echo VR";
public override string GamemodeName => "Echo Arena";
public override bool DisableDevTools => true;
public override bool DisableSpawnGun => true;
public override bool PreventNewJoins => true;
public static EchoVRGamemode Instance { get; private set; }
public override void OnGamemodeRegistered()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
((Gamemode)this).OnGamemodeRegistered();
Instance = this;
FusionOverrides.OnValidateNametag += new UserOverride(OnValidateNametag);
((Gamemode)this).SetPlaylist(0.4f, EchoVRGamemodeAssets.defaultPlaylist);
}
public override void OnGamemodeUnregistered()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
((Gamemode)this).OnGamemodeUnregistered();
if (Instance == this)
{
Instance = null;
}
FusionOverrides.OnValidateNametag -= new UserOverride(OnValidateNametag);
}
public override void OnBoneMenuCreated(MenuCategory category)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
((Gamemode)this).OnBoneMenuCreated(category);
category.CreateIntElement("Round Minutes", Color.yellow, roundDurationMinutes, 1, 1, 15, (Action<int>)delegate(int num)
{
roundDurationMinutes = num;
});
category.CreateBoolElement("Team Select", Color.yellow, doTeamSelect, (Action<bool>)delegate(bool b)
{
doTeamSelect = b;
});
}
public override void OnLoadingBegin()
{
SetDefaults();
}
public void AddBlueScoreDisplay(TMP_Text text)
{
blueScoreDisplays.Add(text);
}
public void AddOrangeScoreDisplay(TMP_Text text)
{
orangeScoreDisplays.Add(text);
}
public void SetDiscSpawnPosition(Vector3 position)
{
//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)
discSpawnPosition = position;
}
public void SetDefaults()
{
//IL_0011: 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)
//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_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)
discSpawnPosition = new Vector3(0f, 0f, 0f);
blueSideDiscSpawnPosition = new Vector3(0f, 0f, 0f);
orangeSideDiscSpawnPosition = new Vector3(0f, 0f, 0f);
blueScoreDisplays.Clear();
orangeScoreDisplays.Clear();
orangeSideSelect = null;
blueSideSelect = null;
DISC_BARCODE = "nothing";
}
public void SetOrangeSelectBox(BoxCollider selectBox)
{
orangeSideSelect = selectBox;
}
public void SetBlueSelectBox(BoxCollider selectBox)
{
blueSideSelect = selectBox;
}
public void SetBlueDiscSpawnPosition(Vector3 position)
{
//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)
blueSideDiscSpawnPosition = position;
}
public void SetOrangeDiscSpawnPosition(Vector3 position)
{
//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)
orangeSideDiscSpawnPosition = position;
}
public void SetBlueScore(int score)
{
blueScore = score;
}
public void SetOrangeScore(int score)
{
orangeScore = score;
}
public void AddBlueScore(int score)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
blueScore += score;
SpawnDisc(orangeSideDiscSpawnPosition);
if (!NetworkInfo.IsServer)
{
return;
}
((Gamemode)this).TryInvokeTrigger($"BlueScore;{blueScore}");
if (roundTimer.IsFinishedInMinutes(roundDurationMinutes))
{
if (blueScore > orangeScore)
{
((Gamemode)this).TryInvokeTrigger("BlueWin");
}
else if (orangeScore > blueScore)
{
((Gamemode)this).TryInvokeTrigger("OrangeWin");
}
else
{
((Gamemode)this).TryInvokeTrigger("Tie");
}
((Gamemode)this).StopGamemode();
roundTimer.Reset();
}
}
public string GetRole(PlayerId playerId)
{
string text = default(string);
return ((Gamemode)this).TryGetMetadata(GetRoleKey(playerId), ref text) ? text : "none";
}
private string GetScoreDisplay(int score)
{
if (score < 10)
{
return $"0{score}";
}
return $"{score}";
}
public void AddOrangeScore(int score)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
orangeScore += score;
SpawnDisc(blueSideDiscSpawnPosition);
if (!NetworkInfo.IsServer)
{
return;
}
((Gamemode)this).TryInvokeTrigger($"OrangeScore;{orangeScore}");
if (roundTimer.IsFinishedInMinutes(roundDurationMinutes))
{
if (blueScore > orangeScore)
{
((Gamemode)this).TryInvokeTrigger("BlueWin");
}
else if (orangeScore > blueScore)
{
((Gamemode)this).TryInvokeTrigger("OrangeWin");
}
else
{
((Gamemode)this).TryInvokeTrigger("Tie");
}
((Gamemode)this).StopGamemode();
roundTimer.Reset();
}
}
protected override void OnStartGamemode()
{
//IL_0026: 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_0031: Unknown result type (might be due to invalid IL or missing references)
//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_0041: 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_0053: 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_0066: Expected O, but got Unknown
//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)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: 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_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_0273: Unknown result type (might be due to invalid IL or missing references)
//IL_037c: Unknown result type (might be due to invalid IL or missing references)
((Gamemode)this).OnStartGamemode();
if (NetworkInfo.IsServer && DISC_BARCODE == "nothing")
{
FusionNotifier.Send(new FusionNotification
{
title = new NotificationText("This map is not ECHOVR SUPPORTED!", Color.cyan, true),
showTitleOnPopup = true,
popupLength = 1f,
isMenuItem = false,
isPopup = true
});
((Gamemode)this).StopGamemode();
return;
}
warnedOfOneMinute = false;
discsUsed.Clear();
blueScore = 0;
orangeScore = 0;
UpdateScoreDisplays();
((Gamemode)this).SetPlaylist(0.4f, EchoVRGamemodeAssets.defaultPlaylist);
if (!NetworkInfo.IsServer)
{
return;
}
List<PlayerId> list = new List<PlayerId>();
list.AddRange(PlayerIdManager.PlayerIds);
List<PlayerId> list2 = new List<PlayerId>();
List<PlayerId> list3 = new List<PlayerId>();
if (doTeamSelect)
{
Bounds bounds;
foreach (PlayerRep playerRep in PlayerRepManager.PlayerReps)
{
if (Object.op_Implicit((Object)(object)orangeSideSelect))
{
bounds = ((Collider)orangeSideSelect).bounds;
if (((Bounds)(ref bounds)).Contains(((Rig)playerRep.RigReferences.RigManager.physicsRig).m_pelvis.position))
{
list3.Add(playerRep.PlayerId);
list.Remove(playerRep.PlayerId);
}
}
if (Object.op_Implicit((Object)(object)blueSideSelect))
{
bounds = ((Collider)blueSideSelect).bounds;
if (((Bounds)(ref bounds)).Contains(((Rig)playerRep.RigReferences.RigManager.physicsRig).m_pelvis.position))
{
list2.Add(playerRep.PlayerId);
list.Remove(playerRep.PlayerId);
}
}
}
if (Object.op_Implicit((Object)(object)orangeSideSelect))
{
bounds = ((Collider)orangeSideSelect).bounds;
if (((Bounds)(ref bounds)).Contains(((Rig)Player.physicsRig).m_pelvis.position))
{
list3.Add(PlayerIdManager.LocalId);
list.Remove(PlayerIdManager.LocalId);
}
}
if (Object.op_Implicit((Object)(object)blueSideSelect))
{
bounds = ((Collider)blueSideSelect).bounds;
if (((Bounds)(ref bounds)).Contains(((Rig)Player.physicsRig).m_pelvis.position))
{
list2.Add(PlayerIdManager.LocalId);
list.Remove(PlayerIdManager.LocalId);
}
}
}
bool flag = true;
while (list.Count > 0)
{
PlayerId item = list[Random.Range(0, list.Count)];
list.Remove(item);
if (flag)
{
list2.Add(item);
}
else
{
list3.Add(item);
}
flag = !flag;
}
foreach (PlayerId item2 in list2)
{
SetRole(item2, "Blue");
}
foreach (PlayerId item3 in list3)
{
SetRole(item3, "Orange");
}
SpawnDisc(discSpawnPosition);
roundTimer.Start();
}
private void SpawnDisc(Vector3 pos)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: 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_002f: Expected O, but got Unknown
//IL_0057: 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)
if (NetworkInfo.IsServer)
{
SpawnableCrateReference crateRef = new SpawnableCrateReference(DISC_BARCODE);
Spawnable val = new Spawnable
{
crateRef = crateRef,
policyData = null
};
AssetSpawner.Register(val);
Action<GameObject> action = delegate(GameObject go)
{
//IL_001a: 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)
discsUsed.Remove(((Object)go).GetInstanceID());
Rigidbody component = go.GetComponent<Rigidbody>();
component.velocity = Vector3.zero;
component.angularVelocity = Vector3.zero;
};
AssetSpawner.Spawn(val, pos, Quaternion.identity, BoxedNullable<Vector3>.op_Implicit(new BoxedNullable<Vector3>((Vector3?)null)), false, BoxedNullable<int>.op_Implicit(new BoxedNullable<int>((int?)null)), Action<GameObject>.op_Implicit(action), (Action<GameObject>)null);
}
}
protected override void OnUpdate()
{
((Gamemode)this).OnUpdate();
if (((Gamemode)this).IsActive())
{
if (NetworkInfo.IsServer && roundTimer.isRunning && roundTimer.IsFinishedInMinutes(roundDurationMinutes - 1) && !warnedOfOneMinute)
{
warnedOfOneMinute = true;
((Gamemode)this).TryInvokeTrigger("OneMinuteWarn");
}
if (endTimer.isRunning && endTimer.IsFinishedInSeconds(3))
{
TeleportToSpawn();
endTimer.Reset();
}
}
}
protected override void OnEventTriggered(string value)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: 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_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Expected O, but got Unknown
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: 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)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: 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_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Expected O, but got Unknown
//IL_019e: 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_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: 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_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Expected O, but got Unknown
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Expected O, but got Unknown
//IL_0286: 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_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Expected O, but got Unknown
((Gamemode)this).OnEventTriggered(value);
if (value == "OneMinuteWarn")
{
FusionNotifier.Send(new FusionNotification
{
title = new NotificationText("One Minute Remaining!", Color.cyan, true),
showTitleOnPopup = true,
popupLength = 1f,
isMenuItem = false,
isPopup = true
});
}
if (value.StartsWith("BlueScore"))
{
int num = (blueScore = int.Parse(value.Split(new char[1] { ';' })[1]));
FusionNotifier.Send(new FusionNotification
{
title = new NotificationText("Blue Scored!", Color.cyan, true),
message = new NotificationText($"They have {num} points!", Color.cyan, true),
showTitleOnPopup = true,
popupLength = 1f,
isMenuItem = false,
isPopup = true
});
UpdateScoreDisplays();
RequestRoundEnd();
}
if (value == "Tie")
{
FusionNotifier.Send(new FusionNotification
{
title = new NotificationText("Tie!", Color.cyan, true),
message = new NotificationText("They points!", Color.cyan, true),
showTitleOnPopup = true,
popupLength = 1f,
isMenuItem = false,
isPopup = true
});
}
if (value.StartsWith("OrangeScore"))
{
int num2 = (orangeScore = int.Parse(value.Split(new char[1] { ';' })[1]));
FusionNotifier.Send(new FusionNotification
{
title = new NotificationText("Orange Scored!", Color.cyan, true),
message = new NotificationText($"They have {num2} points!", Color.cyan, true),
showTitleOnPopup = true,
popupLength = 1f,
isMenuItem = false,
isPopup = true
});
UpdateScoreDisplays();
RequestRoundEnd();
}
if (value == "BlueWin")
{
FusionNotifier.Send(new FusionNotification
{
title = new NotificationText($"BLUE WINS! ({blueScore} points)", Color.cyan, true),
showTitleOnPopup = true,
popupLength = 1f,
isMenuItem = false,
isPopup = true
});
}
if (value == "OrangeWin")
{
FusionNotifier.Send(new FusionNotification
{
title = new NotificationText($"ORANGE WINS! ({orangeScore} points)", Color.cyan, true),
showTitleOnPopup = true,
popupLength = 1f,
isMenuItem = false,
isPopup = true
});
}
}
private void UpdateScoreDisplays()
{
foreach (TMP_Text blueScoreDisplay in blueScoreDisplays)
{
blueScoreDisplay.text = GetScoreDisplay(blueScore);
}
foreach (TMP_Text orangeScoreDisplay in orangeScoreDisplays)
{
orangeScoreDisplay.text = GetScoreDisplay(orangeScore);
}
}
private void RequestRoundEnd()
{
FusionSceneManager.HookOnTargetLevelLoad((Action)delegate
{
Player.leftHand.DetachJoint(false, (Grip)null);
Player.rightHand.DetachJoint(false, (Grip)null);
Player.leftHand.DetachObject();
Player.rightHand.DetachObject();
endTimer.Start();
});
}
private void TeleportToSpawn()
{
if (localRole == "Blue")
{
FusionSceneManager.HookOnTargetLevelLoad((Action)delegate
{
//IL_0059: 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)
List<Transform> list2 = new List<Transform>();
foreach (EchoBlueTeamSpawnpoint component in EchoBlueTeamSpawnpoint.Cache.Components)
{
list2.Add(((Component)component).transform);
}
Transform val2 = list2[Random.Range(0, list2.Count)];
FusionPlayer.Teleport(val2.position, val2.forward, true);
});
}
else
{
if (!(localRole == "Orange"))
{
return;
}
FusionSceneManager.HookOnTargetLevelLoad((Action)delegate
{
//IL_0059: 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)
List<Transform> list = new List<Transform>();
foreach (EchoOrangeTeamSpawnpoint component2 in EchoOrangeTeamSpawnpoint.Cache.Components)
{
list.Add(((Component)component2).transform);
}
Transform val = list[Random.Range(0, list.Count)];
FusionPlayer.Teleport(val.position, val.forward, true);
});
}
}
protected override void OnStopGamemode()
{
((Gamemode)this).OnStopGamemode();
foreach (PlayerId playerId in PlayerIdManager.PlayerIds)
{
PlayerIdExtensions.SetHeadIcon(playerId, (Texture2D)null);
}
DespawnAll(DISC_BARCODE);
FusionPlayer.ClearAvatarOverride();
}
public void DespawnAll(string barcode)
{
if (NetworkInfo.HasServer && !NetworkInfo.IsServer)
{
return;
}
Dictionary<Barcode, AssetPool> barcodeToPool = AssetSpawner._instance._barcodeToPool;
Enumerator<Barcode, AssetPool> enumerator = barcodeToPool.GetEnumerator();
while (enumerator.MoveNext())
{
KeyValuePair<Barcode, AssetPool> current = enumerator.Current;
if (!(current.key.ToString() == barcode))
{
continue;
}
Il2CppArrayBase<AssetPoolee> val = current.value.spawned.ToArray();
{
foreach (AssetPoolee item in val)
{
item.Despawn();
}
break;
}
}
}
protected bool OnValidateNametag(PlayerId id)
{
if (!((Gamemode)this).IsActive())
{
return true;
}
return false;
}
protected override void OnMetadataChanged(string key, string value)
{
((Gamemode)this).OnMetadataChanged(key, value);
if (key.StartsWith("InternalEchoMetadata.Role"))
{
string[] array = key.Split(new char[1] { '.' });
ulong num = ulong.Parse(array[2]);
PlayerId playerId = PlayerIdManager.GetPlayerId(num);
if (playerId != null)
{
OnRoleChanged(playerId, value);
}
}
}
private void OnRoleChanged(PlayerId playerId, string role)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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_005f: 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_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: 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_008e: Expected O, but got Unknown
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: 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_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Expected O, but got Unknown
if (playerId.IsSelf)
{
localRole = role;
if (role == "Blue")
{
FusionSceneManager.HookOnTargetLevelLoad((Action)delegate
{
//IL_0059: 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)
List<Transform> list2 = new List<Transform>();
foreach (EchoBlueTeamSpawnpoint component in EchoBlueTeamSpawnpoint.Cache.Components)
{
list2.Add(((Component)component).transform);
}
Transform val2 = list2[Random.Range(0, list2.Count)];
FusionPlayer.Teleport(val2.position, val2.forward, true);
});
FusionNotifier.Send(new FusionNotification
{
title = new NotificationText("You are on the blue team", Color.cyan, true),
showTitleOnPopup = true,
popupLength = 1f,
isMenuItem = false,
isPopup = true
});
FusionPlayer.SetAvatarOverride(Barcode.op_Implicit(((CrateReference)Player.rigManager.AvatarCrate)._barcode));
FusionPlayer.SetAmmo(0);
FusionPlayer.SetMortality(false);
FusionOverrides.ForceUpdateOverrides();
}
if (!(role == "Orange"))
{
return;
}
FusionSceneManager.HookOnTargetLevelLoad((Action)delegate
{
//IL_0059: 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)
List<Transform> list = new List<Transform>();
foreach (EchoOrangeTeamSpawnpoint component2 in EchoOrangeTeamSpawnpoint.Cache.Components)
{
list.Add(((Component)component2).transform);
}
Transform val = list[Random.Range(0, list.Count)];
FusionPlayer.Teleport(val.position, val.forward, true);
});
FusionNotifier.Send(new FusionNotification
{
title = new NotificationText("You are on the orange team", Color.cyan, true),
showTitleOnPopup = true,
popupLength = 1f,
isMenuItem = false,
isPopup = true
});
FusionOverrides.ForceUpdateOverrides();
FusionPlayer.SetAvatarOverride(Barcode.op_Implicit(((CrateReference)Player.rigManager.AvatarCrate)._barcode));
FusionPlayer.SetAmmo(0);
FusionPlayer.SetMortality(false);
}
else if (role == "Blue")
{
PlayerIdExtensions.SetHeadIcon(playerId, EchoVRGamemodeAssets.blueTeamLogo);
}
else if (role == "Orange")
{
PlayerIdExtensions.SetHeadIcon(playerId, EchoVRGamemodeAssets.orangeTeamLogo);
}
}
private void SetRole(PlayerId playerId, string role)
{
((Gamemode)this).TrySetMetadata(GetRoleKey(playerId), role);
}
private string GetRoleKey(PlayerId playerId)
{
return "InternalEchoMetadata.Role." + playerId.LongId;
}
}
}
namespace EchoVRGamemode.Proxy
{
[RegisterTypeInIl2Cpp]
public class EchoBlueGoal : FusionMarrowBehaviour
{
public EchoBlueGoal(IntPtr intPtr)
: base(intPtr)
{
}
private void OnTriggerEnter(Collider other)
{
if (EchoVRGamemode.Instance == null || !((Gamemode)EchoVRGamemode.Instance).IsActive() || NetworkInfo.IsClient)
{
return;
}
Rigidbody attachedRigidbody = other.attachedRigidbody;
if ((Object)(object)attachedRigidbody != (Object)null && !EchoVRGamemode.discsUsed.Contains(((Object)((Component)attachedRigidbody).gameObject).GetInstanceID()))
{
EchoVRGamemode.discsUsed.Add(((Object)((Component)attachedRigidbody).gameObject).GetInstanceID());
EchoDisc component = ((Component)attachedRigidbody).GetComponent<EchoDisc>();
if ((Object)(object)component != (Object)null)
{
EchoVRGamemode.Instance.AddOrangeScore(1);
((Component)attachedRigidbody).GetComponent<AssetPoolee>().Despawn();
}
}
}
}
[RegisterTypeInIl2Cpp]
public class EchoBlueTeamSpawnpoint : FusionMarrowBehaviour
{
public static readonly FusionComponentCache<GameObject, EchoBlueTeamSpawnpoint> Cache = new FusionComponentCache<GameObject, EchoBlueTeamSpawnpoint>();
public EchoBlueTeamSpawnpoint(IntPtr intPtr)
: base(intPtr)
{
}
private void OnEnable()
{
Cache.Add(((Component)this).gameObject, this);
}
private void OnDisable()
{
Cache.Remove(((Component)this).gameObject);
}
}
[RegisterTypeInIl2Cpp]
public class EchoDisc : FusionMarrowBehaviour
{
public EchoDisc(IntPtr intPtr)
: base(intPtr)
{
}
}
[RegisterTypeInIl2Cpp]
public class EchoOrangeGoal : FusionMarrowBehaviour
{
public EchoOrangeGoal(IntPtr intPtr)
: base(intPtr)
{
}
private void OnTriggerEnter(Collider other)
{
if (EchoVRGamemode.Instance == null || !((Gamemode)EchoVRGamemode.Instance).IsActive() || NetworkInfo.IsClient)
{
return;
}
Rigidbody attachedRigidbody = other.attachedRigidbody;
if ((Object)(object)attachedRigidbody != (Object)null && !EchoVRGamemode.discsUsed.Contains(((Object)((Component)attachedRigidbody).gameObject).GetInstanceID()))
{
EchoVRGamemode.discsUsed.Add(((Object)((Component)attachedRigidbody).gameObject).GetInstanceID());
EchoDisc component = ((Component)attachedRigidbody).GetComponent<EchoDisc>();
if ((Object)(object)component != (Object)null)
{
EchoVRGamemode.Instance.AddBlueScore(1);
((Component)attachedRigidbody).GetComponent<AssetPoolee>().Despawn();
}
}
}
}
[RegisterTypeInIl2Cpp]
public class EchoOrangeTeamSpawnpoint : FusionMarrowBehaviour
{
public static readonly FusionComponentCache<GameObject, EchoOrangeTeamSpawnpoint> Cache = new FusionComponentCache<GameObject, EchoOrangeTeamSpawnpoint>();
public EchoOrangeTeamSpawnpoint(IntPtr intPtr)
: base(intPtr)
{
}
private void OnEnable()
{
Cache.Add(((Component)this).gameObject, this);
}
private void OnDisable()
{
Cache.Remove(((Component)this).gameObject);
}
}
[RegisterTypeInIl2Cpp]
public class EchoVRGamemodeProxy : FusionMarrowBehaviour
{
public EchoVRGamemodeProxy(IntPtr intPtr)
: base(intPtr)
{
}
public void SetDiscOriginPosition(Transform spawn)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if (EchoVRGamemode.Instance != null)
{
EchoVRGamemode.Instance.SetDiscSpawnPosition(spawn.position);
}
}
public void SetDiscBluePosition(Transform spawn)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if (EchoVRGamemode.Instance != null)
{
EchoVRGamemode.Instance.SetBlueDiscSpawnPosition(spawn.position);
}
}
public void SetDiscOrangePosition(Transform spawn)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if (EchoVRGamemode.Instance != null)
{
EchoVRGamemode.Instance.SetOrangeDiscSpawnPosition(spawn.position);
}
}
public void AddBlueScoreDisplay(TMP_Text text)
{
if (EchoVRGamemode.Instance != null)
{
EchoVRGamemode.Instance.AddBlueScoreDisplay(text);
}
}
public void AddOrangeScoreDisplay(TMP_Text text)
{
if (EchoVRGamemode.Instance != null)
{
EchoVRGamemode.Instance.AddOrangeScoreDisplay(text);
}
}
public void SetOrangeSelectBox(BoxCollider selectBox)
{
if (EchoVRGamemode.Instance != null)
{
EchoVRGamemode.Instance.SetOrangeSelectBox(selectBox);
}
}
public void SetBlueSelectBox(BoxCollider selectBox)
{
if (EchoVRGamemode.Instance != null)
{
EchoVRGamemode.Instance.SetBlueSelectBox(selectBox);
}
}
public void SetDiscBarcode(string barcode)
{
EchoVRGamemode.DISC_BARCODE = barcode;
}
}
}
namespace EchoVRGamemode.Behaviors
{
[RegisterTypeInIl2Cpp]
public class AirControl : MonoBehaviour
{
private RigManager rigMan;
public AirControl(IntPtr intPtr)
: base(intPtr)
{
}
private void Start()
{
rigMan = Player.rigManager;
}
private void FixedUpdate()
{
//IL_0063: 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_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: 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_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: 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)
if (!((Object)(object)rigMan.activeSeat != (Object)null) && !rigMan.physicsRig.physG.isGrounded)
{
Vector2 val = (rigMan.ControllerRig.isRightHanded ? Player.leftHand.Controller.GetThumbStickAxis() : Player.rightHand.Controller.GetThumbStickAxis());
Vector3 val2 = rigMan.ControllerRig.directionMasterTransform.rotation * new Vector3(val.x, 0f, val.y) * 12f;
rigMan.physicsRig.torso.rbChest.AddForce(val2, (ForceMode)5);
}
}
}
[RegisterTypeInIl2Cpp]
public class PunchFreezer : MonoBehaviour
{
private int punchCount = 0;
private int targetPunchCount = 3;
private float desiredFreezeTime = 4f;
private float desiredCooldownTime = 2f;
private float freezeTime = 0f;
private float cooldownTime = 2f;
public static PunchFreezer Instance;
private RigManager _rigManager;
private Rigidbody pelvisBody;
private bool _isFrozen = false;
public PunchFreezer(IntPtr intPtr)
: base(intPtr)
{
}
public void Start()
{
Instance = this;
_rigManager = Player.rigManager;
pelvisBody = ((Component)((Rig)Player.physicsRig).m_pelvis).gameObject.GetComponent<Rigidbody>();
}
public void Punch()
{
if (!(cooldownTime > 0.1f))
{
punchCount++;
MelonLogger.Msg("The punch count: " + punchCount);
if (punchCount >= targetPunchCount)
{
punchCount = 0;
Freeze();
}
}
}
public bool IsFrozen()
{
return _isFrozen;
}
public void Freeze()
{
MelonLogger.Msg("Called Freeze");
_isFrozen = true;
freezeTime = desiredFreezeTime;
UnGripAllHand(Player.leftHand);
UnGripAllHand(Player.rightHand);
}
private void UnGripAllHand(Hand hand)
{
hand.DetachJoint(false, (Grip)null);
hand.DetachObject();
}
public void Update()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
if (_isFrozen)
{
pelvisBody.velocity = Vector3.zero;
freezeTime -= Time.deltaTime;
if (freezeTime <= 0f)
{
_isFrozen = false;
cooldownTime = desiredCooldownTime;
}
}
if (cooldownTime > 0f)
{
cooldownTime -= Time.deltaTime;
if (cooldownTime <= 0f)
{
cooldownTime = 0f;
}
}
}
}
}