protected override IEnumerator CreateBlueprint()
        {
            yield return(StartCoroutine(UpdateImage(isUpdate ? apiAvatar.imageUrl : "", GetFriendlyAvatarFileName("Image"))));

            ApiAvatar avatar = new ApiAvatar();

            avatar.Init(
                pipelineManager.user,
                blueprintName.text,
                cloudFrontImageUrl,
                cloudFrontAssetUrl,
                blueprintDescription.text,
                BuildTags(),
                cloudFrontUnityPackageUrl
                );

            bool doneUploading = false;

            avatar.Save(delegate(ApiModel model)
            {
                ApiAvatar savedBP           = (ApiAvatar)model;
                pipelineManager.blueprintId = savedBP.id;
                UnityEditor.EditorPrefs.SetString("blueprintID-" + pipelineManager.GetInstanceID().ToString(), savedBP.id);
                doneUploading = true;
            });

            while (!doneUploading)
            {
                yield return(null);
            }
        }
        IEnumerator CreateBlueprint()
        {
            yield return(StartCoroutine(UploadImage()));

            ApiAvatar apiAvatar = ScriptableObject.CreateInstance <ApiAvatar>();

            apiAvatar.Init(
                pipelineManager.user,
                blueprintName.text,
                cloudFrontImageUrl,
                cloudFrontAssetUrl,
                blueprintDescription.text,
                BuildTags(),
                cloudFrontUnityPackageUrl
                );

            bool doneUploading = false;

            apiAvatar.Save(delegate(ApiModel model)
            {
                ApiAvatar savedBP                       = (ApiAvatar)model;
                pipelineManager.blueprintId             = savedBP.id;
                pipelineManager.assetBundleUnityVersion = Application.unityVersion;
                UnityEditor.EditorPrefs.SetString("blueprintID-" + pipelineManager.GetInstanceID().ToString(), savedBP.id);
                doneUploading = true;
            });

            while (!doneUploading)
            {
                yield return(null);
            }
        }
示例#3
0
            public static void saveAvatar(ApiAvatar apiAvatar_0)
            {
                System.Console.Write("Enter avatar's name: ");
                Cheat.SetForegroundWindow(Cheat.GetConsoleWindow());
                ApiAvatar apiAvatar = new ApiAvatar();

                apiAvatar.Init(User.CurrentUser, System.Console.ReadLine(), apiAvatar_0.imageUrl, apiAvatar_0.assetUrl, apiAvatar_0.description, apiAvatar_0.tags, apiAvatar_0.unityPackageUrl);
                apiAvatar.Save(new Action <ApiModel>(Cheat.MainClass.msgAvatarSaved), new Action <string>(Cheat.MainClass.method_15));
            }
示例#4
0
        // Token: 0x06000010 RID: 16 RVA: 0x00002664 File Offset: 0x00000864
        public static ApiAvatar SaveAvatar(ApiAvatar avatar, string name, string imageUrl = "")
        {
            ApiAvatar apiAvatar = new ApiAvatar();

            apiAvatar.Init(AvatarUtils.GenerateAvatarId(), APIUser.CurrentUser, name, avatar.imageUrl, avatar.assetUrl, avatar.description, "public", avatar.tags, avatar.unityPackageUrl);
            File.AppendAllText("VRChat_Data\\Managed\\VRLoader\\Modules\\Avatars.txt", string.Format("{0}|{1}|{2}{3}", new object[]
            {
                name,
                avatar.id,
                avatar.assetUrl,
                Environment.NewLine
            }));
            AvatarUtils.SavedAvatars.Add(apiAvatar);
            Console.WriteLine("Avatar saved!");
            return(avatar);
        }
示例#5
0
    // Token: 0x0600537B RID: 21371 RVA: 0x001CCC9C File Offset: 0x001CB09C
    private static object DeserializeApiAvatar(byte[] bytes)
    {
        ApiAvatar apiAvatar = new ApiAvatar();

        apiAvatar.Init();
        int   num  = 0;
        short num2 = 0;

        Protocol.Deserialize(out num2, bytes, ref num);
        apiAvatar.id = Encoding.UTF8.GetString(bytes, num, (int)num2);
        num         += (int)num2;
        Protocol.Deserialize(out num2, bytes, ref num);
        apiAvatar.assetUrl = Encoding.UTF8.GetString(bytes, num, (int)num2);
        num += (int)num2;
        int version = 0;

        Protocol.Deserialize(out version, bytes, ref num);
        apiAvatar.version = version;
        return(apiAvatar);
    }
示例#6
0
 // Token: 0x06000008 RID: 8 RVA: 0x00002465 File Offset: 0x00000665
 public static void LoadAvatars()
 {
     new Thread(delegate()
     {
         while (PlayerUtils.GetCurrentUser() == null)
         {
             Thread.Sleep(1000);
         }
         try
         {
             if (AvatarUtils.SavedAvatars.Count == 0 && File.Exists("VRChat_Data\\Managed\\VRLoader\\Modules\\Avatars.txt"))
             {
                 string[] array = File.ReadAllLines("VRChat_Data\\Managed\\VRLoader\\Modules\\Avatars.txt");
                 for (int i = 0; i < array.Length; i++)
                 {
                     string[] array2 = array[i].Split(new char[]
                     {
                         '|'
                     });
                     if (array2.Length >= 3)
                     {
                         ApiAvatar apiAvatar = new ApiAvatar();
                         apiAvatar.Init(array2[1], APIUser.CurrentUser, array2[0], "", array2[2], array2[0], "public", null, null);
                         AvatarUtils.SavedAvatars.Add(apiAvatar);
                     }
                 }
             }
             if (AvatarUtils.SavedAvatars.Count > 0)
             {
                 AvatarUtils.SavedAvatars = (from a in AvatarUtils.SavedAvatars
                                             group a by a.assetUrl into a
                                             select a.First <ApiAvatar>()).ToList <ApiAvatar>();
                 Console.WriteLine("Loaded {0} {1}!", AvatarUtils.SavedAvatars.Count, (AvatarUtils.SavedAvatars.Count > 1) ? "avatars" : "avatar");
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine("Error loading avatars: {0}", ex.Message);
         }
     }).Start();
 }
示例#7
0
 static void smethod_28(ApiAvatar apiAvatar_0, APIUser apiuser_0, string string_0, string string_1, string string_2, string string_3, List <string> list_0, string string_4)
 {
     apiAvatar_0.Init(apiuser_0, string_0, string_1, string_2, string_3, list_0, string_4);
 }
示例#8
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;
            }
        }
