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 HealingStaff v1.0.0
HealingStaff.dll
Decompiled 14 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("HealingStaff")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HealingStaff")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("30063689-6df0-423c-84d7-aa08aff570dc")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace HealingStaffMod; internal static class Settings { public static ConfigEntry<float> EitrCost; public static ConfigEntry<float> HealthCostPercent; public static ConfigEntry<float> StaminaCost; public static ConfigEntry<float> HealRadius; public static ConfigEntry<float> TickInterval; public static ConfigEntry<float> Duration1; public static ConfigEntry<float> Duration2; public static ConfigEntry<float> Duration3; public static ConfigEntry<float> Duration4; public static ConfigEntry<float> BasePerTick; public static ConfigEntry<float> PerQualityLevel; public static ConfigEntry<float> SkillBonusAt100; public static event Action Changed; public static void Bind(ConfigFile cfg) { EitrCost = B(cfg, "Cost", "EitrCost", 40f, "Eitr used per cast.", 0f, 200f); HealthCostPercent = B(cfg, "Cost", "HealthCostPercent", 30f, "Percent of the caster's CURRENT health used per cast.", 0f, 100f); StaminaCost = B(cfg, "Cost", "StaminaCost", 0f, "Stamina used per cast.", 0f, 200f); HealRadius = B(cfg, "Range", "HealRadius", 5f, "Heal radius in meters (also used for pets and summons).", 1f, 20f); TickInterval = B(cfg, "Timing", "TickInterval", 2f, "Seconds between heal ticks.", 0.25f, 10f); Duration1 = B(cfg, "Timing", "DurationQuality1", 10f, "Heal duration in seconds at staff quality 1.", 1f, 120f); Duration2 = B(cfg, "Timing", "DurationQuality2", 12f, "Heal duration at quality 2.", 1f, 120f); Duration3 = B(cfg, "Timing", "DurationQuality3", 15f, "Heal duration at quality 3.", 1f, 120f); Duration4 = B(cfg, "Timing", "DurationQuality4", 20f, "Heal duration at quality 4.", 1f, 120f); BasePerTick = B(cfg, "Healing", "BasePerTick", 5f, "Heal per tick = BasePerTick + quality * PerQualityLevel + skill/100 * SkillBonusAt100.", 0f, 100f); PerQualityLevel = B(cfg, "Healing", "PerQualityLevel", 1f, "Extra heal per tick for each staff quality level.", 0f, 50f); SkillBonusAt100 = B(cfg, "Healing", "SkillBonusAt100", 7f, "Extra heal per tick at skill level 100 (scales linearly).", 0f, 100f); } public static float DurationFor(int quality) { return quality switch { 1 => Duration1.Value, 2 => Duration2.Value, 3 => Duration3.Value, _ => Duration4.Value, }; } private static ConfigEntry<float> B(ConfigFile cfg, string section, string key, float def, string description, float min, float max) { //IL_0000: 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_000d: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown ConfigurationManagerAttributes val = new ConfigurationManagerAttributes { IsAdminOnly = true }; ConfigEntry<float> obj = cfg.Bind<float>(section, key, def, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max), new object[1] { val })); obj.SettingChanged += delegate { Settings.Changed?.Invoke(); }; return obj; } } internal class HealTamesOnSpawn : MonoBehaviour { private static StatusEffect FindHealEffect() { if ((Object)(object)ObjectDB.instance == (Object)null) { return null; } return ObjectDB.instance.m_StatusEffects.Find((StatusEffect se) => (Object)(object)se != (Object)null && ((Object)se).name == "HealStatusEffect"); } private void Start() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) ZNetView component = ((Component)this).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid() || !component.IsOwner()) { return; } Player localPlayer = Player.m_localPlayer; ItemData val = (((Object)(object)localPlayer != (Object)null) ? ((Humanoid)localPlayer).GetCurrentWeapon() : null); if (val == null || val.m_shared.m_name != "$item_staffheal") { return; } Vector3 position = ((Component)localPlayer).transform.position; ((Component)this).transform.position = position; GameObject prefab = PrefabManager.Instance.GetPrefab("sfx_greydwarf_shaman_heal"); if (Object.op_Implicit((Object)(object)prefab)) { Object.Instantiate<GameObject>(prefab, position, Quaternion.identity); } StatusEffect val2 = FindHealEffect(); if ((Object)(object)val2 == (Object)null) { return; } int quality = val.m_quality; float skillLevel = ((Character)localPlayer).GetSkillLevel(val.m_shared.m_skillType); float value = Settings.HealRadius.Value; foreach (Character allCharacter in Character.GetAllCharacters()) { if (!((Object)(object)allCharacter == (Object)null) && !allCharacter.IsDead() && !((Object)(object)allCharacter == (Object)(object)localPlayer) && allCharacter.IsTamed() && !(Vector3.Distance(((Component)allCharacter).transform.position, position) > value)) { allCharacter.GetSEMan().AddStatusEffect(val2, false, quality, skillLevel, (short)(-1)); } } } } [BepInPlugin("madtongpu.healingstaff", "HealingStaff", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] internal class HealingStaffPlugin : BaseUnityPlugin { public const string PluginGUID = "madtongpu.healingstaff"; public const string PluginName = "HealingStaff"; public const string PluginVersion = "1.0.0"; private void Awake() { Logger.LogInfo((object)"HealingStaff loaded"); AddLocalizations(); Settings.Bind(((BaseUnityPlugin)this).Config); HealingStaff.Register(); } private void AddLocalizations() { CustomLocalization localization = LocalizationManager.Instance.GetLocalization(); string text = "English"; localization.AddTranslation(ref text, new Dictionary<string, string> { { "item_staffheal", "Healing Staff" }, { "item_staffheal_description", "Withered bone and ancient seeds bound together with refined eitr. The greydwarves' stolen life seeps from it, mending the wounds of everyone who stands close." }, { "se_heal", "Healing" }, { "se_heal_desc", "Health per second:\n<color=#ff8000>{0}</color> <color=#ffff00>({1})</color>\nDuration: <color=#ff8000>{2}s</color>" } }); } } public class Heal_SE : SE_Stats { private float _baseHealPerTick = 1f; public override void SetLevel(int itemLevel, float skillLevel) { base.m_tickInterval = Settings.TickInterval.Value; _baseHealPerTick = Settings.BasePerTick.Value + (float)itemLevel * Settings.PerQualityLevel.Value; base.m_healthPerTick = _baseHealPerTick + skillLevel / 100f * Settings.SkillBonusAt100.Value; ((StatusEffect)this).m_ttl = Settings.DurationFor(itemLevel); } public override string GetTooltipString() { float value = Settings.TickInterval.Value; return "Health per second:\n<color=#ff8000>" + (_baseHealPerTick / value).ToString("0.#") + "</color> <color=#ffff00>(" + (base.m_healthPerTick / value).ToString("0.#") + ")</color>\nDuration: <color=#ff8000>" + ((StatusEffect)this).m_ttl.ToString("0") + "s</color>"; } } internal static class RuntimeTextures { private static readonly Dictionary<string, Sprite> IconCache = new Dictionary<string, Sprite>(); public static Sprite LoadIcon(string name) { if (IconCache.TryGetValue(name, out var value)) { return value; } Sprite val = DecodeIcon(name); IconCache[name] = val; return val; } private static Sprite DecodeIcon(string name) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_00be: 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) Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = null; string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text2 in manifestResourceNames) { if (text2 == name + ".png" || text2.EndsWith("." + name + ".png")) { text = text2; break; } } if (text == null) { return null; } using Stream stream = executingAssembly.GetManifestResourceStream(text); byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false) { name = name }; if (!LoadPng(val, array)) { return null; } return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } private static bool LoadPng(Texture2D target, byte[] png) { MethodInfo methodInfo = Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule")?.GetMethod("LoadImage", new Type[2] { typeof(Texture2D), typeof(byte[]) }); if (methodInfo == null) { return false; } return (bool)methodInfo.Invoke(null, new object[2] { target, png }); } } internal static class RenderedIcons { private const int Size = 64; private const float RollZ = 215f; public static void Register(string prefabName) { //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_0045: 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_0063: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_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_00c6: Expected O, but got Unknown GameObject prefab = PrefabManager.Instance.GetPrefab(prefabName); ItemDrop val = (Object.op_Implicit((Object)(object)prefab) ? prefab.GetComponent<ItemDrop>() : null); if (!Object.op_Implicit((Object)(object)val)) { Logger.LogWarning((object)("RenderedIcons: item " + prefabName + " not found")); return; } Quaternion val2 = RenderManager.IsometricRotation; val2 = Quaternion.Euler(((Quaternion)(ref val2)).eulerAngles + new Vector3(0f, 0f, 215f)) * Quaternion.AngleAxis(180f, Vector3.up); Vector3 eulerAngles = ((Quaternion)(ref val2)).eulerAngles; RenderRequest val3 = new RenderRequest(prefab) { Width = 64, Height = 64, Rotation = Quaternion.Euler(eulerAngles), FieldOfView = 0.5f, DistanceMultiplier = 1f, UseCache = false }; Sprite val4 = RenderManager.Instance.Render(val3); if (!Object.op_Implicit((Object)(object)val4)) { Logger.LogWarning((object)("RenderedIcons: render of " + prefabName + " failed - keeping base icon")); return; } ((Object)val4).name = prefabName + "_rendered"; val.m_itemData.m_shared.m_icons = (Sprite[])(object)new Sprite[1] { val4 }; } } internal static class HealingStaff { public const string PrefabName = "HealingStaff"; private const string AoeName = "heal_aoe"; private const string HealSEName = "HealStatusEffect"; private static Material _fireworksMat; private static ParticleSystemRenderer _flamesRenderer; private static SharedData _shared; private static Aoe _aoe; public static void Register() { PrefabManager.OnVanillaPrefabsAvailable += Create; } private static void Create() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Expected O, but got Unknown //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Expected O, but got Unknown //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Expected O, but got Unknown //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Expected O, but got Unknown //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Expected O, but got Unknown //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Expected O, but got Unknown //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Expected O, but got Unknown PrefabManager.OnVanillaPrefabsAvailable -= Create; try { CustomStatusEffect val = CreateStatusEffect(); ItemManager.Instance.AddStatusEffect(val); GameObject attackProjectile = BuildHealAoe(); SharedData shared = PrefabManager.Instance.GetPrefab("AncientSeed").GetComponent<ItemDrop>().m_itemData.m_shared; ItemConfig val2 = new ItemConfig(); val2.Name = "$item_staffheal"; val2.Description = "$item_staffheal_description"; val2.Icons = (Sprite[])(object)new Sprite[1] { shared.m_icons[0] }; val2.CraftingStation = CraftingStations.GaldrTable; val2.RepairStation = CraftingStations.GaldrTable; val2.MinStationLevel = 1; val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("WitheredBone", 10, 5, true), new RequirementConfig("AncientSeed", 4, 1, true), new RequirementConfig("Eitr", 10, 5, true) }; ItemConfig val3 = val2; CustomItem val4 = new CustomItem("HealingStaff", "StaffShield", val3); ItemManager.Instance.AddItem(val4); SharedData shared2 = val4.ItemDrop.m_itemData.m_shared; shared2.m_maxDurability = 100f; shared2.m_durabilityPerLevel = 25f; shared2.m_useDurability = true; shared2.m_useDurabilityDrain = 1f; shared2.m_attack.m_attackProjectile = attackProjectile; shared2.m_attackStatusEffect = val.StatusEffect; Attack attack = shared2.m_attack; attack.m_startEffect = new EffectList(); attack.m_triggerEffect = new EffectList(); attack.m_trailStartEffect = new EffectList(); attack.m_burstEffect = new EffectList(); attack.m_hitTerrainEffect = new EffectList(); attack.m_hitEffect = MakeEffectList("vfx_HitSparks"); shared2.m_startEffect = new EffectList(); shared2.m_triggerEffect = new EffectList(); shared2.m_holdStartEffect = new EffectList(); shared2.m_equipEffect = new EffectList(); shared2.m_hitEffect = new EffectList(); shared2.m_hitTerrainEffect = new EffectList(); shared2.m_trailStartEffect = new EffectList(); _shared = shared2; Settings.Changed += ApplyConfig; ApplyConfig(); BuildVisual(val4.ItemPrefab); RenderedIcons.Register("HealingStaff"); } catch (Exception arg) { Logger.LogError((object)$"HealingStaff: failed to assemble item: {arg}"); } } private static void ApplyConfig() { if (_shared != null) { _shared.m_attack.m_attackEitr = Settings.EitrCost.Value; _shared.m_attack.m_attackHealthPercentage = Settings.HealthCostPercent.Value; _shared.m_attack.m_attackStamina = Settings.StaminaCost.Value; } if ((Object)(object)_aoe != (Object)null) { _aoe.m_radius = Settings.HealRadius.Value; } } private static CustomStatusEffect CreateStatusEffect() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown Heal_SE heal_SE = ScriptableObject.CreateInstance<Heal_SE>(); ((Object)heal_SE).name = "HealStatusEffect"; ((StatusEffect)heal_SE).m_name = "$se_heal"; ((StatusEffect)heal_SE).m_ttl = 12f; ((SE_Stats)heal_SE).m_tickInterval = Settings.TickInterval.Value; ((StatusEffect)heal_SE).m_icon = RuntimeTextures.LoadIcon("HealIcon"); if (!Object.op_Implicit((Object)(object)((StatusEffect)heal_SE).m_icon)) { GameObject val = PrefabManager.Instance.GetPrefab("MeadHealthMinor") ?? PrefabManager.Instance.GetPrefab("Raspberry"); if (Object.op_Implicit((Object)(object)val)) { ((StatusEffect)heal_SE).m_icon = val.GetComponent<ItemDrop>().m_itemData.m_shared.m_icons.FirstOrDefault(); } else { Logger.LogWarning((object)"HealingStaff: no icon source for the status effect"); } } return new CustomStatusEffect((StatusEffect)(object)heal_SE, false); } private static GameObject BuildHealAoe() { //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown //IL_01e2: Unknown result type (might be due to invalid IL or missing references) bool flag = (Object)(object)PrefabManager.Instance.GetPrefab("shaman_heal_aoe") != (Object)null; GameObject val = PrefabManager.Instance.CreateClonedPrefab("heal_aoe", flag ? "shaman_heal_aoe" : "DvergerStaffHeal_aoe"); if (!flag) { Logger.LogWarning((object)"HealingStaff: shaman_heal_aoe not found, using Dverger effect"); } Aoe componentInChildren = val.GetComponentInChildren<Aoe>(true); val.AddComponent<HealTamesOnSpawn>(); _aoe = componentInChildren; componentInChildren.m_statusEffect = "HealStatusEffect"; componentInChildren.m_statusEffectIfPlayer = "HealStatusEffect"; componentInChildren.m_hitEnemy = false; componentInChildren.m_hitProps = false; componentInChildren.m_hitFriendly = true; componentInChildren.m_hitCharacters = true; componentInChildren.m_hitOwner = true; componentInChildren.m_ignorePVP = true; componentInChildren.m_ttl = 3.5f; GameObject prefab = PrefabManager.Instance.GetPrefab("DvergerStaffHeal_aoe"); Transform val2 = (Object.op_Implicit((Object)(object)prefab) ? prefab.transform.Find("flames_world") : null); if (Object.op_Implicit((Object)(object)val2)) { ParticleSystemRenderer component = ((Component)val2).GetComponent<ParticleSystemRenderer>(); if (Object.op_Implicit((Object)(object)component)) { _fireworksMat = ((Renderer)component).sharedMaterial; } } if (flag) { componentInChildren.m_hitEffects = new EffectList(); } else { DestroyChild(val, "flames"); DestroyChild(val, "flames_world (1)"); DestroyChild(val, "flames_world (2)"); GameObject prefab2 = PrefabManager.Instance.GetPrefab("vfx_HitSparks"); GameObject prefab3 = PrefabManager.Instance.GetPrefab("sfx_greydwarf_attack_hit"); EffectList val3 = new EffectList(); val3.m_effectPrefabs = ((IEnumerable<GameObject>)(object)new GameObject[2] { prefab2, prefab3 }).Where((GameObject p) => Object.op_Implicit((Object)(object)p)).Select((Func<GameObject, EffectData>)((GameObject p) => new EffectData { m_prefab = p })).ToArray(); componentInChildren.m_hitEffects = val3; Light componentInChildren2 = val.GetComponentInChildren<Light>(true); if (Object.op_Implicit((Object)(object)componentInChildren2)) { componentInChildren2.color = new Color(0.8797f, 1f, 0.4549f); } LightFlicker componentInChildren3 = val.GetComponentInChildren<LightFlicker>(true); if (Object.op_Implicit((Object)(object)componentInChildren3)) { componentInChildren3.m_ttl = 2.5f; componentInChildren3.m_fadeDuration = 1f; componentInChildren3.m_fadeInDuration = 0f; } } PrefabManager.Instance.AddPrefab(new CustomPrefab(val, false)); return val; } private static void BuildVisual(GameObject prefab) { //IL_0034: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0298: 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_0320: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) Transform val = prefab.transform.Find("attach"); if (!Object.op_Implicit((Object)(object)val)) { Logger.LogWarning((object)"HealingStaff: no 'attach' node in the StaffShield clone"); return; } val.localPosition = new Vector3(0f, 0.025f, 0f); val.localRotation = Quaternion.Euler(0f, 0f, 180f); Transform[] array = ((IEnumerable)val).Cast<Transform>().ToArray(); for (int i = 0; i < array.Length; i++) { Object.DestroyImmediate((Object)(object)((Component)array[i]).gameObject); } GameObject val2 = new GameObject("equiped"); val2.transform.SetParent(val, false); Transform transform = val2.transform; int layer = LayerMask.NameToLayer("item"); Mesh val3 = FindLoadedMesh("Bone"); Material val4 = FindLoadedMaterial("bone"); var (val5, val6) = FindModel("AncientSeed", "ancientseed"); if (!Object.op_Implicit((Object)(object)val3) || !Object.op_Implicit((Object)(object)val4) || !Object.op_Implicit((Object)(object)val5) || !Object.op_Implicit((Object)(object)val6)) { Logger.LogWarning((object)($"HealingStaff: missing model parts (bone={Object.op_Implicit((Object)(object)val3)}/{Object.op_Implicit((Object)(object)val4)}, " + $"seed={Object.op_Implicit((Object)(object)val5)}/{Object.op_Implicit((Object)(object)val6)}) - keeping the shield staff model")); return; } GameObject val7 = new GameObject("Wand") { layer = layer }; val7.transform.SetParent(transform, false); val7.transform.localPosition = new Vector3(0.009f, 0f, 0.016f); val7.transform.localScale = new Vector3(0.6f, 0.6f, 0.8f); val7.AddComponent<MeshFilter>().sharedMesh = val3; ((Renderer)val7.AddComponent<MeshRenderer>()).sharedMaterial = val4; val7.AddComponent<BoxCollider>().size = new Vector3(0.2f, 0.2f, 2f); GameObject val8 = new GameObject("model"); val8.layer = layer; val8.transform.SetParent(transform, false); val8.transform.localPosition = new Vector3(0.001f, 0.006f, 0.698f); val8.transform.localRotation = Quaternion.Euler(-34.489f, -74.284f, 186.532f); val8.transform.localScale = Vector3.one * 0.16f; val8.AddComponent<MeshFilter>().sharedMesh = val5; ((Renderer)val8.AddComponent<MeshRenderer>()).sharedMaterial = val6; BoxCollider obj = val8.AddComponent<BoxCollider>(); obj.size = new Vector3(1.73f, 1.61f, 1.65f); obj.center = new Vector3(-0.02f, 0f, 0.149f); GameObject prefab2 = PrefabManager.Instance.GetPrefab("DvergerStaffHeal_aoe"); Transform val9 = (Object.op_Implicit((Object)(object)prefab2) ? prefab2.transform.Find("flames") : null); if (Object.op_Implicit((Object)(object)val9)) { GameObject obj2 = Object.Instantiate<GameObject>(((Component)val9).gameObject, val8.transform, false); ((Object)obj2).name = "flames"; obj2.SetActive(true); obj2.transform.localPosition = Vector3.zero; obj2.transform.localRotation = Quaternion.Euler(91.6782f, 0f, 180f); obj2.transform.localScale = Vector3.one * 1.8f; RestyleFlames(obj2); } else { Logger.LogWarning((object)"HealingStaff: 'flames' not found in DvergerStaffHeal_aoe"); } GameObject val10 = new GameObject("Point light"); val10.transform.SetParent(val8.transform, false); Light obj3 = val10.AddComponent<Light>(); obj3.type = (LightType)2; obj3.color = new Color(0.8797f, 1f, 0.4549f); obj3.intensity = 2f; obj3.range = 2.54f; obj3.shadows = (LightShadows)0; GameObject prefab3 = PrefabManager.Instance.GetPrefab("StaffFireball"); Transform val11 = (Object.op_Implicit((Object)(object)prefab3) ? ((IEnumerable<Transform>)prefab3.GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "flare")) : null); if (Object.op_Implicit((Object)(object)val11)) { GameObject obj4 = Object.Instantiate<GameObject>(((Component)val11).gameObject, val8.transform, false); ((Object)obj4).name = "flare"; obj4.transform.localPosition = Vector3.zero; obj4.transform.localRotation = Quaternion.identity; obj4.transform.localScale = Vector3.one * 0.45f; ParticleSystem component = obj4.GetComponent<ParticleSystem>(); if (Object.op_Implicit((Object)(object)component)) { MainModule main = component.main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.35f, 1f, 0.7f, 0.55f)); } } else { Logger.LogWarning((object)"HealingStaff: 'flare' not found in StaffFireball"); } } private static void RestyleFlames(GameObject flames) { //IL_001b: 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) //IL_0039: 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) //IL_0060: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_0149: 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_0159: Unknown result type (might be due to invalid IL or missing references) //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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) ParticleSystem component = flames.GetComponent<ParticleSystem>(); if (!Object.op_Implicit((Object)(object)component)) { Logger.LogWarning((object)"HealingStaff: flames clone has no ParticleSystem"); return; } MainModule main = component.main; ((MainModule)(ref main)).simulationSpeed = 2f; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(1f, 1.5f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.4f, 0.6f); ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0f, 0.43712f, 0.8f, 0.35f), new Color(0f, 0.62403f, 0.65882f, 0.22f)); ShapeModule shape = component.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).angle = 0f; ((ShapeModule)(ref shape)).radius = 0.0001f; EmissionModule emission = component.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(10f); SizeOverLifetimeModule sizeOverLifetime = component.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 0.4615f, 1f, 1f), new Keyframe(1f, 1f, 1f, 1f) })); ColorOverLifetimeModule colorOverLifetime = component.colorOverLifetime; MinMaxGradient color = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color; Gradient gradient = ((MinMaxGradient)(ref color)).gradient; if (gradient != null) { GradientColorKey[] colorKeys = gradient.colorKeys; for (int i = 0; i < colorKeys.Length; i++) { colorKeys[i].color = Color.white; } gradient.colorKeys = colorKeys; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(gradient); } _flamesRenderer = flames.GetComponent<ParticleSystemRenderer>(); ApplyFlamesMaterial(); } private static void ApplyFlamesMaterial() { if (!Object.op_Implicit((Object)(object)_flamesRenderer)) { PrefabManager.OnVanillaPrefabsAvailable -= ApplyFlamesMaterial; return; } Material val = BuildHealingFlameMaterial(); if (Object.op_Implicit((Object)(object)val)) { ((Renderer)_flamesRenderer).sharedMaterial = val; PrefabManager.OnVanillaPrefabsAvailable -= ApplyFlamesMaterial; } else { PrefabManager.OnVanillaPrefabsAvailable -= ApplyFlamesMaterial; PrefabManager.OnVanillaPrefabsAvailable += ApplyFlamesMaterial; } } private static Material BuildHealingFlameMaterial() { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0202: 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_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0252: 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_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) List<Shader> list = (from s in Resources.FindObjectsOfTypeAll<Shader>() where ((Object)s).name == "Particles/Standard Unlit2" select s).ToList(); if (Object.op_Implicit((Object)(object)_fireworksMat) && Object.op_Implicit((Object)(object)_fireworksMat.shader)) { list.Insert(0, _fireworksMat.shader); } Shader val = ((IEnumerable<Shader>)list).FirstOrDefault((Func<Shader, bool>)((Shader s) => s.isSupported)); Texture2D val2 = ((IEnumerable<Texture2D>)Resources.FindObjectsOfTypeAll<Texture2D>()).FirstOrDefault((Func<Texture2D, bool>)((Texture2D t) => ((Object)t).name == "waterfog")); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2)) { if (Object.op_Implicit((Object)(object)_fireworksMat)) { Material val3 = new Material(_fireworksMat) { name = "healing_flame_fallback" }; if (val3.HasProperty("_Color")) { val3.SetColor("_Color", new Color(0f, 1f, 0.8649f, 0.35f)); } return val3; } return null; } Material val4 = new Material(val) { name = "healing_flame", renderQueue = 3000 }; val4.SetTexture("_MainTex", (Texture)(object)val2); val4.EnableKeyword("_ALPHABLEND_ON"); val4.EnableKeyword("_FADING_ON"); val4.SetFloat("_Mode", 2f); val4.SetFloat("_SrcBlend", 5f); val4.SetFloat("_DstBlend", 10f); val4.SetFloat("_ZWrite", 0f); val4.SetFloat("_Cull", 2f); val4.SetFloat("_InvFade", 3f); val4.SetFloat("_SoftParticlesEnabled", 1f); val4.SetFloat("_SoftParticlesFarFadeDistance", 0.3f); val4.SetFloat("_SoftParticlesNearFadeDistance", 0f); val4.SetFloat("_CameraFadingEnabled", 0f); val4.SetFloat("_DistortionEnabled", 0f); val4.SetFloat("_EmissionEnabled", 0f); val4.SetFloat("_LightingEnabled", 0f); val4.SetFloat("_FlipbookMode", 0f); val4.SetFloat("_ColorMode", 0f); val4.SetFloat("_Cutoff", 0.2f); val4.SetColor("_Color", new Color(0f, 1f, 0.8649f, 1f)); val4.SetColor("_TintColor", new Color(0.4338f, 0.4338f, 0.4338f, 1f)); return val4; } private static Mesh FindLoadedMesh(string name) { Mesh? obj = ((IEnumerable<Mesh>)Resources.FindObjectsOfTypeAll<Mesh>()).FirstOrDefault((Func<Mesh, bool>)((Mesh m) => ((Object)m).name == name)); if (!Object.op_Implicit((Object)(object)obj)) { Logger.LogWarning((object)("HealingStaff: mesh '" + name + "' not found")); } return obj; } private static Material FindLoadedMaterial(string name) { Material? obj = ((IEnumerable<Material>)Resources.FindObjectsOfTypeAll<Material>()).FirstOrDefault((Func<Material, bool>)((Material m) => ((Object)m).name == name)); if (!Object.op_Implicit((Object)(object)obj)) { Logger.LogWarning((object)("HealingStaff: material '" + name + "' not found")); } return obj; } private static (Mesh mesh, Material mat) FindModel(string prefabName, string meshName) { GameObject prefab = PrefabManager.Instance.GetPrefab(prefabName); if (!Object.op_Implicit((Object)(object)prefab)) { Logger.LogWarning((object)("HealingStaff: prefab '" + prefabName + "' not found")); return (mesh: null, mat: null); } MeshFilter val = null; MeshFilter[] componentsInChildren = prefab.GetComponentsInChildren<MeshFilter>(true); foreach (MeshFilter val2 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val2.sharedMesh)) { if (!Object.op_Implicit((Object)(object)val)) { val = val2; } if (((Object)val2.sharedMesh).name == meshName) { val = val2; break; } } } if (!Object.op_Implicit((Object)(object)val)) { return (mesh: null, mat: null); } MeshRenderer component = ((Component)val).GetComponent<MeshRenderer>(); return (mesh: val.sharedMesh, mat: Object.op_Implicit((Object)(object)component) ? ((Renderer)component).sharedMaterial : null); } private static EffectList MakeEffectList(params string[] prefabNames) { //IL_0073: 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_0080: Expected O, but got Unknown EffectData[] effectPrefabs = (from p in prefabNames.Select(delegate(string n) { GameObject prefab = PrefabManager.Instance.GetPrefab(n); if (!Object.op_Implicit((Object)(object)prefab)) { Logger.LogWarning((object)("HealingStaff: effect prefab '" + n + "' not found")); } return prefab; }) where Object.op_Implicit((Object)(object)p) select p).Select((Func<GameObject, EffectData>)((GameObject p) => new EffectData { m_prefab = p })).ToArray(); return new EffectList { m_effectPrefabs = effectPrefabs }; } private static void DestroyChild(GameObject root, string childName) { Transform val = root.transform.Find(childName); if (Object.op_Implicit((Object)(object)val)) { Object.DestroyImmediate((Object)(object)((Component)val).gameObject); } } }