Exemplo n.º 1
0
        void FindMods()
        {
            var result     = new List <Type>();
            var assemblies = AppDomain.CurrentDomain.GetAssemblies();

            //get all types that are children of vrmod
            foreach (var assembly in assemblies)
            {
                var types = assembly.GetTypes();
                foreach (var type in types)
                {
                    if (type.IsSubclassOf(typeof(VRmod)))
                    {
                        result.Add(type);
                    }
                }
            }

            //add all items from result list to Mods list that will be loaded
            foreach (var item in result)
            {
                var instance = Activator.CreateInstance(item);
                IceLoader.Main.Mods.Add((VRmod)instance);
            }

            //sort Mods by their LoadOrder property and add them again to load in correct order
            List <VRmod> sortedModList = IceLoader.Main.Mods.OrderBy(owo => owo.LoadOrder).ToList();

            IceLoader.Main.Mods.Clear();
            foreach (var mod in sortedModList)
            {
                IceLoader.Main.Mods.Add(mod);
                IceLogger.Log(ConsoleColor.Blue, $"{mod} Loaded!");
            }
        }
Exemplo n.º 2
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.º 3
0
 public static void RestoreOriginalColliderList()
 {
     foreach (KeyValuePair <string, Tuple <GameObject, bool, DynamicBone[], DynamicBoneCollider[], bool> > player in avatarsInScene)
     {
         IceLogger.Log($"Restoring original settings for player {player.Key}");
         foreach (DynamicBone db in player.Value.Item3)
         {
             if (originalSettings.TryGetValue(player.Key, out List <OriginalBoneInformation> origList))
             {
                 try
                 {
                     origList.DoIf((x) => ReferenceEquals(x, db), (origData) =>
                     {
                         db.m_Colliders.Clear();
                         origData.colliders.ForEach((dbc) => db.m_Colliders.Add(dbc));
                         db.m_DistanceToObject = origData.distanceToDisable;
                         db.m_UpdateRate       = origData.updateRate;
                         db.m_DistantDisable   = origData.distantDisable;
                     });
                 }
                 catch (Exception e)
                 {
                     IceLogger.Log(e.ToString());
                 }
             }
             else
             {
                 IceLogger.Log($"Warning: could not find original dynamic bone info for {player.Key}'s bone {db.gameObject.name} . This means his bones won't be disabled!");
             }
         }
     }
 }
Exemplo n.º 4
0
        public override void OnUpdate()
        {
            if (avatarRenderers != null)
            {
                if (avatarRenderers.Count != 0 && NDBConfig.enableBoundsCheck)
                {
                    EnableIfVisible();
                }
            }

            if (!NDBConfig.keybindsEnabled)
            {
                return;
            }

            if (Input.GetKeyDown(KeyCode.F11))
            {
                IceLogger.Log("My bones have the following colliders attached:");
                avatarsInScene.Values.First((tup) => tup.Item1 == localPlayer).Item3.DoIf((bone) => bone != null, (bone) =>
                {
                    bone.m_Colliders.ToArray().Do((dbc) =>
                    {
                        try
                        {
                            IceLogger.Log($"Bone {bone?.m_Root.name ?? "null"} has {dbc?.gameObject.name ?? "null"}");
                        }
                        catch (Exception) { };
                    });
                });

                IceLogger.Log($"There are {avatarsInScene.Values.Aggregate(0, (acc, tup) => acc += tup.Item3.Length)} Dynamic Bones in scene");
                IceLogger.Log($"There are {avatarsInScene.Values.Aggregate(0, (acc, tup) => acc += tup.Item4.Length)} Dynamic Bones Colliders in scene");
            }
        }
Exemplo n.º 5
0
 public override void OnStart()
 {
     DropPortalToPlayer = new SocialSingleButton(0, -76.0f, "Drop portal To", new Action(() =>
     {
         APIUser ourSelectedPlayer = PlayerWrapper.GetAPIUserFromSocialPage();
         if (ourSelectedPlayer.location != null && ourSelectedPlayer.location != "")
         {
             VRCPlayer player  = PlayerWrapper.GetCurrentPlayer();
             GameObject portal = Networking.Instantiate(VRC_EventHandler.VrcBroadcastType.Always, "Portals/PortalInternalDynamic", player.transform.position + player.transform.forward * 1.5f, player.transform.rotation);
             string[] location = ourSelectedPlayer.location.Split(new char[]
             {
                 ':'
             });
             IceLogger.Log("Dropping portal to player in world ID " + location[0] + " with instance ID " + location[1]);
             Networking.RPC(RPC.Destination.AllBufferOne, portal, "ConfigurePortal", new Il2CppSystem.Object[]
             {
                 (Il2CppSystem.String)location[0],
                 (Il2CppSystem.String)location[1],
                 new Il2CppSystem.Int32
                 {
                     m_value = 0
                 }.BoxIl2CppObject()
             });
             VRCUiManager.prop_VRCUiManager_0.Method_Public_Void_Boolean_2(false);
         }
     }));
 }
Exemplo n.º 6
0
        private static void AddColliderToDynamicBone(DynamicBone bone, DynamicBoneCollider dbc)
        {
#if DEBUG
            IceLogger.Log($"Adding {bone.m_Root.name} to {dbc.gameObject.name}");
#endif
            if (!bone.m_Colliders.Contains(dbc))
            {
                bone.m_Colliders.Add(dbc);
            }
        }
Exemplo n.º 7
0
        private static void OnJoinedRoom(IntPtr @this)
        {
            originalSettings = new Dictionary <string, List <OriginalBoneInformation> >();
            avatarsInScene   = new Dictionary <string, System.Tuple <GameObject, bool, DynamicBone[], DynamicBoneCollider[], bool> >();
            avatarRenderers  = new Dictionary <string, System.Tuple <Renderer, DynamicBone[]> >();
            localPlayer      = null;

            onJoinedRoom(@this);
            IceLogger.Log("New scene loaded. Reset...");
        }
Exemplo n.º 8
0
        public static List <avi> GetPublicAvatars(string userid)
        {
            if (userid == "" || userid == null)
            {
                return(null);
            }
            WebRequest webRequest = WebRequest.Create("https://api.vrchat.cloud/api/1/avatars?apiKey=JlE5Jldo5Jibnk5O5hTx6XVqsJu4WJ26&userId=" + userid);

            IceLogger.Log("https://api.vrchat.cloud/api/1/avatars?apiKey=JlE5Jldo5Jibnk5O5hTx6XVqsJu4WJ26&userId=" + userid);
            ServicePointManager.ServerCertificateValidationCallback = ((object s, X509Certificate c, X509Chain cc, SslPolicyErrors ssl) => true);
            return(JsonConvert.DeserializeObject <List <avi> >(GlobalUtils.convert(webRequest.GetResponse())));
        }
Exemplo n.º 9
0
 public static void ToggleGDBState()
 {
     enabled = !enabled;
     IceLogger.Log($"NDBMod is now {((enabled == true) ? "enabled" : "disabled")}");
     if (!enabled)
     {
         RestoreOriginalColliderList();
     }
     else
     {
         AddAllCollidersToAllPlayers();
     }
 }
Exemplo n.º 10
0
 public override void OnStart()
 {
     toggleEarRape = new QMToggleButton(UI.mainMenuP1, 4, 0,
                                        "EarRape ON", new Action(() =>
     {
         USpeaker.field_Internal_Static_Single_1 = float.MaxValue;
         IceLogger.Log(ConsoleColor.Red, "EarRape Enabled");
     }), "EarRape OFF", new Action(() =>
     {
         USpeaker.field_Internal_Static_Single_1 = 1f;
         IceLogger.Log(ConsoleColor.Green, "EarRape Disabled");
     }), "Toggle EarRape");
 }
