Example #1
0
 // Token: 0x0600572C RID: 22316 RVA: 0x001E0688 File Offset: 0x001DEA88
 private void FetchAvatar()
 {
     this.mApiAvatar = new ApiAvatar();
     this.mApiAvatar.Init();
     this.mApiAvatar.id = "avtr_no-id";
     ApiAvatar.Fetch(this.mAvatarId, new Action <ApiAvatar>(this.AvatarRecordReceived), new Action <string>(this.AvatarRecordFetchError));
 }
 void Login()
 {
     ApiCredentials.Load();
     APIUser.Login(
         delegate(APIUser user)
     {
         pipelineManager.user = user;
         if (isUpdate)
         {
             ApiAvatar.Fetch(pipelineManager.blueprintId, false,
                             delegate(ApiAvatar avatar)
             {
                 apiAvatar = avatar;
                 SetupUI();
             },
                             delegate(string message)
             {
                 apiAvatar    = new ApiAvatar();
                 apiAvatar.id = pipelineManager.blueprintId;
                 SetupUI();
             });
         }
         else
         {
             apiAvatar    = new ApiAvatar();
             apiAvatar.id = pipelineManager.blueprintId;
             SetupUI();
         }
     }, LoginErrorCallback);
 }
        void Login()
        {
            System.Action cachedLogin = delegate
            {
                pipelineManager.user = APIUser.CachedLogin(
                    delegate(APIUser user)
                {
                    pipelineManager.user = user;
                    if (isUpdate)
                    {
                        ApiAvatar.Fetch(pipelineManager.blueprintId,
                                        delegate(ApiAvatar avatar)
                        {
                            apiAvatar = avatar;
                            SetupUI();
                        },
                                        delegate(string message)
                        {
                            pipelineManager.blueprintId = "";
                            SetupUI();
                        });
                    }
                    else
                    {
                        SetupUI();
                    }
                }, LoginErrorCallback, true);
            };

            cachedLogin();
        }
Example #4
0
        protected override void OnPickerSelected(IPickerElement model)
        {
            var avatar = new ApiAvatar()
            {
                id = model.Id
            };

            if (Imports.IsDebugMode())
            {
                MelonLogger.Log($"Performing an API request for {model.Id}");
            }
            avatar.Fetch(new Action <ApiContainer>((_) =>
            {
                if (Imports.IsDebugMode())
                {
                    MelonLogger.Log($"Done an API request for {model.Id}");
                }

                var canUse = avatar.releaseStatus == "public" || avatar.authorId == APIUser.CurrentUser.id;
                if (!canUse)
                {
                    myPageAvatar.avatar.DisplayErrorAvatar();
                    myPageAvatar.avatar.field_Internal_ApiAvatar_0 = avatar; // set it directly here because refreshing will load it
                }
                else
                {
                    myPageAvatar.avatar.Refresh(avatar);
                }

                RefreshFavButtons();
            }));
        }
        void Login()
        {
            ApiCredentials.Load();
            APIUser.Login(
                delegate(APIUser user)
            {
                pipelineManager.user = user;

                ApiAvatar.Fetch(pipelineManager.blueprintId, false,
                                delegate(ApiAvatar avatar)
                {
                    apiAvatar = avatar;
                    pipelineManager.completedSDKPipeline = !string.IsNullOrEmpty(apiAvatar.authorId);
                    SetupUI();
                },
                                delegate(string message)
                {
                    apiAvatar    = new ApiAvatar();
                    apiAvatar.id = pipelineManager.blueprintId;
                    pipelineManager.completedSDKPipeline = false;
                    SetupUI();
                }
                                );
            }, LoginErrorCallback);
        }
