private static void DropPortal() { const bool ShowAlerts = true; // Fetch the world to know it exists and also needed for the world tags during the portal creation stage API.Fetch <ApiWorld>( worldId, // On Success which it'll be if valid vanilla invite new Action <ApiContainer>( container => { Utilities.HideCurrentPopup(); ApiWorld apiWorld = container.Model.Cast <ApiWorld>(); ApiWorldInstance apiWorldInstance = new ApiWorldInstance(apiWorld, instanceIdWithTags); Transform playerTransform = Utilities.GetLocalPlayerTransform(); // CreatePortal (before il2cpp) bool created = Utilities.CreatePortal(apiWorld, apiWorldInstance, playerTransform.position, playerTransform.forward, ShowAlerts); if (created && DeleteNotifications) { Utilities.DeleteNotification(currentNotification); } }), // On Failure new Action <ApiContainer>(container => Utilities.ShowAlert("Error Fetching World", container.Error))); }
public static void OnInstanceChange(ApiWorldInstance __1) { if (__1 != null) { currentAccessType = __1.InstanceType; } }
public IEnumerator GetInstanceCreator(ApiWorldInstance instance) { string creator = instance.ownerId; if (creator != null) { if (creator == APIUser.CurrentUser? .id) { if (LocalPlayerEntry.emmNameSpoofEnabled) { textComponent.text = OriginalText.Replace("{instancecreator}", LocalPlayerEntry.emmSpoofedName); } else { textComponent.text = OriginalText.Replace("{instancecreator}", APIUser.CurrentUser.displayName); } yield break; } textComponent.text = OriginalText.Replace("{instancecreator}", "Loading..."); yield return(new WaitForSeconds(4)); APIUser.FetchUser(creator, new Action <APIUser>(OnIdReceived), null); yield break; } else { textComponent.text = OriginalText.Replace("{instancecreator}", "No Instance Creator"); } }
public static void OnInstanceChange(ApiWorld world, ApiWorldInstance instance) { if (instance != null) { currentAccessType = instance.type; } }
public static void OpenUserWorldInWorldMenu() { UserInfoExtensionsMod.HideAllPopups(); string location; if (!Utilities.ActiveUser.IsSelf) { location = Utilities.ActiveUser.location; } else { location = APIUser.CurrentUser.location; } if (Utilities.userInfo.field_Private_ApiWorld_1 != null && !(string.IsNullOrEmpty(location) || location == "private")) { string processedLocation = Utilities.ActiveUser.location.Split(new char[] { ':' }, 2)[1]; int count; try { count = Utilities.userInfo.field_Private_ApiWorld_1.instances[processedLocation]; } catch { count = 0; } ApiWorldInstance instance = new ApiWorldInstance(Utilities.userInfo.field_Private_ApiWorld_1, processedLocation, count); Utilities.worldInfo.Method_Public_Void_ApiWorld_ApiWorldInstance_Boolean_Boolean_0(Utilities.userInfo.field_Private_ApiWorld_1, instance); VRCUiManager.prop_VRCUiManager_0.ShowScreenButton("UserInterface/MenuContent/Screens/WorldInfo"); } else { Utilities.OpenPopupV2("Notice", "Cannot grab this user's world", "Close", new Action(() => Utilities.ClosePopup())); } }
public static void OpenUserWorldInWorldMenu() { UserInfoExtensionsMod.HideAllPopups(); string location; if (!VRCUtils.ActiveUser.IsSelf) { location = VRCUtils.ActiveUser.location; } else { location = APIUser.CurrentUser.location; } if (VRCUtils.userInfo.field_Private_ApiWorld_1 != null && !(string.IsNullOrEmpty(location) || location == "private" || location == "offline")) { string processedLocation = VRCUtils.ActiveUser.location.Split(new char[] { ':' }, 2)[1]; int count; try { count = VRCUtils.userInfo.field_Private_ApiWorld_1.instances[processedLocation]; } catch { count = 0; } ApiWorldInstance instance = new ApiWorldInstance(VRCUtils.userInfo.field_Private_ApiWorld_1, processedLocation, count); setUpWorldInfo.Invoke(VRCUtils.worldInfo, new object[] { VRCUtils.userInfo.field_Private_ApiWorld_1, instance, null, null }); VRCUiManager.prop_VRCUiManager_0.ShowScreenButton("UserInterface/MenuContent/Screens/WorldInfo"); } else { VRCUtils.OpenPopupV2("Notice", "Cannot grab this user's world", "Close", new Action(VRCUtils.ClosePopup)); } }
public static void OnInstanceChanged(ApiWorld world, ApiWorldInstance instance) { foreach (EntryBase entry in entries) { entry.OnInstanceChange(world, instance); } RefreshLeftPlayerEntries(0, 0, true); }
public Metadata(int imageRotation, APIUser apiUser, ApiWorldInstance apiWorldInstance, Vector3 position, List <Tuple <Player, Vector3> > playerList) { ImageRotation = imageRotation; ApiUser = apiUser; WorldInstance = apiWorldInstance; Position = position; PlayerList = playerList; }
private static void OnInstanceChange(ApiWorld __0, ApiWorldInstance __1) { if (__0 == null || __1 == null) { return; } OnInstanceChanged?.DelegateSafeInvoke(__0, __1); }
public override void OnInstanceChange(ApiWorld world, ApiWorldInstance instance) { if (APIUser.CurrentUser != null && world.authorId == APIUser.CurrentUser.id && LocalPlayerEntry.emmNameSpoofEnabled) { textComponent.text = OriginalText.Replace("{worldauthor}", LocalPlayerEntry.emmSpoofedName); } else { textComponent.text = OriginalText.Replace("{worldauthor}", world.authorName); } }
public static void OnEnterWorld(ApiWorld __0, ApiWorldInstance __1) { try { OnEnterWorldEvent.Invoke(__0, __1); } catch (Exception ex) { MelonLogger.Error("Something went wrong, this was most likely caused by your InstanceHistory.json file failing to parse correctly.\nHere is the error for debug purposes:\n" + ex.ToString()); } }
private void WorldTracking_Tick() { if (RoomManagerBaseWrappers.InRoom && Time.time - m_lastCheck > 2f) { ApiWorldInstance currentRoom = RoomManagerBase.currentWorldInstance; WorldInfo currentInfo = new WorldInfo() { Id = currentRoom.instanceWorld.id, Tags = currentRoom.idWithTags }; if (!PreviousWorlds.Any(w => w.Id == currentInfo.Id && w.Tags == currentInfo.Tags)) { Log.Debug($"Adding worldId {currentInfo.Id} with tags {currentInfo.Tags} to history"); PreviousWorlds.Add(currentInfo); } m_lastCheck = Time.time; } }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { if (reader.TokenType == JsonToken.Null) { throw new ArgumentNullException(nameof(existingValue)); } // Ok so dont judge me f****t, i havent done C# in ages if (reader.TokenType != JsonToken.StartArray) { throw new ArgumentException("Not a parsable ApiWorldInstance!"); } if (!reader.Read() || reader.TokenType != JsonToken.String) { throw new ArgumentException("Not a parsable ApiWorldInstance!"); } ApiWorldInstance instance = new ApiWorldInstance(); instance.id = (string)serializer.Deserialize(reader, typeof(string)); if (!reader.Read() || reader.TokenType != JsonToken.Integer) { throw new ArgumentException("Not a parsable ApiWorldInstance!"); } instance.occupants = (int)serializer.Deserialize(reader, typeof(int)); if (!reader.Read() || reader.TokenType != JsonToken.EndArray) { throw new ArgumentException("Not a parsable ApiWorldInstance!"); } return(instance); }
public override void OnInstanceChange(ApiWorld world, ApiWorldInstance instance) { MelonCoroutines.Start(GetInstanceCreator(instance)); }
void OnUpdate() { // VRCModLogger.Log("SingleInstance > OnUpdate"); var clipboard = GetClipboardContent(); if (clipboard == lastClipboard) { return; } /*try { * string result = (string)lastMarcoInvite.Invoke(null, null); * if (clipboard == result) return; * } catch (Exception) { }*/ Log($"Clipboard changed to: \"{clipboard}\""); lastClipboard = clipboard; clipboard = clipboard.Trim().ToLower(); if (!clipboard.Contains("wrld_")) { return; } var match = Regex.Match(clipboard, world_pattern_private); if (!match.Success) { match = Regex.Match(clipboard, world_pattern); if (!match.Success) { return; } } string world_id = match.Groups[1].Value; string instance_id = match.Groups[2].Value; bool is_private = match.Groups.Count > 3; string creator = ""; string nonce = ""; string instance_id_only = ""; bool force = clipboard.Contains("force=true"); if (is_private) { instance_id_only = match.Groups[3].Value; creator = match.Groups[4].Value; nonce = match.Groups[5].Value; } Log($"Catched World: {match.Groups[0].Value}"); Log($"Catched World ID: {world_id}"); Log($"Catched Instance: {instance_id}"); Log($"Catched Instance ID: {instance_id_only}"); Log($"Catched Instance Creator: {creator}"); Log($"Catched Instance Nonce: {nonce}"); string full_id = $"{world_id}:{instance_id}"; ApiWorldInstance instance = null; ApiWorld apiWorld = new ApiWorld(); var message = ""; /*try { * apiWorld.FetchInstance(world_id, (worldinstance) => * { * Log("Instance: " + worldinstance); * instance = worldinstance; * }); * message = $"{instance.instanceWorld.name}\n Instance: {instance.idOnly} | Private: {(instance.isPublic ? "No" : "Yes")}"; * } catch(Exception ex) { * Log($"Exception: {ex.Message}\n{ex.StackTrace}\n{ex}"); * message = $"{world_id}\n Instance: {(is_private ? instance_id_only : instance_id)} | Private: {(is_private ? "Yes" : "No")}"; // .Replace("wrld_", "") * }*/ if (force) { EnterWorld(full_id); return; } message = $"{world_id}\n Instance: {(is_private ? instance_id_only : instance_id)} | Private: {(is_private ? "Yes" : "No")}"; // .Replace("wrld_", "") VRCUiPopupManagerUtils.GetVRCUiPopupManager().ShowStandardPopup("URL Found", message, "Yes", () => { VRCUiPopupManagerUtils.GetVRCUiPopupManager().HideCurrentPopup(); EnterWorld(full_id); }, "Cancel", () => { VRCUiPopupManagerUtils.GetVRCUiPopupManager().HideCurrentPopup(); } ); }
public WorldInstanceCache(ApiWorldInstance instance) { InstanceId = instance.instanceId; OwnerId = instance.ownerId; AccessType = instance.type; }
public static void Add(ApiWorld world, ApiWorldInstance instance) { instances.Insert(0, new WorldInstance(world.name, world.id, instance.instanceId)); File.WriteAllText(instanceDatabasePath, JsonConvert.SerializeObject(instances, Formatting.Indented)); }
public PortalInfo(ApiWorld apiWorld, ApiWorldInstance apiWorldInstance, Il2CppSystem.Action <string> whateverThisIs) { ApiWorld = apiWorld; ApiWorldInstance = apiWorldInstance; WhateverThisIs = whateverThisIs; }
// Token: 0x06000C5B RID: 3163 RVA: 0x0001FF5C File Offset: 0x0001E15C public static void OnThisUpdate() { bool flag = RoomManagerBase.currentRoom != null; if (flag) { ApiWorld currentRoom = RoomManagerBase.currentRoom; DiscordInfo.thisScene = default(Scene); bool flag2 = DiscordInfo.currentWorld != currentRoom; if (flag2) { DiscordInfo.currentWorld = RoomManagerBase.currentRoom; ApiWorldInstance currentWorldInstance = RoomManagerBase.currentWorldInstance; ApiWorldInstance.AccessType accessType = currentWorldInstance.GetAccessType(); int count = currentWorldInstance.users.Count; bool flag3 = accessType == ApiWorldInstance.AccessType.Public; if (flag3) { //info 1 DiscordInfo.ResetTime(); DiscordInfo.Presence.details = DiscordInfo.GetWorldName(); DiscordInfo.Presence.state = "In a " + DiscordInfo.GetWorldInstanceType(accessType) + " Lobby"; DiscordInfo.Presence.startTimestamp = DiscordInfo.timestamp; DiscordInfo.Presence.largeImageKey = "default_logo"; DiscordInfo.Presence.largeImageText = "VRChat"; DiscordInfo.Presence.smallImageKey = "public_img"; DiscordInfo.Presence.smallImageText = "Using TurtleGangClient"; DiscordInfo.PlayerCount(); DiscordRich.UpdatePresence(DiscordInfo.Presence); return; } bool flag4 = accessType == ApiWorldInstance.AccessType.InvitePlus; if (flag4) { //info 2 DiscordInfo.ResetTime(); DiscordInfo.Presence.details = DiscordInfo.GetWorldName(); DiscordInfo.Presence.state = "In a " + DiscordInfo.GetWorldInstanceType(accessType) + " Lobby"; DiscordInfo.Presence.startTimestamp = DiscordInfo.timestamp; DiscordInfo.Presence.largeImageKey = "default_logo"; DiscordInfo.Presence.largeImageText = "VRChat"; DiscordInfo.Presence.smallImageKey = "inviteplus_img"; DiscordInfo.Presence.smallImageText = "Using TurtleGangClient"; DiscordInfo.PlayerCount(); DiscordRich.UpdatePresence(DiscordInfo.Presence); return; } bool flag5 = accessType == ApiWorldInstance.AccessType.InviteOnly; if (flag5) { //info 3 DiscordInfo.ResetTime(); DiscordInfo.Presence.details = DiscordInfo.GetWorldName(); DiscordInfo.Presence.state = "In a " + DiscordInfo.GetWorldInstanceType(accessType) + " Lobby"; DiscordInfo.Presence.startTimestamp = DiscordInfo.timestamp; DiscordInfo.Presence.largeImageKey = "default_logo"; DiscordInfo.Presence.largeImageText = "VRChat"; DiscordInfo.Presence.smallImageKey = "inviteonly_img"; DiscordInfo.Presence.smallImageText = "Using TurtleGangClient"; DiscordInfo.PlayerCount(); DiscordRich.UpdatePresence(DiscordInfo.Presence); return; } bool flag6 = accessType == ApiWorldInstance.AccessType.FriendsOfGuests; if (flag6) { //info 4 DiscordInfo.ResetTime(); DiscordInfo.Presence.details = DiscordInfo.GetWorldName(); DiscordInfo.Presence.state = "In a " + DiscordInfo.GetWorldInstanceType(accessType) + " Lobby"; DiscordInfo.Presence.startTimestamp = DiscordInfo.timestamp; DiscordInfo.Presence.largeImageKey = "default_logo"; DiscordInfo.Presence.largeImageText = "VRChat"; DiscordInfo.Presence.smallImageKey = "friendofguests_img"; DiscordInfo.Presence.smallImageText = "Using TurtleGangClient"; DiscordInfo.PlayerCount(); DiscordRich.UpdatePresence(DiscordInfo.Presence); return; } bool flag7 = accessType == ApiWorldInstance.AccessType.FriendsOnly; if (flag7) { //info 5 DiscordInfo.ResetTime(); DiscordInfo.Presence.details = DiscordInfo.GetWorldName(); DiscordInfo.Presence.state = "In a " + DiscordInfo.GetWorldInstanceType(accessType) + " Lobby"; DiscordInfo.Presence.startTimestamp = DiscordInfo.timestamp; DiscordInfo.Presence.largeImageKey = "default_logo"; DiscordInfo.Presence.largeImageText = "VRChat"; DiscordInfo.Presence.smallImageKey = "friendsonly_img"; DiscordInfo.Presence.smallImageText = "Using TurtleGangClient"; DiscordInfo.PlayerCount(); DiscordRich.UpdatePresence(DiscordInfo.Presence); return; } bool flag8 = accessType == ApiWorldInstance.AccessType.Counter; if (flag8) { //info 6 DiscordInfo.ResetTime(); DiscordInfo.Presence.details = DiscordInfo.GetWorldName(); DiscordInfo.Presence.state = "In a " + DiscordInfo.GetWorldInstanceType(accessType) + " Lobby"; DiscordInfo.Presence.startTimestamp = DiscordInfo.timestamp; DiscordInfo.Presence.largeImageKey = "default_logo"; DiscordInfo.Presence.largeImageText = "VRChat"; DiscordInfo.Presence.smallImageKey = "counter_img"; DiscordInfo.Presence.smallImageText = "Using TurtleGangClient"; DiscordInfo.PlayerCount(); DiscordRich.UpdatePresence(DiscordInfo.Presence); return; } } bool flag9 = DiscordInfo.currentWorld != null; if (flag9) { //nb de gens la room ? DiscordInfo.Presence.partySize = PlayerManager.GetAllPlayers().Length; DiscordInfo.Presence.partyMax = DiscordInfo.currentWorld.capacity; DiscordRich.UpdatePresence(DiscordInfo.Presence); } else { //idk DiscordInfo.Presence.partySize = 0; DiscordInfo.Presence.partyMax = 0; DiscordRich.UpdatePresence(DiscordInfo.Presence); } } else { Scene activeScene = SceneManager.GetActiveScene(); bool flag10 = DiscordInfo.thisScene != activeScene; if (flag10) { DiscordInfo.thisScene = activeScene; Scene scene = DiscordInfo.thisScene; //nom de scene idk ? bool flag11 = DiscordInfo.thisScene.name == "ui"; if (flag11) { //info 7 DiscordInfo.ResetTime(); DiscordInfo.Presence.details = "In Loading Screen"; DiscordInfo.Presence.state = string.Empty; DiscordInfo.Presence.startTimestamp = DiscordInfo.timestamp; DiscordInfo.Presence.partySize = 0; DiscordInfo.Presence.partyMax = 0; DiscordInfo.Presence.largeImageKey = "default_logo"; DiscordInfo.Presence.largeImageText = "VRChat"; DiscordInfo.Presence.smallImageKey = "loading_img"; DiscordInfo.Presence.smallImageText = "Using TurtleGangClient"; DiscordRich.UpdatePresence(DiscordInfo.Presence); return; } } } DiscordRich.RunCallbacks(); }
public static void OnEnterWorld(ApiWorld __0, ApiWorldInstance __1) => OnEnterWorldEvent.Invoke(__0, __1);
public static bool CreatePortal(ApiWorld apiWorld, ApiWorldInstance apiWorldInstance, Vector3 pos, Vector3 forward, Il2CppSystem.Action <string> someStrAction = null) => (_createPortalDelegate ??= CreatePortalMethod.CreateDelegate <CreatePortalDelegate>())(apiWorld, apiWorldInstance, pos, forward, someStrAction);
public virtual void OnInstanceChange(ApiWorld world, ApiWorldInstance instance) { }
public override void OnInstanceChange(ApiWorld world, ApiWorldInstance instance) { textComponent.text = OriginalText.Replace("{worldname}", world.name); }