using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MoreTaxTokensSimple")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MoreTaxTokensSimple")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("dab873ab-a85e-45e9-a2a5-ad88b7738f11")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace MoreTaxTokensSimple; [BepInPlugin("dyxc666.MoreTaxTokensSimple", "More Tax Tokens Simple", "1.7.1")] [BepInProcess("REPO.exe")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MoreTaxTokensPlugin : BaseUnityPlugin { internal static ManualLogSource Log; public static ConfigEntry TokenMultiplier; public static ConfigEntry ConvertTokensToCurrency; public static ConfigEntry MaxCurrencyBonus; private readonly Harmony harmony = new Harmony("dyxc666.MoreTaxTokensSimple"); private static readonly int[] CURRENCY_PER_RARITY_K = new int[4] { 2, 4, 10, 15 }; private static bool _currencyAlreadyAddedThisCycle = false; private void Awake() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; TokenMultiplier = ((BaseUnityPlugin)this).Config.Bind("General", "TokenMultiplier", 10, new ConfigDescription("税款代币获取倍率。每提取一个外观箱子,获得原数量 × 倍率 个代币。", (AcceptableValueBase)(object)new AcceptableValueRange(1, 100), Array.Empty())); MaxCurrencyBonus = ((BaseUnityPlugin)this).Config.Bind("General", "MaxCurrencyBonus", 50000, new ConfigDescription("单次折现总金额上限,单位:实际金额(非K)。范围 50000-200000。", (AcceptableValueBase)(object)new AcceptableValueRange(50000, 200000), Array.Empty())); ConvertTokensToCurrency = ((BaseUnityPlugin)this).Config.Bind("General", "ConvertTokensToCurrency", true, new ConfigDescription("客机无法同步的代币转为团队资金。\ntrue = 代币全拿 + 多出的代币按稀有度汇率折现(封顶见 MaxCurrencyBonus,联机自动同步,推荐搭配 CurrencyAsToken)\nfalse = 仅代币全拿,不发钱(单人/主机独享)", (AcceptableValueBase)null, Array.Empty())); try { MethodInfo methodInfo = AccessTools.Method("MetaManager:CosmeticTokenAdd", (Type[])null, (Type[])null); if (methodInfo != null) { harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(MoreTaxTokensPlugin), "CosmeticTokenAddPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)"✅ Prefix 补丁成功: MetaManager.CosmeticTokenAdd"); } else { Log.LogWarning((object)"未能找到 MetaManager.CosmeticTokenAdd 方法"); } } catch (Exception ex) { Log.LogError((object)("补丁失败: " + ex.Message)); } try { MethodInfo methodInfo2 = AccessTools.Method(typeof(RunManager), "ChangeLevel", (Type[])null, (Type[])null); if (methodInfo2 != null) { harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(MoreTaxTokensPlugin), "ChangeLevelPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)"✅ Prefix 补丁成功: RunManager.ChangeLevel"); } else { Log.LogWarning((object)"未能找到 RunManager.ChangeLevel 方法"); } } catch (Exception ex2) { Log.LogError((object)("ChangeLevel 补丁失败: " + ex2.Message)); } Log.LogInfo((object)$"More Tax Tokens Simple v1.7.1 初始化完成!TokenMultiplier = {TokenMultiplier.Value}x, ConvertTokensToCurrency = {ConvertTokensToCurrency.Value}, MaxCurrencyBonus = {MaxCurrencyBonus.Value}"); } [HarmonyPrefix] [HarmonyPatch(typeof(RunManager), "ChangeLevel")] public static void ChangeLevelPrefix() { _currencyAlreadyAddedThisCycle = false; } [HarmonyPrefix] [HarmonyPatch] public static bool CosmeticTokenAddPrefix(MetaManager __instance, object _rarity) { int value = TokenMultiplier.Value; if (value <= 1) { return true; } int num = (int)_rarity; if (SemiFunc.IsMasterClientOrSingleplayer()) { try { if (!(AccessTools.Field(typeof(MetaManager), "cosmeticTokens")?.GetValue(__instance) is List list)) { return true; } for (int i = 0; i < value; i++) { list.Add(num); } int num2 = value - 1; if (!_currencyAlreadyAddedThisCycle && ConvertTokensToCurrency.Value && num2 > 0) { _currencyAlreadyAddedThisCycle = true; int num3 = CURRENCY_PER_RARITY_K[num]; int val = num2 * num3 * 1000; val = Math.Min(val, MaxCurrencyBonus.Value); int num4 = SemiFunc.StatGetRunCurrency(); SemiFunc.StatSetRunCurrency(num4 + val); Log.LogInfo((object)$"\ud83d\udcb0 主机倍率 ×{value} | 代币 +{value} | 折现 {num2} 个({(object)(Rarity)num},单价 {num3}K)+{val} | {num4} → {num4 + val}"); } else if (_currencyAlreadyAddedThisCycle) { Log.LogInfo((object)$"\ud83d\udcb0 主机倍率 ×{value} | 代币 +{value}({(object)(Rarity)num})| 本关已折现,跳过"); } else { Log.LogInfo((object)$"\ud83d\udcb0 主机倍率 ×{value} | 代币 +{value}(稀有度: {(object)(Rarity)num})"); } } catch (Exception ex) { Log.LogError((object)("主机倍率处理失败: " + ex.Message)); } return false; } return true; } }