using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Scoops; using Scoops.customization; using Scoops.service; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalPhonesCustomNumbers")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LethalPhonesCustomNumbers")] [assembly: AssemblyTitle("LethalPhonesCustomNumbers")] [assembly: AssemblyVersion("1.0.0.0")] namespace LethalPhonesCustomNumbers; [HarmonyPatch(typeof(PhoneNetworkHandler))] public class ClientPhonePatch { [HarmonyPatch("CreateNewPhone")] [HarmonyPrefix] public static void CreateNewPhonePrefix(ref string skinId) { string text = ConfigManager.ClientRequestedNumber.Value; if (!string.IsNullOrEmpty(text) && text.Length > 0) { if (text.Length < 4) { text = text.PadLeft(4, '0'); } skinId = skinId + "|" + text; Plugin.Logger.LogInfo((object)("Client appended requested number to skinId: " + skinId)); } } } public static class ConfigManager { public static ConfigEntry SteamIdMappingConfig; public static Dictionary SteamIdToNumber = new Dictionary(); public static ConfigFile Config { get; private set; } public static ConfigEntry ClientRequestedNumber { get; private set; } public static void Init(ConfigFile config) { Config = config; ClientRequestedNumber = Config.Bind("Client", "RequestedNumber", "", "Your requested 4-digit phone number. Leave empty for a random number."); SteamIdMappingConfig = config.Bind("General", "SteamIdMapping", "76561198000000000:1234,76561198000000001:5678", "Comma-separated list of SteamID:Number mappings."); ParseMapping(); } public static void ParseMapping() { SteamIdToNumber.Clear(); string value = SteamIdMappingConfig.Value; if (string.IsNullOrWhiteSpace(value)) { return; } string[] array = value.Split(','); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(':'); if (array3.Length == 2 && ulong.TryParse(array3[0].Trim(), out var result) && short.TryParse(array3[1].Trim(), out var result2)) { SteamIdToNumber[result] = result2; Plugin.Logger.LogInfo((object)$"Loaded CustomNumbers map: {result} -> {result2}"); } } } } [HarmonyPatch(typeof(CustomizationManager))] public class CustomizationUIPatch { private static TMP_InputField numberInputField; private static readonly string[] TAB_NAMES = new string[3] { "SkinButton", "CharmButton", "RingtoneButton" }; [HarmonyPatch("SpawnCustomizationGUI")] [HarmonyPostfix] public static void SpawnCustomizationGUIPostfix() { object? obj = AccessTools.Field(typeof(CustomizationManager), "customizationPanel")?.GetValue(null); Transform val = (Transform)((obj is Transform) ? obj : null); if ((Object)(object)val == (Object)null) { Plugin.Logger.LogError((object)"CustomNumbers: customizationPanel not found!"); return; } Transform val2 = val.Find("Panel"); if ((Object)(object)val2 == (Object)null) { Plugin.Logger.LogError((object)"CustomNumbers: 'Panel' not found!"); return; } Plugin.Logger.LogInfo((object)"=== CustomNumbers: Panel Hierarchy Dump ==="); DumpHierarchy(val2, " "); Plugin.Logger.LogInfo((object)"=== CustomNumbers: End Dump ==="); List