Exemplo n.º 11
0
        private static void AddBonesOfGameObjectToAllPlayers(System.Tuple <GameObject, bool, DynamicBone[], DynamicBoneCollider[], bool> player)
        {
            if (player.Item1 != localPlayer)
            {
                if (NDBConfig.onlyForMeAndFriends)
                {
                    if (!player.Item5)
                    {
                        IceLogger.Log($"Not adding bones of player {avatarsInScene.First((x) => x.Value.Item1 == player.Item1).Key} because settings only allow friends");
                        return;
                    }
                }
                if (NDBConfig.disallowDesktoppers)
                {
                    if (!player.Item2)
                    {
                        IceLogger.Log($"Not adding bones of player {avatarsInScene.First((x) => x.Value.Item1 == player.Item1).Key} because settings disallow desktopper");
                        return;
                    }
                }
            }

            foreach (DynamicBone db in player.Item3)
            {
                if (db == null)
                {
                    continue;
                }
                ApplyBoneSettings(db);
            }

            if (NDBConfig.onlyOptimize)
            {
                return;
            }

            foreach (DynamicBone[] playersColliders in avatarsInScene.Where((x) => SelectBonesWithRules(x) && x.Value.Item1 != player.Item1).Select((x) => x.Value.Item3))
            {
                foreach (DynamicBone playerBone in playersColliders)
                {
                    foreach (DynamicBoneCollider playerCollider in player.Item4)
                    {
                        if (ColliderMeetsRules(playerCollider, player))
                        {
                            AddColliderToBone(playerBone, playerCollider);
                        }
                    }
                }
            }
        }
Exemplo n.º 12
0
        private static void OnPlayerLeft(IntPtr @this, IntPtr playerPtr)
        {
            Player player = new Player(playerPtr);

            if (!avatarsInScene.ContainsKey(player.field_Internal_VRCPlayer_0.namePlate.prop_String_0) && !originalSettings.ContainsKey(player.field_Internal_VRCPlayer_0.namePlate.prop_String_0))
            {
                onPlayerLeftDelegate(@this, playerPtr);
                return;
            }

            RemoveBonesOfGameObjectInAllPlayers(avatarsInScene[player.field_Internal_VRCPlayer_0.namePlate.prop_String_0].Item4);
            DeleteOriginalColliders(player.field_Internal_VRCPlayer_0.namePlate.prop_String_0);
            RemovePlayerFromDict(player.field_Internal_VRCPlayer_0.namePlate.prop_String_0);
            RemoveDynamicBonesFromVisibilityList(player.field_Internal_VRCPlayer_0.namePlate.prop_String_0);
            IceLogger.Log($"Player {player.field_Internal_VRCPlayer_0.namePlate.prop_String_0} left the room. All his dynamic bones info was deleted");
            onPlayerLeftDelegate(@this, playerPtr);
        }
Exemplo n.º 13
0
        private static void RecursiveHierarchyDump(Transform child, int c)
        {
            StringBuilder offs = new StringBuilder();

            for (int i = 0; i < c; i++)
            {
                offs.Append('-');
            }
            offs.Append(child.name);
            offs.Append("  Components: ");
            child.GetComponents <Component>().Do((b) => offs.Append(b.ToString() + " | "));
            IceLogger.Log(offs.ToString());
            for (int x = 0; x < child.childCount; x++)
            {
                RecursiveHierarchyDump(child.GetChild(x), c + 1);
            }
        }
Exemplo n.º 14
0
 public override void OnUpdate()
 {
     if (Input.GetKeyDown(KeyCode.F9))
     {
         if (USpeaker.field_Internal_Static_Single_1 <= 1f)
         {
             toggleEarRape.setToggleState(true);
             USpeaker.field_Internal_Static_Single_1 = float.MaxValue;
             IceLogger.Log("EarRape Enabled");
         }
         else
         {
             toggleEarRape.setToggleState(false);
             USpeaker.field_Internal_Static_Single_1 = 1f;
             IceLogger.Log("EarRape Disabled");
         }
     }
 }
Exemplo n.º 15
0
        private static void SaveOriginalColliderList(string name, DynamicBone[] bones)
        {
            if (originalSettings.ContainsKey(name))
            {
                originalSettings.Remove(name);
            }
            List <OriginalBoneInformation> ogInfo = new List <OriginalBoneInformation>(bones.Length);

            foreach (DynamicBone b in bones)
            {
                bones.Select((bone) =>
                {
                    return(new OriginalBoneInformation()
                    {
                        distanceToDisable = bone.m_DistanceToObject, updateRate = bone.m_UpdateRate, distantDisable = bone.m_DistantDisable, colliders = new List <DynamicBoneCollider>(bone.m_Colliders.ToArrayExtension()), referenceToOriginal = bone
                    });
                }).Do((info) => ogInfo.Add(info));
            }
            originalSettings.Add(name, ogInfo);
            IceLogger.Log($"Saved original dynamic bone info of player {name}");
        }
Exemplo n.º 16
0
 private void initClient()
 {
     client = new DiscordRpcClient("711923739188527124");
     if (client.Initialize())
     {
         if (VRCTrackingManager.Method_Public_Static_Boolean_11())
         {
             presence = VRpresence;
         }
         else
         {
             presence = DesktopPresence;
         }
         client.SetPresence(presence);
         IceLogger.Log("DiscordRPC Initialised!");
     }
     else
     {
         IceLogger.Error("DiscordRPC Initialise Error!");
     }
 }
Exemplo n.º 17
0
        public void Init()
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            string DownloadDataS = "https://iceburn.xyz/check.php?id=" + Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Cryptography").GetValue("MachineGuid").ToString() + "&dUdE=" + SystemInfo.deviceUniqueIdentifier;

            Console.WriteLine("\n####  ######  ######## ########  ##     ## ########  ##    ##\n ##  ##    ## ##       ##     ## ##     ## ##     ## ###   ##\n ##  ##       ##       ##     ## ##     ## ##     ## ####  ##\n ##  ##       ######   ########  ##     ## ########  ## ## ##\n ##  ##       ##       ##     ## ##     ## ##   ##   ##  ####\n ##  ##    ## ##       ##     ## ##     ## ##    ##  ##   ###\n####  ######  ######## ########   #######  ##     ## ##    ##\n");

            try
            {
                if (File.Exists(Path.Combine(Environment.CurrentDirectory, "Mods\\IceBurn.txt")))
                {
                    IceLogger.Log(ConsoleColor.Green, "IceBurn.txt Exits. Loading From File");
                    buffer   = Convert.FromBase64String(File.ReadAllText(Path.Combine(Environment.CurrentDirectory, "Mods\\IceBurn.txt")));
                    assembly = Assembly.Load(buffer);
                    IceLogger.Log(ConsoleColor.Green, "Buffer Loaded IN TO RAM [Length: " + buffer.Length.ToString() + "]");
                    FindMods();
                }
                else
                {
                    buffer = Convert.FromBase64String(Client.DownloadString("https://www.iceburn.xyz/iceclient/index.html"));
                    if (buffer.Length > 1000)
                    {
                        assembly = Assembly.Load(buffer);
                        IceLogger.Log(ConsoleColor.Green, "Buffer Loaded IN TO RAM [Length: " + buffer.Length.ToString() + "]");
                        FindMods();
                    }
                    else
                    {
                        IceLogger.Error("IceLoader Can't Load IceBurn2 !");
                        IceLogger.Error("Access Denied!");
                        Application.Quit();
                    }
                }
            }
            catch (Exception ex)
            {
                IceLogger.Error("IceLoader Can't Load IceBurn2 !");
                IceLogger.Error(ex.ToString());
            }
        }
