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 StrangeDrifter v1.0.0
plugins/StrangeDrifter/StrangeDrifter.dll
Decompiled 3 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.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using R2API; using RoR2; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("StrangeDrifter")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+5962c17d77f9ef77b4e517f170c33bdd8fbcab8d")] [assembly: AssemblyProduct("StrangeDrifter")] [assembly: AssemblyTitle("StrangeDrifter")] [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 StrangeDrifter { 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); } } public static class Stats { public static void ApplyStrangeScrapStats(CharacterBody body, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)body.inventory)) { int itemCountEffective = body.inventory.GetItemCountEffective(Items.StatsFromScrap); args.moveSpeedMultAdd += GetWhiteScrapStats(body, args, itemCountEffective); args.baseRegenAdd += GetGreenScrapStats(body, args, itemCountEffective); args.attackSpeedMultAdd += GetRedScrapStats(body, args, itemCountEffective); } } private static float GetWhiteScrapStats(CharacterBody body, StatHookEventArgs args, int statsFromScrapCount) { int itemCountEffective = body.inventory.GetItemCountEffective(Items.ScrapWhiteSuppressed); if (itemCountEffective <= 0 || statsFromScrapCount <= 0) { return 0f; } return 0.06f * (float)itemCountEffective * (float)statsFromScrapCount; } private static float GetGreenScrapStats(CharacterBody body, StatHookEventArgs args, int statsFromScrapCount) { int itemCountEffective = body.inventory.GetItemCountEffective(Items.ScrapGreenSuppressed); if (itemCountEffective <= 0 || statsFromScrapCount <= 0) { return 0f; } return (float)(statsFromScrapCount * itemCountEffective) * 3f; } private static float GetRedScrapStats(CharacterBody body, StatHookEventArgs args, int statsFromScrapCount) { int itemCountEffective = body.inventory.GetItemCountEffective(Items.ScrapRedSuppressed); if (itemCountEffective <= 0 || statsFromScrapCount <= 0) { return 0f; } return (float)(statsFromScrapCount * itemCountEffective) * 0.3f; } } [BepInPlugin("Bismuth.StrangeDrifter", "StrangeDrifter", "1.0.0")] public class StrangeDrifter : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static StatHookEventHandler <0>__ApplyStrangeScrapStats; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_UpdateBuffCounts <>9__7_0; internal void <Awake>b__7_0(orig_UpdateBuffCounts orig, DrifterTrashToTreasureController self) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (NetworkServer.active) { CharacterBody body = self.body; if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory)) { int num = body.inventory.GetItemCountEffective(Items.ScrapWhite) + body.inventory.GetItemCountEffective(Items.ScrapWhiteSuppressed); body.SetBuffCount(Buffs.TrashToTreasureWhite.buffIndex, num); int num2 = body.inventory.GetItemCountEffective(Items.ScrapGreen) + body.inventory.GetItemCountEffective(Items.RegeneratingScrap) + body.inventory.GetItemCountEffective(Items.ScrapGreenSuppressed); body.SetBuffCount(Buffs.TrashToTreasureGreen.buffIndex, num2); int num3 = body.inventory.GetItemCountEffective(Items.ScrapRed) + body.inventory.GetItemCountEffective(Items.ScrapRedSuppressed); body.SetBuffCount(Buffs.TrashToTreasureRed.buffIndex, num3); body.RecalculateStats(); } } } } public const string PluginGUID = "Bismuth.StrangeDrifter"; public const string PluginAuthor = "Bismuth"; public const string PluginName = "StrangeDrifter"; public const string PluginVersion = "1.0.0"; private const ItemTier whiteTier = 0; private const ItemTier greenTier = 1; private const ItemTier redTier = 2; public void Awake() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown ItemDef val = LegacyResourcesAPI.Load<ItemDef>("ItemDefs/ScrapWhiteSuppressed"); ItemDef val2 = LegacyResourcesAPI.Load<ItemDef>("ItemDefs/ScrapGreenSuppressed"); ItemDef val3 = LegacyResourcesAPI.Load<ItemDef>("ItemDefs/ScrapRedSuppressed"); if (Object.op_Implicit((Object)(object)val)) { val.tier = (ItemTier)0; val.deprecatedTier = (ItemTier)0; } if (Object.op_Implicit((Object)(object)val2)) { val2.tier = (ItemTier)1; val2.deprecatedTier = (ItemTier)1; } if (Object.op_Implicit((Object)(object)val3)) { val3.tier = (ItemTier)2; val3.deprecatedTier = (ItemTier)2; } object obj = <>O.<0>__ApplyStrangeScrapStats; if (obj == null) { StatHookEventHandler val4 = Stats.ApplyStrangeScrapStats; <>O.<0>__ApplyStrangeScrapStats = val4; obj = (object)val4; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; object obj2 = <>c.<>9__7_0; if (obj2 == null) { hook_UpdateBuffCounts val5 = delegate(orig_UpdateBuffCounts orig, DrifterTrashToTreasureController self) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (NetworkServer.active) { CharacterBody body = self.body; if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory)) { int num = body.inventory.GetItemCountEffective(Items.ScrapWhite) + body.inventory.GetItemCountEffective(Items.ScrapWhiteSuppressed); body.SetBuffCount(Buffs.TrashToTreasureWhite.buffIndex, num); int num2 = body.inventory.GetItemCountEffective(Items.ScrapGreen) + body.inventory.GetItemCountEffective(Items.RegeneratingScrap) + body.inventory.GetItemCountEffective(Items.ScrapGreenSuppressed); body.SetBuffCount(Buffs.TrashToTreasureGreen.buffIndex, num2); int num3 = body.inventory.GetItemCountEffective(Items.ScrapRed) + body.inventory.GetItemCountEffective(Items.ScrapRedSuppressed); body.SetBuffCount(Buffs.TrashToTreasureRed.buffIndex, num3); body.RecalculateStats(); } } }; <>c.<>9__7_0 = val5; obj2 = (object)val5; } DrifterTrashToTreasureController.UpdateBuffCounts += (hook_UpdateBuffCounts)obj2; } } }