Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of ZeebsZitems v1.1.6
ZeebsZitems.dll
Decompiled 3 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 HG.Reflection; using On.RoR2; using R2API; using R2API.Utils; using RoR2; using RoR2.Projectile; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Rendering; using ZeebsZitems.Base_Classes; using ZeebsZitems.Custom_Classes.Equipment; using ZeebsZitems.Custom_Classes.Items; using ZeebsZitems.Utils; [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("ZeebsZitems")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+46dbae5a6f1057bbf2339a86d729c67e7c0ba7db")] [assembly: AssemblyProduct("ZeebsZitems")] [assembly: AssemblyTitle("ZeebsZitems")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace ZeebsZitems { [BepInDependency("com.bepis.r2api", "5.1.1")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Zeeboon.ZeebsZitems", "Zeeb's Zitems", "1.1.5")] public class Main : BaseUnityPlugin { public const string ModGUID = "com.Zeeboon.ZeebsZitems"; public const string ModName = "Zeeb's Zitems"; public const string ModVersion = "1.1.5"; public static AssetBundle Assets; private bool Debug_ItemSpawn = false; public static PluginInfo PInfo { get; private set; } public void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); PInfo = ((BaseUnityPlugin)this).Info; string directoryName = Path.GetDirectoryName(((object)this).GetType().Assembly.Location); string text = Path.Combine(Path.GetDirectoryName(PInfo.Location), "mod_assets"); Assets = AssetBundle.LoadFromFile(text); Configs(); Instantiate(); Hooks(); } public void Configs() { } public void Hooks() { } public void Instantiate() { VerifyEquipment(new Equipment01()); VerifyItems(new Item01()); VerifyItems(new Item02()); VerifyItems(new Item03()); VerifyItems(new Item04()); } public void VerifyItems(ItemBase item) { if (((BaseUnityPlugin)this).Config.Bind<bool>("Items", "enable " + item.ItemName, true, "Enable this item in game?").Value) { item.Init(((BaseUnityPlugin)this).Config); } } public void VerifyEquipment(EquipmentBase equip) { if (((BaseUnityPlugin)this).Config.Bind<bool>("Equipment", "enable " + equip.EquipmentName, true, "Enable this equipment in game?").Value) { equip.Init(((BaseUnityPlugin)this).Config); } } private void Update() { if (Debug_ItemSpawn) { Equipment01.Update(); Item01.Update(); Item02.Update(); Item03.Update(); Item04.Update(); } } } } namespace ZeebsZitems.Utils { public static class ArrayHelper { public static T[] Append<T>(ref T[] array, List<T> list) { int num = array.Length; int count = list.Count; Array.Resize(ref array, num + count); list.CopyTo(array, num); return array; } public static Func<T[], T[]> AppendDel<T>(List<T> list) { return (T[] r) => Append(ref r, list); } } internal class ItemHelper { public static RendererInfo[] ItemDisplaySetup(GameObject obj) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_004a: Unknown result type (might be due to invalid IL or missing references) MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>(); RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { array[i] = new RendererInfo { defaultMaterial = ((Renderer)componentsInChildren[i]).material, renderer = (Renderer)(object)componentsInChildren[i], defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false }; } return array; } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void LogDebug(object data) { _logSource.LogDebug(data); } internal static void LogError(object data) { _logSource.LogError(data); } internal static void LogFatal(object data) { _logSource.LogFatal(data); } internal static void LogInfo(object data) { _logSource.LogInfo(data); } internal static void LogMessage(object data) { _logSource.LogMessage(data); } internal static void LogWarning(object data) { _logSource.LogWarning(data); } } } namespace ZeebsZitems.Custom_Classes.Items { internal class Item01 : ItemBase { public static ItemDef StinkyBomb = ScriptableObject.CreateInstance<ItemDef>(); public GameObject StinkProjectilePrefab; public GameObject StinkEffectPrefab; private EffectData StinkEffect; public static float ProcChance = 10f; public static float ProcStack = 10f; public static float StinkDamage = 1.8f; public static float StinkDamageStack = 1.1f; public static float StinkDuration = 4f; public static float StinkRadius = 10f; public override string ItemName => "Stinky Bomb"; public override string ItemLangTokenName => "STINKYBOMB"; public override string ItemPickupDesc => "Chance on hit to poison surrounding enemies."; public override string ItemFullDescription => $"<style=cIsDamage>{ProcChance}%</style> chance on hit to <style=cIsDamage>poison</style> " + $"all enemies in {StinkRadius} meters for <style=cIsDamage>{StinkDamage * 100f}%</style> <style=cStack>[+ {StinkDamageStack * 100f}% per stack]</style>" + " TOTAL damage over 4 seconds."; public override string ItemLore => "the peak of biological warfare"; public override ItemTier Tier => (ItemTier)0; public override string ItemModelPath => "Assets/ItemTests/Models/Prefabs/Items/StinkyBomb.prefab"; public override string ItemIconPath => "Assets/ItemTests/Textures/Icons/Items/StinkyBombIcon.png"; public override ItemTag[] ItemTags { get; } = (ItemTag[])(object)new ItemTag[1] { (ItemTag)1 }; public override bool CanRemove { get; } = true; public static BuffDef StinkBombBuff { get; private set; } public static DotIndex StinkDot { get; private set; } public static ConfigEntry<bool> alwaysShowFX { get; set; } public override void CreateConfig(ConfigFile config) { } public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_003b: 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) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = ItemBase.ItemBodyModelPrefab, childName = "Chest", localPos = new Vector3(0f, 0f, 0f), localAngles = new Vector3(0f, 0f, 0f), localScale = new Vector3(1f, 1f, 1f) } }); } public override void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown GlobalEventManager.ProcessHitEnemy += new hook_ProcessHitEnemy(GlobalEventManager_ProcessHitEnemy); } public static void SetupAttributes() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) StinkBombBuff = ScriptableObject.CreateInstance<BuffDef>(); StinkBombBuff.buffColor = Color.yellow; StinkBombBuff.canStack = true; StinkBombBuff.isDebuff = true; ((Object)StinkBombBuff).name = "StinkyBombBuff"; StinkBombBuff.iconSprite = Main.Assets.LoadAsset<Sprite>("Assets/ItemTests/Textures/Icons/Buffs/StinkyIcon.png"); ContentAddition.AddBuffDef(StinkBombBuff); DotDef val = new DotDef { interval = 1f, damageCoefficient = 1f / StinkDuration, damageColorIndex = (DamageColorIndex)4, associatedBuff = StinkBombBuff }; StinkDot = DotAPI.RegisterDotDef(val, (CustomDotBehaviour)null, (CustomDotVisual)null); } public override void Init(ConfigFile config) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0073: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) CreateConfig(config); StinkProjectilePrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/MiniMushroom/SporeGrenadeProjectileDotZone.prefab").WaitForCompletion(); StinkProjectilePrefab.GetComponent<ProjectileController>().procCoefficient = 0f; StinkEffectPrefab = Main.Assets.LoadAsset<GameObject>("Assets/ItemTests/Models/Prefabs/VFX/stinkPoof.prefab"); StinkEffectPrefab.AddComponent<EffectComponent>(); StinkEffect = new EffectData { scale = StinkRadius * 0.6f }; StinkEffectPrefab.GetComponent<EffectComponent>().applyScale = true; StinkEffectPrefab.AddComponent<VFXAttributes>(); StinkEffectPrefab.GetComponent<VFXAttributes>().vfxPriority = (VFXPriority)1; StinkEffectPrefab.GetComponent<VFXAttributes>().vfxIntensity = (VFXIntensity)0; ContentAddition.AddEffect(StinkEffectPrefab); CreateLang(); SetupAttributes(); CreateItem(StinkyBomb); Hooks(); } private void GlobalEventManager_ProcessHitEnemy(orig_ProcessHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { orig.Invoke(self, damageInfo, victim); CharacterBody val = default(CharacterBody); CharacterBody val2 = default(CharacterBody); HealthComponent val3 = default(HealthComponent); if (Object.op_Implicit((Object)(object)victim) && Object.op_Implicit((Object)(object)damageInfo.attacker) && damageInfo.procCoefficient > 0f && victim.TryGetComponent<CharacterBody>(ref val) && damageInfo.attacker.TryGetComponent<CharacterBody>(ref val2) && victim.TryGetComponent<HealthComponent>(ref val3) && Object.op_Implicit((Object)(object)damageInfo.attacker.GetComponent<CharacterBody>().inventory)) { CharacterBody component = victim.GetComponent<CharacterBody>(); CharacterBody component2 = damageInfo.attacker.GetComponent<CharacterBody>(); int itemCount = component2.inventory.GetItemCount(StinkyBomb); if (itemCount > 0 && Util.CheckRoll(ProcChance * damageInfo.procCoefficient, 0f, (CharacterMaster)null)) { SpawnStink(component, component2, damageInfo, StinkBombBuff, itemCount); } } } private void SpawnStink(CharacterBody victimBody, CharacterBody attackerBody, DamageInfo damageInfo, BuffDef stinkBombBuff, int itemCount) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0014: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0046: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) float stinkRadius = StinkRadius; Vector3 position = damageInfo.position; SphereSearch val = new SphereSearch(); List<HurtBox> list = new List<HurtBox>(); val.origin = position; val.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask; val.radius = stinkRadius; val.RefreshCandidates(); val.FilterCandidatesByHurtBoxTeam(TeamMask.GetUnprotectedTeams(attackerBody.teamComponent.teamIndex)); val.FilterCandidatesByDistinctHurtBoxEntities(); val.GetHurtBoxes(list); val.ClearCandidates(); for (int i = 0; i < list.Count; i++) { HurtBox val2 = list[i]; HealthComponent healthComponent = val2.healthComponent; if ((Object)(object)healthComponent != (Object)null && itemCount > 0) { InflictDotInfo val3 = default(InflictDotInfo); val3.victimObject = ((Component)val2.healthComponent).gameObject; val3.attackerObject = damageInfo.attacker; val3.dotIndex = StinkDot; val3.damageMultiplier = damageInfo.damage / attackerBody.damage * (1.7f + (float)(itemCount - 1)); val3.duration = StinkDuration; InflictDotInfo val4 = val3; DotController.InflictDot(ref val4); } } StinkEffect.origin = position; EffectManager.SpawnEffect(StinkEffectPrefab, StinkEffect, true); } public static void Update() { //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) //IL_003b: 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_004b: 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; PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(StinkyBomb.itemIndex), transform.position, transform.forward * 20f); } } } internal class Item02 : ItemBase { public static ItemDef iceDeathItem = ScriptableObject.CreateInstance<ItemDef>(); public GameObject SlowParticlePrefab; private EffectData SlowEffect; public static float SlowDuration = 3f; public static float SlowRadius = 14f; public static float BlastRadius = 10f; public static float BlastDamageMult = 2.5f; public static float BlastDamageStack = 1f; public static float BlastChance = 10f; public static float BlastStackChance = 5f; public override string ItemName => "Liquid Nitrogen"; public override string ItemLangTokenName => "LIQUID_NITROGEN"; public override string ItemPickupDesc => "Killing an enemy slows surrounding enemies, with a chance to cause a freezing blast instead."; public override string ItemFullDescription => $"<style=cIsDamage>Killing an enemy</style> causes surrounding enemies to be <style=cIsUtility>slowed</style> by 50% for {SlowDuration} <style=cStack>[+ {SlowDuration / 2f} per stack]</style> seconds" + $"\nIn addition, enemies have a {BlastChance}% chance of <style=cIsDamage>exploding in ice</style>, dealing <style=cIsDamage>{BlastDamageMult * 100f}% </style> <style=cStack>[+ {BlastDamageStack * 100f} / stack]</style> TOTAL damage and <style=cIsUtility>freezing</style> surrounding enemies."; public override string ItemLore => "i scream, you scream, we all scream, help we're dying"; public override ItemTier Tier => (ItemTier)1; public override ItemTag[] ItemTags { get; } public override bool CanRemove { get; } public override string ItemModelPath => "Assets/ItemTests/Models/Prefabs/Items/Nitrogen.prefab"; public override string ItemIconPath => "Assets/ItemTests/Textures/Icons/Items/NitrogenIcon.png"; public override void CreateConfig(ConfigFile config) { } public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_003b: 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) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = ItemBase.ItemBodyModelPrefab, childName = "Chest", localPos = new Vector3(0f, 0f, 0f), localAngles = new Vector3(0f, 0f, 0f), localScale = new Vector3(1f, 1f, 1f) } }); } public override void Hooks() { GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal; } public override void Init(ConfigFile config) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) CreateConfig(config); CreateLang(); SlowParticlePrefab = Main.Assets.LoadAsset<GameObject>("Assets/ItemTests/Models/Prefabs/VFX/nitrogenPoof.prefab"); SlowParticlePrefab.AddComponent<EffectComponent>(); SlowEffect = new EffectData { scale = SlowRadius * 0.75f }; SlowParticlePrefab.GetComponent<EffectComponent>().applyScale = true; SlowParticlePrefab.AddComponent<VFXAttributes>(); SlowParticlePrefab.GetComponent<VFXAttributes>().vfxPriority = (VFXPriority)0; SlowParticlePrefab.GetComponent<VFXAttributes>().vfxIntensity = (VFXIntensity)0; ContentAddition.AddEffect(SlowParticlePrefab); CreateItem(iceDeathItem); Hooks(); } private void GlobalEventManager_onCharacterDeathGlobal(DamageReport report) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Invalid comparison between Unknown and I4 //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)report.attacker) && Object.op_Implicit((Object)(object)report.attackerBody) && (Object.op_Implicit((Object)(object)report.attackerBody.inventory) || (int)DamageTypeCombo.op_Implicit(report.damageInfo.damageType) == 256)) { CharacterBody victimBody = report.victimBody; CharacterBody attackerBody = report.attackerBody; float damageDealt = report.damageDealt; int itemCount = attackerBody.inventory.GetItemCount(iceDeathItem.itemIndex); if (itemCount > 0 && Util.CheckRoll(BlastChance, attackerBody.master)) { IceBlast(victimBody, attackerBody, itemCount, damageDealt); } else if (itemCount > 0) { SlowOnDeath(victimBody, attackerBody, itemCount, report); } } } private void SlowOnDeath(CharacterBody victimBody, CharacterBody attackerBody, int itemCount, DamageReport report) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0022: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //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_00ec: Unknown result type (might be due to invalid IL or missing references) float radius = victimBody.radius + SlowRadius; Vector3 corePosition = victimBody.corePosition; SphereSearch val = new SphereSearch(); List<HurtBox> list = new List<HurtBox>(); val.origin = corePosition; val.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask; val.radius = radius; val.RefreshCandidates(); val.FilterCandidatesByHurtBoxTeam(TeamMask.GetUnprotectedTeams(attackerBody.teamComponent.teamIndex)); val.FilterCandidatesByDistinctHurtBoxEntities(); val.OrderCandidatesByDistance(); val.GetHurtBoxes(list); val.ClearCandidates(); for (int i = 0; i < list.Count; i++) { HurtBox val2 = list[i]; if (Object.op_Implicit((Object)(object)val2.healthComponent)) { val2.healthComponent.body.AddTimedBuff(Buffs.Slow50, SlowDuration / 2f + SlowDuration / 2f * (float)itemCount); } } SlowEffect.origin = corePosition; EffectManager.SpawnEffect(SlowParticlePrefab, SlowEffect, true); } private void IceBlast(CharacterBody victimBody, CharacterBody attackerBody, int itemCount, float damage) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_00ca: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) Vector3 corePosition = Util.GetCorePosition(((Component)victimBody).gameObject); GameObject val = Object.Instantiate<GameObject>(Resources.Load<GameObject>("Prefabs/NetworkedObjects/GenericDelayBlast"), corePosition, Quaternion.identity); float num = BlastRadius + victimBody.radius; val.transform.localScale = new Vector3(num, num, num); float num2 = 2.5f * (float)itemCount; float baseDamage = Util.OnHitProcDamage(damage, attackerBody.damage, num2); DelayBlast component = val.GetComponent<DelayBlast>(); component.position = corePosition; component.baseDamage = baseDamage; component.baseForce = 2300f; component.attacker = ((Component)attackerBody).gameObject; component.radius = num; component.crit = Util.CheckRoll(victimBody.crit, victimBody.master); component.procCoefficient = 0.75f; component.maxTimer = 0.2f; component.falloffModel = (FalloffModel)0; component.explosionEffect = Resources.Load<GameObject>("Prefabs/Effects/ImpactEffects/AffixWhiteExplosion"); component.damageType = DamageTypeCombo.op_Implicit((DamageType)256); val.GetComponent<TeamFilter>().teamIndex = attackerBody.teamComponent.teamIndex; } public static void Update() { //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) //IL_003b: 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_004b: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)284)) { Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(iceDeathItem.itemIndex), transform.position, transform.forward * 20f); } } public Item02() { ItemTag[] array = new ItemTag[3]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); ItemTags = (ItemTag[])(object)array; CanRemove = true; base..ctor(); } } internal class Item03 : ItemBase { public static ItemDef KillHeal = ScriptableObject.CreateInstance<ItemDef>(); private readonly float HealPercentage = 10f; private readonly float HealStackPercentage = 10f; public override string ItemName => "Champion Fungus"; public override string ItemLangTokenName => "CHUNGUS"; public override string ItemPickupDesc => "Killing an enemy heals you for a percentage of the damage done."; public override string ItemFullDescription => $"<style=cIsDamage>Killing an enemy</style> heals you for <style=cIsHealing>{HealPercentage}%</style>" + $" <style=cStack>[+{HealStackPercentage}% per stack]</style> of the health they had left."; public override string ItemLore => "a big cartoon mushroom"; public override ItemTier Tier => (ItemTier)1; public override ItemTag[] ItemTags { get; } = (ItemTag[])(object)new ItemTag[1] { (ItemTag)2 }; public override bool CanRemove { get; } = true; public override string ItemModelPath => "Assets/ItemTests/Models/Prefabs/Items/Chungus.prefab"; public override string ItemIconPath => "Assets/ItemTests/Textures/Icons/Items/ChungusIcon.png"; public override void CreateConfig(ConfigFile config) { } public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_003b: 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) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = ItemBase.ItemBodyModelPrefab, childName = "Chest", localPos = new Vector3(0f, 0f, 0f), localAngles = new Vector3(0f, 0f, 0f), localScale = new Vector3(1f, 1f, 1f) } }); } public override void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown HealthComponent.TakeDamageProcess += new hook_TakeDamageProcess(HealthComponent_takeDamageProcess); } public override void Init(ConfigFile config) { CreateConfig(config); CreateLang(); CreateItem(KillHeal); Hooks(); } private void HealthComponent_takeDamageProcess(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo) { //IL_00fa: 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_012d: Unknown result type (might be due to invalid IL or missing references) int num = 0; float num2 = 0f; bool flag = false; if (damageInfo != null && (Object)(object)self != (Object)null && (Object)(object)damageInfo.attacker != (Object)null && (Object)(object)damageInfo.attacker.GetComponent<CharacterBody>() != (Object)null && (Object)(object)damageInfo.attacker.GetComponent<CharacterBody>().inventory != (Object)null) { num = damageInfo.attacker.GetComponent<CharacterBody>().inventory.GetItemCount(KillHeal); if (num > 0) { CharacterBody val = (Object.op_Implicit((Object)(object)self) ? ((Component)self).GetComponent<CharacterBody>() : null); num2 = val.healthComponent.combinedHealth; flag = true; } } orig.Invoke(self, damageInfo); if (((Component)self).GetComponent<CharacterBody>().healthComponent.combinedHealth <= 0f && flag && damageInfo.attacker.GetComponent<CharacterBody>().inventory.GetItemCount(KillHeal) > 0) { ProcChainMask procChainMask = damageInfo.procChainMask; float num3 = num2 / 100f * (HealPercentage + HealStackPercentage * (float)num); damageInfo.attacker.GetComponent<CharacterBody>().healthComponent.Heal(num3, procChainMask, true); flag = false; } } public static void Update() { //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) //IL_003b: 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_004b: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)285)) { Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(KillHeal.itemIndex), transform.position, transform.forward * 20f); } } } internal class Item04 : ItemBase { public static ItemDef DeathItem = ScriptableObject.CreateInstance<ItemDef>(); public float CritChance = 50f; public float CritStack = 10f; public float MoveSpeed = 0.5f; public float AttackSpeed = 0.5f; public float HealthPercentage = 50f; public float BuffDuration = 6f; public float DurationStack = 3f; public override string ItemName => "Deaths Doorhandle"; public override string ItemLangTokenName => "DOORHANDLE"; public override string ItemPickupDesc => "Falling below half health increases movement speed, attack speed and chance to crit."; public override string ItemFullDescription => $"<style=cDeath>Falling below (or taking damage while under) {HealthPercentage}% health</style> will <style=cIsUtility>increase your movement speed and " + $"attack speed by {MoveSpeed * 100f}%</style> and <style=cIsDamage> chance to crit by {CritChance}%</style> " + $"<style=cStack>[+{CritStack}% per stack]</style> for {BuffDuration} seconds <style=cStack>[+{DurationStack} per stack.]</style>"; public override string ItemLore => "you are the one who knocks"; public override ItemTier Tier => (ItemTier)1; public override ItemTag[] ItemTags { get; } = (ItemTag[])(object)new ItemTag[2] { (ItemTag)1, (ItemTag)3 }; public override bool CanRemove { get; } = true; public override string ItemModelPath => "Assets/ItemTests/Models/Prefabs/Items/Doorhandle.prefab"; public override string ItemIconPath => "Assets/ItemTests/Textures/Icons/Items/DoorhandleIcon.png"; public static BuffDef DeathItemBuff { get; private set; } public override void CreateConfig(ConfigFile config) { } public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_003b: 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) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = ItemBase.ItemBodyModelPrefab, childName = "Chest", localPos = new Vector3(0f, 0f, 0f), localAngles = new Vector3(0f, 0f, 0f), localScale = new Vector3(1f, 1f, 1f) } }); } public override void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown HealthComponent.TakeDamageProcess += new hook_TakeDamageProcess(HealthComponent_TakeDamageProcess); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalcStats_GetStatCoefficients); } public static void SetupAttributes() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) DeathItemBuff = ScriptableObject.CreateInstance<BuffDef>(); DeathItemBuff.buffColor = Color.red; DeathItemBuff.canStack = false; DeathItemBuff.isDebuff = false; ((Object)DeathItemBuff).name = "DeathItemBuff"; DeathItemBuff.iconSprite = Resources.Load<Sprite>("Textures/MiscIcons/texMysteryIcon"); ContentAddition.AddBuffDef(DeathItemBuff); } public override void Init(ConfigFile config) { CreateConfig(config); CreateLang(); SetupAttributes(); CreateItem(DeathItem); Hooks(); } private void RecalcStats_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { int itemCount = sender.inventory.GetItemCount(DeathItem); if (sender.HasBuff(DeathItemBuff) && itemCount > 0) { args.critAdd += CritChance + CritStack * (float)(itemCount - 1); args.moveSpeedMultAdd += MoveSpeed; args.attackSpeedMultAdd += AttackSpeed; } } } private void HealthComponent_TakeDamageProcess(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo) { orig.Invoke(self, damageInfo); if (Object.op_Implicit((Object)(object)((Component)self).GetComponent<CharacterBody>().inventory)) { CharacterBody component = ((Component)self).GetComponent<CharacterBody>(); float num = ((Component)component).GetComponent<CharacterBody>().inventory.GetItemCount(DeathItem); if (component.inventory.GetItemCount(DeathItem) > 0 && component.healthComponent.health <= component.healthComponent.fullHealth / 100f * HealthPercentage) { component.AddTimedBuff(DeathItemBuff, BuffDuration + DurationStack * (num - 1f)); } } } public static void Update() { //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) //IL_003b: 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_004b: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)286)) { Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(DeathItem.itemIndex), transform.position, transform.forward * 20f); } } } } namespace ZeebsZitems.Custom_Classes.Equipment { internal class Equipment01 : EquipmentBase { public static EquipmentDef EquipItemDef = ScriptableObject.CreateInstance<EquipmentDef>(); private string FistModelPath = "prefabs/projectiles/TitanPreFistProjectile"; public GameObject FistProjectilePrefab; public float FistForce = 6000f; public float FistDamageMult = 20f; public float FistDelay = 0.5f; public override string EquipmentName => "Stone Gauntlet"; public override string EquipmentLangTokenName => "STONEGAUNTLET"; public override string EquipmentPickupDesc => "Unleash titanic wrath"; public override string EquipmentFullDescription => $"Summon 8 titan fists in a circle around you, each dealing <style=cIsDamage>{FistDamageMult * 100f}%</style> damage"; public override string EquipmentLore => "catch these hands"; public override string EquipmentModelPath => "Assets/ItemTests/Models/Prefabs/Equipment/StoneGauntlet.prefab"; public override string EquipmentIconPath => "Assets/ItemTests/Textures/Icons/Equipment/StoneGauntletIcon.png"; public override float Cooldown => 60f; public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_003b: 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) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown EquipmentBase.EquipmentBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(EquipmentModelPath); ItemDisplay val = EquipmentBase.EquipmentBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(EquipmentBase.EquipmentBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = EquipmentBase.EquipmentBodyModelPrefab, childName = "Chest", localPos = new Vector3(0f, 0f, 0f), localAngles = new Vector3(0f, 0f, 0f), localScale = new Vector3(1f, 1f, 1f) } }); } public override void Init(ConfigFile config) { CreateConfig(config); CreateLang(); FistProjectilePrefab = Resources.Load<GameObject>(FistModelPath); CreateEquipment(EquipItemDef); Hooks(); } protected override bool ActivateEquipment(EquipmentSlot slot) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) CharacterBody characterBody = slot.characterBody; Transform transform = characterBody.transform; FistPunch(transform.position, FistDelay, characterBody); return true; } private void FistPunch(Vector3 position, float delay, CharacterBody owner) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) float num = owner.radius / 2f + 8f; FireProjectileInfo val = default(FireProjectileInfo); val.projectilePrefab = FistProjectilePrefab; val.rotation = Quaternion.identity; val.owner = ((Component)owner).gameObject; val.damage = owner.damage * FistDamageMult; val.force = FistForce; val.crit = owner.RollCrit(); ((FireProjectileInfo)(ref val)).fuseOverride = delay; val.procChainMask = default(ProcChainMask); float num2 = 11f; int num3 = 8; float num4 = 360f; Vector3 val2 = owner.inputBank.aimDirection; Quaternion val3 = Quaternion.AngleAxis(num4 / (float)num3, Vector3.up); Ray val5 = default(Ray); RaycastHit val6 = default(RaycastHit); for (int i = 0; i < num3; i++) { val2 = val3 * val2; Vector3 val4 = position + val2 * num; val4.y += num2 / 2f; bool flag = false; ((Ray)(ref val5))..ctor(val4, Vector3.down); if (Physics.Raycast(val5, ref val6, num2 + 3f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask))) { flag = true; } if (!flag && Physics.Raycast(val5, ref val6, num2 + 3f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.debris)).mask))) { flag = true; } if (flag) { Vector3 point = ((RaycastHit)(ref val6)).point; val.position = point; ProjectileManager.instance.FireProjectile(val); } } } public static void Update() { //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) //IL_003b: 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_004b: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)287)) { Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(EquipItemDef.equipmentIndex), transform.position, transform.forward * 20f); } } } } namespace ZeebsZitems.Base_Classes { public abstract class EquipmentBase { public static GameObject EquipmentBodyModelPrefab; public static EquipmentDef EquipmentDef; public abstract string EquipmentName { get; } public abstract string EquipmentLangTokenName { get; } public abstract string EquipmentPickupDesc { get; } public abstract string EquipmentFullDescription { get; } public abstract string EquipmentLore { get; } public abstract string EquipmentModelPath { get; } public abstract string EquipmentIconPath { get; } public virtual bool AppearsInSinglePlayer { get; } = true; public virtual bool AppearsInMultiPlayer { get; } = true; public virtual bool CanDrop { get; } = true; public virtual float Cooldown { get; } = 60f; public virtual bool EnigmaCompatible { get; } = true; public virtual bool IsBoss { get; } = false; public virtual bool IsLunar { get; } = false; public abstract ItemDisplayRuleDict CreateItemDisplayRules(); public abstract void Init(ConfigFile config); protected virtual void CreateConfig(ConfigFile config) { } protected virtual void CreateLang() { LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_NAME", EquipmentName); LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_PICKUP", EquipmentPickupDesc); LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_DESCRIPTION", EquipmentFullDescription); LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_LORE", EquipmentLore); } protected void CreateEquipment(EquipmentDef equipDef) { //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown ((Object)equipDef).name = "EQUIPMENT_" + EquipmentLangTokenName; equipDef.nameToken = "EQUIPMENT_" + EquipmentLangTokenName + "_NAME"; equipDef.pickupToken = "EQUIPMENT_" + EquipmentLangTokenName + "_PICKUP"; equipDef.descriptionToken = "EQUIPMENT_" + EquipmentLangTokenName + "_DESCRIPTION"; equipDef.loreToken = "EQUIPMENT_" + EquipmentLangTokenName + "_LORE"; if (EquipmentModelPath == "") { equipDef.pickupModelPrefab = Resources.Load<GameObject>("Prefabs/PickupModels/PickupMystery"); } else { equipDef.pickupModelPrefab = Main.Assets.LoadAsset<GameObject>(EquipmentModelPath); } if (EquipmentIconPath == "") { equipDef.pickupIconSprite = Resources.Load<Sprite>("Textures/MiscIcons/texMysteryIcon"); } else { equipDef.pickupIconSprite = Main.Assets.LoadAsset<Sprite>(EquipmentIconPath); } equipDef.appearsInSinglePlayer = AppearsInSinglePlayer; equipDef.appearsInMultiPlayer = AppearsInMultiPlayer; equipDef.canDrop = CanDrop; equipDef.cooldown = Cooldown; equipDef.enigmaCompatible = EnigmaCompatible; equipDef.isBoss = IsBoss; equipDef.isLunar = IsLunar; ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null); EquipmentDef = equipDef; ItemAPI.Add(new CustomEquipment(equipDef, val)); EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(PerformEquipmentAction); } private bool PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef) { if ((Object)(object)equipmentDef == (Object)(object)EquipmentDef) { return ActivateEquipment(self); } return orig.Invoke(self, equipmentDef); } protected abstract bool ActivateEquipment(EquipmentSlot slot); public virtual void Hooks() { } } public abstract class ItemBase { public static GameObject ItemBodyModelPrefab; public static ItemDef itemDef; public abstract string ItemName { get; } public abstract string ItemLangTokenName { get; } public abstract string ItemPickupDesc { get; } public abstract string ItemFullDescription { get; } public abstract string ItemLore { get; } public abstract ItemTier Tier { get; } public virtual ItemTag[] ItemTags { get; } = (ItemTag[])(object)new ItemTag[0]; public abstract string ItemModelPath { get; } public abstract string ItemIconPath { get; } public virtual bool CanRemove { get; } public virtual bool Hidden { get; } public virtual bool HasUnlockable { get; } public virtual UnlockableDef ItemPreReq { get; } public abstract void Init(ConfigFile config); public abstract void CreateConfig(ConfigFile config); protected void CreateLang() { LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_NAME", ItemName); LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_PICKUP", ItemPickupDesc); LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_DESCRIPTION", ItemFullDescription); LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_LORE", ItemLore); } public abstract ItemDisplayRuleDict CreateItemDisplayRules(); protected void CreateItem(ItemDef itemDef) { //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown ((Object)itemDef).name = "ITEM_" + ItemLangTokenName; itemDef.nameToken = "ITEM_" + ItemLangTokenName + "_NAME"; itemDef.pickupToken = "ITEM_" + ItemLangTokenName + "_PICKUP"; itemDef.descriptionToken = "ITEM_" + ItemLangTokenName + "_DESCRIPTION"; itemDef.loreToken = "ITEM_" + ItemLangTokenName + "_LORE"; if (ItemModelPath == "") { itemDef.pickupModelPrefab = Resources.Load<GameObject>("Prefabs/PickupModels/PickupMystery"); } else { itemDef.pickupModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); } if (ItemIconPath == "") { itemDef.pickupIconSprite = Resources.Load<Sprite>("Textures/MiscIcons/texMysteryIcon"); } else { itemDef.pickupIconSprite = Main.Assets.LoadAsset<Sprite>(ItemIconPath); } itemDef.hidden = Hidden; itemDef.tags = ItemTags; itemDef.canRemove = CanRemove; itemDef.deprecatedTier = Tier; itemDef.unlockableDef = ItemPreReq; ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null); ItemAPI.Add(new CustomItem(itemDef, val)); } public abstract void Hooks(); public int GetCount(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory)) { return 0; } return body.inventory.GetItemCount(itemDef); } public int GetCount(CharacterMaster master) { if (!Object.op_Implicit((Object)(object)master) || !Object.op_Implicit((Object)(object)master.inventory)) { return 0; } return master.inventory.GetItemCount(itemDef); } } }