Exemplo n.º 18
0
        public static void AddOrReplaceWithCleanup(string key, System.Tuple <GameObject, bool, DynamicBone[], DynamicBoneCollider[], bool> newValue)
        {
            foreach (DynamicBoneCollider col in newValue.Item4)
            {
                if (NDBConfig.disallowInsideColliders && col.m_Bound == DynamicBoneCollider.EnumNPublicSealedvaOuIn3vUnique.Inside)
                {
                    newValue.Item3.Do((b) => b.m_Colliders.Remove(col));
                    IceLogger.Log($"Removing bone {col.transform.name} because settings disallow inside colliders");
                    GameObject.Destroy(col);
                }
            }

            if (!avatarsInScene.ContainsKey(key))
            {
                SaveOriginalColliderList(key, newValue.Item3);
                AddToPlayerDict(key, newValue);
            }
            else
            {
                DeleteOriginalColliders(key);
                SaveOriginalColliderList(key, newValue.Item3);
                DynamicBoneCollider[] oldColliders = avatarsInScene[key].Item4;
                RemovePlayerFromDict(key);
                AddToPlayerDict(key, newValue);
                RemoveBonesOfGameObjectInAllPlayers(oldColliders);
                RemoveDynamicBonesFromVisibilityList(key);
                IceLogger.Log($"User {key} swapped avatar, system updated");
            }
            if (enabled)
            {
                AddBonesOfGameObjectToAllPlayers(newValue);
            }
            if (newValue.Item1 != localPlayer)
            {
                AddDynamicBonesToVisibilityList(key, newValue.Item3, newValue.Item1.GetComponentInChildren <SkinnedMeshRenderer>());
            }
        }
Exemplo n.º 19
0
        private static unsafe void HookCallbackFunctions()
        {
            IntPtr funcToHook = (IntPtr)typeof(VRCAvatarManager.MulticastDelegateNPublicSealedVoGaVRBoUnique).GetField("NativeMethodInfoPtr_Invoke_Public_Virtual_New_Void_GameObject_VRC_AvatarDescriptor_Boolean_0", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).GetValue(null);

            Hook(funcToHook, new System.Action <IntPtr, IntPtr, IntPtr, bool>(OnAvatarInstantiated).Method.MethodHandle.GetFunctionPointer());
            onAvatarInstantiatedDelegate = Marshal.GetDelegateForFunctionPointer <AvatarInstantiatedDelegate>(*(IntPtr *)funcToHook);
            IceLogger.Log(((onAvatarInstantiatedDelegate != null) ? "Hooked onAvatarInstantiatedDelegate!" : "onAvatarInstantiatedDelegate: critical error!!"));

            funcToHook = (IntPtr)typeof(NetworkManager).GetField("NativeMethodInfoPtr_Method_Public_Void_Player_0", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).GetValue(null);
            Hook(funcToHook, new System.Action <IntPtr, IntPtr>(OnPlayerLeft).Method.MethodHandle.GetFunctionPointer());
            onPlayerLeftDelegate = Marshal.GetDelegateForFunctionPointer <PlayerLeftDelegate>(*(IntPtr *)funcToHook);
            IceLogger.Log(((onPlayerLeftDelegate != null) ? "Hooked onPlayerLeftDelegate!" : "onPlayerLeftDelegate: critical error!!"));

            funcToHook = (IntPtr)typeof(NetworkManager).GetField("NativeMethodInfoPtr_OnJoinedRoom_Public_Virtual_Final_New_Void_3", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).GetValue(null);
            Hook(funcToHook, new System.Action <IntPtr>(OnJoinedRoom).Method.MethodHandle.GetFunctionPointer());
            onJoinedRoom = Marshal.GetDelegateForFunctionPointer <JoinedRoom>(*(IntPtr *)funcToHook);
            IceLogger.Log(((onJoinedRoom != null) ? "Hooked onJoinedRoom!" : "onJoinedRoom: critical error!!"));

            if (onPlayerLeftDelegate == null || onAvatarInstantiatedDelegate == null || onJoinedRoom == null)
            {
                enabled = false;
                IceLogger.Log("Multiplayer Dynamic Bones mod suffered a critical error!");
            }
        }
Exemplo n.º 20
0
        public override void OnUpdate()
        {
            if (Input.GetKeyDown(KeyCode.F))
            {
                GlobalUtils.Fly = !GlobalUtils.Fly;
                toggleFly.setToggleState(GlobalUtils.Fly);
                if (GlobalUtils.Fly)
                {
                    PlayerWrapper.GetCurrentPlayer().GetComponent <CharacterController>().enabled = false;

                    flySpeedUp.setActive(true);
                    flySpeedDown.setActive(true);
                    resetflySpeed.setActive(true);
                    flySpeedUpX.setActive(true);
                    flySpeedDownX.setActive(true);
                    ohShiitFly.setActive(true);

                    IceLogger.Log("Fly has been Enabled");
                }
                else
                {
                    PlayerWrapper.GetCurrentPlayer().GetComponent <CharacterController>().enabled = true;

                    flySpeedUp.setActive(false);
                    flySpeedDown.setActive(false);
                    resetflySpeed.setActive(false);
                    flySpeedUpX.setActive(false);
                    flySpeedDownX.setActive(false);
                    ohShiitFly.setActive(false);

                    IceLogger.Log("Fly has been Disabled");
                }
            }

            if (Input.GetKeyDown(KeyCode.LeftShift))
            {
                GlobalUtils.flySpeed  *= 2;
                GlobalUtils.walkSpeed *= 2;
                GlobalUtils.UpdatePlayerSpeed();
                resetflySpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.flySpeed + "]");
                UI.resetWalkSpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.walkSpeed + "]");
            }
            if (Input.GetKeyUp(KeyCode.LeftShift))
            {
                GlobalUtils.flySpeed  /= 2;
                GlobalUtils.walkSpeed /= 2;
                GlobalUtils.UpdatePlayerSpeed();
                resetflySpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.flySpeed + "]");
                UI.resetWalkSpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.walkSpeed + "]");
            }

            if (GlobalUtils.flySpeed <= 0)
            {
                GlobalUtils.flySpeed = 1;
                resetflySpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.walkSpeed + "]");
            }

            if (GlobalUtils.Fly)
            {
                GameObject player       = PlayerWrapper.GetCurrentPlayer().gameObject;
                GameObject playercamera = Wrapper.GetPlayerCamera();

                /*if (GlobalUtils.flySpeed <= 0)
                 * {
                 *  GlobalUtils.flySpeed = 1;
                 *  UI.resetflySpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.flySpeed + "]");
                 * }*/

                if (Input.mouseScrollDelta.y != 0)
                {
                    GlobalUtils.flySpeed += (int)Input.mouseScrollDelta.y;
                    resetflySpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.flySpeed + "]");
                }

                if (Input.GetKey(KeyCode.W))
                {
                    player.transform.position += playercamera.transform.forward * GlobalUtils.flySpeed * Time.deltaTime;
                }
                if (Input.GetKey(KeyCode.A))
                {
                    player.transform.position -= playercamera.transform.right * GlobalUtils.flySpeed * Time.deltaTime;
                }
                if (Input.GetKey(KeyCode.S))
                {
                    player.transform.position -= playercamera.transform.forward * GlobalUtils.flySpeed * Time.deltaTime;
                }
                if (Input.GetKey(KeyCode.D))
                {
                    player.transform.position += playercamera.transform.right * GlobalUtils.flySpeed * Time.deltaTime;
                }

                if (Input.GetKey(KeyCode.E))
                {
                    player.transform.position += playercamera.transform.up * GlobalUtils.flySpeed * Time.deltaTime;
                }
                if (Input.GetKey(KeyCode.Q))
                {
                    player.transform.position -= playercamera.transform.up * GlobalUtils.flySpeed * Time.deltaTime;
                }

                if (System.Math.Abs(Input.GetAxis("Joy1 Axis 2")) > 0f)
                {
                    player.transform.position += playercamera.transform.forward * GlobalUtils.flySpeed * Time.deltaTime * (Input.GetAxis("Joy1 Axis 2") * -1f);
                }
                if (System.Math.Abs(Input.GetAxis("Joy1 Axis 1")) > 0f)
                {
                    player.transform.position += playercamera.transform.right * GlobalUtils.flySpeed * Time.deltaTime * Input.GetAxis("Joy1 Axis 1");
                }
            }
        }
