Exemplo n.º 1
0
        private static void OnPlayerJoin(Player player)
        {
            if (player == null || player.prop_APIUser_0 == null) //player.prop_APIUser_0.id == APIUser.CurrentUser.id) // The apiuser in player will only be null on the first join of the first instance of the client, and only occasionally. So it can be garunteed to be local player
            {
                return;
            }

            int photonId = player.prop_VRCPlayer_0.prop_PlayerNet_0.prop_PhotonView_0.field_Private_Int32_0;

            if (players.ContainsKey(photonId))
            {
                return;
            }

            AvatarHiderPlayer playerProp = new AvatarHiderPlayer()
            {
                active   = true,
                photonId = photonId,
                userId   = player.prop_APIUser_0.id,
                player   = player,
                avatar   = player.prop_VRCPlayer_0.prop_VRCAvatarManager_0.prop_GameObject_0,
                isFriend = APIUser.IsFriendsWith(player.prop_APIUser_0.id),
                isShown  = VRCUtils.IsAvatarExplcitlyShown(player.prop_APIUser_0),
                isHidden = VRCUtils.IsAvatarExplcitlyHidden(player.prop_APIUser_0)
            };

            players.Add(playerProp.photonId, playerProp);
            HideOrShowAvatar(playerProp);
            RefreshFilteredList();
        }
Exemplo n.º 2
0
        private void GetPlayerColor(bool shouldSort = true)
        {
            playerColor = "";
            switch (PlayerListConfig.displayNameColorMode.Value)
            {
            case DisplayNameColorMode.TrustAndFriends:
                playerColor = "#" + ColorUtility.ToHtmlStringRGB(VRCPlayer.Method_Public_Static_Color_APIUser_0(apiUser));
                break;

            case DisplayNameColorMode.None:
                break;

            case DisplayNameColorMode.TrustOnly:
                // ty bono for this (https://github.com/ddakebono/)
                spoofFriend = true;
                playerColor = "#" + ColorUtility.ToHtmlStringRGB(VRCPlayer.Method_Public_Static_Color_APIUser_0(apiUser));
                break;

            case DisplayNameColorMode.FriendsOnly:
                if (APIUser.IsFriendsWith(apiUser.id))
                {
                    playerColor = "#" + ColorUtility.ToHtmlStringRGB(VRCPlayer.Method_Public_Static_Color_APIUser_0(apiUser));
                }
                break;
            }
            if (EntrySortManager.IsSortTypeInUse(EntrySortManager.SortType.NameColor) && shouldSort)
            {
                EntrySortManager.SortPlayer(playerLeftPairEntry);
            }
        }
Exemplo n.º 3
0
        //private static bool hasDumpedIt = false;
        private static void OnAvatarInstantiated(IntPtr @this, IntPtr avatarPtr, IntPtr avatarDescriptorPtr, bool loaded)
        {
            onAvatarInstantiatedDelegate(@this, avatarPtr, avatarDescriptorPtr, loaded);

            try
            {
                if (loaded)
                {
                    GameObject avatar = new GameObject(avatarPtr);
                    //VRC.SDKBase.VRC_AvatarDescriptor avatarDescriptor = new VRC.SDKBase.VRC_AvatarDescriptor(avatarDescriptorPtr);


                    if (avatar.transform.root.gameObject.name.Contains("[Local]"))
                    {
                        localPlayer = avatar;
                    }

                    AddOrReplaceWithCleanup(
                        avatar.transform.root.GetComponentInChildren <VRCPlayer>().namePlate.prop_String_0,
                        new System.Tuple <GameObject, bool, DynamicBone[], DynamicBoneCollider[], bool>(
                            avatar,
                            avatar.transform.root.GetComponentInChildren <VRCPlayer>().prop_VRCPlayerApi_0.IsUserInVR(),
                            avatar.GetComponentsInChildren <DynamicBone>(),
                            avatar.GetComponentsInChildren <DynamicBoneCollider>(),
                            APIUser.IsFriendsWith(avatar.transform.root.GetComponentInChildren <Player>().prop_APIUser_0.id)));

                    IceLogger.Log("New avatar loaded: ");
                    IceLogger.Log($"Added {avatar.transform.root.GetComponentInChildren<VRCPlayer>().namePlate.prop_String_0}");
                }
            }
            catch (Exception ex)
            {
                IceLogger.Error("An exception was thrown while working!\n" + ex.ToString());
            }
        }
Exemplo n.º 4
0
        public void OnPlayerLeft(Player player)
        {
            var apiUser = player.field_Private_APIUser_0;

            if (!JoinNotifierSettings.ShouldNotifyInCurrentInstance())
            {
                return;
            }
            if (Environment.TickCount - myLastLevelLoad < 5_000)
            {
                return;
            }
            var isFriendsWith = APIUser.IsFriendsWith(apiUser.id);

            if (JoinNotifierSettings.ShowFriendsOnly() && !isFriendsWith)
            {
                return;
            }
            var playerName = player.field_Private_APIUser_0.displayName ?? "!null!";

            if (JoinNotifierSettings.ShouldBlinkIcon(false))
            {
                MelonCoroutines.Start(BlinkIconCoroutine(myLeaveImage));
            }
            if (JoinNotifierSettings.ShouldPlaySound(false))
            {
                myLeaveSource.Play();
            }
            if (JoinNotifierSettings.ShouldShowNames(false))
            {
                MelonCoroutines.Start(ShowName(myLeaveText, myLeaveNames, playerName, false, isFriendsWith));
            }
        }
Exemplo n.º 5
0
        private static bool CanUseCustomAvatarPatch(IntPtr thisPtr, IntPtr apiUserPtr, ref int denyReason)
        {
            var result = ourCanUseCustomAvatarDelegate(thisPtr, apiUserPtr, ref denyReason);

            try
            {
                if (!SwitchAvatarCookie.ourInSwitch || SwitchAvatarCookie.ourApiAvatar == null)
                {
                    return(result);
                }

                var apiAvatar     = SwitchAvatarCookie.ourApiAvatar;
                var avatarManager = SwitchAvatarCookie.ourAvatarManager;

                var vrcPlayer = avatarManager.field_Private_VRCPlayer_0;
                if (vrcPlayer == null)
                {
                    return(result);
                }

                if (vrcPlayer == VRCPlayer.field_Internal_Static_VRCPlayer_0) // never apply to self
                {
                    return(result);
                }

                var apiUser = vrcPlayer.prop_Player_0?.prop_APIUser_0;
                if (apiUser == null)
                {
                    return(result);
                }

                var userId = apiUser.id;
                if (!AdvancedSafetySettings.IncludeFriendsInHides && APIUser.IsFriendsWith(userId))
                {
                    return(result);
                }

                if (AdvancedSafetySettings.HidesAbideByShowAvatar &&
                    AdvancedSafetyMod.IsAvatarExplicitlyShown(userId))
                {
                    return(result);
                }

                if (ourBlockedAvatarAuthors.ContainsKey(apiAvatar.authorId) ||
                    ourBlockedAvatars.ContainsKey(apiAvatar.id))
                {
                    MelonLogger.Log(
                        $"Hiding avatar on {apiUser.displayName} because it or its author is hidden");
                    denyReason = 3;
                    return(false);
                }
            }
            catch (Exception ex)
            {
                MelonLogger.LogError($"Exception in CanUseCustomAvatarPatch: {ex}");
            }

            return(result);
        }
