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 PhreelsTinyContentPack v0.2.10
PhreelsContentPack.dll
Decompiled 6 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HG.Reflection; using On.RoR2; using PhreelsContentPack.HelperClasses; using PhreelsContentPack.Items.T1; using PhreelsContentPack.Items.T2; using PhreelsContentPack.Items.T3; using R2API; using R2API.Utils; using RoR2; using UnityEngine; using UnityEngine.Networking; using VAPI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PhreelsContentPack")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PhreelsContentPack")] [assembly: AssemblyTitle("PhreelsContentPack")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace PhreelsContentPack { [BepInPlugin("com.phreel.phreelitemmod", "PhreelsItemPack", "0.2.10")] [BepInDependency("com.bepis.r2api", "5.1.7")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [R2APISubmoduleDependency(new string[] { "ItemAPI", "LanguageAPI", "RecalculateStatsAPI", "PrefabAPI", "DotAPI" })] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Main : BaseUnityPlugin { public const string ModGuid = "com.phreel.phreelitemmod"; public const string ModName = "PhreelsItemPack"; public const string ModVer = "0.2.10"; public bool VAPILoaded = false; public static AssetBundle MainAssets; public static ConfigEntry<bool> PirateCoin_Enable { get; set; } public static ConfigEntry<float> PirateCoin_PercentageHPWhiteItem { get; set; } public static ConfigEntry<float> PirateCoin_PercentageHPWhiteItemMultiplierAtStacks { get; set; } public static ConfigEntry<bool> PalmTree_Enable { get; set; } public static ConfigEntry<float> PalmTree_AdditionalBaseDamage { get; set; } public static ConfigEntry<bool> IntergamemodeChessboard_Enable { get; set; } public static ConfigEntry<float> IntergamemodeChessboard_InitialChancetoInflict { get; set; } public static ConfigEntry<float> IntergamemodeChessboard_AdditionalChancetoInflict { get; set; } public static ConfigEntry<float> IntergamemodeChessboard_DebuffStacks { get; set; } public static ConfigEntry<float> IntergamemodeChessboard_MovementSpeedReduction { get; set; } public static ConfigEntry<bool> DetachedStinger_Enable { get; set; } public static ConfigEntry<float> DetachedStinger_ChancetoInflict { get; set; } public static ConfigEntry<float> DetachedStinger_DealExtraDamageToVariants { get; set; } public static ConfigEntry<bool> EasternLantern_Enable { get; set; } public static ConfigEntry<float> EasternLantern_InitialRegenPerAlly { get; set; } public static ConfigEntry<float> EasternLantern_AdditionalRegenPerAlly { get; set; } public void ConfigInit() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_002c: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0061: Expected O, but got Unknown //IL_0077: 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: Expected O, but got Unknown //IL_0096: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00c7: Expected O, but got Unknown //IL_00dd: 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_00fc: Expected O, but got Unknown //IL_00fc: Expected O, but got Unknown //IL_0112: 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_012d: Expected O, but got Unknown //IL_012d: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_0162: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Expected O, but got Unknown //IL_0197: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Expected O, but got Unknown //IL_01cc: Expected O, but got Unknown //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Expected O, but got Unknown //IL_0201: Expected O, but got Unknown //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Expected O, but got Unknown //IL_0232: Expected O, but got Unknown //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Expected O, but got Unknown //IL_0267: Expected O, but got Unknown //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Expected O, but got Unknown //IL_029c: Expected O, but got Unknown //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Expected O, but got Unknown //IL_02cd: Expected O, but got Unknown //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Expected O, but got Unknown //IL_0302: Expected O, but got Unknown //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Expected O, but got Unknown //IL_0337: Expected O, but got Unknown PirateCoin_Enable = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Tier2 - Pirate Coin", "Enable item"), true, new ConfigDescription("Allow the user to find this item in runs.", (AcceptableValueBase)null, Array.Empty<object>())); PirateCoin_PercentageHPWhiteItem = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Tier2 - Pirate Coin", "Additional base HP for each Common item"), 0.015f, new ConfigDescription("Percentage increase per Common item of base max health", (AcceptableValueBase)null, Array.Empty<object>())); PirateCoin_PercentageHPWhiteItemMultiplierAtStacks = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Tier2 - Pirate Coin", "Additional base HP for each Common item"), 1.2f, new ConfigDescription("Percentage increase per Common item of base max health", (AcceptableValueBase)null, Array.Empty<object>())); PalmTree_Enable = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Tier3 - Palm Tree", "Enable item"), true, new ConfigDescription("Allow the user to find this item in runs.", (AcceptableValueBase)null, Array.Empty<object>())); PalmTree_AdditionalBaseDamage = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Tier3 - Palm Tree", "Additional damage"), 1f, new ConfigDescription("Additional base damage % per enemy kill", (AcceptableValueBase)null, Array.Empty<object>())); IntergamemodeChessboard_Enable = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Tier3 - Devastator Chessboard", "Enable item"), true, new ConfigDescription("Allow the user to find this item in runs.", (AcceptableValueBase)null, Array.Empty<object>())); IntergamemodeChessboard_InitialChancetoInflict = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Tier3 - Devastator Chessboard", "Initial inflict chance"), 20f, new ConfigDescription("Chance to devastate on hit", (AcceptableValueBase)null, Array.Empty<object>())); IntergamemodeChessboard_AdditionalChancetoInflict = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Tier3 - Devastator Chessboard", "Additional inflict chance"), 20f, new ConfigDescription("Chance to devastate on hit", (AcceptableValueBase)null, Array.Empty<object>())); IntergamemodeChessboard_DebuffStacks = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Tier3 - Devastator Chessboard", "Existing debuff stacks"), 10f, new ConfigDescription("Additional debuff stacks per item stack", (AcceptableValueBase)null, Array.Empty<object>())); IntergamemodeChessboard_MovementSpeedReduction = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Tier3 - Devastator Chessboard", "Movement speed reduction"), 0.8f, new ConfigDescription("Movement speed reduction in decimal", (AcceptableValueBase)null, Array.Empty<object>())); DetachedStinger_Enable = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Tier1 - Detached Stinger", "Enable item"), true, new ConfigDescription("Allow the user to find this item in runs.", (AcceptableValueBase)null, Array.Empty<object>())); DetachedStinger_ChancetoInflict = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Tier1 - Detached Stinger", "Chance to inflict poison"), 9f, new ConfigDescription("Chance to inflict Poison", (AcceptableValueBase)null, Array.Empty<object>())); DetachedStinger_DealExtraDamageToVariants = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Tier1 - Detached Stinger", "Extra Damage against variants"), 10f, new ConfigDescription("Deal extra damage to variants", (AcceptableValueBase)null, Array.Empty<object>())); EasternLantern_Enable = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Tier2 - Eastern Lantern", "Enable item"), true, new ConfigDescription("Allow the user to find this item in runs.", (AcceptableValueBase)null, Array.Empty<object>())); EasternLantern_InitialRegenPerAlly = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Tier2 - Eastern Lantern", "Initial regen per ally"), 2f, new ConfigDescription("Initial regen per ally in your team", (AcceptableValueBase)null, Array.Empty<object>())); EasternLantern_AdditionalRegenPerAlly = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Tier2 - Eastern Lantern", "Additional regen per ally"), 1.5f, new ConfigDescription("Additional regen per ally in your team", (AcceptableValueBase)null, Array.Empty<object>())); } public void Awake() { VAPILoaded = Chainloader.PluginInfos.ContainsKey("com.Nebby.VAPI"); ConfigInit(); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PhreelsContentPack.phreelcontentpack")) { MainAssets = AssetBundle.LoadFromStream(stream); } if (DetachedStinger_Enable.Value) { if (VAPILoaded) { DetachedStinger.InitiateWithVAPIEnabled(); } else { DetachedStinger.Initiate(); } } if (PirateCoin_Enable.Value) { PirateCoin.Initiate(); } if (EasternLantern_Enable.Value) { EasternLantern.Initiate(); } if (IntergamemodeChessboard_Enable.Value) { Chessboard.Initiate(); } if (PalmTree_Enable.Value) { PalmTree.Initiate(PalmTree_AdditionalBaseDamage.Value); } } } } namespace PhreelsContentPack.Utils { internal class Scalings { public static float HyperbolicChance(float baseChance, float scaling, int stacks) { return (stacks <= 0) ? 0f : (baseChance * (1f - 1f / (1f + scaling * (float)stacks))); } public static float LinearChance(float baseChance, float scaling, int stacks) { return (stacks <= 0) ? 0f : (baseChance + scaling * (float)(stacks - 1)); } } } namespace PhreelsContentPack.Items.T3 { internal class Chessboard { private static string itemName = "Chessboard"; private static string upperName = itemName.ToUpper(); public static ItemDef itemDefinition = CreateItem(); public static BuffDef DevastateMovement { get; private set; } public static GameObject LoadPrefab() { return Main.MainAssets.LoadAsset<GameObject>("Assets/ClayfootStudios/Prefabs/Chess_Board.prefab"); } public static Sprite LoadSprite() { return Main.MainAssets.LoadAsset<Sprite>("Assets/Palm tree/Chessboard.png"); } private static void CreateBuff() { //IL_0030: 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) DevastateMovement = ScriptableObject.CreateInstance<BuffDef>(); ((Object)DevastateMovement).name = "DevastateMovement"; DevastateMovement.buffColor = new Color(0.25f, 0f, 0.25f); DevastateMovement.canStack = false; DevastateMovement.isDebuff = true; DevastateMovement.iconSprite = LegacyResourcesAPI.Load<BuffDef>("BuffDefs/VoidFogStrong").iconSprite; ContentAddition.AddBuffDef(DevastateMovement); } public static ItemDef CreateItem() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) ItemDef val = ScriptableObject.CreateInstance<ItemDef>(); ((Object)val).name = itemName; val.nameToken = "PCP_" + upperName + "_NAME"; val.pickupToken = "PCP_" + upperName + "_PICKUP"; val.descriptionToken = "PCP_" + upperName + "_DESC"; val.loreToken = "PCP_" + upperName + "_LORE"; ItemTag[] array = new ItemTag[4]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); val.tags = (ItemTag[])(object)array; val.deprecatedTier = (ItemTier)2; val.canRemove = true; val.hidden = false; val.pickupModelPrefab = LoadPrefab(); val.pickupIconSprite = LoadSprite(); return val; } public static ItemDisplayRuleDict CreateDisplayRules() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown GameObject val = helpers.PrepareItemDisplayModel(PrefabAPI.InstantiateClone(LoadPrefab(), ((Object)LoadPrefab()).name + "Display", false)); return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>()); } public static void AddTokens() { LanguageAPI.Add("PCP_" + upperName + "_NAME", "Devastator Chessboard"); LanguageAPI.Add("PCP_" + upperName + "_PICKUP", "Chance to devastate on hit"); LanguageAPI.Add("PCP_" + upperName + "_DESC", $"On hit, you have a <style=cIsDamage>{Main.IntergamemodeChessboard_InitialChancetoInflict.Value}% chance</style> <style=cStack>(+{Main.IntergamemodeChessboard_AdditionalChancetoInflict.Value}% per stack)</style> to inflict <style=cIsUtility>the Eclipse 8 Permanent Health debuff</style> <style=cStack>(+2 stacks of Curse per item stack)</style> while also <style=cIsDamage>adding +{Main.IntergamemodeChessboard_DebuffStacks.Value} stacks of stackable debuffs already on the enemy</style> <style=cStack>(+{Main.IntergamemodeChessboard_DebuffStacks.Value} per stack)</style> and <style=cIsDamage>decreasing their movement speed by {Main.IntergamemodeChessboard_MovementSpeedReduction.Value}% permanently.</style>"); LanguageAPI.Add("PCP_" + upperName + "_LORE", "How the exact fuck is this even a thing, too broken imo"); } private static void AddHooks(ItemDef itemDefToHooks) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown List<string> EclipseEightbutList = new List<string> { "PermanentCurse" }; List<BuffDef> allBuffDefs = new List<BuffDef>(); GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)delegate(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown orig.Invoke(self, damageInfo, victim); if (Object.op_Implicit((Object)(object)damageInfo.attacker) && Object.op_Implicit((Object)(object)damageInfo.attacker.GetComponent<CharacterBody>()) && Object.op_Implicit((Object)(object)damageInfo.attacker.GetComponent<CharacterBody>().inventory) && Object.op_Implicit((Object)(object)victim.GetComponent<CharacterBody>()) && Object.op_Implicit((Object)(object)damageInfo.attacker.GetComponent<CharacterBody>().master)) { Inventory inventory = damageInfo.attacker.GetComponent<CharacterBody>().inventory; CharacterMaster master = damageInfo.attacker.GetComponent<CharacterBody>().master; CharacterBody component = victim.GetComponent<CharacterBody>(); if (inventory.GetItemCount(itemDefToHooks) > 0) { Xoroshiro128Plus val = new Xoroshiro128Plus(Run.instance.seed); Util.ShuffleList<string>(EclipseEightbutList, val); Util.ShuffleList<BuffDef>(allBuffDefs, val); foreach (BuffDef item in allBuffDefs) { if ((Object)(object)item == (Object)(object)Buffs.PermanentCurse) { foreach (string item2 in EclipseEightbutList) { if (!Util.CheckRoll(Main.IntergamemodeChessboard_InitialChancetoInflict.Value + (float)inventory.GetItemCount(itemDefToHooks) * Main.IntergamemodeChessboard_AdditionalChancetoInflict.Value * damageInfo.procCoefficient, master.luck, master)) { return; } if (inventory.GetItemCount(itemDefToHooks) > 0) { if (inventory.GetItemCount(itemDefToHooks) == 1) { component.AddBuff(Buffs.PermanentCurse); component.AddTimedBuff(DevastateMovement, 99999f); BuffDef[] buffDefs = BuffCatalog.buffDefs; foreach (BuffDef val2 in buffDefs) { if (component.HasBuff(val2) && val2.isDebuff && (Object)(object)val2 != (Object)(object)Buffs.PermanentCurse) { for (int j = 0; (float)j <= Main.IntergamemodeChessboard_DebuffStacks.Value * (float)inventory.GetItemCount(itemDefToHooks); j++) { component.AddBuff(val2); } } } } else { component.AddBuff(Buffs.PermanentCurse); component.AddTimedBuff(DevastateMovement, 99999f); for (int k = 2; k <= inventory.GetItemCount(itemDefToHooks); k++) { component.AddBuff(Buffs.PermanentCurse); component.AddBuff(Buffs.PermanentCurse); } BuffDef[] buffDefs2 = BuffCatalog.buffDefs; foreach (BuffDef val3 in buffDefs2) { if (component.HasBuff(val3) && val3.isDebuff) { for (int m = 0; (float)m <= Main.IntergamemodeChessboard_DebuffStacks.Value * (float)inventory.GetItemCount(itemDefToHooks); m++) { component.AddBuff(val3); } } } } return; } } } } } } }; RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(GetAllBuffs)); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(DevastateMovementBuffBehavior); void GetAllBuffs() { allBuffDefs.Add(Buffs.PermanentCurse); allBuffDefs.Add(DevastateMovement); } } private static void DevastateMovementBuffBehavior(CharacterBody sender, StatHookEventArgs args) { if (sender.HasBuff(DevastateMovement)) { args.moveSpeedReductionMultAdd += Main.IntergamemodeChessboard_MovementSpeedReduction.Value; } } public static void Initiate() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown ItemAPI.Add(new CustomItem(itemDefinition, CreateDisplayRules())); AddTokens(); CreateBuff(); AddHooks(itemDefinition); } } internal class PalmTree { private static string itemName = "PalmTree"; private static string upperName = itemName.ToUpper(); public static ItemDef itemDefinition = CreateItem(); public static GameObject LoadPrefab() { return Main.MainAssets.LoadAsset<GameObject>("Assets/Palm tree/2.prefabs/palm_tree.prefab"); } public static Sprite LoadSprite() { return Main.MainAssets.LoadAsset<Sprite>("Assets/Palm tree/Palm Tree.png"); } public static ItemDef CreateItem() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) ItemDef val = ScriptableObject.CreateInstance<ItemDef>(); ((Object)val).name = itemName; val.nameToken = "PCP_" + upperName + "_NAME"; val.pickupToken = "PCP_" + upperName + "_PICKUP"; val.descriptionToken = "PCP_" + upperName + "_DESC"; val.loreToken = "PCP_" + upperName + "_LORE"; val.tags = (ItemTag[])(object)new ItemTag[2] { (ItemTag)1, (ItemTag)31 }; val.deprecatedTier = (ItemTier)2; val.canRemove = true; val.hidden = false; val.pickupModelPrefab = LoadPrefab(); val.pickupIconSprite = LoadSprite(); return val; } public static ItemDisplayRuleDict CreateDisplayRules() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown GameObject val = helpers.PrepareItemDisplayModel(PrefabAPI.InstantiateClone(LoadPrefab(), ((Object)LoadPrefab()).name + "Display", false)); return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>()); } public static void AddTokens() { LanguageAPI.Add("PCP_" + upperName + "_NAME", "Palm Tree"); LanguageAPI.Add("PCP_" + upperName + "_PICKUP", "Additional base damage for each kill"); LanguageAPI.Add("PCP_" + upperName + "_DESC", $"For each <style=cIsDamage>kill</style> your base damage is increased by <style=cIsDamage>{Main.PalmTree_AdditionalBaseDamage.Value}</style>% <style=cStack>(+{Main.PalmTree_AdditionalBaseDamage.Value}% per stack)</style> base damage. Further stacks count in already killed enemies."); LanguageAPI.Add("PCP_" + upperName + "_LORE", "Crash Bandicoot palm tree, what the fuck"); } private static void AddHooks(ItemDef itemDefToHooks, float PalmTree_AdditionalBaseDamage) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown Run.Start += new hook_Start(Run_Start); GlobalEventManager.OnCharacterDeath += new hook_OnCharacterDeath(GlobalEventManager_OnCharacterDeath); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(GetStatCoefficients); void GetStatCoefficients(CharacterBody self, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)self.inventory)) { int itemCount = self.inventory.GetItemCount(itemDefToHooks); if (itemCount > 0) { args.damageMultAdd += (float)itemCount * (PalmTree_AdditionalBaseDamage / 100f); } } } void GlobalEventManager_OnCharacterDeath(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport) { orig.Invoke(self, damageReport); if (!((Object)(object)damageReport.attackerBody == (Object)null)) { Inventory inventory = damageReport.attackerBody.inventory; if (Object.op_Implicit((Object)(object)inventory)) { int itemCount2 = inventory.GetItemCount(itemDefToHooks); if (itemCount2 == 1) { PalmTree_AdditionalBaseDamage += Main.PalmTree_AdditionalBaseDamage.Value; damageReport.attackerBody.RecalculateStats(); } else if (itemCount2 > 1) { PalmTree_AdditionalBaseDamage += (float)itemCount2 * Main.PalmTree_AdditionalBaseDamage.Value; damageReport.attackerBody.RecalculateStats(); } } } } void Run_Start(orig_Start orig, Run self) { PalmTree_AdditionalBaseDamage = 0f; orig.Invoke(self); } } public static void Initiate(float PalmTree_AdditionalBaseDamage) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown CreateItem(); ItemAPI.Add(new CustomItem(itemDefinition, CreateDisplayRules())); AddTokens(); AddHooks(itemDefinition, PalmTree_AdditionalBaseDamage); } } } namespace PhreelsContentPack.Items.T2 { internal class EasternLantern { private static string itemName = "EasternLantern"; private static string upperName = itemName.ToUpper(); public static ItemDef itemDefinition = CreateItem(); public static GameObject LoadPrefab() { return Main.MainAssets.LoadAsset<GameObject>("Assets/Palm tree/EasternLantern.prefab"); } public static Sprite LoadSprite() { return Main.MainAssets.LoadAsset<Sprite>("Assets/Palm tree/EasternLantern.png"); } public static ItemDef CreateItem() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) ItemDef val = ScriptableObject.CreateInstance<ItemDef>(); ((Object)val).name = itemName; val.nameToken = "PCP_" + upperName + "_NAME"; val.pickupToken = "PCP_" + upperName + "_PICKUP"; val.descriptionToken = "PCP_" + upperName + "_DESC"; val.loreToken = "PCP_" + upperName + "_LORE"; ItemTag[] array = new ItemTag[4]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); val.tags = (ItemTag[])(object)array; val.deprecatedTier = (ItemTier)1; val.canRemove = true; val.hidden = false; val.pickupModelPrefab = LoadPrefab(); val.pickupIconSprite = LoadSprite(); return val; } public static ItemDisplayRuleDict CreateDisplayRules() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown GameObject val = helpers.PrepareItemDisplayModel(PrefabAPI.InstantiateClone(LoadPrefab(), ((Object)LoadPrefab()).name + "Display", false)); return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>()); } public static void AddTokens() { LanguageAPI.Add("PCP_" + upperName + "_NAME", "Far Eastern Lantern"); LanguageAPI.Add("PCP_" + upperName + "_PICKUP", "Increase your HP regen by the amount of allies you have."); LanguageAPI.Add("PCP_" + upperName + "_DESC", $"<style=cIsHealing>Increases base health regeneration by +{Main.EasternLantern_InitialRegenPerAlly.Value}hp/s</style> <style=cStack>(+{Main.EasternLantern_AdditionalRegenPerAlly.Value} hp/s per stack)</style> for each ally you have."); LanguageAPI.Add("PCP_" + upperName + "_LORE", "Did you know that the lanterns in Chinese culture represent family?"); } private static void AddHooks(ItemDef itemDefToHooks) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(EasternLanternRecalculateStats); void EasternLanternRecalculateStats(CharacterBody body, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)body.inventory) && body.inventory.GetItemCount(itemDefToHooks) > 0) { float num = body.inventory.GetItemCount(itemDefToHooks); float num2 = 0f; num2 += (float)TeamComponent.GetTeamMembers((TeamIndex)1).Count(); args.baseRegenAdd += num2 * (Main.EasternLantern_InitialRegenPerAlly.Value + num * Main.EasternLantern_AdditionalRegenPerAlly.Value); } } } public static void Initiate() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown CreateItem(); ItemAPI.Add(new CustomItem(itemDefinition, CreateDisplayRules())); AddTokens(); AddHooks(itemDefinition); } } internal class PirateCoin { private static string itemName = "PirateCoin"; private static string upperName = itemName.ToUpper(); public static ItemDef itemDefinition = CreateItem(); public static GameObject LoadPrefab() { return Main.MainAssets.LoadAsset<GameObject>("Assets/DavePixel/PirateCoin/Prefabs/PirateCoin.prefab"); } public static Sprite LoadSprite() { return Main.MainAssets.LoadAsset<Sprite>("Assets/Palm tree/PirateCoin.png"); } public static ItemDef CreateItem() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) ItemDef val = ScriptableObject.CreateInstance<ItemDef>(); ((Object)val).name = itemName; val.nameToken = "PCP_" + upperName + "_NAME"; val.pickupToken = "PCP_" + upperName + "_PICKUP"; val.descriptionToken = "PCP_" + upperName + "_DESC"; val.loreToken = "PCP_" + upperName + "_LORE"; ItemTag[] array = new ItemTag[3]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); val.tags = (ItemTag[])(object)array; val.deprecatedTier = (ItemTier)1; val.canRemove = true; val.hidden = false; val.pickupModelPrefab = LoadPrefab(); val.pickupIconSprite = LoadSprite(); return val; } public static ItemDisplayRuleDict CreateDisplayRules() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown GameObject val = helpers.PrepareItemDisplayModel(PrefabAPI.InstantiateClone(LoadPrefab(), ((Object)LoadPrefab()).name + "Display", false)); return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>()); } public static void AddTokens() { LanguageAPI.Add("PCP_" + upperName + "_NAME", "Pirate Coin"); LanguageAPI.Add("PCP_" + upperName + "_PICKUP", "Increase your HP based on the amount of White items you own."); LanguageAPI.Add("PCP_" + upperName + "_DESC", $"<style=cIsHealing>Increase your base HP by {Main.PirateCoin_PercentageHPWhiteItem.Value * 100f}%</style> for each Common item in your inventory. <style=cStack>Further stacks of the item, multiplies the HP increase effect by {Main.PirateCoin_PercentageHPWhiteItemMultiplierAtStacks.Value} times.</style>"); LanguageAPI.Add("PCP_" + upperName + "_LORE", "One shipwrecked man's treasure is another sailor's savior of the day."); } private static void AddHooks(ItemDef itemDefToHooks) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(PirateCoinRecalculateStats); void PirateCoinRecalculateStats(CharacterBody body, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)body.inventory)) { int itemCount = body.inventory.GetItemCount(itemDefToHooks); if (itemCount > 0) { float num = 0f; num += (float)body.inventory.GetTotalItemCountOfTier((ItemTier)0); num += (float)body.inventory.GetTotalItemCountOfTier((ItemTier)6); float num2 = Main.PirateCoin_PercentageHPWhiteItem.Value / 100f; float num3 = (float)Math.Pow(Main.PirateCoin_PercentageHPWhiteItemMultiplierAtStacks.Value, itemCount - 1); args.healthMultAdd += num * num2 * num3; } } } } public static void Initiate() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown CreateItem(); ItemAPI.Add(new CustomItem(itemDefinition, CreateDisplayRules())); AddTokens(); AddHooks(itemDefinition); } } } namespace PhreelsContentPack.Items.T1 { internal class DetachedStinger { private static string itemName = "DetachedStinger"; private static string upperName = itemName.ToUpper(); public static ItemDef itemDefinition = CreateItem(); public static GameObject LoadPrefab() { return Main.MainAssets.LoadAsset<GameObject>("Assets/Palm tree/DetachedStinger.prefab"); } public static Sprite LoadSprite() { return Main.MainAssets.LoadAsset<Sprite>("Assets/Palm tree/DetachedStinger.png"); } public static ItemDef CreateItem() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) ItemDef val = ScriptableObject.CreateInstance<ItemDef>(); ((Object)val).name = itemName; val.nameToken = "PCP_" + upperName + "_NAME"; val.pickupToken = "PCP_" + upperName + "_PICKUP"; val.descriptionToken = "PCP_" + upperName + "_DESC"; val.loreToken = "PCP_" + upperName + "_LORE"; val.tags = (ItemTag[])(object)new ItemTag[2] { (ItemTag)1, (ItemTag)31 }; val.deprecatedTier = (ItemTier)0; val.canRemove = true; val.hidden = false; val.pickupModelPrefab = LoadPrefab(); val.pickupIconSprite = LoadSprite(); return val; } public static ItemDisplayRuleDict CreateDisplayRules() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown GameObject val = helpers.PrepareItemDisplayModel(PrefabAPI.InstantiateClone(LoadPrefab(), ((Object)LoadPrefab()).name + "Display", false)); return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>()); } public static void AddTokens() { LanguageAPI.Add("PCP_" + upperName + "_NAME", "Detached Stinger"); LanguageAPI.Add("PCP_" + upperName + "_PICKUP", "Chance to inflict poison on hit."); LanguageAPI.Add("PCP_" + upperName + "_DESC", $"On hit, you have an <style=cIsDamage>{Main.DetachedStinger_ChancetoInflict.Value}% chance</style> <style=cStack>(+{Main.DetachedStinger_ChancetoInflict.Value}% per stack)</style> to <style=cIsDamage>poison</style> your target"); LanguageAPI.Add("PCP_" + upperName + "_LORE", "Thank you Mr.Bones"); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddTokensWithVAPIEnabled() { LanguageAPI.Add("PCP_" + upperName + "_NAME", "Detached Stinger"); LanguageAPI.Add("PCP_" + upperName + "_PICKUP", "Chance to inflict poison on hit. Deal more damage to variants."); LanguageAPI.Add("PCP_" + upperName + "_DESC", $"On hit, you have an <style=cIsDamage>{Main.DetachedStinger_ChancetoInflict.Value}% chance</style> <style=cStack>(+{Main.DetachedStinger_ChancetoInflict.Value}% per stack)</style> to <style=cIsDamage>poison</style> your target. Additionally deal <style=cIsDamage>{Main.DetachedStinger_DealExtraDamageToVariants.Value}% more damage</style> <style=cStack>(+{Main.DetachedStinger_DealExtraDamageToVariants.Value}% per stack)</style> to variant enemies."); LanguageAPI.Add("PCP_" + upperName + "_LORE", "Thank you Mr.Bones"); } private static void AddHooks(ItemDef itemDefToHooks) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(inflictPoison); void inflictPoison(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { //IL_00b0: 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_00bf: 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) try { if (NetworkServer.active && Object.op_Implicit((Object)(object)damageInfo.attacker.GetComponent<CharacterBody>()) && Object.op_Implicit((Object)(object)victim.GetComponent<CharacterBody>())) { Inventory inventory = damageInfo.attacker.GetComponent<CharacterBody>().inventory; int itemCount = inventory.GetItemCount(itemDefToHooks); if (itemCount > 0 && Util.CheckRoll((1f - Mathf.Clamp(1f / (1f + (float)itemCount * Main.DetachedStinger_ChancetoInflict.Value), 0f, 1f)) * 100f * damageInfo.procCoefficient, 0f, (CharacterMaster)null)) { damageInfo.damageType |= DamageTypeCombo.op_Implicit((DamageType)4096); } } } catch { } orig.Invoke(self, damageInfo, victim); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void AddHooksWithVAPIEnabled(ItemDef itemDefToHooks) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(inflictPoison); HealthComponent.TakeDamage += new hook_TakeDamage(DealExtraDamageToVariants); void DealExtraDamageToVariants(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { if (NetworkServer.active && Object.op_Implicit((Object)(object)damageInfo.attacker) && Object.op_Implicit((Object)(object)damageInfo.attacker.GetComponent<CharacterBody>()) && Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)((Component)self).GetComponent<CharacterBody>())) { CharacterBody component = ((Component)self).GetComponent<CharacterBody>(); Inventory inventory = damageInfo.attacker.GetComponent<CharacterBody>().inventory; if ((Object)(object)inventory != (Object)null) { int itemCount = inventory.GetItemCount(itemDefToHooks); if (itemCount > 0 && component.HasBuff(Buffs.bdVariant)) { damageInfo.damage *= 1f + (float)itemCount * (Main.DetachedStinger_DealExtraDamageToVariants.Value / 100f); } } } orig.Invoke(self, damageInfo); } void inflictPoison(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { //IL_006f: 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_007e: 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) CharacterBody val = default(CharacterBody); if (NetworkServer.active && Object.op_Implicit((Object)(object)damageInfo.attacker) && damageInfo.attacker.TryGetComponent<CharacterBody>(ref val) && Object.op_Implicit((Object)(object)val.inventory)) { int itemCount2 = val.inventory.GetItemCount(itemDefToHooks); if (Util.CheckRoll((float)itemCount2 * Main.DetachedStinger_ChancetoInflict.Value * damageInfo.procCoefficient, val.master)) { damageInfo.damageType |= DamageTypeCombo.op_Implicit((DamageType)4096); } } orig.Invoke(self, damageInfo, victim); } } public static void Initiate() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown ItemAPI.Add(new CustomItem(itemDefinition, CreateDisplayRules())); AddTokens(); AddHooks(itemDefinition); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void InitiateWithVAPIEnabled() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown ItemAPI.Add(new CustomItem(itemDefinition, CreateDisplayRules())); AddTokensWithVAPIEnabled(); AddHooksWithVAPIEnabled(itemDefinition); } } } namespace PhreelsContentPack.Items.Buffs { public abstract class BuffBase<T> : BuffBase where T : BuffBase<T> { public static T instance { get; private set; } public BuffBase() { if (instance != null) { throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting BuffBase was instantiated twice"); } instance = this as T; } } public abstract class BuffBase { public BuffDef BuffDef; public abstract string BuffName { get; } public abstract Color Color { get; } public virtual bool CanStack { get; set; } = false; public virtual bool IsDebuff { get; set; } = false; public abstract Sprite BuffIcon { get; } public abstract void Init(); public void CreateBuff() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) BuffDef = ScriptableObject.CreateInstance<BuffDef>(); ((Object)BuffDef).name = BuffName; BuffDef.buffColor = Color; BuffDef.canStack = CanStack; BuffDef.isDebuff = IsDebuff; BuffDef.iconSprite = BuffIcon; ContentAddition.AddBuffDef(BuffDef); } public abstract void Hooks(); } } namespace PhreelsContentPack.HelperClasses { public class helpers { public static GameObject PrepareItemDisplayModel(GameObject itemDisplayModel) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) ItemDisplay val = itemDisplayModel.AddComponent<ItemDisplay>(); List<RendererInfo> list = new List<RendererInfo>(); Renderer[] componentsInChildren = itemDisplayModel.GetComponentsInChildren<Renderer>(); foreach (Renderer val2 in componentsInChildren) { RendererInfo val3 = default(RendererInfo); val3.renderer = val2; val3.defaultMaterial = val2.material; RendererInfo item = val3; list.Add(item); } val.rendererInfos = list.ToArray(); return itemDisplayModel; } } }