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 TempItemsTooShort v1.1.0
TempItemsTooShort.dll
Decompiled 5 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using IL.RoR2.Items; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API; using RoR2; [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("TempItemsTooShort")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("TempItemsTooShort")] [assembly: AssemblyTitle("TempItemsTooShort")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TempItemsTooShort { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("acanthi.TempItemsTooShort", "TempItemsTooShort", "1.0.0")] public class TempItemsTooShort : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<Instruction, bool> <>9__8_1; public static Func<Instruction, bool> <>9__8_2; public static Func<Instruction, bool> <>9__8_3; public static Manipulator <>9__8_0; internal void <Awake>b__8_0(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 80f), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 10) })) { val.Index += 2; val.Next.Operand = 10 + duplicatorExtendDuration; } else { Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!"); } } internal bool <Awake>b__8_1(Instruction x) { return ILPatternMatchingExt.MatchLdcR4(x, 80f); } internal bool <Awake>b__8_2(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, 1); } internal bool <Awake>b__8_3(Instruction x) { return ILPatternMatchingExt.MatchLdcI4(x, 10); } } public const string PluginGUID = "acanthi.TempItemsTooShort"; public const string PluginAuthor = "acanthi"; public const string PluginName = "TempItemsTooShort"; public const string PluginVersion = "1.0.0"; private static ItemDef myItemDef; public static float extendDuration; public static int duplicatorExtendDuration; public static bool duplicatorDescriptionChanges; public void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); InitConfig(); TempItemsStorage.SetDecayDurationServer += new hook_SetDecayDurationServer(TempItemsStorage_SetDecayDurationServer); object obj = <>c.<>9__8_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val2 = new ILCursor(il); if (val2.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 80f), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 10) })) { val2.Index += 2; val2.Next.Operand = 10 + duplicatorExtendDuration; } else { Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!"); } }; <>c.<>9__8_0 = val; obj = (object)val; } DuplicatorBehavior.CalculateNewItemDecayDuration += (Manipulator)obj; if (duplicatorDescriptionChanges) { LanguageAPI.Add("ITEM_DUPLICATOR_DESC", "<style=cIsUtility>Picking up an item</style> gives you a <style=cIsTemporary>temporary copy</style> of itself. Temporary items last an additional <style=cIsDamage>" + (10 + duplicatorExtendDuration) + " <style=cStack>(+" + (10 + duplicatorExtendDuration) + " per stack)</style> seconds</style>.", "en"); } } private void InitConfig() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown extendDuration = ((BaseUnityPlugin)this).Config.Bind<float>("TempItemsTooShort", "Extend Duration", 40f, new ConfigDescription("How many extra seconds should Temporary Items last? (Negative values can be used to reduce the timer.)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-70f, 4800f), Array.Empty<object>())).Value; duplicatorExtendDuration = ((BaseUnityPlugin)this).Config.Bind<int>("TempItemsTooShort", "Substandard Duplicator Extra Duration", 30, new ConfigDescription("How many extra seconds should Substandard Duplicator give? (You shouldn't use negative values here....)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 4800), Array.Empty<object>())).Value; duplicatorDescriptionChanges = ((BaseUnityPlugin)this).Config.Bind<bool>("TempItemsTooShort", "Substandard Duplicator Enable Description Changes", true, "Changes the description of Substandard Duplicator to match the extra duration. Might cause compat issues.").Value; } private void TempItemsStorage_SetDecayDurationServer(orig_SetDecayDurationServer orig, ref TempItemsStorage self, float newDecayDuration) { newDecayDuration += extendDuration; orig.Invoke(ref self, newDecayDuration); } } }