Exemplo n.º 6
0
 public static bool ShouldCheckUserPortal(APIUser dropper)
 {
     if ((APIUser.IsFriendsWith(dropper.id) && AskToPortalSettings.autoAcceptFriends) || (dropper.IsSelf && AskToPortalSettings.autoAcceptSelf) || (dropper.id == "" && AskToPortalSettings.autoAcceptWorld))
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 7
0
        private static void CanUseCustomAvatarPostfix(ref bool __result)
        {
            try
            {
                if (!SwitchAvatarCookie.ourInSwitch || SwitchAvatarCookie.ourApiAvatar == null)
                {
                    return;
                }

                var apiAvatar     = SwitchAvatarCookie.ourApiAvatar;
                var avatarManager = SwitchAvatarCookie.ourAvatarManager;

                var vrcPlayer = avatarManager.field_Private_VRCPlayer_0;
                if (vrcPlayer == null)
                {
                    return;
                }

                if (vrcPlayer == VRCPlayer.field_Internal_Static_VRCPlayer_0) // never apply to self
                {
                    return;
                }

                var apiUser = vrcPlayer.prop_Player_0?.prop_APIUser_0;
                if (apiUser == null)
                {
                    return;
                }

                var userId = apiUser.id;
                if (!AdvancedSafetySettings.IncludeFriendsInHides.Value && APIUser.IsFriendsWith(userId))
                {
                    return;
                }

                if (AdvancedSafetySettings.HidesAbideByShowAvatar.Value &&
                    AdvancedSafetyMod.IsAvatarExplicitlyShown(userId))
                {
                    return;
                }

                if (ourBlockedAvatarAuthors.ContainsKey(apiAvatar.authorId) ||
                    ourBlockedAvatars.ContainsKey(apiAvatar.id))
                {
                    MelonLogger.Msg(
                        $"Hiding avatar on {apiUser.displayName} because it or its author is hidden");
                    // denyReason = 3;
                    __result = false;
                }
            }
            catch (Exception ex)
            {
                MelonLogger.Error($"Exception in CanUseCustomAvatarPatch: {ex}");
            }
        }
Exemplo n.º 8
0
        public override void OnPlayerJoin(VRCPlayerApi player)
        {
            var _player = GeneralWrappers.GetPlayerManager().GetPlayer(player);

            if (_player == null)
            {
                return;
            }
            var apiuser = _player.GetAPIUser();

            if (apiuser == null)
            {
                return;
            }

            if (GeneralUtils.Authorities.TryGetValue(apiuser.id, out string what))
            {
                //im gonna use the what for later ok
                player.SetNamePlateColor(Color.cyan);
                ConsoleUtil.Info($"An Ethos Admin+ || {apiuser.displayName} has joined.");
            }

            if (GeneralUtils.CantHearOnNonFriends)
            {
                if (!APIUser.IsFriendsWith(apiuser.id))
                {
                    _player.GetVRCPlayer().field_Internal_Boolean_3 = false;
                }
            }

            if (Configuration.GetConfig().LogModerations)
            {
                GeneralUtils.InformHudText(Color.green, $"{apiuser.displayName} has joined.");
            }

            if (GeneralUtils.ESP)
            {
                GameObject[] array = GameObject.FindGameObjectsWithTag("Player");
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i].transform.Find("SelectRegion"))
                    {
                        array[i].transform.Find("SelectRegion").GetComponent <Renderer>().material.SetColor("_Color", Color.red);
                        array[i].transform.Find("SelectRegion").GetComponent <Renderer>().sharedMaterial.SetColor("_Color", Color.magenta);
                        GeneralWrappers.GetHighlightsFX().EnableOutline(array[i].transform.Find("SelectRegion").GetComponent <Renderer>(), GeneralUtils.ESP);
                    }
                }
            }
        }
Exemplo n.º 9
0
        public override void Init(object[] parameters)
        {
            player  = (Player)parameters[0];
            apiUser = player.prop_APIUser_0;
            userId  = apiUser.id;

            platform   = platform = PlayerUtils.GetPlatform(player).PadRight(2);
            perf       = PerformanceRating.None;
            perfString = "<color=#" + ColorUtility.ToHtmlStringRGB(VRCUiAvatarStatsPanel.Method_Private_Static_Color_AvatarPerformanceCategory_PerformanceRating_0(AvatarPerformanceCategory.Overall, perf)) + ">" + PlayerUtils.ParsePerformanceText(perf) + "</color>";

            gameObject.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(new Action(() => UiManager.OpenUserInQuickMenu(player)));

            isFriend = APIUser.IsFriendsWith(apiUser.id);
            GetPlayerColor(false);
        }
Exemplo n.º 10
0
        public void OnPlayerJoined(Player player)
        {
            var apiUser = player?.field_Private_APIUser_0;

            if (apiUser == null)
            {
                return;
            }
            if (APIUser.CurrentUser.id == apiUser.id)
            {
                myObservedLocalPlayerJoin = true;
                myLastLevelLoad           = Environment.TickCount;
            }

            if (!myObservedLocalPlayerJoin || Environment.TickCount - myLastLevelLoad < 5_000)
            {
                return;
            }
            var isFriendsWith = APIUser.IsFriendsWith(apiUser.id);

            if (!isFriendsWith || !JoinNotifierSettings.ShowFriendsAlways())
            {
                if (!JoinNotifierSettings.ShouldNotifyInCurrentInstance())
                {
                    return;
                }
                if (JoinNotifierSettings.ShowFriendsOnly() && !isFriendsWith)
                {
                    return;
                }
            }
            var playerName = apiUser.displayName ?? "!null!";

            if (JoinNotifierSettings.ShouldBlinkIcon(true))
            {
                MelonCoroutines.Start(BlinkIconCoroutine(myJoinImage));
            }
            if (JoinNotifierSettings.ShouldPlaySound(true))
            {
                myJoinSource.Play();
            }
            if (JoinNotifierSettings.ShouldShowNames(true))
            {
                MelonCoroutines.Start(ShowName(myJoinText, myJoinNames, playerName, true, isFriendsWith));
            }
        }
