Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of Darn1tMod v0.2.1
plugins/Darn1tMod/Darn1tMod.dll
Decompiled 6 months agousing System; 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 Microsoft.CodeAnalysis; using On.RoR2; using R2API; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; [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("Darn1tMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+651c9ab3357f07cd5dc7013485a6b72f9a2b69f3")] [assembly: AssemblyProduct("Darn1tMod")] [assembly: AssemblyTitle("Darn1tMod")] [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 Darn1tMod { public static class Asset { public static AssetBundle mainBundle; public const string bundleName = "darn1tmod"; public static void Init() { string text = Path.Combine(Path.GetDirectoryName(Darn1tMod.PInfo.Location), "darn1tmod"); mainBundle = AssetBundle.LoadFromFile(text); } } internal class DamageBuff : BuffDef { public DamageBuff() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) base.buffColor = Color.white; base.canStack = true; base.eliteDef = null; base.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion(); base.isCooldown = false; base.isHidden = false; base.startSfx = null; ((Object)this).name = "DamageBuff"; base.ignoreGrowthNectar = false; base.isDebuff = false; base.flags = (Flags)1; ContentAddition.AddBuffDef((BuffDef)(object)this); } } internal class DamageOnKillSlowedOnHitItem : ItemDef { private const int MAX_BUFFS_PER_STACK = 30; public readonly DamageBuff DamageBuff = new DamageBuff(); public readonly SpeedNerf SpeedNerf = new SpeedNerf(); public DamageOnKillSlowedOnHitItem() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_009b: 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_00c0: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown ((Object)this).name = "DAMAGE_ON_KILL_SLOWED_ON_HIT_NAME"; base.nameToken = "DAMAGE_ON_KILL_SLOWED_ON_HIT_NAME"; base.pickupToken = "DAMAGE_ON_KILL_SLOWED_ON_HIT_PICKUP"; base.descriptionToken = "DAMAGE_ON_KILL_SLOWED_ON_HIT_DESC"; base.loreToken = "DAMAGE_ON_KILL_SLOWED_ON_HIT_LORE"; base.deprecatedTier = (ItemTier)3; base.pickupIconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion(); try { base.pickupModelPrefab = Asset.mainBundle.LoadAsset<GameObject>("cube.prefab"); } catch (Exception) { base.pickupModelPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion(); } base.canRemove = true; base.hidden = false; ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null); ItemAPI.Add(new CustomItem((ItemDef)(object)this, val)); GlobalEventManager.OnCharacterDeath += (hook_OnCharacterDeath)delegate(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport report) { GlobalEventManager_onCharacterDeath(report); orig.Invoke(self, report); }; HealthComponent.TakeDamage += (hook_TakeDamage)delegate(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { GlobalEventManager_preOnHitEnemy(self, damageInfo); orig.Invoke(self, damageInfo); }; RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(GetStatCoefficients); } private void GlobalEventManager_onCharacterDeath(DamageReport report) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = report?.attackerBody; if (Object.op_Implicit((Object)(object)((val != null) ? val.inventory : null))) { int itemCount = val.inventory.GetItemCount((ItemDef)(object)this); if (itemCount > 0) { int buffCount = val.GetBuffCount((BuffDef)(object)DamageBuff); val.SetBuffCount(((BuffDef)DamageBuff).buffIndex, Math.Min(buffCount + itemCount, itemCount * 30)); } } } private void GlobalEventManager_preOnHitEnemy(HealthComponent healthComponent, DamageInfo damageInfo) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = healthComponent?.body; if (Object.op_Implicit((Object)(object)((val != null) ? val.inventory : null))) { int itemCount = val.inventory.GetItemCount((ItemDef)(object)this); if (itemCount > 0) { int buffCount = val.GetBuffCount((BuffDef)(object)SpeedNerf); val.SetBuffCount(((BuffDef)SpeedNerf).buffIndex, Math.Min(buffCount + itemCount, itemCount * 30)); } } } private void GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { int buffCount = sender.GetBuffCount((BuffDef)(object)DamageBuff); if (buffCount > 0) { float num = sender.baseDamage + args.baseDamageAdd + (sender.level - 1f) * sender.levelDamage; float num2 = num * Mathf.Pow(1.05f, (float)buffCount) - num; args.baseDamageAdd += num2; } int buffCount2 = sender.GetBuffCount((BuffDef)(object)SpeedNerf); if (buffCount2 > 0) { float num3 = sender.baseMoveSpeed + args.baseMoveSpeedAdd + (sender.level - 1f) * sender.levelMoveSpeed; float num4 = num3 * Mathf.Pow(0.9f, (float)buffCount2) - num3; args.baseMoveSpeedAdd += num4; } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Darn1t.Darn1tMod", "Darn1tMod", "0.1.0")] public class Darn1tMod : BaseUnityPlugin { public const string PluginAuthor = "Darn1t"; public const string PluginName = "Darn1tMod"; public const string PluginGUID = "Darn1t.Darn1tMod"; public const string PluginVersion = "0.1.0"; private static DamageOnKillSlowedOnHitItem damageOnKillSlowedOnHit; private static VoidEnergyDrink voidEnergyDrink; private static PermanentDamageArtifact permanentDamageArtifact; public static PluginInfo PInfo { get; private set; } public void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); PInfo = ((BaseUnityPlugin)this).Info; Asset.Init(); Log.Info("SEAN HURT LOG INIT"); damageOnKillSlowedOnHit = new DamageOnKillSlowedOnHitItem(); permanentDamageArtifact = new PermanentDamageArtifact(); voidEnergyDrink = new VoidEnergyDrink(); } private 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) //IL_00a2: 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_00c1: 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_00cd: 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) if (Input.GetKeyDown((KeyCode)283)) { Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"SEAN HURT Player pressed F2. Spawning our custom item at coordinates {transform.position}"); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(((ItemDef)damageOnKillSlowedOnHit).itemIndex), transform.position, transform.forward * 20f); } if (Input.GetKeyDown((KeyCode)284)) { Transform transform2 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"SEAN HURT Player pressed F3. Spawning our custom item at coordinates {transform2.position}"); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(((ItemDef)voidEnergyDrink).itemIndex), transform2.position, transform2.forward * 20f); } } } 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); } } internal class PermanentDamageArtifact : ArtifactDef { public PermanentMaxHealthDecreaseItem PermanentMaxHealthDecreaseItem = new PermanentMaxHealthDecreaseItem(); public bool IsArtifactEnabled { get { RunArtifactManager instance = RunArtifactManager.instance; return instance != null && instance.IsArtifactEnabled((ArtifactDef)(object)this); } } public PermanentDamageArtifact() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown ((ArtifactDef)this).cachedName = "RiskyArtifactOfArrogance"; base.nameToken = "RISKYARTIFACTS_ARROGANCE_NAME"; base.descriptionToken = "RISKYARTIFACTS_ARROGANCE_DESC"; base.smallIconDeselectedSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion(); base.smallIconSelectedSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion(); ContentAddition.AddArtifactDef((ArtifactDef)(object)this); HealthComponent.TakeDamage += (hook_TakeDamage)delegate(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { GlobalEventManager_preOnHitEnemy(self, damageInfo); orig.Invoke(self, damageInfo); GlobalEventManager_postOnHitEnemy(self, damageInfo); }; CharacterBody.onBodyStartGlobal += delegate(CharacterBody characterBody) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (characterBody.isPlayerControlled && Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled((ArtifactDef)(object)this)) { ItemDef val = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/Base/BarrierOnOverHeal/BarrierOnOverHeal.asset").WaitForCompletion(); characterBody.inventory.GiveItem(val, 1); } characterBody.SetBuffCount(((BuffDef)PermanentMaxHealthDecreaseItem.HealthDisplayBuff).buffIndex, characterBody.inventory.GetItemCount((ItemDef)(object)PermanentMaxHealthDecreaseItem)); }; } private void GlobalEventManager_preOnHitEnemy(HealthComponent healthComponent, DamageInfo damageInfo) { if (IsArtifactEnabled) { CharacterBody val = healthComponent?.body; if (Object.op_Implicit((Object)(object)val) && val.isPlayerControlled) { healthComponent.barrier += 1f; } } } private void GlobalEventManager_postOnHitEnemy(HealthComponent healthComponent, DamageInfo damageInfo) { //IL_009c: 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_00ac: Invalid comparison between Unknown and I4 //IL_00ef: Unknown result type (might be due to invalid IL or missing references) if (!IsArtifactEnabled) { return; } CharacterBody val = healthComponent?.body; if (val == null || !val.isPlayerControlled) { return; } bool flag = healthComponent.barrier <= 0f; if (damageInfo.rejected) { healthComponent.barrier = Math.Max(0f, healthComponent.barrier - 1f); } healthComponent.health = val.maxHealth; if (flag && !damageInfo.rejected) { int num = Mathf.CeilToInt(((damageInfo.damageType.damageType & 0x200000) == 2097152) ? damageInfo.damage : (5f * damageInfo.procCoefficient)); val.inventory.GiveItem((ItemDef)(object)PermanentMaxHealthDecreaseItem, num); val.SetBuffCount(((BuffDef)PermanentMaxHealthDecreaseItem.HealthDisplayBuff).buffIndex, val.inventory.GetItemCount((ItemDef)(object)PermanentMaxHealthDecreaseItem)); if (val.healthComponent.health <= (float)val.inventory.GetItemCount((ItemDef)(object)PermanentMaxHealthDecreaseItem)) { val.healthComponent.health = 0f; } } } } internal class PermanentDamageDisplayBuff : BuffDef { public PermanentDamageDisplayBuff() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) base.buffColor = Color.red; base.canStack = true; base.eliteDef = null; base.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion(); base.isCooldown = false; base.isHidden = false; base.startSfx = null; ((Object)this).name = "PermanentDamageDisplayBuff"; base.ignoreGrowthNectar = true; base.isDebuff = false; base.flags = (Flags)1; ContentAddition.AddBuffDef((BuffDef)(object)this); } } internal class PermanentMaxHealthDecreaseItem : ItemDef { public PermanentDamageDisplayBuff HealthDisplayBuff = new PermanentDamageDisplayBuff(); public PermanentMaxHealthDecreaseItem() { //IL_004d: 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_005d: Unknown result type (might be due to invalid IL or missing references) //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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown ((Object)this).name = "PERMANENT_MAX_HEALTH_DECREASE"; base.nameToken = "DAMAGE_ON_KILL_SLOWED_ON_HIT_NAME"; base.pickupToken = "DAMAGE_ON_KILL_SLOWED_ON_HIT_PICKUP"; base.descriptionToken = "DAMAGE_ON_KILL_SLOWED_ON_HIT_DESC"; base.loreToken = "DAMAGE_ON_KILL_SLOWED_ON_HIT_LORE"; base.deprecatedTier = (ItemTier)5; base.pickupIconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion(); base.pickupModelPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion(); base.canRemove = false; base.hidden = false; ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null); ItemAPI.Add(new CustomItem((ItemDef)(object)this, val)); } } internal class SpeedNerf : BuffDef { public SpeedNerf() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) base.buffColor = Color.blue; base.canStack = true; base.eliteDef = null; base.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion(); base.isCooldown = false; base.isHidden = false; base.startSfx = null; ((Object)this).name = "SpeedNerf"; base.ignoreGrowthNectar = false; base.isDebuff = true; ContentAddition.AddBuffDef((BuffDef)(object)this); } } internal class VoidEnergyDrink : ItemDef { public class VoidEnergyDrinkBehavior : MonoBehaviour { public VoidEnergyDrinkSpeedBuff speedBuff; public CharacterBody CharacterBody; public int itemStacks = 0; private const float timerMax = 1f; private float timer = 0f; private const int maxBuffsPerItem = 5; private bool wasSprinting = false; public void FixedUpdate() { //IL_0098: Unknown result type (might be due to invalid IL or missing references) if (CharacterBody.isSprinting) { wasSprinting = true; timer += Time.fixedDeltaTime; if (timer >= 1f) { Debug.Log((object)"SEAN HURT Adding buff"); CharacterBody.AddBuff((BuffDef)(object)speedBuff); timer = 0f; } } else if (wasSprinting) { Debug.Log((object)"SEAN HURT Removing buff"); timer = 0f; CharacterBody.SetBuffCount(((BuffDef)speedBuff).buffIndex, 0); wasSprinting = false; } } } public class VoidEnergyDrinkSpeedBuff : BuffDef { public VoidEnergyDrinkSpeedBuff() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) base.canStack = true; base.eliteDef = null; base.isCooldown = false; base.isHidden = true; base.startSfx = null; ((Object)this).name = "VoidEnergyDrinkSpeedBuff"; base.ignoreGrowthNectar = true; base.isDebuff = false; base.flags = (Flags)1; ContentAddition.AddBuffDef((BuffDef)(object)this); } } private VoidEnergyDrinkSpeedBuff speedBuff; public VoidEnergyDrink() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_007a: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Expected O, but got Unknown speedBuff = new VoidEnergyDrinkSpeedBuff(); ((Object)this).name = "VOID_ENERGY_DRINK_NAME"; base.nameToken = "VOID_ENERGY_DRINK_NAME"; base.pickupToken = "VOID_ENERGY_DRINK_PICKUP"; base.descriptionToken = "VOID_ENERGY_DRINK_DESC"; base.loreToken = "VOID_ENERGY_DRINK_LORE"; base.deprecatedTier = (ItemTier)6; ItemRelationshipProvider val = new ItemRelationshipProvider(); val.relationshipType = Addressables.LoadAssetAsync<ItemRelationshipType>((object)"RoR2/DLC1/Common/ContagiousItem.asset").WaitForCompletion(); ItemDef itemDef = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/Base/SprintBonus/SprintBonus.asset").WaitForCompletion(); val.relationships = (Pair[])(object)new Pair[1] { new Pair { itemDef1 = itemDef, itemDef2 = (ItemDef)(object)this } }; base.pickupIconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion(); try { base.pickupModelPrefab = Asset.mainBundle.LoadAsset<GameObject>("cube.prefab"); } catch (Exception) { base.pickupModelPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion(); } base.canRemove = true; base.hidden = false; ItemDisplayRuleDict val2 = new ItemDisplayRuleDict((ItemDisplayRule[])null); ItemAPI.Add(new CustomItem((ItemDef)(object)this, val2)); CharacterBody.onBodyInventoryChangedGlobal += OnInventoryChanged; RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(GetStatCoefficients); } private void GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { int buffCount = sender.GetBuffCount((BuffDef)(object)speedBuff); int itemCount = sender.inventory.GetItemCount((ItemDef)(object)this); float num = sender.sprintingSpeedMultiplier + args.sprintSpeedAdd; float num2 = num * (1f + (float)buffCount * 0.03f * (float)itemCount) - num; Debug.Log((object)("SEAN HURT ADDING SPRINT SPEED " + num2)); args.sprintSpeedAdd += num2; } private void OnInventoryChanged(CharacterBody body) { int itemCount = body.inventory.GetItemCount((ItemDef)(object)this); VoidEnergyDrinkBehavior voidEnergyDrinkBehavior = ((Component)body).GetComponent<VoidEnergyDrinkBehavior>(); if (itemCount > 0 && !Object.op_Implicit((Object)(object)voidEnergyDrinkBehavior)) { Debug.Log((object)"SEAN HURT Got ITEM"); voidEnergyDrinkBehavior = ((Component)body).gameObject.AddComponent<VoidEnergyDrinkBehavior>(); voidEnergyDrinkBehavior.CharacterBody = body; voidEnergyDrinkBehavior.speedBuff = speedBuff; } if (Object.op_Implicit((Object)(object)voidEnergyDrinkBehavior)) { Debug.Log((object)("SEAN HURT SETTING STACKS " + itemCount)); voidEnergyDrinkBehavior.itemStacks = itemCount; } } } }