Example #6
0
    // Token: 0x060058D9 RID: 22745 RVA: 0x001EC620 File Offset: 0x001EAA20
    private void Start()
    {
        VRC_EventHandler componentInParent = base.GetComponentInParent <VRC_EventHandler>();

        if (componentInParent != null)
        {
            for (int i = 0; i < componentInParent.Events.Count; i++)
            {
                if (componentInParent.Events[i].Name == "Use" && componentInParent.Events[i].ParameterObject == null)
                {
                    componentInParent.Events[i].ParameterObject = base.gameObject;
                }
            }
        }
        this.calibrator = base.GetComponentInParent <VRC_AvatarCalibrator>();
        this.switcher   = base.GetComponent <VRCAvatarManager>();
        VRCAvatarManager vrcavatarManager = this.switcher;

        vrcavatarManager.OnAvatarCreated = (VRCAvatarManager.AvatarCreationCallback)Delegate.Combine(vrcavatarManager.OnAvatarCreated, new VRCAvatarManager.AvatarCreationCallback(this.AvatarCreated));
        this.vrikCalib = base.GetComponent <VRCVrIkCalibrator>();
        if (!string.IsNullOrEmpty(this.calibrator.blueprintId))
        {
            ApiAvatar.Fetch(this.calibrator.blueprintId, delegate(ApiAvatar bp)
            {
                this.avatar = bp;
                this.switcher.SwitchAvatar(this.avatar, this.calibrator.scale, null);
                Tools.SetLayerRecursively(base.gameObject, base.transform.parent.gameObject.layer, -1);
            }, delegate(string message)
            {
                this.switcher.SwitchToErrorAvatar(1f);
            });
        }
    }
        protected override void OnPickerSelected(IPickerElement model)
        {
            PlaySound();

            var avatar = new ApiAvatar()
            {
                id = model.Id
            };

            if (Imports.IsDebugMode())
            {
                MelonLogger.Log($"Performing an API request for {model.Id}");
            }
            avatar.Fetch(new Action <ApiContainer>((_) =>
            {
                if (Imports.IsDebugMode())
                {
                    MelonLogger.Log($"Done an API request for {model.Id}");
                }

                FavCatMod.Database?.UpdateStoredAvatar(avatar);

                var canUse = avatar.releaseStatus == "public" || avatar.authorId == APIUser.CurrentUser.id;
                if (!canUse)
                {
                    myPageAvatar.field_Public_SimpleAvatarPedestal_0.DisplayErrorAvatar();
                    myPageAvatar.field_Public_SimpleAvatarPedestal_0.field_Internal_ApiAvatar_0 = avatar; // set it directly here because refreshing will load it
                }
                else
                {
                    myPageAvatar.field_Public_SimpleAvatarPedestal_0.Refresh(avatar);
                }

                // VRC has a tendency to change visibility of its lists after pedestal refresh
                ReorderLists();
                RefreshFavButtons();
            }), new Action <ApiContainer>(c =>
            {
                if (Imports.IsDebugMode())
                {
                    MelonLogger.Log("API request errored with " + c.Code + " - " + c.Error);
                }
                if (c.Code == 404 && listsParent.gameObject.activeInHierarchy)
                {
                    FavCatMod.Database.CompletelyDeleteAvatar(model.Id);
                    var menu = ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescription.WideSlimList);
                    menu.AddSpacer();
                    menu.AddSpacer();
                    menu.AddLabel("This avatar is not available anymore (deleted)");
                    menu.AddLabel("It has been removed from all favorite lists");
                    menu.AddSpacer();
                    menu.AddSpacer();
                    menu.AddSpacer();
                    menu.AddSimpleButton("Close", menu.Hide);
                    menu.Show();
                }
            }));
        }
Example #8
0
 // Token: 0x06005775 RID: 22389 RVA: 0x001E1E20 File Offset: 0x001E0220
 public void SwitchToFallbackAvatar(float scale = 1f, VRCAvatarManager.AvatarCreationCallback onAvatarLoaded = null)
 {
     ApiAvatar.Fetch(this.fallbackAvatarId, delegate(ApiAvatar avatar)
     {
         this.SwitchAvatar(avatar, scale, onAvatarLoaded);
     }, delegate(string message)
     {
         this.SwitchToErrorAvatar(1f);
     });
 }