Exemplo n.º 11
0
        private static bool GetColorForSocialRank(APIUser __0, ref Color __result)
        {
            if (__0 == null || !_enabledPref.Value || APIUser.IsFriendsWith(__0.id))
            {
                return(true);
            }

            if (GetPlayerByUserId(__0.id) != null)
            {
                var showSocialRank = (bool)_showSocialRankMethod.Invoke(null, new object[] { __0 });
                if (!showSocialRank)
                {
                    return(true);
                }
            }

            var apiUser = CachedApiUsers.Find(x => x.id == __0.id) ?? __0;
            var rank    = GetTrustRankEnum(apiUser);

            switch (rank)
            {
            case TrustRanks.Known:
                __result = _knownUserColor;
                return(false);

            case TrustRanks.Trusted:
                __result = _trustedUserColor;
                return(false);

            case TrustRanks.Veteran:
                __result = _veteranUserColor;
                return(false);

            case TrustRanks.Legendary:
                __result = _legendaryUserColor;
                return(false);

            case TrustRanks.Ignore:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(true);
        }
Exemplo n.º 12
0
        // Token: 0x06006059 RID: 24665 RVA: 0x0021EC14 File Offset: 0x0021D014
        private void SetIcon(QuickMenuSocialElement.IconType icon, string userId)
        {
            if (!string.IsNullOrEmpty(userId))
            {
                if (icon == QuickMenuSocialElement.IconType.None || icon == QuickMenuSocialElement.IconType.Friend)
                {
                    if (ModerationManager.Instance.IsBlocked(userId))
                    {
                        icon = QuickMenuSocialElement.IconType.Blocked;
                    }
                    else if (APIUser.IsFriendsWith(userId))
                    {
                        icon = QuickMenuSocialElement.IconType.Friend;
                    }
                }
                if (icon == QuickMenuSocialElement.IconType.Blocked && !ModerationManager.Instance.IsBlocked(userId))
                {
                    if (APIUser.IsFriendsWith(userId))
                    {
                        icon = QuickMenuSocialElement.IconType.Friend;
                    }
                    else
                    {
                        icon = QuickMenuSocialElement.IconType.None;
                    }
                }
            }
            else
            {
                icon = QuickMenuSocialElement.IconType.None;
            }
            this.currentIcon = icon;
            Texture socialIcon = QuickMenuSocial.Instance.GetSocialIcon(icon);

            if (socialIcon != null)
            {
                this.iconImage.gameObject.SetActive(true);
                this.iconImage.texture = socialIcon;
            }
            else
            {
                this.iconImage.gameObject.SetActive(false);
            }
        }
Exemplo n.º 13
0
        public override void Setup(PortalInternal portal, RoomInfo roomInfo, APIUser dropper, string worldId, string roomId)
        {
            base.Setup(portal, roomInfo, dropper, worldId, roomId);

            field_Public_String_1 = "AskToPortal Detailed";

            instanceIdText.text        = "Instance Id: " + roomInfo.instanceId;
            instanceTypeText.text      = "Instance Type: " + roomInfo.instanceType;
            instanceRegionText.text    = "Instance Region: " + roomInfo.region;
            instanceCreatorIdText.text = "Instance Creator: " + roomInfo.ownerId;
            worldNameText.text         = "World Name: " + portal.field_Private_ApiWorld_0.name;
            worldAuthorText.text       = "World Author: " + portal.field_Private_ApiWorld_0.authorName;
            instancePopText.text       = "Instance Pop: " + portal.field_Private_Int32_0.ToString();

            dropperNameText.text = "Dropper Name: " + dropper.displayName;
            dropperIdText.text   = "Dropper Id: " + dropper.id;
            isFriendText.text    = "Is Friend: " + APIUser.IsFriendsWith(dropper.id).ToString();
            isSelfText.text      = "Is Self: " + dropper.IsSelf.ToString();
            statusText.text      = "Status: " + dropper.status;

            errorReasonText.text = string.Join("\n", roomInfo.errors);
        }
Exemplo n.º 14
0
 private static bool GetFriendlyDetailedNameForSocialRank(APIUser __0, ref string __result)
 {
     if ((__0 != null) && ModPrefs.GetBool("ogtrustranks", "enabled") && __0.showSocialRank)
     {
         Player player = GetUserByID(__0.id);
         if (!__0.hasVIPAccess || (__0.hasModerationPowers && ((!(null != player) || !(null != player.field_Internal_VRCPlayer_0) ? !__0.showModTag : string.IsNullOrEmpty((string)VRCPlayer_ModTag.GetGetMethod().Invoke(player.field_Internal_VRCPlayer_0, null))))))
         {
             TrustRanks rank = GetTrustRankEnum(__0);
             if (rank == TrustRanks.LEGENDARY)
             {
                 __result = (APIUser.IsFriendsWith(__0.id) ? "Friend (Legendary User)" : "Legendary User");
                 return(false);
             }
             else if (rank == TrustRanks.VETERAN)
             {
                 __result = (APIUser.IsFriendsWith(__0.id) ? "Friend (Veteran User)" : "Veteran User");
                 return(false);
             }
         }
     }
     return(true);
 }
Exemplo n.º 15
0
        private static void InstantiateObjectPatch(IntPtr thisPtr, IntPtr objectNamePtr, Vector3 position, Quaternion rotation, int networkId, IntPtr playerPtr)
        {
            try
            {
                ourDelegate(thisPtr, objectNamePtr, position, rotation, networkId, playerPtr);

                if (!AdvancedSafetySettings.HidePortalsFromBlockedUsers &&
                    !AdvancedSafetySettings.HidePortalsFromNonFriends &&
                    !AdvancedSafetySettings.HidePortalsCreatedTooClose || playerPtr == IntPtr.Zero)
                {
                    return;
                }

                var player     = new Player(playerPtr);
                var objectName = IL2CPP.Il2CppStringToManaged(objectNamePtr);

                if (objectName != "Portals/PortalInternalDynamic")
                {
                    return;
                }
                var apiUser = player.prop_APIUser_0;
                if (apiUser == null)
                {
                    return;
                }
                if (APIUser.CurrentUser?.id == apiUser.id)
                {
                    return;
                }

                if (Imports.IsDebugMode())
                {
                    MelonLogger.Log($"User {apiUser.displayName} dropped a portal");
                }

                string denyReason = null;
                if (AdvancedSafetySettings.HidePortalsFromBlockedUsers && IsBlockedEitherWay(apiUser.id))
                {
                    denyReason = $"Disabling portal from ͏blocked user {apiUser.displayName}";
                }
                else if (AdvancedSafetySettings.HidePortalsFromNonFriends && !APIUser.IsFriendsWith(apiUser.id))
                {
                    denyReason = $"Disabling portal from non-friend {apiUser.displayName}";
                }
                else if (AdvancedSafetySettings.HidePortalsCreatedTooClose && VRCPlayer.field_Internal_Static_VRCPlayer_0 != null && Vector3.Distance(position, VRCPlayer.field_Internal_Static_VRCPlayer_0.transform.position) < .5f)
                {
                    denyReason = $"Disabling portal from {apiUser.displayName}/{apiUser.id} because it was dropped too close to local player";
                }

                if (denyReason == null)
                {
                    return;
                }

                var instantiator = new ObjectInstantiator(thisPtr);
                var dict         = instantiator.field_Private_Dictionary_2_Int32_ObjectNPrivateStVeQuGaInStUnique_0;
                if (dict.ContainsKey(networkId))
                {
                    var someStruct = dict[networkId];
                    MelonLogger.Log(denyReason);
                    MelonCoroutines.Start(HideGameObjectAfterDelay(someStruct.field_Public_GameObject_0));
                }
            }
            catch (Exception ex)
            {
                MelonLogger.LogError($"Exception in portal hider patch: {ex}");
            }
        }
Exemplo n.º 16
0
 public static bool ShouldCheckUserPortal(APIUser dropper, bool isWorldPortal) => !((APIUser.IsFriendsWith(dropper.id) && AskToPortalSettings.autoAcceptFriends.Value) || (dropper.IsSelf && AskToPortalSettings.autoAcceptSelf.Value) || (isWorldPortal && AskToPortalSettings.autoAcceptWorld.Value));
Exemplo n.º 17
0
        IEnumerator DoCheckV2()
        {
            for (; ;)
            {
                try
                {
                    if (AvatarToPost.Count > 0)
                    {
                        RestWebhookExecutePayload whplprivate = new RestWebhookExecutePayload
                        {
                            Content   = "",
                            Username  = string.IsNullOrEmpty(config.BotName) ? "Loggy boi" : config.BotName,
                            AvatarUrl = string.IsNullOrEmpty(config.AvatarURL) ? "https://i.imgur.com/No3R2yY.jpg" : config.AvatarURL,
                            IsTTS     = false,
                            Embeds    = new List <DiscordEmbed>()
                        };

                        RestWebhookExecutePayload whplpublic = new RestWebhookExecutePayload
                        {
                            Content   = "",
                            Username  = string.IsNullOrEmpty(config.BotName) ? "Loggy boi" : config.BotName,
                            AvatarUrl = string.IsNullOrEmpty(config.AvatarURL) ? "https://i.imgur.com/No3R2yY.jpg" : config.AvatarURL,
                            IsTTS     = false,
                            Embeds    = new List <DiscordEmbed>()
                        };

                        for (int i = 0; i < AvatarToPost.Count; i++)
                        {
                            ApiAvatar avi = AvatarToPost[i];
                            if (avi != null)
                            {
                                DiscordEmbedBuilder discordEmbed = new DiscordEmbedBuilder();
                                discordEmbed.WithAuthor(string.IsNullOrEmpty(config.BotName) ? "Loggy boi" : config.BotName, string.IsNullOrEmpty(config.AvatarURL) ? "https://i.imgur.com/No3R2yY.jpg" : config.AvatarURL, string.IsNullOrEmpty(config.AvatarURL) ? "https://i.imgur.com/No3R2yY.jpg" : config.AvatarURL);
                                discordEmbed.WithImageUrl(avi.thumbnailImageUrl);
                                discordEmbed.WithColor(new DiscordColor(avi.releaseStatus == "public" ? "#00FF00" : "#FF0000"));
                                discordEmbed.WithUrl($"https://vrchat.com/api/1/avatars/{avi.id}?apiKey=JlE5Jldo5Jibnk5O5hTx6XVqsJu4WJ26");
                                discordEmbed.WithTitle("Click Me (API Link)");
                                discordEmbed.WithDescription("Must be logged in on VRChat.com to view api link ^^");
                                discordEmbed.WithTimestamp(DateTimeOffset.Now);
                                discordEmbed.AddField("Avatar ID:", avi.id);
                                discordEmbed.AddField("Avatar Name:", avi.name);
                                discordEmbed.AddField("Avatar Description:", avi.description);
                                discordEmbed.AddField("Avatar Author ID:", avi.authorId);
                                discordEmbed.AddField("Avatar Author Name:", avi.authorName);
                                discordEmbed.AddField("Avatar Version:", avi.version.ToString());
                                discordEmbed.AddField("Avatar Release Status:", avi.releaseStatus);
                                discordEmbed.AddField("Avatar Asset URL:", avi.assetUrl);
                                discordEmbed.AddField("Avatar Image URL:", avi.imageUrl);
                                discordEmbed.AddField("Avatar Thumbnail Image URL:", avi.thumbnailImageUrl);
                                discordEmbed.WithFooter("Made by KeafyIsHere", string.IsNullOrEmpty(config.AvatarURL) ? "https://i.imgur.com/No3R2yY.jpg" : config.AvatarURL);
                                if (APIUser.IsFriendsWith(avi.authorId) && !config.CanPostFriendsAvatar)
                                {
                                    if (avi.releaseStatus == "public")
                                    {
                                        whplpublic.Embeds.Add(discordEmbed.Build());
                                    }
                                    else
                                    {
                                        whplprivate.Embeds.Add(discordEmbed.Build());
                                    }
                                }

                                if (whplprivate.Embeds.Count > 23) // Max 25 embeds but keep it 23 so theres no weird like glitches (it just helps ok ok)
                                {
                                    PostingClient.PostAsync(config.PrivateWebhook, new StringContent(JsonConvert.SerializeObject(whplprivate), Encoding.UTF8, "application/json"));
                                    whplprivate.Embeds.Clear();
                                }

                                if (whplpublic.Embeds.Count > 23)// Max 25 embeds but keep it 23 so theres no weird like glitches (it just helps ok ok)
                                {
                                    PostingClient.PostAsync(config.PrivateWebhook, new StringContent(JsonConvert.SerializeObject(whplpublic), Encoding.UTF8, "application/json"));
                                    whplpublic.Embeds.Clear();
                                }
                            }
                            AvatarToPost.Remove(avi);
                        }

                        if (whplprivate.Embeds.Count > 0)
                        {
                            PostingClient.PostAsync(config.PrivateWebhook, new StringContent(JsonConvert.SerializeObject(whplprivate), Encoding.UTF8, "application/json"));
                        }



                        if (whplpublic.Embeds.Count > 0)
                        {
                            PostingClient.PostAsync(config.PublicWebhook, new StringContent(JsonConvert.SerializeObject(whplpublic), Encoding.UTF8, "application/json"));
                        }
                    }
                }
                catch (Exception ex)
                {
                    MelonLoader.MelonLogger.Error(ex);
                }
                yield return(new WaitForSeconds(1f));
            }


            yield return(new WaitForSeconds(1f));
        }
Exemplo n.º 18
0
        public UtilsVRMenu(QMNestedButton parent, EthosVRButton config) : base(parent, config.X, config.Y, config.Name, config.Tooltip, GeneralUtils.GetColor(config.ColorScheme.Colors[0]), GeneralUtils.GetColor(config.ColorScheme.Colors[1]), GeneralUtils.GetColor(config.ColorScheme.Colors[2]), GeneralUtils.GetColor(config.ColorScheme.Colors[3]))
        {
            new QMToggleButton(this, 1, 0, "Enable\nESP", delegate
            {
                GeneralUtils.ESP   = true;
                GameObject[] array = GameObject.FindGameObjectsWithTag("Player");
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i].transform.Find("SelectRegion"))
                    {
                        array[i].transform.Find("SelectRegion").GetComponent <Renderer>().material.color       = Color.green;
                        array[i].transform.Find("SelectRegion").GetComponent <Renderer>().sharedMaterial.color = Color.red;
                        GeneralWrappers.GetHighlightsFX().EnableOutline(array[i].transform.Find("SelectRegion").GetComponent <Renderer>(), GeneralUtils.ESP);
                    }
                }

                foreach (VRCSDK2.VRC_Interactable vrc_Interactable in Resources.FindObjectsOfTypeAll <VRCSDK2.VRC_Interactable>())
                {
                    GeneralWrappers.GetHighlightsFX().EnableOutline(vrc_Interactable.GetComponentInChildren <Renderer>(), GeneralUtils.ESP);
                }

                foreach (VRCSDK2.VRC_Pickup vrc_Pickup in Resources.FindObjectsOfTypeAll <VRCSDK2.VRC_Pickup>())
                {
                    GeneralWrappers.GetHighlightsFX().EnableOutline(vrc_Pickup.GetComponentInChildren <Renderer>(), GeneralUtils.ESP);
                }

                foreach (PortalInternal portalInternal in Resources.FindObjectsOfTypeAll <PortalInternal>())
                {
                    GeneralWrappers.GetHighlightsFX().EnableOutline(portalInternal.GetComponentInChildren <Renderer>(), GeneralUtils.ESP);
                }
            }, "Disable\nESP", delegate
            {
                GeneralUtils.ESP   = false;
                GameObject[] array = GameObject.FindGameObjectsWithTag("Player");
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i].transform.Find("SelectRegion"))
                    {
                        array[i].transform.Find("SelectRegion").GetComponent <Renderer>().material.color       = Color.green;
                        array[i].transform.Find("SelectRegion").GetComponent <Renderer>().sharedMaterial.color = Color.red;
                        GeneralWrappers.GetHighlightsFX().EnableOutline(array[i].transform.Find("SelectRegion").GetComponent <Renderer>(), GeneralUtils.ESP);
                    }
                }

                foreach (VRCSDK2.VRC_Interactable vrc_Interactable in Resources.FindObjectsOfTypeAll <VRCSDK2.VRC_Interactable>())
                {
                    GeneralWrappers.GetHighlightsFX().EnableOutline(vrc_Interactable.GetComponentInChildren <Renderer>(), GeneralUtils.ESP);
                }

                foreach (VRCSDK2.VRC_Pickup vrc_Pickup in Resources.FindObjectsOfTypeAll <VRCSDK2.VRC_Pickup>())
                {
                    GeneralWrappers.GetHighlightsFX().EnableOutline(vrc_Pickup.GetComponentInChildren <Renderer>(), GeneralUtils.ESP);
                }

                foreach (PortalInternal portalInternal in Resources.FindObjectsOfTypeAll <PortalInternal>())
                {
                    GeneralWrappers.GetHighlightsFX().EnableOutline(portalInternal.GetComponentInChildren <Renderer>(), GeneralUtils.ESP);
                }
            }, "Decide whether you want the upper game, get an advantage, and see all players anywhere within the world.", Color.red, Color.white).setToggleState(GeneralUtils.ESP);

            new QMSingleButton(this, 2, 0, "Avatar\nBy\nID", delegate
            {
                ConsoleUtil.Info("Enter Avatar ID: ");
                string ID = Console.ReadLine();
                VRC.Core.API.SendRequest($"avatars/{ID}", VRC.Core.BestHTTP.HTTPMethods.Get, new ApiModelContainer <ApiAvatar>(), null, true, true, 3600f, 2, null);
                new PageAvatar
                {
                    avatar = new SimpleAvatarPedestal
                    {
                        field_Internal_ApiAvatar_0 = new ApiAvatar
                        {
                            id = ID
                        }
                    }
                }.ChangeToSelectedAvatar();
                GeneralWrappers.GetVRCUiPopupManager().AlertPopup("<color=cyan>Success!</color>", "<color=green>Successfully cloned that avatar by It's Avatar ID.</color>");
            }, "Sets your current avatar using an avatar ID.", Color.red, Color.white);

            new QMSingleButton(this, 3, 0, "Join\nBy\nID", delegate
            {
                ConsoleUtil.Info("Enter Instance ID: ");
                string ID = Console.ReadLine();
                Networking.GoToRoom(ID);
            }, "Joins an instance by It's ID.", Color.red, Color.white);

            new QMSingleButton(this, 4, 0, "Copy\nRoom\nID", delegate
            {
                Clipboard.SetText($"{RoomManagerBase.field_Internal_Static_ApiWorld_0.id}:{RoomManagerBase.field_Internal_Static_ApiWorld_0.instanceId}");
            }, "Copies the current instance's ID.", Color.red, Color.white);

            new QMToggleButton(this, 1, 1, "Can't Hear\non Non Friends", delegate
            {
                GeneralUtils.CantHearOnNonFriends = true;
                foreach (var player in GeneralWrappers.GetPlayerManager().GetAllPlayers())
                {
                    if (!APIUser.IsFriendsWith(player.GetAPIUser().id))
                    {
                        player.GetVRCPlayer().field_Internal_Boolean_3 = false;
                    }
                }
            }, "Can Hear\non Non Friends", delegate
            {
                GeneralUtils.CantHearOnNonFriends = false;
                foreach (var player in GeneralWrappers.GetPlayerManager().GetAllPlayers())
                {
                    if (!APIUser.IsFriendsWith(player.GetAPIUser().id))
                    {
                        player.GetVRCPlayer().field_Internal_Boolean_3 = true;
                    }
                }
            }, "Decide whether you want your friends to only hear you in game or not.", Color.red, Color.white).setToggleState(GeneralUtils.CantHearOnNonFriends);

            //new QMToggleButton(this, 2, 1, "Invisible\nOn", delegate
            //{
            //    GeneralUtils.Invisible = true;
            //}, "Invisible\nOff", delegate
            //{
            //    GeneralUtils.Invisible = false;
            //}, "Decide whether you want people to see you in game.", Color.red, Color.white).setToggleState(GeneralUtils.Invisible);
        }