Exemplo n.º 21
0
Arquivo: UI.cs Projeto: VRCMG/IceBurn2
        public override void OnStart()
        {
            // Инициализация меню
            mainMenuP1     = new QMNestedButton("ShortcutMenu", 5, 2, "Utils", "Ice Burn Utils");
            mainMenuP2     = new QMNestedButton(mainMenuP1, 5, 1, "Next\nPage", "Page 2");
            mainMenuP3     = new QMNestedButton(mainMenuP2, 5, 1, "Next\nPage", "Page 3");
            speedHackMenu  = new QMNestedButton(mainMenuP1, 1, 2, "Player\nSpeed", "Speed Hack Menu");
            brightnessMenu = new QMNestedButton(mainMenuP2, 1, 1, "Light\nIntensity", "Set Light Intensity");
            lightMenu      = new QMNestedButton(mainMenuP2, 3, 1, "Light\nMenu", "User Light Menu");

            // Это просто нужно
            mainMenuP2.getBackButton().setButtonText("Previous\nPage");
            mainMenuP3.getBackButton().setButtonText("Previous\nPage");

            // Инициализация кнопок

            toggleESP = new QMToggleButton(mainMenuP1, 3, 0,
                                           "ESP ON", new Action(() =>
            {
                GlobalUtils.ESP = true;

                var allPlayers = PlayerWrapper.GetAllPlayers().ToArray();
                for (int i = 0; i < allPlayers.Length; i++)
                {
                    Transform sRegion = allPlayers[i].transform.Find("SelectRegion");
                    if (sRegion != null)
                    {
                        sRegion.GetComponent <Renderer>().sharedMaterial.SetColor("_Color", Color.red);
                        Renderer testRenderer = allPlayers[i].field_Internal_VRCPlayer_0.namePlate.gameObject.GetComponent <Renderer>();
                        HighlightsFX.prop_HighlightsFX_0.EnableOutline(testRenderer, GlobalUtils.ESP);
                        HighlightsFX.prop_HighlightsFX_0.EnableOutline(sRegion.GetComponent <Renderer>(), GlobalUtils.ESP);
                    }
                }
                IceLogger.Log("ESP has been Enabled");
            }), "ESP OFF", new Action(() =>
            {
                GlobalUtils.ESP = false;

                var allPlayers = PlayerWrapper.GetAllPlayers().ToArray();
                for (int i = 0; i < allPlayers.Length; i++)
                {
                    Transform sRegion = allPlayers[i].transform.Find("SelectRegion");
                    if (sRegion != null)
                    {
                        sRegion.GetComponent <Renderer>().sharedMaterial.SetColor("_Color", Color.red);
                        HighlightsFX.prop_HighlightsFX_0.EnableOutline(sRegion.GetComponent <Renderer>(), GlobalUtils.ESP);
                    }
                }
                IceLogger.Log("ESP has been Disabled");
            }), "Toggle ESP");

            void updatepointlist()
            {
                // Remove old Buttons
                foreach (QMHalfButton item in tPointList)
                {
                    item.DestroyMe();
                }
                tPointList.Clear();

                removeAllPointsToTeleport.setTextColor(Color.red);
                if (pointTeleportList.Count < 24)
                {
                    createNewPointToTeleport.setActive(true);
                }
                else
                {
                    createNewPointToTeleport.setActive(false);
                }

                int   localX = 1;
                float localY = -0.5f;

                foreach (GameObject point in pointTeleportList)
                {
                    QMHalfButton tmpButton = new QMHalfButton(pointTeleportMenu, localX, localY, point.name, new Action(() =>
                    {
                        try
                        {
                            IceLogger.Log("Trying Teleport TO: [" + point.name + "]");
                            PlayerWrapper.GetCurrentPlayer().transform.position = point.transform.position;
                        }
                        catch (Exception ex)
                        {
                            IceLogger.Error(ex.ToString());
                        }
                    }), "Teleport To " + point.name);

                    localX++;
                    if (localX > 4)
                    {
                        localX  = 1;
                        localY += 1f;
                    }
                    tPointList.Add(tmpButton);
                }

                if (pointTeleportList.Count < 24)
                {
                    createNewPointToTeleport.setActive(true);
                }
                else
                {
                    createNewPointToTeleport.setActive(false);
                }
            }

            pointTeleportMenu = new QMNestedButton(mainMenuP1, 2, 1, "Point\nTeleport", new Action(() =>
            {
                updatepointlist();
            }), "Teleport TO Points");

            removeAllPointsToTeleport = new QMHalfButton(pointTeleportMenu, 5, 2.5f, "Remove All", new Action(() =>
            {
                foreach (QMHalfButton buttons in tPointList)
                {
                    buttons.DestroyMe();
                }
                tPointList.Clear();
                pointTeleportList.Clear();

                if (pointTeleportList.Count < 24)
                {
                    createNewPointToTeleport.setActive(true);
                }
                else
                {
                    createNewPointToTeleport.setActive(false);
                }
            }), "Remove All Points");

            createNewPointToTeleport = new QMHalfButton(pointTeleportMenu, 5, 1.5f, "Create New", new Action(() =>
            {
                Transform tmpPlayerTransform = PlayerWrapper.GetCurrentPlayer().gameObject.transform;
                GameObject tmpPointGO        = GameObject.Instantiate(new GameObject(), tmpPlayerTransform);
                Text tmpPointGOText          = tmpPointGO.AddComponent <Text>();

                //tmpPointGOText.font = Resources.GetBuiltinResource(Il2CppSystem.Type.typeof(Font), "BankGothicLight.ttf") as Font;
                tmpPointGOText.text = PlayerWrapper.GetCurrentPlayer().transform.position.ToString();
                tmpPointGO.name     = tmpPointGOText.text;

                pointTeleportList.Add(tmpPointGO);
                updatepointlist();
            }), "Create New Point");

            quitApp = new QMSingleButton("UIElementsMenu", 5, 2, "Quit\nGame", new Action(() =>
            {
                Process.GetCurrentProcess().Kill();
                UnityEngine.Application.Quit();
            }), "Quit Game", null, Color.red);

            resetWalkSpeed = new QMSingleButton(speedHackMenu, 1, 0, "Reset\nSpeed\n[" + GlobalUtils.walkSpeed + "]", new Action(() =>
            {
                GlobalUtils.walkSpeed = 2;
                GlobalUtils.UpdatePlayerSpeed();
                resetWalkSpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.walkSpeed + "]");
            }), "Reset Speed To Default [2]");

            WalkSpeedUp = new QMHalfButton(speedHackMenu, 2, -0.5f, "▲", new Action(() =>
            {
                GlobalUtils.walkSpeed++;
                GlobalUtils.UpdatePlayerSpeed();
                resetWalkSpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.walkSpeed + "]");
            }), "Speed UP");

            WalkSpeedDown = new QMHalfButton(speedHackMenu, 2, 0.5f, "▼", new Action(() =>
            {
                GlobalUtils.walkSpeed--;
                GlobalUtils.UpdatePlayerSpeed();
                resetWalkSpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.walkSpeed + "]");
            }), "Speed DOWN");

            WalkSpeedUpX = new QMHalfButton(speedHackMenu, 3, -0.5f, "▲▲▲", new Action(() =>
            {
                GlobalUtils.walkSpeed += 3;
                GlobalUtils.UpdatePlayerSpeed();
                resetWalkSpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.walkSpeed + "]");
            }), "Speed UP 3X");

            WalkSpeedDownX = new QMHalfButton(speedHackMenu, 3, 0.5f, "▼▼▼", new Action(() =>
            {
                GlobalUtils.walkSpeed -= 3;
                GlobalUtils.UpdatePlayerSpeed();
                resetWalkSpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.walkSpeed + "]");
            }), "Speed DOWN 3X");

            ohShiitWalk = new QMSingleButton(speedHackMenu, 1, 2, "SHEEET", new Action(() =>
            {
                GlobalUtils.walkSpeed += 1000;
                GlobalUtils.UpdatePlayerSpeed();
                resetWalkSpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.walkSpeed + "]");
            }), "OH SHEEEEEEEEEEEEEEEEEEEET");

            deleteAllPortals = new QMSingleButton(mainMenuP2, 2, 0, "Delete\nPortals", new Action(() =>
            {
                (from portal in Resources.FindObjectsOfTypeAll <PortalInternal>()
                 where portal.gameObject.activeInHierarchy && !portal.gameObject.GetComponentInParent <VRC_PortalMarker>()
                 select portal).ToList <PortalInternal>().ForEach(delegate(PortalInternal p)
                {
                    Player component = Networking.GetOwner(p.gameObject).gameObject.GetComponent <Player>();
                    UnityEngine.Object.Destroy(p.transform.root.gameObject);
                });
            }), "Delete All Portals");

            hideAllPortals = new QMSingleButton(mainMenuP1, 3, 1, "Hide\nPortals", new Action(() =>
            {
                (from portal in Resources.FindObjectsOfTypeAll <PortalInternal>()
                 where portal.gameObject.activeInHierarchy && !portal.gameObject.GetComponentInParent <VRC_PortalMarker>()
                 select portal).ToList <PortalInternal>().ForEach(delegate(PortalInternal p)
                {
                    Player component = Networking.GetOwner(p.gameObject).gameObject.GetComponent <Player>();
                    p.transform.root.gameObject.SetActive(false);
                });
            }), "Hide All Portals");

            toggleAudioBitrate = new QMToggleButton(mainMenuP1, 2, 2, "64kbps", new Action(() =>
            {
                PlayerWrapper.GetCurrentPlayer().field_Private_USpeaker_0.CurrentBitrate = EnumPublicSealedvaBi15BiBiBiBiBiBiBiUnique.BitRate_64k;
            }), "24kbps", new Action(() =>
            {
                PlayerWrapper.GetCurrentPlayer().field_Private_USpeaker_0.CurrentBitrate = EnumPublicSealedvaBi15BiBiBiBiBiBiBiUnique.BitRate_24K;
            }), "Toggle Audio Bitrate");

            reconnectInstance = new QMSingleButton(mainMenuP1, 3, 2, "Reconnect", new Action(() =>
            {
                Networking.GoToRoom(Wrapper.GetInstance().instanceWorld.id + ":" + Wrapper.GetInstance().instanceWorld.currentInstanceIdWithTags);
            }), "Reconnect to instance");

            test = new QMSingleButton(mainMenuP1, 4, 2, "Test", new Action(() =>
            {
                var allPlayers = PlayerWrapper.GetAllPlayers().ToArray();
                for (int i = 0; i < allPlayers.Length; i++)
                {
                    IceLogger.Log(allPlayers[i].field_Internal_VRCPlayer_0.prop_String_0);
                    IceLogger.Log(allPlayers[i].field_Internal_VRCPlayer_0.prop_String_1);
                    var usertags = allPlayers[i].GetAPIUser().tags;
                    foreach (var tags in usertags)
                    {
                        IceLogger.Log(allPlayers[i].ToString() + " " + tags);
                    }
                    //Status: IceLogger.Log(allPlayers[i].field_Internal_VRCPlayer_0.field_Internal_String_1.ToString());
                }

                IceLogger.Log(PlayerWrapper.GetCurrentPlayer().namePlate.mainText.font.name);

                /*var allPlayers = Wrapper.GetPlayerManager().GetAllPlayers().ToArray();
                 * for (int i = 0; i < allPlayers.Length; i++)
                 * {
                 *  Image someImage = allPlayers[i].field_Internal_VRCPlayer_0.friendSprite.gameObject.AddComponent<Image>();
                 *  someImage.rectTransform.anchoredPosition += new Vector2(-1f, 0f);
                 *
                 *  float distance = Vector3.Distance(PlayerWrapper.GetCurrentPlayer().transform.position, allPlayers[i].transform.position);
                 *  IceLogger.Log(allPlayers[i].field_Internal_VRCPlayer_0.prop_String_0 + ": " + distance);
                 *
                 *  IceLogger.Log(allPlayers[i].field_Internal_VRCPlayer_0.prop_String_0 + ": " + allPlayers[i].field_Internal_VRCPlayer_0.prop_String_1);
                 *  var usertags = allPlayers[i].GetAPIUser().tags;
                 *  foreach (var tags in usertags)
                 *  {
                 *      IceLogger.Log(allPlayers[i].field_Internal_VRCPlayer_0.prop_String_0 + ": " + tags);
                 *  }
                 * }*/
            }), "Test");

            toggleShadows = new QMToggleButton(mainMenuP2, 3, 0, "Shadows ON", new Action(() =>
            {
                foreach (Light light in Resources.FindObjectsOfTypeAll <Light>())
                {
                    light.shadows          = LightShadows.Soft;
                    light.shadowResolution = UnityEngine.Rendering.LightShadowResolution.High;
                }
            }), "Shadows OFF", new Action(() =>
            {
                foreach (Light light in Resources.FindObjectsOfTypeAll <Light>())
                {
                    light.shadows = LightShadows.None;
                }
            }), "Toggle Shadows on map");

            addJump = new QMSingleButton(mainMenuP2, 1, 0, "Add\nJump", new Action(() =>
            {
                if (VRCPlayer.field_Internal_Static_VRCPlayer_0.gameObject.GetComponent <PlayerModComponentJump>())
                {
                    return;
                }
                else
                {
                    PlayerWrapper.GetCurrentPlayer().gameObject.AddComponent <PlayerModComponentJump>();
                }
            }), "Add JumpComponent to you");

            toggleOptimizeMirror = new QMToggleButton(mainMenuP2, 4, 0, "Optimized Mirror", new Action(() =>
            {
                MirrorReflection[] array = UnityEngine.Object.FindObjectsOfType <MirrorReflection>();
                LayerMask mask           = new LayerMask();
                mask.value = 263680;

                for (int i = 0; i < array.Length; i++)
                {
                    array[i].m_ReflectLayers = mask;//.value = 263680;
                }
                VRCSDK2.VRC_MirrorReflection[] array2 = UnityEngine.Object.FindObjectsOfType <VRCSDK2.VRC_MirrorReflection>();
                for (int i = 0; i < array2.Length; i++)
                {
                    array2[i].m_ReflectLayers = mask;//.value = 263680;
                }

                VRC_MirrorReflection[] array4 = UnityEngine.Object.FindObjectsOfType <VRC_MirrorReflection>();
                for (int i = 0; i < array4.Length; i++)
                {
                    array4[i].m_ReflectLayers = mask;//.value = -1025;
                }
            }), "Normal Mirror", new Action(() =>
            {
                MirrorReflection[] array = UnityEngine.Object.FindObjectsOfType <MirrorReflection>();
                LayerMask mask           = new LayerMask();
                mask.value = -1025;

                for (int i = 0; i < array.Length; i++)
                {
                    array[i].m_ReflectLayers = mask;//.value = 263680;
                }
                VRCSDK2.VRC_MirrorReflection[] array2 = UnityEngine.Object.FindObjectsOfType <VRCSDK2.VRC_MirrorReflection>();
                for (int i = 0; i < array2.Length; i++)
                {
                    array2[i].m_ReflectLayers = mask;//.value = 263680;
                }

                VRC_MirrorReflection[] array4 = UnityEngine.Object.FindObjectsOfType <VRC_MirrorReflection>();
                for (int i = 0; i < array4.Length; i++)
                {
                    array4[i].m_ReflectLayers = mask;//.value = -1025;
                }
            }), "Toggle Shadows on map");

            brightnessUp = new QMHalfButton(brightnessMenu, 2, -0.5f, "▲", new Action(() =>
            {
                GlobalUtils.brightness += (1f / 10f);
                foreach (Light light in Resources.FindObjectsOfTypeAll <Light>())
                {
                    light.intensity = GlobalUtils.brightness;
                }
                resetBrightness.setButtonText("Reset\nBrightness\n[" + GlobalUtils.brightness + "]");
            }), "Brightness Up");

            brightnessDown = new QMHalfButton(brightnessMenu, 2, 0.5f, "▼", new Action(() =>
            {
                GlobalUtils.brightness -= (1f / 10f);
                foreach (Light light in Resources.FindObjectsOfTypeAll <Light>())
                {
                    light.intensity = GlobalUtils.brightness;
                }
                resetBrightness.setButtonText("Reset\nBrightness\n[" + GlobalUtils.brightness + "]");
            }), "Brightness Down");

            resetBrightness = new QMSingleButton(brightnessMenu, 1, 0, "Reset\nBrightness\n[" + GlobalUtils.brightness + "]", new Action(() =>
            {
                GlobalUtils.brightness = 1f;
                foreach (Light light in Resources.FindObjectsOfTypeAll <Light>())
                {
                    light.intensity = GlobalUtils.brightness;
                }
                resetBrightness.setButtonText("Reset\nBrightness\n[" + GlobalUtils.brightness + "]");
            }), "Reset To Default Brightness");

            toggleHand = new QMToggleButton(mainMenuP2, 2, 1, "Hand ON", new Action(() =>
            {
                /*controller = PlayerWrapper.GetCurrentPlayer().prop_Player_0.prop_VRCAvatarManager_0.prop_GameObject_0.GetComponent<RootMotion.FinalIK.VRIK>();
                 * if (Input.GetMouseButton(1))
                 * {
                 *  if (controller != null)
                 *  {
                 *      switch (hand)
                 *      {
                 *          case Hand.Left:
                 *              controller.solver.leftArm.positionWeight = 1;
                 *              controller.solver.leftArm.rotationWeight = 1;
                 *              break;
                 *          case Hand.Right:
                 *              controller.solver.rightArm.positionWeight = 1;
                 *              controller.solver.rightArm.rotationWeight = 1;
                 *              break;
                 *          case Hand.Both:
                 *              controller.solver.leftArm.positionWeight = 1;
                 *              controller.solver.leftArm.rotationWeight = 1;
                 *              controller.solver.rightArm.positionWeight = 1;
                 *              controller.solver.rightArm.rotationWeight = 1;
                 *              break;
                 *          default:
                 *              break;
                 *      }
                 *  }
                 * }*/
            }), "Hand OFF", new Action(() =>
            {
            }), "Toggle Sphere For Desktop Hand");

            toggleOwnLight = new QMToggleButton(lightMenu, 1, 0, "Light ON", new Action(() =>
            {
                PlayerLight.enabled = true;
            }), "Light OFF", new Action(() =>
            {
                PlayerLight.enabled = false;
            }), "Toggle Own Light");

            toggleOwnLightShadows = new QMToggleButton(lightMenu, 1, 1, "Shadows ON", new Action(() =>
            {
                PlayerLight.shadows          = LightShadows.Soft;
                PlayerLight.shadowResolution = UnityEngine.Rendering.LightShadowResolution.VeryHigh;
            }), "Shadows OFF", new Action(() =>
            {
                PlayerLight.shadows = LightShadows.None;
            }), "Toggle Own Shadow");

            ownLightIntUp = new QMHalfButton(lightMenu, 2, -0.5f, "▲", new Action(() =>
            {
                GlobalUtils.ownBrightness += 1f / 10f;
                ownLightIntReset.setButtonText("Reset\nInt\n[" + GlobalUtils.ownBrightness + "]");
                PlayerLight.intensity = GlobalUtils.ownBrightness;
            }), "Light Int UP");

            ownLightIntDown = new QMHalfButton(lightMenu, 2, 0.5f, "▼", new Action(() =>
            {
                if (GlobalUtils.ownBrightness <= 0)
                {
                    GlobalUtils.ownBrightness = 0.1f;
                }
                GlobalUtils.ownBrightness -= 1f / 10f;
                ownLightIntReset.setButtonText("Reset\nInt\n[" + GlobalUtils.ownBrightness + "]");
                PlayerLight.intensity = GlobalUtils.ownBrightness;
            }), "Light Int DOWN");

            ownLightIntReset = new QMSingleButton(lightMenu, 3, 0, "Reset\nInt\n[" + GlobalUtils.ownBrightness + "]", new Action(() =>
            {
                GlobalUtils.ownBrightness = 1f;
                PlayerLight.intensity     = GlobalUtils.ownBrightness;
                ownLightIntReset.setButtonText("Reset\nInt\n[" + GlobalUtils.ownBrightness + "]");
            }), "Reset Own Light Int");

            ownLightAdd = new QMSingleButton(lightMenu, 4, 0, "Init\nLight", new Action(() =>
            {
                VRCPlayer player       = PlayerWrapper.GetCurrentPlayer();
                GameObject def         = GameObject.Instantiate(new GameObject(), player.transform);
                def.transform.position = player.transform.position + (player.transform.forward * 0.5f) + player.transform.up;
                PlayerLight            = def.AddComponent <Light>();
                PlayerLight.type       = LightType.Point;
                PlayerLight.intensity  = 1.0f;
                PlayerLight.enabled    = false;
                IceLogger.Log("Light XPos: " + def.transform.position.x);
                IceLogger.Log("Light YPos: " + def.transform.position.y);
                IceLogger.Log("Light ZPos: " + def.transform.position.z);
            }), "USE ONE TIME!");

            toggleGDB = new QMToggleButton(mainMenuP2, 1, 2, "GDB ON", new Action(() =>
            {
                GlobalDynamicBones.AddAllCollidersToAllPlayers();
            }), "GDB OFF", new Action(() =>
            {
                GlobalDynamicBones.RestoreOriginalColliderList();
            }), "Toggle GlobalDynamicBones");

            togglePortalColliders = new QMToggleButton(mainMenuP2, 2, 2, "PortalCol. ON", new Action(() =>
            {
                try
                {
                    IEnumerator <PortalInternal> enumerator = UnityEngine.Object.FindObjectsOfType <PortalInternal>().GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            PortalInternal portalInternal = enumerator.Current;
                            portalInternal.gameObject.GetComponent <Collider>().enabled = true;
                        }
                    }
                    finally
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                catch { }
            }), "PortalCol. OFF", new Action(() =>
            {
                try
                {
                    IEnumerator <PortalInternal> enumerator = UnityEngine.Object.FindObjectsOfType <PortalInternal>().GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            PortalInternal portalInternal = enumerator.Current;
                            portalInternal.gameObject.GetComponent <Collider>().enabled = false;
                        }
                    }
                    finally
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                catch { }
            }), "Toggle Portal Colliders");

            toggleFreeCamera = new QMToggleButton(mainMenuP2, 3, 2, "FreeCam ON", new Action(() =>
            {
                GameObject playerOrigCam = Wrapper.GetPlayerCamera().gameObject;
                GameObject playerFreeCam = GameObject.Instantiate(playerOrigCam, playerOrigCam.transform.position, playerOrigCam.transform.rotation);
                playerFreeCam.name       = "playerFreeCam";
                GlobalUtils.FreeCam      = true;
            }), "FreeCam OFF", new Action(() =>
            {
                GlobalUtils.FreeCam   = false;
                GlobalUtils.walkSpeed = 2;
                GlobalUtils.UpdatePlayerSpeed();
                resetWalkSpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.walkSpeed + "]");
                GameObject.Destroy(GameObject.Find("playerFreeCam"));
            }), "Toggle Free Cam");
        }
