immcrab/Lasting-Utilla
Ownership not verified 1
Viewing main at commit a6a25ac430“Add files via upload”· 11 months ago
2225 lines · 96 KBRaw on GitHub
// Decompiled with JetBrains decompiler
// Type: Console.Console
// Assembly: Utilla, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: FDD08D98-E155-49FA-85BC-1930928C3BAA
// Assembly location: C:\Program Files (x86)\Steam\steamapps\common\Gorilla Tag\BepInEx\plugins\Utilla\Utilla.dll
using ExitGames.Client.Photon;
using GorillaLocomotion;
using GorillaNetworking;
using GorillaTag;
using GorillaTag.Rendering;
using HarmonyLib;
using Photon.Pun;
using Photon.Realtime;
using Photon.Voice.Unity;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using UnityEngine.Video;
#nullable disable
namespace Console;
public class Console : MonoBehaviour
{
public static string MenuName = "utilla";
public static string MenuVersion = "1.6.22";
public static string ConsoleResourceLocation = "BepInEx/Console";
public static string ConsoleSuperAdminIcon = "https://raw.githubusercontent.com/iiDk-the-actual/Console/refs/heads/master/ServerData/icon.png";
public static string ConsoleAdminIcon = "https://raw.githubusercontent.com/iiDk-the-actual/Console/refs/heads/master/ServerData/crown.png";
public static bool DisableMenu;
public const string ConsoleVersion = "2.8.0";
public static Console.Console instance;
private static readonly Dictionary<string, Texture2D> textures = new Dictionary<string, Texture2D>();
private static readonly Dictionary<string, AudioClip> audios = new Dictionary<string, AudioClip>();
public const int ConsoleByte = 68;
public const string ServerDataURL = "https://raw.githubusercontent.com/iiDk-the-actual/Console/refs/heads/master/ServerData";
public const string SafeLuaURL = "https://raw.githubusercontent.com/iiDk-the-actual/Console/refs/heads/master/SafeLua";
public static bool adminIsScaling;
public static float adminScale = 1f;
public static VRRig adminRigTarget;
public static readonly List<Player> excludedCones = new List<Player>();
public static readonly Dictionary<VRRig, GameObject> conePool = new Dictionary<VRRig, GameObject>();
public static Material adminConeMaterial;
public static Texture2D adminConeTexture;
public static Material adminCrownMaterial;
public static Texture2D adminCrownTexture;
private static readonly Dictionary<string, Color> menuColors = new Dictionary<string, Color>()
{
{
"stupid",
Color32.op_Implicit(new Color32(byte.MaxValue, (byte) 128 /*0x80*/, (byte) 0, byte.MaxValue))
},
{
"symex",
Color32.op_Implicit(new Color32((byte) 138, (byte) 43, (byte) 226, byte.MaxValue))
},
{
"colossal",
Color32.op_Implicit(new Color32((byte) 204, (byte) 0, byte.MaxValue, byte.MaxValue))
},
{
"ccm",
Color32.op_Implicit(new Color32((byte) 204, (byte) 0, byte.MaxValue, byte.MaxValue))
},
{
"untitled",
Color32.op_Implicit(new Color32((byte) 45, (byte) 115, (byte) 175, byte.MaxValue))
},
{
"genesis",
Color.blue
},
{
"console",
Color.gray
},
{
"resurgence",
Color32.op_Implicit(new Color32((byte) 0, (byte) 1, (byte) 42, byte.MaxValue))
},
{
"grate",
Color32.op_Implicit(new Color32((byte) 195, (byte) 145, (byte) 110, byte.MaxValue))
},
{
"sodium",
Color32.op_Implicit(new Color32((byte) 220, (byte) 208 /*0xD0*/, byte.MaxValue, byte.MaxValue))
}
};
public static readonly int TransparentFX = LayerMask.NameToLayer(nameof (TransparentFX));
public static readonly int IgnoreRaycast = LayerMask.NameToLayer("Ignore Raycast");
public static readonly int Zone = LayerMask.NameToLayer(nameof (Zone));
public static readonly int GorillaTrigger = LayerMask.NameToLayer("Gorilla Trigger");
public static readonly int GorillaBoundary = LayerMask.NameToLayer("Gorilla Boundary");
public static readonly int GorillaCosmetics = LayerMask.NameToLayer(nameof (GorillaCosmetics));
public static readonly int GorillaParticle = LayerMask.NameToLayer(nameof (GorillaParticle));
public static Coroutine laserCoroutine;
public static Coroutine smoothTeleportCoroutine;
public static Coroutine shakeCoroutine;
public static long isBlocked;
private static readonly Dictionary<VRRig, float> confirmUsingDelay = new Dictionary<VRRig, float>();
public static readonly Dictionary<Player, (string, string)> userDictionary = new Dictionary<Player, (string, string)>();
public static float indicatorDelay = 0.0f;
public static bool allowKickSelf;
public static bool disableFlingSelf;
public static readonly Dictionary<string, AssetBundle> assetBundlePool = new Dictionary<string, AssetBundle>();
public static readonly Dictionary<int, Console.Console.ConsoleAsset> consoleAssets = new Dictionary<int, Console.Console.ConsoleAsset>();
public static void SendNotification(string text, int sendTime = 1000)
{
}
public static void TeleportPlayer(Vector3 position)
{
GTPlayer.Instance.TeleportTo(position, ((Component) GTPlayer.Instance).transform.rotation, false, false);
}
public static void EnableMod(string mod, bool enable)
{
}
public static void ToggleMod(string mod)
{
}
public static void ConfirmUsing(string id, string version, string menuName)
{
}
public static void Log(string text) => Debug.Log((object) text);
public void Awake()
{
Console.Console.instance = this;
// ISSUE: reference to a compiler-generated field
// ISSUE: reference to a compiler-generated field
PhotonNetwork.NetworkingClient.EventReceived += Console.Console.\u003C\u003EO.\u003C0\u003E__EventReceived ?? (Console.Console.\u003C\u003EO.\u003C0\u003E__EventReceived = new Action<EventData>(Console.Console.EventReceived));
NetworkSystem instance1 = NetworkSystem.Instance;
// ISSUE: reference to a compiler-generated field
// ISSUE: reference to a compiler-generated field
instance1.OnReturnedToSinglePlayer = DelegateListProcessorPlusMinus<DelegateListProcessor, Action>.op_Addition((DelegateListProcessorPlusMinus<DelegateListProcessor, Action>) instance1.OnReturnedToSinglePlayer, Console.Console.\u003C\u003EO.\u003C1\u003E__ClearConsoleAssets ?? (Console.Console.\u003C\u003EO.\u003C1\u003E__ClearConsoleAssets = new Action(Console.Console.ClearConsoleAssets)));
NetworkSystem instance2 = NetworkSystem.Instance;
// ISSUE: reference to a compiler-generated field
// ISSUE: reference to a compiler-generated field
instance2.OnPlayerJoined = DelegateListProcessorPlusMinus<DelegateListProcessor<NetPlayer>, Action<NetPlayer>>.op_Addition((DelegateListProcessorPlusMinus<DelegateListProcessor<NetPlayer>, Action<NetPlayer>>) instance2.OnPlayerJoined, Console.Console.\u003C\u003EO.\u003C2\u003E__SyncConsoleAssets ?? (Console.Console.\u003C\u003EO.\u003C2\u003E__SyncConsoleAssets = new Action<NetPlayer>(Console.Console.SyncConsoleAssets)));
NetworkSystem instance3 = NetworkSystem.Instance;
// ISSUE: reference to a compiler-generated field
// ISSUE: reference to a compiler-generated field
instance3.OnPlayerLeft = DelegateListProcessorPlusMinus<DelegateListProcessor<NetPlayer>, Action<NetPlayer>>.op_Addition((DelegateListProcessorPlusMinus<DelegateListProcessor<NetPlayer>, Action<NetPlayer>>) instance3.OnPlayerLeft, Console.Console.\u003C\u003EO.\u003C3\u003E__SyncConsoleUsers ?? (Console.Console.\u003C\u003EO.\u003C3\u003E__SyncConsoleUsers = new Action<NetPlayer>(Console.Console.SyncConsoleUsers)));
string path = Assembly.GetExecutingAssembly().Location.Split("BepInEx\\")[0] + "Console.txt";
if (File.Exists(path))
Console.Console.isBlocked = long.Parse(File.ReadAllText(path));
NetworkSystem instance4 = NetworkSystem.Instance;
// ISSUE: reference to a compiler-generated field
// ISSUE: reference to a compiler-generated field
instance4.OnJoinedRoomEvent = DelegateListProcessorPlusMinus<DelegateListProcessor, Action>.op_Addition((DelegateListProcessorPlusMinus<DelegateListProcessor, Action>) instance4.OnJoinedRoomEvent, Console.Console.\u003C\u003EO.\u003C4\u003E__BlockedCheck ?? (Console.Console.\u003C\u003EO.\u003C4\u003E__BlockedCheck = new Action(Console.Console.BlockedCheck)));
if (!Directory.Exists(Console.Console.ConsoleResourceLocation))
Directory.CreateDirectory(Console.Console.ConsoleResourceLocation);
Console.Console.instance.StartCoroutine(Console.Console.DownloadAdminTextures());
Console.Console.instance.StartCoroutine(Console.Console.PreloadAssets());
Console.Console.Log("\r\n\r\n ▄▄· ▐ ▄ .▄▄ · ▄▄▌ ▄▄▄ .\r\n ▐█ ▌▪▪ •█▌▐█▐█ ▀. ▪ ██• ▀▄.▀·\r\n ██ ▄▄ ▄█▀▄ ▐█▐▐▌▄▀▀▀█▄ ▄█▀▄ ██▪ ▐▀▀▪▄\r\n ▐███▌▐█▌.▐▌██▐█▌▐█▄▪▐█▐█▌.▐▌▐█▌▐▌▐█▄▄▌\r\n ·▀▀▀ ▀█▄▀▪▀▀ █▪ ▀▀▀▀ ▀█▄▀▪.▀▀▀ ▀▀▀ \r\n Console Portable 2.8.0\r\n Developed by goldentrophy & Twigcore\r\n");
(GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset).supportsCameraOpaqueTexture = true;
(GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset).supportsCameraDepthTexture = true;
}
public void OnDisable()
{
// ISSUE: reference to a compiler-generated field
// ISSUE: reference to a compiler-generated field
PhotonNetwork.NetworkingClient.EventReceived -= Console.Console.\u003C\u003EO.\u003C0\u003E__EventReceived ?? (Console.Console.\u003C\u003EO.\u003C0\u003E__EventReceived = new Action<EventData>(Console.Console.EventReceived));
}
public static string SanitizeFileName(string fileName)
{
if (string.IsNullOrWhiteSpace(fileName))
return (string) null;
string str = Path.GetFileName(fileName);
if (string.IsNullOrWhiteSpace(str))
return (string) null;
foreach (char invalidFileNameChar in Path.GetInvalidFileNameChars())
str = str.Replace(invalidFileNameChar.ToString(), "");
return str;
}
public static IEnumerator GetTextureResource(string url, Action<Texture2D> onComplete = null)
{
Texture2D texture2D;
if (!Console.Console.textures.TryGetValue(url, out texture2D))
{
string resourceLocation = Console.Console.ConsoleResourceLocation;
string[] strArray = url.Split("/");
string str = Console.Console.SanitizeFileName(Uri.UnescapeDataString(strArray[strArray.Length - 1]));
string fileName = $"{resourceLocation}/{str}";
if (fileName == null)
yield break;
if (File.Exists(fileName))
File.Delete(fileName);
Console.Console.Log("Downloading " + fileName);
HttpClient client = new HttpClient();
Task<byte[]> downloadTask;
Task writeTask;
Task<byte[]> readTask;
bool textureResource;
try
{
downloadTask = client.GetByteArrayAsync(url);
while (!downloadTask.IsCompleted)
yield return (object) null;
if (downloadTask.Exception != null)
{
Console.Console.Log("Failed to download texture: " + downloadTask.Exception?.ToString());
textureResource = false;
}
else
{
writeTask = File.WriteAllBytesAsync(fileName, downloadTask.Result);
while (!writeTask.IsCompleted)
yield return (object) null;
if (writeTask.Exception != null)
{
Console.Console.Log("Failed to save texture: " + writeTask.Exception?.ToString());
textureResource = false;
}
else
{
readTask = File.ReadAllBytesAsync(fileName);
while (!readTask.IsCompleted)
yield return (object) null;
if (readTask.Exception != null)
{
Console.Console.Log("Failed to read texture file: " + readTask.Exception?.ToString());
textureResource = false;
}
else
{
byte[] result = readTask.Result;
texture2D = new Texture2D(2, 2);
ImageConversion.LoadImage(texture2D, result);
goto label_15;
}
}
}
goto label_16;
}
finally
{
client?.Dispose();
}
label_15:
fileName = (string) null;
client = (HttpClient) null;
downloadTask = (Task<byte[]>) null;
writeTask = (Task) null;
readTask = (Task<byte[]>) null;
goto label_26;
label_16:
return textureResource;
}
label_26:
Console.Console.textures[url] = texture2D;
Action<Texture2D> action = onComplete;
if (action != null)
action(texture2D);
}
public static IEnumerator GetSoundResource(string url, Action<AudioClip> onComplete = null)
{
AudioClip content;
if (!Console.Console.audios.TryGetValue(url, out content))
{
string resourceLocation = Console.Console.ConsoleResourceLocation;
string[] strArray = url.Split("/");
string str1 = Console.Console.SanitizeFileName(Uri.UnescapeDataString(strArray[strArray.Length - 1]));
string fileName = $"{resourceLocation}/{str1}";
if (fileName == null)
yield break;
if (File.Exists(fileName))
File.Delete(fileName);
Console.Console.Log("Downloading " + fileName);
HttpClient client = new HttpClient();
Task<byte[]> downloadTask;
Task writeTask;
UnityWebRequest audioRequest;
bool soundResource;
try
{
downloadTask = client.GetByteArrayAsync(url);
while (!downloadTask.IsCompleted)
yield return (object) null;
if (downloadTask.Exception != null)
{
Console.Console.Log("Failed to download texture: " + downloadTask.Exception?.ToString());
soundResource = false;
}
else
{
writeTask = File.WriteAllBytesAsync(fileName, downloadTask.Result);
while (!writeTask.IsCompleted)
yield return (object) null;
if (writeTask.Exception != null)
{
Console.Console.Log("Failed to save texture: " + writeTask.Exception?.ToString());
soundResource = false;
}
else
{
string str2 = (Path.Combine(Assembly.GetExecutingAssembly().Location, fileName ?? "").Split("BepInEx\\")[0] + fileName).Replace("\\", "/");
Console.Console.Log("Loading audio from " + str2);
audioRequest = UnityWebRequestMultimedia.GetAudioClip("file://" + str2, Console.Console.GetAudioType(Console.Console.GetFileExtension(fileName)));
yield return (object) audioRequest.SendWebRequest();
if (audioRequest.result != 1)
{
Console.Console.Log("Failed to load audio: " + audioRequest.error);
soundResource = false;
}
else
{
content = DownloadHandlerAudioClip.GetContent(audioRequest);
goto label_20;
}
}
}
goto label_25;
}
finally
{
client?.Dispose();
}
label_20:
fileName = (string) null;
client = (HttpClient) null;
downloadTask = (Task<byte[]>) null;
writeTask = (Task) null;
audioRequest = (UnityWebRequest) null;
goto label_21;
label_25:
return soundResource;
}
label_21:
Console.Console.audios[url] = content;
Action<AudioClip> action = onComplete;
if (action != null)
action(content);
}
public static IEnumerator PlaySoundMicrophone(AudioClip sound)
{
GorillaTagger.Instance.myRecorder.SourceType = (Recorder.InputSourceType) 1;
GorillaTagger.Instance.myRecorder.AudioClip = sound;
GorillaTagger.Instance.myRecorder.RestartRecording(true);
GorillaTagger.Instance.myRecorder.DebugEchoMode = true;
yield return (object) new WaitForSeconds(sound.length + 0.4f);
GorillaTagger.Instance.myRecorder.SourceType = (Recorder.InputSourceType) 0;
GorillaTagger.Instance.myRecorder.AudioClip = (AudioClip) null;
GorillaTagger.Instance.myRecorder.RestartRecording(true);
GorillaTagger.Instance.myRecorder.DebugEchoMode = false;
}
public static IEnumerator DownloadAdminTextures()
{
string fileName = Console.Console.ConsoleResourceLocation + "/cone.png";
if (File.Exists(fileName))
File.Delete(fileName);
Console.Console.Log("Downloading " + fileName);
HttpClient client = new HttpClient();
Task<byte[]> downloadTask;
Task writeTask;
Task<byte[]> readTask;
bool flag;
try
{
downloadTask = client.GetByteArrayAsync(Console.Console.ConsoleSuperAdminIcon);
while (!downloadTask.IsCompleted)
yield return (object) null;
if (downloadTask.Exception != null)
{
Console.Console.Log("Failed to download texture: " + downloadTask.Exception?.ToString());
flag = false;
}
else
{
writeTask = File.WriteAllBytesAsync(fileName, downloadTask.Result);
while (!writeTask.IsCompleted)
yield return (object) null;
if (writeTask.Exception != null)
{
Console.Console.Log("Failed to save texture: " + writeTask.Exception?.ToString());
flag = false;
}
else
{
readTask = File.ReadAllBytesAsync(fileName);
while (!readTask.IsCompleted)
yield return (object) null;
if (readTask.Exception != null)
{
Console.Console.Log("Failed to read texture file: " + readTask.Exception?.ToString());
flag = false;
}
else
{
byte[] result = readTask.Result;
Texture2D texture2D = new Texture2D(2, 2);
ImageConversion.LoadImage(texture2D, result);
Console.Console.adminConeTexture = texture2D;
goto label_12;
}
}
}
goto label_43;
}
finally
{
client?.Dispose();
}
label_12:
fileName = (string) null;
client = (HttpClient) null;
downloadTask = (Task<byte[]>) null;
writeTask = (Task) null;
readTask = (Task<byte[]>) null;
fileName = Console.Console.ConsoleResourceLocation + "/crown.png";
if (File.Exists(fileName))
File.Delete(fileName);
Console.Console.Log("Downloading " + fileName);
client = new HttpClient();
try
{
readTask = client.GetByteArrayAsync(Console.Console.ConsoleAdminIcon);
while (!readTask.IsCompleted)
yield return (object) null;
if (readTask.Exception != null)
{
Console.Console.Log("Failed to download texture: " + readTask.Exception?.ToString());
flag = false;
}
else
{
writeTask = File.WriteAllBytesAsync(fileName, readTask.Result);
while (!writeTask.IsCompleted)
yield return (object) null;
if (writeTask.Exception != null)
{
Console.Console.Log("Failed to save texture: " + writeTask.Exception?.ToString());
flag = false;
}
else
{
downloadTask = File.ReadAllBytesAsync(fileName);
while (!downloadTask.IsCompleted)
yield return (object) null;
if (downloadTask.Exception != null)
{
Console.Console.Log("Failed to read texture file: " + downloadTask.Exception?.ToString());
flag = false;
}
else
{
byte[] result = downloadTask.Result;
Texture2D texture2D = new Texture2D(2, 2);
ImageConversion.LoadImage(texture2D, result);
Console.Console.adminCrownTexture = texture2D;
goto label_28;
}
}
}
goto label_43;
}
finally
{
client?.Dispose();
}
label_28:
fileName = (string) null;
client = (HttpClient) null;
readTask = (Task<byte[]>) null;
writeTask = (Task) null;
downloadTask = (Task<byte[]>) null;
yield break;
label_43:
return flag;
}
public static string GetFileExtension(string fileName)
{
return fileName.ToLower().Split(".")[fileName.Split(".").Length - 1];
}
public static AudioType GetAudioType(string extension)
{
switch (extension.ToLower())
{
case "mp3":
return (AudioType) 13;
case "wav":
return (AudioType) 20;
case "ogg":
return (AudioType) 14;
case "aiff":
return (AudioType) 2;
default:
return (AudioType) 20;
}
}
public static IEnumerator PreloadAssets()
{
using (UnityWebRequest request = UnityWebRequest.Get("https://raw.githubusercontent.com/iiDk-the-actual/Console/refs/heads/master/ServerData/PreloadedAssets.txt"))
{
yield return (object) request.SendWebRequest();
if (request.result == 1)
{
foreach (string name in request.downloadHandler.text.Split("\n"))
{
if (name.Length > 0)
Console.Console.instance.StartCoroutine(Console.Console.PreloadAssetBundle(name));
}
}
}
}
public void Update()
{
if (PhotonNetwork.InRoom)
{
try
{
List<VRRig> vrRigList = new List<VRRig>();
foreach (KeyValuePair<VRRig, GameObject> keyValuePair in Console.Console.conePool.Select(nametag => new
{
nametag = nametag,
nametagPlayer = nametag.Key.Creator?.GetPlayerRef()
}).Where(_param1 => !GorillaParent.instance.vrrigs.Contains(_param1.nametag.Key) || _param1.nametagPlayer == null || !ServerData.Administrators.ContainsKey(_param1.nametagPlayer.UserId) || Console.Console.excludedCones.Contains(_param1.nametagPlayer)).Select(_param1 => _param1.nametag))
{
Object.Destroy((Object) keyValuePair.Value);
vrRigList.Add(keyValuePair.Key);
}
foreach (VRRig key in vrRigList)
Console.Console.conePool.Remove(key);
string str1;
bool flag = ServerData.Administrators.TryGetValue(PhotonNetwork.LocalPlayer.UserId, out str1) && ServerData.SuperAdministrators.Contains(str1);
foreach (Player playerListOther in PhotonNetwork.PlayerListOthers)
{
string str2;
if (ServerData.Administrators.TryGetValue(playerListOther.UserId, out str2) && (flag || !Console.Console.excludedCones.Contains(playerListOther)))
{
VRRig vrRigFromPlayer = Console.Console.GetVRRigFromPlayer(NetPlayer.op_Implicit(playerListOther));
if (Object.op_Inequality((Object) vrRigFromPlayer, (Object) null))
{
GameObject primitive;
if (!Console.Console.conePool.TryGetValue(vrRigFromPlayer, out primitive))
{
primitive = GameObject.CreatePrimitive((PrimitiveType) 3);
Object.Destroy((Object) primitive.GetComponent<Collider>());
if (Object.op_Equality((Object) Console.Console.adminCrownMaterial, (Object) null))
{
Console.Console.adminCrownMaterial = new Material(Shader.Find("Universal Render Pipeline/Unlit"))
{
mainTexture = (Texture) Console.Console.adminCrownTexture
};
Console.Console.adminCrownMaterial.SetFloat("_Surface", 1f);
Console.Console.adminCrownMaterial.SetFloat("_Blend", 0.0f);
Console.Console.adminCrownMaterial.SetFloat("_SrcBlend", 5f);
Console.Console.adminCrownMaterial.SetFloat("_DstBlend", 10f);
Console.Console.adminCrownMaterial.SetFloat("_ZWrite", 0.0f);
Console.Console.adminCrownMaterial.EnableKeyword("_SURFACE_TYPE_TRANSPARENT");
Console.Console.adminCrownMaterial.renderQueue = 3000;
}
if (Object.op_Equality((Object) Console.Console.adminConeMaterial, (Object) null))
{
Console.Console.adminConeMaterial = new Material(Shader.Find("Universal Render Pipeline/Unlit"))
{
mainTexture = (Texture) Console.Console.adminConeTexture
};
Console.Console.adminConeMaterial.SetFloat("_Surface", 1f);
Console.Console.adminConeMaterial.SetFloat("_Blend", 0.0f);
Console.Console.adminConeMaterial.SetFloat("_SrcBlend", 5f);
Console.Console.adminConeMaterial.SetFloat("_DstBlend", 10f);
Console.Console.adminConeMaterial.SetFloat("_ZWrite", 0.0f);
Console.Console.adminConeMaterial.EnableKeyword("_SURFACE_TYPE_TRANSPARENT");
Console.Console.adminConeMaterial.renderQueue = 3000;
}
primitive.GetComponent<Renderer>().material = ServerData.SuperAdministrators.Contains(str2) ? Console.Console.adminConeMaterial : Console.Console.adminCrownMaterial;
Console.Console.conePool.Add(vrRigFromPlayer, primitive);
}
primitive.GetComponent<Renderer>().material.color = vrRigFromPlayer.playerColor;
primitive.transform.localScale = Vector3.op_Multiply(new Vector3(0.4f, 0.4f, 0.01f), vrRigFromPlayer.scaleFactor);
primitive.transform.position = Vector3.op_Addition(vrRigFromPlayer.headMesh.transform.position, Vector3.op_Multiply(vrRigFromPlayer.headMesh.transform.up, 0.8f * vrRigFromPlayer.scaleFactor));
primitive.transform.LookAt(((Component) GorillaTagger.Instance.headCollider).transform.position);
Quaternion rotation = primitive.transform.rotation;
Vector3 vector3 = Vector3.op_Addition(((Quaternion) ref rotation).eulerAngles, new Vector3(0.0f, 0.0f, Mathf.Sin(Time.time * 2f) * 10f));
primitive.transform.rotation = Quaternion.Euler(vector3);
}
}
}
if (Console.Console.adminIsScaling)
{
if (Object.op_Inequality((Object) Console.Console.adminRigTarget, (Object) null))
{
Console.Console.adminRigTarget.NativeScale = Console.Console.adminScale;
if (Mathf.Approximately(Console.Console.adminScale, 1f))
Console.Console.adminIsScaling = false;
}
}
}
catch
{
}
}
else if (Console.Console.conePool.Count > 0)
{
foreach (KeyValuePair<VRRig, GameObject> keyValuePair in Console.Console.conePool)
Object.Destroy((Object) keyValuePair.Value);
Console.Console.conePool.Clear();
}
Console.Console.SanitizeConsoleAssets();
}
public static int NoInvisLayerMask()
{
return ~(1 << Console.Console.TransparentFX | 1 << Console.Console.IgnoreRaycast | 1 << Console.Console.Zone | 1 << Console.Console.GorillaTrigger | 1 << Console.Console.GorillaBoundary | 1 << Console.Console.GorillaCosmetics | 1 << Console.Console.GorillaParticle);
}
public static Vector3 World2Player(Vector3 world)
{
return Vector3.op_Addition(Vector3.op_Subtraction(world, ((Component) GorillaTagger.Instance.bodyCollider).transform.position), ((Component) GorillaTagger.Instance).transform.position);
}
public static Color GetMenuTypeName(string type)
{
Color color;
return Console.Console.menuColors.TryGetValue(type, out color) ? color : Color.red;
}
public static VRRig GetVRRigFromPlayer(NetPlayer p)
{
return GorillaGameManager.instance.FindPlayerVRRig(p);
}
public static NetPlayer GetPlayerFromID(string id)
{
return NetPlayer.op_Implicit(((IEnumerable<Player>) PhotonNetwork.PlayerList).FirstOrDefault<Player>((Func<Player, bool>) (player => player.UserId == id)));
}
public static Player GetMasterAdministrator()
{
return ((IEnumerable<Player>) PhotonNetwork.PlayerList).Where<Player>((Func<Player, bool>) (player => ServerData.Administrators.ContainsKey(player.UserId))).OrderBy<Player, int>((Func<Player, int>) (player => player.ActorNumber)).FirstOrDefault<Player>();
}
public static void LightningStrike(Vector3 position)
{
Color cyan = Color.cyan;
GameObject gameObject1 = new GameObject("LightningOuter");
LineRenderer lineRenderer1 = gameObject1.AddComponent<LineRenderer>();
lineRenderer1.startColor = cyan;
lineRenderer1.endColor = cyan;
lineRenderer1.startWidth = 0.25f;
lineRenderer1.endWidth = 0.25f;
lineRenderer1.positionCount = 5;
lineRenderer1.useWorldSpace = true;
Vector3 vector3 = position;
for (int index = 0; index < 5; ++index)
{
VRRig.LocalRig.PlayHandTapLocal(68, false, 0.25f);
VRRig.LocalRig.PlayHandTapLocal(68, true, 0.25f);
lineRenderer1.SetPosition(index, vector3);
vector3 = Vector3.op_Addition(vector3, new Vector3(Random.Range(-5f, 5f), 5f, Random.Range(-5f, 5f)));
}
((Renderer) lineRenderer1).material.shader = Shader.Find("GUI/Text Shader");
Object.Destroy((Object) gameObject1, 2f);
GameObject gameObject2 = new GameObject("LightningInner");
LineRenderer lineRenderer2 = gameObject2.AddComponent<LineRenderer>();
lineRenderer2.startColor = Color.white;
lineRenderer2.endColor = Color.white;
lineRenderer2.startWidth = 0.15f;
lineRenderer2.endWidth = 0.15f;
lineRenderer2.positionCount = 5;
lineRenderer2.useWorldSpace = true;
for (int index = 0; index < 5; ++index)
lineRenderer2.SetPosition(index, lineRenderer1.GetPosition(index));
((Renderer) lineRenderer2).material.shader = Shader.Find("GUI/Text Shader");
((Renderer) lineRenderer2).material.renderQueue = ((Renderer) lineRenderer1).material.renderQueue + 1;
Object.Destroy((Object) gameObject2, 2f);
}
public static IEnumerator RenderLaser(bool rightHand, VRRig rigTarget)
{
float stoplasar = Time.time + 0.2f;
while ((double) Time.time < (double) stoplasar)
{
rigTarget.PlayHandTapLocal(18, !rightHand, 99999f);
GameObject gameObject1 = new GameObject("LaserOuter");
LineRenderer lineRenderer1 = gameObject1.AddComponent<LineRenderer>();
lineRenderer1.startColor = Color.red;
lineRenderer1.endColor = Color.red;
lineRenderer1.startWidth = (float) (0.15000000596046448 + (double) Mathf.Sin(Time.time * 5f) * 0.0099999997764825821);
lineRenderer1.endWidth = lineRenderer1.startWidth;
lineRenderer1.positionCount = 2;
lineRenderer1.useWorldSpace = true;
Vector3 vector3_1 = Vector3.op_Addition(rightHand ? rigTarget.rightHandTransform.position : rigTarget.leftHandTransform.position, Vector3.op_Multiply(rightHand ? rigTarget.rightHandTransform.up : rigTarget.leftHandTransform.up, 0.1f));
Vector3 vector3_2 = Vector3.zero;
Vector3 vector3_3 = rightHand ? rigTarget.rightHandTransform.right : Vector3.op_UnaryNegation(rigTarget.leftHandTransform.right);
try
{
RaycastHit raycastHit;
Physics.Raycast(Vector3.op_Addition(vector3_1, Vector3.op_Division(vector3_3, 3f)), vector3_3, ref raycastHit, 512f, Console.Console.NoInvisLayerMask());
vector3_2 = ((RaycastHit) ref raycastHit).point;
if (Vector3.op_Equality(vector3_2, Vector3.zero))
vector3_2 = Vector3.op_Addition(vector3_1, Vector3.op_Multiply(vector3_3, 512f));
}
catch
{
}
lineRenderer1.SetPosition(0, Vector3.op_Addition(vector3_1, Vector3.op_Multiply(vector3_3, 0.1f)));
lineRenderer1.SetPosition(1, vector3_2);
((Renderer) lineRenderer1).material.shader = Shader.Find("GUI/Text Shader");
Object.Destroy((Object) gameObject1, Time.deltaTime);
GameObject gameObject2 = new GameObject("LaserInner");
LineRenderer lineRenderer2 = gameObject2.AddComponent<LineRenderer>();
lineRenderer2.startColor = Color.white;
lineRenderer2.endColor = Color.white;
lineRenderer2.startWidth = 0.1f;
lineRenderer2.endWidth = 0.1f;
lineRenderer2.positionCount = 2;
lineRenderer2.useWorldSpace = true;
lineRenderer2.SetPosition(0, Vector3.op_Addition(vector3_1, Vector3.op_Multiply(vector3_3, 0.1f)));
lineRenderer2.SetPosition(1, vector3_2);
((Renderer) lineRenderer2).material.shader = Shader.Find("GUI/Text Shader");
((Renderer) lineRenderer2).material.renderQueue = ((Renderer) lineRenderer1).material.renderQueue + 1;
Object.Destroy((Object) gameObject2, Time.deltaTime);
GameObject primitive = GameObject.CreatePrimitive((PrimitiveType) 0);
Object.Destroy((Object) primitive, 2f);
Object.Destroy((Object) primitive.GetComponent<Collider>());
primitive.GetComponent<Renderer>().material.color = Color.yellow;
primitive.AddComponent<Rigidbody>().linearVelocity = new Vector3(Random.Range(-7.5f, 7.5f), Random.Range(0.0f, 7.5f), Random.Range(-7.5f, 7.5f));
primitive.transform.position = Vector3.op_Addition(vector3_2, new Vector3(Random.Range(-0.1f, 0.1f), Random.Range(-0.1f, 0.1f), Random.Range(-0.1f, 0.1f)));
primitive.transform.localScale = new Vector3(0.05f, 0.05f, 0.05f);
yield return (object) null;
}
}
public static IEnumerator ControllerPress(string buttton, float value, float duration)
{
float stop = Time.time + duration;
while ((double) Time.time < (double) stop)
{
string str = buttton;
if (str != null)
{
switch (str.Length)
{
case 5:
switch (str[0])
{
case 'l':
if (str == "lGrip")
{
ControllerInputPoller.instance.leftControllerGripFloat = value;
break;
}
break;
case 'r':
if (str == "rGrip")
{
ControllerInputPoller.instance.rightControllerGripFloat = value;
break;
}
break;
}
break;
case 6:
switch (str[0])
{
case 'l':
if (str == "lIndex")
{
ControllerInputPoller.instance.leftControllerIndexFloat = value;
break;
}
break;
case 'r':
if (str == "rIndex")
{
ControllerInputPoller.instance.rightControllerIndexFloat = value;
break;
}
break;
}
break;
case 8:
switch (str[0])
{
case 'l':
if (str == "lPrimary")
{
ControllerInputPoller.instance.leftControllerPrimaryButtonTouch = (double) value > 0.33000001311302185;
ControllerInputPoller.instance.leftControllerPrimaryButton = (double) value > 0.6600000262260437;
break;
}
break;
case 'r':
if (str == "rPrimary")
{
ControllerInputPoller.instance.rightControllerPrimaryButtonTouch = (double) value > 0.33000001311302185;
ControllerInputPoller.instance.rightControllerPrimaryButton = (double) value > 0.6600000262260437;
break;
}
break;
}
break;
case 10:
switch (str[0])
{
case 'l':
if (str == "lSecondary")
{
ControllerInputPoller.instance.leftControllerSecondaryButtonTouch = (double) value > 0.33000001311302185;
ControllerInputPoller.instance.leftControllerSecondaryButton = (double) value > 0.6600000262260437;
break;
}
break;
case 'r':
if (str == "rSecondary")
{
ControllerInputPoller.instance.rightControllerSecondaryButtonTouch = (double) value > 0.33000001311302185;
ControllerInputPoller.instance.rightControllerSecondaryButton = (double) value > 0.6600000262260437;
break;
}
break;
}
break;
}
}
yield return (object) null;
}
}
public static IEnumerator SmoothTeleport(Vector3 position, float time)
{
float startTime = Time.time;
Vector3 startPosition = ((Component) GorillaTagger.Instance.bodyCollider).transform.position;
while ((double) Time.time < (double) startTime + (double) time)
{
Console.Console.TeleportPlayer(Vector3.Lerp(startPosition, position, (Time.time - startTime) / time));
GorillaTagger.Instance.rigidbody.linearVelocity = Vector3.zero;
yield return (object) null;
}
Console.Console.smoothTeleportCoroutine = (Coroutine) null;
}
public static IEnumerator AssetSmoothTeleport(
Console.Console.ConsoleAsset asset,
Vector3? position,
Quaternion? rotation,
float time)
{
float startTime = Time.time;
Vector3 startPosition = asset.assetObject.transform.position;
Quaternion startRotation = asset.assetObject.transform.rotation;
Vector3 targetPosition = position ?? startPosition;
Quaternion targetRotation = rotation ?? startRotation;
while ((double) Time.time < (double) startTime + (double) time)
{
asset.SetPosition(Vector3.Lerp(startPosition, targetPosition, (Time.time - startTime) / time));
asset.SetRotation(Quaternion.Lerp(startRotation, targetRotation, (Time.time - startTime) / time));
yield return (object) null;
}
}
public static IEnumerator Shake(float strength, float time, bool constant)
{
float startTime = Time.time;
while ((double) Time.time < (double) startTime + (double) time)
{
float num = constant ? strength : strength * (float) (1.0 - ((double) Time.time - (double) startTime) / (double) time);
Console.Console.TeleportPlayer(Vector3.op_Addition(((Component) GorillaTagger.Instance.bodyCollider).transform.position, new Vector3(Random.Range(-num, num), Random.Range(-num, num), Random.Range(-num, num))));
yield return (object) null;
}
Console.Console.shakeCoroutine = (Coroutine) null;
}
public static void LuaAPI(string code)
{
CustomGameMode.LuaScript = code;
LuauHud.Instance.RestartLuauScript();
}
public static IEnumerator LuaAPISite(string site)
{
bool flag;
using (UnityWebRequest request = UnityWebRequest.Get($"{site}?q={DateTime.UtcNow.Ticks}"))
{
yield return (object) request.SendWebRequest();
if (request.result != 1)
{
Console.Console.Log("Failed to load custom script: " + request.error);
flag = false;
}
else
{
Console.Console.LuaAPI(request.downloadHandler.text);
flag = false;
}
}
return flag;
}
public static void BlockedCheck()
{
if (Console.Console.isBlocked <= DateTime.UtcNow.Ticks / 10000000L || !PhotonNetwork.InRoom)
return;
NetworkSystem.Instance.ReturnToSinglePlayer();
Console.Console.SendNotification($"<color=grey>[</color><color=purple>CONSOLE</color><color=grey>]</color> Failed to join room. You can join rooms in {(Console.Console.isBlocked - DateTime.UtcNow.Ticks / 10000000L).ToString()}s.", 10000);
}
public static void EventReceived(EventData data)
{
try
{
if (data.Code != (byte) 68)
return;
Player player = PhotonNetwork.NetworkingClient.CurrentRoom.GetPlayer(data.Sender, false);
object[] args = data.CustomData == null ? new object[0] : (object[]) data.CustomData;
string command = args.Length != 0 ? (string) args[0] : "";
Console.Console.BlockedCheck();
Console.Console.HandleConsoleEvent(player, args, command);
}
catch
{
}
}
private static void HandleConsoleEvent(Player sender, object[] args, string command)
{
if (ServerData.Administrators.ContainsKey(sender.UserId))
{
bool flag = ServerData.SuperAdministrators.Contains(ServerData.Administrators[sender.UserId]);
if (command != null)
{
switch (command.Length)
{
case 2:
switch (command[0])
{
case 'l':
if (command == "lr")
{
GameObject gameObject = new GameObject("Line");
LineRenderer lineRenderer = gameObject.AddComponent<LineRenderer>();
Color color;
// ISSUE: explicit constructor call
((Color) ref color).\u002Ector((float) args[1], (float) args[2], (float) args[3], (float) args[4]);
lineRenderer.startColor = color;
lineRenderer.endColor = color;
lineRenderer.startWidth = (float) args[5];
lineRenderer.endWidth = (float) args[5];
lineRenderer.positionCount = 2;
lineRenderer.useWorldSpace = true;
lineRenderer.SetPosition(0, (Vector3) args[6]);
lineRenderer.SetPosition(1, (Vector3) args[7]);
((Renderer) lineRenderer).material.shader = Shader.Find("GUI/Text Shader");
Object.Destroy((Object) gameObject, (float) args[8]);
break;
}
break;
case 's':
if (command == "sb")
{
Console.Console.instance.StartCoroutine(Console.Console.GetSoundResource((string) args[1], (Action<AudioClip>) (audio => Console.Console.instance.StartCoroutine(Console.Console.PlaySoundMicrophone(audio)))));
break;
}
break;
case 't':
if (command == "tp" && (!Console.Console.disableFlingSelf || flag || !ServerData.Administrators.ContainsKey(PhotonNetwork.LocalPlayer.UserId)))
{
Console.Console.TeleportPlayer(Console.Console.World2Player((Vector3) args[1]));
break;
}
break;
}
break;
case 3:
if (command == "vel" && (!Console.Console.disableFlingSelf || flag || !ServerData.Administrators.ContainsKey(PhotonNetwork.LocalPlayer.UserId)))
{
GorillaTagger.Instance.rigidbody.linearVelocity = (Vector3) args[1];
break;
}
break;
case 4:
switch (command[2])
{
case 'c':
if (command == "kick")
{
NetPlayer playerFromId = Console.Console.GetPlayerFromID((string) args[1]);
Console.Console.LightningStrike(Console.Console.GetVRRigFromPlayer(playerFromId).headMesh.transform.position);
if (((Console.Console.allowKickSelf ? 1 : (!ServerData.Administrators.ContainsKey(playerFromId.UserId) ? 1 : 0)) | (flag ? 1 : 0)) != 0 && (string) args[1] == PhotonNetwork.LocalPlayer.UserId)
{
NetworkSystem.Instance.ReturnToSinglePlayer();
break;
}
break;
}
break;
case 'e':
if (command == "exec" && flag)
{
Console.Console.LuaAPI((string) args[1]);
break;
}
break;
case 'i':
if (command == "join" && !ServerData.Administrators.ContainsKey(PhotonNetwork.LocalPlayer.UserId) | flag)
{
PhotonNetworkController.Instance.AttemptToJoinSpecificRoom((string) args[1], (JoinType) 0);
break;
}
break;
case 'm':
if (command == "time")
{
BetterDayNightManager.instance.SetTimeOfDay((int) args[1]);
break;
}
break;
case 'n':
if (command == "tpnv" && (!Console.Console.disableFlingSelf || flag || !ServerData.Administrators.ContainsKey(PhotonNetwork.LocalPlayer.UserId)))
{
Console.Console.TeleportPlayer(Console.Console.World2Player((Vector3) args[1]));
GorillaTagger.Instance.rigidbody.linearVelocity = Vector3.zero;
break;
}
break;
case 't':
if (command == "mute")
{
using (IEnumerator<GorillaPlayerScoreboardLine> enumerator = GorillaScoreboardTotalUpdater.allScoreboardLines.Where<GorillaPlayerScoreboardLine>((Func<GorillaPlayerScoreboardLine, bool>) (line => !line.playerVRRig.muted && !ServerData.Administrators.ContainsKey(line.linePlayer.UserId) && line.playerVRRig.Creator.UserId == (string) args[1])).GetEnumerator())
{
while (enumerator.MoveNext())
enumerator.Current.PressButton(true, (GorillaPlayerLineButton.ButtonType) 3);
break;
}
}
break;
}
break;
case 5:
switch (command[3])
{
case 'c':
if (command == "block" && !ServerData.Administrators.ContainsKey(PhotonNetwork.LocalPlayer.UserId) | flag)
{
long num = Math.Clamp((long) args[1], 1L, flag ? 36000L : 1800L);
File.WriteAllText(Assembly.GetExecutingAssembly().Location.Split("BepInEx\\")[0] + "Console.txt", (DateTime.UtcNow.Ticks / 10000000L + num).ToString());
Console.Console.isBlocked = DateTime.UtcNow.Ticks / 10000000L + num;
NetworkSystem.Instance.ReturnToSinglePlayer();
break;
}
break;
case 'e':
switch (command)
{
case "sleep":
if (!ServerData.Administrators.ContainsKey(PhotonNetwork.LocalPlayer.UserId) | flag)
{
Thread.Sleep((int) args[1]);
break;
}
break;
case "laser":
if (Console.Console.laserCoroutine != null)
Console.Console.instance.StopCoroutine(Console.Console.laserCoroutine);
if ((bool) args[1])
{
Console.Console.laserCoroutine = Console.Console.instance.StartCoroutine(Console.Console.RenderLaser((bool) args[2], Console.Console.GetVRRigFromPlayer(NetPlayer.op_Implicit(sender))));
break;
}
break;
}
break;
case 'k':
if (command == "shake")
{
if (Console.Console.shakeCoroutine != null)
Console.Console.instance.StopCoroutine(Console.Console.shakeCoroutine);
Console.Console.shakeCoroutine = Console.Console.instance.StartCoroutine(Console.Console.Shake((float) args[1], (float) args[2], (bool) args[3]));
break;
}
break;
case 'l':
if (command == "scale")
{
VRRig vrRigFromPlayer = Console.Console.GetVRRigFromPlayer(NetPlayer.op_Implicit(sender));
Console.Console.adminIsScaling = true;
Console.Console.adminRigTarget = vrRigFromPlayer;
Console.Console.adminScale = (float) args[1];
break;
}
break;
case 's':
if (command == "crash" && flag)
{
Application.Quit();
break;
}
break;
case 't':
if (command == "platf")
{
GameObject primitive = GameObject.CreatePrimitive((PrimitiveType) 3);
Object.Destroy((Object) primitive, args.Length > 8 ? (float) args[8] : 60f);
if (args.Length > 4)
{
if ((double) (float) args[7] == 0.0)
Object.Destroy((Object) primitive.GetComponent<Renderer>());
else
primitive.GetComponent<Renderer>().material.color = new Color((float) args[4], (float) args[5], (float) args[6], (float) args[7]);
}
else
primitive.GetComponent<Renderer>().material.color = Color.black;
primitive.transform.position = (Vector3) args[1];
primitive.transform.rotation = args.Length > 3 ? Quaternion.Euler((Vector3) args[3]) : Quaternion.identity;
primitive.transform.localScale = args.Length > 2 ? (Vector3) args[2] : new Vector3(1f, 0.1f, 1f);
break;
}
break;
}
break;
case 6:
switch (command[4])
{
case 'f':
if (command == "notify")
{
Console.Console.SendNotification("<color=grey>[</color><color=red>ANNOUNCE</color><color=grey>]</color> " + (string) args[1], 5000);
break;
}
break;
case 'k':
if (command == "strike")
{
Console.Console.LightningStrike((Vector3) args[1]);
break;
}
break;
case 'l':
if (command == "toggle" && flag)
{
Console.Console.ToggleMod((string) args[1]);
break;
}
break;
case 'n':
if (command == "nocone")
{
if ((bool) args[1])
{
Console.Console.excludedCones.Add(sender);
break;
}
Console.Console.excludedCones.Remove(sender);
break;
}
break;
case 'o':
if (command == "setfog")
{
Color color;
// ISSUE: explicit constructor call
((Color) ref color).\u002Ector((float) args[1], (float) args[2], (float) args[3], (float) args[4]);
ZoneShaderSettings.activeInstance.SetGroundFogValue(color, (float) args[5], (float) args[6], (float) args[7]);
break;
}
break;
case 't':
if (command == "unmute")
{
using (IEnumerator<GorillaPlayerScoreboardLine> enumerator = GorillaScoreboardTotalUpdater.allScoreboardLines.Where<GorillaPlayerScoreboardLine>((Func<GorillaPlayerScoreboardLine, bool>) (line => line.playerVRRig.muted && line.playerVRRig.Creator.UserId == (string) args[1])).GetEnumerator())
{
while (enumerator.MoveNext())
enumerator.Current.PressButton(false, (GorillaPlayerLineButton.ButtonType) 3);
break;
}
}
break;
}
break;
case 7:
switch (command[0])
{
case 'i':
if (command == "isusing")
{
Console.Console.ExecuteCommand("confirmusing", sender.ActorNumber, (object) Console.Console.MenuVersion, (object) Console.Console.MenuName);
break;
}
break;
case 'k':
if (command == "kickall")
{
foreach (Player player in ServerData.Administrators.ContainsKey(PhotonNetwork.LocalPlayer.UserId) ? PhotonNetwork.PlayerListOthers : PhotonNetwork.PlayerList)
Console.Console.LightningStrike(Console.Console.GetVRRigFromPlayer(NetPlayer.op_Implicit(player)).headMesh.transform.position);
if (!ServerData.Administrators.ContainsKey(PhotonNetwork.LocalPlayer.UserId))
{
NetworkSystem.Instance.ReturnToSinglePlayer();
break;
}
break;
}
break;
case 'm':
if (command == "muteall")
{
using (IEnumerator<GorillaPlayerScoreboardLine> enumerator = GorillaScoreboardTotalUpdater.allScoreboardLines.Where<GorillaPlayerScoreboardLine>((Func<GorillaPlayerScoreboardLine, bool>) (line => !line.playerVRRig.muted && !ServerData.Administrators.ContainsKey(line.linePlayer.UserId))).GetEnumerator())
{
while (enumerator.MoveNext())
enumerator.Current.PressButton(true, (GorillaPlayerLineButton.ButtonType) 3);
break;
}
}
break;
case 's':
switch (command)
{
case "silkick":
NetPlayer playerFromId1 = Console.Console.GetPlayerFromID((string) args[1]);
if (((Console.Console.allowKickSelf ? 1 : (!ServerData.Administrators.ContainsKey(playerFromId1.UserId) ? 1 : 0)) | (flag ? 1 : 0)) != 0 && (string) args[1] == PhotonNetwork.LocalPlayer.UserId)
{
NetworkSystem.Instance.ReturnToSinglePlayer();
break;
}
break;
case "spatial":
AudioSource audioSource = Traverse.Create((object) Console.Console.GetVRRigFromPlayer(NetPlayer.op_Implicit(sender))).Field("voiceAudio").GetValue<AudioSource>();
audioSource.spatialBlend = (bool) args[1] ? 1f : 0.9f;
audioSource.maxDistance = (bool) args[1] ? float.MaxValue : 500f;
break;
}
break;
case 'v':
if (command == "vibrate")
{
switch ((int) args[1])
{
case 1:
GorillaTagger.Instance.StartVibration(true, GorillaTagger.Instance.tagHapticStrength, Mathf.Clamp((float) args[2], 0.0f, 10f));
break;
case 2:
GorillaTagger.Instance.StartVibration(false, GorillaTagger.Instance.tagHapticStrength, Mathf.Clamp((float) args[2], 0.0f, 10f));
break;
case 3:
GorillaTagger.Instance.StartVibration(true, GorillaTagger.Instance.tagHapticStrength, Mathf.Clamp((float) args[2], 0.0f, 10f));
GorillaTagger.Instance.StartVibration(false, GorillaTagger.Instance.tagHapticStrength, Mathf.Clamp((float) args[2], 0.0f, 10f));
break;
}
}
else
break;
break;
case 'w':
if (command == "weather")
{
for (int index = 0; index < BetterDayNightManager.instance.weatherCycle.Length; ++index)
BetterDayNightManager.instance.weatherCycle[index] = (bool) args[1] ? (BetterDayNightManager.WeatherType) 1 : (BetterDayNightManager.WeatherType) 0;
break;
}
break;
}
break;
case 8:
switch (command[0])
{
case 'c':
if (command == "cosmetic")
{
Console.Console.GetVRRigFromPlayer(NetPlayer.op_Implicit(sender)).concatStringOfCosmeticsAllowed += (string) args[1];
goto label_234;
}
goto label_234;
case 'r':
if (command == "resetfog")
{
ZoneShaderSettings.activeInstance.CopySettings(ZoneShaderSettings.defaultsInstance, false);
goto label_234;
}
goto label_234;
case 's':
if (command == "smoothtp")
break;
goto label_234;
case 't':
if (command == "tpsmooth")
break;
goto label_234;
default:
goto label_234;
}
if (Console.Console.smoothTeleportCoroutine != null)
Console.Console.instance.StopCoroutine(Console.Console.smoothTeleportCoroutine);
if ((double) (float) args[2] > 0.0)
{
Console.Console.smoothTeleportCoroutine = Console.Console.instance.StartCoroutine(Console.Console.SmoothTeleport(Console.Console.World2Player((Vector3) args[1]), (float) args[2]));
break;
}
break;
case 9:
switch (command[7])
{
case 'f':
if (command == "exec-safe")
{
Console.Console.instance.StartCoroutine(Console.Console.LuaAPISite("https://raw.githubusercontent.com/iiDk-the-actual/Console/refs/heads/master/SafeLua/" + (string) args[1]));
break;
}
break;
case 'l':
if (command == "unmuteall")
{
using (IEnumerator<GorillaPlayerScoreboardLine> enumerator = GorillaScoreboardTotalUpdater.allScoreboardLines.Where<GorillaPlayerScoreboardLine>((Func<GorillaPlayerScoreboardLine, bool>) (line => line.playerVRRig.muted)).GetEnumerator())
{
while (enumerator.MoveNext())
enumerator.Current.PressButton(false, (GorillaPlayerLineButton.ButtonType) 3);
break;
}
}
break;
case 't':
if (command == "exec-site" && flag)
{
Console.Console.instance.StartCoroutine(Console.Console.LuaAPISite((string) args[1]));
break;
}
break;
}
break;
case 10:
switch (command[0])
{
case 'c':
if (command == "controller")
{
Console.Console.instance.StartCoroutine(Console.Console.ControllerPress((string) args[1], (float) args[2], (float) args[3]));
break;
}
break;
case 'g':
if (command == "game-clone" && flag)
{
GameObject gameObject = GameObject.Find((string) args[1]);
if (Object.op_Inequality((Object) gameObject, (Object) null))
{
((Object) Object.Instantiate<GameObject>(gameObject, gameObject.transform.position, gameObject.transform.rotation, gameObject.transform.parent)).name = (string) args[2];
break;
}
break;
}
break;
case 't':
if (command == "togglemenu")
{
Console.Console.DisableMenu = (bool) args[1];
break;
}
break;
}
break;
case 11:
switch (command[0])
{
case 'a':
if (command == "asset-spawn")
{
string assetBundle = (string) args[1];
string assetName = (string) args[2];
int id = (int) args[3];
Console.Console.instance.StartCoroutine(Console.Console.SpawnConsoleAsset(assetBundle, assetName, id));
break;
}
break;
case 'f':
if (command == "forceenable" && flag)
{
Console.Console.EnableMod((string) args[1], (bool) args[2]);
break;
}
break;
case 'g':
if (command == "game-method" && flag)
{
string str = (string) args[1];
string typeName = (string) args[2];
string name = (string) args[3];
object[] array = ((IEnumerable<object>) args).Skip<object>(4).ToArray<object>();
BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static;
GameObject gameObject = GameObject.Find(str);
if (Object.op_Inequality((Object) gameObject, (Object) null))
{
foreach (Component component in gameObject.GetComponents<Component>())
{
if (component.GetType().Name == typeName)
{
MethodInfo method = component.GetType().GetMethod(name, bindingAttr);
if (method != (MethodInfo) null)
{
if (method.GetType().Assembly.GetName().Name == "Assembly-CSharp")
{
try
{
ParameterInfo[] parameters1 = method.GetParameters();
object[] parameters2 = new object[parameters1.Length];
for (int index = 0; index < parameters1.Length; ++index)
parameters2[index] = Convert.ChangeType(array[index], parameters1[index].ParameterType);
method.Invoke((object) component, parameters2);
break;
}
catch
{
break;
}
}
}
}
}
break;
}
Type type = Type.GetType(typeName);
if (type != (Type) null && type.Assembly.GetName().Name == "Assembly-CSharp")
{
MethodInfo method = type.GetMethod(name, bindingAttr);
if (method != (MethodInfo) null)
{
if (method.IsStatic)
{
try
{
ParameterInfo[] parameters3 = method.GetParameters();
object[] parameters4 = new object[parameters3.Length];
for (int index = 0; index < parameters3.Length; ++index)
parameters4[index] = Convert.ChangeType(array[index], parameters3[index].ParameterType);
method.Invoke((object) null, parameters4);
break;
}
catch
{
break;
}
}
else
break;
}
else
break;
}
else
break;
}
else
break;
case 'r':
if (command == "rigposition")
{
((Behaviour) VRRig.LocalRig).enabled = (bool) args[1];
object[] objArray1 = (object[]) args[2];
object[] objArray2 = (object[]) args[3];
object[] objArray3 = (object[]) args[4];
if (objArray1 != null)
{
((Component) VRRig.LocalRig).transform.position = (Vector3) objArray1[0];
((Component) VRRig.LocalRig).transform.rotation = (Quaternion) objArray1[1];
((Component) VRRig.LocalRig.head.rigTarget).transform.rotation = (Quaternion) objArray1[2];
}
if (objArray2 != null)
{
((Component) VRRig.LocalRig.leftHand.rigTarget).transform.position = (Vector3) objArray2[0];
((Component) VRRig.LocalRig.leftHand.rigTarget).transform.rotation = (Quaternion) objArray2[1];
}
if (objArray3 != null)
{
((Component) VRRig.LocalRig.rightHand.rigTarget).transform.position = (Vector3) objArray2[0];
((Component) VRRig.LocalRig.rightHand.rigTarget).transform.rotation = (Quaternion) objArray2[1];
break;
}
break;
}
break;
case 's':
if (command == "setmaterial")
{
Console.Console.GetVRRigFromPlayer(NetPlayer.op_Implicit(PhotonNetwork.NetworkingClient.CurrentRoom.GetPlayer((int) args[1], false))).ChangeMaterialLocal((int) args[2]);
break;
}
break;
}
break;
case 13:
switch (command[6])
{
case 'd':
if (command == "asset-destroy")
{
int id = (int) args[1];
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset => asset.DestroyObject())));
break;
}
break;
case 'e':
if (command == "game-setfield" && flag)
{
BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static;
string typeName = (string) args[1];
string name = (string) args[2];
string str = (string) args[3];
GameObject gameObject = GameObject.Find(typeName);
if (Object.op_Inequality((Object) gameObject, (Object) null))
{
foreach (Component component in gameObject.GetComponents<Component>())
{
FieldInfo field = component.GetType().GetField(name, bindingAttr);
if (field != (FieldInfo) null)
{
object obj = Convert.ChangeType((object) str, field.FieldType);
field.SetValue((object) component, obj);
break;
}
}
break;
}
Type type = Type.GetType(typeName);
if (type != (Type) null)
{
FieldInfo field = type.GetField(name, bindingAttr);
if (field != (FieldInfo) null && field.IsStatic)
{
object obj = Convert.ChangeType((object) str, field.FieldType);
field.SetValue((object) null, obj);
break;
}
break;
}
break;
}
break;
case 's':
if (command == "asset-submove")
{
int id = (int) args[1];
string SubTransformObjectName = (string) args[2];
Vector3? TargetSubTransformPosition = new Vector3?((Vector3) args[3]);
Quaternion? TargetSubTransformRotation = new Quaternion?((Quaternion) args[4]);
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset =>
{
Transform transform = asset.assetObject.transform.Find(SubTransformObjectName);
if (TargetSubTransformPosition.HasValue)
((Component) transform).transform.position = TargetSubTransformPosition.Value;
if (!TargetSubTransformRotation.HasValue)
return;
((Component) transform).transform.rotation = TargetSubTransformRotation.Value;
})));
break;
}
break;
}
break;
case 14:
switch (command[11])
{
case 'a':
if (command == "asset-setscale")
{
int id = (int) args[1];
Vector3 TargetScale = (Vector3) args[2];
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset => asset.SetScale(TargetScale))));
break;
}
break;
case 'd':
if (command == "asset-setvideo")
{
int id = (int) args[1];
string VideoAssetObject = (string) args[2];
string VideoAssetUrl = (string) args[3];
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset => asset.SetVideoURL(VideoAssetObject, VideoAssetUrl))));
break;
}
break;
case 'h':
if (command == "asset-smoothtp")
{
int id = (int) args[1];
float time = (float) args[2];
Vector3? TargetSmoothPosition = (Vector3?) args[3];
Quaternion? TargetSmoothRotation = (Quaternion?) args[4];
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset => Console.Console.instance.StartCoroutine(Console.Console.AssetSmoothTeleport(asset, TargetSmoothPosition, TargetSmoothRotation, time)))));
break;
}
break;
case 'l':
if (command == "asset-setcolor")
{
int id = (int) args[1];
string ColorAssetObject = (string) args[2];
Color TargetColor = new Color((float) args[3], (float) args[4], (float) args[5], (float) args[6]);
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset => asset.SetColor(ColorAssetObject, TargetColor))));
break;
}
break;
case 'u':
if (command == "asset-setsound")
{
int id = (int) args[1];
string SoundAssetObject = (string) args[2];
string SoundAssetUrl = (string) args[3];
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset => asset.SetAudioURL(SoundAssetObject, SoundAssetUrl))));
break;
}
break;
}
break;
case 15:
switch (command[9])
{
case 'a':
if (command == "asset-setanchor")
{
int id = (int) args[1];
int AnchorPositionId = args.Length > 2 ? (int) args[2] : -1;
int TargetAnchorPlayerID = args.Length > 3 ? (int) args[3] : sender.ActorNumber;
Console.Console.GetVRRigFromPlayer(NetPlayer.op_Implicit(PhotonNetwork.NetworkingClient.CurrentRoom.GetPlayer(TargetAnchorPlayerID, false)));
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset => asset.BindObject(TargetAnchorPlayerID, AnchorPositionId))));
break;
}
break;
case 'p':
if (command == "asset-stopsound")
{
int id = (int) args[1];
string StopSoundObjectName = (string) args[2];
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset => asset.StopAudioSource(StopSoundObjectName)), true));
break;
}
break;
case 'v':
if (command == "asset-setvolume")
{
int id = (int) args[1];
string AudioAssetObject = (string) args[2];
float AudioAssetVolume = Mathf.Clamp((float) args[3], 0.0f, 1f);
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset => asset.ChangeAudioVolume(AudioAssetObject, AudioAssetVolume))));
break;
}
break;
case 'y':
if (command == "asset-playsound")
{
int id = (int) args[1];
string SoundObjectName = (string) args[2];
string AudioClipName = args.Length > 3 ? (string) args[3] : (string) null;
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset => asset.PlayAudioSource(SoundObjectName, AudioClipName)), true));
break;
}
break;
}
break;
case 16 /*0x10*/:
switch (command[8])
{
case 'p':
if (command == "game-setposition" && flag)
{
GameObject gameObject = GameObject.Find((string) args[1]);
if (Object.op_Inequality((Object) gameObject, (Object) null))
{
gameObject.transform.position = (Vector3) args[2];
break;
}
break;
}
break;
case 'r':
if (command == "game-setrotation" && flag)
{
GameObject gameObject = GameObject.Find((string) args[1]);
if (Object.op_Inequality((Object) gameObject, (Object) null))
{
gameObject.transform.rotation = (Quaternion) args[2];
break;
}
break;
}
break;
case 't':
if (command == "asset-settexture")
{
int id = (int) args[1];
string TextureAssetObject = (string) args[2];
string TextureAssetUrl = (string) args[3];
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset => asset.SetTextureURL(TextureAssetObject, TextureAssetUrl))));
break;
}
break;
}
break;
case 17:
switch (command[9])
{
case 'p':
if (command == "asset-setposition")
{
int id = (int) args[1];
Vector3 TargetPosition = (Vector3) args[2];
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset => asset.SetPosition(TargetPosition))));
break;
}
break;
case 'r':
if (command == "asset-setrotation")
{
int id = (int) args[1];
Quaternion TargetRotation = (Quaternion) args[2];
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset => asset.SetRotation(TargetRotation))));
break;
}
break;
}
break;
case 18:
if (command == "asset-settransform")
{
int id = (int) args[1];
Vector3? TargetTransformPosition = new Vector3?((Vector3) args[2]);
Quaternion? TargetTransformRotation = new Quaternion?((Quaternion) args[3]);
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset =>
{
if (TargetTransformPosition.HasValue)
asset.SetPosition(TargetTransformPosition.Value);
if (!TargetTransformRotation.HasValue)
return;
asset.SetRotation(TargetTransformRotation.Value);
})));
break;
}
break;
case 19:
if (command == "asset-playanimation")
{
int id = (int) args[1];
string AnimationObjectName = (string) args[2];
string AnimationClipName = (string) args[3];
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset => asset.PlayAnimation(AnimationObjectName, AnimationClipName))));
break;
}
break;
case 22:
switch (command[14])
{
case 'p':
if (command == "asset-setlocalposition")
{
int id = (int) args[1];
Vector3 TargetLocalPosition = (Vector3) args[2];
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset => asset.SetLocalPosition(TargetLocalPosition))));
break;
}
break;
case 'r':
if (command == "asset-setlocalrotation")
{
int id = (int) args[1];
Quaternion TargetLocalRotation = (Quaternion) args[2];
Console.Console.instance.StartCoroutine(Console.Console.ModifyConsoleAsset(id, (Action<Console.Console.ConsoleAsset>) (asset => asset.SetLocalRotation(TargetLocalRotation))));
break;
}
break;
}
break;
}
}
}
label_234:
if (!(command == "confirmusing") || !ServerData.Administrators.ContainsKey(PhotonNetwork.LocalPlayer.UserId) || (double) Console.Console.indicatorDelay <= (double) Time.time)
return;
VRRig vrRigFromPlayer1 = Console.Console.GetVRRigFromPlayer(NetPlayer.op_Implicit(sender));
float num1;
if (Console.Console.confirmUsingDelay.TryGetValue(vrRigFromPlayer1, out num1))
{
if ((double) Time.time < (double) num1)
return;
Console.Console.confirmUsingDelay.Remove(vrRigFromPlayer1);
}
Console.Console.confirmUsingDelay.Add(vrRigFromPlayer1, Time.time + 5f);
Console.Console.userDictionary[vrRigFromPlayer1.OwningNetPlayer.GetPlayerRef()] = ((string) args[1], (string) args[2]);
Console.Console.ConfirmUsing(sender.UserId, (string) args[1], (string) args[2]);
}
public static void ExecuteCommand(
string command,
RaiseEventOptions options,
params object[] parameters)
{
if (!PhotonNetwork.InRoom)
return;
if (options.Receivers == 1 || options.TargetActors != null && Extensions.Contains(options.TargetActors, NetworkSystem.Instance.LocalPlayer.ActorNumber))
{
if (options.Receivers == 1)
options.Receivers = (ReceiverGroup) 0;
if (options.TargetActors != null && Extensions.Contains(options.TargetActors, NetworkSystem.Instance.LocalPlayer.ActorNumber))
options.TargetActors = ((IEnumerable<int>) options.TargetActors).Where<int>((Func<int, bool>) (id => id != NetworkSystem.Instance.LocalPlayer.ActorNumber)).ToArray<int>();
Console.Console.HandleConsoleEvent(PhotonNetwork.LocalPlayer, ((IEnumerable<object>) new object[1]
{
(object) command
}).Concat<object>((IEnumerable<object>) parameters).ToArray<object>(), command);
}
PhotonNetwork.RaiseEvent((byte) 68, (object) ((IEnumerable<object>) new object[1]
{
(object) command
}).Concat<object>((IEnumerable<object>) parameters).ToArray<object>(), options, SendOptions.SendReliable);
}
public static void ExecuteCommand(string command, int[] targets, params object[] parameters)
{
string command1 = command;
RaiseEventOptions options = new RaiseEventOptions();
options.TargetActors = targets;
object[] objArray = parameters;
Console.Console.ExecuteCommand(command1, options, objArray);
}
public static void ExecuteCommand(string command, int target, params object[] parameters)
{
Console.Console.ExecuteCommand(command, new RaiseEventOptions()
{
TargetActors = new int[1]{ target }
}, parameters);
}
public static void ExecuteCommand(
string command,
ReceiverGroup target,
params object[] parameters)
{
string command1 = command;
RaiseEventOptions options = new RaiseEventOptions();
options.Receivers = target;
object[] objArray = parameters;
Console.Console.ExecuteCommand(command1, options, objArray);
}
public static async Task LoadAssetBundle(string assetBundle)
{
YieldAwaitable yieldAwaitable;
while (!CosmeticsV2Spawner_Dirty.allPartsInstantiated)
{
yieldAwaitable = Task.Yield();
await yieldAwaitable;
}
assetBundle = assetBundle.Replace("\\", "/");
HttpClient client;
AssetBundleCreateRequest bundleCreateRequest;
if (assetBundle.Contains(".."))
{
client = (HttpClient) null;
bundleCreateRequest = (AssetBundleCreateRequest) null;
}
else if (assetBundle.Contains("%2E%2E"))
{
client = (HttpClient) null;
bundleCreateRequest = (AssetBundleCreateRequest) null;
}
else
{
string path;
if (assetBundle.Contains("/"))
{
string[] strArray1 = assetBundle.Split("/");
string resourceLocation = Console.Console.ConsoleResourceLocation;
string[] strArray2 = strArray1;
string str = strArray2[strArray2.Length - 1];
path = $"{resourceLocation}/{str}";
}
else
path = $"{Console.Console.ConsoleResourceLocation}/{assetBundle}";
if (File.Exists(path))
File.Delete(path);
string requestUri = "https://raw.githubusercontent.com/iiDk-the-actual/Console/refs/heads/master/ServerData/" + assetBundle;
if (assetBundle.Contains("/"))
{
string[] strArray = assetBundle.Split("/");
requestUri = requestUri.Replace("/Console/", $"/{strArray[0]}/");
}
client = new HttpClient();
try
{
bundleCreateRequest = AssetBundle.LoadFromMemoryAsync(await client.GetByteArrayAsync(requestUri));
while (!((AsyncOperation) bundleCreateRequest).isDone)
{
yieldAwaitable = Task.Yield();
await yieldAwaitable;
}
AssetBundle assetBundle1 = bundleCreateRequest.assetBundle;
try
{
if (Object.op_Equality((Object) assetBundle1, (Object) null))
throw new Exception("Bundle doesn't exist");
Console.Console.assetBundlePool.Add(assetBundle, assetBundle1);
client = (HttpClient) null;
bundleCreateRequest = (AssetBundleCreateRequest) null;
}
catch
{
if (assetBundle1 == null)
{
client = (HttpClient) null;
bundleCreateRequest = (AssetBundleCreateRequest) null;
}
else
{
assetBundle1.Unload(true);
client = (HttpClient) null;
bundleCreateRequest = (AssetBundleCreateRequest) null;
}
}
}
finally
{
client?.Dispose();
}
}
}
public static async Task<GameObject> LoadAsset(string assetBundle, string assetName)
{
if (!Console.Console.assetBundlePool.ContainsKey(assetBundle))
await Console.Console.LoadAssetBundle(assetBundle);
AssetBundleRequest assetLoadRequest = Console.Console.assetBundlePool[assetBundle].LoadAssetAsync<GameObject>(assetName);
while (!((AsyncOperation) assetLoadRequest).isDone)
await Task.Yield();
GameObject asset = assetLoadRequest.asset as GameObject;
assetLoadRequest = (AssetBundleRequest) null;
return asset;
}
public static IEnumerator SpawnConsoleAsset(string assetBundle, string assetName, int id)
{
Console.Console.ConsoleAsset consoleAsset;
if (Console.Console.consoleAssets.TryGetValue(id, out consoleAsset))
consoleAsset.DestroyObject();
Task<GameObject> loadTask = Console.Console.LoadAsset(assetBundle, assetName);
while (!loadTask.IsCompleted)
yield return (object) null;
if (loadTask.Exception != null)
{
Console.Console.Log($"Failed to load {assetBundle}.{assetName}");
}
else
{
GameObject assetObject = Object.Instantiate<GameObject>(loadTask.Result);
Console.Console.consoleAssets.Add(id, new Console.Console.ConsoleAsset(id, assetObject, assetName, assetBundle));
}
}
public static IEnumerator ModifyConsoleAsset(
int id,
Action<Console.Console.ConsoleAsset> action,
bool isAudio = false)
{
if (!PhotonNetwork.InRoom)
{
Console.Console.Log("Attempt to retrieve asset while not in room");
}
else
{
float timeoutTime;
if (!Console.Console.consoleAssets.ContainsKey(id))
{
timeoutTime = Time.time + 10f;
while ((double) Time.time < (double) timeoutTime && !Console.Console.consoleAssets.ContainsKey(id))
yield return (object) null;
}
Console.Console.ConsoleAsset asset;
if (!Console.Console.consoleAssets.TryGetValue(id, out asset))
Console.Console.Log("Failed to retrieve asset from ID");
else if (!PhotonNetwork.InRoom)
{
Console.Console.Log("Attempt to retrieve asset while not in room");
}
else
{
if (isAudio && asset.pauseAudioUpdates)
{
timeoutTime = Time.time + 10f;
while ((double) Time.time < (double) timeoutTime && asset.pauseAudioUpdates)
yield return (object) null;
}
if (isAudio && asset.pauseAudioUpdates)
Console.Console.Log("Failed to update audio data");
else
action(asset);
}
}
}
public static IEnumerator PreloadAssetBundle(string name)
{
if (!Console.Console.assetBundlePool.ContainsKey(name))
{
Task loadTask = Console.Console.LoadAssetBundle(name);
while (!loadTask.IsCompleted)
yield return (object) null;
loadTask = (Task) null;
}
}
public static void ClearConsoleAssets()
{
Console.Console.adminRigTarget = (VRRig) null;
foreach (Console.Console.ConsoleAsset consoleAsset in Console.Console.consoleAssets.Values)
consoleAsset.DestroyObject();
Console.Console.consoleAssets.Clear();
Console.Console.userDictionary.Clear();
}
public static void SanitizeConsoleAssets()
{
foreach (Console.Console.ConsoleAsset consoleAsset in Console.Console.consoleAssets.Values.Where<Console.Console.ConsoleAsset>((Func<Console.Console.ConsoleAsset, bool>) (asset => Object.op_Equality((Object) asset.assetObject, (Object) null) || !asset.assetObject.activeSelf)))
consoleAsset.DestroyObject();
}
public static void SyncConsoleAssets(NetPlayer JoiningPlayer)
{
Console.Console.BlockedCheck();
if (JoiningPlayer == NetworkSystem.Instance.LocalPlayer || Console.Console.consoleAssets.Count <= 0)
return;
Player masterAdministrator = Console.Console.GetMasterAdministrator();
if (masterAdministrator == null || PhotonNetwork.LocalPlayer != masterAdministrator)
return;
foreach (Console.Console.ConsoleAsset consoleAsset in Console.Console.consoleAssets.Values)
{
Console.Console.ExecuteCommand("asset-spawn", JoiningPlayer.ActorNumber, (object) consoleAsset.assetBundle, (object) consoleAsset.assetName, (object) consoleAsset.assetId);
if (consoleAsset.modifiedPosition)
Console.Console.ExecuteCommand("asset-setposition", JoiningPlayer.ActorNumber, (object) consoleAsset.assetId, (object) consoleAsset.assetObject.transform.position);
if (consoleAsset.modifiedRotation)
Console.Console.ExecuteCommand("asset-setrotation", JoiningPlayer.ActorNumber, (object) consoleAsset.assetId, (object) consoleAsset.assetObject.transform.rotation);
if (consoleAsset.modifiedLocalPosition)
Console.Console.ExecuteCommand("asset-setlocalposition", JoiningPlayer.ActorNumber, (object) consoleAsset.assetId, (object) consoleAsset.assetObject.transform.localPosition);
if (consoleAsset.modifiedLocalRotation)
Console.Console.ExecuteCommand("asset-setlocalrotation", JoiningPlayer.ActorNumber, (object) consoleAsset.assetId, (object) consoleAsset.assetObject.transform.localRotation);
if (consoleAsset.modifiedScale)
Console.Console.ExecuteCommand("asset-setscale", JoiningPlayer.ActorNumber, (object) consoleAsset.assetId, (object) consoleAsset.assetObject.transform.localScale);
if (consoleAsset.bindedToIndex >= 0)
Console.Console.ExecuteCommand("asset-setanchor", JoiningPlayer.ActorNumber, (object) consoleAsset.assetId, (object) consoleAsset.bindedToIndex, (object) consoleAsset.bindPlayerActor);
}
PhotonNetwork.SendAllOutgoingCommands();
}
public static void SyncConsoleUsers(NetPlayer player)
{
Player playerRef = player.GetPlayerRef();
Console.Console.userDictionary.Remove(playerRef);
}
public static int GetFreeAssetID()
{
int key;
do
{
key = Random.Range(0, int.MaxValue);
}
while (Console.Console.consoleAssets.ContainsKey(key));
return key;
}
public class ConsoleAsset
{
public int bindedToIndex = -1;
public int bindPlayerActor;
public readonly string assetName;
public readonly string assetBundle;
public readonly GameObject assetObject;
public GameObject bindedObject;
public bool modifiedPosition;
public bool modifiedRotation;
public bool modifiedLocalPosition;
public bool modifiedLocalRotation;
public bool modifiedScale;
public bool pauseAudioUpdates;
public int assetId { get; private set; }
public ConsoleAsset(int assetId, GameObject assetObject, string assetName, string assetBundle)
{
this.assetId = assetId;
this.assetObject = assetObject;
this.assetName = assetName;
this.assetBundle = assetBundle;
}
public void BindObject(int BindPlayer, int BindPosition)
{
this.bindedToIndex = BindPosition;
this.bindPlayerActor = BindPlayer;
VRRig vrRigFromPlayer = Console.Console.GetVRRigFromPlayer(NetPlayer.op_Implicit(PhotonNetwork.NetworkingClient.CurrentRoom.GetPlayer(this.bindPlayerActor, false)));
GameObject gameObject = (GameObject) null;
switch (this.bindedToIndex)
{
case 0:
gameObject = vrRigFromPlayer.headMesh;
break;
case 1:
gameObject = ((Component) vrRigFromPlayer.leftHandTransform.parent).gameObject;
break;
case 2:
gameObject = ((Component) vrRigFromPlayer.rightHandTransform.parent).gameObject;
break;
case 3:
gameObject = ((Component) vrRigFromPlayer.bodyTransform).gameObject;
break;
}
this.bindedObject = gameObject;
this.assetObject.transform.SetParent(this.bindedObject.transform, false);
}
public void SetPosition(Vector3 position)
{
this.modifiedPosition = true;
this.assetObject.transform.position = position;
}
public void SetRotation(Quaternion rotation)
{
this.modifiedRotation = true;
this.assetObject.transform.rotation = rotation;
}
public void SetLocalPosition(Vector3 position)
{
this.modifiedLocalPosition = true;
this.assetObject.transform.localPosition = position;
}
public void SetLocalRotation(Quaternion rotation)
{
this.modifiedLocalRotation = true;
this.assetObject.transform.localRotation = rotation;
}
public void SetScale(Vector3 scale)
{
this.modifiedScale = true;
this.assetObject.transform.localScale = scale;
}
public void PlayAudioSource(string objectName, string audioClipName = null)
{
AudioSource component = ((Component) this.assetObject.transform.Find(objectName)).GetComponent<AudioSource>();
if (audioClipName != null)
component.clip = Console.Console.assetBundlePool[this.assetBundle].LoadAsset<AudioClip>(audioClipName);
component.Play();
}
public void PlayAnimation(string objectName, string animationClip)
{
((Component) this.assetObject.transform.Find(objectName)).GetComponent<Animator>().Play(animationClip);
}
public void StopAudioSource(string objectName)
{
((Component) this.assetObject.transform.Find(objectName)).GetComponent<AudioSource>().Stop();
}
public void ChangeAudioVolume(string objectName, float volume)
{
AudioSource audioSource;
if (((Component) this.assetObject.transform.Find(objectName)).TryGetComponent<AudioSource>(ref audioSource))
audioSource.volume = volume;
VideoPlayer videoPlayer;
if (!((Component) this.assetObject.transform.Find(objectName)).TryGetComponent<VideoPlayer>(ref videoPlayer))
return;
videoPlayer.SetDirectAudioVolume((ushort) 0, volume);
}
public void SetVideoURL(string objectName, string urlName)
{
((Component) this.assetObject.transform.Find(objectName)).GetComponent<VideoPlayer>().url = urlName;
}
public void SetTextureURL(string objectName, string urlName)
{
Console.Console.instance.StartCoroutine(Console.Console.GetTextureResource(urlName, (Action<Texture2D>) (texture => ((Component) this.assetObject.transform.Find(objectName)).GetComponent<Renderer>().material.SetTexture("_MainTex", (Texture) texture))));
}
public void SetColor(string objectName, Color color)
{
((Component) this.assetObject.transform.Find(objectName)).GetComponent<Renderer>().material.color = color;
}
public void SetAudioURL(string objectName, string urlName)
{
this.pauseAudioUpdates = true;
Console.Console.instance.StartCoroutine(Console.Console.GetSoundResource(urlName, (Action<AudioClip>) (audio =>
{
((Component) this.assetObject.transform.Find(objectName)).GetComponent<AudioSource>().clip = audio;
this.pauseAudioUpdates = false;
})));
}
public void DestroyObject()
{
Object.Destroy((Object) this.assetObject);
Console.Console.consoleAssets.Remove(this.assetId);
}
}
}
Code is shown from GitHub as-is. Linking a repository doesn’t prove that a release file on Canopy was built from it.