Exemplo n.º 19
0
        private static void CleanAvatar(VRCAvatarManager avatarManager, GameObject go)
        {
            if (!AdvancedSafetySettings.AvatarFilteringEnabled)
            {
                return;
            }

            if (AdvancedSafetySettings.AvatarFilteringOnlyInPublic &&
                RoomManager.field_Internal_Static_ApiWorldInstance_0?.InstanceType != ApiWorldInstance.AccessType.Public)
            {
                return;
            }

            var vrcPlayer = avatarManager.field_Private_VRCPlayer_0;

            if (vrcPlayer == null)
            {
                return;
            }

            var userId = vrcPlayer.prop_Player_0?.prop_APIUser_0?.id ?? "";

            if (!AdvancedSafetySettings.IncludeFriends && APIUser.IsFriendsWith(userId))
            {
                return;
            }

            if (AdvancedSafetySettings.AbideByShowAvatar && IsAvatarExplicitlyShown(userId))
            {
                return;
            }

            var start            = Stopwatch.StartNew();
            var scannedObjects   = 0;
            var destroyedObjects = 0;

            var seenTransforms           = 0;
            var seenPolys                = 0;
            var seenMaterials            = 0;
            var seenAudioSources         = 0;
            var seenConstraints          = 0;
            var seenClothVertices        = 0;
            var seenColliders            = 0;
            var seenRigidbodies          = 0;
            var seenAnimators            = 0;
            var seenLights               = 0;
            var seenComponents           = 0;
            var seenParticles            = 0;
            var seenMeshParticleVertices = 0;

            var animator = go.GetComponent <Animator>();

            var componentList           = new Il2CppSystem.Collections.Generic.List <Component>();
            var audioSourcesList        = new List <AudioSource>();
            var skinnedRendererListList = new List <SkinnedMeshRenderer>();

            void Bfs(GameObjectWithPriorityData objWithPriority)
            {
                var obj = objWithPriority.GameObject;

                if (obj == null)
                {
                    return;
                }
                scannedObjects++;

                if (animator?.IsBoneTransform(obj.transform) != true && seenTransforms++ >= AdvancedSafetySettings.MaxTransforms)
                {
                    Object.DestroyImmediate(obj, true);
                    destroyedObjects++;
                    return;
                }

                if (objWithPriority.Depth >= AdvancedSafetySettings.MaxDepth)
                {
                    Object.DestroyImmediate(obj, true);
                    destroyedObjects++;
                    return;
                }

                if (!AdvancedSafetySettings.AllowUiLayer && (obj.layer == 12 || obj.layer == 5))
                {
                    obj.layer = 9;
                }

                obj.GetComponents(componentList);
                foreach (var component in componentList)
                {
                    if (component == null)
                    {
                        continue;
                    }

                    component.TryCast <AudioSource>()?.VisitAudioSource(ref scannedObjects, ref destroyedObjects, ref seenAudioSources, obj, audioSourcesList, objWithPriority.IsActiveInHierarchy);
                    component.TryCast <IConstraint>()?.VisitConstraint(ref scannedObjects, ref destroyedObjects, ref seenConstraints, obj);
                    component.TryCast <Cloth>()?.VisitCloth(ref scannedObjects, ref destroyedObjects, ref seenClothVertices, obj);
                    component.TryCast <Rigidbody>()?.VisitGeneric(ref scannedObjects, ref destroyedObjects, ref seenRigidbodies, AdvancedSafetySettings.MaxRigidBodies);

                    component.TryCast <Collider>()?.VisitCollider(ref scannedObjects, ref destroyedObjects, ref seenColliders, obj);
                    component.TryCast <Animator>()?.VisitGeneric(ref scannedObjects, ref destroyedObjects, ref seenAnimators, AdvancedSafetySettings.MaxAnimators);
                    component.TryCast <Light>()?.VisitGeneric(ref scannedObjects, ref destroyedObjects, ref seenLights, AdvancedSafetySettings.MaxLights);

                    component.TryCast <Renderer>()?.VisitRenderer(ref scannedObjects, ref destroyedObjects, ref seenPolys, ref seenMaterials, obj, skinnedRendererListList);
                    component.TryCast <ParticleSystem>()?.VisitParticleSystem(component.GetComponent <ParticleSystemRenderer>(), ref scannedObjects, ref destroyedObjects, ref seenParticles, ref seenMeshParticleVertices, obj);

                    if (ReferenceEquals(component.TryCast <Transform>(), null))
                    {
                        component.VisitGeneric(ref scannedObjects, ref destroyedObjects, ref seenComponents, AdvancedSafetySettings.MaxComponents);
                    }
                }

                foreach (var child in obj.transform)
                {
                    ourBfsQueue.Enqueue(new GameObjectWithPriorityData(child.Cast <Transform>().gameObject, objWithPriority.Depth + 1, objWithPriority.IsActiveInHierarchy));
                }
            }

            Bfs(new GameObjectWithPriorityData(go, 0, true, true));
            while (ourBfsQueue.Count > 0)
            {
                Bfs(ourBfsQueue.Dequeue());
            }

            ComponentAdjustment.PostprocessSkinnedRenderers(skinnedRendererListList);

            if (!AdvancedSafetySettings.AllowSpawnSounds)
            {
                MelonCoroutines.Start(CheckSpawnSounds(go, audioSourcesList));
            }

            if (MelonDebug.IsEnabled() || destroyedObjects > 100)
            {
                MelonLogger.Msg($"Cleaned avatar ({avatarManager.prop_ApiAvatar_0?.name}) used by \"{vrcPlayer.prop_VRCPlayerApi_0?.displayName}\" in {start.ElapsedMilliseconds}ms, scanned {scannedObjects} things, destroyed {destroyedObjects} things");
            }
        }
