From 11529b4d99c9095e52bcf18c298aa07b7a3b5c7e Mon Sep 17 00:00:00 2001 From: Deez Date: Wed, 25 Nov 2026 22:48:16 -0500 Subject: [PATCH] Upload files to "Tools" --- Tools/Extensions.cs | 56 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Tools/Extensions.cs diff --git a/Tools/Extensions.cs b/Tools/Extensions.cs new file mode 100644 index 0000000..db7ac98 --- /dev/null +++ b/Tools/Extensions.cs @@ -0,0 +1,56 @@ +using System; + +namespace FortniteEmoteWheel.Tools; + +public static class Extensions +{ + public static Action OnPlayerCosmeticsLoaded; + + public static string CleanString(string input, int maxLength, char[] ignoredChars = null) + { + input = new string(Array.FindAll(input.ToCharArray(), character => + Utils.IsASCIILetterOrDigit(character) || + ignoredChars != null && + Array.IndexOf(ignoredChars, character) != -1)); + + if (input.Length > maxLength) + input = input[..maxLength]; + + return input.ToUpper(); + } + + private static bool HasOwnedCosmetic(VRRig rig, string cosmeticName) + { + if (rig._playerOwnedCosmetics == null) + return false; + + foreach (string ownedCosemtic in rig._playerOwnedCosmetics) + { + if (string.IsNullOrEmpty(ownedCosemtic)) + continue; + + if (ownedCosemtic.IndexOf(cosmeticName, StringComparison.Ordinal) >= 0) + return true; + } + + return false; + } + + public static string GetPlatform(this VRRig Player) + { + string platformProperty = (string)Player.creator.GetPlayerRef().CustomProperties["platform"]; + + if (!string.IsNullOrEmpty(platformProperty)) + return platformProperty; + + if (HasOwnedCosmetic(Player, "S. FIRST LOGIN")) + return "STEAM"; + + if (HasOwnedCosmetic(Player, "FIRST LOGIN") || + Player.creator != null && Player.creator.GetPlayerRef().CustomProperties.Count >= 3 || + Player.currentRankedSubTierPC > 0) + return "PC"; + + return "Quest"; + } +}