Example #9
0
        protected override void OnPickerSelected(IPickerElement model)
        {
            PlaySound();

            if (FavCatSettings.AvatarSearchMode.Value == "author")
            {
                FavCatMod.Instance.playerModule?.OnPickerSelected(((IStoredModelAdapter <StoredAvatar>)model).Model.AuthorId, listsParent.gameObject); //TO-FIX
                return;
            }

            var avatar = new ApiAvatar()
            {
                id = model.Id
            };

            if (MelonDebug.IsEnabled())
            {
                MelonDebug.Msg($"Performing an API request for {model.Id}");
            }
            avatar.Fetch(new Action <ApiContainer>((_) =>
            {
                if (MelonDebug.IsEnabled())
                {
                    MelonDebug.Msg($"Done an API request for {model.Id}");
                }

                FavCatMod.Database?.UpdateStoredAvatar(avatar);

                myPageAvatar.field_Public_SimpleAvatarPedestal_0.Refresh(avatar);

                // VRC has a tendency to change visibility of its lists after pedestal refresh
                ReorderLists();
                RefreshFavButtons();
            }), new Action <ApiContainer>(c =>
            {
                if (MelonDebug.IsEnabled())
                {
                    MelonDebug.Msg("API request errored with " + c.Code + " - " + c.Error);
                }
                if (c.Code == 404 && listsParent.gameObject.activeInHierarchy)
                {
                    FavCatMod.Database.CompletelyDeleteAvatar(model.Id);
                    var menu = ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescription.WideSlimList);
                    menu.AddSpacer();
                    menu.AddSpacer();
                    menu.AddLabel("This avatar is not available anymore (deleted or privated)");
                    menu.AddLabel("It has been removed from all favorite lists");
                    menu.AddSpacer();
                    menu.AddSpacer();
                    menu.AddSpacer();
                    menu.AddSimpleButton("Close", menu.Hide);
                    menu.Show();
                }
            }));
        }
Example #10
0
 // Token: 0x0600572E RID: 22318 RVA: 0x001E06EC File Offset: 0x001DEAEC
 private void AvatarRecordFetchError(string error)
 {
     Debug.LogError("ApiAvatar: Couldn't fetch user's avatar, switching to default. Error: " + error);
     ApiAvatar.Fetch("avtr_53856003-8ff2-4002-b78f-da5d028b22bd", delegate(ApiAvatar avatar)
     {
         this.SetCurrentAvatar(avatar);
     }, delegate(string errorStr)
     {
         Debug.LogError("ApiAvatar: Couldn't set default avatar: " + errorStr);
         User.SetNetworkProperties();
     });
 }
Example #11
0
        public void SaveAvatarId()
        {
            ApiAvatar apiAvatar = new ApiAvatar();

            apiAvatar.id = ConsoleUtils.AskInput("Enter avatar ID: ");
            apiAvatar.Fetch(delegate(ApiContainer success)
            {
                AvatarUtils.SaveAvatar(success.Model as ApiAvatar, ConsoleUtils.AskInput("Enter avatar's name: "), "");
            }, delegate(ApiContainer error)
            {
                Console.WriteLine("Error saving avatar: {0}", error.Error);
            }, null, false);
        }
Example #12
0
 // Token: 0x060058E1 RID: 22753 RVA: 0x001EC990 File Offset: 0x001EAD90
 private void refreshId()
 {
     if (!string.IsNullOrEmpty(this.pedestal.blueprintId))
     {
         ApiAvatar.Fetch(this.pedestal.blueprintId, delegate(ApiAvatar bp)
         {
             this.avatar = bp;
             this.switcher.SwitchAvatar(this.avatar, this.pedestal.scale, null);
             Tools.SetLayerRecursively(base.gameObject, base.transform.parent.gameObject.layer, -1);
         }, delegate(string message)
         {
             this.switcher.SwitchToErrorAvatar(1f);
             this.loadedErrorAvatar = true;
         });
         this.currId = this.pedestal.blueprintId;
     }
 }
Example #13
0
 public void LoadAvatar(string npcName, string blueprintId, float scale = 1f)
 {
     this.playerName = npcName;
     if (this.nameTag != null)
     {
         this.nameTag.text = this.playerName;
     }
     if (this.animationController != null)
     {
         this.animationController.Detach();
     }
     if (!string.IsNullOrEmpty(blueprintId))
     {
         ApiAvatar.Fetch(blueprintId, delegate(ApiAvatar bp)
         {
             this.apiAvatar = bp;
             this.avatarSwitcher.SwitchAvatar(this.apiAvatar, scale, null);
         }, delegate(string message)
         {
             this.avatarSwitcher.SwitchToErrorAvatar(1f);
         });
     }
 }