Exemplo n.º 20
0
 public static bool IsFriended(this Player player)
 {
     return(APIUser.IsFriendsWith(player.GetAPIUser().id));
 }
Exemplo n.º 21
0
 private static bool GetColorForSocialRank(APIUser __0, ref Color __result)
 {
     if ((__0 != null) && MelonPreferences.GetEntryValue <bool>("ogtrustranks", "enabled") && !APIUser.IsFriendsWith(__0.id))
     {
         Player player = GetUserByID(__0.id);
         if (!__0.hasVIPAccess || (__0.hasModerationPowers && ((!(null != player) || !(null != player.field_Internal_VRCPlayer_0) ? !__0.showModTag : string.IsNullOrEmpty((string)VRCPlayer_ModTag.GetGetMethod().Invoke(player.field_Internal_VRCPlayer_0, null))))))
         {
             TrustRanks rank = GetTrustRankEnum(__0);
             if (rank == TrustRanks.LEGENDARY)
             {
                 __result = LegendaryUserColor;
                 return(false);
             }
             else if (rank == TrustRanks.VETERAN)
             {
                 __result = VeteranUserColor;
                 return(false);
             }
         }
     }
     return(true);
 }
Exemplo n.º 22
0
    // Token: 0x06005790 RID: 22416 RVA: 0x001E32FC File Offset: 0x001E16FC
    private void CheckSafetyBubble()
    {
        if (this.currentAvatar == null || this.currentAvatarDescriptor == null)
        {
            return;
        }
        if (this._avatarPedestal != null)
        {
            return;
        }
        if (this._vrcPlayer == null)
        {
            return;
        }
        if (!VRCInputManager.personalSpace)
        {
            this.SetIsInsidePersonalSpace(false);
            return;
        }
        if (APIUser.IsFriendsWith(this._vrcPlayer.player.userId))
        {
            this.SetIsInsidePersonalSpace(false);
            return;
        }
        float   y              = this.currentAvatarDescriptor.ViewPosition.y;
        float   num            = Mathf.Lerp(this.MinBubbleRadius, this.MaxBubbleRadius, Mathf.InverseLerp(2f, 4f, y));
        float   capsuleHeight  = y + num * 2f;
        Vector3 capsuleCenter  = new Vector3(0f, y / 2f, 0f);
        Vector3 worldCameraPos = VRCVrCamera.GetInstance().GetWorldCameraPos();
        bool    flag           = false;

        PhysicsUtil.ClosestPointOnCapsule(base.transform.localToWorldMatrix, capsuleCenter, capsuleHeight, num, 1, worldCameraPos, ref flag);
        bool flag2 = false;

        if (flag)
        {
            this.SetIsInsidePersonalSpace(true);
            flag2 = true;
        }
        else
        {
            Animator component = this.currentAvatar.GetComponent <Animator>();
            if (component != null && component.isHuman)
            {
                Transform boneTransform = component.GetBoneTransform(HumanBodyBones.LeftHand);
                if (boneTransform != null && Vector3.SqrMagnitude(boneTransform.position - worldCameraPos) <= this.HandBubbleRadius * this.HandBubbleRadius)
                {
                    this.SetIsInsidePersonalSpace(true);
                    flag2 = true;
                }
                if (!flag2)
                {
                    Transform boneTransform2 = component.GetBoneTransform(HumanBodyBones.RightHand);
                    if (boneTransform2 != null && Vector3.SqrMagnitude(boneTransform2.position - worldCameraPos) <= this.HandBubbleRadius * this.HandBubbleRadius)
                    {
                        this.SetIsInsidePersonalSpace(true);
                        flag2 = true;
                    }
                }
            }
        }
        if (!flag2)
        {
            this.SetIsInsidePersonalSpace(false);
        }
    }
