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;
using UnityEngine;
[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.0.0")]
[BepInProcess("REPO.exe")]
public class MoreTaxTokensPlugin : BaseUnityPlugin
{
internal static ManualLogSource Log;
public static ConfigEntry<float> TokenMultiplier;
private readonly Harmony harmony = new Harmony("dyxc666.MoreTaxTokensSimple");
private void Awake()
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
TokenMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "TokenMultiplier", 10f, new ConfigDescription("税款代币获取倍率。每提取一个外观箱子,获得的代币数量 = 1 × 倍率。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 100f), Array.Empty<object>()));
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)"✅ 补丁成功: MetaManager.CosmeticTokenAdd (Prefix)");
}
else
{
Log.LogWarning((object)"未能找到 MetaManager.CosmeticTokenAdd 方法,请检查游戏版本。");
}
}
catch (Exception ex)
{
Log.LogError((object)("补丁失败: " + ex.Message));
}
Log.LogInfo((object)$"More Tax Tokens Simple v1.0.0 初始化完成!TokenMultiplier = {TokenMultiplier.Value}x");
}
private static List<int> GetCosmeticTokens(object instance)
{
return AccessTools.Field(instance.GetType(), "cosmeticTokens")?.GetValue(instance) as List<int>;
}
[HarmonyPrefix]
[HarmonyPatch]
public static void CosmeticTokenAddPrefix(object __instance, object _rarity)
{
int num = Mathf.RoundToInt(TokenMultiplier.Value);
if (num <= 1)
{
return;
}
int num2 = (int)_rarity;
List<int> cosmeticTokens = GetCosmeticTokens(__instance);
if (cosmeticTokens != null)
{
int count = cosmeticTokens.Count;
for (int i = 1; i < num; i++)
{
cosmeticTokens.Add(num2);
}
Log.LogInfo((object)$"\ud83d\udcb0 税款代币 ×{num} | {count} → 预计 {count + num} (稀有度: {(object)(Rarity)num2})");
}
}
}