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 DoomslugQualityItemMod v1.3.2
DoomslugQualityItemMod.dll
Decompiled a month agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using DoomslugQualityItemMod.Items; using ItemQualities; using ItemQualities.ContentManagement; using ItemQualities.Utilities.Extensions; using Microsoft.CodeAnalysis; using On.RoR2; using On.RoR2.Projectile; using R2API; using RoR2; using RoR2.Projectile; 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 = ".NET Standard 2.1")] [assembly: AssemblyCompany("DoomslugQualityItemMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+49bfc3f2d2a54ff3613a7f917e652e39e87cb268")] [assembly: AssemblyProduct("DoomslugQualityItemMod")] [assembly: AssemblyTitle("DoomslugQualityItemMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 DoomslugQualityItemMod { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Doomslug.Test", "Test", "1.3.2")] public class Initialize : BaseUnityPlugin { public const string PluginGUID = "Doomslug.Test"; public const string PluginAuthor = "Doomslug"; public const string PluginName = "Test"; public const string PluginVersion = "1.3.2"; public void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "doomslugbundle")); if (!Object.op_Implicit((Object)(object)val)) { Log.Error("AssetBundle failed to load!"); } MicrobialBullets.Init(val); QualityMicrobialBullets.Init(); Biomissiles.Init(val); QualityBiomissiles.Init(); SourSaltShaker.Init(val); QualitySourSaltShaker.Init(); AnatomyTextbook.Init(val); QualityAnatomyTextbook.Init(); } private void Update() { MicrobialBullets.Update(); Biomissiles.Update(); } } 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); } } } namespace DoomslugQualityItemMod.Items { public class AnatomyTextbookMarker : MonoBehaviour { } public class AnatomyTextbook { [CompilerGenerated] private static class <>O { public static hook_OnCharacterDeath <0>__GlobalEventManager_OnCharacterDeath; public static StatHookEventHandler <1>__RecalculateStats; } public static string IconName = "Placeholder_Icon"; public static ItemDef ItemDef; public static BuffDef KnowledgeBuff; public static void Init(AssetBundle bundle) { if (!Object.op_Implicit((Object)(object)bundle)) { Log.Error("AssetBundle failed to load!"); } CreateItem(bundle); CreateBuff(bundle); AddHooks(); } private static void CreateItem(AssetBundle bundle) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown ItemDef = ScriptableObject.CreateInstance<ItemDef>(); ((Object)ItemDef).name = "DOOMSLUG_ANATOMY_TEXTBOOK"; ItemDef.nameToken = "DOOMSLUG_ANATOMY_TEXTBOOK_NAME"; ItemDef.pickupToken = "DOOMSLUG_ANATOMY_TEXTBOOK_PICKUP"; ItemDef.descriptionToken = "DOOMSLUG_ANATOMY_TEXTBOOK_DESC"; ItemDef.loreToken = "DOOMSLUG_ANATOMY_TEXTBOOK_DESC_LORE"; LanguageAPI.Add("DOOMSLUG_ANATOMY_TEXTBOOK_NAME", "Anatomy Textbook"); LanguageAPI.Add("DOOMSLUG_ANATOMY_TEXTBOOK_PICKUP", "Killing an enemy grants increased crit chance and damage"); LanguageAPI.Add("DOOMSLUG_ANATOMY_TEXTBOOK_DESC", "Killing an enemy grants a stack of Knowledge for 3 seconds. Gain 10% (+10% per stack) critical strike chance and damage per stack"); ItemDef._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier1Def.asset").WaitForCompletion(); ItemDef.pickupIconSprite = bundle.LoadAsset<Sprite>(IconName); ItemDef.pickupModelPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion(); ItemDef.canRemove = true; ItemDef.hidden = false; ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null); ItemAPI.Add(new CustomItem(ItemDef, val)); } private static void AddHooks() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown object obj = <>O.<0>__GlobalEventManager_OnCharacterDeath; if (obj == null) { hook_OnCharacterDeath val = GlobalEventManager_OnCharacterDeath; <>O.<0>__GlobalEventManager_OnCharacterDeath = val; obj = (object)val; } GlobalEventManager.OnCharacterDeath += (hook_OnCharacterDeath)obj; object obj2 = <>O.<1>__RecalculateStats; if (obj2 == null) { StatHookEventHandler val2 = RecalculateStats; <>O.<1>__RecalculateStats = val2; obj2 = (object)val2; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj2; } private static void GlobalEventManager_OnCharacterDeath(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, damageReport); if (!Object.op_Implicit((Object)(object)damageReport.attacker) || !Object.op_Implicit((Object)(object)damageReport.victim)) { return; } CharacterBody component = damageReport.attacker.GetComponent<CharacterBody>(); CharacterBody component2 = ((Component)damageReport.victim).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory) && Object.op_Implicit((Object)(object)component2)) { int itemCount = component.inventory.GetItemCount(ItemDef.itemIndex); if (itemCount > 0) { component.AddTimedBuff(KnowledgeBuff, 3f); } } } private static void RecalculateStats(CharacterBody body, StatHookEventArgs args) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body.inventory)) { int itemCount = body.inventory.GetItemCount(ItemDef.itemIndex); if (itemCount > 0 && body.HasBuff(KnowledgeBuff)) { int buffCount = body.GetBuffCount(KnowledgeBuff); args.critAdd += (float)(itemCount * 10 * buffCount); args.critDamageMultAdd += (float)itemCount * 0.1f * (float)buffCount; } } } public static void Update() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)286)) { Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed F5. Spawning our AnatomyTextbook at coordinates {transform.position}"); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(ItemDef.itemIndex), transform.position, transform.forward * 20f); } } private static void CreateBuff(AssetBundle bundle) { KnowledgeBuff = ScriptableObject.CreateInstance<BuffDef>(); ((Object)KnowledgeBuff).name = "DOOMSLUG_KNOWLEDGE"; LanguageAPI.Add("DOOMSLUG_KNOWLEDGE", "Knowledge"); KnowledgeBuff.canStack = true; KnowledgeBuff.isDebuff = false; KnowledgeBuff.isCooldown = false; KnowledgeBuff.iconSprite = bundle.LoadAsset<Sprite>(IconName); ContentAddition.AddBuffDef(KnowledgeBuff); } } public class BiomissilesMarker : MonoBehaviour { } public class Biomissiles { [CompilerGenerated] private static class <>O { public static hook_OnHitEnemy <0>__GlobalEventManager_OnHitEnemy; public static hook_Awake <1>__ProjectileController_Awake; public static StatHookEventHandler <2>__RecalculateStats; } public static string IconName = "Biomissile_Icon"; public static ItemDef ItemDef; public static ModdedProcType BiomissilesProcType; private static bool isFiringBiomissile = false; private static double procCoeffecient = 0.5; private static GameObject missilePrefab; public static void Init(AssetBundle bundle) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) BiomissilesProcType = ProcTypeAPI.ReserveProcType(); if (!Object.op_Implicit((Object)(object)bundle)) { Log.Error("AssetBundle failed to load!"); } CreateItem(bundle); AddHooks(); } private static void CreateItem(AssetBundle bundle) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown ItemDef = ScriptableObject.CreateInstance<ItemDef>(); ((Object)ItemDef).name = "DOOMSLUG_BIOMISSILES"; ItemDef.nameToken = "DOOMSLUG_BIOMISSILES_NAME"; ItemDef.pickupToken = "DOOMSLUG_BIOMISSILES_PICKUP"; ItemDef.descriptionToken = "DOOMSLUG_BIOMISSILES_DESC"; ItemDef.loreToken = "DOOMSLUG_BIOMISSILES_DESC_LORE"; LanguageAPI.Add("DOOMSLUG_BIOMISSILES_NAME", "Biomissiles"); LanguageAPI.Add("DOOMSLUG_BIOMISSILES_PICKUP", "Fire missiles on crit"); LanguageAPI.Add("DOOMSLUG_BIOMISSILES_DESC", "On crit fire 2 (+1 per stack) missiles that deal 30% Total Damage each with a Proc Coeffecient of 0.5"); ItemDef._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier3Def.asset").WaitForCompletion(); ItemDef.pickupIconSprite = bundle.LoadAsset<Sprite>(IconName); ItemDef.pickupModelPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion(); ItemDef.canRemove = true; ItemDef.hidden = false; missilePrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/MissileProjectile.prefab").WaitForCompletion(); if (!Object.op_Implicit((Object)(object)missilePrefab)) { Log.Error("Biomissiles: missile prefab failed to load!"); } else { Log.Info("Biomissiles: missile prefab loaded successfully!"); } ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null); ItemAPI.Add(new CustomItem(ItemDef, val)); } private static void AddHooks() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown object obj = <>O.<0>__GlobalEventManager_OnHitEnemy; if (obj == null) { hook_OnHitEnemy val = GlobalEventManager_OnHitEnemy; <>O.<0>__GlobalEventManager_OnHitEnemy = val; obj = (object)val; } GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj; object obj2 = <>O.<1>__ProjectileController_Awake; if (obj2 == null) { hook_Awake val2 = ProjectileController_Awake; <>O.<1>__ProjectileController_Awake = val2; obj2 = (object)val2; } ProjectileController.Awake += (hook_Awake)obj2; object obj3 = <>O.<2>__RecalculateStats; if (obj3 == null) { StatHookEventHandler val3 = RecalculateStats; <>O.<2>__RecalculateStats = val3; obj3 = (object)val3; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj3; } private static void ProjectileController_Awake(orig_Awake orig, ProjectileController self) { orig.Invoke(self); if (isFiringBiomissile) { self.procCoefficient = (float)procCoeffecient; } } private static void GlobalEventManager_OnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, damageInfo, victim); if (!Object.op_Implicit((Object)(object)damageInfo.attacker)) { return; } CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.inventory)) { return; } int itemCount = component.inventory.GetItemCount(ItemDef.itemIndex); if (itemCount <= 0) { return; } ItemQualityCounts itemCountsEffective = InventoryExtensions.GetItemCountsEffective(component.inventory, QualityBiomissiles.BiomissilesItemGroup); procCoeffecient = 0.5 + (double)itemCountsEffective.UncommonCount * 0.1 + (double)itemCountsEffective.RareCount * 0.2 + (double)itemCountsEffective.EpicCount * 0.4 + (double)itemCountsEffective.LegendaryCount * 0.8; if (ProcTypeAPI.HasModdedProc(damageInfo.procChainMask, BiomissilesProcType) || !damageInfo.crit || damageInfo.procCoefficient == 0f) { return; } CharacterBody component2 = victim.GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component2) || !Object.op_Implicit((Object)(object)component2.healthComponent)) { return; } if (!Object.op_Implicit((Object)(object)missilePrefab)) { Log.Error("Biomissiles: missile prefab is null, cannot fire!"); return; } Log.Info("Biomissiles proc fired!"); ProcTypeAPI.AddModdedProc(ref damageInfo.procChainMask, BiomissilesProcType); int num = 1 + itemCount; HurtBox mainHurtBox = component2.mainHurtBox; Collider val = ((mainHurtBox != null) ? mainHurtBox.collider : null); float num2 = 0f; if ((Object)(object)val != (Object)null) { Bounds bounds = val.bounds; num2 = Mathf.Max(((Bounds)(ref bounds)).extents.x, ((Bounds)(ref bounds)).extents.z); } Vector3 position = component2.corePosition + Vector3.up * (1.5f * num2 + 1f); isFiringBiomissile = true; for (int i = 0; i < num; i++) { Vector3 val2 = Util.ApplySpread(Vector3.up, 0f, 20f, 1f, 1f, 0f, 0f); FireProjectileInfo val3 = new FireProjectileInfo { projectilePrefab = missilePrefab, position = position, rotation = Util.QuaternionSafeLookRotation(val2), owner = ((Component)component).gameObject, damage = damageInfo.damage * 0.3f, force = 0f, crit = damageInfo.crit, damageColorIndex = (DamageColorIndex)3, procChainMask = damageInfo.procChainMask }; ProjectileManager.instance.FireProjectile(val3); } isFiringBiomissile = false; } private static void RecalculateStats(CharacterBody body, StatHookEventArgs args) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body.inventory)) { int itemCount = body.inventory.GetItemCount(ItemDef.itemIndex); if (itemCount > 0) { args.critAdd += 5f; } } } public static void Update() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)285)) { Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed F4. Spawning our Biomissiles at coordinates {transform.position}"); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(ItemDef.itemIndex), transform.position, transform.forward * 20f); } } } public class MicrobialBulletsMarker : MonoBehaviour { } public class MicrobialBullets { [CompilerGenerated] private static class <>O { public static hook_OnHitEnemy <0>__GlobalEventManager_OnHitEnemy; public static hook_Awake <1>__DelayBlast_Awake; public static hook_Detonate <2>__DelayBlast_Detonate; public static hook_TakeDamage <3>__HealthComponent_TakeDamage; public static hook_Awake <4>__ProjectileController_Awake; } public static string IconName = "Microbial_Bullet_Icon2"; public static string ModelName = "MicrobialBulletsPickup"; public static ItemDef ItemDef; private static bool isFiringFakeDeathReport = false; public static ModdedProcType MicrobialBulletsProcType; public static void Init(AssetBundle bundle) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) MicrobialBulletsProcType = ProcTypeAPI.ReserveProcType(); if (!Object.op_Implicit((Object)(object)bundle)) { Log.Error("AssetBundle failed to load!"); } CreateItem(bundle); AddHooks(); } private static void CreateItem(AssetBundle bundle) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown ItemDef = ScriptableObject.CreateInstance<ItemDef>(); ((Object)ItemDef).name = "DOOMSLUG_MICROBIAL_BULLETS"; ItemDef.nameToken = "DOOMSLUG_MICROBIAL_BULLETS_NAME"; ItemDef.pickupToken = "DOOMSLUG_MICROBIAL_BULLETS_PICKUP"; ItemDef.descriptionToken = "DOOMSLUG_MICROBIAL_BULLETS_DESC"; ItemDef.loreToken = "DOOMSLUG_MICROBIAL_BULLETS_DESC_LORE"; LanguageAPI.Add("DOOMSLUG_MICROBIAL_BULLETS_NAME", "Microbial Bullets"); LanguageAPI.Add("DOOMSLUG_MICROBIAL_BULLETS_PICKUP", "Chance to trigger on kill effects"); LanguageAPI.Add("DOOMSLUG_MICROBIAL_BULLETS_DESC", "3% (+2% per stack) chance to trigger all on kill effects on hit."); ItemDef._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier2Def.asset").WaitForCompletion(); ItemDef.pickupIconSprite = bundle.LoadAsset<Sprite>(IconName); ItemDef.canRemove = true; ItemDef.hidden = false; ItemDef.pickupModelPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion(); ItemDef.canRemove = true; ItemDef.hidden = false; ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null); ItemAPI.Add(new CustomItem(ItemDef, val)); } private static void AddHooks() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown object obj = <>O.<0>__GlobalEventManager_OnHitEnemy; if (obj == null) { hook_OnHitEnemy val = GlobalEventManager_OnHitEnemy; <>O.<0>__GlobalEventManager_OnHitEnemy = val; obj = (object)val; } GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj; object obj2 = <>O.<1>__DelayBlast_Awake; if (obj2 == null) { hook_Awake val2 = DelayBlast_Awake; <>O.<1>__DelayBlast_Awake = val2; obj2 = (object)val2; } DelayBlast.Awake += (hook_Awake)obj2; object obj3 = <>O.<2>__DelayBlast_Detonate; if (obj3 == null) { hook_Detonate val3 = DelayBlast_Detonate; <>O.<2>__DelayBlast_Detonate = val3; obj3 = (object)val3; } DelayBlast.Detonate += (hook_Detonate)obj3; object obj4 = <>O.<3>__HealthComponent_TakeDamage; if (obj4 == null) { hook_TakeDamage val4 = HealthComponent_TakeDamage; <>O.<3>__HealthComponent_TakeDamage = val4; obj4 = (object)val4; } HealthComponent.TakeDamage += (hook_TakeDamage)obj4; object obj5 = <>O.<4>__ProjectileController_Awake; if (obj5 == null) { hook_Awake val5 = ProjectileController_Awake; <>O.<4>__ProjectileController_Awake = val5; obj5 = (object)val5; } ProjectileController.Awake += (hook_Awake)obj5; } private static void DelayBlast_Awake(orig_Awake orig, DelayBlast self) { orig.Invoke(self); if (isFiringFakeDeathReport) { ((Component)self).gameObject.AddComponent<MicrobialBulletsMarker>(); } } private static void ProjectileController_Awake(orig_Awake orig, ProjectileController self) { orig.Invoke(self); if (isFiringFakeDeathReport) { ((Component)self).gameObject.AddComponent<MicrobialBulletsMarker>(); } } private static void DelayBlast_Detonate(orig_Detonate orig, DelayBlast self) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((Component)self).GetComponent<MicrobialBulletsMarker>())) { ProcTypeAPI.AddModdedProc(ref self.procChainMask, MicrobialBulletsProcType); } orig.Invoke(self); } private static void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { orig.Invoke(self, damageInfo); return; } if ((Object)(object)damageInfo.inflictor != (Object)null && (Object)(object)damageInfo.inflictor.GetComponent<MicrobialBulletsMarker>() != (Object)null) { ProcTypeAPI.AddModdedProc(ref damageInfo.procChainMask, MicrobialBulletsProcType); } else { Log.Error("inflictor was null"); } orig.Invoke(self, damageInfo); } private static void GlobalEventManager_OnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown orig.Invoke(self, damageInfo, victim); if (isFiringFakeDeathReport || !Object.op_Implicit((Object)(object)damageInfo.attacker)) { return; } CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.inventory)) { return; } int itemCount = component.inventory.GetItemCount(ItemDef.itemIndex); if (itemCount > 0 && !ProcTypeAPI.HasModdedProc(damageInfo.procChainMask, MicrobialBulletsProcType) && Util.CheckRoll(1f + 2f * (float)itemCount * damageInfo.procCoefficient, component.master)) { CharacterBody component2 = victim.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)component2.healthComponent) && component2.healthComponent.alive) { Log.Info("Microbial Bullets proc fired!"); ProcTypeAPI.AddModdedProc(ref damageInfo.procChainMask, MicrobialBulletsProcType); DamageReport val = new DamageReport(damageInfo, component2.healthComponent, damageInfo.damage, component2.healthComponent.combinedHealth); isFiringFakeDeathReport = true; GlobalEventManager.instance.OnCharacterDeath(val); isFiringFakeDeathReport = false; } } } public static void Update() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)284)) { Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed F3. Spawning our Microbial Bullets at coordinates {transform.position}"); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(ItemDef.itemIndex), transform.position, transform.forward * 20f); } } } internal class QualityAnatomyTextbook { [CompilerGenerated] private static class <>O { public static LoadContentAsyncDelegate <0>__CreateItem; public static hook_OnHitEnemy <1>__GlobalEventManager_OnHitEnemy; } private static ItemQualityGroup AnatomyTextbookItemGroup; [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void Init() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown Log.Info("QualityAnatomyTextbook Init Started"); object obj = <>O.<0>__CreateItem; if (obj == null) { LoadContentAsyncDelegate val = CreateItem; <>O.<0>__CreateItem = val; obj = (object)val; } QualityContentManager.LoadContentAsync += (LoadContentAsyncDelegate)obj; object obj2 = <>O.<1>__GlobalEventManager_OnHitEnemy; if (obj2 == null) { hook_OnHitEnemy val2 = GlobalEventManager_OnHitEnemy; <>O.<1>__GlobalEventManager_OnHitEnemy = val2; obj2 = (object)val2; } GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj2; } private static IEnumerator CreateItem(QualityContentLoadArgs args) { Log.Info("QualityAnatomyTextbook CreateItem Started"); AnatomyTextbookItemGroup = args.CreateItemQualityGroup(AnatomyTextbook.ItemDef); LanguageAPI.Add("ITEM_DOOMSLUG_ANATOMY_TEXTBOOK_UNCOMMON_PICKUP", "{0}\n<sprite name=\"Quality\"> Extends buff duration on crit."); LanguageAPI.Add("ITEM_DOOMSLUG_ANATOMY_TEXTBOOK_RARE_PICKUP", "{0}\n<sprite name=\"Quality\"> Extends buff duration on crit."); LanguageAPI.Add("ITEM_DOOMSLUG_ANATOMY_TEXTBOOK_EPIC_PICKUP", "{0}\n<sprite name=\"Quality\"> Extends buff duration on crit."); LanguageAPI.Add("ITEM_DOOMSLUG_ANATOMY_TEXTBOOK_LEGENDARY_PICKUP", "{0}\n<sprite name=\"Quality\"> Extends buff duration on crit."); LanguageAPI.Add("ITEM_DOOMSLUG_ANATOMY_TEXTBOOK_UNCOMMON_DESC", "{0}\nCritical strikes increase all your buff durations by 1 (+1 per stack) seconds"); LanguageAPI.Add("ITEM_DOOMSLUG_ANATOMY_TEXTBOOK_RARE_DESC", "{0}\nCritical strikes increase all your buff durations by 2 (+2 per stack) seconds"); LanguageAPI.Add("ITEM_DOOMSLUG_ANATOMY_TEXTBOOK_EPIC_DESC", "{0}\nCritical strikes increase all your buff durations by 4 (+4 per stack) seconds"); LanguageAPI.Add("ITEM_DOOMSLUG_ANATOMY_TEXTBOOK_LEGENDARY_DESC", "{0}\nCritical strikes increase all your buff durations by 8 (+8 per stack) seconds"); yield break; } private static void GlobalEventManager_OnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, damageInfo, victim); if (!damageInfo.crit || damageInfo.procCoefficient == 0f) { return; } CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.inventory)) { return; } ItemQualityCounts itemCountsEffective = InventoryExtensions.GetItemCountsEffective(component.inventory, AnatomyTextbookItemGroup); double num = (double)itemCountsEffective.UncommonCount * 0.1 + (double)itemCountsEffective.RareCount * 0.2 + (double)itemCountsEffective.EpicCount * 0.4 + (double)itemCountsEffective.LegendaryCount * 0.8 * (double)damageInfo.procCoefficient; if (component.timedBuffs == null) { return; } for (int i = 0; i < component.timedBuffs.Count; i++) { TimedBuff val = component.timedBuffs[i]; BuffDef buffDef = BuffCatalog.GetBuffDef(val.buffIndex); if (!((Object)(object)buffDef == (Object)null) && !buffDef.isDebuff) { val.timer += (float)num; component.timedBuffs[i] = val; } } } } internal static class QualityBiomissiles { [CompilerGenerated] private static class <>O { public static LoadContentAsyncDelegate <0>__loadContent; } public static ItemQualityGroup BiomissilesItemGroup; [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown object obj = <>O.<0>__loadContent; if (obj == null) { LoadContentAsyncDelegate val = loadContent; <>O.<0>__loadContent = val; obj = (object)val; } QualityContentManager.LoadContentAsync += (LoadContentAsyncDelegate)obj; LanguageAPI.Add("ITEM_DOOMSLUG_BIOMISSILEES_UNCOMMON_PICKUP", "{0}\n<sprite name=\"Quality\"> Increases the proc coeffecient."); LanguageAPI.Add("ITEM_DOOMSLUG_BIOMISSILEES_RARE_PICKUP", "{0}\n<sprite name=\"Quality\"> Increases the proc coeffecient."); LanguageAPI.Add("ITEM_DOOMSLUG_BIOMISSILEES_EPIC_PICKUP", "{0}\n<sprite name=\"Quality\"> Increases the proc coeffecient."); LanguageAPI.Add("ITEM_DOOMSLUG_BIOMISSILEES_LEGENDARY_PICKUP", "{0}\n<sprite name=\"Quality\"> Increases the proc coeffecient."); LanguageAPI.Add("ITEM_DOOMSLUG_BIOMISSILEES_UNCOMMON_DESC", "{0}\nIncreases the proc coeffecient of Biomissiles by 0.1 <style=cStack>(+0.1 per stack)</style>"); LanguageAPI.Add("ITEM_DOOMSLUG_BIOMISSILEES_RARE_DEC", "{0}\nIncreases the proc coeffecient of Biomissiles by 0.1 <style=cStack>(+0.2 per stack)</style>"); LanguageAPI.Add("ITEM_DOOMSLUG_BIOMISSILEES_EPIC_DESC", "{0}\nIncreases the proc coeffecient of Biomissiles by 0.1 <style=cStack>(+0.4 per stack)</style>"); LanguageAPI.Add("ITEM_DOOMSLUG_BIOMISSILEES_LEGENDARY_DESC", "{0}\nIncreases the proc coeffecient of Biomissiles by 0.1 <style=cStack>(+0.8 per stack)</style>"); } private static IEnumerator loadContent(QualityContentLoadArgs args) { BiomissilesItemGroup = args.CreateItemQualityGroup(Biomissiles.ItemDef); yield break; } } internal class QualityMicrobialBullets { [CompilerGenerated] private static class <>O { public static LoadContentAsyncDelegate <0>__CreateItem; public static hook_OnCharacterDeath <1>__GlobalEventManager_OnCharacterDeath; } private static ItemQualityGroup MicrobialBulletsItemGroup; [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void Init() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown Log.Info("QualityMicrobialBullets Init Started"); object obj = <>O.<0>__CreateItem; if (obj == null) { LoadContentAsyncDelegate val = CreateItem; <>O.<0>__CreateItem = val; obj = (object)val; } QualityContentManager.LoadContentAsync += (LoadContentAsyncDelegate)obj; object obj2 = <>O.<1>__GlobalEventManager_OnCharacterDeath; if (obj2 == null) { hook_OnCharacterDeath val2 = GlobalEventManager_OnCharacterDeath; <>O.<1>__GlobalEventManager_OnCharacterDeath = val2; obj2 = (object)val2; } GlobalEventManager.OnCharacterDeath += (hook_OnCharacterDeath)obj2; } private static IEnumerator CreateItem(QualityContentLoadArgs args) { Log.Info("QualityMicrobialBullets CreateItem Started"); MicrobialBulletsItemGroup = args.CreateItemQualityGroup(MicrobialBullets.ItemDef); LanguageAPI.Add("ITEM_DOOMSLUG_MICROBIAL_BULLETS_UNCOMMON_PICKUP", "{0}\n<sprite name=\"Quality\"> Provides a portion of the killed enemies max HP as healing."); LanguageAPI.Add("ITEM_DOOMSLUG_MICROBIAL_BULLETS_RARE_PICKUP", "{0}\n<sprite name=\"Quality\"> Provides a portion of the killed enemies max HP as healing."); LanguageAPI.Add("ITEM_DOOMSLUG_MICROBIAL_BULLETS_EPIC_PICKUP", "{0}\n<sprite name=\"Quality\"> Provides a portion of the killed enemies max HP as healing."); LanguageAPI.Add("ITEM_DOOMSLUG_MICROBIAL_BULLETS_LEGENDARY_PICKUP", "{0}\n<sprite name=\"Quality\"> Provides a portion of the killed enemies max HP as healing."); LanguageAPI.Add("ITEM_DOOMSLUG_MICROBIAL_BULLETS_UNCOMMON_DESC", "{0}\nOn Killing an Enemy heal for 4% <style=cStack>(+4% per stack)</style> of their max HP"); LanguageAPI.Add("ITEM_DOOMSLUG_MICROBIAL_BULLETS_RARE_DESC", "{0}\nOn Killing an Enemy heal for 9% <style=cStack>(+9% per stack)</style> of their max HP"); LanguageAPI.Add("ITEM_DOOMSLUG_MICROBIAL_BULLETS_EPIC_DESC", "{0}\nOn Killing an Enemy heal for 15% <style=cStack>(+15% per stack)</style> of their max HP"); LanguageAPI.Add("ITEM_DOOMSLUG_MICROBIAL_BULLETS_LEGENDARY_DESC", "{0}\nOn Killing an Enemy heal for 22% <style=cStack>(+22% per stack)</style> of their max HP"); yield break; } private static void GlobalEventManager_OnCharacterDeath(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, damageReport); if (!Object.op_Implicit((Object)(object)damageReport.attacker) || !Object.op_Implicit((Object)(object)damageReport.victim)) { return; } CharacterBody component = damageReport.attacker.GetComponent<CharacterBody>(); CharacterBody component2 = ((Component)damageReport.victim).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory) && Object.op_Implicit((Object)(object)component2)) { ItemQualityCounts itemCountsEffective = InventoryExtensions.GetItemCountsEffective(component.inventory, MicrobialBulletsItemGroup); if (itemCountsEffective.UncommonCount > 0 || itemCountsEffective.RareCount > 0 || itemCountsEffective.EpicCount > 0 || itemCountsEffective.LegendaryCount > 0) { float num = itemCountsEffective.UncommonCount * 4 + itemCountsEffective.RareCount * 9 + itemCountsEffective.EpicCount * 15 + itemCountsEffective.LegendaryCount * 22; float num2 = num * component2.levelMaxHealth; component.healthComponent.Heal(num2, default(ProcChainMask), true); } } } } internal class QualitySourSaltShaker { [CompilerGenerated] private static class <>O { public static LoadContentAsyncDelegate <0>__CreateItem; public static hook_TakeDamage <1>__HealthComponent_TakeDamage; } private static ItemQualityGroup SourSaltShakerItemGroup; public static BuffDef SaltBuff => SourSaltShaker.SaltBuff; [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void Init() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown Log.Info("QualitySourSaltShaker Init Started"); object obj = <>O.<0>__CreateItem; if (obj == null) { LoadContentAsyncDelegate val = CreateItem; <>O.<0>__CreateItem = val; obj = (object)val; } QualityContentManager.LoadContentAsync += (LoadContentAsyncDelegate)obj; object obj2 = <>O.<1>__HealthComponent_TakeDamage; if (obj2 == null) { hook_TakeDamage val2 = HealthComponent_TakeDamage; <>O.<1>__HealthComponent_TakeDamage = val2; obj2 = (object)val2; } HealthComponent.TakeDamage += (hook_TakeDamage)obj2; } private static IEnumerator CreateItem(QualityContentLoadArgs args) { Log.Info("QualitySourSaltShaker CreateItem Started"); SourSaltShakerItemGroup = args.CreateItemQualityGroup(SourSaltShaker.ItemDef); LanguageAPI.Add("ITEM_DOOMSLUG_SOUR_SALT_SHAKER_UNCOMMON_PICKUP", "{0}\n<sprite name=\"Quality\"> Salt stacks increase crit damage on target."); LanguageAPI.Add("ITEM_DOOMSLUG_SOUR_SALT_SHAKER_RARE_PICKUP", "{0}\n<sprite name=\"Quality\"> Salt stacks increase crit damage on target."); LanguageAPI.Add("ITEM_DOOMSLUG_SOUR_SALT_SHAKER_EPIC_PICKUP", "{0}\n<sprite name=\"Quality\"> Salt stacks increase crit damage on target."); LanguageAPI.Add("ITEM_DOOMSLUG_SOUR_SALT_SHAKER_LEGENDARY_PICKUP", "{0}\n<sprite name=\"Quality\"> Salt stacks increase crit damage on target."); LanguageAPI.Add("ITEM_DOOMSLUG_SOUR_SALT_SHAKER_UNCOMMON_DESC", "{0}\nFor every salt stack on the target you have 5% <style=cStack>(+5% per stack)</style> higher crit on them."); LanguageAPI.Add("ITEM_DOOMSLUG_SOUR_SALT_SHAKER_RARE_DESC", "{0}\nFor every salt stack on the target you have 10% <style=cStack>(+10% per stack)</style> higher crit on them."); LanguageAPI.Add("ITEM_DOOMSLUG_SOUR_SALT_SHAKER_EPIC_DESC", "{0}\nFor every salt stack on the target you have 20% <style=cStack>(+20% per stack)</style> higher crit on them."); LanguageAPI.Add("ITEM_DOOMSLUG_SOUR_SALT_SHAKER_LEGENDARY_DESC", "{0}\nFor every salt stack on the target you have 40% <style=cStack>(+40% per stack)</style> higher crit on them."); yield break; } private static void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { orig.Invoke(self, damageInfo); return; } if (damageInfo.crit && Object.op_Implicit((Object)(object)damageInfo.attacker) && damageInfo.procCoefficient != 0f) { CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); CharacterBody body = self.body; if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory) && Object.op_Implicit((Object)(object)body) && body.HasBuff(SaltBuff)) { ItemQualityCounts itemCountsEffective = InventoryExtensions.GetItemCountsEffective(component.inventory, SourSaltShakerItemGroup); float num = (float)itemCountsEffective.UncommonCount * 0.05f + (float)itemCountsEffective.RareCount * 0.1f + (float)itemCountsEffective.EpicCount * 0.2f + (float)itemCountsEffective.LegendaryCount * 0.4f; if (num > 0f && component.critMultiplier > 0f) { int buffCount = body.GetBuffCount(SaltBuff); damageInfo.damage += damageInfo.damage * (float)buffCount * (num / component.critMultiplier); } } } orig.Invoke(self, damageInfo); } } public class SourSaltShakerMarker : MonoBehaviour { } public class SourSaltShaker { [CompilerGenerated] private static class <>O { public static hook_OnHitEnemy <0>__GlobalEventManager_OnHitEnemy; public static StatHookEventHandler <1>__RecalculateStats; } public static string IconName = "Salt-Shaker-Status-Image"; public static ItemDef ItemDef; public static BuffDef SaltBuff; public static void Init(AssetBundle bundle) { if (!Object.op_Implicit((Object)(object)bundle)) { Log.Error("AssetBundle failed to load!"); } CreateItem(bundle); CreateBuff(bundle); AddHooks(); } private static void CreateItem(AssetBundle bundle) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown ItemDef = ScriptableObject.CreateInstance<ItemDef>(); ((Object)ItemDef).name = "DOOMSLUG_SOUR_SALT_SHAKER"; ItemDef.nameToken = "DOOMSLUG_SOUR_SALT_SHAKER_NAME"; ItemDef.pickupToken = "DOOMSLUG_SOUR_SALT_SHAKER_PICKUP"; ItemDef.descriptionToken = "DOOMSLUG_SOUR_SALT_SHAKER_DESC"; ItemDef.loreToken = "DOOMSLUG_SOUR_SALT_SHAKER_DESC_LORE"; LanguageAPI.Add("DOOMSLUG_SOUR_SALT_SHAKER_NAME", "Sour Salt Shaker"); LanguageAPI.Add("DOOMSLUG_SOUR_SALT_SHAKER_PICKUP", "Enemies that have been crit take damage on hit"); LanguageAPI.Add("DOOMSLUG_SOUR_SALT_SHAKER_DESC", "On crit enemies take 10% Base Damage on hit for the next 3 (+3 per stack) seconds"); ItemDef._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier2Def.asset").WaitForCompletion(); ItemDef.pickupIconSprite = bundle.LoadAsset<Sprite>(IconName); ItemDef.pickupModelPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion(); ItemDef.canRemove = true; ItemDef.hidden = false; ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null); ItemAPI.Add(new CustomItem(ItemDef, val)); } private static void AddHooks() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown object obj = <>O.<0>__GlobalEventManager_OnHitEnemy; if (obj == null) { hook_OnHitEnemy val = GlobalEventManager_OnHitEnemy; <>O.<0>__GlobalEventManager_OnHitEnemy = val; obj = (object)val; } GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj; object obj2 = <>O.<1>__RecalculateStats; if (obj2 == null) { StatHookEventHandler val2 = RecalculateStats; <>O.<1>__RecalculateStats = val2; obj2 = (object)val2; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj2; } private static void GlobalEventManager_OnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, damageInfo, victim); CharacterBody component = victim.GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.healthComponent)) { return; } if (component.HasBuff(SaltBuff) && damageInfo.procCoefficient != 0f) { int buffCount = component.GetBuffCount(SaltBuff); DamageInfo val = new DamageInfo { attacker = damageInfo.attacker, inflictor = damageInfo.attacker, damage = (float)buffCount * damageInfo.attacker.GetComponent<CharacterBody>().damage * 0.1f, position = component.corePosition, procCoefficient = 0f, damageColorIndex = (DamageColorIndex)3, procChainMask = default(ProcChainMask), damageType = DamageTypeCombo.op_Implicit((DamageType)2048) }; component.healthComponent.TakeDamage(val); } if (!Object.op_Implicit((Object)(object)damageInfo.attacker)) { return; } CharacterBody component2 = damageInfo.attacker.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)component2.inventory)) { int itemCount = component2.inventory.GetItemCount(ItemDef.itemIndex); if (itemCount > 0 && damageInfo.crit && damageInfo.procCoefficient != 0f) { Log.Info("Sour Salt Shaker applied!"); component.AddTimedBuff(SaltBuff, (float)(itemCount * 3) * damageInfo.procCoefficient); } } } private static void RecalculateStats(CharacterBody body, StatHookEventArgs args) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body.inventory)) { int itemCount = body.inventory.GetItemCount(ItemDef.itemIndex); if (itemCount > 0) { args.critAdd += 5f; } } } public static void Update() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)286)) { Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed F5. Spawning our SourSaltShaker at coordinates {transform.position}"); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(ItemDef.itemIndex), transform.position, transform.forward * 20f); } } private static void CreateBuff(AssetBundle bundle) { SaltBuff = ScriptableObject.CreateInstance<BuffDef>(); ((Object)SaltBuff).name = "DOOMSLUG_SALT"; LanguageAPI.Add("DOOMSLUG_SALT", "Salt"); SaltBuff.canStack = true; SaltBuff.isDebuff = true; SaltBuff.isCooldown = false; SaltBuff.iconSprite = bundle.LoadAsset<Sprite>(IconName); ContentAddition.AddBuffDef(SaltBuff); } } }