public static void SwitchPedestalToRandomPublicAvatar() { string id; WebRequest request = WebRequest.Create("http://vrcavatars.tk/public/random"); ServicePointManager.ServerCertificateValidationCallback = (object s, X509Certificate c, X509Chain cc, SslPolicyErrors ssl) => true; WebResponse response = request.GetResponse(); using (StreamReader rs = new StreamReader(response.GetResponseStream())) id = Regex.Replace(rs.ReadToEnd(), @"\n", ""); ApiAvatar avatar = new ApiAvatar(); avatar.id = id; avatar.Get(new Action <ApiContainer>(delegate(ApiContainer container) { if (avatar.releaseStatus != "public") { SwitchPedestalToRandomPublicAvatar(); return; } SwitchPedestalToAvatar(avatar); })); }
public static void FirstLoad(this UiAvatarList value, List <SavedAvi> list) { int deleted = 0; value.field_Private_Dictionary_2_String_ApiAvatar_0.Clear(); for (int i = 0; i < list.Count(); i++) { var t = list[i]; var avatar = new ApiAvatar() { id = t.AvatarID, name = t.Name, thumbnailImageUrl = t.ThumbnailImageUrl }; avatar.Get(new Action <ApiContainer>(x => { var avi = x.Model as ApiAvatar; if (avatar.releaseStatus == "private") { deleted++; list.Remove(t); return; } else { if (!value.field_Private_Dictionary_2_String_ApiAvatar_0.ContainsKey(t.AvatarID)) { value.field_Private_Dictionary_2_String_ApiAvatar_0.Add(t.AvatarID, avatar); } } })); } if (deleted > 0) { MelonLoader.MelonModLogger.Log($"Deleted {deleted} private avatars."); DAvatars = list; UpdateAvatars(); } value.specificListIds = list.Select(x => x.AvatarID).ToArray(); //value.Method_Protected_Virtual_Void_Int32_0(0); value.Method_Protected_Virtual_Void_Int32_1(0); }
void Login() { if (!ApiCredentials.Load()) { LoginErrorCallback("Not logged in"); } else { APIUser.FetchCurrentUser( delegate(ApiModelContainer <APIUser> c) { pipelineManager.user = c.Model as APIUser; ApiAvatar av = new ApiAvatar() { id = pipelineManager.blueprintId }; av.Get(false, (c2) => { VRC.Core.Logger.Log("<color=magenta>Updating an existing avatar.</color>", DebugLevel.API); apiAvatar = c2.Model as ApiAvatar; pipelineManager.completedSDKPipeline = !string.IsNullOrEmpty(apiAvatar.authorId); SetupUI(); }, (c2) => { VRC.Core.Logger.Log("<color=magenta>Creating a new avatar.</color>", DebugLevel.API); apiAvatar = new ApiAvatar(); apiAvatar.id = pipelineManager.blueprintId; pipelineManager.completedSDKPipeline = !string.IsNullOrEmpty(apiAvatar.authorId); SetupUI(); }); }, (c) => { LoginErrorCallback(c.Error); }); } }
private static void main_menu() { //page 1 mains var ck_flight = utils.make_text_toggle(0, 0, "Flight", fly_mode, main_menu_mod, new Action <bool>((a) => { if (a == true) { fly_mode = true; if (isNoclip) { return; } Physics.gravity = new Vector3(0, 0, 0); } if (a == false) { fly_mode = false; if (isNoclip) { return; } Physics.gravity = VRCSDK2.VRC_SceneDescriptor.Instance.gravity; VRCPlayer.field_Internal_Static_VRCPlayer_0.GetComponent <VRCMotionState>().Method_Public_Void_0(); } })); var ck_noclip = utils.make_text_toggle(1100, 0, "No-clip", isNoclip, main_menu_mod, new Action <bool>((a) => { if (a) { if (fly_mode == true) { fly_mode = false; } isNoclip = true; flying.noclip(); } else { isNoclip = false; flying.noclip(); } })); var ck_forceclone = utils.make_text_toggle(0, 150, "Force-clone", clone_mode, main_menu_mod, new Action <bool>((a) => { if (a) { clone_mode = true; } else { clone_mode = false; } })); var ck_playeresp = utils.make_text_toggle(1100, 150, "Player-ESP", esp_players, main_menu_mod, new Action <bool>((a) => { if (a) { esp_players = true; } else { esp_players = false; GameObject[] array = GameObject.FindGameObjectsWithTag("Player"); for (int i = 0; i < array.Length; i++) { if (array[i].transform.Find("SelectRegion")) { utils.toggle_outline(array[i].transform.Find("SelectRegion").GetComponent <Renderer>(), false); } } } })); var ck_portalkiller = utils.make_text_toggle(0, 300, "Delete-portals", delete_portals, main_menu_mod, new Action <bool>((a) => { if (a) { delete_portals = true; } else { delete_portals = false; } })); var ck_infoplus = utils.make_text_toggle(1100, 300, "Info+", info_plus_toggle, main_menu_mod, new Action <bool>((a) => { if (a) { info_plus_toggle = true; } else { info_plus_toggle = false; var users = utils.get_all_player(); var self = utils.get_local(); if (self == null || users == null) { return; } for (int i = 0; i < users.Count; i++) { var user = users[i]; if (user == null || user.field_Private_APIUser_0 == null) { continue; } var canvas = user.transform.Find("Canvas - Profile (1)/Text/Text - NameTag"); var canvas_2 = user.transform.Find("Canvas - Profile (1)/Text/Text - NameTag Drop"); if (canvas == null) { continue; } if (canvas_2 == null) { continue; } var text_object = canvas.GetComponent <UnityEngine.UI.Text>(); var text_object_2 = canvas_2.GetComponent <UnityEngine.UI.Text>(); if (text_object == null || text_object_2 == null || text_object.enabled == false) { continue; } text_object.supportRichText = true; text_object_2.text = $"{user.field_Private_APIUser_0.displayName}"; text_object.text = $"{user.field_Private_APIUser_0.displayName}"; } } })); var ck_speedup = utils.make_text_toggle(0, 450, "Speed+", speed_hacks, main_menu_mod, new Action <bool>((a) => { if (a) { speed_hacks = true; } else { speed_hacks = false; speed.set_speeds(2f, 4f); } })); var ck_ignorefriend = utils.make_text_toggle(1100, 450, "IgnoreFriends", anti_crasher_ignore_friends, main_menu_mod, new Action <bool>((a) => { if (a) { anti_crasher_ignore_friends = true; } else { anti_crasher_ignore_friends = false; } })); var ck_esprainbow = utils.make_text_toggle(0, 600, "ESP-rainbow", esp_rainbow_mode, main_menu_mod, new Action <bool>((a) => { if (a) { esp_rainbow_mode = true; } else { esp_rainbow_mode = false; } })); var ck_antispawnsound = utils.make_text_toggle(1100, 600, "AntiSpawnMusic", anti_spawn_music, main_menu_mod, new Action <bool>((a) => { if (a) { anti_spawn_music = true; } else { anti_spawn_music = false; } })); var ck_rainbowfriends = utils.make_text_toggle(0, 750, "Friend-rainbow", rainbow_friend_nameborder, main_menu_mod, new Action <bool>((a) => { if (a) { rainbow_friend_nameborder = true; } else { rainbow_friend_nameborder = false; var users = utils.get_all_player(); if (users == null) { return; } for (var i = 0; i < users.Count; i++) { var obj = users[i]; if (obj == null) { continue; } if (obj.field_Private_APIUser_0 == null) { continue; } if (utils.is_friend(obj) == false) { continue; } obj.field_Private_VRCPlayerApi_0.SetNamePlateColor(new Color(1f, 1f, 0f)); } } })); var ck_antishader = utils.make_text_toggle(1100, 750, "Anti-shader", anti_crasher_shader, main_menu_mod, new Action <bool>((a) => { if (a) { anti_crasher_shader = true; } else { anti_crasher_shader = false; shader_menu.reset_all(); } })); var ck_antishader_fetched = utils.make_text_toggle(0, 900, "Anti-shader-fetched", should_use_fetched_list, main_menu_mod, new Action <bool>((a) => { if (a) { should_use_fetched_list = true; } else { should_use_fetched_list = false; } })); var ck_flying_onpress = utils.make_text_toggle(1100, 900, "Fly onpress", fly_mode_onpress, main_menu_mod, new Action <bool>((a) => { if (a) { fly_mode_onpress = true; } else { fly_mode_onpress = false; } })); //half2 var b_jump = btn_utils.create_btn(false, ButtonType.Default, "Allow jump", "Enables jumping in a world that has it disabled", Color.white, Color.green, -3, 1, main_menu_mod.transform, new Action(() => { if (VRCPlayer.field_Internal_Static_VRCPlayer_0.gameObject.GetComponent <PlayerModComponentJump>() == null) { VRCPlayer.field_Internal_Static_VRCPlayer_0.gameObject.AddComponent <PlayerModComponentJump>(); } }), new Action(() => { }), 2); var b_avi_by_id = btn_utils.create_btn(false, ButtonType.Default, "Avi-by-id", "Saved a avatar to Fav+ just by using the avatars ID", Color.white, Color.green, -2, 1, main_menu_mod.transform, new Action(() => { menu.input_text("Enter the avatar ID (avtr_...)", "Confirm", new Action <string>((a) => { if (!a.Contains("avtr_")) { MelonModLogger.Log("Invalid avatar id!"); return; } var model = new ApiAvatar(); model.id = a; model.Get(DelegateSupport.ConvertDelegate <Il2CppSystem.Action <ApiContainer> > (new Action <ApiContainer> (delegate(ApiContainer t) { MelonModLogger.Log("Found avatar with name:" + model.name); MelonModLogger.Log("Avatar status is: " + model.releaseStatus); MelonModLogger.Log("Avatar asset URL: " + model.assetUrl); if (model.releaseStatus.Contains("public")) { //add to list avatar_utils.add_to_list(model); avatar_utils.update_list(avatar_config.avatar_list.Select(x => x.avatar_ident), hashmod.fav_list.listing_avatars); error_type_poput("Done!", "Added avatar to Fav+ (" + model.name + ")" + " by " + model.authorName); } else { MelonModLogger.Log("Avatar is private, can not add to Fav+!"); } }))); })); }), new Action(() => { }), 2); var b_pubs_by_id = btn_utils.create_btn(false, ButtonType.Default, "Pub-by-id", "Shows all public avatars for a user by his user ID", Color.white, Color.green, -1, 1, main_menu_mod.transform, new Action(() => { if (Time.time > last_apicall) { last_apicall = Time.time + 60; menu.input_text("Enter the User ID (usr_...)", "Confirm", new Action <string>((a) => { if (!a.Contains("usr_")) { MelonModLogger.Log("Invalid user id!"); return; } pubavatar.update_public_user_list(a); VRCUiManager.prop_VRCUiManager_0.Method_Public_Boolean_1(); })); } else { var sec_left = last_apicall - Time.time; error_type_poput("Function is still on cooldown!", "Please wait " + Math.Floor(sec_left) + " seconds before trying again!"); } }), new Action(() => { }), 2); var b_reset_dynbone = btn_utils.create_btn(false, ButtonType.Default, "Reset-bones", "Dsiables and clears current dynamic bone configurations", Color.white, Color.green, 0, 1, main_menu_mod.transform, new Action(() => { foreach (var a in dynbones.map) { dynbones.remove(a.Key); } }), new Action(() => { }), 2); }
public override void VRChat_OnUiManagerInit() { var shortcutmenu = utils.get_quick_menu().transform.Find("ShortcutMenu"); var screensmenu = GameObject.Find("Screens").transform.Find("UserInfo"); if (!setup_userinfo_button && screensmenu != null && utils.get_quick_menu().transform.Find("ShortcutMenu/BuildNumText") != null) { setup_userinfo_button = true; /*setup of stuff*/ pubavatar.setup_user_avatars_list(); favplus.setup_fav_plus(); /*clones*/ var back_button = screensmenu.transform.Find("BackButton"); var clone_button = UnityEngine.Object.Instantiate <GameObject>(back_button.gameObject); var clone_button_getasset = UnityEngine.Object.Instantiate <GameObject>(back_button.gameObject); var clone_button_clonepub = UnityEngine.Object.Instantiate <GameObject>(back_button.gameObject); var clone_button_clone_favplus = UnityEngine.Object.Instantiate <GameObject>(back_button.gameObject); var clone_button_clone_msg = UnityEngine.Object.Instantiate <GameObject>(back_button.gameObject); var clone_button_clone = UnityEngine.Object.Instantiate <GameObject>(utils.get_interact_menu().cloneAvatarButton.gameObject); clone_button.gameObject.name = "Teleport"; clone_button.transform.localPosition -= new Vector3(250, 0, 0); clone_button.GetComponentInChildren <UnityEngine.UI.Text>().text = $"Teleport"; clone_button.GetComponentInChildren <UnityEngine.UI.Button>().onClick = new UnityEngine.UI.Button.ButtonClickedEvent(); clone_button.GetComponentInChildren <UnityEngine.UI.Button>().onClick.AddListener(new Action(() => { social.do_tp_to_social(); })); clone_button_getasset.gameObject.name = $"Log asset"; clone_button_getasset.transform.localPosition -= new Vector3(500, 0, 0); clone_button_getasset.GetComponentInChildren <UnityEngine.UI.Text>().text = $"Log asset"; clone_button_getasset.GetComponentInChildren <UnityEngine.UI.Button>().onClick = new UnityEngine.UI.Button.ButtonClickedEvent(); clone_button_getasset.GetComponentInChildren <UnityEngine.UI.Button>().onClick.AddListener(new Action(() => { var menu = GameObject.Find("Screens").transform.Find("UserInfo"); var userInfo = menu.transform.GetComponentInChildren <VRC.UI.PageUserInfo>(); var found_player = utils.get_player(userInfo.user.id); if (found_player == null) { MelonModLogger.Log("player could not be found id " + userInfo.user.id); return; } MelonModLogger.Log("Asset for user " + userInfo.user.displayName + " -> " + found_player.field_Private_VRCAvatarManager_0.field_Private_ApiAvatar_0.assetUrl); MelonModLogger.Log("Avatar ID: " + found_player.field_Private_VRCAvatarManager_0.field_Private_ApiAvatar_0.id); MelonModLogger.Log("User ID: " + userInfo.user.id); })); clone_button_clonepub.gameObject.name = $"Clone 2"; clone_button_clonepub.transform.localPosition -= new Vector3(750, 0, 0); clone_button_clonepub.GetComponentInChildren <UnityEngine.UI.Text>().text = $"Clone"; clone_button_clonepub.GetComponentInChildren <UnityEngine.UI.Button>().onClick = new UnityEngine.UI.Button.ButtonClickedEvent(); clone_button_clonepub.GetComponentInChildren <UnityEngine.UI.Button>().onClick.AddListener(new Action(() => { social.do_clone_to_social(); })); clone_button_clone_favplus.gameObject.name = $"Clone F+"; clone_button_clone_favplus.transform.localPosition -= new Vector3(1000, 0, 0); clone_button_clone_favplus.GetComponentInChildren <UnityEngine.UI.Text>().text = $"Add Fav+"; clone_button_clone_favplus.GetComponentInChildren <UnityEngine.UI.Button>().onClick = new UnityEngine.UI.Button.ButtonClickedEvent(); clone_button_clone_favplus.GetComponentInChildren <UnityEngine.UI.Button>().onClick.AddListener(new Action(() => { favplus.save_social_to_favplus(); })); clone_button_clone_msg.gameObject.name = $"MSG invite"; clone_button_clone_msg.transform.localPosition -= new Vector3(1250, 0, 0); clone_button_clone_msg.GetComponentInChildren <UnityEngine.UI.Text>().text = $"Send msg"; clone_button_clone_msg.GetComponentInChildren <UnityEngine.UI.Text>().fontSize -= 8; clone_button_clone_msg.GetComponentInChildren <UnityEngine.UI.Button>().onClick = new UnityEngine.UI.Button.ButtonClickedEvent(); clone_button_clone_msg.GetComponentInChildren <UnityEngine.UI.Button>().onClick.AddListener(new Action(() => { var ff = GameObject.Find("Screens").transform.Find("UserInfo"); var userInfo = ff.transform.GetComponentInChildren <VRC.UI.PageUserInfo>(); MelonModLogger.Log("user selected " + userInfo.displayName + " id " + userInfo.user.id); if (Time.time > last_msg_apicall) { last_msg_apicall = Time.time + 30; in_input_shit = true; menu.input_text("Enter the text to send", "A message to send to the target", new Action <string>((a) => { in_input_shit = false; VRCWebSocketsManager.field_Private_Static_VRCWebSocketsManager_0.field_Private_Api_0.PostOffice.Send(Invite.Create(userInfo.user.id, "", new Location("", new Transmtn.DTO.Instance("", userInfo.user.id, "", "", "", false)), a)); })); } else { in_input_shit = false; var sec_left = last_msg_apicall - Time.time; error_type_poput("Function is still on cooldown!", "Please wait " + Math.Floor(sec_left) + " seconds before trying again!"); } })); clone_button.transform.SetParent(screensmenu, false); clone_button_getasset.transform.SetParent(screensmenu, false); clone_button_clonepub.transform.SetParent(screensmenu, false); clone_button_clone_favplus.transform.SetParent(screensmenu, false); clone_button_clone_msg.transform.SetParent(screensmenu, false); } if (shortcutmenu != null && setup_button == false) { setup_button = true; main_menu_mod = menu.make_blank_page("sub_menu"); main_menu_page2_mod = menu.make_blank_page("sub_menu_2"); main_menu_utils = menu.make_blank_page("sub_menu_3"); //menu entrance var menubutton = btn_utils.create_btn(false, ButtonType.Default, "Open menu", "Opens the mod menu", Color.white, Color.red, -4, 3, shortcutmenu, new Action(() => { sub_menu_open = true; main_menu_mod.SetActive(true); shortcutmenu.gameObject.SetActive(false); }), new Action(() => { })); //menu-menu entrance var submenubutton = btn_utils.create_btn(false, ButtonType.Default, "Next page", "Next page of the mod", Color.white, Color.red, -4, 3, main_menu_mod.transform, new Action(() => { sub_menu_open = false; sub_sub_menu_open = true; main_menu_mod.SetActive(false); main_menu_page2_mod.SetActive(true); shortcutmenu.gameObject.SetActive(false); }), new Action(() => { })); main_menu(); direct_menu(); //menu 2 slider_fov_txt = utils.make_slider(main_menu_page2_mod, delegate(float v) { fov_cam = v; slider_fov_txt.text = " Cam FOV (" + String.Format("{0:0.##}", v) + ")"; }, -3, 4, " Cam FOV (" + String.Format("{0:0.##}", fov_cam) + ")", fov_cam, 100, 60, 350); slider_flyspeed_txt = utils.make_slider(main_menu_page2_mod, delegate(float v) { flying_speed = v; slider_flyspeed_txt.text = " Fly-speed (" + String.Format("{0:0.##}", v) + ")"; }, -1, 4, " Fly-speed (" + String.Format("{0:0.##}", flying_speed) + ")", flying_speed, 18, 1, 350); slider_runspeed_txt = utils.make_slider(main_menu_page2_mod, delegate(float v) { run_speed = v; slider_runspeed_txt.text = " Run-speed (" + String.Format("{0:0.##}", v) + ")"; }, -3, 3, " Run-speed (" + String.Format("{0:0.##}", run_speed) + ")", run_speed, 24, 4, 200); slider_walkspeed_txt = utils.make_slider(main_menu_page2_mod, delegate(float v) { walk_speed = v; slider_walkspeed_txt.text = " Walk-speed (" + String.Format("{0:0.##}", v) + ")"; }, -1, 3, " Walk-speed (" + String.Format("{0:0.##}", walk_speed) + ")", walk_speed, 20, 2, 200); var add_by_id = btn_utils.create_btn(false, ButtonType.Default, "Add avatar to Fav+ by avatar ID", "Opens a dialog to add a avatar with just the avatar ID", Color.white, Color.red, -3, 1, main_menu_page2_mod.transform, new Action(() => { menu.input_text("Enter the avatar ID (avtr_...)", "Confirm", new Action <string>((a) => { if (!a.Contains("avtr_")) { MelonModLogger.Log("Invalid avatar id!"); return; } var model = new ApiAvatar(); model.id = a; model.Get(DelegateSupport.ConvertDelegate <Il2CppSystem.Action <ApiContainer> > (new Action <ApiContainer> (delegate(ApiContainer t) { MelonModLogger.Log("Found avatar with name:" + model.name); MelonModLogger.Log("Avatar status is: " + model.releaseStatus); MelonModLogger.Log("Avatar asset URL: " + model.assetUrl); if (model.releaseStatus.Contains("public")) { //add to list avatar_utils.add_to_list(model); avatar_utils.update_list(avatar_config.avatar_list.Select(x => x.avatar_ident), hashmod.fav_list.listing_avatars); MelonModLogger.Log("Attempted to add model to fav+"); } else { MelonModLogger.Log("Avatar is private, can not add to Fav+!"); } }))); })); }), new Action(() => { })); var rainbow_nameborder_friends = btn_utils.create_btn(rainbow_friend_nameborder, ButtonType.Toggle, "RBG friend border", "Enables a rainbow effect for friends name borders", Color.white, Color.red, -3, 0, main_menu_page2_mod.transform, new Action(() => { rainbow_friend_nameborder = true; }), new Action(() => { rainbow_friend_nameborder = false; //and reset colors var users = utils.get_all_player(); if (users == null) { return; } for (var i = 0; i < users.Count; i++) { var obj = users[i]; if (obj == null) { continue; } if (obj.field_Private_APIUser_0 == null) { continue; } if (utils.is_friend(obj) == false) { continue; } obj.field_Private_VRCPlayerApi_0.SetNamePlateColor(new Color(1f, 1f, 0f)); } })); var antishader = btn_utils.create_btn(anti_crasher_shader, ButtonType.Toggle, "Anti-shader", "Attempts to remove possibly toxic shaders", Color.white, Color.red, -2, 0, main_menu_page2_mod.transform, new Action(() => { anti_crasher_shader = true; }), new Action(() => { anti_crasher_shader = false; shader_menu.reset_all(); })); var antishader_fetched_list = btn_utils.create_btn(should_use_fetched_list, ButtonType.Toggle, "Anti-shader Fetched", "Will enable anti-shader to use a server hosted list of shaders as well", Color.white, Color.red, -1, 0, main_menu_page2_mod.transform, new Action(() => { should_use_fetched_list = true; }), new Action(() => { should_use_fetched_list = false; })); var pub_avatars_by_user_id = btn_utils.create_btn(false, ButtonType.Default, "Show public avatars by user ID", "Opens a dialog to look for the users public avatsr (Input a userid)", Color.white, Color.red, -2, 1, main_menu_page2_mod.transform, new Action(() => { if (Time.time > last_apicall) { last_apicall = Time.time + 60; menu.input_text("Enter the User ID (usr_...)", "Confirm", new Action <string>((a) => { if (!a.Contains("usr_")) { MelonModLogger.Log("Invalid user id!"); return; } pubavatar.update_public_user_list(a); MelonModLogger.Log("Check the avatar page to see public-avats by this author!"); VRCUiManager.prop_VRCUiManager_0.Method_Public_Boolean_1(); })); } else { var sec_left = last_apicall - Time.time; error_type_poput("Function is still on cooldown!", "Please wait " + Math.Floor(sec_left) + " seconds before trying again!"); } }), new Action(() => { })); var resetdynbones = btn_utils.create_btn(false, ButtonType.Default, "Reset dynamic bone cache", "Forces dyn bones to re-apply colliders", Color.white, Color.red, -1, 1, main_menu_page2_mod.transform, new Action(() => { foreach (var a in dynbones.map) { dynbones.remove(a.Key); } }), new Action(() => { })); Application.targetFrameRate = max_fps; } }