Exemple #1
0
        public static void JoinRoom(this PhantomClient client, string RoomID)
        {
            EnterRoomParams parms = new EnterRoomParams()
            {
                RoomName          = RoomID,
                CreateIfNotExists = true,
            };
            RoomOptions options = new RoomOptions()
            {
                IsOpen     = true,
                IsVisible  = true,
                MaxPlayers = Convert.ToByte(GetCapacityOfWorld(RoomID) * 2)
            };
            Hashtable table = new Hashtable()
            {
                ["name"] = "name"
            };

            options.CustomRoomProperties = table;
            parms.RoomOptions            = options;
            string[] customroompropertiesforlobby = new string[]
            {
                "name"
            };
            options.CustomRoomPropertiesForLobby = customroompropertiesforlobby;
            options.EmptyRoomTtl         = 0;
            options.DeleteNullProperties = true;
            options.PublishUserId        = false;
            client.OpJoinRoom(parms);
        }
Exemple #2
0
        public static Hashtable Instantiate(this PhantomClient client, string prefabName, Vector3 position, Quaternion rotation, int[] viewIDs)
        {
            Hashtable hashtable = new Hashtable();

            hashtable[(byte)0] = prefabName;
            hashtable[(byte)1] = position;
            hashtable[(byte)2] = rotation;
            hashtable[(byte)4] = viewIDs;
            hashtable[(byte)6] = client.LoadBalancingPeer.ServerTimeInMilliSeconds;
            hashtable[(byte)7] = viewIDs[0];
            hashtable[(byte)8] = 1;

            client.OpRaiseEvent(202, hashtable, new RaiseEventOptions
            {
                CachingOption = EventCaching.AddToRoomCache,
                Receivers     = ReceiverGroup.Others,
            }, new SendOptions()
            {
                DeliveryMode = DeliveryMode.Reliable,
                Reliability  = true,
                Encrypt      = false,
                Channel      = 1
            });

            return(hashtable);
        }
Exemple #3
0
        public static void RegisterTypes(this PhantomClient client)
        {
            Type              typeFromHandle = typeof(Vector3);
            byte              code           = 86;
            SerializeMethod   Serialize1     = new SerializeMethod(JFAFAPNBFLC);
            DeserializeMethod DeSerialize1   = new DeserializeMethod(IKFICLDHAOI);

            PhotonPeer.RegisterType(typeFromHandle, code, Serialize1, DeSerialize1);
            Type              typeFromHandle2 = typeof(Quaternion);
            byte              code2           = 81;
            SerializeMethod   Serialize2      = new SerializeMethod(FECGOFBPKPP);
            DeserializeMethod DeSerialize2    = new DeserializeMethod(KCFONHKNDJH);

            PhotonPeer.RegisterType(typeFromHandle2, code2, Serialize2, DeSerialize2);
            byte              b = 100;
            Type              typeFromHandle3 = typeof(Vector2);
            SerializeMethod   Serialize3      = new SerializeMethod(KMIBNBFAHEN);
            DeserializeMethod DeSerialize3    = new DeserializeMethod(HHBPLJKDKPI);

            GCJHKDFNJEA(typeFromHandle3, ref b, Serialize3, DeSerialize3);
            Type              typeFromHandle4 = typeof(Vector4);
            SerializeMethod   Serialize4      = new SerializeMethod(DFMLPAEPHJD);
            DeserializeMethod DeSerialize4    = new DeserializeMethod(GPJDPFFENPL);

            GCJHKDFNJEA(typeFromHandle4, ref b, Serialize4, DeSerialize4);
        }
Exemple #4
0
        public static Player GetPlayer(this PhantomClient client, int actorID)
        {
            foreach (var Player in client.CurrentRoom.Players.Values)
            {
                if (Player.ActorNumber == actorID)
                {
                    return(Player);
                }
            }

            return(null);
        }
Exemple #5
0
        public static void SetCustomProperties(this PhantomClient client, string authCookie, string userID, string avatarID)
        {
            HttpClientHandler handler = new HttpClientHandler();

            handler.CookieContainer = new CookieContainer();
            Uri target = new Uri("https://www.vrchat.com");

            handler.CookieContainer.Add(new Cookie("auth", authCookie)
            {
                Domain = target.Host
            });
            HttpClient http = new HttpClient(handler);

            _ = http.PutAsync($"https://www.vrchat.com/api/1/users/{userID}/avatar?apiKey=JlE5Jldo5Jibnk5O5hTx6XVqsJu4WJ26", new StringContent("{\"avatarId\":\"" + avatarID + "\"}", Encoding.UTF8, "application/json"));

            Dictionary <string, object> userProperties = new Dictionary <string, object>();

            userProperties["id"] = userID;

            var json = JsonConvert.DeserializeObject <AvatarInformation>(http.GetAsync($"https://www.vrchat.com/api/1/avatars/{avatarID}?apiKey=JlE5Jldo5Jibnk5O5hTx6XVqsJu4WJ26").Result.Content.ReadAsStringAsync().Result);
            Dictionary <string, object> avatarProperties = new Dictionary <string, object>();
            Dictionary <string, object> UnityPackages    = new Dictionary <string, object>();

            var unityPackage = json.unityPackages[0];

            UnityPackages.Add("id", unityPackage.id);
            UnityPackages.Add("assetUrl", unityPackage.assetUrl);
            UnityPackages.Add("assetUrlObject", "{}");
            UnityPackages.Add("unityVersion", unityPackage.unityVersion);
            UnityPackages.Add("unitySortNumber", unityPackage.unitySortNumber);
            UnityPackages.Add("assetVersion", unityPackage.assetVersion);
            UnityPackages.Add("platform", unityPackage.platform);
            UnityPackages.Add("created_at", unityPackage.created_at.ToShortDateString());

            avatarProperties.Add("name", json.name);
            avatarProperties.Add("description", json.description);
            avatarProperties.Add("authorId", json.authorId);
            avatarProperties.Add("authorName", json.authorName);
            avatarProperties.Add("imageUrl", json.imageUrl);
            avatarProperties.Add("thumbnailImageUrl", json.thumbnailImageUrl);
            avatarProperties.Add("assetUrl", json.assetUrl);
            avatarProperties.Add("assetUrlObject", "{}");
            avatarProperties.Add("tags", json.tags);
            avatarProperties.Add("releaseStatus", json.releaseStatus);
            avatarProperties.Add("version", json.version);
            avatarProperties.Add("unityPackageUrl", json.unityPackageUrl);
            avatarProperties.Add("unityVersion", json.unityVersion);
            avatarProperties.Add("assetVersion", json.assetVersion);
            avatarProperties.Add("platform", json.platform);
            avatarProperties.Add("featured", json.featured);
            avatarProperties.Add("imported", json.imported);
            avatarProperties.Add("id", json.id);
            avatarProperties.Add("created_at", json.created_at.ToShortDateString());
            avatarProperties.Add("updated_at", json.updated_at.ToShortDateString());
            avatarProperties.Add("unityPackages", UnityPackages);

            Hashtable hashtable = new Hashtable();

            hashtable["user"]              = userProperties;
            hashtable["avatarDict"]        = avatarProperties;
            hashtable["modTag"]            = string.Empty;
            hashtable["isInvisible"]       = false;
            hashtable["avatarVariations"]  = avatarProperties["id"];
            hashtable["status"]            = "active";
            hashtable["statusDescription"] = "oi";
            hashtable["inVRMode"]          = false;
            hashtable["showSocialRank"]    = true;
            hashtable["steamUserID"]       = "0";

            client.LocalPlayer.SetCustomProperties(hashtable);
        }