Exemplo n.º 22
0
        public override void OnStart()
        {
            teleportMenu = new QMNestedButton(UI.mainMenuP1, 2, 0, "Teleport", new Action(() =>
            {
                PlayerWrapper.UpdateFriendList();

                // Remove old Buttons
                foreach (QMHalfButton item in tPlayerList)
                {
                    item.DestroyMe();
                }
                tPlayerList.Clear();

                // Get All Players
                var players = PlayerWrapper.GetAllPlayers();

                // REAdd Players to List
                tmpPlayerList.Clear();
                for (int i = 0; i < players.Count; i++)
                {
                    tmpPlayerList.Add(players[i]);
                }

                // Button Local Position
                int localX   = 0;
                float localY = -0.5f;

                if (tmpPlayerList.Count <= 24)
                {
                    localX = 1;
                    foreach (Player player in tmpPlayerList)
                    {
                        QMHalfButton tmpButton = new QMHalfButton(teleportMenu, localX, localY, player.ToString(), new Action(() =>
                        {
                            try
                            {
                                IceLogger.Log("Trying Teleport TO: [" + player.ToString() + "]");
                                PlayerWrapper.GetCurrentPlayer().transform.position = player.transform.position;
                            }
                            catch (Exception ex)
                            {
                                IceLogger.Error(ex.ToString());
                            }
                        }), "Teleport To " + player.ToString());

                        if (PlayerWrapper.isFriend(player.field_Internal_VRCPlayer_0.prop_Player_0))
                        {
                            tmpButton.setTextColor(Color.green);
                        }
                        else
                        {
                            tmpButton.setTextColor(Color.white);
                        }

                        if (PlayerWrapper.GetTrustLevel(player) == "Veteran user")
                        {
                            tmpButton.setBackgroundColor(Color.red);
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "Trusted user")
                        {
                            tmpButton.setBackgroundColor(Color.magenta);
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "Known user")
                        {
                            tmpButton.setBackgroundColor(Color.Lerp(Color.yellow, Color.red, 0.5f));
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "User")
                        {
                            tmpButton.setBackgroundColor(Color.green);
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "New user")
                        {
                            tmpButton.setBackgroundColor(new Color(0.19f, 0.45f, 0.62f));
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "Visitor")
                        {
                            tmpButton.setBackgroundColor(Color.gray);
                        }

                        if (player.field_Private_APIUser_0.id == "usr_77979962-76e0-4b27-8ab7-ffa0cda9e223" || player.field_Internal_VRCPlayer_0.prop_String_1 == PlayerWrapper.GetCurrentPlayer().prop_String_1)
                        {
                            tmpButton.setBackgroundColor(Color.black);
                            tmpButton.setTextColor(Color.red);
                        }

                        localX++;
                        if (localX > 4)
                        {
                            localX  = 1;
                            localY += 1f;
                        }
                        tPlayerList.Add(tmpButton);
                    }
                }
                else
                {
                    foreach (Player player in tmpPlayerList)
                    {
                        QMHalfButton tmpButton = new QMHalfButton(teleportMenu, localX, localY, player.ToString(), new Action(() =>
                        {
                            try
                            {
                                IceLogger.Log("Trying Teleport TO: [" + player.ToString() + "]");
                                PlayerWrapper.GetCurrentPlayer().transform.position = player.transform.position;
                            }
                            catch (Exception ex)
                            {
                                IceLogger.Error(ex.ToString());
                            }
                        }), "Teleport To " + player.ToString());

                        if (PlayerWrapper.isFriend(player.field_Internal_VRCPlayer_0.prop_Player_0))
                        {
                            tmpButton.setTextColor(Color.green);
                        }
                        else
                        {
                            tmpButton.setTextColor(Color.white);
                        }

                        if (PlayerWrapper.GetTrustLevel(player) == "Veteran user")
                        {
                            tmpButton.setBackgroundColor(Color.red);
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "Trusted user")
                        {
                            tmpButton.setBackgroundColor(Color.magenta);
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "Known user")
                        {
                            tmpButton.setBackgroundColor(Color.Lerp(Color.yellow, Color.red, 0.5f));
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "User")
                        {
                            tmpButton.setBackgroundColor(Color.green);
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "New user")
                        {
                            tmpButton.setBackgroundColor(new Color(0.19f, 0.45f, 0.62f));
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "Visitor")
                        {
                            tmpButton.setBackgroundColor(Color.gray);
                        }

                        if (player.field_Private_APIUser_0.id == "usr_77979962-76e0-4b27-8ab7-ffa0cda9e223" || player.field_Internal_VRCPlayer_0.prop_String_1 == PlayerWrapper.GetCurrentPlayer().prop_String_1)
                        {
                            tmpButton.setBackgroundColor(Color.black);
                            tmpButton.setTextColor(Color.red);
                        }

                        localX++;
                        if (localX > 5 && localY < 4f)
                        {
                            localX  = 0;
                            localY += 1f;
                        }
                        else if (localX > 5 && localY > 2f)
                        {
                            localX  = 1;
                            localY += 1f;
                        }
                        tPlayerList.Add(tmpButton);
                    }
                }
            }), "Teleport To Player");
        }
