RUMBLE does not support other mod managers. If you want to use a manager, you must use the RUMBLE Mod Manager, a manager specifically designed for this game.
Decompiled source of NameBending v1.1.5
Mods/NameBending.dll
Decompiled a day agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using Il2CppExitGames.Client.Photon; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppPhoton.Pun; using Il2CppPhoton.Realtime; using Il2CppRUMBLE.Economy; using Il2CppRUMBLE.Players; using Il2CppRUMBLE.Players.Subsystems; using Il2CppRUMBLE.Utilities; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppTMPro; using MelonLoader; using NameBending; using Newtonsoft.Json; using RumbleModUI; using RumbleModdingAPI; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(NBClass), "NameBending", "1.1.5", "TacoSlayer36", null)] [assembly: MelonGame("Buckethead Entertainment", "RUMBLE")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("NameBending")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NameBending")] [assembly: AssemblyTitle("NameBending")] [assembly: AssemblyVersion("1.0.0.0")] public static class StringExt { public static string Truncate(this string value, int maxLength) { if (maxLength > 0) { if (string.IsNullOrEmpty(value)) { return value; } return (value.Length <= maxLength) ? value : value.Substring(0, maxLength); } if (maxLength == 0) { return ""; } return value; } } namespace NameBending; public static class BuildInfo { public const string Name = "NameBending"; public const string Author = "TacoSlayer36"; public const string Version = "1.1.5"; public const string Description = "Change your name and title to anything you like"; } public class Variation { [JsonProperty("altText")] public string AltText; [JsonProperty("frameDuration")] public int FrameDuration; [JsonProperty("frames")] public Dictionary<int, string> Frames; [JsonProperty("fonts")] public Dictionary<int, string> Fonts; [JsonProperty("cosmeticsPassword")] public string CosmeticsPassword; [JsonProperty("includeChoker")] public bool IncludeChoker; [JsonProperty("includeBelt")] public bool IncludeBelt; [JsonProperty("includeGlasses1")] public bool IncludedGlasses1; } public class Root { [JsonProperty("doRandomVariations")] public bool DoRandomVariations { get; set; } [JsonProperty("variations")] public List<Variation> Variations { get; set; } } public class Chunk { public int Index { get; set; } public string Id { get; set; } public string Data { get; set; } public int SetSize { get; set; } } public class JSON { public Variation Variation { get; set; } public string ID { get; set; } } public class NBClass : MelonMod { private Mod Mod = new Mod(); private bool showOtherNames = true; private bool showMyName = true; private bool showMyAlt = true; private bool showOtherTitles = true; private bool showMyTitle = true; private bool showAnimations = true; private bool showMatchInfoTags = true; private int truncationLength = -1; private bool disableRefresh = false; private int playerCount = 1; private string sceneName = "Loader"; private int buildIndex = 0; private int currentNameVariationIndex = 0; private int currentTitleVariationIndex = 0; private float timer = 0f; private const byte nameEventNumber = 30; private const byte titleEventNumber = 31; private bool eventInit = false; private bool globalInit = false; private bool fileoundErred = false; private List<Player> playerList; private List<Player> lastPlayerList; private List<JSON> allNameJsons = new List<JSON>(); private List<JSON> allTitleJsons = new List<JSON>(); private List<string> chunkyNameJsons = new List<string>(); private List<string> chunkyTitleJsons = new List<string>(); private Regex indexPattern = new Regex("^.{4}§"); private Regex idPattern = new Regex("§[A-Z\\d]+$"); private Regex idPatternFirstChunk = new Regex("}[A-Z\\d]+$"); private static RaiseEventOptions eventOptions = new RaiseEventOptions { Receivers = (ReceiverGroup)0 }; private float updateNameCooldown = 0f; private List<TMP_FontAsset> cachedFontAssets; private bool hasMatchInfo = false; private bool matchInfoSetUp = false; private GameObject player1TagClone = null; private GameObject player2TagClone = null; private static GameObject nameBendingObject; private static GameObject rainbowBelt; private static GameObject choker; private static GameObject glasses1; private Toggle legacyCamToggle; private List<Glasses1Instance> glasses1Instances = new List<Glasses1Instance>(); private static GameObject benderIcon; private List<Player> playersWithAccessories = new List<Player>(); private Player photonPlayer; private string modKey = "namebending"; public override void OnLateInitializeMelon() { UI.instance.UI_Initialized += OnUIInit; Calls.onMapInitialized += SceneLoaded; LoadFonts(); hasMatchInfo = Mods.findOwnMod("MatchInfo", "2.1.2", false); nameBendingObject = Object.Instantiate<GameObject>(Calls.LoadAssetFromStream<GameObject>((MelonMod)(object)this, "NameBending.assets.namebending", "NameBending")); Object.DontDestroyOnLoad((Object)(object)nameBendingObject); rainbowBelt = ((Component)nameBendingObject.transform.GetChild(1)).gameObject; choker = ((Component)nameBendingObject.transform.GetChild(0)).gameObject; glasses1 = ((Component)nameBendingObject.transform.GetChild(3)).gameObject; benderIcon = ((Component)nameBendingObject.transform.GetChild(2)).gameObject; nameBendingObject.SetActive(false); } public void OnUIInit() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown Mod.ModName = "NameBending"; Mod.ModVersion = "1.1.5"; Mod.SetFolder("NameBending"); Mod.AddDescription("Description", "", "Change your name and title to anything you like", new Tags { IsSummary = true }); Mod.AddToList("Others' Custom Names", true, 0, "See others' custom bent names", new Tags()); Mod.AddToList("My Custom Name", true, 0, "See your custom bent name", new Tags()); Mod.AddToList("My Alt Name", true, 0, "Others will see the name specified under \"altText\" in the settings file when they don't have the mod", new Tags()); Mod.AddToList("Others' Custom Titles", true, 0, "See others' custom bent titles", new Tags()); Mod.AddToList("My Custom Title", true, 0, "Others will see your custom bent title", new Tags()); Mod.AddToList("Animations", true, 0, "Name and title animations will be visible", new Tags()); Mod.AddToList("MatchInfo Tags", true, 0, "Fully customized name tags will show up on the MatchInfo sign", new Tags()); Mod.AddToList("Truncation Length", -1, "Max number of characters to show on names and titles (set to -1 to disable)", new Tags()); Mod.AddToList("Disable Refresh Shortcut", false, 0, "Disables pressing N to update names and titles", new Tags()); Mod.GetFromFile(); Mod.ModSaved += Save; UI.instance.AddMod(Mod); } public void Save() { showOtherNames = (bool)Mod.Settings[1].SavedValue; showMyName = (bool)Mod.Settings[2].SavedValue; showMyAlt = (bool)Mod.Settings[3].SavedValue; showOtherTitles = (bool)Mod.Settings[4].SavedValue; showMyTitle = (bool)Mod.Settings[5].SavedValue; showAnimations = (bool)Mod.Settings[6].SavedValue; showMatchInfoTags = (bool)Mod.Settings[7].SavedValue; truncationLength = (int)Mod.Settings[8].SavedValue; disableRefresh = (bool)Mod.Settings[9].SavedValue; } public override void OnUpdate() { Object val = default(Object); if (photonPlayer != null && ((Dictionary<Object, Object>)(object)photonPlayer.CustomProperties).TryGetValue(Object.op_Implicit(modKey), ref val)) { MelonLogger.Msg("player has custom prop, do your stuff with it"); } if (updateNameCooldown > 0f) { updateNameCooldown -= Time.deltaTime; } try { billboardFlares(); } catch { } if (!disableRefresh && Input.GetKeyDown((KeyCode)110) && sceneName != "Loader") { if ((sceneName != "Gym" && updateNameCooldown <= 0f) || sceneName == "Gym") { purgeNonexistentPlayerJsons(allNameJsons, Managers.GetPlayerManager().LocalPlayer); purgeNonexistentPlayerJsons(allTitleJsons, Managers.GetPlayerManager().LocalPlayer); updateNameCooldown = 3f; ((MelonBase)this).LoggerInstance.Msg("Updating name and title..."); determineSituation(); } else { ((MelonBase)this).LoggerInstance.Error("Please wait to update name again"); } } } public override void OnFixedUpdate() { if (showAnimations) { timer += Time.deltaTime; } if (!eventInit) { return; } insertChunkies(); if (sceneName != "Gym" && sceneName != "Loader") { if (Managers.GetPlayerManager().AllPlayers.Count > playerCount) { playerList = Managers.GetPlayerManager().AllPlayers; List<Player> val = new List<Player>(); if (lastPlayerList != null) { Enumerator<Player> enumerator = playerList.GetEnumerator(); while (enumerator.MoveNext()) { Player current = enumerator.Current; if (!lastPlayerList.Contains(current)) { val.Add(current); } } } AnalyzeAndRaise("Name"); AnalyzeAndRaise("Title"); timer = 0f; } if (Managers.GetPlayerManager().AllPlayers.Count < playerCount) { playerList = Managers.GetPlayerManager().AllPlayers; List<Player> val2 = new List<Player>(); if (lastPlayerList != null) { Enumerator<Player> enumerator2 = lastPlayerList.GetEnumerator(); while (enumerator2.MoveNext()) { Player current2 = enumerator2.Current; if (!playerList.Contains(current2)) { val2.Add(current2); } } } Enumerator<Player> enumerator3 = val2.GetEnumerator(); while (enumerator3.MoveNext()) { Player current3 = enumerator3.Current; try { playersWithAccessories.Remove(current3); } catch { } purgeNonexistentPlayerJsons(allNameJsons, current3); purgeNonexistentPlayerJsons(allTitleJsons, current3); } } lastPlayerList = new List<Player>(); if (playerList != null) { Enumerator<Player> enumerator4 = playerList.GetEnumerator(); while (enumerator4.MoveNext()) { Player current4 = enumerator4.Current; lastPlayerList.Add(current4); } } } playerCount = Managers.GetPlayerManager().AllPlayers.Count; if (showOtherNames && allNameJsons != null && allNameJsons.Any()) { finalize("Name"); } if (showOtherTitles && allTitleJsons != null && allTitleJsons.Any()) { finalize("Title"); } } private IEnumerator addAccessories(Player player, string toInclude) { yield return (object)new WaitForSeconds(0f); if (toInclude == "RainbowBelt") { GameObject obj2 = Object.Instantiate<GameObject>(rainbowBelt); obj2.transform.parent = ((Component)player.Controller).gameObject.transform.FindChild("Visuals/Skelington/Bone_Pelvis/Bone_Spine_A/"); obj2.transform.localPosition = new Vector3(-0.12769f, -0.06f, 0.358f); obj2.transform.localRotation = Quaternion.Euler(5f, 5f, 0f); obj2.transform.localScale = new Vector3(0.9f, 1f, 1.1f); obj2.SetActive(true); } if (toInclude == "Choker") { GameObject obj = Object.Instantiate<GameObject>(choker); obj.transform.parent = ((Component)player.Controller).gameObject.transform.FindChild("Visuals/Skelington/Bone_Pelvis/Bone_Spine_A/Bone_Chest/Bone_Neck"); obj.transform.localPosition = new Vector3(-0.178f, -0.456f, 0.4025f); obj.transform.localRotation = Quaternion.Euler(0f, 0f, 0f); obj.transform.localScale = new Vector3(1.03f, 1.03f, 1.12f); obj.SetActive(true); } } private void billboardFlares() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) if (glasses1Instances == null || !glasses1Instances.Any() || (Object)(object)Camera.main == (Object)null) { return; } foreach (Glasses1Instance glasses1Instance in glasses1Instances) { if (glasses1Instance == null) { try { glasses1Instances.Remove(glasses1Instance); } catch { } continue; } Vector3 position = ((Component)Camera.main).transform.position; Vector3 position2 = glasses1Instance.GameObject.transform.position; Vector3 forward = glasses1Instance.GameObject.transform.forward; float num = Vector3.Angle(forward, -((Component)Camera.main).transform.forward); float num2 = 20f; float num3 = 40f; float num4 = 0f; num4 = ((num <= num2) ? 1f : ((!(num <= num3)) ? 0f : Mathf.InverseLerp(num3, num2, num))); GameObject[] flares = glasses1Instance.Flares; foreach (GameObject val in flares) { if ((Object)(object)val != (Object)null) { val.transform.LookAt(position); Transform transform = val.transform; Quaternion rotation = val.transform.rotation; float x = ((Quaternion)(ref rotation)).eulerAngles.x; rotation = val.transform.rotation; float y = ((Quaternion)(ref rotation)).eulerAngles.y; rotation = ((Component)Camera.main).transform.rotation; transform.rotation = Quaternion.Euler(x, y, 0f - ((Quaternion)(ref rotation)).eulerAngles.z + 22.5f); Material material = ((Renderer)((Component)val.transform.GetChild(0)).GetComponent<MeshRenderer>()).material; Color color = material.color; color.a = num4 - 0.2f; material.color = color; } } } } private void addBenderIcon(Player player) { GameObject val = Object.Instantiate<GameObject>(benderIcon); val.transform.SetParent(((Component)player.Controller).gameObject.transform.Find("NameTag")); } private void insertChunkies() { if (chunkyNameJsons != null && chunkyNameJsons.Any()) { string text = dechunkify(chunkyNameJsons); if (text != null) { string text2 = findID(text); string text3 = text.Substring(0, text.Length - text2.Length); if (text3.EndsWith("§")) { text3 = text3.Substring(0, text3.Length - 1); } Variation variation = JsonConvert.DeserializeObject<Variation>(text3); JSON jSON = new JSON { Variation = variation, ID = text2 }; List<JSON> list = new List<JSON>(); foreach (JSON allNameJson in allNameJsons) { if (allNameJson.ID == text2) { list.Add(allNameJson); } } foreach (JSON item2 in list) { allNameJsons.Remove(item2); } allNameJsons.Add(jSON); Enumerator<Player> enumerator3 = Managers.GetPlayerManager().AllPlayers.GetEnumerator(); while (enumerator3.MoveNext()) { Player current3 = enumerator3.Current; if (current3.Data.GeneralData.PlayFabMasterId == jSON.ID && !playersWithAccessories.Contains(current3) && GetHash(jSON.Variation.CosmeticsPassword) == "0224e2c37553dad35a149265172d8ab0") { if (jSON.Variation.IncludeBelt) { MelonCoroutines.Start(addAccessories(current3, "RainbowBelt")); } if (jSON.Variation.IncludeChoker) { MelonCoroutines.Start(addAccessories(current3, "Choker")); } if (jSON.Variation.IncludedGlasses1) { MelonCoroutines.Start(addAccessories(current3, "Glasses1")); } playersWithAccessories.Add(current3); } } } } if (chunkyTitleJsons == null || !chunkyTitleJsons.Any()) { return; } string text4 = dechunkify(chunkyTitleJsons); if (text4 == null) { return; } string text5 = findID(text4); string text6 = text4.Substring(0, text4.Length - text5.Length); if (text6.EndsWith("§")) { text6 = text6.Substring(0, text6.Length - 1); } Variation variation2 = JsonConvert.DeserializeObject<Variation>(text6); JSON item = new JSON { Variation = variation2, ID = text5 }; if (variation2.Frames != null) { foreach (int item3 in variation2.Frames.Keys.ToList()) { if (variation2.Frames[item3].Length <= 80) { variation2.Frames[item3] = markCounterfeit(variation2.Frames[item3]); } } } List<JSON> list2 = new List<JSON>(); foreach (JSON allTitleJson in allTitleJsons) { if (allTitleJson.ID == text5) { list2.Add(allTitleJson); } } foreach (JSON item4 in list2) { allTitleJsons.Remove(item4); } allTitleJsons.Add(item); } private static string GetHash(string input) { if (string.IsNullOrEmpty(input)) { return string.Empty; } using MD5 mD = MD5.Create(); byte[] bytes = Encoding.UTF8.GetBytes(input); byte[] array = mD.ComputeHash(bytes); return BitConverter.ToString(array).Replace("-", "").ToLowerInvariant(); } private string findID(string str) { Match match = idPattern.Match(str); if (match.Success) { return match.Value.Substring(1); } match = idPatternFirstChunk.Match(str); if (match.Success) { return match.Value.Substring(1); } return null; } private void finalize(string tagType) { List<JSON> list = new List<JSON>(); List<JSON> list2 = new List<JSON>(); if (!(sceneName != "Loader")) { return; } if (tagType == "Name") { list2 = allNameJsons; } if (tagType == "Title") { list2 = allTitleJsons; } foreach (JSON item in list2) { try { if (item.Variation.Frames != null) { changeTagText(item.Variation, item.ID, tagType); } } catch { list.Add(item); } foreach (JSON item2 in list) { list2.Remove(item2); } } } private void purgeNonexistentPlayerJsons(List<JSON> purgeInJsons, Player player) { List<JSON> list = new List<JSON>(); foreach (JSON purgeInJson in purgeInJsons) { if (purgeInJson.ID == player.Data.GeneralData.PlayFabMasterId) { list.Add(purgeInJson); } } foreach (JSON item in list) { purgeInJsons.Remove(item); } } public override void OnSceneWasLoaded(int index, string name) { sceneName = name; buildIndex = index; } public override void OnSceneWasUnloaded(int buildIndex, string sceneName) { matchInfoSetUp = false; } public void SceneLoaded() { allNameJsons.Clear(); allTitleJsons.Clear(); determineSituation(); playersWithAccessories.Clear(); insertChunkies(); if (sceneName.Contains("Map") && hasMatchInfo) { MelonCoroutines.Start(reactivateMatchInfo()); if (showMatchInfoTags) { MelonCoroutines.Start(setUpMatchInfo(buildIndex)); } } legacyCamToggle = GameObject.Find("Game Instance/UI/Recording UI/Panel/Enabled/Toggle - Standard").GetComponent<Toggle>(); } private IEnumerator reactivateMatchInfo() { yield return (object)new WaitForSeconds(1f); GameObject sign = GameObject.Find("MatchInfoMod"); ((Component)sign.transform.Find("Player1Name")).gameObject.active = true; ((Component)sign.transform.Find("Player2Name")).gameObject.active = true; ((Component)sign.transform.Find("Player1BP")).gameObject.active = true; ((Component)sign.transform.Find("Player2BP")).gameObject.active = true; } private void determineSituation() { if (sceneName == "Gym" && !eventInit) { MelonCoroutines.Start(WaitThenAddEvent()); eventInit = true; } if (sceneName != "Loader") { AnalyzeAndRaise("Name"); AnalyzeAndRaise("Title"); } } private void AnalyzeAndRaise(string tagType) { if ((tagType == "Name" && !showMyName) || (tagType == "Title" && !showMyTitle)) { return; } string empty = string.Empty; try { empty = File.ReadAllText("UserData/NameBending/customBent" + tagType + ".json"); } catch { if (!fileoundErred) { ((MelonBase)this).LoggerInstance.Error($"Could not find custom {tagType.ToLower()} file at \"UserData/NameBending/customBent{tagType}.json\""); fileoundErred = true; } return; } string playFabMasterId = Managers.GetPlayerManager().LocalPlayer.Data.GeneralData.PlayFabMasterId; Root root = new Root(); try { root = JsonConvert.DeserializeObject<Root>(empty); } catch { ((MelonBase)this).LoggerInstance.Error("Failed to deserialize JSON. Make sure it is formatted correctly"); return; } string text = ""; int index = 0; if (root.DoRandomVariations) { long num = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); long num2 = num / 10000; Random random = new Random((int)(num2 & 0xFFFFFFFFu)); index = random.Next(0, root.Variations.Count); } else if (tagType == "Name") { index = currentNameVariationIndex; currentNameVariationIndex = (currentNameVariationIndex + 1) % root.Variations.Count; } else if (tagType == "Title") { index = currentTitleVariationIndex; currentTitleVariationIndex = (currentTitleVariationIndex + 1) % root.Variations.Count; } if (tagType == "Name" && showMyAlt && root.Variations[index].AltText.Length > 0 && root.Variations[index].AltText.Length <= 1000) { Managers.GetPlayerManager().LocalPlayer.Data.GeneralData.PublicUsername = root.Variations[index].AltText; } if (tagType == "Title") { foreach (int item in root.Variations[index].Frames.Keys.ToList()) { if (root.Variations[index].Frames[item].Length <= 80) { root.Variations[index].Frames[item] = markCounterfeit(root.Variations[index].Frames[item]); } } } text = JsonConvert.SerializeObject((object)root.Variations[index], (Formatting)1); if (sceneName == "Gym" || sceneName.Contains("Map")) { List<string> list = chunkify(text, 19900); if (list != null && list.Any()) { for (int i = 0; i < list.Count; i++) { string text2 = list[i] + "§" + playFabMasterId; text2 = i.ToString("D2") + list.Count.ToString("D2") + "§" + text2; if (tagType == "Name") { chunkyNameJsons.Add(text2); } else { chunkyTitleJsons.Add(text2); } } } else { ((MelonBase)this).LoggerInstance.Error($"Max variation character count exceeded in customBent{tagType}.json ({text.Length} > 500000)"); } } if (sceneName != "Gym") { MelonCoroutines.Start(WaitThenRaise(text, playFabMasterId, tagType)); } } private IEnumerator WaitThenRaise(string justVariationJson, string myInternalID, string tagType) { yield return (object)new WaitForSeconds(0.5f); List<string> chunkyJson = chunkify(justVariationJson, 19900); if (chunkyJson?.Any() ?? false) { for (int i = 0; i < chunkyJson.Count; i++) { string strToSend2 = chunkyJson[i]; strToSend2 = string.Concat(str3: strToSend2 + "§" + myInternalID, str0: i.ToString("D2"), str1: chunkyJson.Count.ToString("D2"), str2: "§"); byte eventNumber = 30; if (tagType == "Title") { eventNumber = 31; } PhotonNetwork.RaiseEvent(eventNumber, Object.op_Implicit(strToSend2), eventOptions, SendOptions.SendReliable); } } else { ((MelonBase)this).LoggerInstance.Error($"Max variation character count exceeded in customBent{tagType}.json ({justVariationJson.Length} > 500000)"); } } private List<string> chunkify(string str, int chunkSize) { List<string> list = new List<string>(); if (str.Length > 500000000) { return null; } for (int i = 0; i < str.Length; i += chunkSize) { if (i + chunkSize > str.Length) { list.Add(str.Substring(i)); } else { list.Add(str.Substring(i, chunkSize)); } } return list; } private IEnumerator WaitThenAddEvent() { yield return (object)new WaitForSeconds(0.5f); LoadBalancingClient networkingClient = PhotonNetwork.NetworkingClient; networkingClient.EventReceived += Action<EventData>.op_Implicit((Action<EventData>)OnEvent); } private IEnumerator setUpMatchInfo(int build) { if (!matchInfoSetUp) { yield return (object)new WaitForSeconds(3f); Player player1 = null; Player player2 = null; try { player1 = Managers.GetPlayerManager().AllPlayers[1]; } catch { } try { player2 = Managers.GetPlayerManager().AllPlayers[0]; } catch { } if (player1 == null || player2 == null || build != buildIndex) { yield break; } GameObject player1Tag = ((Component)((Component)player1.Controller).transform.Find("NameTag")).gameObject; if ((Object)(object)player1Tag != (Object)null) { player1TagClone = Object.Instantiate<GameObject>(player1Tag); PlayerNameTag tagComponent4 = player1Tag.GetComponent<PlayerNameTag>(); ((PlayerControllerSubsystem)tagComponent4).parentController = player1.Controller; player1TagClone.SetActive(false); ((TMP_Text)((Component)player1TagClone.transform.GetChild(0)).GetComponent<TextMeshPro>()).text = ((TMP_Text)((Component)player1Tag.transform.GetChild(0)).GetComponent<TextMeshPro>()).text; ((TMP_Text)((Component)player1TagClone.transform.GetChild(3)).GetComponent<TextMeshPro>()).text = ((TMP_Text)((Component)player1Tag.transform.GetChild(3)).GetComponent<TextMeshPro>()).text; } GameObject player2Tag = ((Component)((Component)player2.Controller).transform.Find("NameTag")).gameObject; if ((Object)(object)player2Tag != (Object)null) { player2TagClone = Object.Instantiate<GameObject>(player2Tag); PlayerNameTag tagComponent3 = player2TagClone.GetComponent<PlayerNameTag>(); ((PlayerControllerSubsystem)tagComponent3).parentController = player2.Controller; tagComponent3.UpdatePlayerBPText(); tagComponent3.UpdatePlayerNameTagColor(); tagComponent3.UpdatePlayerRankIcon(); tagComponent3.UpdatePlayerTitleText(); tagComponent3.UpdatePlayerNameText(); player2TagClone.SetActive(false); ((TMP_Text)((Component)player2TagClone.transform.GetChild(3)).GetComponent<TextMeshPro>()).text = ((TMP_Text)((Component)player2Tag.transform.GetChild(3)).GetComponent<TextMeshPro>()).text; ((TMP_Text)((Component)player2TagClone.transform.GetChild(0)).GetComponent<TextMeshPro>()).text = ((TMP_Text)((Component)player2Tag.transform.GetChild(0)).GetComponent<TextMeshPro>()).text; } yield return (object)new WaitForSeconds(3f); if (sceneName == "Map0") { if ((Object)(object)player1TagClone != (Object)null) { player1TagClone.transform.position = new Vector3(-2.51f, 0.27f, 20f); MelonLogger.Msg((object)player1TagClone.transform.position); } if ((Object)(object)player2TagClone != (Object)null) { player2TagClone.transform.position = new Vector3(0.51f, 0.27f, 20f); MelonLogger.Msg((object)player2TagClone.transform.position); } } if (sceneName == "Map1") { if ((Object)(object)player1TagClone != (Object)null) { player1TagClone.transform.position = new Vector3(-1.51f, 6.02f, 10.5f); MelonLogger.Msg((object)player1TagClone.transform.position); } if ((Object)(object)player2TagClone != (Object)null) { player2TagClone.transform.position = new Vector3(1.51f, 6.02f, 10.5f); MelonLogger.Msg((object)player2TagClone.transform.position); } } if ((Object)(object)player1TagClone != (Object)null) { player1TagClone.transform.localScale = new Vector3(2.5f, 2.5f, 2.5f); player1TagClone.transform.rotation = Quaternion.Euler(0f, 180f, 0f); player1TagClone.SetActive(true); PlayerNameTag tagComponent2 = player1TagClone.GetComponent<PlayerNameTag>(); ((PlayerControllerSubsystem)tagComponent2).parentController = player1.Controller; tagComponent2.FadePlayerNameTag(true); } if ((Object)(object)player2TagClone != (Object)null) { player2TagClone.transform.localScale = new Vector3(2.5f, 2.5f, 2.5f); player2TagClone.transform.rotation = Quaternion.Euler(0f, 180f, 0f); player2TagClone.SetActive(true); PlayerNameTag tagComponent = player2TagClone.GetComponent<PlayerNameTag>(); ((PlayerControllerSubsystem)tagComponent).parentController = player2.Controller; tagComponent.FadePlayerNameTag(true); } yield return (object)new WaitForSeconds(1f); GameObject sign = GameObject.Find("MatchInfoMod"); sign.transform.position = new Vector3(sign.transform.position.x, sign.transform.position.y, sign.transform.position.z - 0.5f); ((Component)sign.transform.Find("Player1Name")).gameObject.active = false; ((Component)sign.transform.Find("Player2Name")).gameObject.active = false; ((Component)sign.transform.Find("Player1BP")).gameObject.active = false; ((Component)sign.transform.Find("Player2BP")).gameObject.active = false; } matchInfoSetUp = true; } public void OnEvent(EventData photonEvent) { if (photonEvent.Code == 30) { chunkyNameJsons.Add(photonEvent.CustomData.ToString()); } if (photonEvent.Code == 31) { chunkyTitleJsons.Add(photonEvent.CustomData.ToString()); } } private int FindLastFrame(Dictionary<int, string> frames) { int num = 0; foreach (KeyValuePair<int, string> frame in frames) { if (frame.Key > num) { num = frame.Key; } } if (num > 0) { return num; } return 1; } private void changeTagText(Variation currentVariation, string id, string tagType) { try { Enumerator<Player> enumerator = Managers.GetPlayerManager().AllPlayers.GetEnumerator(); while (enumerator.MoveNext()) { Player current = enumerator.Current; float num = (float)currentVariation.FrameDuration / 1000f; TMP_FontAsset val = null; int num2 = FindLastFrame(currentVariation.Frames); if (currentVariation.Fonts != null && FindLastFrame(currentVariation.Fonts) > num2) { num2 = FindLastFrame(currentVariation.Fonts); } int key = (int)(timer / num) % (num2 + 1); string value = null; string value2 = null; currentVariation.Frames.TryGetValue(key, out value); if (currentVariation.Fonts != null) { currentVariation.Fonts.TryGetValue(key, out value2); } else { value2 = "GoodDogPlain"; } if (value == null && value2 == null) { continue; } if (cachedFontAssets != null && value2 != null) { foreach (TMP_FontAsset cachedFontAsset in cachedFontAssets) { if (((Object)cachedFontAsset).name == value2) { val = cachedFontAsset; } } } if (current.Data.GeneralData.PlayFabMasterId == id && sceneName != "Gym") { TextMeshPro val2 = null; if (current != Managers.GetPlayerManager().localPlayer) { try { if (tagType == "Name") { val2 = ((Component)((Component)current.Controller).gameObject.transform.Find("NameTag").Find("PlayerNameText")).GetComponent<TextMeshPro>(); } if (tagType == "Title") { val2 = ((Component)((Component)current.Controller).gameObject.transform.Find("NameTag").Find("Player Title Text")).GetComponent<TextMeshPro>(); } } catch { val2 = null; } if ((Object)(object)val2 != (Object)null && (value != null || (Object)(object)val != (Object)null)) { updateTextComponent(val2, value, val); } if (hasMatchInfo && sceneName.Contains("Map")) { try { if (tagType == "Name") { val2 = ((Component)player1TagClone.transform.Find("PlayerNameText")).GetComponent<TextMeshPro>(); } if (tagType == "Title") { val2 = ((Component)player1TagClone.transform.Find("Player Title Text")).GetComponent<TextMeshPro>(); } } catch { val2 = null; } if ((Object)(object)val2 != (Object)null && (value != null || (Object)(object)val != (Object)null)) { updateTextComponent(val2, value, val); } } } else if (hasMatchInfo && sceneName.Contains("Map")) { try { if (tagType == "Name") { val2 = ((Component)player2TagClone.transform.Find("PlayerNameText")).GetComponent<TextMeshPro>(); } if (tagType == "Title") { val2 = ((Component)player2TagClone.transform.Find("Player Title Text")).GetComponent<TextMeshPro>(); } } catch { val2 = null; } if ((Object)(object)val2 != (Object)null && (value != null || (Object)(object)val != (Object)null)) { updateTextComponent(val2, value, val); } } } if (!(sceneName == "Gym")) { continue; } TextMeshPro val3 = null; Transform val4 = PreviewPlayerController.GetGameObject().transform.Find("NameTag"); try { if (tagType == "Name") { val3 = ((Component)val4.Find("PlayerNameText")).GetComponent<TextMeshPro>(); } if (tagType == "Title") { val3 = ((Component)val4.Find("Player Title Text")).GetComponent<TextMeshPro>(); } } catch { val3 = null; } if ((Object)(object)val3 != (Object)null && (value != null || (Object)(object)val != (Object)null)) { updateTextComponent(val3, value, val); } } } catch { } } private void updateTextComponent(TextMeshPro textComponent, string value, TMP_FontAsset fontToApply) { if ((Object)(object)textComponent != (Object)null) { if (value != null && ((TMP_Text)textComponent).text != value.Truncate(truncationLength)) { ((TMP_Text)textComponent).text = value.Truncate(truncationLength); } if ((Object)(object)fontToApply != (Object)null && (Object)(object)((TMP_Text)textComponent).font != (Object)(object)fontToApply) { ((TMP_Text)textComponent).font = fontToApply; } } } private string removeInPlaceCharArray(string input) { int length = input.Length; char[] array = input.ToCharArray(); int length2 = 0; for (int i = 0; i < length; i++) { char c = array[i]; switch (c) { case '\t': case '\n': case '\v': case '\f': case '\r': case ' ': case '\u0085': case '\u00a0': case '\u1680': case '\u2000': case '\u2001': case '\u2002': case '\u2003': case '\u2004': case '\u2005': case '\u2006': case '\u2007': case '\u2008': case '\u2009': case '\u200a': case '\u2028': case '\u2029': case '\u202f': case '\u205f': case '\u3000': continue; } array[length2++] = c; } return new string(array, 0, length2); } private int levenshteinDistance(string source, string target) { if (string.IsNullOrEmpty(source)) { return (!string.IsNullOrEmpty(target)) ? target.Length : 0; } if (string.IsNullOrEmpty(target)) { return source.Length; } int length = source.Length; int length2 = target.Length; int[,] array = new int[length + 1, length2 + 1]; int num = 0; while (num <= length) { array[num, 0] = num++; } int num2 = 0; while (num2 <= length2) { array[0, num2] = num2++; } for (int i = 1; i <= length; i++) { for (int j = 1; j <= length2; j++) { int num3 = ((target[j - 1] != source[i - 1]) ? 1 : 0); array[i, j] = Math.Min(Math.Min(array[i - 1, j] + 1, array[i, j - 1] + 1), array[i - 1, j - 1] + num3); } } return array[length, length2]; } private string markCounterfeit(string value) { string text = value; CatalogHandler component = ((Component)Singleton<CatalogHandler>.Instance).GetComponent<CatalogHandler>(); Il2CppReferenceArray<CatalogItem> catalogItemsWithTags = component.GetCatalogItemsWithTags((ItemTag)4096); foreach (CatalogItem item in (Il2CppArrayBase<CatalogItem>)(object)catalogItemsWithTags) { string source = ("Item.Part.Title." + removeInPlaceCharArray(value) + ".Name").ToLower(); string target = item.Title.ToLower(); if (levenshteinDistance(source, target) <= 2) { text += "<pos=0><#F00>COUNTERFEIT"; break; } } return text; } private string dechunkify(List<string> list) { string str = list[0]; string text = findID(str); List<Chunk> list2 = new List<Chunk>(); List<string> list3 = new List<string>(); HashSet<int> hashSet = new HashSet<int>(); int num = -1; for (int i = 0; i < list.Count && i <= 26; i++) { string text2 = findID(list[i]); if (!(text == text2)) { continue; } int num2 = 0; int num3 = 1; string text3 = list[i].Substring(0, list[i].Length - text2.Length); if (text3.EndsWith("§")) { text3 = text3.Substring(0, text3.Length - 1); } if (indexPattern.Match(list[i]).Success) { num2 = int.Parse(list[i].Substring(0, 2)); num3 = int.Parse(list[i].Substring(2, 2)); text3 = list[i].Substring(5, list[i].Length - 5 - text2.Length); if (text3.EndsWith("§")) { text3 = text3.Substring(0, text3.Length - 1); } } if (num == -1) { num = num3; } if (!hashSet.Contains(num2)) { list2.Add(new Chunk { Index = num2, Id = text2, Data = text3, SetSize = num3 }); hashSet.Add(num2); list3.Add(list[i]); } } if (list2.Count != num) { return "{\"frameDuration\":600,\"frames\":{\"0\":\"<align=left>Loading.\",\"1\":\"<align=left>Loading..\",\"2\":\"<align=left>Loading...\"},\"fonts\":{\"0\":\"Arial\"}}" + text; } foreach (string item in list3) { list.Remove(item); } string text4 = string.Empty; foreach (Chunk item2 in list2.OrderBy((Chunk c) => c.Index).ToList()) { text4 += item2.Data; } return text4 + text; } private List<TMP_FontAsset> LoadFonts() { if (cachedFontAssets != null) { return cachedFontAssets; } List<TMP_FontAsset> list = new List<TMP_FontAsset>(); try { List<Font> list2 = new List<Font>(); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "Arial")); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "ChineseRocks")); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "ComicSans")); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "Crumble")); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "GoodDogPlain")); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "Impact")); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "Minecraft")); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "Roboto")); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "SGA")); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "TimesNewRoman")); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "Tumble")); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "TokiPona")); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "Avasinistral")); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "Wingdings")); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "Papyrus")); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "Cascadia")); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "Hollywood")); list2.Add(Calls.LoadAssetFromStream<Font>((MelonMod)(object)this, "NameBending.assets.fonts", "HighwayGothic")); foreach (Font item in list2) { TMP_FontAsset val = TMP_FontAsset.CreateFontAsset(item); ((Object)val).hideFlags = (HideFlags)61; list.Add(val); } ((Object)list[0]).name = "Arial"; ((Object)list[1]).name = "ChineseRocks"; ((Object)list[2]).name = "ComicSans"; ((Object)list[3]).name = "Crumble"; ((Object)list[4]).name = "GoodDogPlain"; ((Object)list[5]).name = "Impact"; ((Object)list[6]).name = "Minecraft"; ((Object)list[7]).name = "Roboto"; ((Object)list[8]).name = "SGA"; ((Object)list[9]).name = "TimesNewRoman"; ((Object)list[10]).name = "Tumble"; ((Object)list[11]).name = "TokiPona"; ((Object)list[12]).name = "Avasinistral"; ((Object)list[13]).name = "Wingdings"; ((Object)list[14]).name = "Papyrus"; ((Object)list[15]).name = "Cascadia"; ((Object)list[16]).name = "Hollywood"; ((Object)list[17]).name = "HighwayGothic"; cachedFontAssets = list; } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Error("Error loading fonts: " + ex.Message); } return list; } } internal class Glasses1Instance { public GameObject[] Flares = (GameObject[])(object)new GameObject[2]; public GameObject GameObject { get; private set; } public Player Owner { get; private set; } public Glasses1Instance(GameObject gameObject, Player owner) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) GameObject = gameObject; Owner = owner; Flares[0] = ((Component)GameObject.transform.Find("Flare1")).gameObject; Flares[1] = ((Component)GameObject.transform.Find("Flare2")).gameObject; GameObject[] flares = Flares; foreach (GameObject val in flares) { val.transform.GetChild(0).localScale = new Vector3(275f, 275f, 260f); } } }