Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of CosmeticTokenAdder v0.1.0
CosmeticTokenAdder.dll
Decompiled 12 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("CosmeticTokenAdder")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CosmeticTokenAdder")] [assembly: AssemblyTitle("CosmeticTokenAdder")] [assembly: AssemblyVersion("1.0.0.0")] namespace CosmeticTokenAdder; [BepInPlugin("lch.cosmetictokenadder", "Cosmetic Token Adder", "0.1.0")] public class Plugin : BaseUnityPlugin { public const string GUID = "lch.cosmetictokenadder"; public const string NAME = "Cosmetic Token Adder"; public const string VERSION = "0.1.0"; internal static ManualLogSource Log; private ConfigEntry<KeyCode> _key; private ConfigEntry<string> _rarity; private ConfigEntry<int> _amount; private ConfigEntry<bool> _skipAnim; private static FieldInfo _timerField; private void Awake() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; _key = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "AddTokenKey", (KeyCode)103, "按此键发放装扮代币"); _rarity = ((BaseUnityPlugin)this).Config.Bind<string>("Settings", "TokenRarity", "UltraRare", new ConfigDescription("代币稀有度: Common(绿)/Uncommon(青蓝)/Rare(粉紫)/UltraRare(橙)", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[4] { "Common", "Uncommon", "Rare", "UltraRare" }), Array.Empty<object>())); _amount = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "TokenAmount", 5, new ConfigDescription("每次按键发放的代币数量(1-10)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>())); _skipAnim = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "SkipRewardAnimation", true, "抽奖加速: true=跳过展示动画, false=恢复原速"); _timerField = typeof(CosmeticShopMachine).GetField("stateTimer", BindingFlags.Instance | BindingFlags.NonPublic); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Cosmetic Token Adder v0.1.0 loaded."); } private void Update() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) SkipAnimation(); if (!Input.GetKeyDown(_key.Value)) { return; } MetaManager instance = MetaManager.instance; if ((Object)(object)instance == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"[Token] MetaManager 尚未初始化,无法发放代币"); return; } Rarity val = ParseRarity(_rarity.Value); int num = ((_amount.Value < 1) ? 1 : _amount.Value); try { for (int i = 0; i < num; i++) { instance.CosmeticTokenAdd(val); } ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[Token] 已发放 {num} 枚 {val} 代币"); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[Token] 发放失败(UI 可能未初始化): " + ex.Message)); } } private void SkipAnimation() { if (_skipAnim.Value) { CosmeticShopMachine instance = CosmeticShopMachine.instance; if (!((Object)(object)instance == (Object)null) && !(_timerField == null)) { _timerField.SetValue(instance, 0f); } } } private static Rarity ParseRarity(string s) { switch ((s ?? string.Empty).Trim().ToLower()) { case "uncommon": return (Rarity)1; case "rare": return (Rarity)2; case "ultrarare": case "ultra": return (Rarity)3; default: return (Rarity)0; } } }