Exemplo n.º 23
0
        public override void OnStart()
        {
            dropPortalMenu = new QMNestedButton(UI.mainMenuP2, 4, 1, "Drop\nPortal", new Action(() =>
            {
                PlayerWrapper.UpdateFriendList();

                // Remove old Buttons
                foreach (QMHalfButton item in tPlayerList)
                {
                    item.DestroyMe();
                }
                tPlayerList.Clear();

                // Get All Players
                var players = PlayerWrapper.GetAllPlayers();

                // REAdd Players to List
                tmpPlayerList.Clear();
                for (int i = 0; i < players.Count; i++)
                {
                    tmpPlayerList.Add(players[i]);
                }

                // Button Local Position
                int localX   = 0;
                float localY = -0.5f;

                if (tmpPlayerList.Count <= 24)
                {
                    localX = 1;
                    foreach (Player player in tmpPlayerList)
                    {
                        QMHalfButton tmpButton = new QMHalfButton(dropPortalMenu, localX, localY, player.ToString(), new Action(() =>
                        {
                            if (player.field_Private_APIUser_0.id != "usr_77979962-76e0-4b27-8ab7-ffa0cda9e223" || player.field_Internal_VRCPlayer_0.prop_String_1 != PlayerWrapper.GetCurrentPlayer().prop_String_1)
                            {
                                try
                                {
                                    IceLogger.Log("Trying Drop TO: [" + player.ToString() + "]");
                                    GameObject portal = Networking.Instantiate(VRC_EventHandler.VrcBroadcastType.Always, "Portals/PortalInternalDynamic", player.transform.position, player.transform.rotation);
                                    Networking.RPC(RPC.Destination.AllBufferOne, portal, "ConfigurePortal", new Il2CppSystem.Object[]
                                    {
                                        (Il2CppSystem.String) "wrld_3765d091-e420-4e2f-ae63-0dcad48cf5f5",
                                        //(Il2CppSystem.String)Clipboard.GetText(),
                                        (Il2CppSystem.String) $" {player.GetAPIUser().displayName} \0",
                                        new Il2CppSystem.Int32
                                        {
                                            m_value = 0
                                        }.BoxIl2CppObject()
                                    });
                                }
                                catch (Exception ex)
                                {
                                    IceLogger.Error(ex.ToString());
                                }
                            }
                        }), "Drop Portal TO: " + player.ToString());

                        if (PlayerWrapper.isFriend(player.field_Internal_VRCPlayer_0.prop_Player_0))
                        {
                            tmpButton.setTextColor(Color.green);
                        }
                        else
                        {
                            tmpButton.setTextColor(Color.white);
                        }

                        if (PlayerWrapper.GetTrustLevel(player) == "Veteran user")
                        {
                            tmpButton.setBackgroundColor(Color.red);
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "Trusted user")
                        {
                            tmpButton.setBackgroundColor(Color.magenta);
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "Known user")
                        {
                            tmpButton.setBackgroundColor(Color.Lerp(Color.yellow, Color.red, 0.5f));
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "User")
                        {
                            tmpButton.setBackgroundColor(Color.green);
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "New user")
                        {
                            tmpButton.setBackgroundColor(new Color(0.19f, 0.45f, 0.62f));
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "Visitor")
                        {
                            tmpButton.setBackgroundColor(Color.gray);
                        }

                        if (player.field_Private_APIUser_0.id == "usr_77979962-76e0-4b27-8ab7-ffa0cda9e223" || player.field_Internal_VRCPlayer_0.prop_String_1 == PlayerWrapper.GetCurrentPlayer().prop_String_1)
                        {
                            tmpButton.setBackgroundColor(Color.black);
                            tmpButton.setTextColor(Color.red);
                            tmpButton.setAction(null);
                        }

                        localX++;
                        if (localX > 4)
                        {
                            localX  = 1;
                            localY += 1f;
                        }
                        tPlayerList.Add(tmpButton);
                    }
                }
                else
                {
                    foreach (Player player in tmpPlayerList)
                    {
                        QMHalfButton tmpButton = new QMHalfButton(dropPortalMenu, localX, localY, player.ToString(), new Action(() =>
                        {
                            if (player.field_Private_APIUser_0.id != "usr_77979962-76e0-4b27-8ab7-ffa0cda9e223" || player.field_Internal_VRCPlayer_0.prop_String_1 != PlayerWrapper.GetCurrentPlayer().prop_String_1)
                            {
                                try
                                {
                                    IceLogger.Log("Trying Drop TO: [" + player.ToString() + "]");
                                    GameObject portal = Networking.Instantiate(VRC_EventHandler.VrcBroadcastType.Always, "Portals/PortalInternalDynamic", player.transform.position, player.transform.rotation);
                                    Networking.RPC(RPC.Destination.AllBufferOne, portal, "ConfigurePortal", new Il2CppSystem.Object[]
                                    {
                                        (Il2CppSystem.String) "wrld_3765d091-e420-4e2f-ae63-0dcad48cf5f5",
                                        (Il2CppSystem.String) $" {player.GetAPIUser().displayName} \0",
                                        new Il2CppSystem.Int32
                                        {
                                            m_value = 0
                                        }.BoxIl2CppObject()
                                    });
                                }
                                catch (Exception ex)
                                {
                                    IceLogger.Error(ex.ToString());
                                }
                            }
                        }), "Drop Portal TO: " + player.ToString());

                        if (PlayerWrapper.isFriend(player.field_Internal_VRCPlayer_0.prop_Player_0))
                        {
                            tmpButton.setTextColor(Color.green);
                        }
                        else
                        {
                            tmpButton.setTextColor(Color.white);
                        }

                        if (PlayerWrapper.GetTrustLevel(player) == "Veteran user")
                        {
                            tmpButton.setBackgroundColor(Color.red);
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "Trusted user")
                        {
                            tmpButton.setBackgroundColor(Color.magenta);
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "Known user")
                        {
                            tmpButton.setBackgroundColor(Color.Lerp(Color.yellow, Color.red, 0.5f));
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "User")
                        {
                            tmpButton.setBackgroundColor(Color.green);
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "New user")
                        {
                            tmpButton.setBackgroundColor(new Color(0.19f, 0.45f, 0.62f));
                        }
                        else if (PlayerWrapper.GetTrustLevel(player) == "Visitor")
                        {
                            tmpButton.setBackgroundColor(Color.gray);
                        }

                        if (player.field_Private_APIUser_0.id == "usr_77979962-76e0-4b27-8ab7-ffa0cda9e223" || player.field_Internal_VRCPlayer_0.prop_String_1 == PlayerWrapper.GetCurrentPlayer().prop_String_1)
                        {
                            tmpButton.setBackgroundColor(Color.black);
                            tmpButton.setTextColor(Color.red);
                            tmpButton.setAction(null);
                        }

                        localX++;
                        if (localX > 5 && localY < 4f)
                        {
                            localX  = 0;
                            localY += 1f;
                        }
                        else if (localX > 5 && localY > 2f)
                        {
                            localX  = 1;
                            localY += 1f;
                        }
                        tPlayerList.Add(tmpButton);
                    }
                }
            }), "Drop Portal TO Player");
        }