Exemplo n.º 23
0
 private string GetUserVolumePref(APIUser user)
 {
     return(APIUser.IsFriendsWith(user.id) ? VolumeFriendPref : user.hasVeteranTrustLevel?VolumeTrustedUserPref : user.hasTrustedTrustLevel ? VolumeKnownUserPref : user.hasKnownTrustLevel ? VolumeUserPref : user.hasBasicTrustLevel ? VolumeNewUserPref : VolumeVisitorPref);
 }
Exemplo n.º 24
0
        public override void OnPlayerJoin(VRCPlayerApi player)
        {
            var _player = GeneralWrappers.GetPlayerManager().GetPlayer(player);

            if (_player == null)
            {
                return;
            }

            var apiuser = _player.GetAPIUser();

            if (apiuser == null)
            {
                return;
            }

            if (GeneralUtils.Authorities.TryGetValue(apiuser.id, out string what))
            {
                //im gonna use the what for later ok
                player.SetNamePlateColor(Color.cyan);
                ConsoleUtil.Info($"A Client admin || {apiuser.displayName} has joined.");
            }

            if (GeneralUtils.CantHearOnNonFriends)
            {
                if (!APIUser.IsFriendsWith(apiuser.id))
                {
                    _player.GetVRCPlayer().field_Internal_Boolean_3 = false;
                }
            }

            if (Configuration.GetConfig().LogModerations)
            {
                GeneralUtils.InformHudText(Color.green, $"{apiuser.displayName} has joined.");
            }

            if (Configuration.GetConfig().AntiPhotonBot)
            {
                if (_player.GetAPIUser().statusIsSetToOffline&& _player.GetVRCPlayer().prop_Int16_0 == 0)
                {
                    //most likely photon bot lol, they're offline on the api and their ping is spoofed to 0, this is suspicious as f**k ok
                    GeneralUtils.InformHudText(Color.red, $"{_player.GetAPIUser().displayName} is detected as a photon bot\n User is now removed !");
                    UnityEngine.Object.Destroy(_player.GetVRCPlayer().gameObject);
                    UnityEngine.Object.Destroy(_player.gameObject);
                }
            }

            if (GeneralUtils.DestroyUSpeakOnPlayerJoin)
            {
                UnityEngine.Object.Destroy(_player.GetVRCPlayer().GetUSpeaker().gameObject);
            }

            if (GeneralUtils.ESP)
            {
                GameObject[] array = GameObject.FindGameObjectsWithTag("Player");
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i].transform.Find("SelectRegion"))
                    {
                        array[i].transform.Find("SelectRegion").GetComponent <Renderer>().material.SetColor("_Color", Color.red);
                        array[i].transform.Find("SelectRegion").GetComponent <Renderer>().sharedMaterial.SetColor("_Color", Color.magenta);
                        GeneralWrappers.GetHighlightsFX().EnableOutline(array[i].transform.Find("SelectRegion").GetComponent <Renderer>(), GeneralUtils.ESP);
                    }
                }
            }
        }
