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 FruityBarrierDecay v2.1.4
BarrierRework.dll
Decompiled a year 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 IL.RoR2; using Mono.Cecil.Cil; using MonoMod.Cil; using MoreStats; using On.RoR2; using On.RoR2.Items; using R2API; using R2API.Utils; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [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 = "")] [assembly: AssemblyCompany("BarrierRework")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BarrierRework")] [assembly: AssemblyTitle("BarrierRework")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace BarrierRework; [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.RiskOfBrainrot.FruityBarrierDecay", "FruityBarrierDecay", "2.1.2")] [R2APISubmoduleDependency(new string[] { "LanguageAPI", "ContentAddition" })] public class BarrierReworkPlugin : BaseUnityPlugin { public static float aegisBarrierFraction = 0.1f; public static float _aegisBarrierFlat = 60f; public static BuffDef aegisDecayBuff; public const string guid = "com.RiskOfBrainrot.FruityBarrierDecay"; public const string teamName = "RiskOfBrainrot"; public const string modName = "FruityBarrierDecay"; public const string version = "2.1.2"; private bool _useDynamicDecay = true; private float _barrierDecayRateStatic = 0f; private float _barrierDecayRateDynamic = 3f; public static PluginInfo PInfo { get; private set; } internal static ConfigFile CustomConfigFile { get; private set; } public static ConfigEntry<float> BarrierDecayRateStatic { get; set; } public static ConfigEntry<float> BarrierDecayRateDynamic { get; set; } public static ConfigEntry<bool> AegisRework { get; set; } public static ConfigEntry<float> AegisBarrierFlat { get; set; } protected void ReworkAegis() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown CreateBuff(); Hooks(); HealthComponent.Heal += new Manipulator(RemoveAegisOverheal); LanguageAPI.Add("ITEM_BARRIERONOVERHEAL_PICKUP", "Gain barrier on any interaction. While out of danger, barrier stops decaying."); LanguageAPI.Add("ITEM_BARRIERONOVERHEAL_DESC", "Using any interactable grants a <style=cIsHealing>temporary barrier</style> " + $"for <style=cIsHealing>{AegisBarrierFlat.Value} health</style> <style=cStack>(+{AegisBarrierFlat.Value} per stack)</style>. " + "While outside of danger, <style=cIsUtility>barrier will not decay</style>."); } private void RemoveAegisOverheal(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemCounts>(x, "barrierOnOverHeal") }); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldc_I4_0); } private void CreateBuff() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) aegisDecayBuff = ScriptableObject.CreateInstance<BuffDef>(); ((Object)aegisDecayBuff).name = "AegisDecayFreeze"; aegisDecayBuff.buffColor = new Color(0.95f, 0.85f, 0.08f); aegisDecayBuff.canStack = false; aegisDecayBuff.isDebuff = false; aegisDecayBuff.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texBuffGenericShield.tif").WaitForCompletion(); ContentAddition.AddBuffDef(aegisDecayBuff); } public void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown MultiShopCardUtils.OnMoneyPurchase += new hook_OnMoneyPurchase(OnMoneyPurchase); MultiShopCardUtils.OnNonMoneyPurchase += new hook_OnNonMoneyPurchase(OnNonMoneyPurchase); CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(AddItemBehavior); StatHooks.GetMoreStatCoefficients += new MoreStatHookEventHandler(AegisDecayFreeze); } private void AegisDecayFreeze(CharacterBody body, MoreStatHookEventArgs args) { if (body.HasBuff(aegisDecayBuff)) { args.barrierFreezeCount++; } } private void OnNonMoneyPurchase(orig_OnNonMoneyPurchase orig, PayCostContext context) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) AegisBarrierGrant(context); orig.Invoke(context); } private void OnMoneyPurchase(orig_OnMoneyPurchase orig, PayCostContext context) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) AegisBarrierGrant(context); orig.Invoke(context); } private void AddItemBehavior(orig_OnInventoryChanged orig, CharacterBody self) { orig.Invoke(self); if (NetworkServer.active) { self.AddItemBehavior<AegisDecayBehavior>(self.inventory.GetItemCount(Items.BarrierOnOverHeal)); } } private void AegisBarrierGrant(PayCostContext context) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) CharacterMaster activatorMaster = context.activatorMaster; CharacterBody val = ((activatorMaster != null) ? activatorMaster.GetBody() : null); if (Object.op_Implicit((Object)(object)val)) { int itemCount = val.inventory.GetItemCount(Items.BarrierOnOverHeal); HealthComponent healthComponent = val.healthComponent; if (itemCount > 0 && (Object)(object)healthComponent != (Object)null) { float num = (float)itemCount * _aegisBarrierFlat; healthComponent.AddBarrierAuthority(num); } } } public void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown CustomConfigFile = new ConfigFile(Paths.ConfigPath + "\\FruityBarrierDecay.cfg", true); AegisRework = CustomConfigFile.Bind<bool>("Aegis Rework", "Enable Aegis Rework", true, "Set to true to use fruity aegis, set to false for vanilla aegis."); AegisBarrierFlat = CustomConfigFile.Bind<float>("Aegis Rework", "Aegis Barrier On Interactable", _aegisBarrierFlat, "How much barrier the reworked Aegis grants on using interactables."); BarrierDecayRateStatic = CustomConfigFile.Bind<float>("Barrier Stats", "Flat Decay Time", _barrierDecayRateStatic, "Flat barrier decay, vanilla is 30 seconds. Expressed in seconds to deplete maximum barrier."); BarrierDecayRateDynamic = CustomConfigFile.Bind<float>("Barrier Stats", "Dynamic Decay Half-Life", _barrierDecayRateDynamic, "Fruity dynamic barrier decay. Expressed in seconds of half-life."); if (AegisRework.Value) { ReworkAegis(); } RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(BuffBarrier)); } private void BuffBarrier() { BaseStats.BarrierDecayStaticMaxHealthTime = BarrierDecayRateStatic.Value; BaseStats.BarrierDecayDynamicHalfLife = BarrierDecayRateDynamic.Value; } private void ChangeBarrierDecay(CharacterBody sender, MoreStatHookEventArgs args) { } } public class AegisDecayBehavior : ItemBehavior { private bool decayFrozen = false; public void FixedUpdate() { if (base.body.outOfDanger != decayFrozen) { if (!decayFrozen) { FreezeDecay(); } else { UnfreezeDecay(); } } } private void FreezeDecay() { decayFrozen = true; base.body.AddBuff(BarrierReworkPlugin.aegisDecayBuff); } private void UnfreezeDecay() { decayFrozen = false; base.body.RemoveBuff(BarrierReworkPlugin.aegisDecayBuff); } private void OnDisable() { if (decayFrozen) { UnfreezeDecay(); } } }