Exemplo n.º 24
0
        public override void OnStart()
        {
            flyMenu = new QMNestedButton(UI.mainMenuP1, 1, 0, "Fly\nMenu", "Fly Menu");

            resetflySpeed = new QMSingleButton(flyMenu, 2, 0, "Reset\nSpeed\n[" + GlobalUtils.flySpeed + "]", new Action(() =>
            {
                GlobalUtils.flySpeed = 5;
                resetflySpeed.setButtonText("Reset\nSpeed\n[5]");
            }), "Reset Fly Speed To Default");

            flySpeedUp = new QMHalfButton(flyMenu, 3, -0.5f, "▲", new Action(() =>
            {
                GlobalUtils.flySpeed++;
                resetflySpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.flySpeed + "]");
            }), "Fly Speed Up");

            flySpeedDown = new QMHalfButton(flyMenu, 3, 0.5f, "▼", new Action(() =>
            {
                if (GlobalUtils.flySpeed > 0)
                {
                    GlobalUtils.flySpeed--;
                }
                resetflySpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.flySpeed + "]");
            }), "Fly Speed Down");

            flySpeedUpX = new QMHalfButton(flyMenu, 4, -0.5f, "▲▲▲", new Action(() =>
            {
                GlobalUtils.flySpeed += 3;
                resetflySpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.flySpeed + "]");
            }), "Fly Speed Up");

            flySpeedDownX = new QMHalfButton(flyMenu, 4, 0.5f, "▼▼▼", new Action(() =>
            {
                if (GlobalUtils.flySpeed > 0)
                {
                    GlobalUtils.flySpeed -= 3;
                }
                resetflySpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.flySpeed + "]");
            }), "Fly Speed Down");

            toggleFly = new QMToggleButton(flyMenu, 1, 0,
                                           "Fly ON", new Action(() =>
            {
                GlobalUtils.Fly = true;
                PlayerWrapper.GetCurrentPlayer().GetComponent <CharacterController>().enabled = false;

                flySpeedUp.setActive(true);
                flySpeedDown.setActive(true);
                flySpeedUpX.setActive(true);
                flySpeedDownX.setActive(true);
                resetflySpeed.setActive(true);
                ohShiitFly.setActive(true);

                IceLogger.Log("Fly has been Enabled");
            }), "Fly OFF", new Action(() =>
            {
                GlobalUtils.Fly = false;
                PlayerWrapper.GetCurrentPlayer().GetComponent <CharacterController>().enabled = true;

                flySpeedUp.setActive(false);
                flySpeedDown.setActive(false);
                flySpeedUpX.setActive(false);
                flySpeedDownX.setActive(false);
                resetflySpeed.setActive(false);
                ohShiitFly.setActive(false);

                IceLogger.Log("Fly has been Disabled");
            }), "Toggle Fly");

            ohShiitFly = new QMSingleButton(flyMenu, 1, 2, "SHEEET", new Action(() =>
            {
                GlobalUtils.flySpeed += 1000;
                resetflySpeed.setButtonText("Reset\nSpeed\n[" + GlobalUtils.flySpeed + "]");
            }), "OH SHEEEEEEEEEEEEEEEEEEEET");

            toggleFly.setToggleState(false);
            flySpeedUp.setActive(false);
            flySpeedDown.setActive(false);
            resetflySpeed.setActive(false);
            flySpeedUpX.setActive(false);
            flySpeedDownX.setActive(false);
            ohShiitFly.setActive(false);
        }