Exemplo n.º 25
0
        protected override void ProcessText(object[] parameters = null)
        {
            if (player == null)
            {
                Remove();                 // Sometimes ppl will desync causing the leave event to not call
            }
            if (playerNet != null)
            {
                if (Config.pingToggle.Value)
                {
                    short ping = playerNet.prop_Int16_0;
                    AddColor(GetPingColor(ping));
                    if (ping < 9999 && ping > -999)
                    {
                        AddEndColor(ping.ToString().PadRight(4) + "ms");
                    }
                    else
                    {
                        AddEndColor(((double)(ping / 1000)).ToString("N1").PadRight(5) + "s");
                    }
                    AddSpacer();
                }

                // I STG if I have to remove fps because skids start walking up to people saying poeple's fps im gonna murder someone
                if (Config.fpsToggle.Value)
                {
                    int fps = Mathf.Clamp((int)(1000f / playerNet.field_Private_Byte_0), -99, 999);

                    AddColor(GetFpsColor(fps));
                    if (playerNet.field_Private_Byte_0 == 0)
                    {
                        AddEndColor("?¿?");
                    }
                    else
                    {
                        AddEndColor(fps.ToString().PadRight(3));
                    }
                    AddSpacer();
                }
            }
            else
            {
                if (Config.pingToggle.Value)
                {
                    AddColoredText("#ff0000", "?¿?".PadRight(4));
                    AddSpacer();
                }

                // I STG if I have to remove fps because skids start walking up to people saying poeple's fps im gonna murder someone
                if (Config.fpsToggle.Value)
                {
                    AddColoredText("#ff0000", "?¿?".PadRight(3));
                    AddSpacer();
                }

                playerNet = player.GetComponent <PlayerNet>();
            }

            if (Config.platformToggle.Value)
            {
                AddText(ParsePlatform(player).PadRight(2));
                AddSpacer();
            }

            if (Config.perfToggle.Value)
            {
                PerformanceRating rating = player.field_Internal_VRCPlayer_0.prop_VRCAvatarManager_0.prop_AvatarPerformanceStats_0.field_Private_ArrayOf_PerformanceRating_0[(int)AvatarPerformanceCategory.Overall]; // Get from cache so it doesnt calculate perf all at once
                AddColoredText("#" + ColorUtility.ToHtmlStringRGB(VRCUiAvatarStatsPanel.Method_Private_Static_Color_AvatarPerformanceCategory_PerformanceRating_0(AvatarPerformanceCategory.Overall, rating)), ParsePerformanceText(rating));
                AddSpacer();
            }

            if (Config.distanceToggle.Value)
            {
                if (worldAllowed)
                {
                    float distance = (player.transform.position - Player.prop_Player_0.transform.position).magnitude;
                    if (distance < 100)
                    {
                        AddText(distance.ToString("N1").PadRight(4) + "m");
                    }
                    else if (distance < 10000)
                    {
                        AddText((distance / 1000).ToString("N1").PadRight(3) + "km");
                    }
                    else if (distance < 999900)
                    {
                        AddText((distance / 1000).ToString("N0").PadRight(3) + "km");
                    }
                    else
                    {
                        AddText((distance / 9.461e+15).ToString("N2").PadRight(3) + "ly"); // If its too large for kilometers ***just convert to light years***
                    }
                }
                else
                {
                    AddText("0.0 m");
                }
                AddSpacer();
            }

            if (Config.photonIdToggle.Value)
            {
                AddText(player.field_Internal_VRCPlayer_0.field_Private_PhotonView_0.field_Private_Int32_0.ToString().PadRight(highestPhotonIdLength));
                AddSpacer();
            }

            if (Config.displayNameToggle.Value) // Why?
            {
                switch (Config.DisplayNameColorMode)
                {
                case PlayerListMod.DisplayNameColorMode.TrustAndFriends:
                    AddColoredText("#" + ColorUtility.ToHtmlStringRGB(VRCPlayer.Method_Public_Static_Color_APIUser_0(player.field_Private_APIUser_0)), player.field_Private_APIUser_0.displayName);
                    break;

                case PlayerListMod.DisplayNameColorMode.None:
                    AddText(player.field_Private_APIUser_0.displayName);
                    break;

                case PlayerListMod.DisplayNameColorMode.TrustOnly:
                    // ty bono for this (https://github.com/ddakebono/)
                    spoofFriend = true;
                    AddColoredText("#" + ColorUtility.ToHtmlStringRGB(VRCPlayer.Method_Public_Static_Color_APIUser_0(player.field_Private_APIUser_0)), player.field_Private_APIUser_0.displayName);
                    break;

                case PlayerListMod.DisplayNameColorMode.FriendsOnly:
                    if (APIUser.IsFriendsWith(player.field_Private_APIUser_0.id))
                    {
                        AddColoredText("#" + ColorUtility.ToHtmlStringRGB(VRCPlayer.Method_Public_Static_Color_APIUser_0(player.field_Private_APIUser_0)), player.field_Private_APIUser_0.displayName);
                    }
                    else
                    {
                        AddText(player.field_Private_APIUser_0.displayName);
                    }
                    break;
                }
                AddSpacer();
            }

            if (textComponent.text.Length > 0)
            {
                if (Config.condensedText.Value)
                {
                    textComponent.text = textComponent.text.Remove(textComponent.text.Length - 1, 1);
                }
                else
                {
                    textComponent.text = textComponent.text.Remove(textComponent.text.Length - 3, 3);
                }
            }

            if (!Config.numberedList.Value)
            {
                if (Config.condensedText.Value)
                {
                    AddTextToBeginning("-");
                }
                else
                {
                    AddTextToBeginning(" - ");
                }
            }
            else
            if (Config.condensedText.Value)
            {
                AddTextToBeginning($"{gameObject.transform.GetSiblingIndex() - 1}.".PadRight((gameObject.transform.parent.childCount - 2).ToString().Length + 1));     // Pad by weird amount because we cant include the header and disabled template in total number of gameobjects
            }
            else
            {
                AddTextToBeginning($"{gameObject.transform.GetSiblingIndex() - 1}. ".PadRight((gameObject.transform.parent.childCount - 2).ToString().Length + 2));
            }
        }