Example #14
0
 static void smethod_52(string string_0, Action <ApiAvatar> action_0, Action <string> action_1)
 {
     ApiAvatar.Fetch(string_0, action_0, action_1);
 }
Example #15
0
        public void Update()
        {
            APIUser   selectedUser = QuickMenu.Instance.SelectedUser;
            VRCPlayer vrcLocal     = PlayerManager.GetCurrentPlayer().vrcPlayer;


            if (selectedUser != null && !Event.current.control)
            {
                VRCPlayer vrcSelected = PlayerManager.GetPlayer(selectedUser.id).vrcPlayer;

                if (Input.GetMouseButtonDown(1))
                {
                    System.Console.WriteLine("Copied {0}'s avatar!", selectedUser.displayName);
                    User.CurrentUser.SetCurrentAvatar(vrcSelected.GetApiAvatar());
                }

                if (Input.GetMouseButtonDown(2))
                {
                    ApiAvatar apiAvatar  = vrcSelected.GetApiAvatar();
                    ApiAvatar apiAvatar2 = new ApiAvatar();
                    Cheat.SetForegroundWindow(Cheat.GetConsoleWindow());

                    System.Console.Write("Enter avatar's name: ");
                    string avatarName = System.Console.ReadLine();

                    System.Console.Write("Enter image URL: ");
                    string avatarImageURL = System.Console.ReadLine();

                    System.Console.Write("Enter avatar description: ");
                    string avatarDesc = System.Console.ReadLine();

                    apiAvatar2.Init(User.CurrentUser, avatarName, avatarImageURL, apiAvatar.assetUrl, avatarDesc, apiAvatar.tags, apiAvatar.unityPackageUrl);
                    apiAvatar2.Save(MainClass.avatarSaved, MainClass.avatarError);
                }

                if (Input.GetKeyDown(KeyCode.T))
                {
                    PlayerManager.GetCurrentPlayer().transform.position = vrcSelected.transform.position;
                    PlayerManager.GetCurrentPlayer().transform.rotation = vrcSelected.transform.rotation;
                }

                if (Input.GetKeyDown(KeyCode.N))
                {
                    PhotonNetwork.playerName = selectedUser.displayName;

                    Hashtable propertiesToSet = new Hashtable
                    {
                        {
                            "userId",
                            User.CurrentUser.id
                        }
                    };

                    PhotonNetwork.player.SetCustomProperties(propertiesToSet, null, false);
                }
            }

            else if (Event.current.control)
            {
                if (Input.GetKeyDown(KeyCode.N))
                {
                    Cheat.SetForegroundWindow(Cheat.GetConsoleWindow());
                    System.Console.Write("Enter new name: ");
                    PhotonNetwork.playerName = System.Console.ReadLine();

                    Hashtable propertiesToSet2 = new Hashtable
                    {
                        {
                            "userId",
                            User.CurrentUser.id
                        }
                    };

                    PhotonNetwork.player.SetCustomProperties(propertiesToSet2, null, false);
                }

                if (Input.GetKeyDown(KeyCode.B))
                {
                    ApiAvatar apiAvatar = vrcLocal.GetApiAvatar();

                    System.Console.Write("Enter image URL: ");

                    apiAvatar.imageUrl = System.Console.ReadLine();

                    apiAvatar.Save(MainClass.avatarSaved, MainClass.avatarError);

                    selectedUser.SetCurrentAvatar(apiAvatar);
                }

                if (Input.GetKeyDown(KeyCode.G))
                {
                    Cheat.Class6 @class = new Cheat.Class6();
                    System.Console.Clear();
                    System.Console.WriteLine(string.Join(", ", PlayerManager.GetAllPlayers().Select(new Func <Player, string>(Cheat.MainClass.getDisplayName)).ToArray <string>()));
                    Cheat.SetForegroundWindow(Cheat.GetConsoleWindow());
                    System.Console.Write("Teleport to: ");
                    @class.string_0 = System.Console.ReadLine().ToLower();
                    if (@class.string_0 != string.Empty)
                    {
                        Player player = PlayerManager.GetAllPlayers().FirstOrDefault(new Func <Player, bool>(@class.method_0));
                        if (player != null)
                        {
                            System.Console.WriteLine("Teleporting to {0}", player.user.displayName);
                            PlayerManager.GetCurrentPlayer().transform.position = player.transform.position;
                            PlayerManager.GetCurrentPlayer().transform.rotation = player.transform.rotation;
                        }
                    }
                }

                if (Input.GetKeyDown(KeyCode.Delete))
                {
                    System.Console.WriteLine("Avatar(\"{0}\", {1}) deleted!", User.CurrentUser.apiAvatar.name, User.CurrentUser.apiAvatar.id);
                    ApiAvatar.Delete(User.CurrentUser.apiAvatar.id, new Action(Cheat.MainClass.avatarDel), new Action <string>(Cheat.MainClass.avatarDelError));
                }

                if (Input.GetKeyDown(KeyCode.M))
                {
                    new Thread(new ThreadStart(Cheat.MainClass.pickupItemsToMe)).Start();
                }

                if (Input.GetKeyDown(KeyCode.B))
                {
                    ApiAvatar avatar = vrcLocal.GetApiAvatar();

                    System.Console.WriteLine(avatar.name + ":" + avatar.assetUrl + ":" + avatar.assetVersion + ":" + avatar.authorId + ":" + avatar.authorName + ":" + avatar.id + ":" + avatar.imageUrl);
                }

                if (Input.GetMouseButtonDown(2))
                {
                    System.Console.Write("Enter avatar ID: ");
                    Cheat.SetForegroundWindow(Cheat.GetConsoleWindow());
                    ApiAvatar.Fetch(System.Console.ReadLine(), Cheat.MainClass.saveAvatar, Cheat.MainClass.method_16);
                }

                if (Input.GetKeyDown(KeyCode.O))
                {
                    Cheat.FollowUser followUser = new Cheat.FollowUser();
                    Cheat.SetForegroundWindow(Cheat.GetConsoleWindow());
                    System.Console.Write("Follow: ");
                    followUser.UserName = System.Console.ReadLine();
                    APIUser.FetchUsers(followUser.UserName, followUser.onSuccess, Cheat.MainClass.fetchUserErr);
                }

                if (Input.GetKeyDown(KeyCode.F))
                {
                    this.speedhack = !this.speedhack;
                    if (this.speedhack)
                    {
                        this.vector3_0  = Physics.gravity;
                        Physics.gravity = Vector3.zero;
                    }
                    else
                    {
                        Physics.gravity = this.vector3_0;
                    }
                }

                if (Input.GetKeyDown(KeyCode.R))
                {
                    this.flyMode = !this.flyMode;
                }
            }

            if (this.locomotionInputController == null)
            {
                this.locomotionInputController = vrcLocal.GetComponent <LocomotionInputController>();
                this.vrcmotionState            = (VRCMotionState)typeof(LocomotionInputController).GetField("motionState", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(this.locomotionInputController);
            }

            bool key = Input.GetKey(KeyCode.LeftShift);

            if (this.speedhack)
            {
                this.vrcmotionState.Reset();
                Vector3 position = vrcLocal.transform.position;

                if (Input.GetKey(KeyCode.E))
                {
                    vrcLocal.transform.position = new Vector3(position.x, position.y + (float)(key ? 15 : 4) * Time.deltaTime, position.z);
                }

                if (Input.GetKey(KeyCode.Q))
                {
                    vrcLocal.transform.position = new Vector3(position.x, position.y - (float)(key ? 15 : 4) * Time.deltaTime, position.z);
                }
            }

            this.locomotionInputController.strafeSpeed = (float)(this.speedhack ? (key ? 15 : 4) : (key ? 8 : 2));
            this.locomotionInputController.runSpeed    = (float)(this.speedhack ? 15 : 4);

            if (this.flyMode && DateTime.Now.Millisecond % 500 <= 10)
            {
                if (this.randomName)
                {
                    PhotonNetwork.playerName = Path.GetRandomFileName();
                    Hashtable propertiesToSet3 = new Hashtable
                    {
                        {
                            "userId",
                            User.CurrentUser.id
                        }
                    };
                    PhotonNetwork.player.SetCustomProperties(propertiesToSet3, null, false);
                    this.randomName = false;
                    return;
                }
            }
            else
            {
                this.randomName = true;
            }
        }