using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("OrigamiCoder")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+261fa274ae861c2908bd5a3bc7db889a9b9b92c7")] [assembly: AssemblyProduct("ObfuscatedValues")] [assembly: AssemblyTitle("ObfuscatedValues")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ObfuscatedValues { [HarmonyPatch(typeof(CurrencyUI))] internal static class CurrencyUIPatch { [HarmonyPostfix] [HarmonyPatch("Update")] private static void Update_Postfix(CurrencyUI __instance) { if (!ObfuscatedValuesConfig.ObfuscateAllValues.Value && ((SemiFunc.RunIsLevel() && ObfuscatedValuesConfig.ExtractionValue.Value) || (SemiFunc.RunIsShop() && ObfuscatedValuesConfig.ShopExtraction.Value))) { ((TMP_Text)__instance.Text).text = "$???K"; } } [HarmonyPostfix] [HarmonyPatch("FetchCurrency")] private static void FetchCurrency_Postfix(CurrencyUI __instance) { if (!ObfuscatedValuesConfig.ObfuscateAllValues.Value) { ((TMP_Text)__instance.Text).text = "$???K"; } } } [HarmonyPatch(typeof(ExtractionPoint))] internal static class ExtractionPointPatch { [HarmonyPostfix] [HarmonyPatch("SetHaulText")] private static void SetHaulText_Postfix(ExtractionPoint __instance) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) if (ObfuscatedValuesConfig.ObfuscateAllValues.Value) { return; } if (!__instance.isShop) { if (ObfuscatedValuesConfig.ExtractionValue.Value) { string text = "$"; ((TMP_Text)__instance.haulGoalScreen).text = text + "???"; } } else if (ObfuscatedValuesConfig.ShopExtraction.Value) { string text2 = "$"; ((TMP_Text)__instance.haulGoalScreen).text = text2 + "???"; if (__instance.haulGoal - __instance.haulCurrent < 0) { ((TMP_Text)__instance.haulGoalScreen).text = "???"; ((Graphic)__instance.haulGoalScreen).color = Color.red; } } } [HarmonyPrefix] [HarmonyPatch("StateSuccess")] private static void StateSuccess_Prefix(out bool __state, ExtractionPoint __instance) { __state = __instance.stateStart; } [HarmonyPostfix] [HarmonyPatch("StateSuccess")] private static void StateSuccess_Postfix(bool __state, ExtractionPoint __instance) { if (ObfuscatedValuesConfig.ObfuscateAllValues.Value || !__state) { return; } if (!__instance.isShop) { if (ObfuscatedValuesConfig.ExtractionValue.Value) { ((TMP_Text)__instance.haulGoalScreen).text = "$???"; } } else if (ObfuscatedValuesConfig.ShopExtraction.Value) { ((TMP_Text)__instance.haulGoalScreen).text = "$???"; } } [HarmonyPostfix] [HarmonyPatch("StateSurplus")] private static void StateSurplus_Postfix(ExtractionPoint __instance) { if (!ObfuscatedValuesConfig.ObfuscateAllValues.Value && ObfuscatedValuesConfig.ExtractionValue.Value) { float num = 1.5f; if (__instance.stateTimer < __instance.initialStateTime - num && __instance.haulSurplusAnimated <= __instance.haulSurplus && __instance.initialStateTime != 0f) { ((TMP_Text)__instance.haulGoalScreen).text = "+$???"; } } } } [HarmonyPatch(typeof(HaulUI))] internal static class HaulUIPatch { [HarmonyPostfix] [HarmonyPatch("Update")] private static void Update_Postfix(HaulUI __instance) { if (!ObfuscatedValuesConfig.ObfuscateAllValues.Value && SemiFunc.RunIsLevel() && (ObfuscatedValuesConfig.ExtractionValue.Value || ObfuscatedValuesConfig.ExtractionGoal.Value)) { int extractionHaulGoal = RoundDirector.instance.extractionHaulGoal; int currentHaulValue = __instance.currentHaulValue; string text = "$"; string text2 = (ObfuscatedValuesConfig.ExtractionValue.Value ? "???" : SemiFunc.DollarGetString(currentHaulValue)); string text3 = (ObfuscatedValuesConfig.ExtractionGoal.Value ? "???" : SemiFunc.DollarGetString(extractionHaulGoal)); ((TMP_Text)__instance.Text).text = "" + text + text2 + " / " + text + "" + text3 + ""; } } } [HarmonyPatch(typeof(MenuPageSaves))] internal static class MenuPageSavesPatch { [HarmonyPostfix] [HarmonyPatch("SaveFileSelected")] private static void SaveFileSelected_Postfix(MenuPageSaves __instance) { if (ObfuscatedValuesConfig.ObfuscateAllValues.Value) { string pattern = "(?<= )\\d+"; ((TMP_Text)__instance.saveFileInfoRow1).text = Regex.Replace(((TMP_Text)__instance.saveFileInfoRow1).text, pattern, "???"); } } } [BepInPlugin("OrigamiCoder.ObfuscatedValues", "ObfuscatedValues", "1.0.2")] public class ObfuscatedValues : BaseUnityPlugin { internal static ObfuscatedValues Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } internal static class ObfuscatedValuesConfig { private const string SectionAll = "Obfuscate All Values (Override)"; private const string SectionValuables = "Obfuscate Valuables"; private const string SectionShop = "Obfuscate Shop"; internal static readonly ConfigEntry ObfuscateAllValues; private const bool DefaultObfuscateAllValues = false; internal static readonly ConfigEntry Valuables; private const bool DefaultValuables = true; internal static readonly ConfigEntry ValuableDamage; private const bool DefaultValuableDamage = false; internal static readonly ConfigEntry Cart; private const bool DefaultCart = false; internal static readonly ConfigEntry ExtractionValue; private const bool DefaultExtractionValue = false; internal static readonly ConfigEntry ExtractionGoal; private const bool DefaultExtractionGoal = false; internal static readonly ConfigEntry ShopItems; private const bool DefaultShopItems = false; internal static readonly ConfigEntry ShopExtraction; private const bool DefaultShopExtraction = false; static ObfuscatedValuesConfig() { ObfuscatedValues instance = ObfuscatedValues.Instance; ObfuscateAllValues = ((BaseUnityPlugin)instance).Config.Bind("Obfuscate All Values (Override)", "Obfuscate All Values", false, "Obscures all values. (Overrides all other settings)"); Valuables = ((BaseUnityPlugin)instance).Config.Bind("Obfuscate Valuables", "Valuables", true, "Obscures the value of valuables."); ValuableDamage = ((BaseUnityPlugin)instance).Config.Bind("Obfuscate Valuables", "ValuableDamage", false, "Obscures the value of valuable damage."); Cart = ((BaseUnityPlugin)instance).Config.Bind("Obfuscate Valuables", "Cart", false, "Obscures the value of valuables in cart."); ExtractionValue = ((BaseUnityPlugin)instance).Config.Bind("Obfuscate Valuables", "Extraction", false, "Obscures the value of valuables in extraction."); ExtractionGoal = ((BaseUnityPlugin)instance).Config.Bind("Obfuscate Valuables", "ExtractionGoal", false, "Obscures the value of the extraction goal."); ShopItems = ((BaseUnityPlugin)instance).Config.Bind("Obfuscate Shop", "ShopItems", false, "Obscures the value of shop items."); ShopExtraction = ((BaseUnityPlugin)instance).Config.Bind("Obfuscate Shop", "ShopExtraction", false, "Obscures the value of items in shop extraction."); } } [HarmonyPatch(typeof(SemiFunc))] internal static class SemiFuncPatch { [HarmonyPostfix] [HarmonyPatch("DollarGetString")] private static string DollarGetString_Postfix(string s) { return ObfuscatedValuesConfig.ObfuscateAllValues.Value ? "???" : s; } } [HarmonyPatch(typeof(ShopCostUI))] internal static class ShopCostUIPatch { [HarmonyPostfix] [HarmonyPatch("Update")] private static void Update_Postfix(ShopCostUI __instance) { if (SemiFunc.RunIsShop() && ObfuscatedValuesConfig.ShopExtraction.Value) { ((TMP_Text)__instance.Text).text = "-$???K"; } if (SemiFunc.RunIsLevel() && (ObfuscatedValuesConfig.ExtractionValue.Value || ObfuscatedValuesConfig.ObfuscateAllValues.Value)) { ((TMP_Text)__instance.Text).text = "+$???K"; } } } [HarmonyPatch(typeof(ValueScreen))] internal static class ValueScreenPatch { [HarmonyPostfix] [HarmonyPatch("SetValueText")] private static void SetValueText_Postfix(ValueScreen __instance) { if (ObfuscatedValuesConfig.Cart.Value) { string text = "$"; ((TMP_Text)__instance.displayText).text = text + "???"; } } } [HarmonyPatch(typeof(WorldSpaceUIValueLost))] internal static class WorldSpaceUIValueLostPatch { [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_Postfix(WorldSpaceUIValueLost __instance) { if (!ObfuscatedValuesConfig.ObfuscateAllValues.Value) { if (ObfuscatedValuesConfig.ValuableDamage.Value) { ((TMP_Text)__instance.text).text = "-$???"; } else if (ObfuscatedValuesConfig.Valuables.Value) { TextMeshProUGUI text = __instance.text; ((TMP_Text)text).text = ((TMP_Text)text).text + "?"; } } } } [HarmonyPatch(typeof(WorldSpaceUIValue))] internal static class WorldSpaceUIValuePatch { [HarmonyPostfix] [HarmonyPatch("Show")] [HarmonyPatch(new Type[] { typeof(PhysGrabObject), typeof(int), typeof(bool), typeof(Vector3) })] private static void Show_Postfix(bool _cost, WorldSpaceUIValue __instance) { if (ObfuscatedValuesConfig.ObfuscateAllValues.Value) { return; } if (_cost) { if (ObfuscatedValuesConfig.ShopItems.Value) { ((TMP_Text)__instance.text).text = "-$???K"; } } else if (ObfuscatedValuesConfig.Valuables.Value) { ((TMP_Text)__instance.text).text = "$???"; } } } }