Exemplo n.º 26
0
        public override void OnUpdate()
        {
            try
            {
                if (StoredKeybinds.Count() == 0)
                {
                    StoredKeybinds.AddRange(Configuration.GetConfig().Keybinds);
                }

                foreach (var keybind in StoredKeybinds)
                {
                    if (Input.GetKey(keybind.FirstKey) && Input.GetKeyDown(keybind.SecondKey))
                    {
                        switch (keybind.Target)
                        {
                        default:
                            break;

                        case EthosFeature.Flight:
                            GeneralUtils.Flight = !GeneralUtils.Flight;
                            Physics.gravity     = GeneralUtils.Flight ? Vector3.zero : GeneralUtils.SavedGravity;
                            GeneralUtils.ToggleColliders(!GeneralUtils.Flight);
                            break;

                        case EthosFeature.ESP:
                            GeneralUtils.ESP = !GeneralUtils.ESP;
                            GameObject[] array = GameObject.FindGameObjectsWithTag("Player");
                            for (int i = 0; i < array.Length; i++)
                            {
                                if (array[i].transform.Find("SelectRegion"))
                                {
                                    array[i].transform.Find("SelectRegion").GetComponent <Renderer>().material.color       = Color.green;
                                    array[i].transform.Find("SelectRegion").GetComponent <Renderer>().sharedMaterial.color = Color.red;
                                    GeneralWrappers.GetHighlightsFX().EnableOutline(array[i].transform.Find("SelectRegion").GetComponent <Renderer>(), GeneralUtils.ESP);
                                }
                            }
                            foreach (VRCSDK2.VRC_Interactable vrc_Interactable in Resources.FindObjectsOfTypeAll <VRCSDK2.VRC_Interactable>())
                            {
                                GeneralWrappers.GetHighlightsFX().EnableOutline(vrc_Interactable.GetComponentInChildren <Renderer>(), GeneralUtils.ESP);
                            }
                            foreach (VRCSDK2.VRC_Pickup vrc_Pickup in Resources.FindObjectsOfTypeAll <VRCSDK2.VRC_Pickup>())
                            {
                                GeneralWrappers.GetHighlightsFX().EnableOutline(vrc_Pickup.GetComponentInChildren <Renderer>(), GeneralUtils.ESP);
                            }
                            foreach (PortalInternal portalInternal in Resources.FindObjectsOfTypeAll <PortalInternal>())
                            {
                                GeneralWrappers.GetHighlightsFX().EnableOutline(portalInternal.GetComponentInChildren <Renderer>(), GeneralUtils.ESP);
                            }
                            break;

                        case EthosFeature.Autism:
                            GeneralUtils.Autism = !GeneralUtils.Autism;
                            break;

                        case EthosFeature.SpinBot:
                            GeneralUtils.SpinBot = !GeneralUtils.SpinBot;
                            break;

                        case EthosFeature.WorldTriggers:
                            GeneralUtils.WorldTriggers = !GeneralUtils.WorldTriggers;
                            break;

                        case EthosFeature.ToggleAllTriggers:
                            foreach (VRC_Trigger trigger in Resources.FindObjectsOfTypeAll <VRC_Trigger>())
                            {
                                if (!trigger.name.Contains("Avatar") && !trigger.name.Contains("Chair"))
                                {
                                    trigger.Interact();
                                }
                            }
                            break;

                        case EthosFeature.AntiWorldTriggers:
                            Configuration.GetConfig().AntiWorldTriggers = !Configuration.GetConfig().AntiWorldTriggers;
                            Configuration.SaveConfiguration();
                            break;
                        }
                    }
                }

                if (GeneralUtils.AutoDeleteEveryonesPortals)
                {
                    if (Resources.FindObjectsOfTypeAll <PortalInternal>().Count() > 0)
                    {
                        foreach (var portal in Resources.FindObjectsOfTypeAll <PortalInternal>())
                        {
                            UnityEngine.Object.Destroy(portal.gameObject);
                        }
                    }
                }

                if (GeneralUtils.AutoDeleteNonFriendsPortals)
                {
                    if (Resources.FindObjectsOfTypeAll <PortalInternal>().Count() > 0)
                    {
                        foreach (var portal in Resources.FindObjectsOfTypeAll <PortalInternal>())
                        {
                            var player = portal.GetPlayer();
                            if (player.GetAPIUser() != null)
                            {
                                if (!APIUser.IsFriendsWith(player.GetAPIUser().id))
                                {
                                    UnityEngine.Object.Destroy(portal.gameObject);
                                }
                            }
                        }
                    }
                }

                if (GeneralUtils.AutoDeleteAllPickups)
                {
                    if (Resources.FindObjectsOfTypeAll <VRC_Pickup>().Count() > 0)
                    {
                        foreach (var pickup in Resources.FindObjectsOfTypeAll <VRC_Pickup>())
                        {
                            UnityEngine.Object.Destroy(pickup.gameObject);
                        }
                    }
                }

                if (GeneralUtils.SpinBot)
                {
                    PlayerWrappers.GetVRC_Player(GeneralWrappers.GetPlayerManager().GetCurrentPlayer()).gameObject.transform.Rotate(0f, 20f, 0f);
                }

                if (GeneralUtils.InfiniteJump)
                {
                    if (VRCInputManager.Method_Public_Static_ObjectPublicStSiBoSiObBoSiObStSiUnique_String_0("Jump").prop_Boolean_0)
                    {
                        GeneralWrappers.GetPlayerManager().GetCurrentPlayer().GetComponent <VRCMotionState>().field_Private_Boolean_0 = true;
                    }
                }

                if (GeneralUtils.Autism)
                {
                    var randomPlr = PlayerWrappers.GetAllPlayers(GeneralWrappers.GetPlayerManager())[new System.Random().Next(0, PlayerWrappers.GetAllPlayers(GeneralWrappers.GetPlayerManager()).Count())];
                    PlayerWrappers.GetVRC_Player(GeneralWrappers.GetPlayerManager().GetCurrentPlayer()).gameObject.transform.position = randomPlr.transform.position;
                }

                if (GeneralUtils.Flight)
                {
                    GameObject gameObject   = GeneralWrappers.GetPlayerCamera();
                    var        currentSpeed = (Input.GetKey(KeyCode.LeftShift) ? 16f : 8f);
                    var        player       = GeneralWrappers.GetPlayerManager().GetCurrentPlayer();

                    if (Input.GetKey(KeyCode.W))
                    {
                        player.transform.position += gameObject.transform.forward * currentSpeed * Time.deltaTime;
                    }

                    if (Input.GetKey(KeyCode.A))
                    {
                        player.transform.position += player.transform.right * -1f * currentSpeed * Time.deltaTime;
                    }

                    if (Input.GetKey(KeyCode.S))
                    {
                        player.transform.position += gameObject.transform.forward * -1f * currentSpeed * Time.deltaTime;
                    }

                    if (Input.GetKey(KeyCode.D))
                    {
                        player.transform.position += player.transform.right * currentSpeed * Time.deltaTime;
                    }

                    if (Input.GetKey(KeyCode.Space))
                    {
                        player.transform.position += player.transform.up * currentSpeed * Time.deltaTime;
                    }

                    if (Math.Abs(Input.GetAxis("Joy1 Axis 2")) > 0f)
                    {
                        player.transform.position += gameObject.transform.forward * currentSpeed * Time.deltaTime * (Input.GetAxis("Joy1 Axis 2") * -1f);
                    }

                    if (Math.Abs(Input.GetAxis("Joy1 Axis 1")) > 0f)
                    {
                        player.transform.position += gameObject.transform.right * currentSpeed * Time.deltaTime * Input.GetAxis("Joy1 Axis 1");
                    }
                }
            }
            catch (Exception) { }
        }
Exemplo n.º 27
0
    // Token: 0x060061A4 RID: 24996 RVA: 0x002275B8 File Offset: 0x002259B8
    protected override void SetPickerContentFromApiModel(VRCUiContentButton content, object am)
    {
        APIUser user = null;

        content.SetDetailShouldShowImage(0, false);
        content.SetDetailShouldShowImage(1, false);
        content.SetDetailShouldShowImage(2, false);
        if (am is ApiNotification)
        {
            ApiNotification notif = (ApiNotification)am;
            user = new APIUser();
            user.Init(notif);
            content.Initialize(user.currentAvatarThumbnailImageUrl, user.displayName, null, notif.id);
            APIUser.Fetch(notif.senderUserId, delegate(APIUser u)
            {
                content.Initialize(u.currentAvatarThumbnailImageUrl, u.displayName, delegate
                {
                    VRCUiPage page = VRCUiManager.Instance.GetPage("UserInterface/MenuContent/Screens/UserInfo");
                    VRCUiManager.Instance.ShowScreen(page);
                    ((PageUserInfo)page).SetupUserInfo(u, PageUserInfo.InfoType.ReceivedFriendRequest, UiUserList.ListType.None);
                    ((PageUserInfo)page).notification = notif;
                }, notif.id);
            }, null);
        }
        else
        {
            user = (APIUser)am;
            content.Initialize(user.currentAvatarThumbnailImageUrl, user.displayName, delegate
            {
                PageUserInfo.InfoType infoType = PageUserInfo.InfoType.NotFriends;
                VRCUiPage page = VRCUiManager.Instance.GetPage("UserInterface/MenuContent/Screens/UserInfo");
                VRCUiManager.Instance.ShowScreen(page);
                bool flag = false;
                if (APIUser.CurrentUser.friends != null)
                {
                    flag = (APIUser.CurrentUser.friends.Find((APIUser u) => u.id == user.id) != null);
                }
                switch (this.listType)
                {
                case UiUserList.ListType.InWorld:
                    if (flag)
                    {
                        infoType = PageUserInfo.InfoType.OnlineFriend;
                    }
                    else
                    {
                        infoType = PageUserInfo.InfoType.NotFriends;
                    }
                    break;

                case UiUserList.ListType.FriendRequests:
                    infoType = PageUserInfo.InfoType.ReceivedFriendRequest;
                    break;

                case UiUserList.ListType.OnlineFriends:
                    infoType = PageUserInfo.InfoType.OnlineFriend;
                    break;

                case UiUserList.ListType.OfflineFriends:
                    infoType = PageUserInfo.InfoType.OfflineFriend;
                    break;

                case UiUserList.ListType.Invites:
                    infoType = PageUserInfo.InfoType.Invited;
                    break;

                case UiUserList.ListType.HelpRequests:
                    infoType = PageUserInfo.InfoType.ReceivedHelpRequest;
                    break;

                case UiUserList.ListType.Search:
                    {
                        Player player = PlayerManager.GetPlayer(user.id);
                        bool flag2    = player != null && player.vrcPlayer != null && player.vrcPlayer.isInvisible;
                        if (flag)
                        {
                            infoType = ((!flag2) ? PageUserInfo.InfoType.OnlineFriend : PageUserInfo.InfoType.OfflineFriend);
                        }
                        else
                        {
                            infoType = PageUserInfo.InfoType.NotFriends;
                        }
                        break;
                    }
                }
                ((PageUserInfo)page).SetupUserInfo(user, infoType, this.listType);
            }, user.id);
        }
        if (this.listType == UiUserList.ListType.FriendRequests)
        {
            content.SetDetailShouldShowImage(2, true);
        }
        else if (ModerationManager.Instance.IsBlocked(user.id))
        {
            content.SetDetailShouldShowImage(1, true);
        }
        else if (APIUser.IsFriendsWith(user.id))
        {
            content.SetDetailShouldShowImage(0, true);
        }
    }