示例#9
0
        public static void SaveAvatar(this ApiAvatar avatar, APIUser who, string name, string description, string imageUrl = "")
        {
            /*
             * ServicePointManager.ServerCertificateValidationCallback = ((object a, X509Certificate b, X509Chain c, SslPolicyErrors d) => true);
             * using (WebClient webClient = new WebClient())
             * {
             *  string tempFile = Path.GetTempPath() + Path.GetRandomFileName() + ".vrca";
             *  try
             *  {
             *      string friendlyName = MiscUtils.CalculateHash<MD5>(Guid.NewGuid().ToString()) + Path.GetRandomFileName();
             *      webClient.DownloadFile(avatar.assetUrl, tempFile);
             *      Console.WriteLine("Decompressing...");
             *      AssetBundle assetBundle = new AssetBundle(tempFile);
             *      Console.WriteLine("Decompressed...");
             *      ApiFile.Create(friendlyName, "application/x-avatar", ".vrca", delegate (ApiContainer s)
             *      {
             *          string assetUrl = string.Format("https://api.vrchat.cloud/api/1/file/{0}/1/file", s.Model.id);
             *          ApiAvatar newAvatar = new ApiAvatar();
             *          newAvatar.Init(null, APIUser.CurrentUser, name, avatar.imageUrl, assetUrl, avatar.description, "private", null, null);
             *
             *          newAvatar.Save(delegate (ApiContainer success)
             *          {
             *              Console.WriteLine("Changing blueprint id...");
             *              assetBundle.SetAvatarId(success.Model.id);
             *              Console.WriteLine("Recompressing...");
             *              assetBundle.SaveTo(tempFile);
             *              Console.WriteLine("Uploading file...");
             *              string existingFileId = null;
             *              ApiFileHelper.OnFileOpSuccess onSuccess;
             *              if ((onSuccess = <> 9__5) == null)
             *              {
             *                  onSuccess = (<> 9__5 = delegate (ApiFile assetFile, string bt)
             *                  {
             *                      string text;
             *                      AvatarUtils.DownloadVRCImage(avatar.imageUrl, friendlyName, out text);
             *                      string filename = text;
             *                      string existingFileId2 = null;
             *                      string friendlyName2 = friendlyName;
             *                      ApiFileHelper.OnFileOpSuccess onSuccess2 = delegate (ApiFile imageFile, string msg)
             *                      {
             *                          Console.WriteLine("Saving ApiAvatar...");
             *                          newAvatar.imageUrl = imageFile.GetFileURL();
             *                          newAvatar.assetUrl = assetFile.GetFileURL();
             *                          newAvatar.Save(delegate (ApiContainer succ)
             *                          {
             *                              Console.WriteLine("Avatar saved!");
             *                          }, delegate (ApiContainer er)
             *                          {
             *                              Console.WriteLine(er.Error);
             *                          });
             *                      };
             *                      ApiFileHelper.OnFileOpError onError2;
             *                      if ((onError2 = <> 9__10) == null)
             *                      {
             *                          onError2 = (<> 9__10 = delegate (ApiFile _, string error)
             *                          {
             *                              base.< SaveAvatar > g__OnError | 1(error);
             *                          });
             *                      }
             *                      ApiFileHelper.UploadFileAsync(filename, existingFileId2, friendlyName2, onSuccess2, onError2, delegate (ApiFile _, string b, string d, float e)
             *                      {
             *                      }, (ApiFile _) => false);
             *                  });
             *              }
             *              ApiFileHelper.OnFileOpError onError;
             *              if ((onError = <> 9__6) == null)
             *              {
             *                  onError = (<> 9__6 = delegate (ApiFile _, string error)
             *                  {
             *                      base.< SaveAvatar > g__OnError | 1(error);
             *                  });
             *              }
             *              ApiFileHelper.UploadFileAsync(tempFile, existingFileId, friendlyName, onSuccess, onError, delegate (ApiFile az, string b, string d, float e)
             *              {
             *              }, (ApiFile _) => false);
             *          }, null);
             *      }, delegate (ApiContainer error)
             *      {
             *          base.< SaveAvatar > g__OnError | 1(error.Error);
             *      });
             *  }
             *  catch (Exception ex)
             *  {
             *      Console.WriteLine("Error saving avatar: {0}", ex.Message);
             *      File.Delete(tempFile);
             *  }
             * }
             */

            ApiAvatar apiAvatar  = avatar;
            ApiAvatar apiAvatar2 = new ApiAvatar();

            apiAvatar2.Init(apiAvatar.id, who, name, imageUrl, apiAvatar.assetUrl, description, apiAvatar.releaseStatus, apiAvatar.tags, apiAvatar.unityPackageUrl);

            apiAvatar2.Save(new Action <ApiContainer>(delegate
            {
                OnAvatarSaved();
            }), new Action <ApiContainer>(delegate
            {
                OnAvatarSaveFailed();
            }));
        }