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 PokeItems v0.2.1
plugins/PokeItems.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; 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.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using PokeItems.Items; using PokeItems.Managers; using R2API; using R2API.Utils; using RoR2; using RoR2.ExpansionManagement; 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("PokeItems")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+c14d70d652b98e38bcb52059a4a12faee3d1ef4a")] [assembly: AssemblyProduct("PokeItems")] [assembly: AssemblyTitle("PokeItems")] [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 PokeItems { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } private static string Format(object data, string file, int line) { string fileName = Path.GetFileName(file); return $"[{fileName}:{line}] {data}"; } internal static void Debug(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogDebug((object)Format(data, file, line)); } internal static void Error(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogError((object)Format(data, file, line)); } internal static void Fatal(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogFatal((object)Format(data, file, line)); } internal static void Info(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogInfo((object)Format(data, file, line)); } internal static void Message(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogMessage((object)Format(data, file, line)); } internal static void Warning(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogWarning((object)Format(data, file, line)); } } internal class MathUtility { public static float GetLinearStacking(float value, float count, float procCoefficient = 1f) { return value * count * procCoefficient; } public static float GetLinearWithExtraStacking(float value, float extraValue, float count, float procCoefficient = 1f) { if (count <= 1f) { return GetLinearStacking(value, count, procCoefficient); } return (value + extraValue * (count - 1f)) * procCoefficient; } public static float GetExponentialPercentReductionStacking(float percent, float count) { return Mathf.Pow(1f - percent / 100f, count - 1f); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("DTPGStudios.PokeItems", "PokeItems", "0.2.1")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class PokeItems : BaseUnityPlugin { public const string PluginGUID = "DTPGStudios.PokeItems"; public const string PluginAuthor = "DTPGStudios"; public const string PluginName = "PokeItems"; public const string PluginVersion = "0.2.1"; public static ExpansionDef sotvDLC; public static ExpansionDef sotsDLC; public static PluginInfo PInfo { get; private set; } public static ConfigFile PConfig { get; private set; } public void Awake() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) PInfo = ((BaseUnityPlugin)this).Info; PConfig = ((BaseUnityPlugin)this).Config; sotvDLC = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion(); sotsDLC = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC2/Common/DLC2.asset").WaitForCompletion(); Log.Init(((BaseUnityPlugin)this).Logger); ConfigManager.Init(); AssetManager.Init(); Leftovers.Init(); FlameOrb.Init(); AirBalloonBroken.Init(); AirBalloon.Init(); ExpShare.Init(); AmuletCoin.Init(); HeavyDutyBoots.Init(); if (ConfigManager.UnfinishedItemsEnabled.Value) { } Log.Message("PokeItems mod is ready!", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 71); } private void Update() { //IL_0047: 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_006d: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) if (ConfigManager.SpawnModeEnabled.Value) { if (Input.GetKeyDown((KeyCode)283)) { Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed key. Spawning custom item at coordinates {transform.position}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 91); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(AirBalloon.itemDef.itemIndex), transform.position, transform.forward * 30f); } if (Input.GetKeyDown((KeyCode)284)) { Transform transform2 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed key. Spawning custom item at coordinates {transform2.position}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 103); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(FlameOrb.itemDef.itemIndex), transform2.position, transform2.forward * 30f); } if (Input.GetKeyDown((KeyCode)285)) { Transform transform3 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed key. Spawning custom item at coordinates {transform3.position}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 115); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(Leftovers.itemDef.itemIndex), transform3.position, transform3.forward * 30f); } if (Input.GetKeyDown((KeyCode)286)) { Transform transform4 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed key. Spawning custom item at coordinates {transform4.position}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 127); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(ExpShare.itemDef.itemIndex), transform4.position, transform4.forward * 30f); } if (Input.GetKeyDown((KeyCode)287)) { Transform transform5 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed key. Spawning custom item at coordinates {transform5.position}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 139); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(AmuletCoin.itemDef.itemIndex), transform5.position, transform5.forward * 30f); } if (Input.GetKeyDown((KeyCode)288)) { Transform transform6 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed key. Spawning custom item at coordinates {transform6.position}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 151); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(HeavyDutyBoots.itemDef.itemIndex), transform6.position, transform6.forward * 30f); } } } } } namespace PokeItems.Managers { public static class AssetManager { public static AssetBundle bundle; public const string bundleName = "pokeassets"; public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(PokeItems.PInfo.Location), "pokeassets"); public static void Init() { bundle = AssetBundle.LoadFromFile(AssetBundlePath); } } internal class ConfigManager { public static ConfigEntry<bool> CustomValuesEnabled; public static ConfigEntry<bool> SpawnModeEnabled; public static ConfigEntry<bool> UnfinishedItemsEnabled; public static ConfigEntry<float> Leftovers_RegenBonusPerStack; public static ConfigEntry<float> Leftovers_RegenBonusPerExtraStack; public static ConfigEntry<float> FlameOrb_ProcPercentPerStack; public static ConfigEntry<float> FlameOrb_DebuffDuration; public static ConfigEntry<float> AirBalloon_FallSpeedLimit; public static ConfigEntry<float> AirBalloon_FallPercentReductionPerExtraStack; public static ConfigEntry<float> AirBalloon_HpThresholdPercent; public static ConfigEntry<float> ExpShare_ExpPercentBonusPerStack; public static ConfigEntry<float> ExpShare_ExpPercentBonusPerExtraStack; public static ConfigEntry<float> ExpShare_ExpRateBonus; public static ConfigEntry<float> AmuletCoin_GoldMulPercentPerStack; public static ConfigEntry<float> HeavyDutyBoots_ArmorBonusPerStack; public static ConfigEntry<float> HeavyDutyBoots_ArmorBonusPerExtraStack; public static void Init() { ConfigFile pConfig = PokeItems.PConfig; CustomValuesEnabled = pConfig.Bind<bool>("! Important !", "Use Custom Values", false, "Whether items utilise user-inputted/custom values instead of the preferred values [TURN THIS ON IF YOU WANT TO CUSTOMIZE VALUES]."); SpawnModeEnabled = pConfig.Bind<bool>("! Important !", "Spawn Mode", false, "Enable Spawn Mode to allow spawning custom items via F-keys."); UnfinishedItemsEnabled = pConfig.Bind<bool>("! Important !", "Enable Unfinished Items", false, "Allow early-access items that are either unfinished or currently being developed. NOTE: You will need to restart your game."); Leftovers_RegenBonusPerStack = pConfig.Bind<float>("Leftovers", "Initial Regeneration Bonus", Leftovers.regenBonusPerStack, "Health regeneration applied from initial stack."); Leftovers_RegenBonusPerExtraStack = pConfig.Bind<float>("Leftovers", "Regeneration Bonus Per Extra Stack", Leftovers.regenBonusPerExtraStack, "Health regeneration applied per extra stack."); FlameOrb_ProcPercentPerStack = pConfig.Bind<float>("Flame Orb", "Burn Chance Percent Per Stack", FlameOrb.procPercentPerStack, "Chance to inflict burn per stack."); FlameOrb_DebuffDuration = pConfig.Bind<float>("Flame Orb", "Burn Duration", FlameOrb.debuffDuration, "How long the burn debuff lasts."); AirBalloon_FallSpeedLimit = pConfig.Bind<float>("Air Balloon", "Fall Speed Limit", AirBalloon.fallSpeedLimit, "Limit applied to falling speed (m/s)."); AirBalloon_FallPercentReductionPerExtraStack = pConfig.Bind<float>("Air Balloon", "Fall Percent Reduction Per Extra Stack", AirBalloon.fallPercentReductionPerExtraStack, "Reduction percent over falling speed limit exponentially applied."); AirBalloon_HpThresholdPercent = pConfig.Bind<float>("Air Balloon", "HP Threshold Percent", AirBalloon.hpThresholdPercent, "How low the HP can deplete before the balloon pops."); ExpShare_ExpPercentBonusPerStack = pConfig.Bind<float>("EXP Share", "Initial EXP Percent Bonus", ExpShare.expPercentBonusPerStack, "Extra percent of EXP is applied from initial stack."); ExpShare_ExpPercentBonusPerExtraStack = pConfig.Bind<float>("EXP Share", "EXP Percent Bonus Per Extra Stack", ExpShare.expPercentBonusPerExtraStack, "Extra percent of EXP is applied per extra stack."); ExpShare_ExpRateBonus = pConfig.Bind<float>("EXP Share", "Required EXP Percent Rate", ExpShare.expRateBonus, "Percent amount of required EXP gained per second."); AmuletCoin_GoldMulPercentPerStack = pConfig.Bind<float>("Amulet Coin", "Gold Percent Bonus", AmuletCoin.goldMulPercentPerStack, "Extra percent of gold is applied per stack."); HeavyDutyBoots_ArmorBonusPerStack = pConfig.Bind<float>("Heavy-Duty Boots", "Initial Armor Bonus", HeavyDutyBoots.armorBonusPerStack, "Extra percent of EXP is applied from initial stack."); HeavyDutyBoots_ArmorBonusPerExtraStack = pConfig.Bind<float>("Heavy-Duty Boots", "Armor Bonus Per Extra Stack", HeavyDutyBoots.armorBonusPerExtraStack, "How long the burn debuff lasts."); } } internal class ItemManager { public static ItemDef itemDef; public static readonly Dictionary<string, object[]> tokenMap = new Dictionary<string, object[]>(); public unsafe static ItemDef CreateItemDef(string name, ItemTier tier, bool canRemove, bool hidden, ItemTag[] tags, params object[] itemTokens) { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Invalid comparison between Unknown and I4 //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Invalid comparison between Unknown and I4 //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Invalid comparison between Unknown and I4 //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Invalid comparison between Unknown and I4 //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Expected O, but got Unknown //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Invalid comparison between Unknown and I4 //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Expected O, but got Unknown //IL_02aa: Unknown result type (might be due to invalid IL or missing references) itemDef = ScriptableObject.CreateInstance<ItemDef>(); ((Object)itemDef).name = name; itemDef.nameToken = "Item_" + ((Object)itemDef).name + "_Name"; itemDef.pickupToken = "Item_" + ((Object)itemDef).name + "_Pickup"; itemDef.descriptionToken = "Item_" + ((Object)itemDef).name + "_Desc"; itemDef.loreToken = "Item_" + ((Object)itemDef).name + "_Lore"; tokenMap[itemDef.descriptionToken] = itemTokens; GameObject val = AssetManager.bundle.LoadAsset<GameObject>(name + ".prefab"); if ((Object)(object)val == (Object)null) { if ((int)tier != 5) { Log.Warning("Missing prefab file for item " + ((Object)itemDef).name + ". Substituting default...", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\ItemManager.cs", 32); } val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion(); } Sprite val2 = AssetManager.bundle.LoadAsset<Sprite>(name + ".png"); if ((Object)(object)val2 == (Object)null) { Log.Warning("Missing sprite file for item " + ((Object)itemDef).name + ". Substituting default...", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\ItemManager.cs", 41); val2 = (itemDef.pickupIconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion()); } ModelPanelParameters val3 = val.AddComponent<ModelPanelParameters>(); val3.focusPointTransform = val.transform; val3.cameraPositionTransform = val.transform; val3.maxDistance = 10f; val3.minDistance = 5f; itemDef.pickupIconSprite = val2; itemDef.pickupModelPrefab = val; itemDef.deprecatedTier = tier; if ((int)itemDef.tier == 9 || (int)itemDef.tier == 6 || (int)itemDef.tier == 7 || (int)itemDef.tier == 8) { itemDef.requiredExpansion = PokeItems.sotvDLC; } itemDef.canRemove = canRemove; itemDef.hidden = hidden; itemDef.tags = tags; ItemDisplayRuleDict val4 = new ItemDisplayRuleDict((ItemDisplayRule[])null); Language.onCurrentLanguageChanged += FormatDescription; ItemAPI.Add(new CustomItem(itemDef, val4)); string text = ""; for (int i = 0; i < tags.Length; i++) { text = text + ((object)tags[i]/*cast due to .constrained prefix*/).ToString() + ", "; } Log.Info("Item created: " + name + "; Tier: " + ((object)(*(ItemTier*)(&tier))/*cast due to .constrained prefix*/).ToString() + "; Tags: " + text.Trim(), "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\ItemManager.cs", 88); return itemDef; } private static void FormatDescription() { foreach (KeyValuePair<string, object[]> item in tokenMap) { string stringFormatted = Language.GetStringFormatted(item.Key, item.Value); LanguageAPI.AddOverlay(item.Key, stringFormatted); } } } } namespace PokeItems.Items { internal class AirBalloon { [CompilerGenerated] private static class <>O { public static hook_TakeDamage <0>__AirBalloonDamagedHook; public static hook_FixedUpdate <1>__AirBalloonHook; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)0; public static float fallSpeedLimit = 50f; public static float fallPercentReductionPerExtraStack = 10f; public static float hpThresholdPercent = 35f; public static void Init() { //IL_0006: 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_006e: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("AirBalloon", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)3, (ItemTag)31 }, fallSpeedLimit, fallPercentReductionPerExtraStack, hpThresholdPercent); object obj = <>O.<0>__AirBalloonDamagedHook; if (obj == null) { hook_TakeDamage val = AirBalloonDamagedHook; <>O.<0>__AirBalloonDamagedHook = val; obj = (object)val; } HealthComponent.TakeDamage += (hook_TakeDamage)obj; object obj2 = <>O.<1>__AirBalloonHook; if (obj2 == null) { hook_FixedUpdate val2 = AirBalloonHook; <>O.<1>__AirBalloonHook = val2; obj2 = (object)val2; } CharacterMotor.FixedUpdate += (hook_FixedUpdate)obj2; } private static void AirBalloonDamagedHook(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { orig.Invoke(self, damageInfo); CharacterBody body = self.body; if ((Object)(object)body == (Object)null || (Object)(object)body.inventory == (Object)null || (Object)(object)body.healthComponent == (Object)null) { return; } int itemCountEffective = body.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { if (ConfigManager.CustomValuesEnabled.Value) { hpThresholdPercent = ConfigManager.AirBalloon_HpThresholdPercent.Value; } float num = self.combinedHealth / self.fullCombinedHealth; if (num <= hpThresholdPercent / 100f) { PopAllBalloons(body.inventory); } } } private static void PopAllBalloons(Inventory inventory) { //IL_006e: 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) int itemCountEffective = inventory.GetItemCountEffective(itemDef); if (itemCountEffective <= 0) { return; } inventory.RemoveItem(itemDef, itemCountEffective); inventory.GiveItem(AirBalloonBroken.itemDef, itemCountEffective); CharacterMaster component = ((Component)inventory).GetComponent<CharacterMaster>(); if (Object.op_Implicit((Object)(object)component)) { CharacterBody body = component.GetBody(); if (Object.op_Implicit((Object)(object)body) && body.isPlayerControlled) { CharacterMasterNotificationQueue.PushItemTransformNotification(component, itemDef.itemIndex, AirBalloonBroken.itemDef.itemIndex, (TransformationType)0); } } } private static void AirBalloonHook(orig_FixedUpdate orig, CharacterMotor self) { //IL_00cb: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); CharacterBody body = self.body; if ((Object)(object)body == (Object)null || (Object)(object)body.inventory == (Object)null) { return; } int itemCountEffective = body.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0 && self.velocity.y < 0f) { if (ConfigManager.CustomValuesEnabled.Value) { fallSpeedLimit = ConfigManager.AirBalloon_FallSpeedLimit.Value; fallPercentReductionPerExtraStack = ConfigManager.AirBalloon_FallPercentReductionPerExtraStack.Value; } float exponentialPercentReductionStacking = MathUtility.GetExponentialPercentReductionStacking(fallPercentReductionPerExtraStack, itemCountEffective); float num = (0f - fallSpeedLimit) * exponentialPercentReductionStacking; if (self.velocity.y < num) { Vector3 velocity = self.velocity; velocity.y = num; self.velocity = velocity; } } } } internal class AirBalloonBroken { public static ItemDef itemDef; private static ItemTier tier = (ItemTier)5; public static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) itemDef = ItemManager.CreateItemDef("AirBalloonBroken", tier, false, false, Array.Empty<ItemTag>()); } } internal class AmuletCoin { [CompilerGenerated] private static class <>O { public static hook_OnKilledServer <0>__AmuletCoinHook; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)2; public static float goldMulPercentPerStack = 100f; public static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("AmuletCoin", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)3, (ItemTag)31 }, goldMulPercentPerStack); object obj = <>O.<0>__AmuletCoinHook; if (obj == null) { hook_OnKilledServer val = AmuletCoinHook; <>O.<0>__AmuletCoinHook = val; obj = (object)val; } DeathRewards.OnKilledServer += (hook_OnKilledServer)obj; } private static void AmuletCoinHook(orig_OnKilledServer orig, DeathRewards self, DamageReport damageReport) { CharacterBody attackerBody = damageReport.attackerBody; if ((Object)(object)attackerBody != (Object)null && (Object)(object)attackerBody.inventory != (Object)null) { int itemCountEffective = attackerBody.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { if (ConfigManager.CustomValuesEnabled.Value) { goldMulPercentPerStack = ConfigManager.AmuletCoin_GoldMulPercentPerStack.Value; } float num = 1f + MathUtility.GetLinearStacking(goldMulPercentPerStack, itemCountEffective) / 100f; self.goldReward = (uint)Mathf.RoundToInt((float)self.goldReward * num); } } orig.Invoke(self, damageReport); } } internal class ExpShare { [CompilerGenerated] private static class <>O { public static hook_AwardExperience <0>__ExpShareHook; public static hook_FixedUpdate <1>__ExpShareRateHook; public static hook_OnDestroy <2>__DictionaryDestroy; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)2; public static float expPercentBonusPerStack = 200f; public static float expPercentBonusPerExtraStack = 100f; public static float expRateBonus = 0.5f; private static readonly Dictionary<CharacterMaster, float> timersDict = new Dictionary<CharacterMaster, float>(); private static bool isPassiveEXP = false; public static void Init() { //IL_0006: 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_006e: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("ExpShare", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)3, (ItemTag)31 }, expPercentBonusPerStack, expPercentBonusPerExtraStack, expRateBonus); object obj = <>O.<0>__ExpShareHook; if (obj == null) { hook_AwardExperience val = ExpShareHook; <>O.<0>__ExpShareHook = val; obj = (object)val; } ExperienceManager.AwardExperience += (hook_AwardExperience)obj; object obj2 = <>O.<1>__ExpShareRateHook; if (obj2 == null) { hook_FixedUpdate val2 = ExpShareRateHook; <>O.<1>__ExpShareRateHook = val2; obj2 = (object)val2; } CharacterBody.FixedUpdate += (hook_FixedUpdate)obj2; object obj3 = <>O.<2>__DictionaryDestroy; if (obj3 == null) { hook_OnDestroy val3 = DictionaryDestroy; <>O.<2>__DictionaryDestroy = val3; obj3 = (object)val3; } CharacterMaster.OnDestroy += (hook_OnDestroy)obj3; } private static void ExpShareHook(orig_AwardExperience orig, ExperienceManager self, Vector3 origin, CharacterBody body, ulong experience) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)body != (Object)null && (Object)(object)body.inventory != (Object)null && !isPassiveEXP) { int itemCountEffective = body.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { if (ConfigManager.CustomValuesEnabled.Value) { expPercentBonusPerStack = ConfigManager.ExpShare_ExpPercentBonusPerStack.Value; expPercentBonusPerExtraStack = ConfigManager.ExpShare_ExpPercentBonusPerExtraStack.Value; } float num = 1f + MathUtility.GetLinearWithExtraStacking(expPercentBonusPerStack, expPercentBonusPerExtraStack, itemCountEffective) / 100f; experience = (ulong)((float)experience * num); } } orig.Invoke(self, origin, body, experience); } private static void ExpShareRateHook(orig_FixedUpdate orig, CharacterBody self) { orig.Invoke(self); if (!NetworkServer.active || (Object)(object)self == (Object)null || (Object)(object)self.inventory == (Object)null || (Object)(object)self.master == (Object)null) { return; } int itemCountEffective = self.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { CharacterMaster master = self.master; if (!timersDict.ContainsKey(master)) { timersDict[master] = 0f; } timersDict[master] += Time.fixedDeltaTime; if (timersDict[master] >= 1f) { timersDict[master] -= 1f; GainPassiveEXP(self, itemCountEffective); } } } private static void GainPassiveEXP(CharacterBody body, int itemCount) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { if (ConfigManager.CustomValuesEnabled.Value) { expRateBonus = ConfigManager.ExpShare_ExpRateBonus.Value; } uint num = (uint)Mathf.FloorToInt(body.level); ulong experienceForLevel = TeamManager.GetExperienceForLevel(num); ulong experienceForLevel2 = TeamManager.GetExperienceForLevel(num + 1); ulong num2 = experienceForLevel2 - experienceForLevel; ulong num3 = (ulong)((float)num2 * (expRateBonus / 100f)); if (num3 == 0) { num3 = 1uL; } isPassiveEXP = true; ExperienceManager.instance.AwardExperience(body.corePosition, body, num3); isPassiveEXP = false; } } private static void DictionaryDestroy(orig_OnDestroy orig, CharacterMaster self) { timersDict.Remove(self); orig.Invoke(self); } } internal class FlameOrb { [CompilerGenerated] private static class <>O { public static hook_OnHitEnemy <0>__FlameOrbHook; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)0; public static float procPercentPerStack = 10f; public static float debuffDuration = 4f; public static float damageMul = 1f; public static void Init() { //IL_0006: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("FlameOrb", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)1, (ItemTag)31 }, procPercentPerStack, debuffDuration); object obj = <>O.<0>__FlameOrbHook; if (obj == null) { hook_OnHitEnemy val = FlameOrbHook; <>O.<0>__FlameOrbHook = val; obj = (object)val; } GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj; } private static void FlameOrbHook(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, damageInfo, victim); if ((Object)(object)damageInfo.attacker == (Object)null || (Object)(object)victim == (Object)null) { return; } CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); CharacterBody component2 = victim.GetComponent<CharacterBody>(); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null || (Object)(object)component.inventory == (Object)null) { return; } int itemCountEffective = component.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { if (ConfigManager.CustomValuesEnabled.Value) { procPercentPerStack = ConfigManager.FlameOrb_ProcPercentPerStack.Value; debuffDuration = ConfigManager.FlameOrb_DebuffDuration.Value; } float linearStacking = MathUtility.GetLinearStacking(procPercentPerStack, itemCountEffective, damageInfo.procCoefficient); if (Util.CheckRoll(linearStacking, component.master)) { InflictDotInfo val = new InflictDotInfo { victimObject = victim, attackerObject = damageInfo.attacker, dotIndex = (DotIndex)1, duration = debuffDuration, damageMultiplier = damageMul }; StrengthenBurnUtils.CheckDotForUpgrade(component.inventory, ref val); DotController.InflictDot(ref val); } } } } internal class HeavyDutyBoots { [CompilerGenerated] private static class <>O { public static StatHookEventHandler <0>__HeavyDutyBootsHook; public static hook_FixedUpdate <1>__HeavyDutyBootsGroundedHook; public static hook_OnDestroy <2>__DictionaryDestroy; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)1; public static float armorBonusPerStack = 20f; public static float armorBonusPerExtraStack = 10f; private static readonly Dictionary<CharacterBody, bool> isGroundedDict = new Dictionary<CharacterBody, bool>(); public static void Init() { //IL_0006: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("HeavyDutyBoots", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)3, (ItemTag)31 }, armorBonusPerStack, armorBonusPerExtraStack); object obj = <>O.<0>__HeavyDutyBootsHook; if (obj == null) { StatHookEventHandler val = HeavyDutyBootsHook; <>O.<0>__HeavyDutyBootsHook = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; object obj2 = <>O.<1>__HeavyDutyBootsGroundedHook; if (obj2 == null) { hook_FixedUpdate val2 = HeavyDutyBootsGroundedHook; <>O.<1>__HeavyDutyBootsGroundedHook = val2; obj2 = (object)val2; } CharacterMotor.FixedUpdate += (hook_FixedUpdate)obj2; object obj3 = <>O.<2>__DictionaryDestroy; if (obj3 == null) { hook_OnDestroy val3 = DictionaryDestroy; <>O.<2>__DictionaryDestroy = val3; obj3 = (object)val3; } CharacterBody.OnDestroy += (hook_OnDestroy)obj3; } private static void HeavyDutyBootsHook(CharacterBody body, StatHookEventArgs args) { if ((Object)(object)body == (Object)null || (Object)(object)body.inventory == (Object)null) { return; } int itemCountEffective = body.inventory.GetItemCountEffective(itemDef); if (itemCountEffective <= 0) { return; } CharacterMotor characterMotor = body.characterMotor; if ((Object)(object)characterMotor == (Object)null || characterMotor.isGrounded) { if (ConfigManager.CustomValuesEnabled.Value) { armorBonusPerStack = ConfigManager.HeavyDutyBoots_ArmorBonusPerStack.Value; armorBonusPerExtraStack = ConfigManager.HeavyDutyBoots_ArmorBonusPerExtraStack.Value; } args.armorAdd += MathUtility.GetLinearWithExtraStacking(armorBonusPerStack, armorBonusPerExtraStack, itemCountEffective); } } private static void HeavyDutyBootsGroundedHook(orig_FixedUpdate orig, CharacterMotor self) { orig.Invoke(self); CharacterBody body = self.body; if ((Object)(object)body == (Object)null || (Object)(object)body.inventory == (Object)null) { return; } int itemCountEffective = body.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { bool isGrounded = self.isGrounded; if (!isGroundedDict.TryGetValue(body, out var value)) { isGroundedDict[body] = isGrounded; } else if (value != isGrounded) { isGroundedDict[body] = isGrounded; body.MarkAllStatsDirty(); } } } private static void DictionaryDestroy(orig_OnDestroy orig, CharacterBody self) { isGroundedDict.Remove(self); orig.Invoke(self); } } internal class Leftovers { [CompilerGenerated] private static class <>O { public static StatHookEventHandler <0>__LeftoversHook; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)1; public static float regenBonusPerStack = 4f; public static float regenBonusPerExtraStack = 2f; public static void Init() { //IL_0006: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("Leftovers", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)2, (ItemTag)31 }, regenBonusPerStack, regenBonusPerExtraStack); object obj = <>O.<0>__LeftoversHook; if (obj == null) { StatHookEventHandler val = LeftoversHook; <>O.<0>__LeftoversHook = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; } private static void LeftoversHook(CharacterBody body, StatHookEventArgs args) { if ((Object)(object)body == (Object)null || !Object.op_Implicit((Object)(object)body.inventory)) { return; } int itemCountEffective = body.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { if (ConfigManager.CustomValuesEnabled.Value) { regenBonusPerStack = ConfigManager.Leftovers_RegenBonusPerStack.Value; regenBonusPerExtraStack = ConfigManager.Leftovers_RegenBonusPerExtraStack.Value; } args.baseRegenAdd += MathUtility.GetLinearWithExtraStacking(regenBonusPerStack, regenBonusPerExtraStack, itemCountEffective); } } } }