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 BlightedWorldHeart v1.0.0
BlightedWorldHeart/plugins/BlightedHeart.dll
Decompiled 12 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: IgnoresAccessChecksTo("assembly_guiutils")] [assembly: IgnoresAccessChecksTo("assembly_utils")] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: AssemblyCompany("BlightedHeart")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A Valheim mod that adds the Blighted World Heart boss.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BlightedHeart")] [assembly: AssemblyTitle("BlightedHeart")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BlightedHeart { [HarmonyPatch(typeof(Character), "OnDeath")] public static class BlightedHeartLoot { public static void Prefix(Character __instance) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0045: 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) BlightedWorldHeartAI component = ((Component)__instance).GetComponent<BlightedWorldHeartAI>(); if ((Object)(object)component != (Object)null && __instance.IsOwner()) { Logger.LogInfo((object)"Blighted World Heart defeated! Dropping loot..."); DropLoot(component.CurrentBiome, ((Component)__instance).transform.position + Vector3.up * 2f); } } private static void DropLoot(Biome biome, Vector3 dropPosition) { //IL_0006: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) if (!BlightedConfigManager.BiomeConfigs.TryGetValue(biome, out var value)) { return; } float value2 = value.LootScaleFactor.Value; List<string> list = new List<string>(); if (BlightedItemsManager.BiomeWeaponDrops.TryGetValue(biome, out var value3)) { list.AddRange(value3); } if (BlightedItemsManager.BiomeArmorDrops.TryGetValue(biome, out var value4)) { list.AddRange(value4); } if (list.Count == 0) { return; } int num = Mathf.CeilToInt(2f * value2); for (int i = 0; i < num; i++) { string text = list[Random.Range(0, list.Count)]; GameObject prefab = PrefabManager.Instance.GetPrefab(text); if ((Object)(object)prefab != (Object)null) { Vector3 val = dropPosition + Random.insideUnitSphere * 2f; Object.Instantiate<GameObject>(prefab, val, Quaternion.identity); } } } } [HarmonyPatch(typeof(OfferingBowl))] public static class BlightedHeartSpawning { [CompilerGenerated] private sealed class <SpawnBlightedHeartCoroutine>d__3 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public OfferingBowl bowl; private GameObject <heartPrefab>5__1; private Vector3 <spawnPos>5__2; private float <solidHeight>5__3; private GameObject <spawnedBoss>5__4; private Biome <currentBiome>5__5; private BlightedWorldHeartAI <ai>5__6; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SpawnBlightedHeartCoroutine>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <heartPrefab>5__1 = null; <spawnedBoss>5__4 = null; <ai>5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_0062: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <heartPrefab>5__1 = PrefabManager.Instance.GetPrefab("BlightedWorldHeart"); if ((Object)(object)<heartPrefab>5__1 == (Object)null) { Logger.LogError((object)"Failed to get BlightedWorldHeart prefab for spawning."); return false; } <spawnPos>5__2 = ((Component)bowl).transform.position + Vector3.up * 1f; if (ZoneSystem.instance.GetSolidHeight(<spawnPos>5__2, ref <solidHeight>5__3, 1000)) { <spawnPos>5__2.y = <solidHeight>5__3; } if (bowl.m_spawnBossStartEffects != null) { bowl.m_spawnBossStartEffects.Create(<spawnPos>5__2, Quaternion.identity, (Transform)null, 1f, -1); } <>2__current = (object)new WaitForSeconds((bowl.m_spawnBossDelay > 0f) ? bowl.m_spawnBossDelay : 8f); <>1__state = 1; return true; case 1: <>1__state = -1; <spawnedBoss>5__4 = Object.Instantiate<GameObject>(<heartPrefab>5__1, <spawnPos>5__2, Quaternion.identity); <currentBiome>5__5 = Heightmap.FindBiome(<spawnPos>5__2); <ai>5__6 = <spawnedBoss>5__4.GetComponent<BlightedWorldHeartAI>(); if ((Object)(object)<ai>5__6 != (Object)null) { <ai>5__6.Initialize(<currentBiome>5__5); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPatch("Interact")] [HarmonyPrefix] public static bool InteractPrefix(OfferingBowl __instance, Humanoid user, bool hold, bool alt) { if (hold) { return true; } if ((Object)(object)__instance.m_bossPrefab == (Object)null) { return true; } return true; } [HarmonyPatch("UseItem")] [HarmonyPrefix] public static bool UseItemPrefix(OfferingBowl __instance, Humanoid user, ItemData item, ref bool __result) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0031: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance.m_bossPrefab == (Object)null) { return true; } Biome key = Heightmap.FindBiome(((Component)__instance).transform.position); if (!BlightedConfigManager.BiomeConfigs.TryGetValue(key, out var value)) { return true; } string value2 = value.AltarSummonItem.Value; int value3 = value.AltarSummonAmount.Value; if (((Object)item.m_dropPrefab).name == value2) { if (item.m_stack < value3) { ((Character)user).Message((MessageType)2, $"Need {value3} {item.m_shared.m_name}", 0, (Sprite)null); __result = true; return false; } user.GetInventory().RemoveItem(item, value3); ((Character)user).Message((MessageType)2, "The Blighted World Heart awakens!", 0, (Sprite)null); SpawnBlightedHeart(__instance); __result = true; return false; } return true; } private static void SpawnBlightedHeart(OfferingBowl bowl) { ((MonoBehaviour)bowl).StartCoroutine(SpawnBlightedHeartCoroutine(bowl)); } [IteratorStateMachine(typeof(<SpawnBlightedHeartCoroutine>d__3))] private static IEnumerator SpawnBlightedHeartCoroutine(OfferingBowl bowl) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SpawnBlightedHeartCoroutine>d__3(0) { bowl = bowl }; } } public static class BlightedItemsManager { public static Dictionary<Biome, List<string>> BiomeWeaponDrops = new Dictionary<Biome, List<string>>(); public static Dictionary<Biome, List<string>> BiomeArmorDrops = new Dictionary<Biome, List<string>>(); public static void Setup() { PrefabManager.OnVanillaPrefabsAvailable -= Setup; Logger.LogInfo((object)"Setting up Blighted custom items..."); CreateBiomeItems((Biome)1, new string[4] { "Club", "SpearFlint", "Bow", "ShieldWood" }, new string[4] { "ArmorLeatherChest", "ArmorLeatherLegs", "HelmetLeather", "CapeDeerHide" }); CreateBiomeItems((Biome)8, new string[4] { "SwordBronze", "MaceBronze", "AxeBronze", "ShieldBronzeBuckler" }, new string[4] { "ArmorBronzeChest", "ArmorBronzeLegs", "HelmetBronze", "CapeTrollHide" }); CreateBiomeItems((Biome)2, new string[4] { "SwordIron", "MaceIron", "Battleaxe", "ShieldBanded" }, new string[3] { "ArmorIronChest", "ArmorIronLegs", "HelmetIron" }); CreateBiomeItems((Biome)4, new string[3] { "SwordSilver", "BowDraugrFang", "ShieldSilver" }, new string[4] { "ArmorWolfChest", "ArmorWolfLegs", "HelmetDrake", "CapeWolf" }); CreateBiomeItems((Biome)16, new string[4] { "SwordBlackmetal", "MaceNeedle", "AtgeirBlackmetal", "ShieldBlackmetal" }, new string[4] { "ArmorPaddedCuirass", "ArmorPaddedGreaves", "HelmetPadded", "CapeLox" }); CreateBiomeItems((Biome)512, new string[3] { "SwordMistwalker", "BowSpineSnap", "ShieldCarapace" }, new string[4] { "ArmorCarapaceChest", "ArmorCarapaceLegs", "HelmetCarapace", "CapeFeather" }); CreateBiomeItems((Biome)32, new string[3] { "SwordFlametal", "MaceFlametal", "ShieldFlametal" }, new string[4] { "ArmorFlametalChest", "ArmorFlametalLegs", "HelmetFlametal", "CapeAsh" }); CreateBiomeItems((Biome)64, new string[3] { "SwordSilver", "BowDraugrFang", "ShieldSilver" }, new string[4] { "ArmorWolfChest", "ArmorWolfLegs", "HelmetDrake", "CapeWolf" }); Logger.LogInfo((object)"Blighted custom items created."); } private static void CreateBiomeItems(Biome biome, string[] weapons, string[] armors) { //IL_0017: 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_004c: 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_00c8: 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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) float scale = 1f; if (BlightedConfigManager.BiomeConfigs.TryGetValue(biome, out var value)) { scale = value.LootScaleFactor.Value; } BiomeWeaponDrops[biome] = new List<string>(); BiomeArmorDrops[biome] = new List<string>(); foreach (string basePrefab in weapons) { string text = CreateWeaponVariant(biome, basePrefab, "Serpent", "of the Serpent", "Attacks deal massive additional poison damage.", scale, delegate(SharedData shared) { shared.m_damages.m_poison += 30f * scale; }); if (text != null) { BiomeWeaponDrops[biome].Add(text); } string text2 = CreateWeaponVariant(biome, basePrefab, "Wraith", "of the Wraith", "Attacks deal massive additional spirit damage.", scale, delegate(SharedData shared) { shared.m_damages.m_spirit += 30f * scale; }); if (text2 != null) { BiomeWeaponDrops[biome].Add(text2); } string text3 = CreateWeaponVariant(biome, basePrefab, "Blight", "of the Blight", "Attacks deal increased physical, poison, and spirit damage.", scale, delegate(SharedData shared) { shared.m_damages.m_poison += 20f * scale; shared.m_damages.m_spirit += 20f * scale; shared.m_damages.m_slash *= 1.1f * scale; shared.m_damages.m_blunt *= 1.1f * scale; shared.m_damages.m_pierce *= 1.1f * scale; }); if (text3 != null) { BiomeWeaponDrops[biome].Add(text3); } } foreach (string basePrefab2 in armors) { string text4 = CreateArmorVariant(biome, basePrefab2, "Bastion", "of the Bastion", "Massively increased armor rating and durability.", scale, delegate(SharedData shared) { shared.m_armor *= 1.5f * scale; shared.m_maxDurability *= 2f * scale; }); if (text4 != null) { BiomeArmorDrops[biome].Add(text4); } string text5 = CreateArmorVariant(biome, basePrefab2, "Serpent", "of the Serpent", "Grants resistance to Poison.", scale, delegate(SharedData shared) { //IL_0021: 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_0036: 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) if (shared.m_damageModifiers == null) { shared.m_damageModifiers = new List<DamageModPair>(); } shared.m_damageModifiers.Add(new DamageModPair { m_type = (DamageType)256, m_modifier = (DamageModifier)1 }); }); if (text5 != null) { BiomeArmorDrops[biome].Add(text5); } string text6 = CreateArmorVariant(biome, basePrefab2, "Wraith", "of the Wraith", "Grants resistance to Spirit damage.", scale, delegate(SharedData shared) { //IL_0021: 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_0036: 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) if (shared.m_damageModifiers == null) { shared.m_damageModifiers = new List<DamageModPair>(); } shared.m_damageModifiers.Add(new DamageModPair { m_type = (DamageType)512, m_modifier = (DamageModifier)1 }); }); if (text6 != null) { BiomeArmorDrops[biome].Add(text6); } string text7 = CreateArmorVariant(biome, basePrefab2, "Blight", "of the Blight", "Increased armor and resistance to Poison and Spirit.", scale, delegate(SharedData shared) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) shared.m_armor *= 1.25f * scale; if (shared.m_damageModifiers == null) { shared.m_damageModifiers = new List<DamageModPair>(); } shared.m_damageModifiers.Add(new DamageModPair { m_type = (DamageType)256, m_modifier = (DamageModifier)1 }); shared.m_damageModifiers.Add(new DamageModPair { m_type = (DamageType)512, m_modifier = (DamageModifier)1 }); }); if (text7 != null) { BiomeArmorDrops[biome].Add(text7); } } } private static string CreateWeaponVariant(Biome biome, string basePrefab, string suffixId, string suffixName, string effectDescription, float scale, Action<SharedData> modify) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown string text = $"Blighted{biome}_{basePrefab}_{suffixId}"; GameObject prefab = PrefabManager.Instance.GetPrefab(basePrefab); if ((Object)(object)prefab == (Object)null) { return null; } CustomItem val = new CustomItem(text, basePrefab); SharedData shared = val.ItemDrop.m_itemData.m_shared; shared.m_name = "Blighted " + shared.m_name + " " + suffixName; shared.m_description = "<color=yellow>" + effectDescription + "</color>\n" + shared.m_description; shared.m_damages.m_blunt *= 1f + 0.2f * scale; shared.m_damages.m_slash *= 1f + 0.2f * scale; shared.m_damages.m_pierce *= 1f + 0.2f * scale; modify?.Invoke(shared); TintItemPrefab(val); ItemManager.Instance.AddItem(val); return text; } private static string CreateArmorVariant(Biome biome, string basePrefab, string suffixId, string suffixName, string effectDescription, float scale, Action<SharedData> modify) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown string text = $"Blighted{biome}_{basePrefab}_{suffixId}"; GameObject prefab = PrefabManager.Instance.GetPrefab(basePrefab); if ((Object)(object)prefab == (Object)null) { return null; } CustomItem val = new CustomItem(text, basePrefab); SharedData shared = val.ItemDrop.m_itemData.m_shared; shared.m_name = "Blighted " + shared.m_name + " " + suffixName; shared.m_description = "<color=yellow>" + effectDescription + "</color>\n" + shared.m_description; shared.m_armor *= 1f + 0.2f * scale; modify?.Invoke(shared); TintItemPrefab(val); ItemManager.Instance.AddItem(val); return text; } private static void TintItemPrefab(CustomItem customItem) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) Color blightedTint = default(Color); ((Color)(ref blightedTint))..ctor(0.1f, 0.4f, 0.1f, 1f); Renderer[] componentsInChildren = customItem.ItemPrefab.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { Material[] materials = val.materials; foreach (Material mat in materials) { TintMaterial(mat, blightedTint); } } SharedData shared = customItem.ItemDrop.m_itemData.m_shared; if (shared != null && (Object)(object)shared.m_armorMaterial != (Object)null) { shared.m_armorMaterial = new Material(shared.m_armorMaterial); TintMaterial(shared.m_armorMaterial, blightedTint); } } private static void TintMaterial(Material mat, Color blightedTint) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)mat == (Object)null)) { if (mat.HasProperty("_Color")) { mat.color = Color.Lerp(mat.color, blightedTint, 0.8f); } if (mat.HasProperty("_EmissionColor") && mat.IsKeywordEnabled("_EMISSION")) { mat.SetColor("_EmissionColor", mat.GetColor("_EmissionColor") * blightedTint); } } } } [HarmonyPatch] public static class BlightedMechanicsPatches { [HarmonyPatch(typeof(Character), "Damage")] [HarmonyPrefix] public static bool DamagePrefix(Character __instance, HitData hit) { if ((Object)(object)((Component)__instance).GetComponent<BlightedWorldHeartAI>() != (Object)null && hit != null && ((Object)(object)hit.GetAttacker() == (Object)null || !hit.GetAttacker().IsPlayer())) { return false; } if (hit == null || (Object)(object)hit.GetAttacker() == (Object)null || !hit.GetAttacker().IsPlayer()) { return true; } return true; } } public class BlightedUIManager : MonoBehaviour { private static BlightedUIManager _instance; private GameObject _uiRoot; private BlightedWorldHeartAI _activeHeart; private Character _trackedSubBoss1; private Character _trackedSubBoss2; private Vector3 _heartPosition; private RectTransform _mainBossBar; private Image _mainBossFill; private Text _mainBossName; private RectTransform _subBoss1Bar; private Image _subBoss1Fill; private Text _subBoss1Name; private RectTransform _subBoss2Bar; private Image _subBoss2Fill; private Text _subBoss2Name; private Font _valheimFont; public static BlightedUIManager Instance => _instance; public void Awake() { _instance = this; } public void RegisterHeart(BlightedWorldHeartAI heart) { //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) _activeHeart = heart; if ((Object)(object)_activeHeart != (Object)null) { _heartPosition = ((Component)_activeHeart).transform.position; } if ((Object)(object)_uiRoot == (Object)null && (Object)(object)Hud.instance != (Object)null) { CreateUI(); } } public void UnregisterHeart(BlightedWorldHeartAI heart) { if ((Object)(object)_activeHeart == (Object)(object)heart) { _activeHeart = null; } } private void CreateUI() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Hud.instance == (Object)null) && !((Object)(object)Hud.instance.m_rootObject == (Object)null)) { Text componentInChildren = Hud.instance.m_rootObject.GetComponentInChildren<Text>(true); if ((Object)(object)componentInChildren != (Object)null) { _valheimFont = componentInChildren.font; } _uiRoot = new GameObject("BlightedCustomBossUI"); _uiRoot.transform.SetParent(Hud.instance.m_rootObject.transform, false); RectTransform val = _uiRoot.AddComponent<RectTransform>(); val.anchorMin = new Vector2(0.5f, 1f); val.anchorMax = new Vector2(0.5f, 1f); val.pivot = new Vector2(0.5f, 1f); val.anchoredPosition = new Vector2(0f, -50f); CreateHealthBar("MainBossBar", _uiRoot.transform, new Vector2(0f, 0f), new Vector2(600f, 30f), out _mainBossBar, out _mainBossFill, out _mainBossName); CreateHealthBar("SubBoss1Bar", _uiRoot.transform, new Vector2(-200f, -50f), new Vector2(250f, 20f), out _subBoss1Bar, out _subBoss1Fill, out _subBoss1Name); CreateHealthBar("SubBoss2Bar", _uiRoot.transform, new Vector2(200f, -50f), new Vector2(250f, 20f), out _subBoss2Bar, out _subBoss2Fill, out _subBoss2Name); _uiRoot.SetActive(false); } } private void CreateHealthBar(string name, Transform parent, Vector2 anchoredPos, Vector2 size, out RectTransform rootRt, out Image fill, out Text nameText) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_002c: 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_005c: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_00a2: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Expected O, but got Unknown //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); rootRt = val.AddComponent<RectTransform>(); rootRt.anchorMin = new Vector2(0.5f, 1f); rootRt.anchorMax = new Vector2(0.5f, 1f); rootRt.pivot = new Vector2(0.5f, 1f); rootRt.anchoredPosition = anchoredPos; rootRt.sizeDelta = size; GameObject val2 = new GameObject("Trim"); val2.transform.SetParent(val.transform, false); RectTransform val3 = val2.AddComponent<RectTransform>(); val3.anchorMin = Vector2.zero; val3.anchorMax = Vector2.one; val3.offsetMin = new Vector2(-2f, -2f); val3.offsetMax = new Vector2(2f, 2f); Image val4 = val2.AddComponent<Image>(); ((Graphic)val4).color = new Color(1f, 0.84f, 0f, 1f); GameObject val5 = new GameObject("Bkg"); val5.transform.SetParent(val.transform, false); RectTransform val6 = val5.AddComponent<RectTransform>(); val6.anchorMin = Vector2.zero; val6.anchorMax = Vector2.one; val6.sizeDelta = Vector2.zero; Image val7 = val5.AddComponent<Image>(); ((Graphic)val7).color = new Color(0f, 0f, 0f, 0.9f); GameObject val8 = new GameObject("Fill"); val8.transform.SetParent(val.transform, false); RectTransform val9 = val8.AddComponent<RectTransform>(); val9.anchorMin = new Vector2(0f, 0f); val9.anchorMax = new Vector2(1f, 1f); val9.sizeDelta = Vector2.zero; val9.pivot = new Vector2(0f, 0.5f); fill = val8.AddComponent<Image>(); ((Graphic)fill).color = Color.magenta; GameObject val10 = new GameObject("NameText"); val10.transform.SetParent(val.transform, false); RectTransform val11 = val10.AddComponent<RectTransform>(); val11.anchorMin = new Vector2(0.5f, 0.5f); val11.anchorMax = new Vector2(0.5f, 0.5f); val11.pivot = new Vector2(0.5f, 0.5f); val11.anchoredPosition = new Vector2(0f, 0f); val11.sizeDelta = new Vector2(500f, 30f); nameText = val10.AddComponent<Text>(); nameText.alignment = (TextAnchor)4; ((Graphic)nameText).color = Color.white; nameText.fontSize = 20; if ((Object)(object)_valheimFont != (Object)null) { nameText.font = _valheimFont; } else { nameText.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); } Shadow val12 = val10.AddComponent<Shadow>(); val12.effectColor = Color.black; val12.effectDistance = new Vector2(1f, -1f); } public void LateUpdate() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Hud.instance == (Object)null) { return; } if ((Object)(object)_activeHeart != (Object)null && _activeHeart.m_health > 0f) { _heartPosition = ((Component)_activeHeart).transform.position; if ((Object)(object)_activeHeart.m_subBoss1 != (Object)null) { _trackedSubBoss1 = _activeHeart.m_subBoss1; } if ((Object)(object)_activeHeart.m_subBoss2 != (Object)null) { _trackedSubBoss2 = _activeHeart.m_subBoss2; } } bool flag = (Object)(object)_activeHeart != (Object)null && _activeHeart.m_health > 0f; bool flag2 = (Object)(object)_trackedSubBoss1 != (Object)null && !_trackedSubBoss1.IsDead(); bool flag3 = (Object)(object)_trackedSubBoss2 != (Object)null && !_trackedSubBoss2.IsDead(); if (!flag && !flag2 && !flag3) { if ((Object)(object)_uiRoot != (Object)null && _uiRoot.activeSelf) { _uiRoot.SetActive(false); } return; } if ((Object)(object)Player.m_localPlayer != (Object)null) { float num = Vector3.Distance(((Component)Player.m_localPlayer).transform.position, _heartPosition); if (num > 100f) { if ((Object)(object)_uiRoot != (Object)null && _uiRoot.activeSelf) { _uiRoot.SetActive(false); } return; } } if ((Object)(object)_uiRoot == (Object)null) { CreateUI(); } if (!((Object)(object)_uiRoot == (Object)null)) { if (!_uiRoot.activeSelf) { _uiRoot.SetActive(true); } UpdateBars(flag, flag2, flag3); } } private void UpdateBars(bool heartAlive, bool sb1Alive, bool sb2Alive) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) if (heartAlive) { ((Component)_mainBossBar).gameObject.SetActive(true); float health = _activeHeart.m_health; float maxHealth = _activeHeart.m_maxHealth; ((Graphic)_mainBossFill).color = GetBiomeColor(_activeHeart.CurrentBiome); _mainBossName.text = "Blighted World Heart"; UpdateFill(_mainBossFill, health, maxHealth); } else { ((Component)_mainBossBar).gameObject.SetActive(false); } float num = (heartAlive ? (-50f) : 0f); if (sb1Alive) { ((Component)_subBoss1Bar).gameObject.SetActive(true); _subBoss1Name.text = _trackedSubBoss1.m_name; ((Graphic)_subBoss1Fill).color = new Color(0.2f, 0.6f, 1f, 1f); UpdateFill(_subBoss1Fill, _trackedSubBoss1.GetHealth(), _trackedSubBoss1.GetMaxHealth()); } else { ((Component)_subBoss1Bar).gameObject.SetActive(false); } if (sb2Alive) { ((Component)_subBoss2Bar).gameObject.SetActive(true); _subBoss2Name.text = _trackedSubBoss2.m_name; ((Graphic)_subBoss2Fill).color = new Color(0.2f, 0.6f, 1f, 1f); UpdateFill(_subBoss2Fill, _trackedSubBoss2.GetHealth(), _trackedSubBoss2.GetMaxHealth()); } else { ((Component)_subBoss2Bar).gameObject.SetActive(false); } if (sb1Alive && sb2Alive) { _subBoss1Bar.sizeDelta = new Vector2(250f, 20f); _subBoss1Bar.anchoredPosition = new Vector2(-200f, num); _subBoss1Name.fontSize = 20; _subBoss2Bar.sizeDelta = new Vector2(250f, 20f); _subBoss2Bar.anchoredPosition = new Vector2(200f, num); _subBoss2Name.fontSize = 20; } else if (sb1Alive && !sb2Alive && !heartAlive) { _subBoss1Bar.sizeDelta = new Vector2(600f, 30f); _subBoss1Bar.anchoredPosition = new Vector2(0f, 0f); _subBoss1Name.fontSize = 24; } else if (!sb1Alive && sb2Alive && !heartAlive) { _subBoss2Bar.sizeDelta = new Vector2(600f, 30f); _subBoss2Bar.anchoredPosition = new Vector2(0f, 0f); _subBoss2Name.fontSize = 24; } else if (sb1Alive && !sb2Alive && heartAlive) { _subBoss1Bar.sizeDelta = new Vector2(250f, 20f); _subBoss1Bar.anchoredPosition = new Vector2(0f, num); _subBoss1Name.fontSize = 20; } else if (!sb1Alive && sb2Alive && heartAlive) { _subBoss2Bar.sizeDelta = new Vector2(250f, 20f); _subBoss2Bar.anchoredPosition = new Vector2(0f, num); _subBoss2Name.fontSize = 20; } } private void UpdateFill(Image fill, float current, float max) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01((max > 0f) ? (current / max) : 0f); ((Component)fill).transform.localScale = new Vector3(num, 1f, 1f); } private Color GetBiomeColor(Biome biome) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_000a: 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_0022: Expected I4, but got Unknown //IL_00f7: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_0051: Invalid comparison between Unknown and I4 //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_00ce: Unknown result type (might be due to invalid IL or missing references) if ((int)biome <= 16) { switch (biome - 1) { default: if ((int)biome != 8) { if ((int)biome != 16) { break; } return new Color(0.9f, 0.7f, 0.2f); } return new Color(0.5f, 0.1f, 0.8f); case 0: return new Color(0.2f, 0.8f, 0.2f); case 1: return new Color(0.4f, 0.3f, 0.1f); case 3: return new Color(0.8f, 0.9f, 1f); case 2: break; } } else { if ((int)biome == 32) { return new Color(1f, 0.2f, 0f); } if ((int)biome == 64) { return new Color(0.9f, 0.9f, 1f); } if ((int)biome == 512) { return new Color(0.3f, 0.1f, 0.5f); } } return Color.white; } } public class BlightedWorldHeartAI : MonoBehaviour, IDestructible { private static readonly int RPC_BlightedDamage = StringExtensionMethods.GetStableHashCode("RPC_BlightedHeartDamage"); public float m_health; public float m_maxHealth = 2000f; private bool m_isDead = false; public Biome CurrentBiome; private float _lastWaveTime; private float _waveInterval = 30f; private bool _subBoss1Spawned = false; private bool _subBoss2Spawned = false; public Character m_subBoss1; public Character m_subBoss2; public ZNetView m_nview; private float _lastLogTime = 0f; private static readonly int ZDO_Health = StringExtensionMethods.GetStableHashCode("blighted_health"); private static readonly int ZDO_MaxHealth = StringExtensionMethods.GetStableHashCode("blighted_max_health"); private List<GameObject> m_spawnedEnemies = new List<GameObject>(); public void Awake() { //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) m_nview = ((Component)this).GetComponent<ZNetView>(); CharacterAnimEvent[] componentsInChildren = ((Component)this).GetComponentsInChildren<CharacterAnimEvent>(true); foreach (CharacterAnimEvent val in componentsInChildren) { Object.DestroyImmediate((Object)(object)val); } CharacterDrop[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<CharacterDrop>(true); foreach (CharacterDrop val2 in componentsInChildren2) { Object.DestroyImmediate((Object)(object)val2); } BaseAI[] componentsInChildren3 = ((Component)this).GetComponentsInChildren<BaseAI>(true); foreach (BaseAI val3 in componentsInChildren3) { Object.DestroyImmediate((Object)(object)val3); } FootStep[] componentsInChildren4 = ((Component)this).GetComponentsInChildren<FootStep>(true); foreach (FootStep val4 in componentsInChildren4) { Object.DestroyImmediate((Object)(object)val4); } VisEquipment[] componentsInChildren5 = ((Component)this).GetComponentsInChildren<VisEquipment>(true); foreach (VisEquipment val5 in componentsInChildren5) { Object.DestroyImmediate((Object)(object)val5); } Character[] componentsInChildren6 = ((Component)this).GetComponentsInChildren<Character>(true); foreach (Character val6 in componentsInChildren6) { Logger.LogInfo((object)("[BlightedHeart] Stripping Character: " + ((Object)((Component)val6).gameObject).name)); Object.DestroyImmediate((Object)(object)val6); } ZSyncAnimation[] componentsInChildren7 = ((Component)this).GetComponentsInChildren<ZSyncAnimation>(true); foreach (ZSyncAnimation val7 in componentsInChildren7) { Object.DestroyImmediate((Object)(object)val7); } Animator[] componentsInChildren8 = ((Component)this).GetComponentsInChildren<Animator>(true); foreach (Animator val8 in componentsInChildren8) { Object.DestroyImmediate((Object)(object)val8); } Rigidbody[] componentsInChildren9 = ((Component)this).GetComponentsInChildren<Rigidbody>(true); foreach (Rigidbody val9 in componentsInChildren9) { Object.DestroyImmediate((Object)(object)val9); } Aoe[] componentsInChildren10 = ((Component)this).GetComponentsInChildren<Aoe>(true); foreach (Aoe val10 in componentsInChildren10) { Logger.LogInfo((object)("[BlightedHeart] Stripping Aoe: " + ((Object)((Component)val10).gameObject).name)); Object.DestroyImmediate((Object)(object)val10); } MineRock5[] componentsInChildren11 = ((Component)this).GetComponentsInChildren<MineRock5>(true); foreach (MineRock5 val11 in componentsInChildren11) { Object.DestroyImmediate((Object)(object)val11); } HitArea[] componentsInChildren12 = ((Component)this).GetComponentsInChildren<HitArea>(true); foreach (HitArea val12 in componentsInChildren12) { Object.DestroyImmediate((Object)(object)val12); } Destructible[] componentsInChildren13 = ((Component)this).GetComponentsInChildren<Destructible>(true); foreach (Destructible val13 in componentsInChildren13) { Object.DestroyImmediate((Object)(object)val13); } Collider[] componentsInChildren14 = ((Component)this).GetComponentsInChildren<Collider>(true); foreach (Collider val14 in componentsInChildren14) { if ((Object)(object)val14 != (Object)null && val14.isTrigger) { Object.DestroyImmediate((Object)(object)val14); } } MonoBehaviour[] componentsInChildren15 = ((Component)this).GetComponentsInChildren<MonoBehaviour>(true); foreach (MonoBehaviour val15 in componentsInChildren15) { if (!((Object)(object)val15 == (Object)null) && !(val15 is ZNetView) && !(val15 is BlightedWorldHeartAI) && !(val15 is BlightedDamageForwarder)) { Object.DestroyImmediate((Object)(object)val15); } } if ((Object)(object)m_nview != (Object)null) { m_nview.Register<HitData>("RPC_BlightedHeartDamage", (Action<long, HitData>)RPC_HandleDamage); } m_health = m_maxHealth; if ((Object)(object)m_nview != (Object)null && m_nview.GetZDO() != null) { float @float = m_nview.GetZDO().GetFloat(ZDO_Health, 0f); if (@float > 0f) { m_health = @float; } float float2 = m_nview.GetZDO().GetFloat(ZDO_MaxHealth, 0f); if (float2 > 0f) { m_maxHealth = float2; } } Collider[] componentsInChildren16 = ((Component)this).GetComponentsInChildren<Collider>(true); foreach (Collider val16 in componentsInChildren16) { if ((Object)(object)val16 != (Object)null && (Object)(object)((Component)val16).gameObject != (Object)(object)((Component)this).gameObject) { BlightedDamageForwarder blightedDamageForwarder = ((Component)val16).gameObject.GetComponent<BlightedDamageForwarder>(); if ((Object)(object)blightedDamageForwarder == (Object)null) { blightedDamageForwarder = ((Component)val16).gameObject.AddComponent<BlightedDamageForwarder>(); } blightedDamageForwarder.m_heart = this; } } Collider component = ((Component)this).gameObject.GetComponent<Collider>(); if ((Object)(object)component == (Object)null) { BoxCollider val17 = ((Component)this).gameObject.AddComponent<BoxCollider>(); val17.size = new Vector3(10f, 10f, 10f); val17.center = Vector3.zero; } if ((Object)(object)BlightedUIManager.Instance != (Object)null) { BlightedUIManager.Instance.RegisterHeart(this); } Logger.LogInfo((object)"[BlightedHeart] Runtime cleanup complete. Custom IDestructible active."); } public DestructibleType GetDestructibleType() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (DestructibleType)1; } public void Damage(HitData hit) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if (m_isDead || (Object)(object)m_nview == (Object)null || !m_nview.IsValid()) { return; } if (!m_nview.IsOwner()) { m_nview.InvokeRPC("RPC_BlightedHeartDamage", new object[1] { hit }); return; } float totalDamage = hit.GetTotalDamage(); if (!(totalDamage <= 0f)) { m_health -= totalDamage; m_nview.GetZDO().Set(ZDO_Health, m_health); if ((Object)(object)DamageText.instance != (Object)null) { DamageText.instance.ShowText((TextType)0, hit.m_point, totalDamage, false); } if (BlightedConfigManager.DebugMode != null && BlightedConfigManager.DebugMode.Value) { Logger.LogInfo((object)$"[BlightedHeart] Took {totalDamage:F1} damage. Health: {m_health:F0}/{m_maxHealth:F0}"); } if (m_health <= 0f) { m_health = 0f; m_isDead = true; OnDeath(); } } } private void RPC_HandleDamage(long sender, HitData hit) { Damage(hit); } private void OnDeath() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) Logger.LogInfo((object)"[BlightedHeart] The Blighted World Heart has been destroyed!"); DropLoot(); if ((Object)(object)Player.m_localPlayer != (Object)null) { Player.MessageAllInRange(((Component)this).transform.position, 200f, (MessageType)2, "The Blighted World Heart has been purified!", (Sprite)null); } if ((Object)(object)m_nview != (Object)null && m_nview.IsOwner()) { m_nview.Destroy(); } } private void DropLoot() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) if (!BlightedConfigManager.BiomeConfigs.TryGetValue(CurrentBiome, out var _)) { return; } int num = 1; List<Player> list = new List<Player>(); Player.GetPlayersInRange(((Component)this).transform.position, 100f, list); if (list.Count > 0) { num = list.Count; } int num2 = 3 + (num - 1); if (num2 < 3) { num2 = 3; } List<string> value2; bool flag = BlightedItemsManager.BiomeWeaponDrops.TryGetValue(CurrentBiome, out value2) && value2.Count > 0; List<string> value3; bool flag2 = BlightedItemsManager.BiomeArmorDrops.TryGetValue(CurrentBiome, out value3) && value3.Count > 0; if (!flag && !flag2) { return; } for (int i = 0; i < num2; i++) { bool flag3 = Random.value > 0.5f; if ((flag3 && flag) || !flag2) { string prefabName = value2[Random.Range(0, value2.Count)]; SpawnDrop(prefabName); } else if (flag2) { string prefabName2 = value3[Random.Range(0, value3.Count)]; SpawnDrop(prefabName2); } } } private void SpawnDrop(string prefabName) { //IL_0026: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) ZNetScene instance = ZNetScene.instance; GameObject val = ((instance != null) ? instance.GetPrefab(prefabName) : null); if ((Object)(object)val != (Object)null) { Vector3 val2 = ((Component)this).transform.position + Vector3.up * 1f + Random.insideUnitSphere * 0.5f; Object.Instantiate<GameObject>(val, val2, Quaternion.identity); } } private void OnDestroy() { if ((Object)(object)BlightedUIManager.Instance != (Object)null) { BlightedUIManager.Instance.UnregisterHeart(this); } } public void Initialize(Biome biome) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) CurrentBiome = biome; if (BlightedConfigManager.BiomeConfigs.TryGetValue(biome, out var value)) { float num = ((value.WaveTimerSeconds != null) ? value.WaveTimerSeconds.Value : _waveInterval); _lastWaveTime = Time.time - num + 1f; } else { _lastWaveTime = Time.time - _waveInterval + 1f; } if (BlightedConfigManager.BiomeConfigs.TryGetValue(biome, out var value2)) { m_maxHealth = value2.BossHP.Value; m_health = m_maxHealth; if ((Object)(object)m_nview != (Object)null && m_nview.GetZDO() != null) { m_nview.GetZDO().Set(ZDO_Health, m_health); m_nview.GetZDO().Set(ZDO_MaxHealth, m_maxHealth); } } ApplyBiomeVisuals(biome); } private void ApplyBiomeVisuals(Biome biome) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(); Color biomeColor = GetBiomeColor(biome); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if ((Object)(object)val.material != (Object)null) { val.material.SetColor("_Color", biomeColor); if (val.material.HasProperty("_EmissionColor")) { val.material.SetColor("_EmissionColor", biomeColor * 2f); val.material.EnableKeyword("_EMISSION"); } } } } private Color GetBiomeColor(Biome biome) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_000a: 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_0022: Expected I4, but got Unknown //IL_00f7: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_0051: Invalid comparison between Unknown and I4 //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_00ce: Unknown result type (might be due to invalid IL or missing references) if ((int)biome <= 16) { switch (biome - 1) { default: if ((int)biome != 8) { if ((int)biome != 16) { break; } return new Color(0.9f, 0.7f, 0.2f); } return new Color(0.5f, 0.1f, 0.8f); case 0: return new Color(0.2f, 0.8f, 0.2f); case 1: return new Color(0.4f, 0.3f, 0.1f); case 3: return new Color(0.8f, 0.9f, 1f); case 2: break; } } else { if ((int)biome == 32) { return new Color(1f, 0.2f, 0f); } if ((int)biome == 64) { return new Color(0.9f, 0.9f, 1f); } if ((int)biome == 512) { return new Color(0.3f, 0.1f, 0.5f); } } return Color.white; } private void Update() { if (!((Object)(object)m_nview == (Object)null) && m_nview.IsOwner() && !m_isDead) { CheckSubBossThresholds(); HandleWaveSpawning(); } } private void HandleWaveSpawning() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (BlightedConfigManager.BiomeConfigs.TryGetValue(CurrentBiome, out var value)) { float num = ((value.WaveTimerSeconds != null) ? value.WaveTimerSeconds.Value : _waveInterval); if (Time.time - _lastWaveTime > num) { _lastWaveTime = Time.time; SpawnWave(); } } } private void SpawnWave() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) if (!BlightedConfigManager.BiomeConfigs.TryGetValue(CurrentBiome, out var value)) { return; } int value2 = value.MaxEnemiesPerWave.Value; m_spawnedEnemies.RemoveAll((GameObject e) => (Object)(object)e == (Object)null || (Object)(object)e.GetComponent<Character>() == (Object)null || e.GetComponent<Character>().IsDead()); int num = value2 - m_spawnedEnemies.Count; if (num <= 0) { return; } string[] waveEnemiesForBiome = GetWaveEnemiesForBiome(CurrentBiome); if (waveEnemiesForBiome.Length == 0) { return; } if (BlightedConfigManager.DebugMode.Value) { Logger.LogInfo((object)string.Format("Attempting to spawn {0} wave enemies (Current: {1}/{2}) of type {3} in {4}.", num, m_spawnedEnemies.Count, value2, string.Join(",", waveEnemiesForBiome), CurrentBiome)); } int num2 = 0; float y = default(float); for (int i = 0; i < num; i++) { string text = waveEnemiesForBiome[Random.Range(0, waveEnemiesForBiome.Length)]; GameObject prefab = ZNetScene.instance.GetPrefab(text); if ((Object)(object)prefab != (Object)null) { Vector3 val = ((Component)this).transform.position + Random.insideUnitSphere * 10f; if (ZoneSystem.instance.GetSolidHeight(val, ref y, 1000)) { val.y = y; } else { val.y = ((Component)this).transform.position.y; } GameObject val2 = Object.Instantiate<GameObject>(prefab, val, Quaternion.identity); m_spawnedEnemies.Add(val2); num2++; CharacterDrop[] componentsInChildren = val2.GetComponentsInChildren<CharacterDrop>(true); CharacterDrop[] array = componentsInChildren; foreach (CharacterDrop val3 in array) { Object.Destroy((Object)(object)val3); } BaseAI component = val2.GetComponent<BaseAI>(); if (!((Object)(object)component != (Object)null)) { continue; } component.Alert(); Player closestPlayer = Player.GetClosestPlayer(val, 50f); if ((Object)(object)closestPlayer != (Object)null) { MonsterAI component2 = val2.GetComponent<MonsterAI>(); if ((Object)(object)component2 != (Object)null) { component2.SetTarget(((Component)closestPlayer).GetComponent<Character>()); } } } else if (BlightedConfigManager.DebugMode.Value) { Logger.LogWarning((object)("Wave enemy prefab " + text + " not found in ZNetScene.")); } } if (BlightedConfigManager.DebugMode.Value) { Logger.LogInfo((object)$"Successfully spawned {num2} wave enemies."); } if (num2 > 0 && BlightedConfigManager.EnableWaveAnnouncement.Value) { Player.MessageAllInRange(((Component)this).transform.position, 100f, BlightedConfigManager.WaveAnnouncementLocation.Value, "The Blighted World Heart cries out for the fallen...", (Sprite)null); } } private void CheckSubBossThresholds() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (BlightedConfigManager.BiomeConfigs.TryGetValue(CurrentBiome, out var value)) { float num = m_health / m_maxHealth; if (BlightedConfigManager.DebugMode.Value && Time.time - _lastLogTime > 5f) { _lastLogTime = Time.time; Logger.LogInfo((object)$"Checking SubBoss thresholds. Current Health: {num:P0}. T1: {value.SubBossThreshold1.Value:P0}, T2: {value.SubBossThreshold2.Value:P0}. Spawned: {_subBoss1Spawned}, {_subBoss2Spawned}"); } if (!_subBoss1Spawned && num <= value.SubBossThreshold1.Value) { _subBoss1Spawned = true; SpawnSubBoss(1, value.SubBoss1HP.Value); } if (!_subBoss2Spawned && num <= value.SubBossThreshold2.Value) { _subBoss2Spawned = true; SpawnSubBoss(2, value.SubBoss2HP.Value); } } } private void SpawnSubBoss(int index, float maxHealth) { //IL_0003: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) string subBossForBiome = GetSubBossForBiome(CurrentBiome); if (BlightedConfigManager.DebugMode.Value) { Logger.LogInfo((object)$"Attempting to spawn subboss: {subBossForBiome} for biome {CurrentBiome}"); } GameObject prefab = ZNetScene.instance.GetPrefab(subBossForBiome); if (!((Object)(object)prefab != (Object)null)) { return; } Vector3 val = ((Component)this).transform.position + Random.insideUnitSphere * 5f; float y = default(float); if (ZoneSystem.instance.GetSolidHeight(val, ref y, 1000)) { val.y = y; } else { val.y = ((Component)this).transform.position.y; } GameObject val2 = Object.Instantiate<GameObject>(prefab, val, Quaternion.identity); if (BlightedConfigManager.DebugMode.Value) { Logger.LogInfo((object)("Successfully spawned subboss " + subBossForBiome)); } Transform transform = val2.transform; transform.localScale *= 1.5f; CharacterDrop[] componentsInChildren = val2.GetComponentsInChildren<CharacterDrop>(true); CharacterDrop[] array = componentsInChildren; foreach (CharacterDrop val3 in array) { Object.Destroy((Object)(object)val3); } Component[] componentsInChildren2 = val2.GetComponentsInChildren<Component>(true); foreach (Component val4 in componentsInChildren2) { string name = ((object)val4).GetType().Name; if (name == "DropOnDestroy" || name == "SpawnOnDestroy") { Object.Destroy((Object)(object)val4); } } Character component = val2.GetComponent<Character>(); if ((Object)(object)component != (Object)null) { component.SetLevel(3); string text = Localization.instance.Localize(component.m_name); component.m_name = "Blighted " + text; component.SetMaxHealth(maxHealth); component.SetHealth(maxHealth); } val2.AddComponent<BlightedSubBoss>(); switch (index) { case 1: m_subBoss1 = component; break; case 2: m_subBoss2 = component; break; } } private string[] GetWaveEnemiesForBiome(Biome biome) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected I4, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 if ((int)biome <= 8) { switch (biome - 1) { default: if ((int)biome != 8) { break; } return new string[3] { "Greydwarf", "Greydwarf_Elite", "Skeleton" }; case 0: return new string[3] { "Boar", "Neck", "Greyling" }; case 1: return new string[3] { "Draugr", "Blob", "Leech" }; case 3: return new string[2] { "Wolf", "Hatchling" }; case 2: break; } } else { if ((int)biome == 16) { return new string[2] { "Goblin", "Deathsquito" }; } if ((int)biome == 32) { return new string[2] { "Charred_Melee", "Charred_Archer" }; } if ((int)biome == 512) { return new string[2] { "Seeker", "SeekerBrood" }; } } return new string[1] { "Boar" }; } private string GetSubBossForBiome(Biome biome) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected I4, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 string[] array; if ((int)biome <= 8) { switch (biome - 1) { case 0: goto IL_0050; case 1: goto IL_0090; case 3: goto IL_00b1; case 2: goto IL_011d; } if ((int)biome != 8) { goto IL_011d; } array = new string[3] { "Greydwarf_Elite", "Troll", "Skeleton_Poison" }; } else if ((int)biome != 16) { if ((int)biome != 32) { if ((int)biome != 512) { goto IL_011d; } array = new string[2] { "SeekerBrute", "Seeker" }; } else { array = new string[2] { "Morgen", "Charred_Melee" }; } } else { array = new string[3] { "GoblinBrute", "GoblinShaman", "Lox" }; } goto IL_012e; IL_0050: array = new string[2] { "Boar", "Neck" }; goto IL_012e; IL_011d: array = new string[1] { "Boar" }; goto IL_012e; IL_012e: return array[Random.Range(0, array.Length)]; IL_00b1: array = new string[2] { "Fenring", "StoneGolem" }; goto IL_012e; IL_0090: array = new string[3] { "Draugr_Elite", "Wraith", "Abomination" }; goto IL_012e; } } public static class BlightedConfigManager { public class BiomeConfig { public ConfigEntry<float> BossHP; public ConfigEntry<float> SubBossThreshold1; public ConfigEntry<float> SubBossThreshold2; public ConfigEntry<float> SubBoss1HP; public ConfigEntry<float> SubBoss2HP; public ConfigEntry<float> LootScaleFactor; public ConfigEntry<int> MaxEnemiesPerWave; public ConfigEntry<float> WaveTimerSeconds; public ConfigEntry<string> AltarSummonItem; public ConfigEntry<int> AltarSummonAmount; } public static Dictionary<Biome, BiomeConfig> BiomeConfigs = new Dictionary<Biome, BiomeConfig>(); public static ConfigEntry<bool> DebugMode; public static ConfigEntry<bool> EnableWaveAnnouncement; public static ConfigEntry<MessageType> WaveAnnouncementLocation; public static void SetupConfig(BlightedHeartPlugin plugin) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown ((BaseUnityPlugin)plugin).Config.SaveOnConfigSet = true; DebugMode = ((BaseUnityPlugin)plugin).Config.Bind<bool>("General", "Debug Mode", false, new ConfigDescription("Enable verbose debug logging.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); EnableWaveAnnouncement = ((BaseUnityPlugin)plugin).Config.Bind<bool>("General", "Enable Wave Announcement", true, new ConfigDescription("Toggle for wave spawn text.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); WaveAnnouncementLocation = ((BaseUnityPlugin)plugin).Config.Bind<MessageType>("General", "Wave Announcement Location", (MessageType)2, new ConfigDescription("Where the wave text displays.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); SetupBiomeConfig(plugin, (Biome)1, 3000f, 0.5f, 0.2f, 750f, 1250f, 1.5f, 6, 8f, "HardAntler", 1); SetupBiomeConfig(plugin, (Biome)8, 6000f, 0.5f, 0.2f, 1500f, 2500f, 2f, 7, 8f, "CryptKey", 1); SetupBiomeConfig(plugin, (Biome)2, 9000f, 0.5f, 0.2f, 2250f, 3750f, 2.5f, 8, 8f, "Wishbone", 1); SetupBiomeConfig(plugin, (Biome)4, 12000f, 0.5f, 0.2f, 3000f, 5000f, 3f, 9, 8f, "DragonTear", 1); SetupBiomeConfig(plugin, (Biome)16, 18000f, 0.5f, 0.2f, 4500f, 7500f, 3.5f, 10, 8f, "YagluthDrop", 1); SetupBiomeConfig(plugin, (Biome)512, 24000f, 0.5f, 0.2f, 6000f, 10000f, 4.5f, 11, 8f, "QueenDrop", 1); SetupBiomeConfig(plugin, (Biome)32, 30000f, 0.5f, 0.2f, 7500f, 12500f, 5.5f, 12, 8f, "FaderDrop", 1); SetupBiomeConfig(plugin, (Biome)64, 37500f, 0.5f, 0.2f, 9000f, 15000f, 6f, 13, 8f, "FaderDrop", 1); } private static void SetupBiomeConfig(BlightedHeartPlugin plugin, Biome biome, float defaultHP, float defaultThreshold1, float defaultThreshold2, float defaultSubBoss1HP, float defaultSubBoss2HP, float defaultLootScale, int defaultMaxEnemies, float defaultWaveTimer, string defaultSummonItem, int defaultSummonAmount) { //IL_003c: 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_004a: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Expected O, but got Unknown //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Expected O, but got Unknown //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Expected O, but got Unknown //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Expected O, but got Unknown //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Expected O, but got Unknown //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Expected O, but got Unknown //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Expected O, but got Unknown //IL_0269: Unknown result type (might be due to invalid IL or missing references) string text = ((object)(Biome)(ref biome)).ToString(); BiomeConfig biomeConfig = new BiomeConfig(); biomeConfig.BossHP = ((BaseUnityPlugin)plugin).Config.Bind<float>(text, "Boss HP", defaultHP, new ConfigDescription("Base HP of the Blighted World Heart when summoned in the " + text + ".", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); biomeConfig.SubBossThreshold1 = ((BaseUnityPlugin)plugin).Config.Bind<float>(text, "Sub-Boss Threshold 1", defaultThreshold1, new ConfigDescription("Health percentage (0.0 to 1.0) to spawn the first sub-boss.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); biomeConfig.SubBossThreshold2 = ((BaseUnityPlugin)plugin).Config.Bind<float>(text, "Sub-Boss Threshold 2", defaultThreshold2, new ConfigDescription("Health percentage (0.0 to 1.0) to spawn the second sub-boss.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); biomeConfig.SubBoss1HP = ((BaseUnityPlugin)plugin).Config.Bind<float>(text, "Sub-Boss 1 HP", defaultSubBoss1HP, new ConfigDescription("Max HP of the first sub-boss.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); biomeConfig.SubBoss2HP = ((BaseUnityPlugin)plugin).Config.Bind<float>(text, "Sub-Boss 2 HP", defaultSubBoss2HP, new ConfigDescription("Max HP of the second sub-boss.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); biomeConfig.LootScaleFactor = ((BaseUnityPlugin)plugin).Config.Bind<float>(text, "Loot Scale Factor", defaultLootScale, new ConfigDescription("Multiplier for the loot quality and drop amounts.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); biomeConfig.MaxEnemiesPerWave = ((BaseUnityPlugin)plugin).Config.Bind<int>(text, "Max Enemies Per Wave", defaultMaxEnemies, new ConfigDescription("Maximum number of standard enemies that can be alive in a single wave.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); biomeConfig.WaveTimerSeconds = ((BaseUnityPlugin)plugin).Config.Bind<float>(text, "Wave Timer Seconds", defaultWaveTimer, new ConfigDescription("Time in seconds between enemy wave spawns.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); biomeConfig.AltarSummonItem = ((BaseUnityPlugin)plugin).Config.Bind<string>(text, "Altar Summon Item", defaultSummonItem, new ConfigDescription("The prefab name of the item required to summon the boss in this biome.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); biomeConfig.AltarSummonAmount = ((BaseUnityPlugin)plugin).Config.Bind<int>(text, "Altar Summon Amount", defaultSummonAmount, new ConfigDescription("The amount of the summon item required.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); BiomeConfig value = biomeConfig; BiomeConfigs[biome] = value; } } [BepInPlugin("wubarrk.blightedworldheart", "BlightedWorldHeart", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class BlightedHeartPlugin : BaseUnityPlugin { public const string PluginGUID = "wubarrk.blightedworldheart"; public const string PluginName = "BlightedWorldHeart"; public const string PluginVersion = "1.0.0"; private readonly Harmony _harmony = new Harmony("wubarrk.blightedworldheart"); private void Awake() { BlightedConfigManager.SetupConfig(this); PrefabManager.OnVanillaPrefabsAvailable += SetupBlightedHeartPrefab; PrefabManager.OnVanillaPrefabsAvailable += BlightedItemsManager.Setup; _harmony.PatchAll(); Logger.LogInfo((object)"BlightedWorldHeart v1.0.0 loaded."); } private void SetupBlightedHeartPrefab() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown PrefabManager.OnVanillaPrefabsAvailable -= SetupBlightedHeartPrefab; Logger.LogInfo((object)"Setting up Blighted World Heart prefab..."); GameObject val = PrefabManager.Instance.CreateClonedPrefab("BlightedWorldHeart", "TheHive"); if ((Object)(object)val == (Object)null) { Logger.LogError((object)"Could not create cloned prefab BlightedWorldHeart!"); return; } CustomPrefab val2 = new CustomPrefab(val, true); val.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); ZNetView component = val.GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null) { component = val.AddComponent<ZNetView>(); } BlightedWorldHeartAI blightedWorldHeartAI = val.AddComponent<BlightedWorldHeartAI>(); PrefabManager.Instance.AddPrefab(val2); Logger.LogInfo((object)"BlightedWorldHeart prefab registered. Runtime cleanup will happen on spawn."); GameObject val3 = new GameObject("BlightedUIManager"); Object.DontDestroyOnLoad((Object)(object)val3); val3.AddComponent<BlightedUIManager>(); } } public class BlightedDamageForwarder : MonoBehaviour, IDestructible { public BlightedWorldHeartAI m_heart; public DestructibleType GetDestructibleType() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) return (DestructibleType)((!((Object)(object)m_heart != (Object)null)) ? 1 : ((int)m_heart.GetDestructibleType())); } public void Damage(HitData hit) { if ((Object)(object)m_heart != (Object)null) { m_heart.Damage(hit); } } } public class BlightedSubBoss : MonoBehaviour { public Character m_character; private void Awake() { m_character = ((Component)this).GetComponent<Character>(); if ((Object)(object)m_character != (Object)null) { m_character.m_boss = false; } } } public static class PluginInfo { public const string PLUGIN_GUID = "BlightedHeart"; public const string PLUGIN_NAME = "BlightedHeart"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }